diff options
author | Alan Modra <amodra@gmail.com> | 2012-06-29 14:46:03 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2012-06-29 14:46:03 +0000 |
commit | 3d4d4302b99ee621e11ac8ef60ac9185da94654b (patch) | |
tree | 95c1467db42073fd90064c7ab2d32ff28c133138 /bfd/elf32-m68k.c | |
parent | b6ba681cdacf16ce4369eb5e824c6bac2540f332 (diff) | |
download | gdb-3d4d4302b99ee621e11ac8ef60ac9185da94654b.zip gdb-3d4d4302b99ee621e11ac8ef60ac9185da94654b.tar.gz gdb-3d4d4302b99ee621e11ac8ef60ac9185da94654b.tar.bz2 |
* section.c (bfd_get_linker_section): New function.
* elf32-arm.c: When retrieving SEC_LINKER_CREATED sections, use
the above throughout rather than bfd_get_section_by_name. Use
bfd_make_section_anyway rather than bfd_make_section when creating
them.
* elf32-bfin.c: Likewise.
* elf32-cr16.c: Likewise.
* elf32-cris.c: Likewise.
* elf32-frv.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i370.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-lm32.c: Likewise.
* elf32-m32c.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-microblaze.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-rl78.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-score.c: Likewise.
* elf32-score7.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-tic6x.c: Likewise.
* elf32-tilepro.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-xstormy16.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ia64-vms.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-sparc.c: Likewise.
* elf64-x86-64.c: Likewise.
* elfnn-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* elfxx-tilegx.c: Likewise.
* elflink.c: Likewise.
* elf-vxworks.c: Likewise.
* elf-m10300.c: Likewise. Also make use of htab plt, got and
gotplt shortcuts.
* bfd-in2.h: Regenerate.
* elf32-lm32.c (lm32_elf_check_relocs): Use the correct bfd when
calling create_rofixup_section.
* elflink.c (bfd_elf_final_link): Simplify test for .dynstr.
Diffstat (limited to 'bfd/elf32-m68k.c')
-rw-r--r-- | bfd/elf32-m68k.c | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 1cb03ae..9df60ac 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2468,7 +2468,7 @@ elf_m68k_partition_multi_got (struct bfd_link_info *info) { asection *s; - s = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".got"); + s = bfd_get_linker_section (elf_hash_table (info)->dynobj, ".got"); if (s != NULL) s->size = arg_.offset; else @@ -2477,7 +2477,7 @@ elf_m68k_partition_multi_got (struct bfd_link_info *info) BFD_ASSERT (arg_.slots_relas_diff <= arg_.n_slots); arg_.n_slots -= arg_.slots_relas_diff; - s = bfd_get_section_by_name (elf_hash_table (info)->dynobj, ".rela.got"); + s = bfd_get_linker_section (elf_hash_table (info)->dynobj, ".rela.got"); if (s != NULL) s->size = arg_.n_slots * sizeof (Elf32_External_Rela); else @@ -2675,24 +2675,22 @@ elf_m68k_check_relocs (abfd, info, sec, relocs) 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; @@ -3182,7 +3180,7 @@ elf_m68k_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 @@ -3209,12 +3207,12 @@ elf_m68k_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); @@ -3262,7 +3260,7 @@ elf_m68k_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_68K_COPY reloc to tell the dynamic linker to @@ -3273,7 +3271,7 @@ elf_m68k_adjust_dynamic_symbol (info, h) { 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; @@ -3302,7 +3300,7 @@ elf_m68k_size_dynamic_sections (output_bfd, 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; @@ -3315,7 +3313,7 @@ elf_m68k_size_dynamic_sections (output_bfd, info) not actually use these entries. Reset the size of .rela.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; } @@ -3746,7 +3744,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, if (sgot == NULL) { - sgot = bfd_get_section_by_name (dynobj, ".got"); + sgot = bfd_get_linker_section (dynobj, ".got"); if (sgot != NULL) sgot_output_offset = sgot->output_offset; @@ -3821,7 +3819,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, if (sgot == NULL) { - sgot = bfd_get_section_by_name (dynobj, ".got"); + sgot = bfd_get_linker_section (dynobj, ".got"); BFD_ASSERT (sgot != NULL); } @@ -3892,7 +3890,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, { if (srela == NULL) { - srela = bfd_get_section_by_name (dynobj, ".rela.got"); + srela = bfd_get_linker_section (dynobj, ".rela.got"); BFD_ASSERT (srela != NULL); } @@ -3996,7 +3994,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, if (splt == NULL) { - splt = bfd_get_section_by_name (dynobj, ".plt"); + splt = bfd_get_linker_section (dynobj, ".plt"); BFD_ASSERT (splt != NULL); } @@ -4015,7 +4013,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, if (splt == NULL) { - splt = bfd_get_section_by_name (dynobj, ".plt"); + splt = bfd_get_linker_section (dynobj, ".plt"); BFD_ASSERT (splt != NULL); } @@ -4296,9 +4294,9 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) BFD_ASSERT (h->dynindx != -1); plt_info = elf_m68k_hash_table (info)->plt_info; - 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); /* Get the index in the procedure linkage table which @@ -4363,8 +4361,8 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) /* 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); got_entry = elf_m68k_hash_entry (h)->glist; @@ -4487,8 +4485,7 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) && (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 @@ -4516,16 +4513,16 @@ elf_m68k_finish_dynamic_sections (output_bfd, 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; |