libseat: Use symbol file instead of -fvisibility

This commit is contained in:
Kenny Levinsen 2020-08-03 00:54:43 +02:00
parent b2cbe576d1
commit 3e301b8e70
4 changed files with 19 additions and 12 deletions

View file

@ -3,10 +3,8 @@
#ifdef __GNUC__
#define ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
#define LIBSEAT_EXPORT __attribute__((visibility("default")))
#else
#define ATTRIB_PRINTF(start, end)
#define LIBSEAT_EXPORT
#endif
#define STRLEN(s) ((sizeof(s) / sizeof(s[0])) - 1)

View file

@ -32,7 +32,7 @@ static const struct named_backend impls[] = {
#error At least one backend must be enabled
#endif
LIBSEAT_EXPORT struct libseat *libseat_open_seat(struct libseat_seat_listener *listener, void *data) {
struct libseat *libseat_open_seat(struct libseat_seat_listener *listener, void *data) {
if (listener == NULL) {
errno = EINVAL;
return NULL;
@ -70,42 +70,42 @@ LIBSEAT_EXPORT struct libseat *libseat_open_seat(struct libseat_seat_listener *l
return backend;
}
LIBSEAT_EXPORT int libseat_disable_seat(struct libseat *seat) {
int libseat_disable_seat(struct libseat *seat) {
assert(seat && seat->impl);
return seat->impl->disable_seat(seat);
}
LIBSEAT_EXPORT int libseat_close_seat(struct libseat *seat) {
int libseat_close_seat(struct libseat *seat) {
assert(seat && seat->impl);
return seat->impl->close_seat(seat);
}
LIBSEAT_EXPORT const char *libseat_seat_name(struct libseat *seat) {
const char *libseat_seat_name(struct libseat *seat) {
assert(seat && seat->impl);
return seat->impl->seat_name(seat);
}
LIBSEAT_EXPORT int libseat_open_device(struct libseat *seat, const char *path, int *fd) {
int libseat_open_device(struct libseat *seat, const char *path, int *fd) {
assert(seat && seat->impl);
return seat->impl->open_device(seat, path, fd);
}
LIBSEAT_EXPORT int libseat_close_device(struct libseat *seat, int device_id) {
int libseat_close_device(struct libseat *seat, int device_id) {
assert(seat && seat->impl);
return seat->impl->close_device(seat, device_id);
}
LIBSEAT_EXPORT int libseat_get_fd(struct libseat *seat) {
int libseat_get_fd(struct libseat *seat) {
assert(seat && seat->impl);
return seat->impl->get_fd(seat);
}
LIBSEAT_EXPORT int libseat_dispatch(struct libseat *seat, int timeout) {
int libseat_dispatch(struct libseat *seat, int timeout) {
assert(seat && seat->impl);
return seat->impl->dispatch(seat, timeout);
}
LIBSEAT_EXPORT int libseat_switch_session(struct libseat *seat, int session) {
int libseat_switch_session(struct libseat *seat, int session) {
assert(seat && seat->impl);
return seat->impl->switch_session(seat, session);
}

6
libseat/libseat.syms Normal file
View file

@ -0,0 +1,6 @@
{
global:
libseat_*;
local:
*;
};

View file

@ -25,7 +25,6 @@ add_project_arguments(
'-Wno-unused-command-line-argument',
'-Wvla',
'-Wl,--exclude-libs=ALL',
'-fvisibility=hidden',
'-D_XOPEN_SOURCE=700',
'-D__BSD_VISIBLE',
],
@ -128,12 +127,16 @@ private_lib = static_library(
include_directories: [include_directories('.', 'include')],
)
symbols_file = 'libseat/libseat.syms'
symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file)
lib = library(
'seat', # This results in the library being called 'libseat'
[ 'libseat/libseat.c' ],
link_with: private_lib,
include_directories: [include_directories('.', 'include')],
install: true,
link_args: symbols_flag,
link_depends: symbols_file,
)
install_headers('include/libseat.h')