From: jca Date: Fri, 15 Dec 2017 16:40:33 +0000 (+0000) Subject: Export only symbols to what's declared in fuse.h/fuse_opt.h X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7c0bee304ce03065d5a47f25bcda7cf3c0285e86;p=openbsd Export only symbols to what's declared in fuse.h/fuse_opt.h While here, use guenther's magic recipe to avoid the PLT when calling exported symbols from within the library. ok kettenis@ for v1, ok guenther@ helg@ --- diff --git a/lib/libfuse/Makefile b/lib/libfuse/Makefile index e28f6924de4..57f7e31645c 100644 --- a/lib/libfuse/Makefile +++ b/lib/libfuse/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.12 2017/12/14 13:50:13 jca Exp $ +# $OpenBSD: Makefile,v 1.13 2017/12/15 16:40:33 jca Exp $ LIB= fuse MAN= fuse_main.3 @@ -17,6 +17,8 @@ CFLAGS+= -I${.CURDIR} SRCS= debug.c dict.c fuse.c fuse_ops.c fuse_opt.c fuse_subr.c tree.c HDRS= fuse.h fuse_opt.h +VERSION_SCRIPT= ${.CURDIR}/Symbols.map + PC_FILES=fuse.pc CLEANFILES+=${PC_FILES} diff --git a/lib/libfuse/Symbols.map b/lib/libfuse/Symbols.map new file mode 100644 index 00000000000..3537e9d0207 --- /dev/null +++ b/lib/libfuse/Symbols.map @@ -0,0 +1,31 @@ +{ + global: + fuse_chan_fd; + fuse_daemonize; + fuse_destroy; + fuse_get_context; + fuse_get_session; + fuse_invalidate; + fuse_is_lib_option; + fuse_loop; + fuse_loop_mt; + fuse_main; + fuse_mount; + fuse_new; + fuse_opt_add_arg; + fuse_opt_add_opt; + fuse_opt_add_opt_escaped; + fuse_opt_free_args; + fuse_opt_insert_arg; + fuse_opt_match; + fuse_opt_parse; + fuse_parse_cmdline; + fuse_remove_signal_handlers; + fuse_set_signal_handlers; + fuse_setup; + fuse_teardown; + fuse_unmount; + fuse_version; + local: + *; +}; diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c index d0dde9a1039..2b9f9e58172 100644 --- a/lib/libfuse/fuse.c +++ b/lib/libfuse/fuse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse.c,v 1.40 2017/12/15 12:08:22 helg Exp $ */ +/* $OpenBSD: fuse.c,v 1.41 2017/12/15 16:40:33 jca Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -218,6 +218,7 @@ fuse_loop(struct fuse *fuse) return (0); } +DEF(fuse_loop); struct fuse_chan * fuse_mount(const char *dir, unused struct fuse_args *args) @@ -268,6 +269,7 @@ bad: free(fc); return (NULL); } +DEF(fuse_mount); void fuse_unmount(const char *dir, struct fuse_chan *ch) @@ -278,6 +280,7 @@ fuse_unmount(const char *dir, struct fuse_chan *ch) if (unmount(dir, MNT_UPDATE) == -1) DPERROR(__func__); } +DEF(fuse_unmount); int fuse_is_lib_option(const char *opt) @@ -299,6 +302,7 @@ fuse_get_session(struct fuse *f) { return (&f->se); } +DEF(fuse_get_session); int fuse_loop_mt(unused struct fuse *fuse) @@ -342,6 +346,7 @@ fuse_new(struct fuse_chan *fc, unused struct fuse_args *args, return (fuse); } +DEF(fuse_new); int fuse_daemonize(int foreground) @@ -351,6 +356,7 @@ fuse_daemonize(int foreground) return (daemon(0,0)); } +DEF(fuse_daemonize); void fuse_destroy(struct fuse *f) @@ -368,6 +374,7 @@ fuse_destroy(struct fuse *f) free(f->fc); free(f); } +DEF(fuse_destroy); void fuse_remove_signal_handlers(unused struct fuse_session *se) @@ -377,6 +384,7 @@ fuse_remove_signal_handlers(unused struct fuse_session *se) signal(SIGTERM, SIG_DFL); signal(SIGPIPE, SIG_DFL); } +DEF(fuse_remove_signal_handlers); int fuse_set_signal_handlers(unused struct fuse_session *se) @@ -501,12 +509,14 @@ fuse_parse_cmdline(struct fuse_args *args, char **mp, int *mt, int *fg) return (0); } +DEF(fuse_parse_cmdline); struct fuse_context * fuse_get_context(void) { return (ictx); } +DEF(fuse_get_context); int fuse_version(void) @@ -571,6 +581,7 @@ err: free(dir); return (NULL); } +DEF(fuse_setup); int fuse_main(int argc, char **argv, const struct fuse_operations *ops, void *data) diff --git a/lib/libfuse/fuse_opt.c b/lib/libfuse/fuse_opt.c index 26f86a5cf44..c422d85b079 100644 --- a/lib/libfuse/fuse_opt.c +++ b/lib/libfuse/fuse_opt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_opt.c,v 1.24 2017/12/14 13:23:30 jca Exp $ */ +/* $OpenBSD: fuse_opt.c,v 1.25 2017/12/15 16:40:33 jca Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * Copyright (c) 2013 Stefan Sperling @@ -183,6 +183,7 @@ fuse_opt_add_arg(struct fuse_args *args, const char *name) { return (fuse_opt_insert_arg(args, args->argc, name)); } +DEF(fuse_opt_add_arg); static int parse_opt(const struct fuse_opt *o, const char *opt, void *data, @@ -358,6 +359,7 @@ err: return (ret); } +DEF(fuse_opt_parse); int fuse_opt_insert_arg(struct fuse_args *args, int p, const char *name) @@ -395,6 +397,7 @@ fuse_opt_insert_arg(struct fuse_args *args, int p, const char *name) } return (0); } +DEF(fuse_opt_insert_arg); void fuse_opt_free_args(struct fuse_args *args) @@ -407,6 +410,7 @@ fuse_opt_free_args(struct fuse_args *args) args->argc = 0; args->allocated = 0; } +DEF(fuse_opt_free_args); int fuse_opt_match(const struct fuse_opt *opts, const char *opt) @@ -424,3 +428,4 @@ fuse_opt_match(const struct fuse_opt *opts, const char *opt) return (0); } +DEF(fuse_opt_match); diff --git a/lib/libfuse/fuse_private.h b/lib/libfuse/fuse_private.h index 7c538bfc8ba..4fac3754f6d 100644 --- a/lib/libfuse/fuse_private.h +++ b/lib/libfuse/fuse_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_private.h,v 1.15 2017/11/26 15:17:17 helg Exp $ */ +/* $OpenBSD: fuse_private.h,v 1.16 2017/12/15 16:40:33 jca Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon * @@ -127,4 +127,24 @@ void *dict_pop(struct dict *, const char *); #define FUSE_VERSION_PKG_INFO "2.8.0" #define unused __attribute__ ((unused)) +#define PROTO(x) __dso_hidden typeof(x) x asm("__"#x) +#define DEF(x) __strong_alias(x, __##x) + +PROTO(fuse_daemonize); +PROTO(fuse_destroy); +PROTO(fuse_get_context); +PROTO(fuse_get_session); +PROTO(fuse_loop); +PROTO(fuse_mount); +PROTO(fuse_new); +PROTO(fuse_opt_add_arg); +PROTO(fuse_opt_free_args); +PROTO(fuse_opt_insert_arg); +PROTO(fuse_opt_match); +PROTO(fuse_opt_parse); +PROTO(fuse_parse_cmdline); +PROTO(fuse_remove_signal_handlers); +PROTO(fuse_setup); +PROTO(fuse_unmount); + #endif /* _FUSE_SUBR_ */ diff --git a/lib/libfuse/shlib_version b/lib/libfuse/shlib_version index 893819d18ff..b52599a164f 100644 --- a/lib/libfuse/shlib_version +++ b/lib/libfuse/shlib_version @@ -1,2 +1,2 @@ -major=1 -minor=1 +major=2 +minor=0