Bug 25891 - ld: Implement --[no-]apply-dynamic-relocs
Summary: ld: Implement --[no-]apply-dynamic-relocs
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.35
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-29 06:06 UTC by Fangrui Song
Modified: 2020-04-29 06:06 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2020-04-29 06:06:06 UTC
GNU ld supports --no-apply-dynamic-relocs, but only for aarch64:

% aarch64-linux-gnu-ld --no-apply-dynamic-relocs a.o
% aarch64-linux-gnu-ld --apply-dynamic-relocs a.o 
aarch64-linux-gnu-ld: unrecognized option '--apply-dynamic-relocs'
aarch64-linux-gnu-ld: use the --help option for usage information

# gold and LLD support both and all targets support the option.

% aarch64-linux-gnu-ld.gold --apply-dynamic-relocs a.o
% aarch64-linux-gnu-ld.gold --no-apply-dynamic-relocs a.o


--no-apply-dynamic-relocs can rule out bugs (LLD defaults to --no-apply-dynamic-relocsc https://github.com/llvm/llvm-project/commit/0e4df539fa2c10a2ee55a7ed4d54afc381d73ab6) and arguably is slightly better because zeros compress better.