]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[Morello] Expand GOT entry sizes for C64
authorSiddhesh Poyarekar <siddesh.poyarekar@arm.com>
Fri, 11 Sep 2020 03:48:09 +0000 (09:18 +0530)
committerLuis Machado <luis.machado@linaro.org>
Tue, 20 Oct 2020 18:04:07 +0000 (15:04 -0300)
Expand GOT slots based on whether we are emitting C64 relocations.
This patch only has infrastructure changes, i.e. it only makes
got_header_size a function and adjusts across architectures.

bfd/ChangeLog:

2020-10-20  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>
    Tamar Christina  <tamar.christina@arm.com>

* elf-bfd.h (elf_backend_data): Make got_header_size a
function.  Add callbacks to all targets that use it.
* elflink.c (_bfd_elf_create_got_section,
bfd_elf_gc_common_finalize_got_offsets,
_bfd_elf_common_section): Adjust got_header_size usage.

50 files changed:
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf-m10300.c
bfd/elf-vxworks.c
bfd/elf-vxworks.h
bfd/elf32-arc.c
bfd/elf32-arm.c
bfd/elf32-bfin.c
bfd/elf32-cr16.c
bfd/elf32-cris.c
bfd/elf32-frv.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-lm32.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-microblaze.c
bfd/elf32-mips.c
bfd/elf32-nds32.c
bfd/elf32-nios2.c
bfd/elf32-or1k.c
bfd/elf32-ppc.c
bfd/elf32-s390.c
bfd/elf32-score.c
bfd/elf32-sh.c
bfd/elf32-sparc.c
bfd/elf32-tic6x.c
bfd/elf32-tilegx.c
bfd/elf32-tilepro.c
bfd/elf32-vax.c
bfd/elf32-wasm32.c
bfd/elf32-xtensa.c
bfd/elf64-alpha.c
bfd/elf64-hppa.c
bfd/elf64-ia64-vms.c
bfd/elf64-mips.c
bfd/elf64-ppc.c
bfd/elf64-ppc.h
bfd/elf64-s390.c
bfd/elf64-sparc.c
bfd/elf64-tilegx.c
bfd/elf64-x86-64.c
bfd/elflink.c
bfd/elfn32-mips.c
bfd/elfnn-aarch64.c
bfd/elfnn-ia64.c
bfd/elfnn-riscv.c
bfd/elfxx-mips.c
bfd/elfxx-target.h
bfd/elfxx-tilegx.c

index bf9e320b44b15e1d0ba6d2706bd224b8b2bbe43d..2b03b838951f5d990fd95e0e4d686ffdef88665d 100644 (file)
@@ -1,3 +1,12 @@
+2020-10-20  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>
+           Tamar Christina  <tamar.christina@arm.com>
+
+       * elf-bfd.h (elf_backend_data): Make got_header_size a
+       function.  Add callbacks to all targets that use it.
+       * elflink.c (_bfd_elf_create_got_section,
+       bfd_elf_gc_common_finalize_got_offsets,
+       _bfd_elf_common_section): Adjust got_header_size usage.
+
 2020-10-20  Siddhesh Poyarekar  <siddesh.poyarekar@arm.com>
 
        * elfxx-aarch64.c (reencode_ldst_pos_imm): Support loads and
index 173267ffa27d973761e06c5318c35ecc76ce7c4e..98165af1335743835d5249cd174d15dc6d8c396b 100644 (file)
@@ -1503,9 +1503,9 @@ struct elf_backend_data
   /* An array of target specific special sections.  */
   const struct bfd_elf_special_section *special_sections;
 
-  /* The size in bytes of the header for the GOT.  This includes the
-     so-called reserved entries on some systems.  */
-  bfd_vma got_header_size;
+  /* The size in bytes of the header for the GOT using configuration in INFO.
+     This includes the so-called reserved entries on some systems.  */
+  bfd_vma (*got_header_size) (struct bfd_link_info * info);
 
   /* The size of the GOT entry for the symbol pointed to by H if non-NULL,
      otherwise by the local symbol with index SYMNDX in IBFD.  */
@@ -2612,6 +2612,9 @@ extern unsigned int _bfd_elf_common_section_index
 extern asection *_bfd_elf_common_section
   (asection *);
 
+extern bfd_vma _bfd_elf_default_got_header_size
+(struct bfd_link_info *);
+
 extern bfd_vma _bfd_elf_default_got_elt_size
 (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, bfd *,
  unsigned long);
index 7a2b67569b075c7cacd07a8ee11070b3863079b9..efa2401966b7dd6e96d41a66fae75a5aa90d090f 100644 (file)
@@ -765,7 +765,7 @@ _bfd_mn10300_elf_create_got_section (bfd * abfd,
     return FALSE;
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   return TRUE;
 }
@@ -5463,6 +5463,14 @@ mn10300_elf_mkobject (bfd *abfd)
                                  MN10300_ELF_DATA);
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+_bfd_mn10300_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #define bfd_elf32_mkobject     mn10300_elf_mkobject
 
 #ifndef ELF_ARCH
@@ -5516,11 +5524,12 @@ mn10300_elf_mkobject (bfd *abfd)
   _bfd_mn10300_copy_indirect_symbol
 #define elf_backend_reloc_type_class \
   _bfd_mn10300_elf_reloc_type_class
+#define elf_backend_got_header_size \
+  _bfd_mn10300_elf_got_header_size
 
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    12
 #define elf_backend_dtrel_excludes_plt 1
 
 #include "elf32-target.h"
index f8a57e1a7dc7d18ed723816248d973a294afff42..45d5817017602de562ca36d070ea29282dd168af 100644 (file)
@@ -309,3 +309,11 @@ _bfd_elf_maybe_vxworks_add_dynamic_tags (bfd *output_bfd,
              || htab->target_os != is_vxworks
              || elf_vxworks_add_dynamic_entries (output_bfd, info)));
 }
+
+/* Determine the size of the header of for the GOT section.  */
+
+bfd_vma
+elf_vxworks_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4 * 3;
+}
index 47a099fca729229258386caca7ecb27eb466a36d..949a83ceccbc2cbbf9c5a79d63c25c00a85cfa01 100644 (file)
@@ -35,3 +35,4 @@ bfd_boolean elf_vxworks_add_dynamic_entries (bfd *, struct bfd_link_info *);
 bfd_boolean elf_vxworks_finish_dynamic_entry (bfd *, Elf_Internal_Dyn *);
 bfd_boolean _bfd_elf_maybe_vxworks_add_dynamic_tags
   (bfd *, struct bfd_link_info *, bfd_boolean);
