From d4337d869f5bed87c124d663f08dce5a27cffefd Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Thu, 2 Jun 2005 05:34:08 +0000 Subject: [PATCH] Fix the load64 and store64 macros, created to handle 8-byte unaligned loads and stores (resp.) The ldq_u and stq_u instruction mask off the lower 3 bits of the final address before loading from or storing to the address, so as to avoid unaligned loads and stores. They do not themselves allow loads from or stores to unaligned addresses. Replace the macro definitions by a packed struct dereference. Submitted by: Richard Henderson (rth at twiddle dot net) --- libexec/rtld-elf/alpha/reloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libexec/rtld-elf/alpha/reloc.c b/libexec/rtld-elf/alpha/reloc.c index 1ec66ca66fc3..74aaf9cfa8ac 100644 --- a/libexec/rtld-elf/alpha/reloc.c +++ b/libexec/rtld-elf/alpha/reloc.c @@ -58,13 +58,13 @@ extern Elf_Dyn _GOT_END_; * We don't use these when relocating jump slots and GOT entries, * since they are guaranteed to be aligned. */ -#define load64(p) ({ \ - Elf_Addr __res; \ - __asm__("ldq_u %0,%1" : "=r"(__res) : "m"(*(p))); \ - __res; }) -#define store64(p, v) \ - __asm__("stq_u %1,%0" : "=m"(*(p)) : "r"(v)) +struct ualong { + Elf_Addr x __attribute__((packed)); +}; + +#define load64(p) (((struct ualong *)(p))->x) +#define store64(p,v) (((struct ualong *)(p))->x = (v)) /* Relocate a non-PLT object with addend. */ static int