Issue metadata
Sign in to add a comment
|
aarch64 gold linker should use --apply-dynamic-relocs by default |
||||||||||||||||||||||
Issue descriptionThis flag was added to gold specifically for Android: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0eccf19f96d6218dd7c2f8d13f0546c2b942cc08 Upstream has '--apply-dynamic-relocs' as default. Android sets '--no-apply-dynamic-relocs' as the default: https://android-review.googlesource.com/368019 The issue does not effect the glibc dynamic linker used in Chromium OS. We should switch the default back to '--apply-dynamic-relocs'. There are known cases of debug information getting dropped due to the current setting.
,
Apr 2 2018
Correction: aarch64 ld.bfd linker also supports the '--no-apply-dynamic-relocs' flag. Default is '--apply-dynamic-relocs'.
,
Apr 5 2018
Small testcase:
$ cat a.c
int g_a = 123;
$ aarch64-cros-linux-gnu-clang -g -c a.c
$ aarch64-cros-linux-gnu-ld.gold -shared -o liba.so a.o
$ llvm-dwarfdump liba.so
...
0x0000001e: DW_TAG_variable
DW_AT_name ("g_a")
DW_AT_type (cu + 0x0033 "int")
DW_AT_external (true)
DW_AT_decl_file ("a.c")
DW_AT_decl_line (1)
DW_AT_location (DW_OP_addr 0x0) <---- The address 0x0 is due to dynamic relocations not getting applied in debug info.
...
$ aarch64-cros-linux-gnu-ld.gold --apply-dynamic-relocs -shared -o liba.so a.o
$ llvm-dwarfdump liba.so
...
0x0000001e: DW_TAG_variable
DW_AT_name ("g_a")
DW_AT_type (cu + 0x0033 "int")
DW_AT_external (true)
DW_AT_decl_file ("a.c")
DW_AT_decl_line (1)
DW_AT_location (DW_OP_addr 0x20000) <---- The address is non-zero when --apply-dynamic-relocs is passed to the linker.
...
,
Apr 6 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/73ace4c1288c2786c4a231630335a0dc8c7aa97e commit 73ace4c1288c2786c4a231630335a0dc8c7aa97e Author: Rahul Chaudhry <rahulchaudhry@chromium.org> Date: Fri Apr 06 21:44:08 2018 sys-devel/binutils: turn on --apply-dynamic-relocs by default. This change applies to the gold linker only, and for aarch64 only. '--apply-dynamic-relocs' is also the default in upstream binutils. BUG= chromium:828169 TEST='sudo emerge cross-aarch64-cros-linux-gnu/binutils' works. TEST=The test from crbug/828169 works. Change-Id: I8b9dcf5a001bcea673e6d1ebb8358bd91e3c72cc Reviewed-on: https://chromium-review.googlesource.com/999176 Commit-Ready: Rahul Chaudhry <rahulchaudhry@chromium.org> Tested-by: Rahul Chaudhry <rahulchaudhry@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> [add] https://crrev.com/73ace4c1288c2786c4a231630335a0dc8c7aa97e/sys-devel/binutils/files/binutils-2.27.0-apply_dynamic_relocs.patch [modify] https://crrev.com/73ace4c1288c2786c4a231630335a0dc8c7aa97e/sys-devel/binutils/binutils-9999.ebuild
,
Apr 6 2018
,
Apr 27 2018
why land this as a patch instead of committing directly to the binutils git repo we have specifically for holding our code ?
,
Apr 27 2018
The source git repo is shared with Android, and they want to keep the other default.
,
May 7 2018
you can make it into a configure flag so that we pass it at configure time. and try sending that upstream too. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by rahulchaudhry@chromium.org
, Apr 2 2018