Compiler Support
This table summarizes how the supported compilers interact with the variables
described on Configure-Time and project-local.cmake: How To Hook Into LIBRA.
The variables in the table are an attempt at a polymorphic interface for
supporting different compilers, cmake style. In the compiler-specific sections
that follow, the shown variables have suffixes ({_GNU,_CLANG,_INTEL}) which
are pure to get the docs to link unambiguously and are not present in the code.
LIBRA Variable |
gcc/g++ |
clang/clang++ |
icx/icpx |
|---|---|---|---|
Yes |
Yes |
Yes |
|
|
No |
Yes |
No |
Yes |
Yes |
No |
|
Yes, via cmake builtin |
Yes, via cmake builtin |
Yes, via cmake builtin |
|
|
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
|
Yes |
Yes |
Yes |
|
Yes |
Yes |
Yes |
|
Yes, all types |
Yes, all types |
Yes, all types |
|
Yes |
Yes |
Yes |
|
Yes |
Yes |
No |
|
Yes |
Yes |
No |
|
Yes |
Yes |
Yes |
GNU (gcc/g++)
- LIBRA_DEBUG_INFO_GNU
If enabled:
-g2. If disabled:-g0.
- LIBRA_FORTIFY_GNU
If STACK: -fstack-protector.
If SOURCE: -D_FORTIFY_SOURCE=2.
If GOT: -Wl,-z,relro -Wl,-z,now.
If FORMAT: -Wformat-security -Werror=format=2.
- LIBRA_OPT_LEVEL_GNU
Set to -O0 on Debug builds and -O3 on release builds, unless overriden.
- LIBRA_NATIVE_OPT_GNU
If enabled: -march=native -mtune=native.
- LIBRA_SAN_GNU
If MSAN enabled:
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize=leak
-fsanitize-recover=all
If ASAN is enabled:
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize=address
-fsanitize-address-use-after-scope
-fsanitize=pointer-compare
-fsanitize=pointer-subtract
-fsanitize-recover=all
If SSAN is enabled:
-fno-omit-frame-pointer
-fstack-protector-all
-fstack-protector-strong
-fsanitize-recover=all.
If UBSAN is enabled:
-fno-omit-frame-pointer
-fsanitize=undefined
-fsanitize=float-divide-by-zero
-fsanitize=float-cast-overflow
-fsanitize=null
-fsanitize=signed-integer-overflow
-fsanitize=bool
-fsanitize=enum
-fsanitize=builtin
-fsanitize=bounds
-fsanitize=vptr
-fsanitize=pointer-overflow
-fsanitize-recover=all
If TSAN is enabled:
-fno-omit-frame-pointer
-fsanitize=thread
-fsanitize-recover=all
- LIBRA_PGO_GNU
If GEN: -fprofile-generate.
If USE: -fprofile-use.
- LIBRA_CODE_COV_CLANG
If enabled: -fprofile-arcs -ftest-coverage -fno-inline -fprofile-update=atomic.
- LIBRA_VALGRIND_COMPAT_CLANG
If enabled: -mno-sse3.
- LIBRA_STDLIB_GNU
If NONE: -nostdlib.
If STDCXX: N/A.
If CXX: N/A.
clang (clang/clang++)
- LIBRA_DEBUG_INFO_CLANG
If enabled: -g2. If disabled: -g0.
- LIBRA_BUILD_PROF_CLANG
If enabled: -ftime-trace.
- LIBRA_FORTIFY_CLANG
If STACK: -fstack-protector.
If SOURCE: -D_FORTIFY_SOURCE=2.
If GOT: -Wl,-z,relro -Wl,-z,now.
If FORMAT: -Wformat-security -Werror=format=2.
- LIBRA_OPT_LEVEL_CLANG
Set to -O0 on Debug builds and -O3 on release builds, unless overriden.
- LIBRA_SAN_GNU
If MSAN enabled:
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
fsanitize=memory
-fsanitize-memory-track-origins
If ASAN is enabled:
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize=address,leak
If SSAN is enabled:
-fno-omit-frame-pointer
-fstack-protector-all
-fstack-protector-strong
-fsanitize=safe-stack
If UBSAN is enabled:
-fno-omit-frame-pointer
-fsanitize=undefined
-fsanitize=float-divide-by-zero
-fsanitize=unsigned-integer-overflow
-fsanitize=local-bounds
-fsanitize=nullability
If TSAN is enabled:
-fno-omit-frame-pointer -fsanitize=thread
- LIBRA_PGO_CLANG
If GEN: -fprofile-generate. Also passed as linker options to
${PROJECT_NAME}`.
If USE: -fprofile-use.
- LIBRA_CODE_COV_CLANG
If enabled: -fprofile-instr-generate -fcoverage-mapping -fno-inline.
- LIBRA_VALGRIND_COMPAT_CLANG
If enabled: -mno-sse3.
- LIBRA_STDLIB_CLANG
If NONE: -nostdlib.
If STDCXX: -stdlib=libstdc++.
If CXX: -stdlib=libc++
Intel LLVM (icx/icpx)
- LIBRA_DEBUG_INFO_INTEL
If enabled:
-g2. If disabled:-g0.
- LIBRA_NATIVE_OPT_INTEL
If enabled: -xHost.
- LIBRA_SAN_INTEL
If MSAN enabled:
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize=memory
-fsanitize-memory-track-origins
If ASAN is enabled:
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
-fsanitize=address,leak
If SSAN is enabled:
-fno-omit-frame-pointer
-fstack-protector-all
-fstack-protector-strong
-fstack-security-check
If UBSAN is enabled:
-fno-omit-frame-pointer
-fsanitize=undefined
If TSAN is enabled:
-fno-omit-frame-pointer
-fsanitize=thread
- LIBRA_PGO_INTEL
If GEN: -fprofile-generate. Also passed as linker options to
${PROJECT_NAME}`.
If USE: -fprofile-use
This is software PGO. Intel also supports HWPGO experimentally, but it isn’t ready for prime time yet.
- LIBRA_STDLIB_GNU
If NONE: -nostdlib.
If STDCXX: -stdlib=libstdc++.
If CXX: -stdlib=libc++