|
Message-ID: <20210126172330.GB23432@brightrain.aerifal.cx> Date: Tue, 26 Jan 2021 12:23:31 -0500 From: Rich Felker <dalias@...ifal.cx> To: Andrey Melnikov <temnota.am@...il.com> Cc: musl@...ts.openwall.com Subject: Re: move __BYTE_ORDER definition to alltypes.h On Tue, Jan 26, 2021 at 02:55:09PM +0300, Andrey Melnikov wrote: > Hi. > > Your commit 97d35a552ec5b6ddf7923dd2f9a8eb973526acea leads to > miscompile programs which rely on one of defines __LITTLE_ENDIAN or > __BIG_ENDIAN. > Now, both unconditionally defined when included stdarg.h and programs > which define __(BIG|LITTE)_ENDIAN itself - miscompiled. linux kernel > for example - it internally uses #if defined __BIG_ENDIAN and defines > it only for BIGENDAIN arches. > > Any ideas? The conditionally-defined macros that on some archs tell you the endianness are __BIG_ENDIAN__ and __LITTLE_ENDIAN__ (note the final __) or other arch-specific macros. __BIG_ENDIAN and __LITTLE_ENDIAN (without the final __) have always been the possible values for __BYTE_ORDER from endian.h. In any case, all of these are in the reserved namespace and should not be defined by applications or inspected in any way other than a manner documented by the implementation. How did this come up with the Linux kernel? AFAIK it uses -nostdinc and should not see the libc headers at all. But if that #ifdef is present in Linux it's probably a bug since it's contrary to all historical use of __BIG_ENDIAN... Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.