On 2019-06-25 19:59, Xi Ruoyao wrote:
On 2019-06-25 15:36 +0200, J.W. Jagersma wrote:
Say I have a header which defines a type conditionally based on the
__SSE__ macro:
#ifdef __SSE__
struct X { ... };
#else
struct X { ... };
#endif
This header is included in multiple compilation units, some of which are
compiled with -mgeneral-regs-only. I don't want any fpu/simd code there.
Now this flag also undefines __SSE__, which I suppose makes sense, but
it breaks the ABI between translation units.
Is there some way to avoid generating fpu code without affecting
preprocessor macros?
How about just "pretend" to have __SSE__?
cat > test.c << EOF
#ifndef __SSE__
#error
#endif
int main(){}
EOF
gcc test.c -mgeneral-regs-only -D__SSE__
Ideally I'd have the macros defined by -march so I don't need to
complicate the build process for different architectures. I suppose I
could work this out in the makefile, but a different solution would be
preferable.