public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: John David Anglin <danglin@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/release/2.35/master] hppa: Fix warnings from _dl_lookup_address Date: Thu, 3 Mar 2022 21:19:10 +0000 (GMT) [thread overview] Message-ID: <20220303211910.1F47C3858038@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ca0570fee323349bac834cf3bf3aef712f09cdc1 commit ca0570fee323349bac834cf3bf3aef712f09cdc1 Author: John David Anglin <danglin@gcc.gnu.org> Date: Tue Feb 22 18:51:35 2022 +0000 hppa: Fix warnings from _dl_lookup_address This change fixes two warnings from _dl_lookup_address. The first warning comes from dropping the volatile keyword from desc in the call to _dl_read_access_allowed. We now have a full atomic barrier between loading desc[0] and the access check, so desc no longer needs to be declared as volatile. The second warning comes from the implicit declaration of _dl_fix_reloc_arg. This is fixed by including dl-runtime.h and declaring _dl_fix_reloc_arg in dl-runtime.h. (cherry picked from commit d2224ffbddc9d25ed5b0e34c212018c32d1e5a95) Diff: --- sysdeps/hppa/dl-fptr.c | 15 ++++++++------- sysdeps/hppa/dl-lookupcfg.h | 1 + sysdeps/hppa/dl-runtime.c | 4 ++-- sysdeps/hppa/dl-runtime.h | 3 +++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sysdeps/hppa/dl-fptr.c b/sysdeps/hppa/dl-fptr.c index 2584557c4f..9ed21602d6 100644 --- a/sysdeps/hppa/dl-fptr.c +++ b/sysdeps/hppa/dl-fptr.c @@ -26,6 +26,7 @@ #include <ldsodefs.h> #include <elf/dynamic-link.h> #include <dl-fptr.h> +#include <dl-runtime.h> #include <dl-unmap-segments.h> #include <atomic.h> #include <libc-pointer-arith.h> @@ -351,21 +352,20 @@ _dl_lookup_address (const void *address) { ElfW(Addr) addr = (ElfW(Addr)) address; ElfW(Word) reloc_arg; - volatile unsigned int *desc; - unsigned int *gptr; + unsigned int *desc, *gptr; /* Return ADDR if the least-significant two bits of ADDR are not consistent with ADDR being a linker defined function pointer. The normal value for a code address in a backtrace is 3. */ - if (((unsigned int) addr & 3) != 2) + if (((uintptr_t) addr & 3) != 2) return addr; /* Handle special case where ADDR points to page 0. */ - if ((unsigned int) addr < 4096) + if ((uintptr_t) addr < 4096) return addr; /* Clear least-significant two bits from descriptor address. */ - desc = (unsigned int *) ((unsigned int) addr & ~3); + desc = (unsigned int *) ((uintptr_t) addr & ~3); if (!_dl_read_access_allowed (desc)) return addr; @@ -376,7 +376,7 @@ _dl_lookup_address (const void *address) /* Then load first word of candidate descriptor. It should be a pointer with word alignment and point to memory that can be read. */ gptr = (unsigned int *) desc[0]; - if (((unsigned int) gptr & 3) != 0 + if (((uintptr_t) gptr & 3) != 0 || !_dl_read_access_allowed (gptr)) return addr; @@ -400,10 +400,11 @@ _dl_lookup_address (const void *address) /* If gp has been resolved, we need to hunt for relocation offset. */ if (!(reloc_arg & PA_GP_RELOC)) - reloc_arg = _dl_fix_reloc_arg (addr, l); + reloc_arg = _dl_fix_reloc_arg ((struct fdesc *) addr, l); _dl_fixup (l, reloc_arg); } return (ElfW(Addr)) desc[0]; } +rtld_hidden_def (_dl_lookup_address) diff --git a/sysdeps/hppa/dl-lookupcfg.h b/sysdeps/hppa/dl-lookupcfg.h index 27d2cd5e0e..de0a3b78e8 100644 --- a/sysdeps/hppa/dl-lookupcfg.h +++ b/sysdeps/hppa/dl-lookupcfg.h @@ -30,6 +30,7 @@ rtld_hidden_proto (_dl_symbol_address) #define DL_SYMBOL_ADDRESS(map, ref) _dl_symbol_address(map, ref) Elf32_Addr _dl_lookup_address (const void *address); +rtld_hidden_proto (_dl_lookup_address) #define DL_LOOKUP_ADDRESS(addr) _dl_lookup_address ((const void *) addr) diff --git a/sysdeps/hppa/dl-runtime.c b/sysdeps/hppa/dl-runtime.c index 8b2ee58e37..192a6bee03 100644 --- a/sysdeps/hppa/dl-runtime.c +++ b/sysdeps/hppa/dl-runtime.c @@ -25,8 +25,7 @@ return that to the caller. The caller will continue on to call _dl_fixup with the relocation offset. */ -ElfW(Word) -attribute_hidden __attribute ((noinline)) DL_ARCH_FIXUP_ATTRIBUTE +ElfW(Word) __attribute ((noinline)) DL_ARCH_FIXUP_ATTRIBUTE _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l) { Elf32_Addr l_addr, iplt, jmprel, end_jmprel, r_type; @@ -52,3 +51,4 @@ _dl_fix_reloc_arg (struct fdesc *fptr, struct link_map *l) ABORT_INSTRUCTION; return 0; } +rtld_hidden_def (_dl_fix_reloc_arg) diff --git a/sysdeps/hppa/dl-runtime.h b/sysdeps/hppa/dl-runtime.h index d4da46079b..5ced8e14e9 100644 --- a/sysdeps/hppa/dl-runtime.h +++ b/sysdeps/hppa/dl-runtime.h @@ -17,6 +17,9 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +ElfW(Word) _dl_fix_reloc_arg (struct fdesc *, struct link_map *); +rtld_hidden_proto (_dl_fix_reloc_arg) + /* Clear PA_GP_RELOC bit in relocation offset. */ static inline uintptr_t reloc_offset (uintptr_t plt0, uintptr_t pltn)
reply other threads:[~2022-03-03 21:19 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220303211910.1F47C3858038@sourceware.org \ --to=danglin@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).