On Tue, Mar 31, 2020 at 3:28 PM Maciej W. Rozycki <ma...@linux-mips.org> wrote: > > Correct an issue with GCC commit 906b3eb9df6c ("Improve endianess > detection.") and fix a typo in the __BYTE_ORDER fallback macro check > that causes compilation errors like: > > .../include/plugin-api.h:162:2: error: #error "Could not detect architecture > endianess" > > on systems that do not provide the __BYTE_ORDER__ macro. > > include/ > PR lto/94249 > * plugin-api.h: Fix a typo in the __BYTE_ORDER macro check. > --- > On Tue, 24 Mar 2020, Martin Liška wrote: > > > >> +/* Detect endianess based on _BYTE_ORDER. */ > > >> +#if _BYTE_ORDER == _LITTLE_ENDIAN > > > > > > So most likely _BYTE_ORDER and _LITTLE_ENDIAN macros will not be defined. > > > Which means this will be handled as #if 0 == 0 and override the > > >> +#define PLUGIN_LITTLE_ENDIAN 1 > > > > > > will define also PLUGIN_LITTLE_ENDIAN. > > > > Ok, for being sure, I've wrapped all equality comparison with corresponding > > check of the LHS is defined. > > This change, when merged into binutils, caused BFD to fail building in > one of my configurations: > > In file included from .../bfd/elflink.c:31: > .../bfd/../include/plugin-api.h:162:2: error: #error "Could not detect > architecture endianess" > make[4]: *** [elflink.lo] Error 1 > > This is due to a missing underscore in the: > > #ifdef _BYTE_ORDER > > check. > > OK to apply this hopefully obvious fix to GCC and then merge to binutils?
OK. > NB if posting as an attachment please try matching the message subject > with the change heading as otherwise it takes a lot of effort to track the > patch submission corresponding to a given commit. > > Maciej > --- > include/plugin-api.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > binutils-include-plugin-api-byte-order.diff > Index: binutils/include/plugin-api.h > =================================================================== > --- binutils.orig/include/plugin-api.h > +++ binutils/include/plugin-api.h > @@ -51,7 +51,7 @@ > /* Older GCC releases (<4.6.0) can make detection from glibc macros. */ > #if defined(__GLIBC__) || defined(__GNU_LIBRARY__) || defined(__ANDROID__) > #include <endian.h> > -#ifdef _BYTE_ORDER > +#ifdef __BYTE_ORDER > #if __BYTE_ORDER == __LITTLE_ENDIAN > #define PLUGIN_LITTLE_ENDIAN 1 > #elif __BYTE_ORDER == __BIG_ENDIAN