llvm-project
a60d6982 - [clang][driver][AIX] Change linker bcdtor mode to default to mbr (#191265)

Commit
15 days ago
[clang][driver][AIX] Change linker bcdtor mode to default to mbr (#191265) The bcdtor mode affects how the AIX linker choose to pull in static constructors and destructors (https://www.ibm.com/docs/en/aix/7.2.0?topic=l-ld-command) to the link. The current setting of `all` makes static init in archive members live regardless of if the archive member would be otherwise referenced, causing that whole archive member to become part of the link. This default was initially retained for compatibility purposes with historical compilers on the platform which defaulted to this setting. Unfortunately this greedy pulling in of static init can have unintended consequences for applications, for example for programs linked against parts of compiler-rt which contain optional instrumentation (containing static initializers) which may be unused as these now become live in all programs regardless of use. For that reason and similar reasons, this PR switches the default to `mbr`, which only extracts static init from archive members which would otherwise be referenced. This gives a behaviour very consistent with linkers on other platforms (e.g. Linux). Users requiring the old default behaviour can manually pass `-bcdtors:all` on the link step which will override any default we pass here.
Author
Parents
Loading