[Bug target/15037] New: -ffreestanding not taken into account when compiling main()

xtrochu at yahoo dot com gcc-bugzilla@gcc.gnu.org
Wed Apr 21 10:11:00 GMT 2004


When compiling a function called "main" with gcc under mingw32, a call to __main
() is inserted before anything else. This is normal and expected.

The problem is that the same behaviour occurs when using the -ffreestanding 
compiler flag.

Step to reproduce :
$ echo "int main() { return 0;" > test.c
$ gcc -ffreestanding -S -o test.S test.c
$ grep "call" test.S
        call    __alloca
        call    ___main
$ gcc -v
Reading specs from c:/tools/gnuwin32/bin/../lib/gcc-lib/mingw32/3.3.3/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --
host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --
enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-
shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x -
-enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-
synchronization
Thread model: win32
gcc version 3.3.3 (mingw special)

the cygwin compiler (gcc version 3.3.1 (cygming special)) has the same behavior.

-- 
           Summary: -ffreestanding not taken into account when compiling
                    main()
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xtrochu at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15037



More information about the Gcc-bugs mailing list