summaryrefslogtreecommitdiff
path: root/bfd/elf32-hppa.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-11-02 10:37:04 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-11-02 10:37:04 +0000
commitd21cccab0dcc13d849951ef8f8eea436f50aa87a (patch)
treede0ea97912f6779a4310f9f025e89b0402b8c9af /bfd/elf32-hppa.c
parent925273716a866b7325ae8192dd9f2aa140e87de3 (diff)
downloadgdb-d21cccab0dcc13d849951ef8f8eea436f50aa87a.tar.gz
* elf32-hppa.c (hppa_handle_PIC_calls): Rename to mark_PIC_calls.
(allocate_PIC_calls): New function. (allocate_dynrelocs): Don't allocate pic_call plt entries here. (elf32_hppa_size_dynamic_sections): Call allocate_PIC_calls. (elf32_hppa_finish_dynamic_symbol): Remove dead code.
Diffstat (limited to 'bfd/elf32-hppa.c')
-rw-r--r--bfd/elf32-hppa.c79
1 files changed, 55 insertions, 24 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 61c3e6fb98a..0bebd89e5da 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -338,7 +338,10 @@ static void elf32_hppa_hide_symbol
static boolean elf32_hppa_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-static boolean hppa_handle_PIC_calls
+static boolean mark_PIC_calls
+ PARAMS ((struct elf_link_hash_entry *, PTR));
+
+static boolean allocate_PIC_calls
PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean allocate_dynrelocs
@@ -1967,7 +1970,7 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
the first part of elf32_hppa_adjust_dynamic_symbol. */
static boolean
-hppa_handle_PIC_calls (h, inf)
+mark_PIC_calls (h, inf)
struct elf_link_hash_entry *h;
PTR inf ATTRIBUTE_UNUSED;
{
@@ -1988,6 +1991,42 @@ hppa_handle_PIC_calls (h, inf)
return true;
}
+/* Allocate space in the .plt for pic_call entries. */
+
+static boolean
+allocate_PIC_calls (h, inf)
+ struct elf_link_hash_entry *h;
+ PTR inf;
+{
+ struct bfd_link_info *info;
+ struct elf32_hppa_link_hash_table *htab;
+ asection *s;
+
+ if (h->root.type == bfd_link_hash_indirect
+ || h->root.type == bfd_link_hash_warning)
+ return true;
+
+ info = (struct bfd_link_info *) inf;
+ htab = hppa_link_hash_table (info);
+ if (((struct elf32_hppa_link_hash_entry *) h)->pic_call)
+ {
+ /* 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;
+ }
+
+ return true;
+}
+
/* Allocate space in .plt, .got and associated reloc sections for
global syms. */
@@ -2023,8 +2062,11 @@ allocate_dynrelocs (h, inf)
return false;
}
- if (((struct elf32_hppa_link_hash_entry *) h)->pic_call
- || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+ 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;
@@ -2039,12 +2081,9 @@ allocate_dynrelocs (h, inf)
else
s->_raw_size += PLT_ENTRY_SIZE;
- 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);
- htab->need_plt_stub = 1;
- }
+ /* 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
{
@@ -2249,12 +2288,10 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
else
{
/* Run through the function symbols, looking for any that are
- PIC, and allocate space for the necessary .plt entries so
- that %r19 will be set up. */
+ PIC, and mark them as needing .plt entries so that %r19 will
+ be set up. */
if (! info->shared)
- elf_link_hash_traverse (&htab->elf,
- hppa_handle_PIC_calls,
- info);
+ elf_link_hash_traverse (&htab->elf, mark_PIC_calls, (PTR) info);
}
/* Set up .got and .plt offsets for local syms, and space for local
@@ -2332,6 +2369,9 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
}
}
+ if (! info->shared)
+ elf_link_hash_traverse (&htab->elf, allocate_PIC_calls, (PTR) info);
+
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
@@ -4082,15 +4122,6 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
+ htab->splt->output_section->vma);
if (h->dynindx != -1)
{
- /* To support lazy linking, the function pointer is
- initialised to point to a special stub stored at the
- end of the .plt. This is not done for plt entries
- with a base-relative dynamic relocation. */
- value = (htab->splt->output_offset
- + htab->splt->output_section->vma
- + htab->splt->_raw_size
- - sizeof (plt_stub)
- + PLT_STUB_ENTRY);
rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_IPLT);
rel.r_addend = 0;
}