diff --git a/config/config.mk b/config/config.mk index a9fa56a95f2c..be861dc7470a 100644 --- a/config/config.mk +++ b/config/config.mk @@ -54,6 +54,7 @@ _MOZBUILD_EXTERNAL_VARIABLES := \ JAR_MANIFEST \ JAVA_JAR_TARGETS \ JS_MODULES_PATH \ + LD_VERSION_SCRIPT \ LIBRARY_NAME \ MODULE \ MSVC_ENABLE_PGO \ diff --git a/config/rules.mk b/config/rules.mk index c9cb9f2a0fe6..b7503a84122a 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -510,6 +510,10 @@ ifeq ($(OS_ARCH),Linux) ifdef IS_COMPONENT EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic endif +ifdef LD_VERSION_SCRIPT +EXTRA_DSO_LDOPTS += -Wl,--version-script,$(LD_VERSION_SCRIPT) +EXTRA_DEPS += $(LD_VERSION_SCRIPT) +endif endif # diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 0dad810d7344..eb60dca362b7 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -249,6 +249,7 @@ class TreeMetadataEmitter(LoggingMixin): 'DEFFILE', 'SDK_LIBRARY', 'WIN32_EXE_LDFLAGS', + 'LD_VERSION_SCRIPT', ] for v in varlist: if v in sandbox and sandbox[v]: diff --git a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py index d5d794bc9583..b2e7981f7124 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py +++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py @@ -359,6 +359,12 @@ VARIABLES = { This variable can only be used on Windows. """, None), + 'LD_VERSION_SCRIPT': (unicode, unicode, + """The linker version script for shared libraries. + + This variable can only be used on Linux. + """, None), + 'RESOURCE_FILES': (HierarchicalStringListWithFlagsFactory({'preprocess': bool}), list, """List of resources to be exported, and in which subdirectories.