Unix Programming - What situation is the gcc's -Wl,option used for?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2006 > What situation is the gcc's -Wl,option used for?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author What situation is the gcc's -Wl,option used for?
Terry.Chaur

2006-03-03, 6:43 pm

Dear group members:

Could please tell me:
Do you know the differences between the two options when linking shared
library using g++?

1. LDFLAG=-Wl,-library-path=some_path -Wl,-library=some_lib
2. LDFLAG=-Lsome_path -lsome_lib

Actually I want to know Who will be aware of -library-path and -library
passed into by -Wl options, and where will they be deposed of in the
linking system.

Thanks.

Paul Pluzhnikov

2006-03-03, 6:43 pm

"Terry.Chaur" <Terry.Chaur@gmail.com> writes:

> Do you know the differences between the two options when linking shared
> library using g++?
>
> 1. LDFLAG=-Wl,-library-path=some_path -Wl,-library=some_lib
> 2. LDFLAG=-Lsome_path -lsome_lib


There is no difference (assuming GNU ld).
(1) is non-portable, while (2) is portable and preferred.

> Actually I want to know Who will be aware of -library-path and -library
> passed into by -Wl options,


The linker.

> and where will they be deposed of in the linking system.


There is no 'linking system'. g++ passes all unrecognized flags to
'ld', which performs the link (well, there is also collect2, which
(I believe) on ELF platforms doesn't actually do anything).

Finally, your subject line appears to ask "when is -Wl, useful?"
One example is -Wl,-Bsymbolic. You can't do "g++ -Bsymbolic"
because to g++ -B... means something completely different.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Terry.Chaur

2006-03-03, 6:43 pm

Paul -

Thank you very much. You clarify my mind.

Roger Leigh

2006-03-03, 6:43 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul Pluzhnikov <ppluzhnikov-nsp@charter.net> writes:

> There is no 'linking system'. g++ passes all unrecognized flags to
> 'ld', which performs the link (well, there is also collect2, which
> (I believe) on ELF platforms doesn't actually do anything).


I saw it do something when I tried out "-frepo" a few months ago; it
instantiated all the templates needed from the repository.


- --
Roger Leigh
Printing on GNU/Linux? http://gutenprint.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8+ <http://mailcrypt.sourceforge.net/>

iD8DBQFECBDWVcFcaSW/uEgRAsFRAJ9100nsbh0C6QZ9+A/u9HOFgm2RwwCgioR4
pyOLSScpJa+URWBQD39tGAs=
=RR4q
-----END PGP SIGNATURE-----
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com