diff options
author | Alan Modra <amodra@gmail.com> | 2016-05-13 11:48:56 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-05-13 14:34:45 +0930 |
commit | 4ade44b727ee77adaa9c22719935d012e253a5e6 (patch) | |
tree | b8245860459f263489810f5ad2a3a0dc1bc1c5df /ld | |
parent | c8e44c6d168f8e68b7bbb1119065e0059a16fe34 (diff) | |
download | gdb-4ade44b727ee77adaa9c22719935d012e253a5e6.zip gdb-4ade44b727ee77adaa9c22719935d012e253a5e6.tar.gz gdb-4ade44b727ee77adaa9c22719935d012e253a5e6.tar.bz2 |
Set dynamic tag VMA and size from dynamic section when possible
Rather than searching the output for a specific named section, it's
better, where possible, to use a linker created dynamic section to set
a dynamic tag's value. That way ld doesn't depend on the output
section name, making it possibile to map dynamic sections differently.
bfd/
* elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_sections): Use
linker dynamic sections in calculating size and address of
* dynamic tags rather than using output sections. Remove asserts.
* elf32-arm.c (elf32_arm_finish_dynamic_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_finish_dynamic_sections): Likewise.
* elf32-cris.c (elf_cris_finish_dynamic_sections): Likewise.
* elf32-i370.c (i370_elf_finish_dynamic_sections): Likewise.
* elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_finish_dynamic_sections): Likewise.
* elf32-m68k.c (elf_m68k_finish_dynamic_sections): Likewise.
* elf32-metag.c (elf_metag_finish_dynamic_sections): Likewise.
* elf32-microblaze.c (microblaze_elf_finish_dynamic_sections): Likewise.
* elf32-nds32.c (nds32_elf_finish_dynamic_sections): Likewise.
* elf32-nios2.c (nios2_elf32_finish_dynamic_sections): Likewise.
* elf32-or1k.c (or1k_elf_finish_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_finish_dynamic_sections): Likewise.
* elf32-score.c (s3_bfd_score_elf_finish_dynamic_sections): Likewise.
* elf32-score7.c (s7_bfd_score_elf_finish_dynamic_sections): Likewise.
* elf32-vax.c (elf_vax_finish_dynamic_sections): Likewise.
* elf32-xtensa.c (elf_xtensa_finish_dynamic_sections): Likewise.
* elf64-alpha.c (elf64_alpha_finish_dynamic_sections): Likewise.
* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
* elf64-sh64.c (sh64_elf64_finish_dynamic_sections): Likewise.
* elflink.c (bfd_elf_final_link): Likewise.
* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Likewise.
* elfxx-sparc.c (sparc_finish_dyn): Likewise. Adjust error message.
* elf32-arc.c (GET_SYMBOL_OR_SECTION): Remove ASSERT arg and
don't set doit. Look up dynobj section.
(elf_arc_finish_dynamic_sections): Adjust GET_SYMBOL_OR_SECTION
invocation and dynamic tag vma calculation. Don't test
boolean var == TRUE.
* elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_sections): Fix
DT_JMPREL calc.
ld/
* testsuite/ld-arm/arm-elf.exp: Adjust for arm-no-rel-plt now passing.
Use different output file name for static app without .rel.plt.
* testsuite/ld-arm/arm-no-rel-plt.ld: Align .rel.dyn and .rela.dyn.
* testsuite/ld-arm/arm-no-rel-plt.out: Delete.
* testsuite/ld-arm/arm-no-rel-plt.r: New.
* testsuite/ld-arm/arm-static-app.d: Don't check file name.
* testsuite/ld-arm/arm-static-app.r: Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-elf.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-no-rel-plt.ld | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-no-rel-plt.out | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-no-rel-plt.r | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-static-app.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/arm-static-app.r | 2 |
7 files changed, 26 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 6480439..6587105 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2016-05-13 Alan Modra <amodra@gmail.com> + + * testsuite/ld-arm/arm-elf.exp: Adjust for arm-no-rel-plt now passing. + Use different output file name for static app without .rel.plt. + * testsuite/ld-arm/arm-no-rel-plt.ld: Align .rel.dyn and .rela.dyn. + * testsuite/ld-arm/arm-no-rel-plt.out: Delete. + * testsuite/ld-arm/arm-no-rel-plt.r: New. + * testsuite/ld-arm/arm-static-app.d: Don't check file name. + * testsuite/ld-arm/arm-static-app.r: Likewise. + 2016-05-12 H.J. Lu <hongjiu.lu@intel.com> PR ld/20070 diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index f34ce5f..db25a8d 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -286,11 +286,11 @@ set armelftests_nonacl { {"Simple static application without .rel.plt in linker script" "-T arm-no-rel-plt.ld" "" "" {arm-static-app.s} {{objdump -fdw arm-static-app.d} {objdump -rw arm-static-app.r}} - "arm-static-app"} + "arm-static-app-no-rel-plt"} {"Simple dynamic application without .rel.plt in linker script" "tmpdir/arm-lib.so -T arm-no-rel-plt.ld" "" "" {arm-app.s} - {{ld arm-no-rel-plt.out}} - "arm-app"} + {{readelf -dr arm-no-rel-plt.r}} + "arm-app-no-rel-plt"} {"Non-pcrel function reference" "tmpdir/arm-lib.so" "" "" {arm-app-abs32.s} {{objdump -fdw arm-app-abs32.d} {objdump -Rw arm-app-abs32.r}} "arm-app-abs32"} diff --git a/ld/testsuite/ld-arm/arm-no-rel-plt.ld b/ld/testsuite/ld-arm/arm-no-rel-plt.ld index 391e663..d175a3d 100644 --- a/ld/testsuite/ld-arm/arm-no-rel-plt.ld +++ b/ld/testsuite/ld-arm/arm-no-rel-plt.ld @@ -14,7 +14,7 @@ SECTIONS .gnu.version : { *(.gnu.version) } .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } - .rel.dyn : + .rel.dyn ALIGN (0x100) : { *(.rel.init) *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) @@ -34,7 +34,7 @@ SECTIONS PROVIDE_HIDDEN (__rela_iplt_start = .); PROVIDE_HIDDEN (__rela_iplt_end = .); } - .rela.dyn : + .rela.dyn ALIGN (0x100) : { *(.rela.init) *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) diff --git a/ld/testsuite/ld-arm/arm-no-rel-plt.out b/ld/testsuite/ld-arm/arm-no-rel-plt.out deleted file mode 100644 index 948d5a5..0000000 --- a/ld/testsuite/ld-arm/arm-no-rel-plt.out +++ /dev/null @@ -1,2 +0,0 @@ -.*: error: required section '.rel.plt' not found in the linker script -.*: final link failed: Invalid operation diff --git a/ld/testsuite/ld-arm/arm-no-rel-plt.r b/ld/testsuite/ld-arm/arm-no-rel-plt.r new file mode 100644 index 0000000..686957e --- /dev/null +++ b/ld/testsuite/ld-arm/arm-no-rel-plt.r @@ -0,0 +1,9 @@ +#... + 0x00000017 \(JMPREL\) +0x.*08 + 0x00000011 \(REL\) +0x.*00 +#... + +Relocation section '\.rel\.dyn' at offset 0x.*00 contains 2 entries: + Offset +Info +Type +Sym\.Value +Sym\. Name +.* R_ARM_COPY .* data_obj +.* R_ARM_JUMP_SLOT .* lib_func1 diff --git a/ld/testsuite/ld-arm/arm-static-app.d b/ld/testsuite/ld-arm/arm-static-app.d index 40355c8..9547cd9 100644 --- a/ld/testsuite/ld-arm/arm-static-app.d +++ b/ld/testsuite/ld-arm/arm-static-app.d @@ -1,5 +1,5 @@ -tmpdir/arm-static-app: file format elf32-(little|big)arm.* +.*: file format elf32-(little|big)arm.* architecture: arm.*, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x.* diff --git a/ld/testsuite/ld-arm/arm-static-app.r b/ld/testsuite/ld-arm/arm-static-app.r index 92df70e..cad5905 100644 --- a/ld/testsuite/ld-arm/arm-static-app.r +++ b/ld/testsuite/ld-arm/arm-static-app.r @@ -1,3 +1,3 @@ -tmpdir/arm-static-app: file format elf32-(little|big)arm.* +.*: file format elf32-(little|big)arm.* |