help with dl module and clang
Konstantin Belousov
kostikbel at gmail.com
Sat Nov 3 16:35:28 UTC 2018
On Sat, Nov 03, 2018 at 06:11:19PM +0200, Daniel Braniss wrote:
>
>
> > On 3 Nov 2018, at 17:58, Daniel Braniss <danny at cs.huji.ac.il> wrote:
> >
> >
> >
> >> On 3 Nov 2018, at 17:47, Dimitry Andric <dim at FreeBSD.org> wrote:
> >>
> >> On 3 Nov 2018, at 15:51, Daniel Braniss <danny at cs.huji.ac.il> 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 at freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
>
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
More information about the freebsd-hackers
mailing list