Home | History | Annotate | Download | only in bfd

Lines Matching refs:elf

1 /* Intel 80386/80486-specific support for 32-bit ELF
25 #include "elf-bfd.h"
26 #include "elf-nacl.h"
27 #include "elf-vxworks.h"
36 #include "elf/i386.h"
510 /* Functions for the i386 ELF linker.
715 /* i386 ELF linker hash entry. */
719 struct elf_link_hash_entry elf;
781 /* i386 ELF linker hash table. */
785 struct elf_link_hash_table elf;
825 /* Get the i386 ELF linker hash table from a link_info structure. */
832 ((htab)->elf.srelplt->reloc_count * 4)
834 /* Create an entry in an i386 ELF linker hash table. */
905 e.elf.indx = sec->id;
906 e.elf.dynstr_index = ELF32_R_SYM (rel->r_info);
916 return &ret->elf;
925 ret->elf.indx = sec->id;
926 ret->elf.dynstr_index = ELF32_R_SYM (rel->r_info);
927 ret->elf.dynindx = -1;
930 return &ret->elf;
933 /* Destroy an i386 ELF linker hash table. */
948 /* Create an i386 ELF linker hash table. */
960 if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd,
979 ret->elf.root.hash_table_free = elf_i386_link_hash_table_free;
981 return &ret->elf.root;
1015 && htab->elf.splt != NULL)
1510 if (htab->elf.dynobj == NULL)
1511 htab->elf.dynobj = abfd;
1512 if (!_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info))
1665 if (htab->elf.sgot == NULL)
1667 if (htab->elf.dynobj == NULL)
1668 htab->elf.dynobj = abfd;
1669 if (!_bfd_elf_create_got_section (htab->elf.dynobj, info))
1747 if (htab->elf.dynobj == NULL)
1748 htab->elf.dynobj = abfd;
1751 (sec, htab->elf.dynobj, 2, abfd, /*rela?*/ FALSE);
1788 p = (struct elf_dyn_relocs *) bfd_alloc (htab->elf.dynobj,
2204 elf.dynamic_sections_created
2219 asection *s = htab->elf.splt;
2245 htab->elf.sgotplt->size += 4;
2248 htab->elf.srelplt->size += sizeof (Elf32_External_Rel);
2249 htab->elf.srelplt->reloc_count++;
2308 s = htab->elf.sgot;
2311 eh->tlsdesc_got = htab->elf.sgotplt->size
2313 htab->elf.sgotplt->size += 8;
2325 dyn = htab->elf.dynamic_sections_created;
2332 htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rel);
2335 htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
2337 htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rel);
2343 htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
2345 htab->elf.srelplt->size += sizeof (Elf32_External_Rel);
2421 || (htab->elf.dynamic_sections_created
2532 /* Don't even try to convert non-ELF outputs. */
2614 && h != htab->elf.hdynamic
2676 dynobj = htab->elf.dynobj;
2680 if (htab->elf.dynamic_sections_created)
2760 s = htab->elf.sgot;
2761 srel = htab->elf.srelgot;
2770 *local_tlsdesc_gotent = htab->elf.sgotplt->size
2772 htab->elf.sgotplt->size += 8;
2794 htab->elf.srelplt->size += sizeof (Elf32_External_Rel);
2806 htab->tls_ldm_got.offset = htab->elf.sgot->size;
2807 htab->elf.sgot->size += 8;
2808 htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
2815 elf_link_hash_traverse (&htab->elf, elf_i386_allocate_dynrelocs, info);
2830 if (htab->elf.srelplt)
2832 htab->next_tls_desc_index = htab->elf.srelplt->reloc_count;
2834 htab->next_irelative_index = htab->elf.srelplt->reloc_count - 1;
2836 else if (htab->elf.irelplt)
2837 htab->next_irelative_index = htab->elf.irelplt->reloc_count - 1;
2840 if (htab->elf.sgotplt)
2844 if ((htab->elf.hgot == NULL
2845 || !htab->elf.hgot->ref_regular_nonweak)
2846 && (htab->elf.sgotplt->size
2848 && (htab->elf.splt == NULL
2849 || htab->elf.splt->size == 0)
2850 && (htab->elf.sgot == NULL
2851 || htab->elf.sgot->size == 0)
2852 && (htab->elf.iplt == NULL
2853 || htab->elf.iplt->size == 0)
2854 && (htab->elf.igotplt == NULL
2855 || htab->elf.igotplt->size == 0))
2856 htab->elf.sgotplt->size = 0;
2861 && htab->elf.splt != NULL
2862 && htab->elf.splt->size != 0
2863 && !bfd_is_abs_section (htab->elf.splt->output_section)
2877 if (s == htab->elf.splt
2878 || s == htab->elf.sgot)
2886 if (htab->elf.hplt != NULL)
2889 else if (s == htab->elf.sgotplt
2890 || s == htab->elf.iplt
2891 || s == htab->elf.igotplt
2900 && s != htab->elf.srelplt
2948 bfd_put_32 (dynobj, htab->elf.splt->size,
2952 if (htab->elf.dynamic_sections_created)
2968 if (htab->elf.splt->size != 0)
2987 elf_link_hash_traverse (&htab->elf,
3048 /* Set the correct type for an x86 ELF section. We do this by the
3062 elf.c:elf_fake_sections() not to consider ".reloc" as a section
3063 containing ELF relocation info. We need this hack in order to
3064 be able to generate ELF binaries that can be translated into
3104 base->u.def.value = htab->elf.tls_size;
3139 /* Relocate an i386 ELF section. */
3349 if (htab->elf.splt != NULL)
3351 plt = htab->elf.splt;
3352 gotplt = htab->elf.sgotplt;
3356 plt = htab->elf.iplt;
3357 gotplt = htab->elf.igotplt;
3417 sreloc = htab->elf.irelifunc;
3433 base_got = htab->elf.sgot;
3445 if (htab->elf.splt != NULL)
3449 base_got = htab->elf.sgotplt;
3455 base_got = htab->elf.igotplt;
3484 if (htab->elf.splt == NULL)
3494 if (htab->elf.splt == NULL)
3512 if (htab->elf.sgot == NULL)
3520 dyn = htab->elf.dynamic_sections_created;
3544 htab->elf.sgot->contents + off);
3566 htab->elf.sgot->contents + off);
3573 s = htab->elf.srelgot;
3577 outrel.r_offset = (htab->elf.sgot->output_section->vma
3578 + htab->elf.sgot->output_offset
3591 relocation = htab->elf.sgot->output_section->vma
3592 + htab->elf.sgot->output_offset + off
3593 - htab->elf.sgotplt->output_section->vma
3594 - htab->elf.sgotplt->output_offset;
3651 relocation -= htab->elf.sgotplt->output_section->vma
3652 + htab->elf.sgotplt->output_offset;
3657 relocation = htab->elf.sgotplt->output_section->vma
3658 + htab->elf.sgotplt->output_offset;
3672 || htab->elf.splt == NULL)
3680 relocation = (htab->elf.splt->output_section->vma
3681 + htab->elf.splt->output_offset
3986 if (htab->elf.sgot == NULL)
4011 if (htab->elf.srelgot == NULL)
4021 <= htab->elf.sgotplt->size);
4022 outrel.r_offset = (htab->elf.sgotplt->output_section->vma
4023 + htab->elf.sgotplt->output_offset
4026 sreloc = htab->elf.srelplt;
4038 htab->elf.sgotplt->contents + offplt
4044 htab->elf.sgotplt->contents + offplt
4049 sreloc = htab->elf.srelgot;
4051 outrel.r_offset = (htab->elf.sgot->output_section->vma
4052 + htab->elf.sgot->output_offset + off);
4066 htab->elf.sgot->contents + off);
4070 htab->elf.sgot->contents + off);
4073 htab->elf.sgot->contents + off);
4085 htab->elf.sgot->contents + off + 4);
4090 htab->elf.sgot->contents + off + 4);
4103 htab->elf.sgot->contents + off + 4);
4127 bfd_vma g_o_t = htab->elf.sgotplt->output_section->vma
4128 + htab->elf.sgotplt->output_offset;
4129 relocation = htab->elf.sgot->output_section->vma
4130 + htab->elf.sgot->output_offset + off - g_o_t;
4172 htab->elf.sgot->output_section->vma
4173 + htab->elf.sgot->output_offset + off
4174 - htab->elf.sgotplt->output_section->vma
4175 - htab->elf.sgotplt->output_offset,
4213 htab->elf.sgot->output_section->vma
4214 + htab->elf.sgot->output_offset + off
4215 - htab->elf.sgotplt->output_section->vma
4216 - htab->elf.sgotplt->output_offset,
4279 if (htab->elf.sgot == NULL)
4289 if (htab->elf.srelgot == NULL)
4292 outrel.r_offset = (htab->elf.sgot->output_section->vma
4293 + htab->elf.sgot->output_offset + off);
4296 htab->elf.sgot->contents + off);
4298 htab->elf.sgot->contents + off + 4);
4300 elf_append_rel (output_bfd, htab->elf.srelgot, &outrel);
4303 relocation = htab->elf.sgot->output_section->vma
4304 + htab->elf.sgot->output_offset + off
4305 - htab->elf.sgotplt->output_section->vma
4306 - htab->elf.sgotplt->output_offset;
4451 if (htab->elf.splt != NULL)
4453 plt = htab->elf.splt;
4454 gotplt = htab->elf.sgotplt;
4455 relplt = htab->elf.srelplt;
4459 plt = htab->elf.iplt;
4460 gotplt = htab->elf.igotplt;
4461 relplt = htab->elf.irelplt;
4487 if (plt == htab->elf.splt)
4531 rel.r_offset = (htab->elf.splt->output_section->vma
4532 + htab->elf.splt->output_offset
4534 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
4539 rel.r_offset = (htab->elf.sgotplt->output_section->vma
4540 + htab->elf.sgotplt->output_offset
4542 rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
4595 if (plt == htab->elf.splt)
4631 if (htab->elf.sgot == NULL || htab->elf.srelgot == NULL)
4634 rel.r_offset = (htab->elf.sgot->output_section->vma
4635 + htab->elf.sgot->output_offset
4661 plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
4665 htab->elf.sgot->contents + h->got.offset);
4680 htab->elf.sgot->contents + h->got.offset);
4684 elf_append_rel (output_bfd, htab->elf.srelgot, &rel);
4760 dynobj = htab->elf.dynobj;
4764 if (htab->elf.dynamic_sections_created)
4768 if (sdyn == NULL || htab->elf.sgot == NULL)
4789 s = htab->elf.sgotplt;
4794 s = htab->elf.srelplt;
4799 s = htab->elf.srelplt;
4810 s = htab->elf.srelplt;
4817 /* We may not be using the standard ELF linker script.
4820 s = htab->elf.srelplt;
4833 if (htab->elf.splt && htab->elf.splt->size > 0)
4837 memcpy (htab->elf.splt->contents, abed->plt->pic_plt0_entry,
4839 memset (htab->elf.splt->contents + abed->plt->plt0_entry_size,
4845 memcpy (htab->elf.splt->contents, abed->plt->plt0_entry,
4847 memset (htab->elf.splt->contents + abed->plt->plt0_entry_size,
4851 (htab->elf.sgotplt->output_section->vma
4852 + htab->elf.sgotplt->output_offset
4854 htab->elf.splt->contents
4857 (htab->elf.sgotplt->output_section->vma
4858 + htab->elf.sgotplt->output_offset
4860 htab->elf.splt->contents
4870 rel.r_offset = (htab->elf.splt->output_section->vma
4871 + htab->elf.splt->output_offset
4873 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
4877 rel.r_offset = (htab->elf.splt->output_section->vma
4878 + htab->elf.splt->output_offset
4880 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
4889 elf_section_data (htab->elf.splt->output_section)
4895 int num_plts = (htab->elf.splt->size
4909 rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
4914 rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
4922 if (htab->elf.sgotplt)
4924 if (bfd_is_abs_section (htab->elf.sgotplt->output_section))
4927 (_("discarded output section: `%A'"), htab->elf.sgotplt);
4932 if (htab->elf.sgotplt->size > 0)
4937 htab->elf.sgotplt->contents);
4938 bfd_put_32 (output_bfd, 0, htab->elf.sgotplt->contents + 4);
4939 bfd_put_32 (output_bfd, 0, htab->elf.sgotplt->contents + 8);
4942 elf_section_data (htab->elf.sgotplt->output_section)->this_hdr.sh_entsize = 4;
4949 if (htab->elf.splt != NULL
4950 && htab->elf.splt->size != 0
4951 && (htab->elf.splt->flags & SEC_EXCLUDE) == 0
4952 && htab->elf.splt->output_section != NULL
4955 bfd_vma plt_start = htab->elf.splt->output_section->vma;
4973 if (htab->elf.sgot && htab->elf.sgot->size > 0)
4974 elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
5120 "FreeBSD" label in the ELF header. So we put this label on all