mirror of https://code.videolan.org/videolan/vlc
configure.ac: add linker test for dynamic_lookup
Check that the linker features from Darwin ld64 for marking a symbol as undefined (in the context of two-level namespace, it means that it can be looked up in other namespaces) are usable. If they are not, the static module bank is disabled since it depends on either static linkage (which is obviously not affected by this option) or more generally the ability to look up the static module bank symbol in a different linkage unit/namespace. In particular, they are currently not usable when enabling bitcode through LDFLAGS+=" -fembed-bitcode" and compiling dynamically. On tvOS, bitcode is mandatory, so supporting compiling with bitcode but without the static module bank seems a rather good compromise given that it was disabled anyway previously. In static builds (the current shipping target for iOS and tvOS), the static module bank stays enabled by the !HAVE_DYNAMIC_PLUGINS check.
This commit is contained in:
parent
9262bbc257
commit
7e916f4ce6
19
configure.ac
19
configure.ac
|
@ -205,9 +205,26 @@ case "${host_os}" in
|
|||
AX_APPEND_FLAG([-Werror=partial-availability], [OBJCFLAGS])
|
||||
AX_APPEND_FLAG([-Wl,-headerpad_max_install_names], [LDFLAGS])
|
||||
|
||||
VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup])
|
||||
VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation])
|
||||
|
||||
dnl This is not supported when bitcode is enabled. In that case, we need
|
||||
dnl to disable the static bank loader.
|
||||
AC_MSG_CHECKING([if -Wl,-U is allowed])
|
||||
VLC_SAVE_FLAGS
|
||||
AX_APPEND_FLAG([LDFLAGS],[-Wl,-U,_my_array -no-undefined])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([], [dnl
|
||||
__attribute__((visibility("default"))) extern int my_array[];
|
||||
__attribute__((visibility("default"))) int foo() { return my_array[0]; }
|
||||
])],
|
||||
[
|
||||
VLC_ADD_LDFLAGS([libvlccore],[-Wl,-U,_vlc_static_modules])
|
||||
VLC_ADD_LDFLAGS([libvlc vlc],[-Wl,-undefined,dynamic_lookup])
|
||||
VLC_ADD_CPPFLAGS([libvlccore],[-DHAVE_DYLIB_DYNAMIC_LOOKUP=1])
|
||||
AC_MSG_RESULT([yes])
|
||||
],[AC_MSG_RESULT([no])])
|
||||
VLC_RESTORE_FLAGS
|
||||
|
||||
AC_EGREP_CPP(yes,
|
||||
[#import <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
|
|
|
@ -566,7 +566,7 @@ $(libvlccore_la_OBJECTS): libvlccore_objc.la
|
|||
libvlccore_objc_la_OBJCFLAGS = $(AM_OBJCFLAGS) -fobjc-arc
|
||||
libvlccore_objc_la_LDFLAGS = -static
|
||||
libvlccore_la_LIBADD += libvlccore_objc.la
|
||||
libvlccore_la_LDFLAGS += -Wl,-framework,Foundation -Xlinker -install_name -Xlinker @rpath/libvlccore.dylib -Wl,-U,_vlc_static_modules
|
||||
libvlccore_la_LDFLAGS += -Wl,-framework,Foundation -Xlinker -install_name -Xlinker @rpath/libvlccore.dylib
|
||||
endif
|
||||
|
||||
# iOS and tvOS applications cannot install global shared libraries and
|
||||
|
|
|
@ -179,7 +179,9 @@ static vlc_plugin_t *module_InitStatic(vlc_plugin_cb entry)
|
|||
* not provided at runtime. However, although __MACH__ implies the same runtime
|
||||
* consequences for weak linking, it will still require the definition to exist
|
||||
* at build time. To workaround this, we add -Wl,-U,vlc_static_modules. */
|
||||
#if defined(__ELF__) || defined(__MACH__) || !HAVE_DYNAMIC_PLUGINS
|
||||
#if defined(__ELF__) \
|
||||
|| (defined(__MACH__) && defined(HAVE_DYLIB_DYNAMIC_LOOKUP)) \
|
||||
|| !HAVE_DYNAMIC_PLUGINS
|
||||
VLC_WEAK
|
||||
extern vlc_plugin_cb vlc_static_modules[];
|
||||
|
||||
|
|
Loading…
Reference in New Issue