From: guenther Date: Thu, 14 Dec 2017 17:06:33 +0000 (+0000) Subject: Add Symbols.map to explicitly define the ABIs, hiding linker defined symbols. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=cfd60b50b925dbd1f966fb2bd4ff813c47c0f606;p=openbsd Add Symbols.map to explicitly define the ABIs, hiding linker defined symbols. Use hidden aliases for internal invocations of exported symbols to avoid PLT. ok deraadt@ kettenis@ jca@ --- diff --git a/lib/libkvm/Makefile b/lib/libkvm/Makefile index 7284c60507d..60098367593 100644 --- a/lib/libkvm/Makefile +++ b/lib/libkvm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.18 2016/03/30 06:38:42 jmc Exp $ +# $OpenBSD: Makefile,v 1.19 2017/12/14 17:06:33 guenther Exp $ # $NetBSD: Makefile,v 1.11 1996/03/18 22:33:07 thorpej Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/4/93 @@ -18,6 +18,8 @@ SRCS= kvm_${MACHINE_CPU}.c .endif .endif +VERSION_SCRIPT= ${.CURDIR}/Symbols.map + CFLAGS+= -D_LIBKVM SRCS+= kvm.c kvm_file2.c kvm_getloadavg.c kvm_proc.c kvm_proc2.c \ kvm_cd9660.c kvm_udf.c kvm_ntfs.c diff --git a/lib/libkvm/Symbols.map b/lib/libkvm/Symbols.map new file mode 100644 index 00000000000..76cf4f2fb1c --- /dev/null +++ b/lib/libkvm/Symbols.map @@ -0,0 +1,21 @@ +{ + global: + kvm_close; + kvm_dump_inval; + kvm_dump_mkheader; + kvm_dump_wrtheader; + kvm_getargv; + kvm_getenvv; + kvm_geterr; + kvm_getfiles; + kvm_getloadavg; + kvm_getprocs; + kvm_nlist; + kvm_open; + kvm_openfiles; + kvm_read; + kvm_write; + + local: + *; +}; diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 5247cffb9f4..dce4359fc78 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm.c,v 1.62 2016/07/10 23:06:48 tedu Exp $ */ +/* $OpenBSD: kvm.c,v 1.63 2017/12/14 17:06:33 guenther Exp $ */ /* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */ /*- @@ -664,6 +664,7 @@ kvm_close(kvm_t *kd) return (error); } +DEF(kvm_close); /* * Set up state necessary to do queries on the kernel namelist @@ -802,6 +803,7 @@ kvm_nlist(kvm_t *kd, struct nlist *nl) */ return ((p - nl) - nvalid); } +DEF(kvm_nlist); int kvm_dump_inval(kvm_t *kd) @@ -894,6 +896,7 @@ kvm_read(kvm_t *kd, u_long kva, void *buf, size_t len) } /* NOTREACHED */ } +DEF(kvm_read); ssize_t kvm_write(kvm_t *kd, u_long kva, const void *buf, size_t len) diff --git a/lib/libkvm/kvm_private.h b/lib/libkvm/kvm_private.h index b42634ba969..3fe186e7365 100644 --- a/lib/libkvm/kvm_private.h +++ b/lib/libkvm/kvm_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_private.h,v 1.24 2015/09/04 02:55:09 dlg Exp $ */ +/* $OpenBSD: kvm_private.h,v 1.25 2017/12/14 17:06:33 guenther Exp $ */ /* $NetBSD: kvm_private.h,v 1.7 1996/05/05 04:32:15 gwr Exp $ */ /*- @@ -106,3 +106,11 @@ void _kvm_syserr(kvm_t *kd, const char *program, const char *fmt, ...) ssize_t _kvm_pread(kvm_t *, int, void *, size_t, off_t); ssize_t _kvm_pwrite(kvm_t *, int, const void *, size_t, off_t); __END_HIDDEN_DECLS + + +#define PROTO(x) __dso_hidden typeof(x) x asm("__"#x) +#define DEF(x) __strong_alias(x, __##x) + +PROTO(kvm_close); +PROTO(kvm_nlist); +PROTO(kvm_read); diff --git a/lib/libkvm/shlib_version b/lib/libkvm/shlib_version index cd2907e093d..ffdd3d2d569 100644 --- a/lib/libkvm/shlib_version +++ b/lib/libkvm/shlib_version @@ -1,2 +1,2 @@ -major=16 -minor=2 +major=17 +minor=0