diff --git a/configure.ac b/configure.ac index e518150c5a..f3c1eb1be1 100644 --- a/configure.ac +++ b/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 #if TARGET_OS_IPHONE diff --git a/src/Makefile.am b/src/Makefile.am index eea01fbf4e..6c438122ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 diff --git a/src/modules/bank.c b/src/modules/bank.c index 76bf56be36..7f8b0fd8fa 100644 --- a/src/modules/bank.c +++ b/src/modules/bank.c @@ -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[];