summaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-07-10 06:50:54 +0000
committerH.J. Lu <hjl.tools@gmail.com>2012-07-10 06:50:54 +0000
commit6e9904258942022fdc259efc11add9f263637335 (patch)
tree359b733c8c7c585e5bf8fd9bf612e68d5cf02415 /ld/ldlang.c
parenta0dc025c30115826cbddeef648d3891ddb2b991f (diff)
downloadbinutils-redhat-6e9904258942022fdc259efc11add9f263637335.tar.gz
Add SORT_NONE and don't sort sort .init/.fini sections
ld/ PR ld/14156 * NEWS: Mention SORT_NONE. * ld.h (sort_type): Add by_none. * ld.texinfo: Document SORT_NONE. * ldgram.y: Handle SORT_NONE. * ldlang.c (update_wild_statements): Handle by_none. Don't sort .init/.fini sections. * ldlex.l: Add SORT_NONE. ld/testsuite/ PR ld/14156 * ld-elf/fini0.s: New file. * ld-elf/fini1.s: Likewise. * ld-elf/fini2.s: Likewise. * ld-elf/fini3.s: Likewise. * ld-elf/finin.s: Likewise. * ld-elf/foo0.s: Likewise. * ld-elf/foo1.s: Likewise. * ld-elf/foo2.s: Likewise. * ld-elf/foo3.s: Likewise. * ld-elf/foon.s: Likewise. * ld-elf/init0.s: Likewise. * ld-elf/init1.s: Likewise. * ld-elf/init2.s: Likewise. * ld-elf/init3.s: Likewise. * ld-elf/initn.s: Likewise. * ld-elf/pr14156a.d: Likewise. * ld-elf/pr14156b.d: Likewise. * ld-elf/pr14156c.d: Likewise. * ld-elf/pr14156c.t: Likewise.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index e94d2613ec..317e445cd1 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3510,6 +3510,8 @@ update_wild_statements (lang_statement_union_type *s)
if (sort_section == by_name)
sec->spec.sorted = by_alignment_name;
break;
+ case by_none:
+ sec->spec.sorted = none;
default:
break;
}
@@ -3521,8 +3523,11 @@ update_wild_statements (lang_statement_union_type *s)
break;
case lang_output_section_statement_enum:
- update_wild_statements
- (s->output_section_statement.children.head);
+ /* Don't sort .init/.fini sections. */
+ if (strcmp (s->output_section_statement.name, ".init") != 0
+ && strcmp (s->output_section_statement.name, ".fini") != 0)
+ update_wild_statements
+ (s->output_section_statement.children.head);
break;
case lang_group_statement_enum: