x86_64-pc-mingw32 native ld.exe randomly failed to read the archive file

zhou drangon drangon.mail@gmail.com
Thu Oct 4 06:25:00 GMT 2007


under x86_64 linux, I built the cross x86_64-pc-mingw32 compiler using the
latest CVS/SVN head of binutils gcc mingw-w64,
and the use the cross compiler to build the native x86_64-pc-mingw32
compiler toolchain.

Then I ran the compiler in native WinXP x64, the compiler toolchain
failed to compile.
And I think this is mostly a bug of ld.exe when reading the archive file.

A very simple "hello world" program t3.c, use gcc.exe and as.exe to
create obj file :
..\target\bin\gcc -S t3.c
..\target\bin\as t3.s -o t3.o

then the following command can generate t3.exe successfully under command line

..\target\bin\ld.exe -static -o t3.exe
..\target\x86_64-pc-mingw32\lib\crt2.o
..\target\x86_64-pc-mingw32\lib\crtbegin.o   -L
..\target\x86_64-pc-mingw32\lib  t3.o t3_pp.o -lmingw32 -lmoldname
-lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32
-lmoldname -lmingwex -lmsvcrt
..\target\x86_64-pc-mingw32\lib\crtend.o

but if I double the "-lmingw32", it failed to generate exe file

..\target\bin\ld.exe -static -o t3.exe
..\target\x86_64-pc-mingw32\lib\crt2.o
..\target\x86_64-pc-mingw32\lib\crtbegin.o   -L
..\target\x86_64-pc-mingw32\lib  t3.o t3_pp.o -lmingw32 -lmingw32
-lmoldname -lmingwex -lmsvcrt
-luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lmoldname -lmingwex -lmsvcrt
  ..\target\x86_64-pc-mingw32\lib\crtend.o
..\target\x86_64-pc-mingw32\lib\libmingw32.a: file not recognized: File format n
ot recognized

If I run the command similar with the first successful example ( mainly change
the "\" to "/" ) in MSYS, run the same command several times,
all the odd times run successfule and all the even times run failed.
the same command!

How can I get more information or debug it ?



More information about the Binutils mailing list