From owner-freebsd-hackers@freebsd.org Sat Nov 3 16:11:25 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 C107B10DC3E3 for ; Sat, 3 Nov 2018 16:11:25 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59DDC8860D; Sat, 3 Nov 2018 16:11:25 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from imac.bk.cs.huji.ac.il ([132.65.179.42]) by kabab.cs.huji.ac.il with esmtp id 1gIyW8-00025j-35; Sat, 03 Nov 2018 18:11:20 +0200 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: help with dl module and clang From: Daniel Braniss In-Reply-To: <2E58B6A3-B3E4-4266-9B40-5F3D64433460@cs.huji.ac.il> Date: Sat, 3 Nov 2018 18:11:19 +0200 Cc: freebsd-hackers@FreeBSD.org Content-Transfer-Encoding: quoted-printable Message-Id: <08A14290-0A6E-4002-892E-D4254EB23076@cs.huji.ac.il> References: <4B8101F4-9A89-4486-8DF3-93DC799EF6D4@cs.huji.ac.il> <2E58B6A3-B3E4-4266-9B40-5F3D64433460@cs.huji.ac.il> To: Dimitry Andric X-Mailer: Apple Mail (2.3445.100.39) 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:11:25 -0000 > On 3 Nov 2018, at 17:58, Daniel Braniss wrote: >=20 >=20 >=20 >> On 3 Nov 2018, at 17:47, Dimitry Andric wrote: >>=20 >> On 3 Nov 2018, at 15:51, Daniel Braniss wrote: >>>=20 >>> 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. >>>=20 >>> 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 =E2=80=A6 >>> BTW, when linking the main program with cc I get >>> /usr/bin/ld: warning: cannot find entry symbol xport-dynamic; = defaulting to 0000000000402140 >>=20 >> 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. >>=20 >=20 > 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 :-))!!!!! >=20 > thanks!!!!!! >=20 > and now have to try profiling (gprof) which started this mess, >=20 > thanks again!! >=20 > danny >=20 >=20 >> I think this will also help with the exporting of the symbols of your >> main program. >>=20 >> -Dimitry >>=20 >=20 ok, new problem, it also happens with gcc: when compiling the main program with flag -pg (gprof) dlopen fails with dlerror: Service unavailable 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"