[PATCH] D42748: [ELF] Don't create a .dynamic section when linking with -Bstatic
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 09:17:06 PDT 2019
MaskRay added a comment.
@arichardson @emaste @kib
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236165 was raised again recently.
I'll reiterate that I think lld's current behavior (after rL295240 <https://reviews.llvm.org/rL295240>) is quite reasonable.
> lld: has_dso || --shared || --pie || --export-dynamic
> gold: has_dso || --shared || --pie
> bfd: (--shared || --pie) || ((not -r) && info->nointerp && (info->export_dynamic || info->dynamic)) && some (almost always true) conditions
The following example demonstrates why ld.bfd's behavior is unreasonable.
% cat <e >> a.s
.globl _start
_start:
e
% as a.s -o a.o
% ld.bfd a.o --export-dynamic -o a; readelf -S a | grep -c dynsym
0
% ld.bfd a.o --no-dynamic-linker --export-dynamic -o a; readelf -S a | grep -c dynsym
1
`--no-dynamic-linker` was invented to fix its historical mistake: hard-coded ld.so path (e.g. `/lib/ld64.so.1` on x86-64). The fallout caused trouble to static pie (so a new -static-pie was invented).
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D42748/new/
https://reviews.llvm.org/D42748
More information about the llvm-commits
mailing list