aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-08-03 00:54:43 +0200
committerKenny Levinsen <kl@kl.wtf>2020-08-03 00:54:55 +0200
commit3e301b8e708e94be0512d8425c33c418a81e5cf7 (patch)
treea473a1d4fbb342fec31b64839b3f50f46f47b092
parentb2cbe576d10d992116bcaae245247c862cc5395a (diff)
libseat: Use symbol file instead of -fvisibility
-rw-r--r--include/compiler.h2
-rw-r--r--libseat/libseat.c18
-rw-r--r--libseat/libseat.syms6
-rw-r--r--meson.build5
4 files changed, 19 insertions, 12 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 6a2b169..4fc02f2 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -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)
diff --git a/libseat/libseat.c b/libseat/libseat.c
index a1aed18..e514d7f 100644
--- a/libseat/libseat.c
+++ b/libseat/libseat.c
@@ -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);
}
diff --git a/libseat/libseat.syms b/libseat/libseat.syms
new file mode 100644
index 0000000..8fd9732
--- /dev/null
+++ b/libseat/libseat.syms
@@ -0,0 +1,6 @@
+{
+ global:
+ libseat_*;
+ local:
+ *;
+};
diff --git a/meson.build b/meson.build
index 59a773f..7d79a31 100644
--- a/meson.build
+++ b/meson.build
@@ -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')