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: PATCH: PR ld/6931: COMDAT group is broken


On Fri, Oct 03, 2008 at 07:16:16PM +0930, Alan Modra wrote:
> The elf.c and elflink.c patches below teach the ELF backend linker to
> handle group signature symbols for ld -r.  The genelf.em patch does
> the same for ELF targets that use the generic linker.
> 
> The linker.c change fixes the group section contents for the generic
> linker, a nasty hack but nothing else seemed nice either.  Prior to
> this change, the generic linker simply copied group section contents
> to output for ld -r, which, since section indices almost always
> change, broke groups.  The generic linker also mashed together group
> sections due to lack of unique sections for groups.  Moving this logic
> from elf32.em into ldlang.c cures that particular problem.
> 
> Finally, I tweaked the various emulation's place_orphan code to not
> use an existing output section statement if it did not already have a
> bfd section.  This is because a new bfd section will be created after
> all other existing sections, which is probably the wrong ordering.
> lang_place_orphan knows how to rearrange sections.
> 

I checked in this patch to update the testcases.


H.J.
---
binutils/testsuite/

2008-10-03  H.J. Lu  <hongjiu.lu@intel.com>

	* binutils-all/group.s: Updated.
	* binutils-all/group-2.s: Likewise.
	* binutils-all/group-3.s: Likewise.
	* binutils-all/group-4.s: Likewise.
	* binutils-all/strip-7.d: Likewise.
	* binutils-all/strip-9.d: Likewise.

ld/testsuite/

2008-10-03  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-elf/group5.d: Updated.
	* ld-elf/group6.d: Likewise.

--- binutils/binutils/testsuite/binutils-all/group-2.s.grp	2008-10-01 14:54:59.000000000 -0700
+++ binutils/binutils/testsuite/binutils-all/group-2.s	2008-10-03 07:23:24.000000000 -0700
@@ -1,8 +1,8 @@
 	.section .text.foo,"axG",%progbits,.text.foo,comdat
-	.global foo
-foo:
+	.global foo2
+foo2:
 	.word 0
 	.section .data.bar,"awG",%progbits,.text.foo,comdat
-	.global bar
-bar:
+	.global bar2
+bar2:
 	.word 0
--- binutils/binutils/testsuite/binutils-all/group-3.s.grp	2008-10-01 16:10:48.000000000 -0700
+++ binutils/binutils/testsuite/binutils-all/group-3.s	2008-10-02 17:17:01.000000000 -0700
@@ -1,8 +1,8 @@
-	.section .text,"axG",%progbits,foo,comdat
-	.global foo
-foo:
+	.section .text.foo3,"axG",%progbits,foo3,comdat
+	.global foo3
+foo3:
 	.word 0
-	.section .data,"awG",%progbits,foo,comdat
-	.global bar
-bar:
+	.section .data.bar3,"awG",%progbits,foo3,comdat
+	.global bar3
+bar3:
 	.word 0
--- binutils/binutils/testsuite/binutils-all/group-4.s.grp	2008-10-01 18:06:12.000000000 -0700
+++ binutils/binutils/testsuite/binutils-all/group-4.s	2008-10-02 17:17:16.000000000 -0700
@@ -1,6 +1,6 @@
-	.section .text,"axG",%progbits,foo,comdat
-foo:
+	.section .text.foo4,"axG",%progbits,foo4,comdat
+foo4:
 	.word 0
-	.section .data,"awG",%progbits,foo,comdat
-bar:
+	.section .data.foo4,"awG",%progbits,foo4,comdat
+bar4:
 	.word 0
--- binutils/binutils/testsuite/binutils-all/group.s.grp	2005-10-20 10:06:40.000000000 -0700
+++ binutils/binutils/testsuite/binutils-all/group.s	2008-10-02 17:12:54.000000000 -0700
@@ -1,8 +1,8 @@
-	.section .text,"axG",%progbits,foo_group,comdat
+	.section .text.foo,"axG",%progbits,foo_group,comdat
 	.global foo
 foo:
 	.word 0
-	.section .data,"awG",%progbits,foo_group,comdat
+	.section .data.foo,"awG",%progbits,foo_group,comdat
 	.global bar
 bar:
 	.word 0
--- binutils/binutils/testsuite/binutils-all/strip-7.d.grp	2008-10-01 16:10:48.000000000 -0700
+++ binutils/binutils/testsuite/binutils-all/strip-7.d	2008-10-03 07:23:42.000000000 -0700
@@ -11,7 +11,7 @@
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
 #...
-COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `.group' \[foo3\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*
--- binutils/binutils/testsuite/binutils-all/strip-9.d.grp	2008-10-01 18:06:12.000000000 -0700
+++ binutils/binutils/testsuite/binutils-all/strip-9.d	2008-10-03 07:23:50.000000000 -0700
@@ -11,7 +11,7 @@
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
 #...
-COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `.group' \[foo4\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*
--- binutils/ld/testsuite/ld-elf/group5.d.grp	2008-10-03 07:08:38.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/group5.d	2008-10-03 07:58:17.000000000 -0700
@@ -9,7 +9,7 @@
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
 #...
-COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `.group' \[foo3\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*
--- binutils/ld/testsuite/ld-elf/group6.d.grp	2008-10-03 07:08:38.000000000 -0700
+++ binutils/ld/testsuite/ld-elf/group6.d	2008-10-03 07:58:24.000000000 -0700
@@ -9,7 +9,7 @@
 #...
   \[[ 0-9]+\] \.data.*[ \t]+PROGBITS[ \t0-9a-f]+WAG[ \t]+.*
 #...
-COMDAT group section \[[ 0-9]+\] `.group' \[foo\] contains 2 sections:
+COMDAT group section \[[ 0-9]+\] `.group' \[foo4\] contains 2 sections:
    \[Index\]    Name
    \[[ 0-9]+\]   .text.*
    \[[ 0-9]+\]   .data.*


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