diff options
author | peter <peter@FreeBSD.org> | 2013-07-01 08:06:26 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2013-07-01 08:06:26 +0000 |
commit | c77016ccdaf40ab136d3fd9db47a6aad98135ae6 (patch) | |
tree | 6ccd193339a06c80e18d73d20490bedc798e225c /lib/libc/iconv | |
parent | 75dee8bb5ae9162b5536e80ab4be44936ed4b65a (diff) | |
download | FreeBSD-src-c77016ccdaf40ab136d3fd9db47a6aad98135ae6.zip FreeBSD-src-c77016ccdaf40ab136d3fd9db47a6aad98135ae6.tar.gz |
__weak_alias() doesn't exist on FreeBSD. Use __weak_reference();
Expose iconv functions as weak symbols as well as their internal
remapped #define names. This is necessary for autoconf compatability -
on Linux it appears that #include <iconv.h> isn't a link time
prerequisite for their version that's built into glibc.
Initialize the pthread rwlock. Note that upstream has three
separate locks. The file-local static lock appears intentional.
I'm using this as a ports-compatible compile-time substitute for
converters/libiconv on one of my personal machines.
Diffstat (limited to 'lib/libc/iconv')
-rw-r--r-- | lib/libc/iconv/Symbol.map | 10 | ||||
-rw-r--r-- | lib/libc/iconv/citrus_lock.h | 3 | ||||
-rw-r--r-- | lib/libc/iconv/iconv.c | 17 |
3 files changed, 19 insertions, 11 deletions
diff --git a/lib/libc/iconv/Symbol.map b/lib/libc/iconv/Symbol.map index 73e0e22..82be46f 100644 --- a/lib/libc/iconv/Symbol.map +++ b/lib/libc/iconv/Symbol.map @@ -17,6 +17,16 @@ FBSD_1.2 { libiconvlist; }; +FBSD_1.3 { + iconv; + iconv_open; + iconv_close; + iconv_open_into; + iconv_set_relocation_prefix; + iconvctl; + iconvlist; +}; + FBSDprivate_1.0 { _citrus_bcs_convert_to_lower; _citrus_bcs_convert_to_upper; diff --git a/lib/libc/iconv/citrus_lock.h b/lib/libc/iconv/citrus_lock.h index ad9443a..d275d55 100644 --- a/lib/libc/iconv/citrus_lock.h +++ b/lib/libc/iconv/citrus_lock.h @@ -27,7 +27,8 @@ #include <pthread.h> -static pthread_rwlock_t lock; +/* XXX Yes, the original code has three separate file-local lock instances */ +static pthread_rwlock_t lock = PTHREAD_RWLOCK_INITIALIZER; #define WLOCK if (__isthreaded) \ pthread_rwlock_wrlock(&lock); diff --git a/lib/libc/iconv/iconv.c b/lib/libc/iconv/iconv.c index 99cfc37..c78a615 100644 --- a/lib/libc/iconv/iconv.c +++ b/lib/libc/iconv/iconv.c @@ -47,16 +47,13 @@ #include "citrus_hash.h" #include "citrus_iconv.h" -#ifdef __weak_alias -__weak_alias(libiconv, _iconv) -__weak_alias(libiconv_open, _iconv_open) -__weak_alias(libiconv_open_into, _iconv_open_into) -__weak_alias(libiconv_close, _iconv_close) -__weak_alias(libiconvlist, _iconvlist) -__weak_alias(libiconvctl, _iconvctl) -__weak_alias(libiconv_set_relocation_prefix, _iconv_set_relocation_prefix) -__weak_alias(iconv_canonicalize, _iconv_canonicalize) -#endif +__weak_reference(libiconv, iconv); +__weak_reference(libiconv_open, iconv_open); +__weak_reference(libiconv_open_into, iconv_open_into); +__weak_reference(libiconv_close, iconv_close); +__weak_reference(libiconvlist, iconvlist); +__weak_reference(libiconvctl, iconvctl); +__weak_reference(libiconv_set_relocation_prefix, iconv_set_relocation_prefix); #define ISBADF(_h_) (!(_h_) || (_h_) == (iconv_t)-1) |