+bfd_vma elf_vxworks_got_header_size (struct bfd_link_info* info);
index a05f697b6575410328bb4f87d9d8e7be03e5337b..61852e988adb45e133c714fa83025907d01aa47a 100644 (file)
@@ -2850,6 +2850,14 @@ const struct elf_size_info arc_elf32_size_info =
 
 #define elf_backend_size_info          arc_elf32_size_info
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_arc_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 /* GDB expects general purpose registers to be in section .reg.  However Linux
    kernel doesn't create this section and instead writes registers to NOTE
    section.  It is up to the binutils to create a pseudo-section .reg from the
@@ -3127,13 +3135,13 @@ arc_elf_relax_section (bfd *abfd, asection *sec,
 
 #define elf_backend_finish_dynamic_sections  elf_arc_finish_dynamic_sections
 #define elf_backend_size_dynamic_sections    elf_arc_size_dynamic_sections
+#define elf_backend_got_header_size         elf_arc_got_header_size
 
 #define elf_backend_can_gc_sections    1
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_rela_plts_and_copies_p 1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    12
 #define elf_backend_dtrel_excludes_plt 1
 
 #define elf_backend_may_use_rel_p      0
index 2f6bd885550c102cc85bd07d24216c69fc22cf0e..00a8a101ebec87c08b5fbe41161bfda34a2fb789 100644 (file)
@@ -9633,7 +9633,8 @@ elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
       sgot = htab->root.sgotplt;
       srel = htab->root.srelplt;
 
-      got_header_size = get_elf_backend_data (output_bfd)->got_header_size;
+      got_header_size
+       = get_elf_backend_data (output_bfd)->got_header_size (info);
       plt_header_size = htab->plt_header_size;
     }
   BFD_ASSERT (splt != NULL && srel != NULL);
@@ -20228,6 +20229,14 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
     sym->flags |= BSF_KEEP;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_arm_backend_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #undef  elf_backend_copy_special_section_fields
 #define elf_backend_copy_special_section_fields elf32_arm_copy_special_section_fields
 
@@ -20288,6 +20297,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
 #define elf_backend_add_symbol_hook            elf32_arm_add_symbol_hook
 #define elf_backend_count_additional_relocs    elf32_arm_count_additional_relocs
 #define elf_backend_symbol_processing          elf32_arm_backend_symbol_processing
+#define elf_backend_got_header_size            elf32_arm_backend_got_header_size
 
 #define elf_backend_can_refcount       1
 #define elf_backend_can_gc_sections    1
@@ -20300,7 +20310,6 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
 #define elf_backend_default_use_rela_p 0
 #define elf_backend_dtrel_excludes_plt 1
 
-#define elf_backend_got_header_size    12
 #define elf_backend_extern_protected_data 1
 
 #undef elf_backend_obj_attrs_vendor
@@ -20892,6 +20901,14 @@ elf32_arm_symbian_plt_sym_val (bfd_vma i, const asection *plt,
   return plt->vma + 4 * ARRAY_SIZE (elf32_arm_symbian_plt_entry) * i;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_arm_symbian_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #undef  elf32_bed
 #define elf32_bed elf32_arm_symbian_bed
 
@@ -20917,7 +20934,7 @@ elf32_arm_symbian_plt_sym_val (bfd_vma i, const asection *plt,
 
 /* There is no .got section for BPABI objects, and hence no header.  */
 #undef  elf_backend_got_header_size
-#define elf_backend_got_header_size 0
+#define elf_backend_got_header_size elf32_arm_symbian_got_header_size
 
 /* Similarly, there is no .got.plt section.  */
 #undef  elf_backend_want_got_plt
index ab928530db60d8f412896fda51b8cdca419ff08e..7e9b155631f40f7b444f7c5e1090104033d721a8 100644 (file)
@@ -3224,7 +3224,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
     }
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   /* This is the machine-specific part.  Create and initialize section
      data for the got.  */
@@ -4683,6 +4683,13 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
 
   return TRUE;
 }
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+bfinfdpic_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
 
 /* Set the right machine number for a Blackfin ELF file.  */
 
@@ -5381,6 +5388,14 @@ bfd_bfin_elf32_create_embedded_relocs (bfd *abfd,
   return FALSE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_bfin_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 struct bfd_elf_special_section const elf32_bfin_special_sections[] =
 {
   { ".l1.text",                8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
@@ -5440,7 +5455,7 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] =
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 1
 #define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size    12
+#define elf_backend_got_header_size     elf32_bfin_got_header_size
 #define elf_backend_rela_normal                1
 
 #include "elf32-target.h"
@@ -5453,7 +5468,7 @@ struct bfd_elf_special_section const elf32_bfin_special_sections[] =
 #define        elf32_bed                       elf32_bfinfdpic_bed
 
 #undef elf_backend_got_header_size
-#define elf_backend_got_header_size    0
+#define elf_backend_got_header_size     bfinfdpic_got_header_size
 
 #undef elf_backend_relocate_section
 #define elf_backend_relocate_section   bfinfdpic_relocate_section
index c93fd9da8f84ccc4bf2f68f87cbaac3649d4a094..7853f9e3c89213e143082915675f182b775911d2 100644 (file)
@@ -633,7 +633,7 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info)
     return FALSE;
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   return TRUE;
 }
@@ -2792,6 +2792,14 @@ _bfd_cr16_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSE
     }
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+_bfd_cr16_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 /* Definitions for setting CR16 target vector.  */
 #define TARGET_LITTLE_SYM                cr16_elf32_vec
 #define TARGET_LITTLE_NAME               "elf32-cr16"
@@ -2838,6 +2846,7 @@ _bfd_cr16_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSE
                                   _bfd_cr16_elf_finish_dynamic_sections
 
 #define elf_backend_reloc_type_class   _bfd_cr16_elf_reloc_type_class
+#define elf_backend_got_header_size    _bfd_cr16_elf_got_header_size
 
 
 #define elf_backend_want_got_plt       1
