aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2000-07-12 05:03:01 +0000
committerAlan Modra <amodra@gmail.com>2000-07-12 05:03:01 +0000
commit0ba2a60ea96bb63756bfb01ccc2e20081aad3995 (patch)
tree5dabf37fcbccb6a4b8ac9a0465e07009cff1ad86 /bfd
parent1c64c4ed86fcf294ce8ea92dd3e7c605deacfa91 (diff)
downloadbinutils-0ba2a60ea96bb63756bfb01ccc2e20081aad3995.zip
binutils-0ba2a60ea96bb63756bfb01ccc2e20081aad3995.tar.gz
binutils-0ba2a60ea96bb63756bfb01ccc2e20081aad3995.tar.bz2
Use section id in get_dyn_name.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog15
-rw-r--r--bfd/elf-hppa.h6
-rw-r--r--bfd/elf64-hppa.c27
3 files changed, 31 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index bde689f..ec8caa5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,8 +1,21 @@
+2000-07-11 Alan Modra <alan@linuxcare.com.au>
+
+ * elf64-hppa.c (get_dyn_name): Pass in section pointer instead of
+ bfd pointer. Print section id instead of bfd pointer for local
+ syms. Prefix addend with `+' for global syms as well as local.
+ Correct calculation of name component lengths.
+ (elf64_hppa_check_relocs): Update call to get_dyn_name.
+
+ From David Huggins-Daines <dhd@linuxcare.com>
+ * elf-hppa.h (elf_hppa_relocate_section): Update calls here too.
+ * elf64-hppa.c (elf64_hppa_check_relocs): Fix some warnings.
+ (elf64_hppa_modify_segment_map): Likewise.
+
Tue Jul 11 17:21:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
* elf.c (bfd_elf_get_sign_extend_vma): Return tendency of VMA
addresses to be "naturally" sign extended. Return -1 if unknown.
- * bfd-in.h (bfd_elf_get_sign_extend_vma): : Add declaration.
+ * bfd-in.h (bfd_elf_get_sign_extend_vma): Add declaration.
* bfd-in2.h: Regenerate.
Tue Jul 11 16:25:52 2000 Andrew Cagney <cagney@b1.cygnus.com>
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index e67ada4..2dbb0d3 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -1299,7 +1299,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
/* If this symbol has an entry in the PA64 dynamic hash
table, then get it. */
- dyn_name = get_dyn_name (input_bfd, h, rel,
+ dyn_name = get_dyn_name (input_section, h, rel,
&dynh_buf, &dynh_buflen);
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
dyn_name, false, false);
@@ -1322,7 +1322,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
/* If this symbol has an entry in the PA64 dynamic hash
table, then get it. */
- dyn_name = get_dyn_name (input_bfd, h, rel,
+ dyn_name = get_dyn_name (input_section, h, rel,
&dynh_buf, &dynh_buflen);
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
dyn_name, false, false);
@@ -1358,7 +1358,7 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
/* If this symbol has an entry in the PA64 dynamic hash
table, then get it. */
- dyn_name = get_dyn_name (input_bfd, h, rel,
+ dyn_name = get_dyn_name (input_section, h, rel,
&dynh_buf, &dynh_buflen);
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
dyn_name, false, false);
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 4b07556..b90b478 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -172,8 +172,8 @@ static void elf64_hppa_dyn_hash_traverse
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
@@ -399,8 +399,8 @@ elf64_hppa_section_from_shdr (abfd, hdr, name)
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;
@@ -416,11 +416,8 @@ get_dyn_name (abfd, h, rel, pbuf, plen)
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;
@@ -437,11 +434,14 @@ get_dyn_name (abfd, h, rel, pbuf, plen)
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++] = '+';
@@ -574,7 +574,8 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs)
if (info->shared && hppa_info->section_syms_bfd != abfd)
{
- int i, highest_shndx;
+ unsigned int i;
+ int highest_shndx;
Elf_Internal_Sym *local_syms, *isym;
Elf64_External_Sym *ext_syms, *esym;
@@ -817,7 +818,7 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs)
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,
@@ -2511,7 +2512,7 @@ elf64_hppa_modify_segment_map (abfd)
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++)
{