|
From: KJK::Hyperion <no...@li...> - 2002-05-18 17:13:43
|
At 07.00 15/05/2002, you wrote:
>On Wed, May 15, 2002 at 01:33:11AM +0200, KJK::Hyperion wrote:
> > ... that I forgot to ask:
> > - is there some --do-exactly-what-i-say-and-not-what-you-think-i-need
> > switch? because no matter how many -no this and -fno that I put in the
> > command line, if a program happens to have a procedure called main, a big,
> > annoying static library is linked to the executable, adding an unnecessary
>doesn't "gcc -nostartfiles" work (probably with -nostdlibs or something
>like that? if not, it seems you have found a bug in the gcc-win32 port as
>that is how it should work...
here's the build log:
gcc -I../../../include -nostdinc -fno-builtin -I./ -I../../../../../include
-pipe -march=i386 -c crthybrid.c -o crthybrid.o
gcc -I../../../include -nostdinc -fno-builtin -I./ -I../../../../../include
-pipe -march=i386 -c testfork.c -o testfork.o
gcc -nostartfiles -Wl,--subsystem,console \
-Wl,--entry,___PdxLdrEntry@4 \
-o testfork.nostrip.exe \
crthybrid.o testfork.o ../../../../../dk/w32/lib/ntdll.a
../../../../../dk/w32/lib/kernel32.a ../../../lib/psxdll/psxdll.a
../../../../../tools/rdel temp.exp
nm --numeric-sort testfork.nostrip.exe > testfork.sym
../../../../../tools/rcopy testfork.nostrip.exe testfork.exe
If testfork.c contains a function named main, testfork.exe is 15.7 KB, and
it imports MSVCRT!atexit. If the function is named, for example, mymain,
testfork.exe is 7.44 KB, and imports only functions I actually use. If I
use -nostdlib, that doesn't stop gcc from trying to slip in its static
library, but the compilation fails:
gcc -I../../../include -nostdinc -fno-builtin -I./ -I../../../../../include
-pipe -march=i386 -c crthybrid.c -o crthybrid.o
gcc -I../../../include -nostdinc -fno-builtin -I./ -I../../../../../include
-pipe -march=i386 -c testfork.c -o testfork.o
gcc -nostartfiles -nostdlib -Wl,--subsystem,console \
-Wl,--entry,___PdxLdrEntry@4 \
-o testfork.nostrip.exe \
crthybrid.o testfork.o ../../../../../dk/w32/lib/ntdll.a
../../../../../dk/w32/lib/kernel32.a ../../../lib/psxdll/psxdll.a
testfork.o(.text+0x43):testfork.c: undefined reference to `__main'
make: *** [testfork.nostrip.exe] Error 1
|