Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Nov 2018 16:47:37 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Daniel Braniss <danny@cs.huji.ac.il>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: help with dl module and clang
Message-ID:  <E3B4CDF3-2DE9-4785-963C-9158105C263E@FreeBSD.org>
In-Reply-To: <4B8101F4-9A89-4486-8DF3-93DC799EF6D4@cs.huji.ac.il>
References:  <4B8101F4-9A89-4486-8DF3-93DC799EF6D4@cs.huji.ac.il>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_AB3D4540-AD0E-41C2-927C-E4E172DB92E3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

On 3 Nov 2018, at 15:51, Daniel Braniss <danny@cs.huji.ac.il> 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

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 think this will also help with the exporting of the symbols of your
main program.

-Dimitry


--Apple-Mail=_AB3D4540-AD0E-41C2-927C-E4E172DB92E3
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCW93DGQAKCRCwXqMKLiCW
o9O0AJ9tC96/mSUaHKoTaHuqd4Ar0Ss+NgCg6zU4kLcbNNKUgIbJm8zNw3dqlZQ=
=nIL3
-----END PGP SIGNATURE-----

--Apple-Mail=_AB3D4540-AD0E-41C2-927C-E4E172DB92E3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E3B4CDF3-2DE9-4785-963C-9158105C263E>