From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29761 invoked by alias); 6 Sep 2011 17:56:05 -0000 Received: (qmail 29744 invoked by uid 22791); 6 Sep 2011 17:56:04 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail3.caviumnetworks.com (HELO mail3.caviumnetworks.com) (12.108.191.235) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 06 Sep 2011 17:55:42 +0000 Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by mail3.caviumnetworks.com with MailMarshal (v6,7,2,8378) id ; Tue, 06 Sep 2011 10:56:53 -0700 Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 6 Sep 2011 10:55:41 -0700 Received: from dd1.caveonetworks.com ([64.2.3.195]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 6 Sep 2011 10:55:41 -0700 Message-ID: <4E665E9A.3010007@cavium.com> Date: Tue, 06 Sep 2011 17:56:00 -0000 From: David Daney User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10 MIME-Version: 1.0 To: Romain Geissler CC: gcc@gcc.gnu.org Subject: Re: [PLUGIN] dlopen and RTLD_NOW References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00034.txt.bz2 On 09/05/2011 12:50 AM, Romain Geissler wrote: > Hi > > Is there any particular reason to load plugin with the RTLD_NOW option? > This option force .so symbol resolution to be completely made at load time, > but this could be done only when a symbol is needed (RTLD_NOW). > > Here is the dlopen line in plugin.c: > dl_handle = dlopen (plugin->full_name, RTLD_NOW | RTLD_GLOBAL); > > My issue is, I want to load the same plugin.so in both cc1 and cc1plus, but > in the C++ case, I may need to reference some cc1plus specific symbols. I can > check whether cc1 or cc1plus loaded the plugin and thus use custom C++ > symbols only when present. With RTLD_NOW, the plugin fails to load in cc1 as > symbol resolution is forced at load time. > Can you supply weak binding implementations for the missing functions? That might allow the linking to succeed. David Daney