On Thu, Dec 23, 2010 at 7:09 PM, Ian Lance Taylor <iant@xxxxxxxxxx> wrote: > Lucky Lu <Lucky.Lu@xxxxxxxxxxxxxxxxxx> writes: > >> I am having trouble with building the gcc 4.5.1 with --enable-plugin on Cygwin. > > As far as I know gcc plugins don't work on cygwin. > >> The configure string is "--enable-plugin --enable-languages=c,c++ --disable-bootstrap". >> The error is , >> checking for -rdynamic... objdump: conftest: not a dynamic object no >> checking for library containing dlopen... none required >> checking for -fPIC -shared... no >> configure: error: >> Building GCC with plugin support requires a host that supports >> -fPIC, -shared, -ldl and -rdynamic. >> make[1]: *** [configure-gcc] Error 1 >> >> When I jump the -fPIC checking, it's success. And then failed when building a gcc plugin, print following, >> >> plugin.c:1:0: warning: -fPIC ignored for target (all code is position independent) >> /tmp/ccU93aXF.o:plugin.c:(.text+0xd1): undefined reference to `_build3_stat' >> /tmp/ccU93aXF.o:plugin.c:(.text+0xff): undefined reference to `_gimple_assign_single_p' >> ..... > > That's in essence because -rdynamic doesn't do anything on Windows. It > goes further, in that I don't know that there is any way it can be made > to work given the way that Windows DLLs work. There may be some way to > make it work; I just don't know of one. In Windows, EXEs can export symbols like DLLs. I've never used the feature, though. __declspec(dllexport) int g_global = 0; int main(int argc, char* argv[]) { return 0; } >dumpbin -exports exporttest.exe Microsoft (R) COFF/PE Dumper Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file exporttest.exe File Type: EXECUTABLE IMAGE Section contains the following exports for exporttest.exe 00000000 characteristics 4D13EC00 time date stamp Thu Dec 23 19:40:32 2010 0.00 version 1 ordinal base 1 number of functions 1 number of names ordinal hint RVA name 1 0 00017140 ?g_global@@3HA = ?g_global@@3HA (int g_global) Summary 1000 .data 1000 .idata 2000 .rdata 1000 .reloc 1000 .rsrc 4000 .text 10000 .textbss > Jeff