This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mips64-elf .rel.dyn sections


On Tue, Dec 04, 2012 at 07:32:11PM +0000, Jim Wilson (jimwilso) wrote:
> > I can try this on a full router image build here to see what happens.  This will
> > probably take a day.
> 
> I rebuilt a mips router image.  The original unpatched binutils generated a ~13.5KB .rel.dyn section.  The new one has no .rel.dyn section as I expect, and otherwise looks OK.

Committed.

bfd/
	* elfxx-mips.c (allocate_dynrelocs): Correct test for symbol
	defined in a regular file to include common symbols.
ld/testsuite/
	* ld-elf/comm-data4.d, ld-elf/comm-data4.s: New test.
	* ld-elf/comm-data5.d, ld-elf/comm-data5.s: New test.
	* ld-elf/comm-data.exp: Run them.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.319
diff -u -p -r1.319 elfxx-mips.c
--- bfd/elfxx-mips.c	3 Dec 2012 16:37:51 -0000	1.319
+++ bfd/elfxx-mips.c	5 Dec 2012 07:20:47 -0000
@@ -8568,7 +8568,7 @@ allocate_dynrelocs (struct elf_link_hash
   if (! info->relocatable
       && hmips->possibly_dynamic_relocs != 0
       && (h->root.type == bfd_link_hash_defweak
-	  || !h->def_regular
+	  || (!h->def_regular && !ELF_COMMON_DEF_P (h))
 	  || info->shared))
     {
       bfd_boolean do_copy = TRUE;
Index: ld/testsuite/ld-elf/comm-data.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-elf/comm-data.exp,v
retrieving revision 1.5
diff -u -p -r1.5 comm-data.exp
--- ld/testsuite/ld-elf/comm-data.exp	21 Nov 2012 19:31:24 -0000	1.5
+++ ld/testsuite/ld-elf/comm-data.exp	5 Dec 2012 07:20:50 -0000
@@ -98,3 +98,6 @@ run_ld_link_tests [list \
 	"comm-data3b" \
     ] \
 ]
+
+run_dump_test comm-data4
+run_dump_test comm-data5
Index: ld/testsuite/ld-elf/comm-data4.d
===================================================================
RCS file: ld/testsuite/ld-elf/comm-data4.d
diff -N ld/testsuite/ld-elf/comm-data4.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/comm-data4.d	5 Dec 2012 23:59:53 -0000
@@ -0,0 +1,6 @@
+#source: comm-data4.s
+#ld: 
+#readelf: -r
+#notarget: hppa64*-*-hpux*
+
+There are no relocations in this file.
Index: ld/testsuite/ld-elf/comm-data4.s
===================================================================
RCS file: ld/testsuite/ld-elf/comm-data4.s
diff -N ld/testsuite/ld-elf/comm-data4.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/comm-data4.s	5 Dec 2012 23:59:53 -0000
@@ -0,0 +1,15 @@
+ .comm i,4,4
+
+ .data
+ .dc.a i
+
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .dc.a 0
Index: ld/testsuite/ld-elf/comm-data5.d
===================================================================
RCS file: ld/testsuite/ld-elf/comm-data5.d
diff -N ld/testsuite/ld-elf/comm-data5.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/comm-data5.d	5 Dec 2012 23:59:53 -0000
@@ -0,0 +1,6 @@
+#source: comm-data5.s
+#ld: 
+#readelf: -r
+#notarget: hppa64*-*-hpux*
+
+There are no relocations in this file.
Index: ld/testsuite/ld-elf/comm-data5.s
===================================================================
RCS file: ld/testsuite/ld-elf/comm-data5.s
diff -N ld/testsuite/ld-elf/comm-data5.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ld/testsuite/ld-elf/comm-data5.s	5 Dec 2012 23:59:53 -0000
@@ -0,0 +1,15 @@
+ .comm i,4,4
+
+ .section .rodata,"a",%progbits
+ .dc.a i
+
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .dc.a 0

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]