index 61f4b24fe0297f659a6c0d9633516b882dddc01f..012f8a1a2e3d0046ecb459c99c1076bec7f8baeb 100644 (file)
@@ -3988,6 +3988,14 @@ elf_cris_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
     }
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_cris_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 /* The elf_backend_got_elt_size worker.  For one symbol, we can have up to
    two GOT entries from three types with two different sizes.  We handle
    it as a single entry, so we can use the regular offset-calculation
@@ -4107,8 +4115,8 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBUTE_UNUSED,
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    12
-#define elf_backend_got_elt_size elf_cris_got_elt_size
+#define elf_backend_got_header_size    elf_cris_got_header_size
+#define elf_backend_got_elt_size       elf_cris_got_elt_size
 #define elf_backend_dtrel_excludes_plt 1
 #define elf_backend_want_dynrelro      1
 
index 9908c0112a5fac731f355c32f565636e469cf187..a5ff0d9cb103f6d9f23e95666327beffb2d5e6f0 100644 (file)
@@ -4214,7 +4214,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
     }
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   /* This is the machine-specific part.  Create and initialize section
      data for the got.  */
@@ -6759,6 +6759,15 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 
   return TRUE;
 }
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+frv_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
 #define ELF_ARCH               bfd_arch_frv
 #define ELF_MACHINE_CODE       EM_CYGNUS_FRV
 #define ELF_MAXPAGESIZE                0x1000
@@ -6784,7 +6793,7 @@ elf32_frv_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 #define bfd_elf32_bfd_print_private_bfd_data   frv_elf_print_private_bfd_data
 
 #define elf_backend_want_got_sym       1
-#define elf_backend_got_header_size    0
+#define elf_backend_got_header_size    frv_elf_got_header_size
 #define elf_backend_want_got_plt       0
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
index b9b1dad1aef3d25d4041cfda3f9667a88e9aef37..469a686c8c934a1a60f545d374c9b3d16c402847 100644 (file)
@@ -4432,6 +4432,14 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
     return type;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_hppa_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 8;
+}
+
 /* Misc BFD support code.  */
 #define bfd_elf32_bfd_is_local_label_name    elf_hppa_is_local_label_name
 #define bfd_elf32_bfd_reloc_type_lookup             elf_hppa_reloc_type_lookup
@@ -4469,7 +4477,7 @@ elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
 #define elf_backend_want_got_plt            0
 #define elf_backend_plt_readonly            0
 #define elf_backend_want_plt_sym            0
-#define elf_backend_got_header_size         8
+#define elf_backend_got_header_size         elf32_hppa_got_header_size
 #define elf_backend_want_dynrelro           1
 #define elf_backend_rela_normal                     1
 #define elf_backend_dtrel_excludes_plt      1
index 7ae881be0ad9470900f506306fcedb9a92c57566..db84a9a67d6612db65d3e4c7c96a0f8e96c74dfd 100644 (file)
@@ -4330,6 +4330,14 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
   return _bfd_x86_elf_link_setup_gnu_properties (info, &init_table);
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_i386_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #define TARGET_LITTLE_SYM              i386_elf32_vec
 #define TARGET_LITTLE_NAME             "elf32-i386"
 #define ELF_ARCH                       bfd_arch_i386
@@ -4342,7 +4350,7 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    12
+#define elf_backend_got_header_size    elf_i386_got_header_size
 #define elf_backend_plt_alignment      4
 #define elf_backend_dtrel_excludes_plt 1
 #define elf_backend_extern_protected_data 1
index 1751b66bae6e049ec4841a8fa733c43939de59f3..41d39837e758ba3c02fa9eb323b3fc2d6d4ec477 100644 (file)
@@ -2370,6 +2370,13 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+lm32_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
 
 #define ELF_ARCH               bfd_arch_lm32
 #define ELF_TARGET_ID          LM32_ELF_DATA
@@ -2393,7 +2400,7 @@ lm32_elf_fdpic_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
 #define elf_backend_plt_readonly               1
 #define elf_backend_want_got_plt               1
 #define elf_backend_want_plt_sym               0
-#define elf_backend_got_header_size            12
+#define elf_backend_got_header_size            lm32_elf_got_header_size
 #define elf_backend_dtrel_excludes_plt         1
 #define bfd_elf32_bfd_link_hash_table_create   lm32_elf_link_hash_table_create
 #define elf_backend_check_relocs               lm32_elf_check_relocs
index 533d662ee8956b2df1fe8c5c0db855aa13e32fb1..ca15d4d57b4e5882475206b15662875cc7c414c4 100644 (file)
@@ -3645,7 +3645,15 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
     default:              return reloc_class_normal;
     }
 }
-\f
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+m32r_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #define ELF_ARCH               bfd_arch_m32r
 #define ELF_TARGET_ID          M32R_ELF_DATA
 #define ELF_MACHINE_CODE       EM_M32R
@@ -3683,7 +3691,7 @@ m32r_elf_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
 #define elf_backend_want_got_plt 1
 #define elf_backend_plt_readonly 1
 #define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size 12
+#define elf_backend_got_header_size    m32r_elf_got_header_size
 #define elf_backend_dtrel_excludes_plt 1
 
 #define elf_backend_may_use_rel_p      1
index b9b8bec6aa89f00ec5c3dd084e5a058155eb6c71..910f9c54e36e134f23de18173d7f8822b4917233 100644 (file)
@@ -4617,6 +4617,14 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_m68k_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #define TARGET_BIG_SYM                 m68k_elf32_vec
 #define TARGET_BIG_NAME                        "elf32-m68k"
 #define ELF_MACHINE_CODE               EM_68K
@@ -4660,7 +4668,7 @@ elf_m68k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 #define elf_backend_want_got_plt 1
 #define elf_backend_plt_readonly 1
 #define elf_backend_want_plt_sym 0
-#define elf_backend_got_header_size    12
+#define elf_backend_got_header_size    elf32_m68k_got_header_size
 #define elf_backend_rela_normal                1
 #define elf_backend_dtrel_excludes_plt 1
 
index 1b5c2efcd6edfe372cfcd3fb9b75c251aac2f60d..a6af15e0d348b6c9afd48fffe368984bbbde86f3 100644 (file)
@@ -3409,6 +3409,14 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+microblaze_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #define TARGET_LITTLE_SYM      microblaze_elf32_le_vec
 #define TARGET_LITTLE_NAME     "elf32-microblazeel"
 
@@ -3438,7 +3446,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
 #define elf_backend_can_refcount               1
 #define elf_backend_want_got_plt               1
 #define elf_backend_plt_readonly               1
-#define elf_backend_got_header_size            12
+#define elf_backend_got_header_size            microblaze_elf_got_header_size
 #define elf_backend_want_dynrelro              1
 #define elf_backend_rela_normal                        1
 #define elf_backend_dtrel_excludes_plt         1
index b17d51620eae94b5bad1a90d24b198c350614ced..bd3c151b48600ad93f4056673f8c68e22afc7ad6 100644 (file)
@@ -2495,7 +2495,15 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
   /* Function to read in symbolic data.  */
   _bfd_mips_elf_read_ecoff_info
 };
