Article View: gnu.gcc.help
Article #51020Re: Getting gcc 2.4+ to build dynamic linked progs on SunOS 4.x
From: Per Cederqvist
Date: Tue, 13 Jul 1993 14:10
Date: Tue, 13 Jul 1993 14:10
39 lines
2370 bytes
2370 bytes
etxmesa@eos.ericsson.se (Michael Salmon) writes:
>In article <21ka9a$rip@tramp.cc.utexas.edu>
>mccoy@ccwf.cc.utexas.edu (Jim McCoy) writes:
>|>
>|> [ why does gcc 2.4.x link statically? ]
>
> gcc, regardless of version, doesn't build executables, it calls either
> gld or ld to do that. gld in fact cannot build a dynamically linked
> executable, only ld can do that. The current gcc configuration renames
> collect2 to ld which then invokes gld if it can find it and the
> original ld otherwise. Hence if you want dynamically linked executables
> you must remove all copies of gld that collect2 is likely to find. Also
> note that the -shared flag is to be used to create an object file that
> can later be shared, the flag that you want is -dynamic.
You do not have to remove all instances of gld. All you have to do is
add a symlink. On my system, the output from "gcc -v" looks like this:
Reading specs from /usr/gnu/lib/gcc-lib/m68k-sun-sunos4.1/2.4.5/specs
gcc version 2.4.5
Collect2 searches for the linker to use in several places and under
several names. The first it tries is gld in the directory specified in
the output from gcc -v. So, all you have to do to use the system
linker even if gld is installed is
$ ln -s /bin/ld /usr/gnu/lib/gcc-lib/m68k-sun-sunos4.1/2.4.5/gld
You might also want to
$ ln -s /usr/gnu/bin/gas /usr/gnu/lib/gcc-lib/m68k-sun-sunos4.1/2.4.5/gas
if you have the GNU assembler installed.
--
Per Cederqvist, Lysator Academic Computer Society., Univ. of Linkoping, Sweden
Email: ceder@lysator.liu.se
Phone: +46 13 26 09 17 "CVS - Check It Out!"
Technical Details
Message-ID:
<CA3wpG.9J9@lysator.liu.se>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!darwin.sura.net!haven.umd.edu!uunet!pipex!sunic!kitten.umdc.umu.se!fizban.solace.hsh.se!lysator.liu.se!cederReferences:
<21ka9a$rip@tramp.cc.utexas.edu> <1993Jul12.075340.8354@ericsson.se>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,8440fa119c54f10a X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-07-13 08:04:50 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!darwin.sura.net!haven.umd.edu!uunet!pipex!sunic!kitten.umdc.umu.se!fizban.solace.hsh.se!lysator.liu.se!ceder From: ceder@lysator.liu.se (Per Cederqvist) Subject: Re: Getting gcc 2.4+ to build dynamic linked progs on SunOS 4.x Message-ID: <CA3wpG.9J9@lysator.liu.se> Sender: news@lysator.liu.se Organization: Lysator ACS at Linkoping University References: <21ka9a$rip@tramp.cc.utexas.edu> <1993Jul12.075340.8354@ericsson.se> Date: Tue, 13 Jul 1993 14:10:24 GMT Lines: 39