* 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.
This commit is contained in:
Nick Clifton
2013-07-19 10:39:51 +00:00
parent 5d0a3b53c0
commit 1eec346e12
12 changed files with 79 additions and 32 deletions

View File

@@ -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