[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Creating .so files.
From: |
Rob Landley |
Subject: |
Re: [Tinycc-devel] Creating .so files. |
Date: |
Thu, 30 Aug 2007 19:05:26 -0500 |
User-agent: |
KMail/1.9.6 |
On Thursday 30 August 2007 9:28:05 am bifferos wrote:
> --- Rob Landley <address@hidden> wrote:
> > On Wednesday 29 August 2007 6:12:01 am bifferos wrote:
> > > --- Rob Landley <address@hidden> wrote:
> > > > On Wednesday 29 August 2007 3:25:04 am bifferos wrote:
> > > > > I tried to produce a .so file with:
> > > > >
> > > > > tcc -shared -r dll.c -o test_dll.so
> > > > >
> > > > > but when dlopen()ing it I got the error:
> > > > >
> > > > > ./test_dll.so: only ET_DYN and ET_EXEC can be loaded
> > > > >
> > > > > Any ideas what I'm doing wrong?
> > > >
> > > > What version are you using, and what platform are you using it on?
> > >
> > > I tried 0.9.23 on Slackware Linux 11.0. I compiled the same source
> > > code with gcc -shared and it was loaded by my test program no problem.
> > > Then I looked on the list and then discovered the Mercurial repo, so I
> > > tried the tip of that, and got the same result.
> > >
> > > I take it that from your response I am typing the right compilation
> > > command?
> >
> > Dunno, I'm not very familiar with this area. (It's been around two years
> > since I needed to use dlopen() on a shared library, it's "pull out the
> > man pages" time and I assume you've already done that...)
>
> Yup.
>
> > Did you try doing the same thing with gcc? If it works with gcc and not
> > with
>
> Yes, it works fine when .so compiled with gcc -shared -fPIC.
>
> > tcc, it's a bug and we need to fix it. (Comparing the resulting binaries
> > is a good way to figure out what the heck's wrong, too...)
>
> I now know why the .so doesn't load. It's because it wasn't an .so, but a
> .o file. you cannot combine -shared and -r options on the command line.
> The first sets the output format to DLL, the second sets it to OBJ, so you
> end up getting an OBJ file. I guess tcc could add a warning about
> combining these two options to avoid confusion. It's also a pity the -r
> option seems to be documented differently between the command-line help and
> the manual page! However, I'm still no closer to creating my .so file. I
> surmised that I would have to do it as a two-step process, unfortunately I
> still get another weird error:
>
> bash-3.1$ tcc -r dllmain.c -o dllmain.o
> bash-3.1$ tcc -shared dllmain.o -o dll.so
> tcc: file 'AS_NEEDED' not found
> /usr/lib/libc.so:3: filename expected
> /usr/lib/libc.so:3: unrecognized file type
You're using Fabrice's last release version, not my fork.
http://landley.net/hg/tinycc
The AS_NEEDED thing should have been fixed a while ago, and I just put in a
patch for the -r thing. (Dunno if it _works, but it at least compiled.)
Rob
--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
- Re: [Tinycc-devel] autoconfiscation, (continued)
- Re: [Tinycc-devel] autoconfiscation, Rob Landley, 2007/08/27
- Re: [Tinycc-devel] autoconfiscation, Peter Lund, 2007/08/28
- Re: [Tinycc-devel] autoconfiscation, Rob Landley, 2007/08/28
- Re: [Tinycc-devel] autoconfiscation, Peter Lund, 2007/08/29
- [Tinycc-devel] Creating .so files., bifferos, 2007/08/29
- Re: [Tinycc-devel] Creating .so files., Rob Landley, 2007/08/29
- Re: [Tinycc-devel] Creating .so files., bifferos, 2007/08/29
- Re: [Tinycc-devel] Creating .so files., Rob Landley, 2007/08/29
- Re: [Tinycc-devel] Creating .so files., bifferos, 2007/08/30
- Re: [Tinycc-devel] Creating .so files., bifferos, 2007/08/30
- Re: [Tinycc-devel] Creating .so files.,
Rob Landley <=
- Re: [Tinycc-devel] Creating .so files., Fabrice Bellard, 2007/08/31
- Re: [Tinycc-devel] autoconfiscation, Rob Landley, 2007/08/29
- Re: [Tinycc-devel] autoconfiscation, Sergey Lyubka, 2007/08/30
- Re: [Tinycc-devel] autoconfiscation, Rob Landley, 2007/08/30
- Re: [Tinycc-devel] autoconfiscation, Attila Kinali, 2007/08/28
- Re: [Tinycc-devel] autoconfiscation, Peter Lund, 2007/08/29
- Re: [Tinycc-devel] autoconfiscation, Jakob Eriksson, 2007/08/29
- Re: [Tinycc-devel] autoconfiscation, Peter Lund, 2007/08/29
Re: [Tinycc-devel] autoconfiscation, Shawn Rutledge, 2007/08/28