https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122472

            Bug ID: 122472
           Summary: LTO does not work when using bigobj on
                    x86_64-w64-mingw32
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: peter0x44 at disroot dot org
  Target Milestone: ---

For the following simple code:

#include <stdio.h>

int main(void)
{
    puts("hi");
}

It builds fine with LTO:

$ x86_64-w64-mingw32-gcc test.c -flto -o test

But, if you use bigobj:

$ x86_64-w64-mingw32-gcc test.c -flto -Wa,-mbig-obj

/home/peter/wintoolchain/lib/gcc/x86_64-w64-mingw32/16.0.0/../../../../x86_64-w64-mingw32/bin/ld:
/tmp/ccWnQ0l4.o: plugin needed to handle lto object
/home/peter/wintoolchain/lib/gcc/x86_64-w64-mingw32/16.0.0/../../../../x86_64-w64-mingw32/bin/ld:
/home/peter/wintoolchain/mingw/lib/../lib/libmingw32.a(lib64_libmingw32_a-crtexewin.o):
in function `main':
/home/peter/mingwbuild/../mingw-w64-v13.0.0/mingw-w64-crt/crt/crtexewin.c:66:(.text.startup+0xb5):
undefined reference to `WinMain'
collect2: error: ld returned 1 exit status


I suspect this code in libiberty does not support them:
https://gcc.gnu.org/cgit/gcc/tree/libiberty/simple-object-coff.c

I wrote a blog post on this subject:
https://peter0x44.github.io/posts/bigobj_format_explained/

Reply via email to