Hi,
As previously announced, I am writing Clang Driver code so it directly
calls as/ld instead of delegating that to GCC.
I am nearly finished, with just one issue remaining. If I have this test
code:
#include <stdio.h>
int main()
{
printf("Hello World!\n");
}
and I run
$ i686-w64-mingw32-gcc -shared -v test.c -o test.dll
I get the following output for the call to collect2/ld:
/usr/libexec/gcc/i686-w64-mingw32/4.8.2/collect2
-m i386pe
--shared
-Bdynamic
-e _DllMainCRTStartup@12
--enable-auto-image-base
-o test.dll
/usr/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib/dllcrt2.o
/usr/lib/gcc/i686-w64-mingw32/4.8.2/crtbegin.o
-L/usr/lib/gcc/i686-w64-mingw32/4.8.2
-L/usr/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib
-L/usr/lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib
/tmp/ccRL8M4y.o
-lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32
-lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex
-lmsvcrt
/usr/lib/gcc/i686-w64-mingw32/4.8.2/crtend.o
If I repeat that call, with my improved clang:
clang -target i686-w64-mingw32 -v -shared test.c -o test.dll, I get this:
"/usr/libexec/gcc/i686-w64-mingw32/4.8.2/collect2"
-m i386pe
-Bdynamic
--shared
-e _DllMainCRTStartup@12
--enable-auto-image-base
-o test.dll
/usr/i686-w64-mingw32/lib/dllcrt2.o
/usr/i686-w64-mingw32/lib/crtbegin.o
-L/usr/i686-w64-mingw32/lib
-L/usr/lib/gcc/i686-w64-mingw32/4.8.2
/tmp/test-c90c4a.o
-lmingw32 -lgcc --as-needed -lgcc_s --no-as-needed -lmoldname -lmingwex
-lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc
--as-needed -lgcc_s --no-as-needed -lmoldname -lmingwex -lmsvcrt
/usr/i686-w64-mingw32/lib/crtend.o
/usr/bin/i686-w64-mingw32-ld: warning: cannot find entry symbol
_DllMainCRTStartup@12; defaulting to 000000006bec1000
I tried rearranging the --shared -Bdynamic at the beginning, but that
changed nothing. Why does it give an error in the Clang case? As far as I
can tell, the calls are pretty much identical.
Furthermore, if I first compile to an object file by adding "-c", then run
the above command to produce a dll from this object file, I get no warning.
What gives? And how can I check that the dll produced through clang works?
Any help is appreciated. I've got more stuff for clang coming up, but I
want to finish this first.
Cheers,
Ruben
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public