Use section id in get_dyn_name.
authorAlan Modra <amodra@gmail.com>
Wed, 12 Jul 2000 05:03:01 +0000 (05:03 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 12 Jul 2000 05:03:01 +0000 (05:03 +0000)
bfd/ChangeLog
bfd/elf-hppa.h
bfd/elf64-hppa.c

index bde689fe58eded44568e4f3cdd9a2381f3b9ed2f..ec8caa5da4f881b7785a610d256370ce5811e27c 100644 (file)
@@ -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>
index e67ada4d916839d3e3b969b530d1c3651d7d0440..2dbb0d3929a3f8b7d6c2848a44bbd41c26959d3f 100644 (file)
@@ -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);
index 4b07556cdd8a89b194bb843609e9b9fc7b763b30..b90b47878f00c7f28a3ee44df8cb8bed8ab5cbe1 100644 (file)
@@ -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++)
          {
This page took 0.033678 seconds and 4 git commands to generate.