I did some tests to determine at which stage (compilation, assembly, linking) 
the faulty toolchain creates invalid output. This C program (hi.c) is what I 
used for testing:

    int main(void) {return 0;}

1. Compilation -- `gcc -S file.c` (successful):
With input hi.c, I used the faulty toolchain to create hi.s, and the reference 
toolchain to create hi.ref.s, then I compiled both .s files using the reference 
toolchain into executables. Both executables worked.

2. Assembly -- `as file.s` (successful):
With input hi.s, I used the faulty toolchain to create a.out, and the reference 
toolchain to create a.ref.out, then I compiled both .out files using the 
reference toolchain into executables. Both executables worked.

3. Linking -- `gcc file.out` (FAILED):
With input a.out, I used the faulty toolchain to create a.exe, and the 
reference toolchain to create a.ref.exe. Only a.ref.exe worked, which means 
there's a problem in the linking stage. After inspecting the full linking 
command with -v I found both toolchains are using almost the exact same flags. 
The reference toolchain uses a slightly different ordering of -l flags and adds 
2 extra flags (-lgcc_eh -lpthread), however rearranging the -l flags and 
removing the 2 extra flags to match the faulty toolchain had no effect. This 
means both toolchains are using the correct linking command.

This leads me to believe that the problem comes from the MinGW-w64 libraries or 
the linker (or both)... How can I debug this?




_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to