* elf32-hppa.c (PLABEL_PLT_ENTRY_SIZE): Delete.
(allocate_PIC_calls): Rename to allocate_plt_static. (allocate_dynrelocs): Move most of code handling .plt entries to.. (allocate_plt_static): ..here. Don't drop plabel entries.
This commit is contained in:
parent
6eeb40b2c0
commit
e5ee5df190
|
@ -1,3 +1,10 @@
|
||||||
|
2001-11-19 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elf32-hppa.c (PLABEL_PLT_ENTRY_SIZE): Delete.
|
||||||
|
(allocate_PIC_calls): Rename to allocate_plt_static.
|
||||||
|
(allocate_dynrelocs): Move most of code handling .plt entries to..
|
||||||
|
(allocate_plt_static): ..here. Don't drop plabel entries.
|
||||||
|
|
||||||
2001-11-19 Hans-Peter Nilsson <hp@bitrange.com>
|
2001-11-19 Hans-Peter Nilsson <hp@bitrange.com>
|
||||||
|
|
||||||
* mmo.c: Adjust documentation tags to use texinfo 4 features.
|
* mmo.c: Adjust documentation tags to use texinfo 4 features.
|
||||||
|
|
115
bfd/elf32-hppa.c
115
bfd/elf32-hppa.c
|
@ -114,7 +114,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
: be,n 0(%sr0,%rp) ; inter-space return */
|
: be,n 0(%sr0,%rp) ; inter-space return */
|
||||||
|
|
||||||
#define PLT_ENTRY_SIZE 8
|
#define PLT_ENTRY_SIZE 8
|
||||||
#define PLABEL_PLT_ENTRY_SIZE PLT_ENTRY_SIZE
|
|
||||||
#define GOT_ENTRY_SIZE 4
|
#define GOT_ENTRY_SIZE 4
|
||||||
#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
|
#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
|
||||||
|
|
||||||
|
@ -344,7 +343,7 @@ static boolean elf32_hppa_adjust_dynamic_symbol
|
||||||
static boolean mark_PIC_calls
|
static boolean mark_PIC_calls
|
||||||
PARAMS ((struct elf_link_hash_entry *, PTR));
|
PARAMS ((struct elf_link_hash_entry *, PTR));
|
||||||
|
|
||||||
static boolean allocate_PIC_calls
|
static boolean allocate_plt_static
|
||||||
PARAMS ((struct elf_link_hash_entry *, PTR));
|
PARAMS ((struct elf_link_hash_entry *, PTR));
|
||||||
|
|
||||||
static boolean allocate_dynrelocs
|
static boolean allocate_dynrelocs
|
||||||
|
@ -2008,10 +2007,11 @@ mark_PIC_calls (h, inf)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate space in the .plt for pic_call entries. */
|
/* Allocate space in the .plt for entries that won't have relocations.
|
||||||
|
ie. pic_call and plabel entries. */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
allocate_PIC_calls (h, inf)
|
allocate_plt_static (h, inf)
|
||||||
struct elf_link_hash_entry *h;
|
struct elf_link_hash_entry *h;
|
||||||
PTR inf;
|
PTR inf;
|
||||||
{
|
{
|
||||||
|
@ -2027,18 +2027,48 @@ allocate_PIC_calls (h, inf)
|
||||||
htab = hppa_link_hash_table (info);
|
htab = hppa_link_hash_table (info);
|
||||||
if (((struct elf32_hppa_link_hash_entry *) h)->pic_call)
|
if (((struct elf32_hppa_link_hash_entry *) h)->pic_call)
|
||||||
{
|
{
|
||||||
/* Make an entry in the .plt section. */
|
/* Make an entry in the .plt section for non-pic code that is
|
||||||
|
calling pic code. */
|
||||||
s = htab->splt;
|
s = htab->splt;
|
||||||
h->plt.offset = s->_raw_size;
|
h->plt.offset = s->_raw_size;
|
||||||
if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE
|
s->_raw_size += PLT_ENTRY_SIZE;
|
||||||
&& ((struct elf32_hppa_link_hash_entry *) h)->plabel
|
}
|
||||||
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
|
else if (htab->elf.dynamic_sections_created
|
||||||
|
&& h->plt.refcount > 0)
|
||||||
|
{
|
||||||
|
/* Make sure this symbol is output as a dynamic symbol.
|
||||||
|
Undefined weak syms won't yet be marked as dynamic. */
|
||||||
|
if (h->dynindx == -1
|
||||||
|
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0
|
||||||
|
&& h->type != STT_PARISC_MILLI)
|
||||||
{
|
{
|
||||||
/* Add some extra space for the dynamic linker to use. */
|
if (! bfd_elf32_link_record_dynamic_symbol (info, h))
|
||||||
s->_raw_size += PLABEL_PLT_ENTRY_SIZE;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
|
||||||
|
{
|
||||||
|
/* Allocate these later. */
|
||||||
|
}
|
||||||
|
else if (((struct elf32_hppa_link_hash_entry *) h)->plabel)
|
||||||
|
{
|
||||||
|
/* Make an entry in the .plt section for plabel references
|
||||||
|
that won't have a .plt entry for other reasons. */
|
||||||
|
s = htab->splt;
|
||||||
|
h->plt.offset = s->_raw_size;
|
||||||
|
s->_raw_size += PLT_ENTRY_SIZE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
s->_raw_size += PLT_ENTRY_SIZE;
|
{
|
||||||
|
/* No .plt entry needed. */
|
||||||
|
h->plt.offset = (bfd_vma) -1;
|
||||||
|
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
h->plt.offset = (bfd_vma) -1;
|
||||||
|
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2064,54 +2094,19 @@ allocate_dynrelocs (h, inf)
|
||||||
|
|
||||||
info = (struct bfd_link_info *) inf;
|
info = (struct bfd_link_info *) inf;
|
||||||
htab = hppa_link_hash_table (info);
|
htab = hppa_link_hash_table (info);
|
||||||
if ((htab->elf.dynamic_sections_created
|
if (htab->elf.dynamic_sections_created
|
||||||
&& h->plt.refcount > 0)
|
&& h->plt.offset != (bfd_vma) -1
|
||||||
|| ((struct elf32_hppa_link_hash_entry *) h)->pic_call)
|
&& !((struct elf32_hppa_link_hash_entry *) h)->pic_call
|
||||||
|
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
|
||||||
{
|
{
|
||||||
/* Make sure this symbol is output as a dynamic symbol.
|
/* Make an entry in the .plt section. */
|
||||||
Undefined weak syms won't yet be marked as dynamic. */
|
s = htab->splt;
|
||||||
if (h->dynindx == -1
|
h->plt.offset = s->_raw_size;
|
||||||
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0
|
s->_raw_size += PLT_ENTRY_SIZE;
|
||||||
&& h->type != STT_PARISC_MILLI
|
|
||||||
&& !((struct elf32_hppa_link_hash_entry *) h)->pic_call)
|
|
||||||
{
|
|
||||||
if (! bfd_elf32_link_record_dynamic_symbol (info, h))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (((struct elf32_hppa_link_hash_entry *) h)->pic_call)
|
/* We also need to make an entry in the .rela.plt section. */
|
||||||
{
|
htab->srelplt->_raw_size += sizeof (Elf32_External_Rela);
|
||||||
/* Already handled by allocate_PIC_calls. */
|
htab->need_plt_stub = 1;
|
||||||
}
|
|
||||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
|
|
||||||
{
|
|
||||||
/* Make an entry in the .plt section. */
|
|
||||||
s = htab->splt;
|
|
||||||
h->plt.offset = s->_raw_size;
|
|
||||||
if (PLABEL_PLT_ENTRY_SIZE != PLT_ENTRY_SIZE
|
|
||||||
&& ((struct elf32_hppa_link_hash_entry *) h)->plabel
|
|
||||||
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
|
|
||||||
{
|
|
||||||
/* Add some extra space for the dynamic linker to use. */
|
|
||||||
s->_raw_size += PLABEL_PLT_ENTRY_SIZE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
s->_raw_size += PLT_ENTRY_SIZE;
|
|
||||||
|
|
||||||
/* We also need to make an entry in the .rela.plt section. */
|
|
||||||
htab->srelplt->_raw_size += sizeof (Elf32_External_Rela);
|
|
||||||
htab->need_plt_stub = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
h->plt.offset = (bfd_vma) -1;
|
|
||||||
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
h->plt.offset = (bfd_vma) -1;
|
|
||||||
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h->got.refcount > 0)
|
if (h->got.refcount > 0)
|
||||||
|
@ -2400,8 +2395,10 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! info->shared)
|
/* Do all the .plt entries without relocs first. The dynamic linker
|
||||||
elf_link_hash_traverse (&htab->elf, allocate_PIC_calls, (PTR) info);
|
uses the last .plt reloc to find the end of the .plt (and hence
|
||||||
|
the start of the .got) for lazy linking. */
|
||||||
|
elf_link_hash_traverse (&htab->elf, allocate_plt_static, (PTR) info);
|
||||||
|
|
||||||
/* Allocate global sym .plt and .got entries, and space for global
|
/* Allocate global sym .plt and .got entries, and space for global
|
||||||
sym dynamic relocs. */
|
sym dynamic relocs. */
|
||||||
|
|
Loading…
Reference in New Issue