08c3a6
commit 6c9c2307657529e52c5fa7037618835f2a50b916
08c3a6
Author: John David Anglin <danglin@gcc.gnu.org>
08c3a6
Date:   Sun Mar 6 16:04:32 2022 +0000
08c3a6
08c3a6
    hppa: Fix warnings from _dl_lookup_address
08c3a6
    
08c3a6
    This change fixes two warnings from _dl_lookup_address.
08c3a6
    
08c3a6
    The first warning comes from dropping the volatile keyword from
08c3a6
    desc in the call to _dl_read_access_allowed.  We now have a full
08c3a6
    atomic barrier between loading desc[0] and the access check, so
08c3a6
    desc no longer needs to be declared as volatile.
08c3a6
    
08c3a6
    The second warning comes from the implicit declaration of
08c3a6
    _dl_fix_reloc_arg.  This is fixed by including dl-runtime.h and
08c3a6
    declaring _dl_fix_reloc_arg in dl-runtime.h.
08c3a6
08c3a6
diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c
08c3a6
index 62ef68b62bd601f4..cd4f77c0ecfd376f 100644
08c3a6
--- a/sysdeps/hppa/dl-fptr.c
08c3a6
+++ b/sysdeps/hppa/dl-fptr.c
08c3a6
@@ -26,6 +26,7 @@
08c3a6
 #include <ldsodefs.h>
08c3a6
 #include <elf/dynamic-link.h>
08c3a6
 #include <dl-fptr.h>
08c3a6
+#include <dl-runtime.h>
08c3a6
 #include <dl-unmap-segments.h>
08c3a6
 #include <atomic.h>
08c3a6
 #include <libc-pointer-arith.h>
08c3a6
@@ -351,21 +352,20 @@ _dl_lookup_address (const void *address)
08c3a6
 {
08c3a6
   ElfW(Addr) addr = (ElfW(Addr)) address;
08c3a6
   ElfW(Word) reloc_arg;
08c3a6
-  volatile unsigned int *desc;
08c3a6
-  unsigned int *gptr;
08c3a6
+  unsigned int *desc, *gptr;
08c3a6
 
08c3a6
   /* Return ADDR if the least-significant two bits of ADDR are not consistent
08c3a6
      with ADDR being a linker defined function pointer.  The normal value for
08c3a6
      a code address in a backtrace is 3.  */
08c3a6
-  if (((unsigned int) addr & 3) != 2)
08c3a6
+  if (((uintptr_t) addr & 3) != 2)
08c3a6
     return addr;
08c3a6
 
08c3a6
   /* Handle special case where ADDR points to page 0.  */
08c3a6
-  if ((unsigned int) addr < 4096)
08c3a6
+  if ((uintptr_t) addr < 4096)
08c3a6
     return addr;
08c3a6
 
08c3a6
   /* Clear least-significant two bits from descriptor address.  */
08c3a6
-  desc = (unsigned int *) ((unsigned int) addr & ~3);
08c3a6
+  desc = (unsigned int *) ((uintptr_t) addr & ~3);
08c3a6
   if (!_dl_read_access_allowed (desc))
08c3a6
     return addr;
08c3a6
 
08c3a6
@@ -376,7 +376,7 @@ _dl_lookup_address (const void *address)
08c3a6
   /* Then load first word of candidate descriptor.  It should be a pointer
08c3a6
      with word alignment and point to memory that can be read.  */
08c3a6
   gptr = (unsigned int *) desc[0];
08c3a6
-  if (((unsigned int) gptr & 3) != 0
08c3a6
+  if (((uintptr_t) gptr & 3) != 0
08c3a6
       || !_dl_read_access_allowed (gptr))
08c3a6
     return addr;
08c3a6
 
08c3a6
@@ -400,10 +400,11 @@ _dl_lookup_address (const void *address)
08c3a6
 
08c3a6
       /* If gp has been resolved, we need to hunt for relocation offset.  */
08c3a6
       if (!(reloc_arg & PA_GP_RELOC))
08c3a6
-	reloc_arg = _dl_fix_reloc_arg (addr, l);
08c3a6
+	reloc_arg = _dl_fix_reloc_arg ((struct fdesc *) addr, l);
08c3a6
 
08c3a6
       _dl_fixup (l, reloc_arg);
08c3a6
     }
08c3a6
 
08c3a6
   return (ElfW(Addr)) desc[0];
08c3a6
 }
08c3a6
+rtld_hidden_def (_dl_lookup_address)
08c3a6
diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h
08c3a6
index a9a927f26c6fec09..2f6991aa16e87a00 100644
08c3a6
--- a/sysdeps/hppa/dl-lookupcfg.h
08c3a6
+++ b/sysdeps/hppa/dl-lookupcfg.h
08c3a6
@@ -30,6 +30,7 @@ rtld_hidden_proto (_dl_symbol_address)
08c3a6
 #define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref)
08c3a6
 
08c3a6
 Elf32_Addr _dl_lookup_address (const void *address);
08c3a6
+rtld_hidden_proto (_dl_lookup_address)
08c3a6
 
08c3a6
 #define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address ((const void *) addr)
08c3a6
 
08c3a6
diff --git a/sysdeps/hppa/dl-runtime.c b/sysdeps/hppa/dl-runtime.c
08c3a6
index e7fbb7417d866bb0..a71b5b2013abf723 100644
08c3a6
--- a/sysdeps/hppa/dl-runtime.c
08c3a6
+++ b/sysdeps/hppa/dl-runtime.c
08c3a6
@@ -25,8 +25,7 @@
08c3a6
    return that to the caller.  The caller will continue on to call
08c3a6
    _dl_fixup with the relocation offset.  */
08c3a6
 
08c3a6
-ElfW(Word)
08c3a6
-attribute_hidden __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
08c3a6
+ElfW(Word) __attribute ((noinline)) ARCH_FIXUP_ATTRIBUTE
08c3a6
 _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l)
08c3a6
 {
08c3a6
   Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type;
08c3a6
@@ -52,3 +51,4 @@ _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l)
08c3a6
   ABORT_INSTRUCTION;
08c3a6
   return 0;
08c3a6
 }
08c3a6
+rtld_hidden_def (_dl_fix_reloc_arg)
08c3a6
diff --git a/sysdeps/hppa/dl-runtime.h b/sysdeps/hppa/dl-runtime.h
08c3a6
index 5d6ee53b076d5e0e..9913539b5f0e7435 100644
08c3a6
--- a/sysdeps/hppa/dl-runtime.h
08c3a6
+++ b/sysdeps/hppa/dl-runtime.h
08c3a6
@@ -17,6 +17,9 @@
08c3a6
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
08c3a6
    02111-1307 USA.  */
08c3a6
 
08c3a6
+ElfW(Word) _dl_fix_reloc_arg (struct fdesc *, struct link_map *);
08c3a6
+rtld_hidden_proto (_dl_fix_reloc_arg)
08c3a6
+
08c3a6
 /* Clear PA_GP_RELOC bit in relocation offset.  */
08c3a6
 static inline uintptr_t
08c3a6
 reloc_offset (uintptr_t plt0, uintptr_t pltn)