From owner-freebsd-hackers@freebsd.org Sat Nov 3 16:35:28 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0FE210DD1F3 for ; Sat, 3 Nov 2018 16:35:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4BA5C893A0; Sat, 3 Nov 2018 16:35:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wA3GZ8mY068859 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 3 Nov 2018 18:35:12 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wA3GZ8mY068859 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wA3GZ8Ht068858; Sat, 3 Nov 2018 18:35:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 3 Nov 2018 18:35:08 +0200 From: Konstantin Belousov To: Daniel Braniss Cc: Dimitry Andric , freebsd-hackers@FreeBSD.org Subject: Re: help with dl module and clang Message-ID: <20181103163508.GS5335@kib.kiev.ua> References: <4B8101F4-9A89-4486-8DF3-93DC799EF6D4@cs.huji.ac.il> <2E58B6A3-B3E4-4266-9B40-5F3D64433460@cs.huji.ac.il> <08A14290-0A6E-4002-892E-D4254EB23076@cs.huji.ac.il> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <08A14290-0A6E-4002-892E-D4254EB23076@cs.huji.ac.il> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Nov 2018 16:35:28 -0000 On Sat, Nov 03, 2018 at 06:11:19PM +0200, Daniel Braniss wrote: > > > > On 3 Nov 2018, at 17:58, Daniel Braniss wrote: > > > > > > > >> On 3 Nov 2018, at 17:47, Dimitry Andric wrote: > >> > >> On 3 Nov 2018, at 15:51, Daniel Braniss wrote: > >>> > >>> I have a program that loads some modules via dlopen(), these modules call some routines > >>> which are in the main program, this works when using gcc, but with cc it does not. > >>> > >>> when compiling the main program I use -export-dynamic, and the modules link fine when compiled with > >>> gcc, but when compiling with clang/cc i get dlerror: ...Undefined symbol … > >>> BTW, when linking the main program with cc I get > >>> /usr/bin/ld: warning: cannot find entry symbol xport-dynamic; defaulting to 0000000000402140 > >> > >> Instead of using -export-dynamic (which is a linker flag) as a flag to > >> cc, try using -Wl,-export-dynamic instead. Now, the linker interprets > >> this as the -e flag, which is something totally different. > >> > > > > i had tried that before but i had -WI (upper case i) but re-reading the manual > > it should be-Wl (lower case l as in lima :-))!!!!! > > > > thanks!!!!!! > > > > and now have to try profiling (gprof) which started this mess, > > > > thanks again!! > > > > danny > > > > > >> I think this will also help with the exporting of the symbols of your > >> main program. > >> > >> -Dimitry > >> > > > ok, new problem, it also happens with gcc: > > when compiling the main program with flag -pg (gprof) > dlopen fails with dlerror: Service unavailable This means that your binary is linked statically. dlopen(3) is not supported for static linking, ld-elf.so.1 is required for dynamic loading to work. > > what magic is needed now? > > danny > > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"