]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
build-system: make it compatible with ASan/UBsan/MSan 3759/head
authorEvgeny Vereshchagin <evvers@ya.ru>
Tue, 30 Mar 2021 03:31:36 +0000 (03:31 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Tue, 30 Mar 2021 06:09:35 +0000 (06:09 +0000)
Closes: https://github.com/lxc/lxc/issues/3727
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
configure.ac
src/lxc/Makefile.am

index 78446c65a3cd642adf253a41379fc0d08b12cdc0..db12131a0cc207f25565ea6b93b03987e4c0e003 100644 (file)
@@ -200,6 +200,11 @@ AC_ARG_ENABLE([werror],
        [AS_HELP_STRING([--disable-werror], [do not treat warnings as errors])],
        [enable_werror=$enableval], [enable_werror=yes])
 
+AC_ARG_ENABLE([no_undefined],
+       [AS_HELP_STRING([--disable-no-undefined], [do not pass -Wl,--no-undefined])],
+       [enable_no_undefined=$enableval], [enable_no_undefined=yes])
+AM_CONDITIONAL([ENABLE_NO_UNDEFINED], [test "x$enable_no_undefined" = "xyes"])
+
 # Allow disabling rpath
 AC_ARG_ENABLE([rpath],
        [AS_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
@@ -801,12 +806,15 @@ AC_SUBST(AM_CFLAGS)
 
 CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[ \
        -Wl,--as-needed \
-        -Wl,--no-undefined \
         -Wl,--gc-sections \
         -Wl,-z,relro \
         -Wl,-z,now \
         -pie \
         -Wl,-fuse-ld=gold])
+
+AM_COND_IF([ENABLE_NO_UNDEFINED],
+       [CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[-Wl,--no-undefined])])
+
 AC_SUBST(AM_LDFLAGS)
 
 CFLAGS="$CFLAGS -Wvla -std=gnu11 -fms-extensions"
index 8ef26f392d21f7a4f1e7c00c9e1bdfd6186d4cdb..7d1accf2936fba454bc703ba4a66ca1b1e5f390d 100644 (file)
@@ -262,10 +262,13 @@ liblxc_la_CFLAGS = -fPIC \
                   -pthread
 
 liblxc_la_LDFLAGS = -pthread \
-                   -Wl,-no-undefined \
                    -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
                    -version-info @LXC_ABI_MAJOR@
 
+if ENABLE_NO_UNDEFINED
+liblxc_la_LDFLAGS += -Wl,-no-undefined
+endif
+
 liblxc_la_LIBADD = $(CAP_LIBS) \
                   $(OPENSSL_LIBS) \
                   $(SELINUX_LIBS) \
@@ -1855,8 +1858,7 @@ pam_cgfs_la_LIBADD = $(AM_LIBS) \
 pam_cgfs_la_LDFLAGS = $(AM_LDFLAGS) \
                      -avoid-version \
                      -module \
-                     -shared \
-                     -Wl,-no-undefined
+                     -shared
 endif
 endif