https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84148
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to igor.v.tsimbalist from comment #7)
> (In reply to H.J. Lu from comment #6)
> > (In reply to igor.v.tsimbalist from comment #4)
> > > Created attachment 43400 [details]
> > > patch
> >
> > 2 questions:
> >
> > 1. Should 32-bit multilib target libraries compiled on 64-bit host
> > enable CET?
> > 2. Should 64-bit multilib target libraries compiled with 32-bit compiler
> > enable CET?
>
> Is there a configuration variable holding an indication of bit-ness for
> which the compilation of a library is done? I see there is some code in
> configure.ac in libgcc evaluating the host_address (32 or 64 bits)
>
> # Check 32bit or 64bit. In the case of MIPS, this really determines the
> # word size rather than the address size.
> cat > conftest.c <<EOF
> #if defined(__x86_64__) || (!defined(__i386__) && defined(__LP64__)) \
> || defined(__mips64)
> host_address=64
> #else
> host_address=32
> #endif
> EOF
> eval `${CC-cc} -E conftest.c | grep host_address=`
> rm -f conftest.c
>
> If I use the 'host_address' in cet.m4 I got the expected results for libgcc:
> by default 64-bit library is CET enabled, 32-bit library is not.
That would be wrong for x32. We need to enable CET for x86-64
by default, regardless address size. To enable CET, we only
need to check if __SSE2__ is defined since all SSE2 processors
support multi-byte NOPs.