From owner-svn-src-head@FreeBSD.ORG Mon Jul 1 08:06:27 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A1418459; Mon, 1 Jul 2013 08:06:27 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7C1C81454; Mon, 1 Jul 2013 08:06:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r6186QKC027322; Mon, 1 Jul 2013 08:06:26 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r6186QmN027318; Mon, 1 Jul 2013 08:06:26 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <201307010806.r6186QmN027318@svn.freebsd.org> From: Peter Wemm Date: Mon, 1 Jul 2013 08:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252458 - head/lib/libc/iconv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Jul 2013 08:06:27 -0000 Author: peter Date: Mon Jul 1 08:06:26 2013 New Revision: 252458 URL: http://svnweb.freebsd.org/changeset/base/252458 Log: __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 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. Modified: head/lib/libc/iconv/Symbol.map head/lib/libc/iconv/citrus_lock.h head/lib/libc/iconv/iconv.c Modified: head/lib/libc/iconv/Symbol.map ============================================================================== --- head/lib/libc/iconv/Symbol.map Mon Jul 1 07:07:35 2013 (r252457) +++ head/lib/libc/iconv/Symbol.map Mon Jul 1 08:06:26 2013 (r252458) @@ -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; Modified: head/lib/libc/iconv/citrus_lock.h ============================================================================== --- head/lib/libc/iconv/citrus_lock.h Mon Jul 1 07:07:35 2013 (r252457) +++ head/lib/libc/iconv/citrus_lock.h Mon Jul 1 08:06:26 2013 (r252458) @@ -27,7 +27,8 @@ #include -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); Modified: head/lib/libc/iconv/iconv.c ============================================================================== --- head/lib/libc/iconv/iconv.c Mon Jul 1 07:07:35 2013 (r252457) +++ head/lib/libc/iconv/iconv.c Mon Jul 1 08:06:26 2013 (r252458) @@ -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)