[914669c] | 1 | --- ../binutils-2.19.51.0.11.orig/ld/ldlang.c 2009-07-14 11:42:46.000000000 +0100 |
---|
| 2 | +++ ld/ldlang.c 2009-07-14 11:55:01.000000000 +0100 |
---|
| 3 | @@ -1615,10 +1615,12 @@ output_prev_sec_find (lang_output_sectio |
---|
| 4 | idea is to skip over anything that might be inside a SECTIONS {} |
---|
| 5 | statement in a script, before we find another output section |
---|
| 6 | statement. Assignments to "dot" before an output section statement |
---|
| 7 | - are assumed to belong to it. An exception to this rule is made for |
---|
| 8 | - the first assignment to dot, otherwise we might put an orphan |
---|
| 9 | - before . = . + SIZEOF_HEADERS or similar assignments that set the |
---|
| 10 | - initial address. */ |
---|
| 11 | + are assumed to belong to it, except in two cases; The first |
---|
| 12 | + assignment to dot, and assignments before non-alloc sections. |
---|
| 13 | + Otherwise we might put an orphan before . = . + SIZEOF_HEADERS or |
---|
| 14 | + similar assignments that set the initial address, or we might |
---|
| 15 | + insert non-alloc note sections among assignments setting end of |
---|
| 16 | + image symbols. */ |
---|
| 17 | |
---|
| 18 | static lang_statement_union_type ** |
---|
| 19 | insert_os_after (lang_output_section_statement_type *after) |
---|
| 20 | @@ -1662,7 +1664,12 @@ insert_os_after (lang_output_section_sta |
---|
| 21 | continue; |
---|
| 22 | case lang_output_section_statement_enum: |
---|
| 23 | if (assign != NULL) |
---|
| 24 | - where = assign; |
---|
| 25 | + { |
---|
| 26 | + asection *s = (*where)->output_section_statement.bfd_section; |
---|
| 27 | + |
---|
| 28 | + if (s == NULL || (s->flags & SEC_ALLOC) != 0) |
---|
| 29 | + where = assign; |
---|
| 30 | + } |
---|
| 31 | break; |
---|
| 32 | case lang_input_statement_enum: |
---|
| 33 | case lang_address_statement_enum: |
---|
| 34 | |
---|