+cc Helg

On Thu, Dec 14 2017, Mark Kettenis <[email protected]> wrote:
>> From: Jeremie Courreges-Anglas <[email protected]>
>> Date: Thu, 14 Dec 2017 10:40:50 +0100
>> 
>> When reviewing helg@'s last diff I noticed a bunch of stuff that
>> shouldn't be exported.  So here's a diff similar to the recent
>> diffs for libutil and libkvm.  To get the list of public symbols I used
>> symbol visibility.
>> 
>> The diff below only reduces the symbols list, it does not remove PLT
>> entries for internal calls, as I don't feel confident using this
>> machinery.  AFAIK this can be done in a subsequent step with no bump.

[...]

> Looks good to me, but I can't judge if you're removing too much, so
> maybe you should wait for an ok from helg@ as well.

I have completed a partial ports bulk build with all libfuse consumers,
no visible fallout, with the updated diff below.  I used DEF and PROTO
from guenther's libkvm diff for intra-library calls.

New check_sym output:
/usr/lib/libfuse.so.1.1 --> obj/libfuse.so.2.0
Dynamic export changes:
removed:
        __bss_start
        __data_start
        _edata
        _end
        _fini
        _init
        alloc_vn
        build_realname
        dict_SPLAY
        dict_SPLAY_INSERT
        dict_SPLAY_MINMAX
        dict_SPLAY_REMOVE
        dict_check
        dict_get
        dict_pop
        dict_set
        get_vn_by_name_and_parent
        ifuse_debug
        ifuse_debug_init
        ifuse_exec_opcode
        ref_vn
        remove_vnode_from_name_tree
        set_vn
        tree_SPLAY
        tree_SPLAY_INSERT
        tree_SPLAY_MINMAX
        tree_SPLAY_REMOVE
        tree_check
        tree_get
        tree_pop
        tree_set
        unref_vn

PLT removed:
        alloc_vn
        build_realname
        dict_SPLAY
        dict_check
        dict_get
        dict_pop
        dict_set
        fuse_get_context
        fuse_loop
        fuse_mount
        fuse_opt_insert_arg
        fuse_opt_match
        fuse_opt_parse
        fuse_remove_signal_handlers
        fuse_setup
        fuse_unmount
        get_vn_by_name_and_parent
        ifuse_debug_init
        ifuse_exec_opcode
        ref_vn
        set_vn
        tree_SPLAY
        tree_get
        tree_pop
        tree_set
        unref_vn

ok?


Index: Makefile
===================================================================
--- Makefile.orig
+++ Makefile
@@ -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}
 
Index: Symbols.map
===================================================================
--- /dev/null
+++ 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:
+               *;
+};
Index: fuse.c
===================================================================
--- fuse.c.orig
+++ fuse.c
@@ -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 fus
        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 st
 
        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)
@@ -363,6 +369,7 @@ fuse_destroy(struct fuse *f)
        free(f->fc);
        free(f);
 }
+DEF(fuse_destroy);
 
 void
 fuse_remove_signal_handlers(unused struct fuse_session *se)
@@ -372,6 +379,7 @@ fuse_remove_signal_handlers(unused struc
        signal(SIGTERM, SIG_DFL);
        signal(SIGPIPE, SIG_DFL);
 }
+DEF(fuse_remove_signal_handlers);
 
 int
 fuse_set_signal_handlers(unused struct fuse_session *se)
@@ -495,12 +503,14 @@ fuse_parse_cmdline(struct fuse_args *arg
 
        return (0);
 }
+DEF(fuse_parse_cmdline);
 
 struct fuse_context *
 fuse_get_context(void)
 {
        return (ictx);
 }
+DEF(fuse_get_context);
 
 int
 fuse_version(void)
@@ -556,6 +566,7 @@ err:
        free(dir);
        return (NULL);
 }
+DEF(fuse_setup);
 
 int
 fuse_main(int argc, char **argv, const struct fuse_operations *ops, void *data)
Index: fuse_opt.c
===================================================================
--- fuse_opt.c.orig
+++ fuse_opt.c
@@ -182,6 +182,7 @@ fuse_opt_add_arg(struct fuse_args *args,
 {
        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,
@@ -357,6 +358,7 @@ err:
 
        return (ret);
 }
+DEF(fuse_opt_parse);
 
 int
 fuse_opt_insert_arg(struct fuse_args *args, int p, const char *name)
@@ -394,6 +396,7 @@ fuse_opt_insert_arg(struct fuse_args *ar
        }
        return (0);
 }
+DEF(fuse_opt_insert_arg);
 
 void
 fuse_opt_free_args(struct fuse_args *args)
@@ -406,6 +409,7 @@ fuse_opt_free_args(struct fuse_args *arg
        args->argc = 0;
        args->allocated = 0;
 }
+DEF(fuse_opt_free_args);
 
 int
 fuse_opt_match(const struct fuse_opt *opts, const char *opt)
@@ -423,3 +427,4 @@ fuse_opt_match(const struct fuse_opt *op
 
        return (0);
 }
+DEF(fuse_opt_match);
Index: fuse_private.h
===================================================================
--- fuse_private.h.orig
+++ fuse_private.h
@@ -127,4 +127,24 @@ void                       *dict_pop(struct dict *, const 
ch
 #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_ */
Index: shlib_version
===================================================================
--- shlib_version.orig
+++ shlib_version
@@ -1,2 +1,2 @@
-major=1
-minor=1
+major=2
+minor=0

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to