-\f
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_mips_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4 * MIPS_RESERVED_GOTNO;
+}
+
 #define ELF_ARCH                       bfd_arch_mips
 #define ELF_TARGET_ID                  MIPS_ELF_DATA
 #define ELF_MACHINE_CODE               EM_MIPS
@@ -2550,7 +2558,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
 #define elf_backend_grok_psinfo                elf32_mips_grok_psinfo
 #define elf_backend_ecoff_debug_swap   &mips_elf32_ecoff_debug_swap
 
-#define elf_backend_got_header_size    (4 * MIPS_RESERVED_GOTNO)
+#define elf_backend_got_header_size    elf32_mips_got_header_size
 #define elf_backend_want_dynrelro      1
 #define elf_backend_may_use_rel_p      1
 #define elf_backend_may_use_rela_p     0
@@ -2696,7 +2704,7 @@ mips_vxworks_final_write_processing (bfd *abfd)
 #undef elf_backend_default_use_rela_p
 #define elf_backend_default_use_rela_p         1
 #undef elf_backend_got_header_size
-#define elf_backend_got_header_size            (4 * 3)
+#define elf_backend_got_header_size            elf_vxworks_got_header_size
 #undef elf_backend_dtrel_excludes_plt
 #define elf_backend_dtrel_excludes_plt         1
 
index 233af38c2307e1c66dc02d8d5d2cb966e2293420..c54507127e42d10c40387017b02cceae9a102e99 100644 (file)
@@ -13911,6 +13911,14 @@ nds32_elf_unify_tls_model (bfd *inbfd, asection *insec, bfd_byte *incontents,
 }
 
 /* End TLS model conversion.  */
+\f
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+nds32_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
 
 #define ELF_ARCH                               bfd_arch_nds32
 #define ELF_MACHINE_CODE                       EM_NDS32
