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: [PATCH] tile: Fix up corner cases with signed relocations


Chris Metcalf <cmetcalf@tilera.com> writes:

> @@ -686,13 +686,17 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
>    tile_bundle_bits *p = (tile_bundle_bits *) reloc_addr;
>    tile_bundle_bits bits = *p;
>  
> -#define MUNGE(func) do {                                            \
> +#define MUNGE_SIGNED(func, length) do {                             \
>      bits = ((bits & ~create_##func (-1)) | create_##func (value));  \
> -    if (get_##func (bits) != value)                                 \
> +    ElfW(Addr) result = (long) get_##func (bits)                    \
> +      << (__WORDSIZE - length) >> (__WORDSIZE - length);            \

Left shifting a negative value has undefined value.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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