PowerPC unaligned relocs in little-endian mode
Adhemerval Zanella
azanella@linux.vnet.ibm.com
Thu Oct 3 21:31:00 GMT 2013
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?
More information about the Libc-alpha
mailing list