Date: Wed, 1 Jun 2005 22:38:04 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: Richard Henderson <rth@twiddle.net> Cc: freebsd-alpha@freebsd.org Subject: Re: reloc_non_plt_obj buggy Message-ID: <dd23e5f52ea44881de2e59e606afb1d2@xcllnt.net> In-Reply-To: <20050601172416.GA4197@twiddle.net> References: <20050601172416.GA4197@twiddle.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Jun 1, 2005, at 10:24 AM, Richard Henderson wrote:
>> From src/libexec/rtld-elf/alpha/reloc.c:
>
> ---------------------
> #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))
> ---------------------
>
> Someone wasn't very clear on what ldq_u/stq_u actually does.
> You're not actually modifying the unaligned address, you're
> modifying (address & ~7), and corrupting the dwarf2 data in
> the process.
You're absolutely right.
> You need to use
>
> struct ualong {
> Elf_Addr x __attribute__((packed));
> };
>
> #define load64(p) (((struct ualong *)(p))->x)
> #define store64(p,v) (((struct ualong *)(p))->x = (v))
Committed as-is. Thanks,
--
Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?dd23e5f52ea44881de2e59e606afb1d2>
