From 0c1ded8dc0be9c61975e04a0b416b064223f7bda Mon Sep 17 00:00:00 2001 From: Renlin Li Date: Wed, 7 Mar 2018 09:27:45 +0000 Subject: [PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are resolved at static linking time. For absolute symbols which are forced local or not dynamic, the ABS relocation should be resolved at static linking time. Originally, an RELATIVE/ABS relocation will be generated even for absolution symbols for the dynamic linker to resolve. bfd/ 2018-03-07 Renlin Li PR ld/20402 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute symbol, and don't emit relocation in specific case. ld/ 2018-03-07 Renlin Li PR ld/20402 * testsuite/ld-aarch64/aarch64-elf.exp: Run new test. * testsuite/ld-aarch64/pr20402.s: New. * testsuite/ld-aarch64/pr20402.d: New. --- ld/testsuite/ld-aarch64/aarch64-elf.exp | 1 + ld/testsuite/ld-aarch64/pr20402.d | 7 +++++++ ld/testsuite/ld-aarch64/pr20402.s | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/pr20402.d create mode 100644 ld/testsuite/ld-aarch64/pr20402.s (limited to 'ld/testsuite/ld-aarch64') diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp index c67ffb1..de99a8b 100644 --- a/ld/testsuite/ld-aarch64/aarch64-elf.exp +++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp @@ -286,6 +286,7 @@ run_dump_test_lp64 "tprel_g2_overflow" run_dump_test "tprel_add_lo12_overflow" run_dump_test "protected-data" run_dump_test_lp64 "pr22764" +run_dump_test_lp64 "pr20402" # ifunc tests run_dump_test "ifunc-1" diff --git a/ld/testsuite/ld-aarch64/pr20402.d b/ld/testsuite/ld-aarch64/pr20402.d new file mode 100644 index 0000000..9cfeeb7 --- /dev/null +++ b/ld/testsuite/ld-aarch64/pr20402.d @@ -0,0 +1,7 @@ +#ld: -pie -defsym foo=0x1 -defsym bar=0x2 +#readelf: -r + +Relocation section '\.rela\.dyn' at offset .* contains 2 entries: + Offset Info Type Sym\. Value Sym\. Name \+ Addend +000000000000 000000000000 R_AARCH64_NONE 0 +000000000000 000000000000 R_AARCH64_NONE 0 diff --git a/ld/testsuite/ld-aarch64/pr20402.s b/ld/testsuite/ld-aarch64/pr20402.s new file mode 100644 index 0000000..b18c5e7 --- /dev/null +++ b/ld/testsuite/ld-aarch64/pr20402.s @@ -0,0 +1,6 @@ + .text + .global _start + .hidden foo +_start: + .xword foo + .xword bar -- cgit v1.1