This fixes:
gcc a.c -fsanitize=leak
/usr/bin/ld:
/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../lib64/liblsan.so:
undefined reference to `__lsan::GetThreadRangesLocked(unsigned long long,
unsigned long*, unsigned long*, unsigned long*, unsigned long*, unsigned long*,
unsigned long*, __sanitizer::DTLS**)'
/usr/bin/ld:
/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../lib64/liblsan.so:
undefined reference to `__lsan::LsanOnDeadlySignal(int, void*, void*)'
/usr/bin/ld:
/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../lib64/liblsan.so:
undefined reference to `__lsan::ThreadContext::ThreadContext(int)'
/usr/bin/ld:
/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../lib64/liblsan.so:
undefined reference to `__lsan::ThreadStart(unsigned int, unsigned long long,
__sanitizer::ThreadType)'
/usr/bin/ld:
/home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../lib64/liblsan.so:
undefined reference to `__lsan::InitializeMainThread()'
collect2: error: ld returned 1 exit status
I tested the patch helps and I'm going to push the patch.
Martin
libsanitizer/ChangeLog:
PR libsanitizer/98828
* lsan/Makefile.am: Add missing lsan_posix.cpp file.
* lsan/Makefile.in: Likewise.
---
libsanitizer/lsan/Makefile.am | 3 ++-
libsanitizer/lsan/Makefile.in | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/libsanitizer/lsan/Makefile.am b/libsanitizer/lsan/Makefile.am
index c76d8a3aa8f..f4db8e37683 100644
--- a/libsanitizer/lsan/Makefile.am
+++ b/libsanitizer/lsan/Makefile.am
@@ -29,7 +29,8 @@ lsan_files = \
lsan_malloc_mac.cpp \
lsan_allocator.cpp \
lsan_interceptors.cpp \
- lsan_thread.cpp
+ lsan_thread.cpp \
+ lsan_posix.cpp
libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
diff --git a/libsanitizer/lsan/Makefile.in b/libsanitizer/lsan/Makefile.in
index fbe87cd2496..01de442637c 100644
--- a/libsanitizer/lsan/Makefile.in
+++ b/libsanitizer/lsan/Makefile.in
@@ -151,7 +151,7 @@ liblsan_la_DEPENDENCIES = \
am__objects_1 = lsan_common.lo lsan_common_linux.lo lsan_common_mac.lo
am__objects_2 = $(am__objects_1) lsan.lo lsan_linux.lo lsan_mac.lo \
lsan_malloc_mac.lo lsan_allocator.lo lsan_interceptors.lo \
- lsan_thread.lo
+ lsan_thread.lo lsan_posix.lo
am_liblsan_la_OBJECTS = $(am__objects_2)
liblsan_la_OBJECTS = $(am_liblsan_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
@@ -401,7 +401,8 @@ lsan_files = \
lsan_malloc_mac.cpp \
lsan_allocator.cpp \
lsan_interceptors.cpp \
- lsan_thread.cpp
+ lsan_thread.cpp \
+ lsan_posix.cpp
libsanitizer_lsan_la_SOURCES = $(sanitizer_lsan_files)
liblsan_la_SOURCES = $(lsan_files)
@@ -551,6 +552,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_linux.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_mac.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_malloc_mac.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_posix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsan_thread.Plo@am__quote@
.cpp.o:
--
2.30.0