diff options
author | Alan Modra <amodra@gmail.com> | 2005-11-24 00:58:28 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-11-24 00:58:28 +0000 |
commit | be5291325d6402206276092e018ad6bb4210bcf0 (patch) | |
tree | b5debd5954269889244954d9121fd638f69d2af0 /ld | |
parent | b615bfbb2d68199923e1c4b05ace8d8cd1fc915d (diff) | |
download | gdb-be5291325d6402206276092e018ad6bb4210bcf0.zip gdb-be5291325d6402206276092e018ad6bb4210bcf0.tar.gz gdb-be5291325d6402206276092e018ad6bb4210bcf0.tar.bz2 |
* ldlang.c (lang_insert_orphan): Skip first assignment to dot
in script when looking for place to insert orphan statements.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/ldlang.c | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 8a31f7c..977af6f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2005-11-24 Alan Modra <amodra@bigpond.net.au> + + * ldlang.c (lang_insert_orphan): Skip first assignment to dot + in script when looking for place to insert orphan statements. + 2005-11-18 Alan Modra <amodra@bigpond.net.au> * emulparams/elf64ppc.sh (.tocbss): Use new section alignment scheme. @@ -15,7 +20,7 @@ * Makefile.in: Regenerated. * ld.texinfo: Include configdoc.texi and ldver.texi in man pages. Add @file documentation. - + 2005-11-17 Alan Modra <amodra@bigpond.net.au> * ldlang.h (lang_input_section_type): Remove "ifile" field. diff --git a/ld/ldlang.c b/ld/ldlang.c index cba7179..119fb7a 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -1467,13 +1467,20 @@ lang_insert_orphan (asection *s, { lang_statement_union_type **where; lang_statement_union_type **assign = NULL; + bfd_boolean ignore_first; /* Look for a suitable place for the new statement list. The idea is to skip over anything that might be inside a SECTIONS {} statement in a script, before we find another output_section_statement. Assignments to "dot" before an output section statement are assumed to - belong to it. */ + belong to it. An exception to this rule is made for + the first assignment to dot, otherwise we might put an + orphan before . = . + SIZEOF_HEADERS or similar + assignments that set the initial address. */ + + ignore_first = after == (&lang_output_section_statement.head + ->output_section_statement); for (where = &after->header.next; *where != NULL; where = &(*where)->header.next) @@ -1487,9 +1494,11 @@ lang_insert_orphan (asection *s, ass = &(*where)->assignment_statement; if (ass->exp->type.node_class != etree_assert && ass->exp->assign.dst[0] == '.' - && ass->exp->assign.dst[1] == 0) + && ass->exp->assign.dst[1] == 0 + && !ignore_first) assign = where; } + ignore_first = FALSE; continue; case lang_wild_statement_enum: case lang_input_section_enum: |