From 6a4837657a02883bda341796fe407ee988cd0695 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 19 Oct 2006 13:42:17 +0000 Subject: [PATCH] bfd/ * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG and DT_MIPS_RLD_MAP tags for position-independent executables. Do not add DT_DEBUG to shared libraries for any MIPS target. ld/testsuite/ * ld-mips-elf/multi-got-1.d: Remove DT_DEBUG tag. Do not require a specific file offset for .dynamic. Reduce DT_HASH by 8 to account for removed tag. * ld-mips-elf/tls-multi-got-1.r: Likewise. Also reduce DT_REL by 8. Reduce PLTGOT and symbol values by 16 to account for the removed tag. * ld-mips-elf/textrel-1.d: Remove DT_DEBUG tag. * ld-mips-elf/rel32-n32.d: Reduce addresses by 16 to account for removed DT_DEBUG tag. * ld-mips-elf/rel64.d: Likewise. * ld-mips-elf/tls-multi-got-1.got: Likewise. * ld-mips-elf/tlslib-o32-hidden.got: Likewise. --- bfd/ChangeLog | 6 +++++ bfd/elfxx-mips.c | 11 +-------- ld/testsuite/ChangeLog | 14 +++++++++++ ld/testsuite/ld-mips-elf/multi-got-1.d | 5 ++-- ld/testsuite/ld-mips-elf/rel32-n32.d | 6 ++--- ld/testsuite/ld-mips-elf/rel64.d | 6 ++--- ld/testsuite/ld-mips-elf/textrel-1.d | 3 +-- ld/testsuite/ld-mips-elf/tls-multi-got-1.got | 34 +++++++++++++------------- ld/testsuite/ld-mips-elf/tls-multi-got-1.r | 17 ++++++------- ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got | 14 +++++------ 10 files changed, 62 insertions(+), 54 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3bc36e4..7919e95 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-10-19 Richard Sandiford + + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG + and DT_MIPS_RLD_MAP tags for position-independent executables. + Do not add DT_DEBUG to shared libraries for any MIPS target. + 2006-10-18 H.J. Lu PR ld/3290 diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 66cdf14..aea0273 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7478,7 +7478,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, must add the entries now so that we get the correct size for the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ - if (! info->shared) + if (info->executable) { /* SGI object has the equivalence of DT_DEBUG in the DT_MIPS_RLD_MAP entry. */ @@ -7490,15 +7490,6 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, return FALSE; } } - else - { - /* Shared libraries on traditional mips have DT_DEBUG. */ - if (!SGI_COMPAT (output_bfd)) - { - if (!MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0)) - return FALSE; - } - } if (reltext && (SGI_COMPAT (output_bfd) || htab->is_vxworks)) info->flags |= DF_TEXTREL; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index fd5bee9..da65ae6 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2006-10-19 Richard Sandiford + + * ld-mips-elf/multi-got-1.d: Remove DT_DEBUG tag. Do not require + a specific file offset for .dynamic. Reduce DT_HASH by 8 to account + for removed tag. + * ld-mips-elf/tls-multi-got-1.r: Likewise. Also reduce DT_REL by 8. + Reduce PLTGOT and symbol values by 16 to account for the removed tag. + * ld-mips-elf/textrel-1.d: Remove DT_DEBUG tag. + * ld-mips-elf/rel32-n32.d: Reduce addresses by 16 to account for + removed DT_DEBUG tag. + * ld-mips-elf/rel64.d: Likewise. + * ld-mips-elf/tls-multi-got-1.got: Likewise. + * ld-mips-elf/tlslib-o32-hidden.got: Likewise. + 2006-10-18 H.J. Lu PR ld/3290 diff --git a/ld/testsuite/ld-mips-elf/multi-got-1.d b/ld/testsuite/ld-mips-elf/multi-got-1.d index 1ba5f4b..610cfad 100644 --- a/ld/testsuite/ld-mips-elf/multi-got-1.d +++ b/ld/testsuite/ld-mips-elf/multi-got-1.d @@ -5,14 +5,13 @@ #ld: -melf32btsmip -shared #readelf: -d -r -Dynamic section at offset 0xcc contains 18 entries: +Dynamic section at offset .* contains 17 entries: Tag Type Name/Value - 0x00000004 \(HASH\) 0x184 + 0x00000004 \(HASH\) 0x17c 0x00000005 \(STRTAB\) 0x[0-9a-f]+ 0x00000006 \(SYMTAB\) 0x[0-9a-f]+ 0x0000000a \(STRSZ\) [0-9]+ \(bytes\) 0x0000000b \(SYMENT\) 16 \(bytes\) - 0x00000015 \(DEBUG\) 0x0 0x00000003 \(PLTGOT\) 0x[0-9a-f]+ 0x00000011 \(REL\) 0x[0-9a-f]+ 0x00000012 \(RELSZ\) 65544 \(bytes\) diff --git a/ld/testsuite/ld-mips-elf/rel32-n32.d b/ld/testsuite/ld-mips-elf/rel32-n32.d index 3c6b093..3764f40 100644 --- a/ld/testsuite/ld-mips-elf/rel32-n32.d +++ b/ld/testsuite/ld-mips-elf/rel32-n32.d @@ -10,6 +10,6 @@ Relocation section '.rel.dyn' at offset .* contains 2 entries: [0-9a-f ]+R_MIPS_REL32 Hex dump of section '.text': - 0x000002d0 00000000 00000000 00000000 00000000 ................ - 0x000002e0 000002e0 00000000 00000000 00000000 ................ - 0x000002f0 00000000 00000000 00000000 00000000 ................ + 0x000002c0 00000000 00000000 00000000 00000000 ................ + 0x000002d0 000002d0 00000000 00000000 00000000 ................ + 0x000002e0 00000000 00000000 00000000 00000000 ................ diff --git a/ld/testsuite/ld-mips-elf/rel64.d b/ld/testsuite/ld-mips-elf/rel64.d index 34b3b45..c3e0913 100644 --- a/ld/testsuite/ld-mips-elf/rel64.d +++ b/ld/testsuite/ld-mips-elf/rel64.d @@ -14,6 +14,6 @@ Relocation section '.rel.dyn' at offset .* contains 2 entries: +Type3: R_MIPS_NONE Hex dump of section '.text': - 0x00000430 00000000 00000000 00000000 00000000 ................ - 0x00000440 00000000 00000440 00000000 00000000 ................ - 0x00000450 00000000 00000000 00000000 00000000 ................ + 0x00000420 00000000 00000000 00000000 00000000 ................ + 0x00000430 00000000 00000430 00000000 00000000 ................ + 0x00000440 00000000 00000000 00000000 00000000 ................ diff --git a/ld/testsuite/ld-mips-elf/textrel-1.d b/ld/testsuite/ld-mips-elf/textrel-1.d index 945c863..16bd727 100644 --- a/ld/testsuite/ld-mips-elf/textrel-1.d +++ b/ld/testsuite/ld-mips-elf/textrel-1.d @@ -4,14 +4,13 @@ #ld: -shared -melf32btsmipn32 #readelf: -d -Dynamic section at offset .* contains 18 entries: +Dynamic section at offset .* contains 17 entries: Tag Type Name/Value 0x00000004 \(HASH\) 0x[0-9a-f]* 0x00000005 \(STRTAB\) 0x[0-9a-f]* 0x00000006 \(SYMTAB\) 0x[0-9a-f]* 0x0000000a \(STRSZ\) [0-9]* \(bytes\) 0x0000000b \(SYMENT\) 16 \(bytes\) - 0x00000015 \(DEBUG\) 0x0 0x00000003 \(PLTGOT\) 0x[0-9a-f]* 0x00000011 \(REL\) 0x[0-9a-f]* 0x00000012 \(RELSZ\) 8 \(bytes\) diff --git a/ld/testsuite/ld-mips-elf/tls-multi-got-1.got b/ld/testsuite/ld-mips-elf/tls-multi-got-1.got index 7e113d6..1d5e216 100644 --- a/ld/testsuite/ld-mips-elf/tls-multi-got-1.got +++ b/ld/testsuite/ld-mips-elf/tls-multi-got-1.got @@ -4,17 +4,17 @@ DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE \*ABS\* -001495c0 R_MIPS_TLS_DTPMOD32 \*ABS\* -0013f938 R_MIPS_TLS_DTPMOD32 \*ABS\* -001495cc R_MIPS_TLS_DTPMOD32 tlsvar_gd -001495d0 R_MIPS_TLS_DTPREL32 tlsvar_gd -0013f944 R_MIPS_TLS_DTPMOD32 tlsvar_gd -0013f948 R_MIPS_TLS_DTPREL32 tlsvar_gd -001495c8 R_MIPS_TLS_TPREL32 tlsvar_ie -0013f940 R_MIPS_TLS_TPREL32 tlsvar_ie -00143f6c R_MIPS_REL32 sym_1_9526 +001495b0 R_MIPS_TLS_DTPMOD32 \*ABS\* +0013f928 R_MIPS_TLS_DTPMOD32 \*ABS\* +001495bc R_MIPS_TLS_DTPMOD32 tlsvar_gd +001495c0 R_MIPS_TLS_DTPREL32 tlsvar_gd +0013f934 R_MIPS_TLS_DTPMOD32 tlsvar_gd +0013f938 R_MIPS_TLS_DTPREL32 tlsvar_gd +001495b8 R_MIPS_TLS_TPREL32 tlsvar_ie +0013f930 R_MIPS_TLS_TPREL32 tlsvar_ie +00143f5c R_MIPS_REL32 sym_1_9526 #... -00139bc0 R_MIPS_REL32 sym_2_8654 +00139bb0 R_MIPS_REL32 sym_2_8654 00000000 R_MIPS_NONE \*ABS\* 00000000 R_MIPS_NONE \*ABS\* 00000000 R_MIPS_NONE \*ABS\* @@ -40,19 +40,19 @@ OFFSET TYPE VALUE Contents of section .got: - 122410 00000000 80000000 00000000 00000000 .* + 122400 00000000 80000000 00000000 00000000 .* + 122410 00000000 00000000 00000000 00000000 .* 122420 00000000 00000000 00000000 00000000 .* - 122430 00000000 00000000 00000000 00000000 .* - 122440 00000000 000d8038 000d6694 000d2044 .* + 122430 00000000 000d8028 000d6684 000d2034 .* #... + 13f910 00000000 00000000 00000000 00000000 .* 13f920 00000000 00000000 00000000 00000000 .* 13f930 00000000 00000000 00000000 00000000 .* - 13f940 00000000 00000000 00000000 00000000 .* - 13f950 80000000 00000000 00000000 00000000 .* + 13f940 80000000 00000000 00000000 00000000 .* #... + 149580 00000000 00000000 00000000 00000000 .* 149590 00000000 00000000 00000000 00000000 .* 1495a0 00000000 00000000 00000000 00000000 .* 1495b0 00000000 00000000 00000000 00000000 .* - 1495c0 00000000 00000000 00000000 00000000 .* - 1495d0 00000000 .* + 1495c0 00000000 .* #pass diff --git a/ld/testsuite/ld-mips-elf/tls-multi-got-1.r b/ld/testsuite/ld-mips-elf/tls-multi-got-1.r index 51f3ab1..3befcd7 100644 --- a/ld/testsuite/ld-mips-elf/tls-multi-got-1.r +++ b/ld/testsuite/ld-mips-elf/tls-multi-got-1.r @@ -1,14 +1,13 @@ -Dynamic section at offset 0xec contains 19 entries: +Dynamic section at offset .* contains 18 entries: Tag Type Name/Value - 0x00000004 \(HASH\) 0x1ac + 0x00000004 \(HASH\) 0x1a4 0x00000005 \(STRTAB\).* 0x00000006 \(SYMTAB\).* 0x0000000a \(STRSZ\) 220091 \(bytes\) 0x0000000b \(SYMENT\) 16 \(bytes\) - 0x00000015 \(DEBUG\) 0x0 - 0x00000003 \(PLTGOT\) 0x122410 - 0x00000011 \(REL\) 0xa7960 + 0x00000003 \(PLTGOT\) 0x122400 + 0x00000011 \(REL\) 0xa7958 0x00000012 \(RELSZ\) 160072 \(bytes\) 0x00000013 \(RELENT\) 8 \(bytes\) 0x70000001 \(MIPS_RLD_VERSION\) 1 @@ -32,9 +31,9 @@ Relocation section '\.rel\.dyn' at offset 0x[0-9a-f]+ contains 20031 entries: [0-9a-f ]+R_MIPS_TLS_DTPREL 00000000 tlsvar_gd [0-9a-f ]+R_MIPS_TLS_TPREL3 00000004 tlsvar_ie [0-9a-f ]+R_MIPS_TLS_TPREL3 00000004 tlsvar_ie -[0-9a-f ]+R_MIPS_REL32 000d8038 sym_1_9526 -[0-9a-f ]+R_MIPS_REL32 000d6694 sym_1_7885 +[0-9a-f ]+R_MIPS_REL32 000d8028 sym_1_9526 +[0-9a-f ]+R_MIPS_REL32 000d6684 sym_1_7885 #... -[0-9a-f ]+R_MIPS_REL32 000cf2a4 sym_1_0465 -[0-9a-f ]+R_MIPS_REL32 000e0ee8 sym_2_8654 +[0-9a-f ]+R_MIPS_REL32 000cf294 sym_1_0465 +[0-9a-f ]+R_MIPS_REL32 000e0ed8 sym_2_8654 #... diff --git a/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got b/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got index e1d64e0..22d048a 100644 --- a/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got +++ b/ld/testsuite/ld-mips-elf/tlslib-o32-hidden.got @@ -4,13 +4,13 @@ DYNAMIC RELOCATION RECORDS OFFSET TYPE VALUE 00000000 R_MIPS_NONE \*ABS\* -000403cc R_MIPS_TLS_DTPMOD32 \*ABS\* -000403c4 R_MIPS_TLS_DTPMOD32 \*ABS\* -000403c0 R_MIPS_TLS_TPREL32 \*ABS\* +000403bc R_MIPS_TLS_DTPMOD32 \*ABS\* +000403b4 R_MIPS_TLS_DTPMOD32 \*ABS\* +000403b0 R_MIPS_TLS_TPREL32 \*ABS\* Contents of section .got: - 403a0 00000000 80000000 00000000 00000000 ................ - 403b0 00000000 00000000 00000000 00000370 ................ - 403c0 00000008 00000000 00000000 00000000 ................ - 403d0 ffff8004 .... + 40390 00000000 80000000 00000000 00000000 ................ + 403a0 00000000 00000000 00000000 00000360 ................ + 403b0 00000008 00000000 00000000 00000000 ................ + 403c0 ffff8004 .... -- 2.7.4