@@ -13962,7 +13970,7 @@ nds32_elf_unify_tls_model (bfd *inbfd, asection *insec, bfd_byte *incontents,
 #define elf_backend_want_got_plt               1
 #define elf_backend_plt_readonly               1
 #define elf_backend_want_plt_sym               0
-#define elf_backend_got_header_size            12
+#define elf_backend_got_header_size            nds32_elf_got_header_size
 #define elf_backend_may_use_rel_p              1
 #define elf_backend_default_use_rela_p         1
 #define elf_backend_may_use_rela_p             1
index 153bfadc619ac14ce95d5d24d98034ce30ac321a..ee6513b332ac89439641aea3fca3f35f7cc30a6a 100644 (file)
@@ -6004,6 +6004,14 @@ nios2_elf32_can_make_relative_eh_frame (bfd *input_bfd ATTRIBUTE_UNUSED,
   return FALSE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+nios2_elf32_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 /* Implement elf_backend_special_sections.  */
 const struct bfd_elf_special_section elf32_nios2_special_sections[] =
 {
@@ -6081,7 +6089,7 @@ const struct bfd_elf_special_section elf32_nios2_special_sections[] =
 #define TARGET_BIG_SYM                 nios2_elf32_be_vec
 #define TARGET_BIG_NAME                        "elf32-bignios2"
 
-#define elf_backend_got_header_size    12
+#define elf_backend_got_header_size    nios2_elf32_got_header_size
 #define elf_backend_default_execstack  0
 
 #include "elf32-target.h"
index 38406eda3d686736049123b05194938770d56eb6..a7cfdb8a605e5f263424bc5da60ba783c4fc7692 100644 (file)
@@ -3238,6 +3238,13 @@ or1k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+or1k_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
 
 #define ELF_ARCH                       bfd_arch_or1k
 #define ELF_MACHINE_CODE               EM_OR1K
@@ -3270,7 +3277,7 @@ or1k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 #define elf_backend_plt_readonly               1
 #define elf_backend_want_got_plt               1
 #define elf_backend_want_plt_sym               0
-#define elf_backend_got_header_size            12
+#define elf_backend_got_header_size            or1k_elf_got_header_size
 #define elf_backend_dtrel_excludes_plt         1
 #define elf_backend_want_dynrelro              1
 
index 66265ef6009ef69d2450449ea1b9ac861baa58b7..c1c7cea482ac2059f8495438621d70896c401b51 100644 (file)
@@ -10436,7 +10436,7 @@ ppc_elf_vxworks_final_write_processing (bfd *abfd)
 #undef elf_backend_plt_readonly
 #define elf_backend_plt_readonly               1
 #undef elf_backend_got_header_size
-#define elf_backend_got_header_size            12
+#define elf_backend_got_header_size            elf_vxworks_got_header_size
 #undef elf_backend_dtrel_excludes_plt
 #define elf_backend_dtrel_excludes_plt         1
 
index 158f909d05a9b9f0d066100b401cc2eb268b9d31..3c29ae1d9fbd0b98431c0ea79aec5454b9866a54 100644 (file)
@@ -3890,6 +3890,14 @@ elf32_s390_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_s390_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 
 #define TARGET_BIG_SYM s390_elf32_vec
 #define TARGET_BIG_NAME        "elf32-s390"
@@ -3904,7 +3912,7 @@ elf32_s390_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    12
+#define elf_backend_got_header_size    elf_s390_got_header_size
 #define elf_backend_want_dynrelro      1
 #define elf_backend_rela_normal                1
 
index 80380573d5ef560dc5f4d885cf56ab1c25830a5e..d2188c5e68fa1ec5447d481a89dbc09dc71dc513 100644 (file)
@@ -4408,6 +4408,14 @@ elf32_score_new_section_hook (bfd *abfd, asection *sec)
     return s7_elf32_score_new_section_hook (abfd, sec);
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_score_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4 * SCORE_RESERVED_GOTNO;
+}
+
 
 /* s3_s7: don't need to split.  */
 
@@ -4492,7 +4500,7 @@ _bfd_score_elf_common_definition (Elf_Internal_Sym *sym)
 #define elf_backend_grok_psinfo                  _bfd_score_elf_grok_psinfo
 #define elf_backend_can_gc_sections      1
 #define elf_backend_want_plt_sym         0
-#define elf_backend_got_header_size      (4 * SCORE_RESERVED_GOTNO)
+#define elf_backend_got_header_size       elf32_score_got_header_size
 #define elf_backend_plt_header_size      0
 #define elf_backend_collect              TRUE
 #define elf_backend_type_change_ok       TRUE
index 04949463ebf227d12cb42cf1b3168e3b4be8eb5d..d2220653d018a14ff8c83445e706c4c09bcfca6d 100644 (file)
@@ -6548,6 +6548,14 @@ sh_elf_encode_eh_address (bfd *abfd,
   return DW_EH_PE_datarel | DW_EH_PE_sdata4;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+sh_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 12;
+}
+
 #if !defined SH_TARGET_ALREADY_DEFINED
 #define TARGET_BIG_SYM         sh_elf32_vec
 #define TARGET_BIG_NAME                "elf32-sh"
@@ -6615,7 +6623,7 @@ sh_elf_encode_eh_address (bfd *abfd,
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    12
+#define elf_backend_got_header_size    sh_elf_got_header_size
 #define elf_backend_dtrel_excludes_plt 1
 
 #define elf_backend_linux_prpsinfo32_ugid16    TRUE
index 4be618cc554d423ea704177cad51a171898fbccf..60e167709c968bdc2f4fa514fb784cfa6663c3f0 100644 (file)
@@ -216,6 +216,14 @@ elf32_sparc_reloc_type_class (const struct bfd_link_info *info,
     }
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_sparc_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4;
+}
+
 #define TARGET_BIG_SYM sparc_elf32_vec
 #define TARGET_BIG_NAME        "elf32-sparc"
 #define ELF_ARCH       bfd_arch_sparc
@@ -267,7 +275,7 @@ elf32_sparc_reloc_type_class (const struct bfd_link_info *info,
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 0
 #define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 4
+#define elf_backend_got_header_size    elf32_sparc_got_header_size
 #define elf_backend_want_dynrelro 1
 #define elf_backend_rela_normal 1
 
@@ -335,7 +343,7 @@ elf32_sparc_vxworks_final_write_processing (bfd *abfd)
 #undef  elf_backend_plt_readonly
 #define elf_backend_plt_readonly               1
 #undef  elf_backend_got_header_size
-#define elf_backend_got_header_size            12
+#define elf_backend_got_header_size            elf_vxworks_got_header_size
 #undef  elf_backend_dtrel_excludes_plt
 #define elf_backend_dtrel_excludes_plt         1
 #undef  elf_backend_add_symbol_hook
index 5f5abd591fe6bd03b6d21930edad4b3f0b68c20e..cde6ce9c327ac83842566a1ef5f0748601892a6c 100644 (file)
@@ -1756,7 +1756,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd,
         For static executables, we don't reserve anything.  */
 
       plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1;
-      got_section_offset = plt_index + bed->got_header_size / 4;
+      got_section_offset = plt_index + bed->got_header_size (info) / 4;
       got_dp_offset = got_section_offset + htab->params.dsbt_size;
       rela_offset = plt_index * sizeof (Elf32_External_Rela);
 
@@ -4222,6 +4222,14 @@ elf32_tic6x_write_section (bfd *output_bfd,
 
 #define        elf32_bed               elf32_tic6x_bed
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_tic6x_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 8;
+}
+
 #define TARGET_LITTLE_SYM      tic6x_elf32_le_vec
 #define TARGET_LITTLE_NAME     "elf32-tic6x-le"
 #define TARGET_BIG_SYM         tic6x_elf32_be_vec
@@ -4253,7 +4261,7 @@ elf32_tic6x_write_section (bfd *output_bfd,
 #define elf_backend_want_dynrelro      1
 #define elf_backend_plt_readonly       1
 #define elf_backend_rela_normal                1
-#define elf_backend_got_header_size     8
+#define elf_backend_got_header_size     elf32_tic6x_got_header_size
 #define elf_backend_fake_sections       elf32_tic6x_fake_sections
 #define elf_backend_gc_mark_extra_sections elf32_tic6x_gc_mark_extra_sections
 #define elf_backend_create_dynamic_sections \
index dd7560d160a252fcb74f984d928e7c134cba3cff..9c6b3fb22e8405c14b5c3d9c98c3b74461af330f 100644 (file)
@@ -80,6 +80,13 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+tilegx_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4;
+}
 
 #define ELF_ARCH               bfd_arch_tilegx
 #define ELF_TARGET_ID          TILEGX_ELF_DATA
@@ -126,7 +133,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 /* Align PLT mod 64 byte L2 line size. */
 #define elf_backend_plt_alignment 6
 #define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 4
+#define elf_backend_got_header_size         tilegx_elf_got_header_size
 #define elf_backend_want_dynrelro 1
 #define elf_backend_rela_normal 1
 #define elf_backend_default_execstack 0
index 351146673943f839f07b14a7e0ae488eb10446e2..8189aabab5e31b7caa87e9bedcf21f4c5a90b3f5 100644 (file)
@@ -1228,7 +1228,7 @@ tilepro_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
   htab->sgot = s;
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   if (bed->want_got_plt)
     {
@@ -2311,7 +2311,8 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
              || htab->splt->size == 0)
          && (htab->sgot == NULL
              || (htab->sgot->size
-                 == get_elf_backend_data (output_bfd)->got_header_size)))
+                 == get_elf_backend_data (output_bfd)->
+                       got_header_size (info))))
        htab->sgotplt->size = 0;
     }
 
@@ -3719,6 +3720,14 @@ tilepro_additional_program_headers (bfd *abfd,
   return count;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+tilepro_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return GOT_ENTRY_SIZE;
+}
+
 #define ELF_ARCH               bfd_arch_tilepro
 #define ELF_TARGET_ID          TILEPRO_ELF_DATA
 #define ELF_MACHINE_CODE       EM_TILEPRO
