This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
other/490: -static / -shared not equivalent to -Wl,-Bshared / -Wl,-Bdynamic under linux with GNU ld
- To: gcc-gnats at gcc dot gnu dot org
- Subject: other/490: -static / -shared not equivalent to -Wl,-Bshared / -Wl,-Bdynamic under linux with GNU ld
- From: histed at mit dot edu
- Date: 28 Aug 2000 01:07:09 -0000
- Reply-To: histed at mit dot edu
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, histed@mit.edu
>Number: 490
>Category: other
>Synopsis: -static / -shared not equivalent to -Wl,-Bshared / -Wl,-Bdynamic under linux with GNU ld
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Aug 27 18:16:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: histed@mit.edu
>Release: 2.95.2
>Organization:
>Environment:
>Description:
You can't use -shared and -static in a positional way on the gcc command line with GNU ld under linux: if -static is present without -shared all libraries are linked statically.
However, you can get this effect by passing -B options to the linker.
I'm not sure whether this is a bug or desired functionality.
>How-To-Repeat:
gcc -g -O2 -o prog prog.o -static -lglib -shared -lm
produces an executable with all libraries dynamically linked
but
gcc -g -O2 -o prog prog.o -Wl,-Bstatic -lglib -Wl,-Bdynamic
statically links libglib and nothing else.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: