diff --git a/meson.build b/meson.build
index 42a4d25bfd7..68690e5de52 100644
--- a/meson.build
+++ b/meson.build
@@ -98,7 +98,7 @@ cxxflags_mod = []
 
 ldflags = []
 ldflags_be = []
-ldflags_sl = []
+ldflags_sl = get_option('ldflags_sl')
 ldflags_mod = []
 
 test_c_args = []
diff --git a/meson_options.txt b/meson_options.txt
index 246cecf3827..5997eba8644 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -76,6 +76,8 @@ option('darwin_sysroot', type: 'string', value: '',
 option('rpath', type: 'boolean', value: true,
   description: 'Embed shared library search path in executables')
 
+option('ldflags_sl', type: 'array', value: [],
+  description: 'Extra linker flags for linking shared libraries only')
 
 # External dependencies
 