@@ -3762,7 +3771,7 @@ tilepro_additional_program_headers (bfd *abfd,
 /* Align PLT mod 64 byte L2 line size. */
 #define elf_backend_plt_alignment 6
 #define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size GOT_ENTRY_SIZE
+#define elf_backend_got_header_size         tilepro_elf_got_header_size
 #define elf_backend_want_dynrelro 1
 #define elf_backend_rela_normal 1
 #define elf_backend_default_execstack 0
index 58a4a8bdfbee928ea4820e4a5bc154268cf6fd39..ab2e011c838da913d0d254a62e4b643814e2ae9d 100644 (file)
@@ -1848,6 +1848,14 @@ elf_vax_plt_sym_val (bfd_vma i, const asection *plt,
   return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_vax_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 16;
+}
+
 #define TARGET_LITTLE_SYM              vax_elf32_vec
 #define TARGET_LITTLE_NAME             "elf32-vax"
 #define ELF_MACHINE_CODE               EM_VAX
@@ -1886,7 +1894,7 @@ elf_vax_plt_sym_val (bfd_vma i, const asection *plt,
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    16
+#define elf_backend_got_header_size    elf_vax_got_header_size
 #define elf_backend_rela_normal                1
 #define elf_backend_dtrel_excludes_plt 1
 
index 400d754c6ac4711ec00e8b0c30a4af0b5dc14bbb..fd87ed4721d45caee4ffc845124a665c53956851 100644 (file)
@@ -127,6 +127,14 @@ elf32_wasm32_info_to_howto_rela (bfd *abfd,
   return cache_ptr->howto != NULL;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_wasm32_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
 #define ELF_ARCH               bfd_arch_wasm32
 #define ELF_TARGET_ID          EM_WEBASSEMBLY
 #define ELF_MACHINE_CODE       EM_WEBASSEMBLY
@@ -152,6 +160,6 @@ elf32_wasm32_info_to_howto_rela (bfd *abfd,
 
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
-#define elf_backend_got_header_size    0
+#define elf_backend_got_header_size    elf32_wasm32_got_header_size
 
 #include "elf32-target.h"
index 5824c599ca88bbb47b772c8ee7eb85217f6489f7..dc06f324635fb20c0b79811b75012d0da8eaeb51 100644 (file)
@@ -11473,6 +11473,14 @@ xtensa_callback_required_dependence (bfd *abfd,
   return ok;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_xtensa_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4;
+}
+
 /* The default literal sections should always be marked as "code" (i.e.,
    SHF_EXECINSTR).  This is particularly important for the Linux kernel
    module loader so that the literals are not placed after the text.  */
@@ -11502,7 +11510,7 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
 #define elf_backend_can_gc_sections    1
 #define elf_backend_can_refcount       1
 #define elf_backend_plt_readonly       1
-#define elf_backend_got_header_size    4
+#define elf_backend_got_header_size    elf_xtensa_got_header_size
 #define elf_backend_want_dynbss                0
 #define elf_backend_want_got_plt       1
 #define elf_backend_dtrel_excludes_plt 1
index 7b708f1e9d91b9893d30dfdd38cbc16e6663bc87..74af9078a487205f1764a25e95c2c028bfe2477a 100644 (file)
@@ -5325,6 +5325,14 @@ elf64_alpha_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
       return reloc_class_normal;
     }
 }
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf64_alpha_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
 \f
 static const struct bfd_elf_special_section elf64_alpha_special_sections[] =
 {
@@ -5499,7 +5507,7 @@ static const struct elf_size_info alpha_elf_size_info =
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 0
 #define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 0
+#define elf_backend_got_header_size elf64_alpha_got_header_size
 #define elf_backend_dtrel_excludes_plt 1
 
 #include "elf64-target.h"
index bf8207e3a7a53bf2a8cb439a9509614903125b74..8450302a98af038faa2bba06294ddee427365436 100644 (file)
@@ -3905,6 +3905,14 @@ elf64_hppa_relocate_section (bfd *output_bfd,
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf64_hppa_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
 static const struct bfd_elf_special_section elf64_hppa_special_sections[] =
 {
   { STRING_COMMA_LEN (".tbss"),         0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
@@ -4020,7 +4028,7 @@ const struct elf_size_info hppa64_elf_size_info =
 #define elf_backend_want_got_plt       0
 #define elf_backend_plt_readonly       0
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size     0
+#define elf_backend_got_header_size     elf64_hppa_got_header_size
 #define elf_backend_type_change_ok     TRUE
 #define elf_backend_get_symbol_type    elf64_hppa_elf_get_symbol_type
 #define elf_backend_reloc_type_class   elf64_hppa_reloc_type_class
index 5ce8775459e117d86aea6afdd8626a1ee08ef51f..0d713438268f03037ddbf8c792b8d001d6b21728 100644 (file)
@@ -5420,6 +5420,14 @@ elf64_ia64_vms_mkobject (bfd *abfd)
     (abfd, sizeof (struct elf64_ia64_vms_obj_tdata), IA64_ELF_DATA);
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf64_ia64_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
 
 /* Size-dependent data and functions.  */
 static const struct elf_size_info elf64_ia64_vms_size_info = {
@@ -5513,7 +5521,7 @@ static const struct elf_size_info elf64_ia64_vms_size_info = {
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
 #define elf_backend_plt_alignment      5
-#define elf_backend_got_header_size    0
+#define elf_backend_got_header_size    elf64_ia64_got_header_size
 #define elf_backend_want_got_plt       1
 #define elf_backend_may_use_rel_p      1
 #define elf_backend_may_use_rela_p     1
index a07c39f1fd13df86314540945c8998c7bd8a8e91..a6b4e1eb78e8ddae7df85e5878453ed97837586c 100644 (file)
@@ -4639,6 +4639,14 @@ elf64_mips_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
       }
     }
 }
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf64_mips_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 8 * MIPS_RESERVED_GOTNO;
+}
 \f
 /* ECOFF swapping routines.  These are used when dealing with the
    .mdebug section, which is in the ECOFF debugging format.  */
@@ -4777,7 +4785,7 @@ const struct elf_size_info mips_elf64_size_info =
 #define elf_backend_grok_prstatus      elf64_mips_grok_prstatus
 #define elf_backend_grok_psinfo                elf64_mips_grok_psinfo
 
-#define elf_backend_got_header_size    (8 * MIPS_RESERVED_GOTNO)
+#define elf_backend_got_header_size    elf64_mips_got_header_size
 #define elf_backend_want_dynrelro      1
 
 /* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations
index 157c454d854116081e944a31809ed2fcefc75754..5b55ec9ebff93c1ef4843beae5469a2784bf601a 100644 (file)
@@ -77,7 +77,7 @@ static bfd_vma opd_entry_value
 #define elf_backend_want_plt_sym 0
 #define elf_backend_plt_alignment 3
 #define elf_backend_plt_not_loaded 1
-#define elf_backend_got_header_size 8
+#define elf_backend_got_header_size ppc64_elf_got_header_size
 #define elf_backend_want_dynrelro 1
 #define elf_backend_can_gc_sections 1
 #define elf_backend_can_refcount 1
@@ -17712,6 +17712,14 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+bfd_vma
+ppc64_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 8;
+}
+
 #include "elf64-target.h"
 
 /* FreeBSD support */
index 0492fd7fad5d568a2c7b566fa7df77d45d1f547d..34c7c70847e0a8958bf98dd957463894953f6d83 100644 (file)
@@ -109,3 +109,5 @@ bfd_boolean ppc64_elf_size_stubs
 (struct bfd_link_info *);
 bfd_boolean ppc64_elf_build_stubs
   (struct bfd_link_info *, char **);
+bfd_vma ppc64_elf_got_header_size
+  (struct struct bfd_link_info *)
\ No newline at end of file
index 0522850a5d8784fef2aece9a4b6c641c3b5ebce3..a69895f5226d4437ce405639ab964b1d6fffdac3 100644 (file)
@@ -3792,6 +3792,14 @@ elf_s390_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_s390_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 24;
+}
+
 bfd_boolean
 bfd_elf_s390_set_options (struct bfd_link_info *info,
                          struct s390_elf_params *params)
@@ -3859,7 +3867,7 @@ const struct elf_size_info s390_elf64_size_info =
 #define elf_backend_want_got_plt       1
 #define elf_backend_plt_readonly       1
 #define elf_backend_want_plt_sym       0
-#define elf_backend_got_header_size    24
+#define elf_backend_got_header_size    elf_s390_got_header_size
 #define elf_backend_want_dynrelro      1
 #define elf_backend_rela_normal                1
 
index 8d352252b63aba8278f8764f5e4d746e1edf5b5e..d537d810cd92f4269be8855ebc1bcac3223f130f 100644 (file)
@@ -829,6 +829,14 @@ elf64_sparc_reloc_type_class (const struct bfd_link_info *info,
     }
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf64_sparc_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 8;
+}
+
 /* Relocations in the 64 bit SPARC ELF ABI are more complex than in
    standard ELF, because R_SPARC_OLO10 has secondary addend in
    ELF64_R_TYPE_DATA field.  This structure is used to redirect the
@@ -963,7 +971,7 @@ const struct elf_size_info elf64_sparc_size_info =
 #define elf_backend_want_got_plt 0
 #define elf_backend_plt_readonly 0
 #define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 8
+#define elf_backend_got_header_size elf64_sparc_got_header_size
 #define elf_backend_want_dynrelro 1
 #define elf_backend_rela_normal 1
 
index 1cb78555229116d85011e4baf1b0398a5a67d2c2..4b329c2e18589368ddd1d516980fec00651fb05b 100644 (file)
@@ -80,6 +80,13 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
   return TRUE;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+tilegx_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 8;
+}
 
 #define ELF_ARCH               bfd_arch_tilegx
 #define ELF_TARGET_ID          TILEGX_ELF_DATA
@@ -127,7 +134,7 @@ tilegx_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
 /* Align PLT mod 64 byte L2 line size. */
 #define elf_backend_plt_alignment 6
 #define elf_backend_want_plt_sym 1
-#define elf_backend_got_header_size 8
+#define elf_backend_got_header_size tilegx_elf_got_header_size
 #define elf_backend_want_dynrelro 1
 #define elf_backend_rela_normal 1
 #define elf_backend_default_execstack 0
index 549a8be6a6a8df4899b40f3d6fa089073bce3ae0..1e5a166d9c1a2fe2c3bcdd69aec9dfab1f80a44a 100644 (file)
@@ -5161,6 +5161,14 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
   return _bfd_x86_elf_link_setup_gnu_properties (info, &init_table);
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf_x86_64_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return GOT_ENTRY_SIZE * 3;
+}
+
 static const struct bfd_elf_special_section
 elf_x86_64_special_sections[]=
 {
@@ -5191,7 +5199,7 @@ elf_x86_64_special_sections[]=
 #define elf_backend_want_got_plt           1
 #define elf_backend_plt_readonly           1
 #define elf_backend_want_plt_sym           0
-#define elf_backend_got_header_size        (GOT_ENTRY_SIZE*3)
+#define elf_backend_got_header_size        elf_x86_64_got_header_size
 #define elf_backend_rela_normal                    1
 #define elf_backend_plt_alignment          4
 #define elf_backend_extern_protected_data   1
index e23d189b9835047c90f84a37970f6cc534727597..5117cb593f2942761c2c1eb4fc3809503b664016 100644 (file)
@@ -189,7 +189,7 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
     }
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   if (bed->want_got_sym)
     {
@@ -14403,7 +14403,7 @@ bfd_elf_gc_common_finalize_got_offsets (bfd *abfd,
   if (bed->want_got_plt)
     gotoff = 0;
   else
-    gotoff = bed->got_header_size;
+    gotoff = bed->got_header_size (info);
 
   /* Do the local .got entries first.  */
   for (i = info->input_bfds; i; i = i->link.next)
@@ -14839,6 +14839,14 @@ _bfd_elf_common_section (asection *sec ATTRIBUTE_UNUSED)
   return bfd_com_section_ptr;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+bfd_vma
+_bfd_elf_default_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
+
 bfd_vma
 _bfd_elf_default_got_elt_size (bfd *abfd,
                               struct bfd_link_info *info ATTRIBUTE_UNUSED,
index 16febe7d04d793040bb5c3ec0ba0921760e1ee1c..50155fb5abd3424cd9fac422070b45573e84f413 100644 (file)
@@ -4028,6 +4028,15 @@ elf32_mips_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
     }
 }
 \f
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elf32_mips_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 4 * MIPS_RESERVED_GOTNO;
+}
+
 /* Depending on the target vector we generate some version of Irix
    executables or "normal" MIPS ELF ABI executables.  */
 static irix_compat_t
@@ -4153,7 +4162,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = {
                                        elf_n32_mips_grok_freebsd_prstatus
 #define elf_backend_ecoff_debug_swap   &mips_elf32_ecoff_debug_swap
 
-#define elf_backend_got_header_size    (4 * MIPS_RESERVED_GOTNO)
+#define elf_backend_got_header_size    elf32_mips_got_header_size
 #define elf_backend_want_dynrelro      1
 
 /* MIPS n32 ELF can use a mixture of REL and RELA, but some Relocations
index c945572ed911c7d48cda7c0e8533c15096a54317..9d53ca71b59d118f7c5609a0a6353bdca948ea27 100644 (file)
@@ -7982,7 +7982,7 @@ aarch64_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
     }
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   return TRUE;
 }
@@ -10315,6 +10315,15 @@ aarch64_elfNN_swap_symbol_out (bfd *abfd,
   bfd_elfNN_swap_symbol_out (abfd, &newsym, cdst, shndx);
 }
 
+/* Define the size of a GOT header, which is the minimum size of the GOT section
+   when one is needed.  */
+
+static bfd_vma
+elfNN_aarch64_got_header_size (struct bfd_link_info *info ATTRIBUTE_UNUSED)
+{
+  return GOT_ENTRY_SIZE * 3;
+}
+
 /* We use this so we can override certain functions
    (though currently we don't).  */
 
@@ -10459,6 +10468,9 @@ const struct elf_size_info elfNN_aarch64_size_info =
 #define elf_backend_merge_gnu_properties       \
   elfNN_aarch64_merge_gnu_properties
 
+#define elf_backend_got_header_size            \
+  elfNN_aarch64_got_header_size
+
 #define elf_backend_can_refcount       1
 #define elf_backend_can_gc_sections    1
 #define elf_backend_plt_readonly       1
@@ -10470,7 +10482,6 @@ const struct elf_size_info elfNN_aarch64_size_info =
 #define elf_backend_default_use_rela_p 1
 #define elf_backend_rela_normal               1
 #define elf_backend_dtrel_excludes_plt 1
-#define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3)
 #define elf_backend_default_execstack  0
 #define elf_backend_extern_protected_data 1
 #define elf_backend_hash_symbol elf_aarch64_hash_symbol
index 292c00b6d0300d693ce66a345dd5d5de56a1e540..b6a49ce73eeca018ff375a1d377d55404cf0d379 100644 (file)
@@ -4991,6 +4991,14 @@ static void
 ignore_errors (const char *fmt ATTRIBUTE_UNUSED, ...)
 {
 }
+
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+elfNN_ia64_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return 0;
+}
 \f
 #define TARGET_LITTLE_SYM              ia64_elfNN_le_vec
 #define TARGET_LITTLE_NAME             "elfNN-ia64-little"
@@ -5068,7 +5076,7 @@ ignore_errors (const char *fmt ATTRIBUTE_UNUSED, ...)
 #define elf_backend_can_gc_sections    1
 #define elf_backend_want_plt_sym       0
 #define elf_backend_plt_alignment      5
-#define elf_backend_got_header_size    0
+#define elf_backend_got_header_size    elfNN_ia64_got_header_size
 #define elf_backend_want_got_plt       1
 #define elf_backend_may_use_rel_p      1
 #define elf_backend_may_use_rela_p     1
index a5b2c8a198cefaf029ff8c2088b0af34a44cd9de..d6cb2e1e0da5419dd3dcc011df1749b1da186a84 100644 (file)
@@ -421,7 +421,7 @@ riscv_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
   htab->sgot = s;
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   if (bed->want_got_plt)
     {
@@ -1448,7 +1448,8 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
              || htab->elf.splt->size == 0)
          && (htab->elf.sgot == NULL
              || (htab->elf.sgot->size
-                 == get_elf_backend_data (output_bfd)->got_header_size)))
+                 == get_elf_backend_data (output_bfd)->
+                       got_header_size (info))))
        htab->elf.sgotplt->size = 0;
     }
 
