This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: PowerPC unaligned relocs in little-endian mode
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: Alan Modra <amodra at gmail dot com>, libc-alpha at sourceware dot org
- Date: Thu, 03 Oct 2013 18:31:22 -0300
- Subject: Re: PowerPC unaligned relocs in little-endian mode
- Authentication-results: sourceware.org; auth=none
- References: <20131003151308 dot GE5082 at bubble dot grove dot modra dot org>
Hi Alan
-On 10/03/2013 12:13 PM, Alan Modra wrote:
> diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c
> index 3e7202d..f81899a 100644
> --- a/sysdeps/powerpc/powerpc32/dl-machine.c
> +++ b/sysdeps/powerpc/powerpc32/dl-machine.c
> @@ -416,6 +416,12 @@ __process_machine_rela (struct link_map *map,
> Elf32_Addr const finaladdr,
> int rinfo)
> {
> + union unaligned
> + {
> + unsigned u2 __attribute__ ((mode (HI)));
> + unsigned u4 __attribute__ ((mode (SI)));
> + } __attribute__((__packed__));
> +
> diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h
> index 059fdaf..b69a1ce 100644
> --- a/sysdeps/powerpc/powerpc64/dl-machine.h
> +++ b/sysdeps/powerpc/powerpc64/dl-machine.h
> @@ -561,6 +561,12 @@ elf_machine_rela (struct link_map *map,
> Elf64_Addr *const reloc_addr = reloc_addr_arg;
> const int r_type = ELF64_R_TYPE (reloc->r_info);
> const Elf64_Sym *const refsym = sym;
> + union unaligned
> + {
> + unsigned u2 __attribute__ ((mode (HI)));
> + unsigned u4 __attribute__ ((mode (SI)));
> + unsigned u8 __attribute__ ((mode (DI)));
> + } __attribute__((__packed__));
The patch is ok, just a question: any reason in particular to not use uint16_t, uint32_t, and uint64_t?