chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Tue, 29 Aug 2017 14:57:55 +0000 (16:57 +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
elogind creates PAM sessions, the potential for collisions is high.

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

Fixes #6624

src/shared/meson.build

index ff7a8349f56011c2f22478a90ac5f7162bddaf4b..06ecaf63372634b3b178a6dbf41b074a1e575c26 100644 (file)
@@ -168,6 +168,8 @@ libshared_deps = [threads,
                   libselinux]
 #endif // 0
 
+libshared_sym_path = '@0@/libshared.sym'.format(meson.current_source_dir())
+
 libshared = shared_library(
         libshared_name,
         shared_sources,
@@ -180,7 +182,8 @@ libshared = shared_library(
         libelogind_internal_sources,
 #endif // 0
         include_directories : includes,
-        link_args : ['-shared'],
+        link_args : ['-shared',
+                    '-Wl,--version-script=' + libshared_sym_path],
         c_args : ['-fvisibility=default'],
         dependencies : libshared_deps,
         install : true,