This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: ld/3009: "ld --sort-section xxx" doesn't work with wildcard list
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Cc: sonal dot santan at xilinx dot com
- Date: Mon, 7 Aug 2006 14:24:46 -0700
- Subject: PATCH: ld/3009: "ld --sort-section xxx" doesn't work with wildcard list
The "ld --sort-section xxx" patch:
http://sourceware.org/ml/binutils/2004-10/msg00020.html
doesn't update the wildcard list. This patch fixes it. However, the
current linker is broken when "--sort-section name" is used:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=3006
H.J.
---
ld/
2007-08-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3009
* ldlang.c (update_wild_statements): Update the whole wild
section list.
ld/testsuite/
2007-08-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3009
* ld-scripts/sort.t: New file.
* ld-scripts/sort_b_a-1.d: Likewise.
* ld-scripts/sort_b_a-1.s: Likewise.
* ld-scripts/sort_b_n-1.d: Likewise.
* ld-scripts/sort_b_n-1.s: Likewise.
--- ld/ldlang.c.sort 2006-08-07 14:07:34.000000000 -0700
+++ ld/ldlang.c 2006-08-07 13:53:28.000000000 -0700
@@ -3060,7 +3060,8 @@ update_wild_statements (lang_statement_u
case lang_wild_statement_enum:
sec = s->wild_statement.section_list;
- if (sec != NULL)
+ for (sec = s->wild_statement.section_list; sec != NULL;
+ sec = sec->next)
{
switch (sec->spec.sorted)
{
--- ld/testsuite/ld-scripts/sort.t.sort 2006-08-07 12:36:01.000000000 -0700
+++ ld/testsuite/ld-scripts/sort.t 2006-08-07 12:36:01.000000000 -0700
@@ -0,0 +1,5 @@
+SECTIONS
+{
+ .text : {*(.text .text.*)}
+ /DISCARD/ : { *(.*) }
+}
--- ld/testsuite/ld-scripts/sort_b_a-1.d.sort 2006-08-07 12:36:01.000000000 -0700
+++ ld/testsuite/ld-scripts/sort_b_a-1.d 2006-08-07 14:03:39.000000000 -0700
@@ -0,0 +1,9 @@
+#source: sort_b_a-1.s
+#ld: -T sort.t --sort-section alignment
+#name: --sort-section alignment
+#nm: -n
+
+0[0-9a-f]* t text3
+0[0-9a-f]* t text1
+0[0-9a-f]* t text
+0[0-9a-f]* t text2
--- ld/testsuite/ld-scripts/sort_b_a-1.s.sort 2006-08-07 12:36:01.000000000 -0700
+++ ld/testsuite/ld-scripts/sort_b_a-1.s 2006-08-07 12:36:01.000000000 -0700
@@ -0,0 +1,16 @@
+ .section .text.2
+ .p2align 3
+text2:
+ .long 0
+ .section .text.3
+ .p2align 6
+text3:
+ .long 0
+ .section .text.1
+ .p2align 5
+text1:
+ .long 0
+ .text
+text:
+ .p2align 4
+ .long 0
--- ld/testsuite/ld-scripts/sort_b_n-1.d.sort 2006-08-07 12:36:01.000000000 -0700
+++ ld/testsuite/ld-scripts/sort_b_n-1.d 2006-08-07 12:36:01.000000000 -0700
@@ -0,0 +1,9 @@
+#source: sort_b_n-1.s
+#ld: -T sort.t --sort-section name
+#name: --sort-section name
+#nm: -n
+
+0[0-9a-f]* t text
+0[0-9a-f]* t text1
+0[0-9a-f]* t text2
+0[0-9a-f]* t text3
--- ld/testsuite/ld-scripts/sort_b_n-1.s.sort 2006-08-07 12:36:01.000000000 -0700
+++ ld/testsuite/ld-scripts/sort_b_n-1.s 2006-08-07 12:36:01.000000000 -0700
@@ -0,0 +1,12 @@
+ .section .text.2
+text2:
+ .long 0
+ .section .text.3
+text3:
+ .long 0
+ .section .text.1
+text1:
+ .long 0
+ .text
+text:
+ .long 0