if (htab == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
if (dynobj != NULL)
{
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgot = bfd_get_linker_section (dynobj, ".got");
+ splt = htab->root.splt;
+ sgot = htab->root.sgot;
}
for (rel = relocs; rel < relend; rel ++)
if (h != NULL
&& ((struct elf_cris_link_hash_entry *) h)->gotplt_offset != 0)
{
- asection *sgotplt
- = bfd_get_linker_section (dynobj, ".got.plt");
+ asection *sgotplt = htab->root.sgotplt;
bfd_vma got_offset;
BFD_ASSERT (h->dynindx != -1);
Elf_Internal_Rela outrel;
bfd_byte *loc;
- if (srelgot == NULL)
- srelgot
- = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
outrel.r_offset = (sgot->output_section->vma
if (htab->dtpmod_refcount > 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
- asection *sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
+ asection *sgotplt = htab->root.sgotplt;
BFD_ASSERT (sgotplt != NULL);
if (bfd_link_pic (info))
Elf_Internal_Rela outrel;
bfd_byte *loc;
- if (srelgot == NULL)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
loc = srelgot->contents;
loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_put_32 (output_bfd, 0, sgot->contents + off);
bfd_put_32 (output_bfd, 0, sgot->contents + off + 4);
- if (srelgot == NULL)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
if (h != NULL && h->dynindx != -1)
else
local_got_offsets[r_symndx] |= 1;
- if (srelgot == NULL)
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
if (h != NULL && h->dynindx != -1)
plt_pic_entry = elf_cris_pic_plt_entry_v32;
}
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
if (h->plt.offset != (bfd_vma) -1)
{
BFD_ASSERT (h->dynindx != -1);
- splt = bfd_get_linker_section (dynobj, ".plt");
- sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
- srela = bfd_get_linker_section (dynobj, ".rela.plt");
+ splt = htab->root.splt;
+ sgotplt = htab->root.sgotplt;
+ srela = htab->root.srelplt;
BFD_ASSERT (splt != NULL && sgotplt != NULL
&& (! has_gotplt || srela != NULL));
/* This symbol has an entry in the global offset table. Set it up. */
- sgot = bfd_get_linker_section (dynobj, ".got");
- srela = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = htab->root.sgot;
+ srela = htab->root.srelgot;
BFD_ASSERT (sgot != NULL && srela != NULL);
rela.r_offset = (sgot->output_section->vma
dynobj = elf_hash_table (info)->dynobj;
- sgot = bfd_get_linker_section (dynobj, ".got.plt");
+ sgot = elf_hash_table (info)->sgotplt;
BFD_ASSERT (sgot != NULL);
sdyn = bfd_get_linker_section (dynobj, ".dynamic");
asection *splt;
Elf32_External_Dyn *dyncon, *dynconend;
- splt = bfd_get_linker_section (dynobj, ".plt");
+ splt = elf_hash_table (info)->splt;
BFD_ASSERT (splt != NULL && sdyn != NULL);
dyncon = (Elf32_External_Dyn *) sdyn->contents;
case DT_JMPREL:
/* Yes, we *can* have a .plt and no .plt.rela, for instance
if all symbols are found in the .got (not .got.plt). */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
dyn.d_un.d_ptr = s != NULL ? (s->output_section->vma
+ s->output_offset) : 0;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
break;
case DT_PLTRELSZ:
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s == NULL)
dyn.d_un.d_val = 0;
else
linker script arranges for .rela.plt to follow all
other relocation sections, we don't have to worry
about changing the DT_RELA entry. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = elf_hash_table (info)->srelplt;
if (s != NULL)
dyn.d_un.d_val -= s->size;
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd);
- sgot = bfd_get_linker_section (dynobj, ".got");
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = htab->root.sgot;
+ srelgot = htab->root.srelgot;
relend = relocs + sec->reloc_count;
for (rel = relocs; rel < relend; rel++)
else
{
/* No GOT entry for this symbol. We need to create one. */
- bfd *dynobj = elf_hash_table (info)->dynobj;
asection *sgot;
asection *srelgot;
- BFD_ASSERT (dynobj != NULL);
- sgot = bfd_get_linker_section (dynobj, ".got");
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
/* Put accurate refcounts there. */
h->root.got.refcount += h->gotplt_refcount;
if (htab == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
/* Make sure we know what is going on here. */
BFD_ASSERT (dynobj != NULL
return FALSE;
}
- s = bfd_get_linker_section (dynobj, ".plt");
+ s = htab->root.splt;
BFD_ASSERT (s != NULL);
/* If this is the first .plt entry, make room for the special
= htab->next_gotplt_entry;
htab->next_gotplt_entry += 4;
- s = bfd_get_linker_section (dynobj, ".got.plt");
+ s = htab->root.sgotplt;
BFD_ASSERT (s != NULL);
s->size += 4;
/* We also need to make an entry in the .rela.plt section. */
- s = bfd_get_linker_section (dynobj, ".rela.plt");
+ s = htab->root.srelplt;
BFD_ASSERT (s != NULL);
s->size += sizeof (Elf32_External_Rela);
if (!_bfd_elf_create_got_section (dynobj, info))
return FALSE;
- sgot = bfd_get_linker_section (dynobj, ".got");
+ sgot = elf_hash_table (info)->sgot;
+ srelgot = elf_hash_table (info)->srelgot;
}
if (local_got_refcounts == NULL)
break;
}
- /* Some relocs require a global offset table (but perhaps not a
- specific GOT entry). */
- switch (r_type)
- {
- case R_CRIS_16_DTPREL:
- case R_CRIS_32_DTPREL:
- /* Not requesting .got.rela for an executable: the contents
- of the first entry is constant there. For a shared
- library, we need .got.rela for the R_CRIS_DTPMOD
- relocation at index 3. */
- if (!bfd_link_pic (info))
- break;
- /* Fall through. */
-
- case R_CRIS_32_IE:
- case R_CRIS_32_GD:
- case R_CRIS_16_GOT_GD:
- case R_CRIS_32_GOT_GD:
- case R_CRIS_32_GOT_TPREL:
- case R_CRIS_16_GOT_TPREL:
- /* Fall through. */
-
- /* For R_CRIS_16_GOTPLT and R_CRIS_32_GOTPLT, we need a GOT
- entry only for local symbols. Unfortunately, we don't know
- until later on if there's a version script that forces the
- symbol local. We must have the .rela.got section in place
- before we know if the symbol looks global now, so we need
- to treat the reloc just like for R_CRIS_16_GOT and
- R_CRIS_32_GOT. */
- case R_CRIS_16_GOTPLT:
- case R_CRIS_32_GOTPLT:
- case R_CRIS_16_GOT:
- case R_CRIS_32_GOT:
- if (srelgot == NULL
- && (h != NULL || bfd_link_pic (info)))
- {
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
- if (srelgot == NULL)
- {
- 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;
- }
- }
- break;
-
- default:
- break;
- }
-
/* Warn and error for invalid input. */
switch (r_type)
{
if (htab == NULL)
return FALSE;
- dynobj = elf_hash_table (info)->dynobj;
+ dynobj = htab->root.dynobj;
BFD_ASSERT (dynobj != NULL);
- if (elf_hash_table (info)->dynamic_sections_created)
+ if (htab->root.dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
if (bfd_link_executable (info) && !info->nointerp)
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_linker_section (dynobj, ".rela.got");
+ s = htab->root.srelgot;
if (s != NULL)
s->size = 0;
}
&& elf_hash_table (info)->dynamic_sections_created)
{
bfd *dynobj = elf_hash_table (info)->dynobj;
- asection *srelgot;
+ asection *srelgot = elf_hash_table (info)->srelgot;
BFD_ASSERT (dynobj != NULL);
-
- srelgot = bfd_get_linker_section (dynobj, ".rela.got");
-
BFD_ASSERT (srelgot != NULL);
srelgot->size -= sizeof (Elf32_External_Rela);