@@ -4952,6 +4953,14 @@ riscv_elf_obj_attrs_arg_type (int tag)
   return (tag & 1) != 0 ? ATTR_TYPE_FLAG_STR_VAL : ATTR_TYPE_FLAG_INT_VAL;
 }
 
+/* Determine the size of the header of for the GOT section.  */
+
+static bfd_vma
+riscv_elf_got_header_size (struct bfd_link_info* info ATTRIBUTE_UNUSED)
+{
+  return ARCH_SIZE / 8;
+}
+
 #define TARGET_LITTLE_SYM              riscv_elfNN_vec
 #define TARGET_LITTLE_NAME             "elfNN-littleriscv"
 
@@ -4975,6 +4984,7 @@ riscv_elf_obj_attrs_arg_type (int tag)
 #define elf_backend_plt_sym_val                     riscv_elf_plt_sym_val
 #define elf_backend_grok_prstatus           riscv_elf_grok_prstatus
 #define elf_backend_grok_psinfo                     riscv_elf_grok_psinfo
+#define elf_backend_got_header_size         riscv_elf_got_header_size
 #define elf_backend_object_p                riscv_elf_object_p
 #define elf_info_to_howto_rel               NULL
 #define elf_info_to_howto                   riscv_info_to_howto_rela
@@ -4989,7 +4999,6 @@ riscv_elf_obj_attrs_arg_type (int tag)
 #define elf_backend_plt_readonly       1
 #define elf_backend_plt_alignment      4
 #define elf_backend_want_plt_sym       1
