stupid ld tricks

Michael Sterrett -Mr. Bones.- msterret@coat.com
Wed Jun 21 15:53:00 GMT 2000


I'm trying to use the -Bstatic -Bdynamic flags to ld to link certain
libraries statically to my application and others dynamically.

I had hoped something like this would work:

    cc -o app.o -c app.c
    ld -o app app.o -Bstatic -la -Bdynamic -lb -lc

Unfortunately, I get this error:

    ld: warning: cannot find entry symbol _start; defaulting to 08048184

and although the application is produced, trying to run it results in
this error message:

    bash: ./app: No such file or directory

Even though it *is* there:

    -rwxrwxr-x    1 msterret prog         7582 Jun 21 18:06 app*

This is all happening on a pretty stock RedHat 6.2 system with binutils
2.9.5.0.22 (RedHat release 6 if that matters).  cc is egcs-1.1.2 (RedHat
release 30).

If I use cc instead of ld to link, I get a good executable file,
but then I lose the abiltiy to individually indicate which libraries
are statically linked and which ones are dynamically linked I think.
When using -Bstatic/-Bdynamic with cc, cc seems to just ignore the flags.

Can someone please tell me what I'm doing wrong?  I'm getting a little
desperate and certainly frustrated.  This is not working at all the way
I think it should.

Michael Sterrett
  -Mr. Bones.-
michael.sterrett@coat.com



More information about the Binutils mailing list