[vlc-devel] [PATCH 1/2] configure: allow toggling of -Wl, -z, defs and -no-undefined

Rémi Denis-Courmont remi at remlab.net
Wed Mar 15 13:51:51 CET 2017


On March 15, 2017 11:10:27 AM GMT+02:00, "Filip Roséen" <filip at atch.se> wrote:
>There are cases where it is annoying to build VLC with this
>restriction as you would like to use symbols that are simply not
>present (in terms of definition) when things are being built.
>
>SUMMARY:
>
> - "-Wl,-z,defs" is now opt-out + automatic detection
> - "-no-undefined" is now opt-out
>
>Both options are governed by a new configure flag,
>"--{enable,disable}-no-undefined-symbols" as they are tightly coupled.
>
>--
>
>RATIONALE:
>
> - simplify usage of -fsanitize together with llvm/clang
> - out-of-tree definitions of VLC related functions (I sometimes do
>   this for extensive testing by building object files that I later
>   circle between when trying out samples).
>
>Using llvm/clang with -fsanitize=address, the symbols put in the
>resulting object-file related to the address sanitizer are not
>available, and we will get an error diagnostic due to the relevant
>flags.
>
>The below linked articles elaborates the issue further:
>
> - https://clang.llvm.org/docs/AddressSanitizer.html#usage
> - https://github.com/google/sanitizers/wiki/AddressSanitizer#faq
>
>One can circumvent the issue by manually specifying flags to
>effectivelly have the symbols resolved during linking, and preventing
>use of the relevant shared library. The drawbacks are, of course:
>
> - negative impact on build time
> - negative impact on execution speed
> - unnecessary complex for those who are not familiar with the
>   intrinsics of libtools and configure.ac
>---
> configure.ac | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
>diff --git a/configure.ac b/configure.ac
>index 71f19c43f9..1081e14ec8 100644
>--- a/configure.ac
>+++ b/configure.ac
>@@ -1086,16 +1086,22 @@ VLC_RESTORE_FLAGS
> SYMBOLIC_LDFLAGS="${ac_cv_ld_bsymbolic}"
> AC_SUBST(SYMBOLIC_LDFLAGS)
> 
>-VLC_SAVE_FLAGS
>-LDFLAGS="${LDFLAGS} -Wl,-z,defs"
>-AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
>-  AC_TRY_LINK([],, [
>-    ac_cv_ld_z_defs="yes"
>-  ], [
>-    ac_cv_ld_z_defs="no"
>-  ])
>+dnl
>+dnl No undefined symbols for libvlc* objects
>+dnl
>+AC_ARG_ENABLE(no-undefined-symbols,
>+  [AS_HELP_STRING([--disable-no-undefined-symbols],
>+    [disable error on undefined symbols when linking \
>+     core VLC objects (default enabled)] )] )
>+
>+AS_IF([test "${enable_no_undefined_symbols}" != "no" ], [
>+  VLC_SAVE_FLAGS
>+  LDFLAGS="${LDFLAGS} -Wl,-z,defs"
>+  AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
>+    AC_TRY_LINK([],, [ac_cv_ld_z_defs="yes"], [ac_cv_ld_z_defs="no"])
>])
>+  AS_IF([test "${ac_cv_ld_z_defs}" = "no"], [VLC_RESTORE_FLAGS])
>+  AC_SUBST([LDFLAGS_no_undefined], [-no-undefined])
> ])
>-AS_IF([test "${ac_cv_ld_z_defs}" = "no"], [VLC_RESTORE_FLAGS])
> 
> dnl Check for __attribute__((packed))
> AC_CACHE_CHECK([for __attribute__((packed))],
>-- 
>2.12.0
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

I added this because I am fed up with devs not checking their dependencies correctly, breaking my and Debian builds frequently.

So obviously, I am very much against this change. This removes a very useful build-time diagnostic and WILL cause more build breaks.
-- 
Rémi Denis-Courmont


More information about the vlc-devel mailing list