-#define elf_backend_got_header_size    (ARCH_SIZE / 8)
 #define elf_backend_want_dynrelro      1
 #define elf_backend_rela_normal                1
 #define elf_backend_default_execstack  0
index c0970fb85d04643ecf3dfbeea0ae6e6eec64230a..d26abb8f3add06987cd95d1aa7e6fda4a0a4d633 100644 (file)
@@ -9378,7 +9378,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
             are reserved.  */
          if (htab->root.target_os != is_vxworks)
            htab->plt_got_index
-             += (get_elf_backend_data (dynobj)->got_header_size
+             += (get_elf_backend_data (dynobj)->got_header_size (info)
                  / MIPS_ELF_GOT_SIZE (dynobj));
 
          /* On VxWorks, also allocate room for the header's
index a137c4681f1dc09cd6c817bcd7d93b72323be09f..d527a604f0f521164afd97818ec8477661a2dded 100644 (file)
 #define elf_backend_core_find_build_id _bfd_elfNN_core_find_build_id
 #endif
 #ifndef elf_backend_got_header_size
-#define elf_backend_got_header_size    0
+#define elf_backend_got_header_size    _bfd_elf_default_got_header_size
 #endif
 #ifndef elf_backend_got_elt_size
 #define elf_backend_got_elt_size _bfd_elf_default_got_elt_size
index abe344c0c8620b100765db1b9b9f30f6c69e71ad..039a21fc190e0424726e1daf01d81a85a9fc0e0c 100644 (file)
@@ -1443,7 +1443,7 @@ tilegx_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
   htab->sgot = s;
 
   /* The first bit of the global offset table is the header.  */
-  s->size += bed->got_header_size;
+  s->size += bed->got_header_size (info);
 
   if (bed->want_got_plt)
     {
@@ -2557,7 +2557,8 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
              || htab->elf.splt->size == 0)
          && (htab->elf.sgot == NULL
              || (htab->elf.sgot->size
-                 == get_elf_backend_data (output_bfd)->got_header_size)))
+                 == get_elf_backend_data (output_bfd)->
+                       got_header_size (info))))
        htab->elf.sgotplt->size = 0;
     }