]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: Add a linker script so that all functions are tagget @SD_SHARED instead of...
authorFelipe Sateler <fsateler@users.noreply.github.com>
Mon, 28 Aug 2017 16:49:03 +0000 (13:49 -0300)
committerLennart Poettering <lennart@poettering.net>
Mon, 28 Aug 2017 16:49:03 +0000 (18:49 +0200)
This helps prevent symbol collisions with other programs and libraries. In particular,
because PAM modules are loaded into the process that is creating the session, and
systemd creates PAM sessions, the potential for collisions is high.

Disambiguate all systemd calls by tagging a 'version' SD_SHARED.

Fixes #6624

src/shared/libshared.sym [new file with mode: 0644]
src/shared/meson.build

diff --git a/src/shared/libshared.sym b/src/shared/libshared.sym
new file mode 100644 (file)
index 0000000..e4ae17e
--- /dev/null
@@ -0,0 +1,3 @@
+SD_SHARED {
+       global: *;
+};
index 2eaef11a2d48f104fb277fe783f8e4c4be479049..ce84d007d1651aa3b3743d0e7621e97a0375e1a5 100644 (file)
@@ -136,6 +136,8 @@ libshared_deps = [threads,
                   liblz4,
                   libblkid]
 
+libshared_sym_path = '@0@/libshared.sym'.format(meson.current_source_dir())
+
 libshared = shared_library(
         libshared_name,
         shared_sources,
@@ -144,7 +146,8 @@ libshared = shared_library(
         libsystemd_internal_sources,
         libudev_sources,
         include_directories : includes,
-        link_args : ['-shared'],
+        link_args : ['-shared',
+                    '-Wl,--version-script=' + libshared_sym_path],
         c_args : ['-fvisibility=default'],
         dependencies : libshared_deps,
         install : true,