aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-11-19 01:25:00 +0000
committerAlan Modra <amodra@gmail.com>2001-11-19 01:25:00 +0000
commite5ee5df1907fdda58597ffe44a32e3ca6d4eee68 (patch)
tree8341c48707baee68816e24b6296041b7dd2743fd /bfd
parent6eeb40b2c0dacbea635c455992e6991e88a45ef2 (diff)
downloadfsf-binutils-gdb-e5ee5df1907fdda58597ffe44a32e3ca6d4eee68.zip
fsf-binutils-gdb-e5ee5df1907fdda58597ffe44a32e3ca6d4eee68.tar.gz
fsf-binutils-gdb-e5ee5df1907fdda58597ffe44a32e3ca6d4eee68.tar.bz2
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-hppa.c115
2 files changed, 63 insertions, 59 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 207bb43..ff5c99f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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>
* mmo.c: Adjust documentation tags to use texinfo 4 features.
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 97abe8f..ea8bb32 100644
--- a/bfd/elf32-hppa.c
+++ b/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 */
#define PLT_ENTRY_SIZE 8
-#define PLABEL_PLT_ENTRY_SIZE PLT_ENTRY_SIZE
#define GOT_ENTRY_SIZE 4
#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
@@ -344,7 +343,7 @@ static boolean elf32_hppa_adjust_dynamic_symbol
static boolean mark_PIC_calls
PARAMS ((struct elf_link_hash_entry *, PTR));
-static boolean allocate_PIC_calls
+static boolean allocate_plt_static
PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean allocate_dynrelocs
@@ -2008,10 +2007,11 @@ mark_PIC_calls (h, inf)
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
-allocate_PIC_calls (h, inf)
+allocate_plt_static (h, inf)
struct elf_link_hash_entry *h;
PTR inf;
{
@@ -2027,18 +2027,48 @@ allocate_PIC_calls (h, inf)
htab = hppa_link_hash_table (info);
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;
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)
+ s->_raw_size += PLT_ENTRY_SIZE;
+ }
+ 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. */
- s->_raw_size += PLABEL_PLT_ENTRY_SIZE;
+ if (! bfd_elf32_link_record_dynamic_symbol (info, h))
+ 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
- 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;
@@ -2064,54 +2094,19 @@ allocate_dynrelocs (h, inf)
info = (struct bfd_link_info *) inf;
htab = hppa_link_hash_table (info);
- if ((htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
- || ((struct elf32_hppa_link_hash_entry *) h)->pic_call)
+ if (htab->elf.dynamic_sections_created
+ && h->plt.offset != (bfd_vma) -1
+ && !((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.
- 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
- && !((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)
- {
- /* Already handled by allocate_PIC_calls. */
- }
- 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;
+ /* Make an entry in the .plt section. */
+ s = htab->splt;
+ h->plt.offset = s->_raw_size;
+ 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;
+ /* 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;
}
if (h->got.refcount > 0)
@@ -2400,8 +2395,10 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
}
}
- if (! info->shared)
- elf_link_hash_traverse (&htab->elf, allocate_PIC_calls, (PTR) info);
+ /* Do all the .plt entries without relocs first. The dynamic linker
+ 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
sym dynamic relocs. */