This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Always check section_alignment for output section alignment
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Cc: amodra at bigpond dot net dot au
- Date: Wed, 8 Feb 2006 11:24:22 -0800
- Subject: PATCH: Always check section_alignment for output section alignment
Hi Alan,
lang_size_sections_1 used to always check section_alignment for section
alignment. Your patch:
http://sourceware.org/ml/binutils/2005-11/msg00235.html
moved the check to init_os. I have some local changes where some
targets may update section_alignment after init_os is called. This
patch restores the old behavior.
H.J.
----
2006-02-08 H.J. Lu <hongjiu.lu@intel.com>
* ldlang.c (lang_size_sections_1): Check section_alignment for
output section alignment.
--- ld/ldlang.c.align 2006-02-08 10:12:45.000000000 -0800
+++ ld/ldlang.c 2006-02-08 11:13:32.000000000 -0800
@@ -4202,7 +4202,13 @@ lang_size_sections_1
}
newdot = os->region->current;
- align = os->bfd_section->alignment_power;
+ /* Always use the larger alignment. */
+ if (os->section_alignment == -1
+ || (os->bfd_section->alignment_power
+ > (unsigned int) os->section_alignment))
+ align = os->bfd_section->alignment_power;
+ else
+ align = os->section_alignment;
}
else
align = os->section_alignment;