reloc_non_plt_obj buggy
Marcel Moolenaar
marcel at xcllnt.net
Wed Jun 1 22:38:06 PDT 2005
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 at xcllnt.net
More information about the freebsd-alpha
mailing list