| Index: bfd/elf32-vax.c
|
| diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
|
| index 643381c5c43b8311f232c272df395e8610c727a1..84ec972563f328974ba7fdc3c1cc62173cb7ac62 100644
|
| --- a/bfd/elf32-vax.c
|
| +++ b/bfd/elf32-vax.c
|
| @@ -1,6 +1,6 @@
|
| /* VAX series support for 32-bit ELF
|
| Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
| - 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
| + 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
| Free Software Foundation, Inc.
|
| Contributed by Matt Thomas <matt@3am-software.com>.
|
|
|
| @@ -53,7 +53,7 @@ static bfd_vma elf_vax_plt_sym_val (bfd_vma, const asection *,
|
|
|
| static bfd_boolean elf32_vax_set_private_flags (bfd *, flagword);
|
| static bfd_boolean elf32_vax_merge_private_bfd_data (bfd *, bfd *);
|
| -static bfd_boolean elf32_vax_print_private_bfd_data (bfd *, PTR);
|
| +static bfd_boolean elf32_vax_print_private_bfd_data (bfd *, void *);
|
|
|
| static reloc_howto_type howto_table[] = {
|
| HOWTO (R_VAX_NONE, /* type */
|
| @@ -423,7 +423,7 @@ static bfd_boolean elf_vax_instantiate_got_entries (struct elf_link_hash_entry *
|
| #define elf_vax_link_hash_traverse(table, func, info) \
|
| (elf_link_hash_traverse \
|
| ((table), \
|
| - (bfd_boolean (*) (struct elf_link_hash_entry *, PTR)) (func), \
|
| + (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
|
| (info)))
|
|
|
| /* Create an entry in an VAX ELF linker hash table. */
|
| @@ -514,7 +514,7 @@ elf32_vax_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
|
|
|
| /* Display the flags field */
|
| static bfd_boolean
|
| -elf32_vax_print_private_bfd_data (bfd *abfd, PTR ptr)
|
| +elf32_vax_print_private_bfd_data (bfd *abfd, void * ptr)
|
| {
|
| FILE *file = (FILE *) ptr;
|
|
|
| @@ -613,24 +613,23 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
|
|
| if (sgot == NULL)
|
| {
|
| - sgot = bfd_get_section_by_name (dynobj, ".got");
|
| + sgot = bfd_get_linker_section (dynobj, ".got");
|
| BFD_ASSERT (sgot != NULL);
|
| }
|
|
|
| if (srelgot == NULL
|
| && (h != NULL || info->shared))
|
| {
|
| - srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
| + srelgot = bfd_get_linker_section (dynobj, ".rela.got");
|
| if (srelgot == NULL)
|
| {
|
| - srelgot = bfd_make_section_with_flags (dynobj,
|
| - ".rela.got",
|
| - (SEC_ALLOC
|
| - | SEC_LOAD
|
| - | SEC_HAS_CONTENTS
|
| - | SEC_IN_MEMORY
|
| - | SEC_LINKER_CREATED
|
| - | SEC_READONLY));
|
| + flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
|
| + | SEC_IN_MEMORY | SEC_LINKER_CREATED
|
| + | SEC_READONLY);
|
| +
|
| + srelgot = bfd_make_section_anyway_with_flags (dynobj,
|
| + ".rela.got",
|
| + flags);
|
| if (srelgot == NULL
|
| || !bfd_set_section_alignment (dynobj, srelgot, 2))
|
| return FALSE;
|
| @@ -967,7 +966,7 @@ elf_vax_adjust_dynamic_symbol (info, h)
|
| return FALSE;
|
| }
|
|
|
| - s = bfd_get_section_by_name (dynobj, ".plt");
|
| + s = bfd_get_linker_section (dynobj, ".plt");
|
| BFD_ASSERT (s != NULL);
|
|
|
| /* If this is the first .plt entry, make room for the special
|
| @@ -997,13 +996,13 @@ elf_vax_adjust_dynamic_symbol (info, h)
|
| /* We also need to make an entry in the .got.plt section, which
|
| will be placed in the .got section by the linker script. */
|
|
|
| - s = bfd_get_section_by_name (dynobj, ".got.plt");
|
| + s = bfd_get_linker_section (dynobj, ".got.plt");
|
| BFD_ASSERT (s != NULL);
|
| s->size += 4;
|
|
|
| /* We also need to make an entry in the .rela.plt section. */
|
|
|
| - s = bfd_get_section_by_name (dynobj, ".rela.plt");
|
| + s = bfd_get_linker_section (dynobj, ".rela.plt");
|
| BFD_ASSERT (s != NULL);
|
| s->size += sizeof (Elf32_External_Rela);
|
|
|
| @@ -1036,13 +1035,6 @@ elf_vax_adjust_dynamic_symbol (info, h)
|
| if (info->shared)
|
| return TRUE;
|
|
|
| - if (h->size == 0)
|
| - {
|
| - (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
|
| - h->root.root.string);
|
| - return TRUE;
|
| - }
|
| -
|
| /* We must allocate the symbol in our .dynbss section, which will
|
| become part of the .bss section of the executable. There will be
|
| an entry for this symbol in the .dynsym section. The dynamic
|
| @@ -1053,18 +1045,18 @@ elf_vax_adjust_dynamic_symbol (info, h)
|
| both the dynamic object and the regular object will refer to the
|
| same memory location for the variable. */
|
|
|
| - s = bfd_get_section_by_name (dynobj, ".dynbss");
|
| + s = bfd_get_linker_section (dynobj, ".dynbss");
|
| BFD_ASSERT (s != NULL);
|
|
|
| /* We must generate a R_VAX_COPY reloc to tell the dynamic linker to
|
| copy the initial value out of the dynamic object and into the
|
| runtime process image. We need to remember the offset into the
|
| .rela.bss section we are going to use. */
|
| - if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
|
| + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0)
|
| {
|
| asection *srel;
|
|
|
| - srel = bfd_get_section_by_name (dynobj, ".rela.bss");
|
| + srel = bfd_get_linker_section (dynobj, ".rela.bss");
|
| BFD_ASSERT (srel != NULL);
|
| srel->size += sizeof (Elf32_External_Rela);
|
| h->needs_copy = 1;
|
| @@ -1092,7 +1084,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
| /* Set the contents of the .interp section to the interpreter. */
|
| if (info->executable)
|
| {
|
| - s = bfd_get_section_by_name (dynobj, ".interp");
|
| + s = bfd_get_linker_section (dynobj, ".interp");
|
| BFD_ASSERT (s != NULL);
|
| s->size = sizeof ELF_DYNAMIC_INTERPRETER;
|
| s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER;
|
| @@ -1105,13 +1097,13 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
| not actually use these entries. Reset the size of .rela.got
|
| and .got, which will cause it to get stripped from the output
|
| file below. */
|
| - s = bfd_get_section_by_name (dynobj, ".rela.got");
|
| + s = bfd_get_linker_section (dynobj, ".rela.got");
|
| if (s != NULL)
|
| s->size = 0;
|
| - s = bfd_get_section_by_name (dynobj, ".got.plt");
|
| + s = bfd_get_linker_section (dynobj, ".got.plt");
|
| if (s != NULL)
|
| s->size = 0;
|
| - s = bfd_get_section_by_name (dynobj, ".got");
|
| + s = bfd_get_linker_section (dynobj, ".got");
|
| if (s != NULL)
|
| s->size = 0;
|
| }
|
| @@ -1130,7 +1122,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
| instantiate (allocate space for them). */
|
| elf_link_hash_traverse (elf_hash_table (info),
|
| elf_vax_instantiate_got_entries,
|
| - (PTR) info);
|
| + info);
|
|
|
| /* The check_relocs and adjust_dynamic_symbol entry points have
|
| determined the sizes of the various dynamic sections. Allocate
|
| @@ -1269,7 +1261,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
|
|
| static bfd_boolean
|
| elf_vax_discard_copies (struct elf_vax_link_hash_entry *h,
|
| - PTR ignore ATTRIBUTE_UNUSED)
|
| + void * ignore ATTRIBUTE_UNUSED)
|
| {
|
| struct elf_vax_pcrel_relocs_copied *s;
|
|
|
| @@ -1291,7 +1283,7 @@ elf_vax_discard_copies (struct elf_vax_link_hash_entry *h,
|
| will be reserved for the symbol. */
|
|
|
| static bfd_boolean
|
| -elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, PTR infoptr)
|
| +elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, void * infoptr)
|
| {
|
| struct bfd_link_info *info = (struct bfd_link_info *) infoptr;
|
| bfd *dynobj;
|
| @@ -1306,8 +1298,8 @@ elf_vax_instantiate_got_entries (struct elf_link_hash_entry *h, PTR infoptr)
|
| if (dynobj == NULL)
|
| return TRUE;
|
|
|
| - sgot = bfd_get_section_by_name (dynobj, ".got");
|
| - srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
|
| + sgot = bfd_get_linker_section (dynobj, ".got");
|
| + srelgot = bfd_get_linker_section (dynobj, ".rela.got");
|
|
|
| if (!elf_hash_table (info)->dynamic_sections_created
|
| || (info->shared && info->symbolic)
|
| @@ -1450,9 +1442,9 @@ elf_vax_relocate_section (bfd *output_bfd,
|
| relocation = 0;
|
| }
|
|
|
| - if (sec != NULL && elf_discarded_section (sec))
|
| + if (sec != NULL && discarded_section (sec))
|
| RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
|
| - rel, relend, howto, contents);
|
| + rel, 1, relend, howto, 0, contents);
|
|
|
| if (info->relocatable)
|
| continue;
|
| @@ -1477,7 +1469,7 @@ elf_vax_relocate_section (bfd *output_bfd,
|
|
|
| if (sgot == NULL)
|
| {
|
| - sgot = bfd_get_section_by_name (dynobj, ".got");
|
| + sgot = bfd_get_linker_section (dynobj, ".got");
|
| BFD_ASSERT (sgot != NULL);
|
| }
|
|
|
| @@ -1553,13 +1545,13 @@ elf_vax_relocate_section (bfd *output_bfd,
|
|
|
| if (splt == NULL)
|
| {
|
| - splt = bfd_get_section_by_name (dynobj, ".plt");
|
| + splt = bfd_get_linker_section (dynobj, ".plt");
|
| BFD_ASSERT (splt != NULL);
|
| }
|
|
|
| if (sgotplt == NULL)
|
| {
|
| - sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
|
| + sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
|
| BFD_ASSERT (sgotplt != NULL);
|
| }
|
|
|
| @@ -1698,14 +1690,12 @@ elf_vax_relocate_section (bfd *output_bfd,
|
| }
|
| }
|
|
|
| - if (!strcmp (bfd_get_section_name (input_bfd, input_section),
|
| - ".text") != 0 ||
|
| - (info->shared
|
| - && ELF32_R_TYPE(outrel.r_info) != R_VAX_32
|
| - && ELF32_R_TYPE(outrel.r_info) != R_VAX_RELATIVE
|
| - && ELF32_R_TYPE(outrel.r_info) != R_VAX_COPY
|
| - && ELF32_R_TYPE(outrel.r_info) != R_VAX_JMP_SLOT
|
| - && ELF32_R_TYPE(outrel.r_info) != R_VAX_GLOB_DAT))
|
| + if ((input_section->flags & SEC_CODE) != 0
|
| + || (ELF32_R_TYPE (outrel.r_info) != R_VAX_32
|
| + && ELF32_R_TYPE (outrel.r_info) != R_VAX_RELATIVE
|
| + && ELF32_R_TYPE (outrel.r_info) != R_VAX_COPY
|
| + && ELF32_R_TYPE (outrel.r_info) != R_VAX_JMP_SLOT
|
| + && ELF32_R_TYPE (outrel.r_info) != R_VAX_GLOB_DAT))
|
| {
|
| if (h != NULL)
|
| (*_bfd_error_handler)
|
| @@ -1817,9 +1807,9 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
| it up. */
|
| BFD_ASSERT (h->dynindx != -1);
|
|
|
| - splt = bfd_get_section_by_name (dynobj, ".plt");
|
| - sgot = bfd_get_section_by_name (dynobj, ".got.plt");
|
| - srela = bfd_get_section_by_name (dynobj, ".rela.plt");
|
| + splt = bfd_get_linker_section (dynobj, ".plt");
|
| + sgot = bfd_get_linker_section (dynobj, ".got.plt");
|
| + srela = bfd_get_linker_section (dynobj, ".rela.plt");
|
| BFD_ASSERT (splt != NULL && sgot != NULL && srela != NULL);
|
|
|
| addend = 2 * (h->plt.offset & 1);
|
| @@ -1881,8 +1871,8 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
|
|
| /* This symbol has an entry in the global offset table. Set it
|
| up. */
|
| - sgot = bfd_get_section_by_name (dynobj, ".got");
|
| - srela = bfd_get_section_by_name (dynobj, ".rela.got");
|
| + sgot = bfd_get_linker_section (dynobj, ".got");
|
| + srela = bfd_get_linker_section (dynobj, ".rela.got");
|
| BFD_ASSERT (sgot != NULL && srela != NULL);
|
|
|
| rela.r_offset = (sgot->output_section->vma
|
| @@ -1923,8 +1913,7 @@ elf_vax_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
| && (h->root.type == bfd_link_hash_defined
|
| || h->root.type == bfd_link_hash_defweak));
|
|
|
| - s = bfd_get_section_by_name (h->root.u.def.section->owner,
|
| - ".rela.bss");
|
| + s = bfd_get_linker_section (dynobj, ".rela.bss");
|
| BFD_ASSERT (s != NULL);
|
|
|
| rela.r_offset = (h->root.u.def.value
|
| @@ -1955,16 +1944,16 @@ elf_vax_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
|
|
| dynobj = elf_hash_table (info)->dynobj;
|
|
|
| - sgot = bfd_get_section_by_name (dynobj, ".got.plt");
|
| + sgot = bfd_get_linker_section (dynobj, ".got.plt");
|
| BFD_ASSERT (sgot != NULL);
|
| - sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
|
| + sdyn = bfd_get_linker_section (dynobj, ".dynamic");
|
|
|
| if (elf_hash_table (info)->dynamic_sections_created)
|
| {
|
| asection *splt;
|
| Elf32_External_Dyn *dyncon, *dynconend;
|
|
|
| - splt = bfd_get_section_by_name (dynobj, ".plt");
|
| + splt = bfd_get_linker_section (dynobj, ".plt");
|
| BFD_ASSERT (splt != NULL && sdyn != NULL);
|
|
|
| dyncon = (Elf32_External_Dyn *) sdyn->contents;
|
|
|