]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - ld/emultempl/sh64elf.em
Update sources to GPLv3
[thirdparty/binutils-gdb.git] / ld / emultempl / sh64elf.em
index 7f2b037df7f596235934b8cc9d08c1eb443de71f..30dd68f169df2f6493607b21bd7b8ee8101e68f3 100644 (file)
@@ -1,11 +1,11 @@
 # This shell script emits a C file. -*- C -*-
-#   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+#   Copyright 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
 #
-# This file is part of GLD, the Gnu Linker.
+# This file is part of the GNU Binutils.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
@@ -15,7 +15,8 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
 #
 
 # This file is sourced from elf32.em, and defines extra sh64
@@ -152,7 +153,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
                 isec = isec->next)
              {
                if (isec->output_section == osec
-                   && isec->_raw_size != 0
+                   && isec->size != 0
                    && (bfd_get_section_flags (isec->owner, isec)
                        & SEC_EXCLUDE) == 0)
                  {
@@ -179,7 +180,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
                 isec = isec->next)
              {
                if (isec->output_section == osec
-                   && isec->_raw_size != 0
+                   && isec->size != 0
                    && (bfd_get_section_flags (isec->owner, isec)
                        & SEC_EXCLUDE) == 0)
                  {
@@ -283,7 +284,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
                 isec = isec->next)
              {
                if (isec->output_section == osec
-                   && isec->_raw_size != 0
+                   && isec->size != 0
                    && (bfd_get_section_flags (isec->owner, isec)
                        & SEC_EXCLUDE) == 0)
                  {
@@ -310,7 +311,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
                 isec = isec->next)
              {
                if (isec->output_section == osec
-                   && isec->_raw_size != 0
+                   && isec->size != 0
                    && (bfd_get_section_flags (isec->owner, isec)
                        & SEC_EXCLUDE) == 0)
                  {
@@ -363,7 +364,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
                 isec = isec->next)
              {
                if (isec->output_section == osec
-                   && isec->_raw_size != 0
+                   && isec->size != 0
                    && (bfd_get_section_flags (isec->owner, isec)
                        & SEC_EXCLUDE) == 0
                    && ((elf_section_data (isec)->this_hdr.sh_flags
@@ -379,7 +380,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
      lang_process, and the second time when lang_process calls ldemul_finish,
      which calls gld${EMULATION_NAME}_finish, e.g. gldshelf32_finish, which
      is defined in emultempl/elf32.em and calls ldemul_after_allocation,
-     if bfd_elf${ELFSIZE}_discard_info returned true.  */
+     if bfd_elf_discard_info returned true.  */
   if (cranges->contents != NULL)
     free (cranges->contents);
 
@@ -388,7 +389,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
   /* Make sure we have .cranges in memory even if there were only
      assembler-generated .cranges.  */
   cranges_growth = new_cranges * SH64_CRANGE_SIZE;
-  cranges->contents = xcalloc (cranges->_raw_size + cranges_growth, 1);
+  cranges->contents = xcalloc (cranges->size + cranges_growth, 1);
   bfd_set_section_flags (cranges->owner, cranges,
                         bfd_get_section_flags (cranges->owner, cranges)
                         | SEC_IN_MEMORY);
@@ -403,7 +404,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
       return;
     }
 
-  crangesp = cranges->contents + cranges->_raw_size;
+  crangesp = cranges->contents + cranges->size;
 
   /* Now pass over the sections again, and make reloc orders for the new
      .cranges entries.  Constants are set as we go.  */
@@ -437,7 +438,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
                   as containing mixed data, thus already having .cranges
                   entries.  */
                if (isec->output_section == osec
-                   && isec->_raw_size != 0
+                   && isec->size != 0
                    && (bfd_get_section_flags (isec->owner, isec)
                        & SEC_EXCLUDE) == 0
                    && ((elf_section_data (isec)->this_hdr.sh_flags
@@ -458,9 +459,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
                    else
                      cr_type = CRT_SH5_ISA16;
 
-                   cr_size
-                     = (isec->_cooked_size
-                        ? isec->_cooked_size : isec->_raw_size);
+                   cr_size = isec->size;
 
                    /* Sections can be empty, like .text in a file that
                       only contains other sections.  Ranges shouldn't be
@@ -522,13 +521,6 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
                        bfd_put_32 (output_bfd, isec->output_offset,
                                    crangesp + SH64_CRANGE_CR_ADDR_OFFSET);
                        cr_addr_order->u.reloc.p->addend = 0;
-
-                       /* We must update the number of relocations here,
-                          since the elf linker does not take link orders
-                          into account when setting header sizes.  The
-                          actual relocation orders are however executed
-                          correctly.  */
-                       elf_section_data(cranges)->rel_count++;
                      }
                    else
                      bfd_put_32 (output_bfd,
@@ -563,8 +555,8 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
 
      Sorting before writing is done by sh64_elf_final_write_processing.  */
 
-  cranges->_cooked_size = crangesp - cranges->contents;
   sh64_elf_section_data (cranges)->sh64_info->cranges_growth
-    = cranges->_cooked_size - cranges->_raw_size;
-  cranges->_raw_size = cranges->_cooked_size;
+    = crangesp - cranges->contents - cranges->size;
+  cranges->size = crangesp - cranges->contents;
+  cranges->rawsize = cranges->size;
 }