This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: how could make gcc link static library default?
- From: Andrew Haley <aph at redhat dot com>
- To: net_robber <net_robber at timectrl dot net>
- Cc: "Anandkumar, CB IN BLR STS" <anand dot cb at siemens dot com>, "flameroc at gmail dot com" <flameroc at gmail dot com>, "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Thu, 17 Oct 2013 10:04:14 +0100
- Subject: Re: how could make gcc link static library default?
- Authentication-results: sourceware.org; auth=none
- References: <CACdxSLm=7+1vPyQBHE7+xutvdxbz-SaHz37VsCtsc9=VmFvS-w at mail dot gmail dot com> <80070575041F1A43B43673DA71C5B0BCBBE2B2EBBC at INBLRK77M1MSX dot in002 dot siemens dot net> <CAGbRaL6GirQ-nQT59=HTHUc5fipqwtXq+XYxVq5n2ayZ9oo7Jg at mail dot gmail dot com> <80070575041F1A43B43673DA71C5B0BCBBE2B2EC65 at INBLRK77M1MSX dot in002 dot siemens dot net> <CAGbRaL68a=E2Byk3ONJpsMZamUaCNYb9mGkPJQQB4fkFsN_P=g at mail dot gmail dot com> <CACdxSL=sJYfWCwtnLvOgU1P4975uUL1rX8Q8ss7VaggoHS04Aw at mail dot gmail dot com> <80070575041F1A43B43673DA71C5B0BCBBE2B2EE2C at INBLRK77M1MSX dot in002 dot siemens dot net> <CACdxSLmVe63s1fB=1eYMzuqWr9SjYGxaGf5s_DDVmDKm-uWhCQ at mail dot gmail dot com>
On 10/17/2013 07:57 AM, net_robber wrote:
> how to make it the first priority give to static, and then, in case
> static does not exist it uses dynamic.
Have a look at /usr/lib/libc.so on a GNU/Linux system of your choice.
Here it is on mine:
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) )
Andrew.