aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl/pe.em
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2011-03-10 10:20:26 +0000
committerDave Korn <dave.korn@artimi.com>2011-03-10 10:20:26 +0000
commit4bf0cafb353d8856baa25968877cd84f7a3504ae (patch)
treeb7b727d10f6b321def223751c7549747f007e93e /ld/emultempl/pe.em
parent293855c8bb376c8dc7cb43bdbb5a6460df27a0c0 (diff)
downloadgdb-4bf0cafb353d8856baa25968877cd84f7a3504ae.zip
gdb-4bf0cafb353d8856baa25968877cd84f7a3504ae.tar.gz
gdb-4bf0cafb353d8856baa25968877cd84f7a3504ae.tar.bz2
[PATCH] Fix PE-COFF bug in orphan section alignment handling.
ld/ChangeLog: 2011-03-10 Dave Korn <dave.korn.cygwin@gmail.com> * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Preserve alignment of input sections when creating orphan output sections during relocatable link. * emultempl/pep.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
Diffstat (limited to 'ld/emultempl/pe.em')
-rw-r--r--ld/emultempl/pe.em9
1 files changed, 8 insertions, 1 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9b800cd..b8290b3 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -2009,10 +2009,17 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
->output_section_statement);
}
- /* All sections in an executable must be aligned to a page boundary. */
+ /* All sections in an executable must be aligned to a page boundary.
+ In a relocatable link, just preserve the incoming alignment; the
+ address is discarded by lang_insert_orphan in that case, anyway. */
address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
os = lang_insert_orphan (s, secname, constraint, after, place, address,
&add_child);
+ if (link_info.relocatable)
+ {
+ os->section_alignment = s->alignment_power;
+ os->bfd_section->alignment_power = s->alignment_power;
+ }
}
/* If the section name has a '\$', sort it with the other '\$'