* ldgram.y: Add ALIGN_WITH_INPUT output section attribute.
[deliverable/binutils-gdb.git] / ld / ldlang.c
index 645c26c1511d493dc13007d0d9b532514c0adf72..ba7f493bee108515df539f3ba8c007d89ae54c99 100644 (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
This page took 0.02532 seconds and 4 git commands to generate.