[EXPERIMENTAL] Building Dragonegg on Cygwin

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[EXPERIMENTAL] Building Dragonegg on Cygwin

Good evening, guys!

I have built dragonegg.dll on cygwin and it works (it seems).
I have not tried stage2 build yet.

It would be applicable to also mingw32-gcc to enhance gcc/plugin.c.



1. Apply two patches. one is for gcc/config/i386/i386.c.

--- a/gcc/configure
+++ b/gcc/configure
@@ -25621,6 +25621,9 @@ rm -f core conftest.err conftest.$ac_objext \

+  pluginlibs="-Wl,--export-all-symbols -Wl,--output-def,cc1.def"
+  enable_plugin=yes
   # If plugin support had been requested but not available, fail.
   if test x"$enable_plugin" = x"no" ; then
     if test x"$default_plugin" != x"yes"; then

2. build gcc with --enable-lto --enable-plugin and install it.
cc1*.exe might have export tables.

3. Generate import libraries. (manually!)

$ dragonegg/lazyimp.pl $(GCC_PLUGIN_DIR)/lib/libcc1.a $(builtgcc)/gcc/cc1.def

It takes so long time. :/

4. Compile dll.c

$ gcc -O3 -Wall dll.c -c
$ ar rcs $(GCC_PLUGIN_DIR)/lib/libcc1.a dll.o

5. Tweak Dragonegg's Makefile and build!

--- a/Makefile
+++ b/Makefile
@@ -57,6 +57,8 @@ CPP_OPTIONS+=$(CPPFLAGS) $(shell $(LLVM_CONFIG) --cppflags) \
             -I$(INCLUDE_DIR) -I$(GCC_PLUGIN_DIR)/include

+LD_OPTIONS+=-Wl,-e,_lazymain@12 -L $(GCC_PLUGIN_DIR)/lib -lcc1
 LD_OPTIONS+=$(shell $(LLVM_CONFIG) --ldflags) $(LDFLAGS)

 # NOTE: The following flags can only be used after TARGET_UTIL has been built.

6. check
$ /path/to/installed/gcc/bin/g++.exe -fplugin=./dragonegg.dll -O3 -S
hello.c -fplugin-arg-dragonegg-emit-ir
$ cat hello.s
; ModuleID = 'hello.c'
target datalayout =
target triple = "i386-pc-cygwin"

LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu

dll.c (710 bytes) Download Attachment
lazyimp.pl (2K) Download Attachment