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] elf.h SHF_EXCLUDE signed int 31 bit shift triggers undefined behaviour.


On Wed, 2015-04-22 at 10:33 +0200, Florian Weimer wrote:
> On 04/22/2015 10:25 AM, Andreas Schwab wrote:
> > Florian Weimer <fweimer@redhat.com> writes:
> > 
> >> I think the safer change is to use -0x80000000 as the value of the
> >> constant, without making it unsigned.
> > 
> > -0x80000000 has unsigned type.
> 
> Ugh.  The joys of C.
> 
> Using a cast would rely on a GCC extension, so one has to write
> (-2147483647 - 1) to get the desired value.  Wow.

What is your objection to having the constant unsigned?

Note that other ELF based systems like android or bsd just define the
constant as 0x80000000 (with or without UL). And the other SHF_
constants are also defined with their 0x... values in gABI. They are
flag values you combine with | or mask with &, not compare directly.

If you objection is that it isn't consistent with the other flag value
defines then my other proposal was to just define all these SHF
constants with their hex value:
https://sourceware.org/ml/libc-alpha/2015-03/msg00793.html

Cheers,

Mark


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