2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
* elf32-arm.c (create_got_section): Get existing .rela.got section. * elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise. * elf32-lm32.c (create_got_section): Likewise. * elf32-m32r.c (create_got_section): Likewise. * elf32-ppc.c (ppc_elf_create_got): Likewise. * elf32-s390.c (create_got_section): Likewise. * elf32-sh.c (create_got_section): Likewise. * elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise. * elf64-s390.c (create_got_section): Likewise. * elfxx-sparc.c (create_got_section): Likewise. * elflink.c (_bfd_elf_create_got_section): Properly initialize the GOT size.
This commit is contained in:
parent
6bfb4e30b8
commit
64e77c6d5f
12 changed files with 45 additions and 103 deletions
|
@ -1,3 +1,20 @@
|
||||||
|
2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* elf32-arm.c (create_got_section): Get existing .rela.got
|
||||||
|
section.
|
||||||
|
* elf32-hppa.c (elf32_hppa_create_dynamic_sections): Likewise.
|
||||||
|
* elf32-lm32.c (create_got_section): Likewise.
|
||||||
|
* elf32-m32r.c (create_got_section): Likewise.
|
||||||
|
* elf32-ppc.c (ppc_elf_create_got): Likewise.
|
||||||
|
* elf32-s390.c (create_got_section): Likewise.
|
||||||
|
* elf32-sh.c (create_got_section): Likewise.
|
||||||
|
* elf32-xtensa.c (elf_xtensa_create_dynamic_sections): Likewise.
|
||||||
|
* elf64-s390.c (create_got_section): Likewise.
|
||||||
|
* elfxx-sparc.c (create_got_section): Likewise.
|
||||||
|
|
||||||
|
* elflink.c (_bfd_elf_create_got_section): Properly initialize
|
||||||
|
the GOT size.
|
||||||
|
|
||||||
2009-06-16 H.J. Lu <hongjiu.lu@intel.com>
|
2009-06-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): New.
|
* elf-bfd.h (ELF_LOCAL_SYMBOL_HASH): New.
|
||||||
|
|
|
@ -2748,15 +2748,9 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
|
||||||
if (!htab->sgot || !htab->sgotplt)
|
if (!htab->sgot || !htab->sgotplt)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj,
|
htab->srelgot = bfd_get_section_by_name (dynobj,
|
||||||
RELOC_SECTION (htab, ".got"),
|
RELOC_SECTION (htab, ".got"));
|
||||||
(SEC_ALLOC | SEC_LOAD
|
if (htab->srelgot == NULL)
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1011,16 +1011,7 @@ elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||||
htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt");
|
htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt");
|
||||||
|
|
||||||
htab->sgot = bfd_get_section_by_name (abfd, ".got");
|
htab->sgot = bfd_get_section_by_name (abfd, ".got");
|
||||||
htab->srelgot = bfd_make_section_with_flags (abfd, ".rela.got",
|
htab->srelgot = bfd_get_section_by_name (abfd, ".rela.got");
|
||||||
(SEC_ALLOC
|
|
||||||
| SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (abfd, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss");
|
htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss");
|
||||||
htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss");
|
htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss");
|
||||||
|
|
|
@ -225,20 +225,10 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
|
||||||
htab = lm32_elf_hash_table (info);
|
htab = lm32_elf_hash_table (info);
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
if (! htab->sgot || ! htab->sgotplt)
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
|
if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
|
|
||||||
(SEC_ALLOC
|
|
||||||
| SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1623,20 +1623,10 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
|
||||||
htab = m32r_elf_hash_table (info);
|
htab = m32r_elf_hash_table (info);
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
if (! htab->sgot || ! htab->sgotplt)
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
|
if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
|
|
||||||
(SEC_ALLOC
|
|
||||||
| SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2845,12 +2845,9 @@ ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
|
htab->relgot = bfd_get_section_by_name (abfd, ".rela.got");
|
||||||
| SEC_LINKER_CREATED | SEC_READONLY);
|
if (!htab->relgot)
|
||||||
htab->relgot = bfd_make_section_with_flags (abfd, ".rela.got", flags);
|
abort ();
|
||||||
if (!htab->relgot
|
|
||||||
|| ! bfd_set_section_alignment (abfd, htab->relgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -821,18 +821,10 @@ create_got_section (dynobj, info)
|
||||||
htab = elf_s390_hash_table (info);
|
htab = elf_s390_hash_table (info);
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
if (!htab->sgot || !htab->sgotplt)
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
|
if (!htab->sgot || !htab->sgotplt || !htab->srelgot)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
|
|
||||||
(SEC_ALLOC | SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2303,18 +2303,9 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
|
||||||
htab = sh_elf_hash_table (info);
|
htab = sh_elf_hash_table (info);
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
if (! htab->sgot || ! htab->sgotplt)
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
|
if (! htab->sgot || ! htab->sgotplt || ! htab->srelgot)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
|
|
||||||
(SEC_ALLOC | SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1404,6 +1404,7 @@ elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||||
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
|
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
|
|
||||||
/* Create any extra PLT sections in case check_relocs has already
|
/* Create any extra PLT sections in case check_relocs has already
|
||||||
been called on all the non-dynamic input files. */
|
been called on all the non-dynamic input files. */
|
||||||
|
@ -1419,12 +1420,6 @@ elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||||
|| ! bfd_set_section_flags (dynobj, htab->sgotplt, flags))
|
|| ! bfd_set_section_flags (dynobj, htab->sgotplt, flags))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Create ".rela.got". */
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got", flags);
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* Create ".got.loc" (literal tables for use by dynamic linker). */
|
/* Create ".got.loc" (literal tables for use by dynamic linker). */
|
||||||
htab->sgotloc = bfd_make_section_with_flags (dynobj, ".got.loc", flags);
|
htab->sgotloc = bfd_make_section_with_flags (dynobj, ".got.loc", flags);
|
||||||
if (htab->sgotloc == NULL
|
if (htab->sgotloc == NULL
|
||||||
|
|
|
@ -776,18 +776,9 @@ create_got_section (dynobj, info)
|
||||||
htab = elf_s390_hash_table (info);
|
htab = elf_s390_hash_table (info);
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
||||||
if (!htab->sgot || !htab->sgotplt)
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
|
if (!htab->sgot || !htab->sgotplt || !htab->srelgot)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
|
|
||||||
(SEC_ALLOC | SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY));
|
|
||||||
if (htab->srelgot == NULL
|
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot, 3))
|
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,12 +110,6 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
|
||||||
|
|
||||||
flags = bed->dynamic_sec_flags;
|
flags = bed->dynamic_sec_flags;
|
||||||
|
|
||||||
s = bfd_make_section_with_flags (abfd, ".got", flags);
|
|
||||||
if (s == NULL
|
|
||||||
|| !bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
|
|
||||||
return FALSE;
|
|
||||||
htab->sgot = s;
|
|
||||||
|
|
||||||
s = bfd_make_section_with_flags (abfd,
|
s = bfd_make_section_with_flags (abfd,
|
||||||
(bed->rela_plts_and_copies_p
|
(bed->rela_plts_and_copies_p
|
||||||
? ".rela.got" : ".rel.got"),
|
? ".rela.got" : ".rel.got"),
|
||||||
|
@ -126,6 +120,12 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
htab->srelgot = s;
|
htab->srelgot = s;
|
||||||
|
|
||||||
|
s = bfd_make_section_with_flags (abfd, ".got", flags);
|
||||||
|
if (s == NULL
|
||||||
|
|| !bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
|
||||||
|
return FALSE;
|
||||||
|
htab->sgot = s;
|
||||||
|
|
||||||
if (bed->want_got_plt)
|
if (bed->want_got_plt)
|
||||||
{
|
{
|
||||||
s = bfd_make_section_with_flags (abfd, ".got.plt", flags);
|
s = bfd_make_section_with_flags (abfd, ".got.plt", flags);
|
||||||
|
@ -136,6 +136,9 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
|
||||||
htab->sgotplt = s;
|
htab->sgotplt = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The first bit of the global offset table is the header. */
|
||||||
|
s->size += bed->got_header_size;
|
||||||
|
|
||||||
if (bed->want_got_sym)
|
if (bed->want_got_sym)
|
||||||
{
|
{
|
||||||
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
|
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
|
||||||
|
@ -149,9 +152,6 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The first bit of the global offset table is the header. */
|
|
||||||
s->size += bed->got_header_size;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -899,13 +899,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
|
||||||
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
htab->sgot = bfd_get_section_by_name (dynobj, ".got");
|
||||||
BFD_ASSERT (htab->sgot != NULL);
|
BFD_ASSERT (htab->sgot != NULL);
|
||||||
|
|
||||||
htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
|
htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
||||||
SEC_ALLOC
|
|
||||||
| SEC_LOAD
|
|
||||||
| SEC_HAS_CONTENTS
|
|
||||||
| SEC_IN_MEMORY
|
|
||||||
| SEC_LINKER_CREATED
|
|
||||||
| SEC_READONLY);
|
|
||||||
if (htab->srelgot == NULL
|
if (htab->srelgot == NULL
|
||||||
|| ! bfd_set_section_alignment (dynobj, htab->srelgot,
|
|| ! bfd_set_section_alignment (dynobj, htab->srelgot,
|
||||||
htab->word_align_power))
|
htab->word_align_power))
|
||||||
|
|
Loading…
Reference in a new issue