Skip to content

Commit a2138c0

Browse files
committed
First pass at using the Symbol map
First pass at using the Symbol map to hide symbols. This is a little clunky in meson, since there's no built in support for this yet. What we do is we define the path to the version map, and the linker flags to use it, and then test if the compiler is OK with this. If it is, then all is good, otherwise, we abort and complain. The linker flags are also added to to library build step.
1 parent 483e6b3 commit a2138c0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ rt_dep = cc.find_library('rt')
3131
# Include directories
3232
includes_include = include_directories('include')
3333

34+
# Symbol map
35+
libepollshim_sym_path = meson.current_source_dir() + '/Version.map'
36+
libepollshim_sym_ldflag = '-Wl,--version-script=' + libepollshim_sym_path
37+
38+
if cc.links('', name: '-Wl,--version-script', args: ['-shared', libepollshim_sym_ldflag])
39+
link_args = [libepollshim_sym_ldflag]
40+
else
41+
error('Linker doesn\'t support --version-script')
42+
endif
43+
3444
header_libepollshim = [ 'include/sys/epoll.h',
3545
'include/sys/timerfd.h',
3646
'include/sys/signalfd.h'
@@ -55,6 +65,7 @@ lib_libepollshim = both_libraries('epoll-shim',
5565
include_directories : includes_include,
5666
dependencies : deps_libepollshim,
5767
version : libepollshim_so_version,
68+
link_args : '-Wl,--version-script=' + libepollshim_sym_path,
5869
install : true
5970
)
6071

0 commit comments

Comments
 (0)