summaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-07-19 10:39:51 +0000
committerNick Clifton <nickc@redhat.com>2013-07-19 10:39:51 +0000
commitee1b5888413cde990618e68e627b9c52ec80b8ee (patch)
tree4ffd8008c75245363bd8e56f670c92aef79a3d92 /ld/ldlang.c
parentf74ac3a7f7c62f4456ba2720bdc09f9e4d4bc7d2 (diff)
downloadbinutils-redhat-ee1b5888413cde990618e68e627b9c52ec80b8ee.tar.gz
* ldgram.y: Add ALIGN_WITH_INPUT output section attribute.
* ldlang.c: Likewise. * ldlang.h: Likewise. * ldlex.l: Likewise. * mri.c: Likewise. * ld.texinfo: Document new feature. * NEWS: Mention new feature. * ld-scripts/script.exp: Run align with input test. * ld-scripts/align-with-input.t: New file. * ld-scripts/rgn-at8.d: Likewise. * ld-scripts/rgn-at8.t: Likewise.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 645c26c151..ba7f493bee 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1,7 +1,5 @@
/* Linker command language support.
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
- Free Software Foundation, Inc.
+ Copyright 1991-2013 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -1779,7 +1777,7 @@ lang_insert_orphan (asection *s,
os_tail = ((lang_output_section_statement_type **)
lang_output_section_statement.tail);
os = lang_enter_output_section_statement (secname, address, normal_section,
- NULL, NULL, NULL, constraint);
+ NULL, NULL, NULL, constraint, 0);
ps = NULL;
if (config.build_constructors && *os_tail == os)
@@ -4967,8 +4965,8 @@ lang_size_sections_1
as we did for the VMA, possibly including alignment
from the bfd section. If a different region, then
only align according to the value in the output
- statement. */
- if (os->lma_region != os->region)
+ statement unless specified otherwise. */
+ if (os->lma_region != os->region && !os->align_lma_with_input)
section_alignment = os->section_alignment;
if (section_alignment > 0)
lma = align_power (lma, section_alignment);
@@ -6235,7 +6233,8 @@ lang_enter_output_section_statement (const char *output_section_statement_name,
etree_type *align,
etree_type *subalign,
etree_type *ebase,
- int constraint)
+ int constraint,
+ int align_with_input)
{
lang_output_section_statement_type *os;
@@ -6257,6 +6256,10 @@ lang_enter_output_section_statement (const char *output_section_statement_name,
/* Make next things chain into subchain of this. */
push_stat_ptr (&os->children);
+ os->align_lma_with_input = align_with_input == ALIGN_WITH_INPUT;
+ if (os->align_lma_with_input && align != NULL)
+ einfo (_("%F%P:%S: error: align with input and explicit align specified\n"), NULL);
+
os->subsection_alignment =
topower (exp_get_value_int (subalign, -1, "subsection alignment"));
os->section_alignment =
@@ -7307,7 +7310,7 @@ lang_enter_overlay_section (const char *name)
etree_type *size;
lang_enter_output_section_statement (name, overlay_vma, overlay_section,
- 0, overlay_subalign, 0, 0);
+ 0, overlay_subalign, 0, 0, 0);
/* If this is the first section, then base the VMA of future
sections on this one. This will work correctly even if `.' is