Message ID | 1574554290-25787-1-git-send-email-apinski@marvell.com |
---|---|
State | New |
Headers | show |
Series | Fix libstdc++ compiling for an aarch64 multilib with big-endian. | expand |
+ libstdc++@gcc.gnu.org <apinski@marvell.com> writes: > From: Andrew Pinski <apinski@marvell.com> > > Hi if we have a aarch64 compiler that has a big-endian > multi-lib, it fails to compile libstdc++ because > simd_fast_mersenne_twister_engine is only defined for little-endian > in ext/random but ext/opt_random.h thinks it is defined always. > > OK? Built an aarch64-elf toolchain which has a big-endian multi-lib enabled. Looks good to me in the sense that I see the same preprocessor conditions you see. OK if no libstdc++ maintainer tells us it's the wrong fix in the next 24 hrs. Thanks, Richard > > Thanks, > Andrew Pinski > > libstdc++/ChangeLog: > * config/cpu/aarch64/opt/ext/opt_random.h: Wrap around with check > for little-endian like ext/random is done. > > Signed-off-by: Andrew Pinski <apinski@marvell.com> > --- > libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h b/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h > index 696a6d18ab4..9eca9b7df74 100644 > --- a/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h > +++ b/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h > @@ -44,6 +44,7 @@ > _C+8, _C+9, _C+10, _C+11, _C+12, _C+13, _C+14, _C+15}) > #endif > > +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ > namespace __gnu_cxx _GLIBCXX_VISIBILITY (default) > { > _GLIBCXX_BEGIN_NAMESPACE_VERSION > @@ -175,6 +176,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > _GLIBCXX_END_NAMESPACE_VERSION > } // namespace > > +#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ > #endif // __ARM_NEON > > #endif // _EXT_OPT_RANDOM_H
On 26/11/19 22:22 +0000, Richard Sandiford wrote: >+ libstdc++@gcc.gnu.org > ><apinski@marvell.com> writes: >> From: Andrew Pinski <apinski@marvell.com> >> >> Hi if we have a aarch64 compiler that has a big-endian >> multi-lib, it fails to compile libstdc++ because >> simd_fast_mersenne_twister_engine is only defined for little-endian >> in ext/random but ext/opt_random.h thinks it is defined always. >> >> OK? Built an aarch64-elf toolchain which has a big-endian multi-lib enabled. > >Looks good to me in the sense that I see the same preprocessor >conditions you see. OK if no libstdc++ maintainer tells us it's >the wrong fix in the next 24 hrs. Looks right. The #if could even be moved earlier, as the __VEXT macros don't seem to be used anywhere except that file. If most of the file gets skipped for big endian, that macro isn't needed either (and it looks like the __ARM_BIG_ENDIAN version of it is never used at all). No harm leaving the macro though, so as far as I'm concerned the patch is fine.
diff --git a/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h b/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h index 696a6d18ab4..9eca9b7df74 100644 --- a/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h +++ b/libstdc++-v3/config/cpu/aarch64/opt/ext/opt_random.h @@ -44,6 +44,7 @@ _C+8, _C+9, _C+10, _C+11, _C+12, _C+13, _C+14, _C+15}) #endif +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ namespace __gnu_cxx _GLIBCXX_VISIBILITY (default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -175,6 +176,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace +#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #endif // __ARM_NEON #endif // _EXT_OPT_RANDOM_H