gcc - How to link the RTL statically ? - OS2
This is a discussion on gcc - How to link the RTL statically ? - OS2 ; How do you do that ? Is it possible at all ?
I tried "gcc -Bstatic -c foo.c" , "gcc -non_shared -c foo.c", "gcc -Zso -c
foo.c" but it always links to the RTL dynamically.
Or do I have to ...
-
gcc - How to link the RTL statically ?
How do you do that ? Is it possible at all ?
I tried "gcc -Bstatic -c foo.c" , "gcc -non_shared -c foo.c", "gcc -Zso -c
foo.c" but it always links to the RTL dynamically.
Or do I have to specify those options in the link step ? If yes, how ?
Lars
-
Re: gcc - How to link the RTL statically ?
On Wed, 29 Oct 2008 18:52:50 +0100, Lars Erdmann wrote:
> How do you do that ? Is it possible at all ?
>
> I tried "gcc -Bstatic -c foo.c" , "gcc -non_shared -c foo.c", "gcc -Zso -c
> foo.c" but it always links to the RTL dynamically.
> Or do I have to specify those options in the link step ? If yes, how ?
Rightly or wrongly, I use "-s -static -Zomf -lc_omf386" at the link stage.
I am not a GCC expert, but the above works for me and produces an executable
which is massive compared to any other compiler, but which has no unexpected
DLL dependencies.
-
Re: gcc - How to link the RTL statically ?
Paul Ratcliffe schrieb:
> On Wed, 29 Oct 2008 18:52:50 +0100, Lars Erdmann wrote:
>
>> How do you do that ? Is it possible at all ?
>>
>> I tried "gcc -Bstatic -c foo.c" , "gcc -non_shared -c foo.c", "gcc -Zso -c
>> foo.c" but it always links to the RTL dynamically.
>> Or do I have to specify those options in the link step ? If yes, how ?
>
> Rightly or wrongly, I use "-s -static -Zomf -lc_omf386" at the link stage.
> I am not a GCC expert, but the above works for me and produces an executable
> which is massive compared to any other compiler, but which has no unexpected
> DLL dependencies.
Hi,
very strange, my results are different (for gcc 3.3.5 at least).
Even though I only have one source file I decided to go for a separate
compile and link step:
gcc -Zomf -o lostKingdom.obj lostKingdom.c
gcc -static -Zomf -Zmt -Zmap=lostKingdom.map -Zlinker /STACK:0x10000
-Zlinker /BASE:0x10000 -Zlinker /EXEPACK:2 -lc_omf386 -o lostKingdom.exe
lostKingdom.obj
This gives a VERY SMALL executable which links the C library statically
! It only imports from doscalls.dll, libuni.dll and uconv.dll.
The only problem I have is this warning:
D:\HOME\buildenv\usr\lib\libc_omf386.lib(src/lib/sys/386/signal16bit.asm)
: warning LNK4008: aliased fix-up to non-alias object near F in object
CODE32
However, the executable runs just fine. By the way: Compiling and
linking in one step also does not make a difference.
gcc --version yields:
gcc (GCC) 3.3.5 (Bird Build 2007-06-10 14:30)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Lars