This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PowerPC unaligned relocs in little-endian mode


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? 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]