along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#include "alloca-conf.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
bfd_vma opd_offset;
bfd_vma stub_offset;
- /* The symbol table entry, if any, that this was derrived from. */
+ /* The symbol table entry, if any, that this was derived from. */
struct elf_link_hash_entry *h;
/* The index of the (possibly local) symbol in the input bfd and its
PTR info));
static const char *get_dyn_name
- PARAMS ((bfd *abfd, struct elf_link_hash_entry *h,
- const Elf_Internal_Rela *rel, char **pbuf, size_t *plen));
+ PARAMS ((asection *, struct elf_link_hash_entry *,
+ const Elf_Internal_Rela *, char **, size_t *));
/* This must follow the definitions of the various derived linker
static boolean
elf64_hppa_dyn_hash_table_init (ht, abfd, new)
struct elf64_hppa_dyn_hash_table *ht;
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
new_hash_entry_func new;
{
memset (ht, 0, sizeof(*ht));
allocate memory as necessary, possibly reusing PBUF/PLEN. */
static const char *
-get_dyn_name (abfd, h, rel, pbuf, plen)
- bfd *abfd;
+get_dyn_name (sec, h, rel, pbuf, plen)
+ asection *sec;
struct elf_link_hash_entry *h;
const Elf_Internal_Rela *rel;
char **pbuf;
if (h)
nlen = strlen (h->root.root.string);
else
- {
- nlen = sizeof(void*)*2 + 1 + sizeof(bfd_vma)*4 + 1 + 1;
- nlen += 10; /* %p slop */
- }
- tlen = nlen + 1 + 16 + 1;
+ nlen = 8 + 1 + sizeof (rel->r_info) * 2 - 8;
+ tlen = nlen + 1 + sizeof (rel->r_addend) * 2 + 1;
len = *plen;
buf = *pbuf;
if (h)
{
memcpy (buf, h->root.root.string, nlen);
+ buf[nlen++] = '+';
sprintf_vma (buf + nlen, rel->r_addend);
}
else
{
- nlen = sprintf (buf, "%p:%lx", abfd, ELF64_R_SYM (rel->r_info));
+ nlen = sprintf (buf, "%x:%lx",
+ sec->id & 0xffffffff,
+ (long) ELF64_R_SYM (rel->r_info));
if (rel->r_addend)
{
buf[nlen++] = '+';
if (info->shared && hppa_info->section_syms_bfd != abfd)
{
- int i, highest_shndx;
- asection *section;
+ unsigned long i;
+ int highest_shndx;
Elf_Internal_Sym *local_syms, *isym;
Elf64_External_Sym *ext_syms, *esym;
/* These are function calls. Depending on their precise target we
may need to make a stub for them. The stub uses the PLT, so we
need to create PLT entries for these symbols too. */
+ case R_PARISC_PCREL12F:
case R_PARISC_PCREL17F:
case R_PARISC_PCREL22F:
case R_PARISC_PCREL32:
continue;
/* Collect a canonical name for this address. */
- addr_name = get_dyn_name (abfd, h, rel, &buf, &buf_len);
+ addr_name = get_dyn_name (sec, h, rel, &buf, &buf_len);
/* Collect the canonical entry data for this address. */
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
return false;
dyn_h->want_opd = 1;
+ /* Put a flag here for output_symbol_hook. */
+ dyn_h->st_shndx = -1;
h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_PLT;
}
static boolean
get_opd (abfd, info, hppa_info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct elf64_hppa_link_hash_table *hppa_info;
{
asection *opd;
static boolean
get_plt (abfd, info, hppa_info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct elf64_hppa_link_hash_table *hppa_info;
{
asection *plt;
static boolean
get_dlt (abfd, info, hppa_info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct elf64_hppa_link_hash_table *hppa_info;
{
asection *dlt;
static boolean
get_stub (abfd, info, hppa_info)
bfd *abfd;
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct elf64_hppa_link_hash_table *hppa_info;
{
asection *stub;
static boolean
elf64_hppa_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
+ struct bfd_link_info *info ATTRIBUTE_UNUSED;
struct elf_link_hash_entry *h;
{
/* ??? Undefined symbols with PLT entries should be re-defined
boolean plt;
boolean relocs;
boolean reltext;
- boolean stubs;
struct elf64_hppa_allocate_data data;
struct elf64_hppa_link_hash_table *hppa_info;
}
/* Allocate memory for the section contents if it has not
- been allocated already. */
+ been allocated already. We use bfd_zalloc here in case
+ unused entries are not reclaimed before the section's
+ contents are written out. This should not happen, but this
+ way if it does, we get a R_PARISC_NONE reloc instead of
+ garbage. */
if (s->contents == NULL)
{
- s->contents = (bfd_byte *) bfd_alloc (dynobj, s->_raw_size);
+ s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return false;
}
{
if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
+ info->flags |= DF_TEXTREL;
}
}
static boolean
elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec)
- bfd *abfd;
+ bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
const char *name;
Elf_Internal_Sym *sym;
- asection *input_sec;
+ asection *input_sec ATTRIBUTE_UNUSED;
{
struct elf64_hppa_link_hash_table *hppa_info;
struct elf64_hppa_dyn_hash_entry *dyn_h;
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
name, false, false);
- /* Function symbols for which we created .opd entries were munged
- by finish_dynamic_symbol and have to be un-munged here. */
- if (dyn_h && dyn_h->want_opd)
+ /* Function symbols for which we created .opd entries *may* have been
+ munged by finish_dynamic_symbol and have to be un-munged here.
+
+ Note that finish_dynamic_symbol sometimes turns dynamic symbols
+ into non-dynamic ones, so we initialize st_shndx to -1 in
+ mark_exported_functions and check to see if it was overwritten
+ here instead of just checking dyn_h->h->dynindx. */
+ if (dyn_h && dyn_h->want_opd && dyn_h->st_shndx != -1)
{
/* Restore the saved value and section index. */
sym->st_value = dyn_h->st_value;
if (info->shared && dyn_h && dyn_h->want_opd)
{
Elf64_Internal_Rela rel;
- bfd_vma value;
int dynindx;
/* We may need to do a relocation against a local symbol, in
if (info->shared && rent->type == R_PARISC_FPTR64)
{
bfd_vma value, value2;
- asymbol *sym;
- int elf_index;
/* First compute the address of the opd entry for this symbol. */
value = (dyn_h->opd_offset
if (elf_hash_table (info)->dynamic_sections_created)
{
Elf64_External_Dyn *dyncon, *dynconend;
- struct elf_link_hash_entry *h;
BFD_ASSERT (sdyn != NULL);
elf64_hppa_modify_segment_map (abfd)
bfd *abfd;
{
- struct elf_segment_map *m, **pm;
+ struct elf_segment_map *m;
asection *s;
s = bfd_get_section_by_name (abfd, ".interp");
for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
if (m->p_type == PT_LOAD)
{
- int i;
+ unsigned int i;
for (i = 0; i < m->count; i++)
{