Couldn't convince clang not to inline duplicateFun() into bbTest2(). Splitting things out in a seperate file avoids the issue. Fixes the regression test.
ok? Index: regress/libexec/ld.so/dlclose/test1/libbb/Makefile =================================================================== RCS file: /cvs/src/regress/libexec/ld.so/dlclose/test1/libbb/Makefile,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 Makefile --- regress/libexec/ld.so/dlclose/test1/libbb/Makefile 28 Sep 2005 15:42:32 -0000 1.1.1.1 +++ regress/libexec/ld.so/dlclose/test1/libbb/Makefile 2 Aug 2017 18:59:14 -0000 @@ -1,7 +1,7 @@ # $OpenBSD: Makefile,v 1.1.1.1 2005/09/28 15:42:32 kurt Exp $ LIB= bb -SRCS= bb.c +SRCS= bb.c bbb.c regress: all Index: regress/libexec/ld.so/dlclose/test1/libbb/bb.c =================================================================== RCS file: /cvs/src/regress/libexec/ld.so/dlclose/test1/libbb/bb.c,v retrieving revision 1.2 diff -u -p -r1.2 bb.c --- regress/libexec/ld.so/dlclose/test1/libbb/bb.c 30 Sep 2005 14:57:35 -0000 1.2 +++ regress/libexec/ld.so/dlclose/test1/libbb/bb.c 2 Aug 2017 18:59:14 -0000 @@ -20,19 +20,10 @@ #include <dlfcn.h> #include <stdio.h> -int bbSymbol; - -void -bbLazyFun() -{ +extern void bbLazyFun(); +extern int duplicateFun(); -} - -int -duplicateFun() -{ - return (1); -} +int bbSymbol; int bbTest1() Index: regress/libexec/ld.so/dlclose/test1/libbb/bbb.c =================================================================== RCS file: regress/libexec/ld.so/dlclose/test1/libbb/bbb.c diff -N regress/libexec/ld.so/dlclose/test1/libbb/bbb.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ regress/libexec/ld.so/dlclose/test1/libbb/bbb.c 2 Aug 2017 18:59:14 -0000 @@ -0,0 +1,30 @@ +/* $OpenBSD$ */ + +/* + * Copyright (c) 2005 Kurt Miller <k...@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +void +bbLazyFun() +{ + +} + +int +duplicateFun() +{ + return (1); +}