various symbol referencing fixes

make weak symbol references and namespace renames references
the renamed versions.

function renaming, weak symbol references and libc namespace.h
protection interact in hairy ways and causes weak symbol references
for renamed functions to be unresolved; e.g. vfork should be an
alias for _vfork but _vfork doesn't exist because __vfork14()
exists.

this is a problem for dynamically linked executables as all symbols
have to be resolved, used or not, at link time. it was masked by
clang-compiled base system libraries but is a problem when gcc does
it.
This commit is contained in:
Ben Gras 2012-06-28 14:56:50 +02:00
parent 8d1c219676
commit c3db1c6939
5 changed files with 17 additions and 21 deletions

View file

@ -222,8 +222,8 @@
#define confstr _confstr
#define csetexpandtc _csetexpandtc
#define ctermid _ctermid
#define ctime_r _ctime_r
#define ctime_rz _ctime_rz
#define ctime_r __ctime_r50
#define ctime_rz __ctime_rz50
#define daemon _daemon
#define dbopen _dbopen
#define devname _devname
@ -434,15 +434,15 @@
#define lcong48 _lcong48
#define llabs _llabs
#define lldiv _lldiv
#define localtime_r _localtime_r
#define localtime_rz _localtime_rz
#define localtime_r __localtime_r50
#define localtime_rz __localtime_rz50
#define lockf _lockf
#define lrand48 _lrand48
#define lseek _lseek
#define mergesort _mergesort
#define mi_vector_hash _mi_vector_hash
#define mkstemp _mkstemp
#define mktime_z _mktime_z
#define mktime_z __mktime_z50
#define mpool_close _mpool_close
#define mpool_filter _mpool_filter
#define mpool_get _mpool_get
@ -477,8 +477,8 @@
#define pmap_unset _pmap_unset
#define pollts _pollts
#define popen _popen
#define posix2time _posix2time
#define posix2time_z _posix2time_z
#define posix2time __posix2time50
#define posix2time_z __posix2time_z50
#define pread _pread
#define pselect _pselect
#define psignal _psignal
@ -924,7 +924,7 @@
#define minix_mmap _minix_mmap
#define minix_munmap _minix_munmap
#define minix_munmap_text _minix_munmap_text
#define vfork _vfork
#define vfork __vfork14
#endif /* __minix */
#endif /* __weak_alias */

View file

@ -16,10 +16,6 @@
#include <stdarg.h>
#include <errno.h>
#ifdef __weak_alias
__weak_alias(sem, _sem)
#endif
static int get_ipc_endpt(endpoint_t *pt)
{
return minix_rs_lookup("ipc", pt);

View file

@ -5,7 +5,7 @@
#include <unistd.h>
#ifdef __weak_alias
__weak_alias(vfork, _vfork)
__weak_alias(vfork, __vfork14)
#endif
pid_t vfork()

View file

@ -28,14 +28,14 @@ __RCSID("$NetBSD: localtime.c,v 1.54 2011/01/15 15:42:10 christos Exp $");
#include "reentrant.h"
#if defined(__weak_alias)
__weak_alias(ctime_r,_ctime_r)
__weak_alias(ctime_rz,_ctime_rz)
__weak_alias(ctime_r,__ctime_r50)
__weak_alias(ctime_rz,__ctime_rz50)
__weak_alias(daylight,_daylight)
__weak_alias(mktime_z,_mktime_z)
__weak_alias(localtime_r,_localtime_r)
__weak_alias(localtime_rz,_localtime_rz)
__weak_alias(posix2time,_posix2time)
__weak_alias(posix2time_z,_posix2time_z)
__weak_alias(mktime_z,__mktime_z50)
__weak_alias(localtime_r,__localtime_r50)
__weak_alias(localtime_rz,__localtime_rz50)
__weak_alias(posix2time,__posix2time50)
__weak_alias(posix2time_z,__posix2time_z50)
__weak_alias(tzname,_tzname)
#endif

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.8 2007/11/05 13:41:52 pooka Exp $
USE_FORT?= yes # data driven bugs?
USE_FORT?= no # data driven bugs?
LIB= refuse
LIBDPLIBS+= puffs ${.CURDIR}/../libpuffs