[SERVER-54928] Investigate injection of libdeps tags via ARFLAGS Created: 03/Mar/21  Updated: 29/Oct/23  Resolved: 30/Mar/21

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

Type: Task Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Daniel Moody
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Dev Platform 2021-03-22, Dev Platform 2021-04-05
Participants:

 Description   

In SERVER-51318, a fix to link tags was made that achieved its effects by adding expansions to ARFLAGS, but this should not have had the intended effect, since AR isn't used at link time. Investigate why this fix has the effects it does, and see if there is another way to achieve the same thing.



 Comments   
Comment by Githook User [ 29/Mar/21 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-54928 switch no-init-global flags to be stored on node instead of env.
Branch: master
https://github.com/mongodb/mongo/commit/7c3a9eff515d5137e3f4f40bdad4744fe62b4e54

Comment by Daniel Moody [ 22/Mar/21 ]

Code Review: https://mongodbcr.appspot.com/774100017/

Comment by Daniel Moody [ 16/Mar/21 ]

after some discussion on scons discord, bdbaddog suggested storing pre/post flag information on the target node in an emitter: https://discord.com/channels/571796279483564041/612459756246007829/821453516672335902

This will remove the need to the ARFLAGS subst.

Comment by Daniel Moody [ 09/Mar/21 ]

Okay I did some digging and this is how its working:

The ARFLAGS are assigned _LIBDEPS_TAGS so that all static libraries we build will run the expansions. AR is used for creating the .a libraries which are linked with the linker. One of the expansions that we assign globally is the no_global_init expansion. This needs to expand for every static library, modifying that static library node environment, to set the pre and post flags for that node environment if it has the no_global_init tag.

Later in the build when we go to get the libdeps for linking with the linker, every libdep is converted to a node, and that node env checked if it has the pre and postfix flags that were set in the original expansion per static library node, and then added to the link line if necessary.

 

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