On Tue, Mar 24, 2020 at 09:19:12AM +0100, Martin Liška wrote: > 2020-03-24 Martin Liska <mli...@suse.cz> > > PR lto/94249 > * plugin-api.h: Add more robust endianess detection. > --- > include/plugin-api.h | 43 +++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 41 insertions(+), 2 deletions(-) > > diff --git a/include/plugin-api.h b/include/plugin-api.h > index 673f136ce68..4a211d51f43 100644 > --- a/include/plugin-api.h > +++ b/include/plugin-api.h > @@ -42,6 +42,43 @@ extern "C" > { > #endif
The location is incorrect, you don't want to include system headers inside explicit extern "C", so please move it a few lines above it. Furthermore, you don't have the glibc case with GCC < 4.6 handled, that needs something like: #if defined(__GLIBC__) || defined(__GNU_LIBRARY__) \ || defined(__ANDROID__) #include <endian.h> #if __BYTE_ORDER == __LITTLE_ENDIAN #define PLUGIN_LITTLE_ENDIAN 1 #elif __BYTE_ORDER == __BIG_ENDIAN #define PLUGIN_BIG_ENDIAN 1 ... (of course done only if __BYTE_ORDER__ and __ORDER_*_ENDIAN__ isn't defined). And, you don't handle PDP endian, while GCC does support pdp11-*, so IMNSHO you also need to detect PDP endian and use: #elif PLUGIN_PDP_ENDIAN == 1 char symbol_type; char def; char unused; char section_kind; Jakub