From 5f72109e5bd84124bd6dd9877fae3fa9ae7ee348 Mon Sep 17 00:00:00 2001 From: Joao Carlos Mendes Luis Date: Tue, 14 Jul 2020 16:17:44 -0300 Subject: [PATCH] Disable -Wl,-z,defs for ASAN builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit af65916 added -Wl,-z,defs for the shared libraries. This apparently does not work in some cases with --enable-asan, so only add it for non-ASAN builds. Reviewed-by: Brian Behlendorf Reviewed-by: João Carlos Mendes Luis Signed-off-by: Arvind Sankar Closes #10557 Closes #10560 --- lib/libnvpair/Makefile.am | 6 +++++- lib/libuutil/Makefile.am | 6 +++++- lib/libzfs/Makefile.am | 6 +++++- lib/libzfs_core/Makefile.am | 6 +++++- lib/libzpool/Makefile.am | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index 340e6d3622..ec16c5d526 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -31,7 +31,11 @@ libnvpair_la_LIBADD = \ libnvpair_la_LIBADD += $(LIBTIRPC_LIBS) $(LTLIBINTL) -libnvpair_la_LDFLAGS = -Wl,-z,defs +libnvpair_la_LDFLAGS = + +if !ASAN_ENABLED +libnvpair_la_LDFLAGS += -Wl,-z,defs +endif if BUILD_FREEBSD libnvpair_la_LDFLAGS += -version-info 3:0:0 diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index 4143a190bf..8d9b32e448 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -21,7 +21,11 @@ libuutil_la_LIBADD = \ libuutil_la_LIBADD += $(LTLIBINTL) -libuutil_la_LDFLAGS = -pthread -Wl,-z,defs +libuutil_la_LDFLAGS = -pthread + +if !ASAN_ENABLED +libuutil_la_LDFLAGS += -Wl,-z,defs +endif if BUILD_FREEBSD libuutil_la_LDFLAGS += -version-info 3:0:0 diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 4154e9fee9..f88fb828d5 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -76,7 +76,11 @@ libzfs_la_LIBADD = \ libzfs_la_LIBADD += -lm $(LIBCRYPTO_LIBS) $(ZLIB_LIBS) $(LTLIBINTL) -libzfs_la_LDFLAGS = -pthread -Wl,-z,defs +libzfs_la_LDFLAGS = -pthread + +if !ASAN_ENABLED +libzfs_la_LDFLAGS += -Wl,-z,defs +endif if BUILD_FREEBSD libzfs_la_LIBADD += -lutil -lgeom diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index 94a10e3991..e94ba85d27 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -15,7 +15,11 @@ libzfs_core_la_LIBADD = \ libzfs_core_la_LIBADD += $(LTLIBINTL) -libzfs_core_la_LDFLAGS = -pthread -Wl,-z,defs +libzfs_core_la_LDFLAGS = -pthread + +if !ASAN_ENABLED +libzfs_core_la_LDFLAGS += -Wl,-z,defs +endif if BUILD_FREEBSD libzfs_core_la_LIBADD += -lutil -lgeom diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 7924a425d2..50658bc678 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -210,7 +210,11 @@ libzpool_la_LIBADD = \ libzpool_la_LIBADD += $(LIBCLOCK_GETTIME) $(ZLIB_LIBS) -ldl -libzpool_la_LDFLAGS = -pthread -Wl,-z,defs +libzpool_la_LDFLAGS = -pthread + +if !ASAN_ENABLED +libzpool_la_LDFLAGS += -Wl,-z,defs +endif if BUILD_FREEBSD libzpool_la_LIBADD += -lgeom