summaryrefslogtreecommitdiff
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
commitfed6bc205a9b18640cd24600c135947b6e7cd330 (patch)
tree58eee28db8ba1f344ddfca7d4c2f1170c3c09d59
parent136e514c544c9079170025aae7b7ce52cc086b6b (diff)
downloadbinutils-redhat-fed6bc205a9b18640cd24600c135947b6e7cd330.tar.gz
[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.
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/emultempl/pe.em9
-rw-r--r--ld/emultempl/pep.em9
3 files changed, 23 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index bdf4b01ec4..d3c5235571 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2011-03-04 H.J. Lu <hongjiu.lu@intel.com>
* ld.texinfo: Document --verbose[=NUMBER].
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9b800cde69..b8290b3435 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 '\$'
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 2119367cbd..0c1dfb9753 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1748,10 +1748,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 '\$'