This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: different libc from non-standard path


On 15 May 2005, gumbold@bonbon.net spake:
> i want to compile with different libc from non-standard place.

Ah, that's much clearer.

> what the best way to do it throw specs file?

Well, it's hard to say, depending on exactly what you might want to
do. You might want to adjust the startfile, link, or lib specs, perhaps
from something like this (which is the default on a *-linux-gnu target):


*link:
%{!static:--eh-frame-hdr} -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static: 	%{rdynamic:-export-dynamic} 	%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} 	%{static:-static}}}

*lib:
%{pthread:-lpthread}    %{shared:-lc}    %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}


to something like this (not tested, shared library variant only):


*link:
%{!static:--eh-frame-hdr} -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static: 	%{rdynamic:-export-dynamic} 	%{weird-libc:-dynamic-linker /frobozz/ld-frobozz.so.2:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} 	%{static:-static}}}

*lib:
%{weird-libc:-L /frobozz} %{pthread:-lpthread}    %{shared:-lc}    %{!shared:%{mieee-fp:-lieee} %{profile:-lc_p}%{!profile:-lc}}


With those changes, the -weird-libc switch would look for a dynamic
linker called /frobozz/ld-frobozz.so.2, and link against libraries in
that directory in preference to /lib. That's probably good enough.


(Note that the startfile, lib and link specs go directly to the linker,
so there's no need for -Wl, stuff: that sort of thing is for things
which are fed *to* the GCC driver, while specs are instructions to the
driver telling it how to assemble command lines to pass to subsidiary
programs.)

You might want to look for the lengthy comment starting "The Specs
Language" in gcc/gcc.c: that's all the documentation there is for specs,
as far as I know.

-- 
`End users are just test loads for verifying that the system works, kind of
 like resistors in an electrical circuit.' - Kaz Kylheku in c.o.l.d.s


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