external/firebird: Avoid ODR violation issues from sanitizer builds
My local ASan/UBSan builds of d37c60c5e2b793c0934d431e59c8cb3ff1a170b6 "external/firebird: Drop -fno-rtti from sanitizer builds" against LLVM 21 trunk had been fine, but <https://ci.libreoffice.org/job/lo_ubsan/3459/> against lode's LLVM 12.0.1 started to fail with > ==3374322==ERROR: AddressSanitizer: odr-violation (0x0000007af7a0): > [1] size=16 'typeinfo for Firebird::Exception' /home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/UnpackedTarball/firebird/src/common/fb_exception.cpp > [2] size=16 'typeinfo for Firebird::Exception' /home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/UnpackedTarball/firebird/src/common/fb_exception.cpp > These globals were registered at these points: > [1]: > #0 0x440738 in __asan_register_globals.part.0 /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_globals.cpp:360:3 > #1 0x68237b in asan.module_ctor (/workdir/UnpackedTarball/firebird/gen/Debug/firebird/bin/isql+0x68237b) > > [2]: > #0 0x440738 in __asan_register_globals.part.0 /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_globals.cpp:360:3 > #1 0x7f5ccdec01ab in asan.module_ctor (/workdir/UnpackedTarball/firebird/gen/Debug/firebird/lib/libfbclient.so.2+0x9b41ab) What appears to make a difference there is <https://github.com/llvm/llvm-project/commit/1ada819c237bf724e6eaa1c82b2742e3eb57a5d5> "[asan] Default to -fsanitize-address-use-odr-indicator for non-Windows", first appearing in LLVM 16: My local ASan/UBSan LLVM 21 trunk build, which builds external/firebird fine, has > 0000000000ee5166 B __odr_asan_gen__ZTIN8Firebird9ExceptionE > 000000000045b960 D _ZTIN8Firebird9ExceptionE in workdir/UnpackedTarball/firebird/gen/Debug/firebird/bin/isql and > 0000000000e49920 b __odr_asan_gen__ZTIN8Firebird9ExceptionE > 0000000000b9d100 D _ZTIN8Firebird9ExceptionE in workdir/UnpackedTarball/firebird/gen/Debug/firebird/lib/libfbclient.so.2, but when I rebuild it with -fno-sanitize-address-use-odr-indicator, it has only > 000000000045bbc0 D _ZTIN8Firebird9ExceptionE in workdir/UnpackedTarball/firebird/gen/Debug/firebird/bin/isql and only > 0000000000b9d1c0 D _ZTIN8Firebird9ExceptionE in workdir/UnpackedTarball/firebird/gen/Debug/firebird/lib/libfbclient.so.2, and fails the same way as <https://ci.libreoffice.org/job/lo_ubsan/3459/>. So make the "Drop -fno-rtti" patch depend on Clang >= 16 (recorded, for simplicity, with a bespoke new CLANG_16 config_host.mk variable). Change-Id: I70a8ce8eb535265d592d470718d6b3a6765d5bcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181235 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
This commit is contained in:
@@ -71,6 +71,7 @@ export CCACHE_DEPEND_MODE=@CCACHE_DEPEND_MODE@
|
||||
export CDR_CFLAGS=$(gb_SPACE)@CDR_CFLAGS@
|
||||
export CDR_LIBS=$(gb_SPACE)@CDR_LIBS@
|
||||
@x_CFLAGS@ export CFLAGS=@CFLAGS@
|
||||
export CLANG_16=@CLANG_16@
|
||||
export CLANG_USE_LD=@CLANG_USE_LD@
|
||||
export CLANGDIR=@CLANGDIR@
|
||||
export CLANGLIBDIR=@CLANGLIBDIR@
|
||||
|
||||
@@ -4704,6 +4704,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
AC_SUBST(COM_IS_CLANG)
|
||||
|
||||
CLANGVER=
|
||||
CLANG_16=
|
||||
if test "$COM_IS_CLANG" = TRUE; then
|
||||
AC_MSG_CHECKING([whether Clang is new enough])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||
@@ -4732,10 +4733,14 @@ if test "$COM_IS_CLANG" = TRUE; then
|
||||
else
|
||||
AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 12])
|
||||
fi
|
||||
if test "$CLANGVER" -ge 160000; then
|
||||
CLANG_16=TRUE
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
|
||||
AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(CLANG_16)
|
||||
|
||||
SHOWINCLUDES_PREFIX=
|
||||
if test "$_os" = WINNT; then
|
||||
|
||||
@@ -79,6 +79,7 @@ endif
|
||||
ifneq ($(filter -fsanitize=%,$(CC)),)
|
||||
$(eval $(call gb_UnpackedTarball_add_patches,firebird, \
|
||||
external/firebird/sanitizer.patch \
|
||||
$(if $(CLANG_16),external/firebird/sanitizer-rtti.patch) \
|
||||
))
|
||||
endif
|
||||
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- builds/posix/make.defaults
|
||||
+++ builds/posix/make.defaults
|
||||
@@ -102,7 +102,7 @@
|
||||
#____________________________________________________________________________
|
||||
|
||||
# Firebird needs no RTTI
|
||||
-RTTI_FLAG:= -fno-rtti
|
||||
+RTTI_FLAG:=
|
||||
|
||||
# If this is defined then we use special rules useful for developers only
|
||||
IsDeveloper = @DEVEL_FLG@
|
||||
Vendored
-9
@@ -21,15 +21,6 @@
|
||||
+_ZTI*
|
||||
--- builds/posix/make.defaults
|
||||
+++ builds/posix/make.defaults
|
||||
@@ -102,7 +102,7 @@
|
||||
#____________________________________________________________________________
|
||||
|
||||
# Firebird needs no RTTI
|
||||
-RTTI_FLAG:= -fno-rtti
|
||||
+RTTI_FLAG:=
|
||||
|
||||
# If this is defined then we use special rules useful for developers only
|
||||
IsDeveloper = @DEVEL_FLG@
|
||||
@@ -252,7 +252,7 @@
|
||||
# LINKER OPTIONS
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user