This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Q: linker "-static" flag usage


On Thu, May 11, 2000 at 03:45:21PM -0400, Denis Vakatov wrote:
> Hi,
> 
> Sorry, but I cannot get sufficient info about the use of "-static"
> flag with GCC. After searching numerous discussions, and looking into
> your manual(http://gcc.gnu.org/onlinedocs/gcc_2.html#SEC13), and
> "man gcc", and "gcc -v --help", the only thing I got is:
> 
> | -static 
> |     On systems that support dynamic linking, this prevents linking
> |     with the shared libraries. On other systems, this option has no effect. 
> 
> I need to know an answer to 2 more questions:
> 
> 1) Will the "-static" flag affect the linking of ALL libs following
>    him in the linker command-line?

No, "-static" applies to ALL libs in the linker command-line.

> 
> 2) If (1) == TRUE, then -- is there a way to restore the default
>    static/dynamic linking policy after you used "-static" flag in
>    your command line (something like the "-Bdynamic" flag for
>    Sun native compiler)?

I have been using

# gcc ... -Wl,-Bstatic -lfoo -Wl,-Bdynamic ...

Only libs between -Wl,-Bstatic and -Wl,-Bdynamic will be linked
statically. BTW, I am using GNU ld.


H.J.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]