[SERVER-63400] mongo_csfle_shlib_test can fail to build with -gsplit-dwarf Created: 08/Feb/22  Updated: 29/Oct/23  Resolved: 10/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.0

Type: Bug Priority: Major - P3
Reporter: Ryan Egesdahl (Inactive) Assignee: Ryan Egesdahl (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.2, v5.0
Sprint: Dev Platform 2022-02-21
Participants:

 Description   

Building mongo_csfle_shlib_test with --link-model=dynamic and -gsplit-dwarf fails with a linker error that looks like this:

/opt/mongodbtoolchain/v3/bin/ld.gold: warning: build/opt/mongo/db/modules/enterprise/src/fle/lib/mongo_csfle_shlib_test.dwo: missing .note.GNU-stack section implies executable stack
/opt/mongodbtoolchain/v3/bin/ld.gold: error: treating warnings as errors
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [build/opt/mongo/db/modules/enterprise/src/fle/lib/mongo_csfle_shlib_test] Error 1
scons: building terminated because of errors.

This is happening because we're using a SCons Object to create a shared library for the test. However, if -gsplit-dwarf is enabled, the list of object files includes a .dwo, which indeed does not have a .note.GNU-stack section because it is not really an object file meant for linking. We know there will only be one object file for linking, so we just need to be specific about that.



 Comments   
Comment by Githook User [ 10/Feb/22 ]

Author:

{'name': 'Ryan Egesdahl', 'email': 'ryan.egesdahl@mongodb.com', 'username': 'deriamis'}

Message: SERVER-63400 mongo_csfle_shlib_test should build with -gsplit-dwarf

Developers using -gsplit-dwarf for build performance with dynamic
linking were having trouble building mongo_csfle_shlib_test because it
was inadvertently trying to link against the `.dwo`. Now it will only
link with the actual object file.
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/40fc0246a67fecacffd4800c6803fe4e47de468b

Generated at Thu Feb 08 05:57:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.