aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-11-02 10:37:04 +0000
committerAlan Modra <amodra@gmail.com>2001-11-02 10:37:04 +0000
commita8d02d6673c0a108c77e03ac2789b5ed82d82038 (patch)
tree290f398dfafbefcb5bd6566b0744347e751c9cdc /bfd
parent4a15251e589719308e321944c283d08c2a689c0c (diff)
downloadgdb-a8d02d6673c0a108c77e03ac2789b5ed82d82038.zip
gdb-a8d02d6673c0a108c77e03ac2789b5ed82d82038.tar.gz
gdb-a8d02d6673c0a108c77e03ac2789b5ed82d82038.tar.bz2
* 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')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-hppa.c79
2 files changed, 63 insertions, 24 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8d69833..9d0fce7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2001-11-02 Alan Modra <amodra@bigpond.net.au>
+
+ * 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.
+
2001-11-02 Hans-Peter Nilsson <hp@axis.com>
* elf32-cris.c (cris_elf_grok_prstatus): New function.
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 61c3e6f..0bebd89 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;
}