From owner-freebsd-current@FreeBSD.ORG Wed Oct 8 21:36:51 2008 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F938106568C for ; Wed, 8 Oct 2008 21:36:51 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from sippysoft.com (gk1.360sip.com [72.236.70.240]) by mx1.freebsd.org (Postfix) with ESMTP id E3F408FC15 for ; Wed, 8 Oct 2008 21:36:50 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.54.128] (S01060014bf8629c0.vc.shawcable.net [24.87.44.186]) (authenticated bits=0) by sippysoft.com (8.13.8/8.13.8) with ESMTP id m98Lamul099423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Oct 2008 14:36:49 -0700 (PDT) (envelope-from sobomax@FreeBSD.org) Message-ID: <48ED27EA.9020407@FreeBSD.org> Date: Wed, 08 Oct 2008 14:36:42 -0700 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: Alexander Kabaev Content-Type: text/plain; charset=KOI8-U; format=flowed Content-Transfer-Encoding: 7bit Cc: "current@freebsd.org" Subject: dlsym(RTLD_NEXT) and weak symbols X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2008 21:36:51 -0000 Hi, I am not sure if it has even worked correctly, but calling dlsym("dlopen", RTLD_NEXT) returns reference to the dlopen() function in the libc, not reference to dlopen() function in the ld-elf.so. The attempt to call this function then fails, since dlopen() in libc is just a stub to make static linking happy. #pragma weak dlopen void * dlopen(const char *name, int mode) { _rtld_error(sorry); return NULL; } IMHO this is incorrect and is probably part of the bigger problem. The dlsym(3) should return first non-weak symbol instead. -Maxim