Open eminarcissus opened 5 years ago
Hi @eminarcissus
Thanks for your PR!
Already reported https://github.com/xiangzhai/dragonegg/issues/23
Workaround for Linux https://github.com/xiangzhai/dragonegg/commit/2736f2a735244ca3ab029ac06456140c4217e6f5
So you could simply workaround it for __unix__
.
Cheers, Leslie Zhai
Wow, thx very much. Sorry didn't noticed that issue That did works out, but some few other issues looks like here. cc1: fatal error: plugin ./dragonegg/dragonegg.so is not licensed under a GPL-compatible license dlsym(0x1439039e0, plugin_is_GPL_compatible): symbol not found
I will check where's the problem here :)
You could try to comment this line https://github.com/xiangzhai/dragonegg/blob/master/src/Backend.cpp#L1970
quite weird, no matter if I define it as 1 or 0, or just comment out this out, all comes up with the same error. looks like is gcc itself trying to check for this value when loading a plugin?
https://github.com/gcc-mirror/gcc/blob/master/gcc/plugin.c#L712
so workaround might be:
int plugin_is_GPL_compatible __attribute__((visibility("default"))) { return 0; }
looks like the problem roots from CPP naming conventions. this is the result after I decompile the so file. symbol plugin_is_GPL_compatible is being compiled to _plugin_is_GPL_compatible as global variable. Didn't confirmed yet.
You could just comment the Check the plugin license
https://github.com/gcc-mirror/gcc/blob/master/gcc/plugin.c#L711
And rebuild gcc https://github.com/xiangzhai/dragonegg/wiki/GGC#fedora-25
yeah... that probably works out, will try it now 👍
quite devastating problems here looks like. after comment out this line now GPL check works out but plugin_init not found. dlsym(0x141f05980, plugin_init): symbol not found I've tried to remove the leading underscore but still no help(by adding asm("plugin_init") when defining the function).
Also double checked dragonegg.so compiled with GCC4.8 and llvm3.5. Looks like both GPL license check and plugin_init are pre underscored. So I believe this might be some other problems here. Don't know how to start on debuging this kind of problem...
plugin_init
could not be commented :)
What about this commit? https://github.com/xiangzhai/dragonegg/commit/d332eefb270555b2b46919171ab59073d66ea4a3
didn't work out. Also that commit looks like is a fix for GCC 4.9.3? The error itself looks really obscure, 000000000000c3d3 l F TEXT,text __ZL13version_checkP18plugin_gcc_version 000000000000c3f4 l F TEXT,text _plugin_init 000000000000d1a4 lw F TEXT,text __ZN4llvm4castINS_8ConstantEKNS_5ValueEEENS_10cast_rettyIT_PT0_E8rettypeES7
and plugin.c just calling dlsym(handle,"plugin_init"), so it shouldn't be a error telling symbol not found, quite confusing.
You could report the bug to GCC if failed to run testsuite on your Mac:
dejagnu
https://gcc.gnu.org/install/test.html$ make check-gcc RUNTESTFLAGS="plugin.exp"
make[1]: Entering directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
rm -rf testsuite/gcc-parallel
make[2]: Entering directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc; ${PWDCMD-pwd}` ; export srcdir ; \
if [ -n "" ] \
&& [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] \
&& [ -f testsuite/gcc-parallel/finished ]; then \
rm -rf testsuite/gcc; \
else \
cd testsuite/gcc; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/gcc|' \
< ../../site.exp > tmp-site.exp; \
/bin/bash ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; \
fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool gcc plugin.exp; \
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] ; then \
touch ${rootme}/testsuite/gcc-parallel/finished; \
fi ; \
fi )
Test run by loongson on Wed Jun 26 17:20:52 2019
Native configuration is x86_64-pc-linux-gnu
=== gcc tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /disk/zhaixiang/gcc-7-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /disk/zhaixiang/gcc-7-branch/gcc/testsuite/gcc.dg/plugin/plugin.exp ...
=== gcc Summary ===
# of expected passes 340
# of expected failures 1
/disk/zhaixiang/gcc-7-branch/build/gcc/xgcc version 7.4.1 20190620 (GCC)
make[2]: Leaving directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
rm -rf testsuite/g++-parallel
make[2]: Entering directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc; ${PWDCMD-pwd}` ; export srcdir ; \
if [ -n "" ] \
&& [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] \
&& [ -f testsuite/g++-parallel/finished ]; then \
rm -rf testsuite/g++; \
else \
cd testsuite/g++; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/g++|' \
< ../../site.exp > tmp-site.exp; \
/bin/bash ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; \
fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool g++ plugin.exp; \
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] ; then \
touch ${rootme}/testsuite/g++-parallel/finished; \
fi ; \
fi )
Test run by loongson on Wed Jun 26 17:20:57 2019
Native configuration is x86_64-pc-linux-gnu
=== g++ tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /disk/zhaixiang/gcc-7-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /disk/zhaixiang/gcc-7-branch/gcc/testsuite/g++.dg/plugin/plugin.exp ...
=== g++ Summary ===
# of expected passes 268
# of expected failures 2
/disk/zhaixiang/gcc-7-branch/build/gcc/xg++ version 7.4.1 20190620 (GCC)
make[2]: Leaving directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
rm -rf testsuite/gfortran-parallel
make[2]: Entering directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc; ${PWDCMD-pwd}` ; export srcdir ; \
if [ -n "" ] \
&& [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] \
&& [ -f testsuite/gfortran-parallel/finished ]; then \
rm -rf testsuite/gfortran; \
else \
cd testsuite/gfortran; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/gfortran|' \
< ../../site.exp > tmp-site.exp; \
/bin/bash ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; \
fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool gfortran plugin.exp; \
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] ; then \
touch ${rootme}/testsuite/gfortran-parallel/finished; \
fi ; \
fi )
Test run by loongson on Wed Jun 26 17:21:00 2019
Native configuration is x86_64-pc-linux-gnu
=== gfortran tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /disk/zhaixiang/gcc-7-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
=== gfortran Summary ===
/disk/zhaixiang/gcc-7-branch/build/gcc/gfortran version 7.4.1 20190620 (GCC)
make[2]: Leaving directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
rm -rf testsuite/go-parallel
make[2]: Entering directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc; ${PWDCMD-pwd}` ; export srcdir ; \
if [ -n "" ] \
&& [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] \
&& [ -f testsuite/go-parallel/finished ]; then \
rm -rf testsuite/go; \
else \
cd testsuite/go; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/go|' \
< ../../site.exp > tmp-site.exp; \
/bin/bash ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; \
fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool go plugin.exp; \
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] ; then \
touch ${rootme}/testsuite/go-parallel/finished; \
fi ; \
fi )
Test run by loongson on Wed Jun 26 17:21:00 2019
Native configuration is x86_64-pc-linux-gnu
=== go tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /disk/zhaixiang/gcc-7-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
=== go Summary ===
/disk/zhaixiang/gcc-7-branch/build/gcc/gccgo version 7.4.1 20190620 (GCC)
make[2]: Leaving directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
rm -rf testsuite/objc-parallel
make[2]: Entering directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc; ${PWDCMD-pwd}` ; export srcdir ; \
if [ -n "" ] \
&& [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] \
&& [ -f testsuite/objc-parallel/finished ]; then \
rm -rf testsuite/objc; \
else \
cd testsuite/objc; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/objc|' \
< ../../site.exp > tmp-site.exp; \
/bin/bash ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=`if [ -f ${rootme}/../expect/expect ] ; then echo ${rootme}/../expect/expect ; else echo expect ; fi` ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; \
fi ; \
`if [ -f ${srcdir}/../dejagnu/runtest ] ; then echo ${srcdir}/../dejagnu/runtest ; else echo runtest; fi` --tool objc plugin.exp; \
if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ] ; then \
touch ${rootme}/testsuite/objc-parallel/finished; \
fi ; \
fi )
Test run by loongson on Wed Jun 26 17:21:01 2019
Native configuration is x86_64-pc-linux-gnu
=== objc tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /disk/zhaixiang/gcc-7-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /disk/zhaixiang/gcc-7-branch/gcc/testsuite/objc.dg/plugin/plugin.exp ...
=== objc Summary ===
# of expected passes 16
/disk/zhaixiang/gcc-7-branch/build/gcc/xgcc version 7.4.1 20190620 (GCC)
make[2]: Leaving directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
test -d plugin || mkdir plugin
test -d testsuite || mkdir testsuite
test -d testsuite/obj-c++ || mkdir testsuite/obj-c++
(rootme=`${PWDCMD-pwd}`; export rootme; \
srcdir=`cd ../../gcc; ${PWDCMD-pwd}` ; export srcdir ; \
cd testsuite/obj-c++; \
rm -f tmp-site.exp; \
sed '/set tmpdir/ s|testsuite$|testsuite/obj-c++|' \
< ../../site.exp > tmp-site.exp; \
/bin/bash ${srcdir}/../move-if-change tmp-site.exp site.exp; \
EXPECT=expect ; export EXPECT ; \
if [ -f ${rootme}/../expect/expect ] ; then \
TCL_LIBRARY=`cd .. ; cd ${srcdir}/../tcl/library ; ${PWDCMD-pwd}` ; \
export TCL_LIBRARY ; fi ; \
runtest --tool obj-c++ plugin.exp)
Test run by loongson on Wed Jun 26 17:21:01 2019
Native configuration is x86_64-pc-linux-gnu
=== obj-c++ tests ===
Schedule of variations:
unix
Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /disk/zhaixiang/gcc-7-branch/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /disk/zhaixiang/gcc-7-branch/gcc/testsuite/obj-c++.dg/plugin/plugin.exp ...
=== obj-c++ Summary ===
# of expected passes 16
/disk/zhaixiang/gcc-7-branch/build/gcc/xg++ version 7.4.1 20190620 (GCC)
make[1]: Leaving directory '/disk/zhaixiang/gcc-7-branch/build/gcc'
Will try that, currently I'm retreating back to old version dragonegg to get the job done first :(
Hi @eminarcissus
You could try @my-HenryS `s workaround https://github.com/my-HenryS/dragonegg/commit/3252c914c2741147fc52002bbda78d6f432bcfc2#diff-b67911656ef5d18c4ae36cb6741b7965
Cheers, Leslie Zhai
Thx, gotta give it a shot, being stucked at gcc test for a while lol :)
Quite weird, after patch Henry's version it is not even building, I saw some header files change which like Target -> CodeGen which is not exists with llvm-6.0, Also some errors like this
In function 'void CreateTargetMachine(const string&)': /Users/misuzi/developing/c/mod_dragonegg/dragonegg/src/Backend.cpp:695:36: error: base operand of '->' has non-pointer type 'const llvm::DataLayout' assert(TheModule->getDataLayout()->isBigEndian() == BYTES_BIG_ENDIAN);
just apply his patch for Makefile
https://github.com/my-HenryS/dragonegg/commit/3252c914c2741147fc52002bbda78d6f432bcfc2#diff-b67911656ef5d18c4ae36cb6741b7965 but do not change other source files.
Quite interesting, now it builds, but testing the plugin emits a crash like this.
Event | Plugins PLUGIN_FINISH_UNIT | dragonegg PLUGIN_FINISH | dragonegg PLUGIN_START_UNIT | dragonegg PLUGIN_ALL_IPA_PASSES_END | dragonegg wc.c:8:5: internal compiler error: Segmentation fault: 11 int main(int argc, char** argv) { ^~~~
WARNING there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_FINISH_UNIT | dragonegg PLUGIN_FINISH | dragonegg PLUGIN_START_UNIT | dragonegg PLUGIN_ALL_IPA_PASSES_END | dragonegg wc.c:8:5: internal compiler error: Abort trap: 6 gcc-6: internal compiler error: Abort trap: 6 (program cc1)
Could you show me the command line? And then it is able to see what gdb say like this https://github.com/xiangzhai/dragonegg/issues/37
gcc-6 wc.c -S -O1 -o - -fplugin=$PWD/dragonegg/dragonegg.so wc.c: In function 'main': wc.c:22:17: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration] while ((r = read(fd, BUFFER, BUFFER_SIZE)) > 0) { ^~~~ wc.c:30:5: warning: implicit declaration of function 'close' [-Wimplicit-function-declaration] close(fd); ^~~~~ WARNING there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_FINISH_UNIT | dragonegg PLUGIN_FINISH | dragonegg PLUGIN_START_UNIT | dragonegg PLUGIN_ALL_IPA_PASSES_END | dragonegg wc.c:8:5: internal compiler error: Segmentation fault: 11 int main(int argc, char** argv) { ^~~~
WARNING there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_FINISH_UNIT | dragonegg PLUGIN_FINISH | dragonegg PLUGIN_START_UNIT | dragonegg PLUGIN_ALL_IPA_PASSES_END | dragonegg wc.c:8:5: internal compiler error: Abort trap: 6 gcc-6: internal compiler error: Abort trap: 6 (program cc1) Please submit a full bug report, with preprocessed source if appropriate. See https://github.com/Homebrew/homebrew-core/issues for instructions.
wc.c is a snip of quite simple test c codes.
gcc-6 -fplugin=$PWD/dragonegg/dragonegg.so \
-fplugin-arg-dragonegg-debug-pass-arguments \
-ftime-report \
-fplugin-arg-dragonegg-enable-gcc-optzns \
-fplugin-arg-dragonegg-emit-ir \
-O1 \
-S \
wc.c \
-o $PWD/wc.c.ll \
-wrapper gdb,--args
And see what gdb say.
misuzi@TimnoMBP-2 ~/developing/c $ gcc-6 -fplugin=$PWD/dragonegg/dragonegg.so \ -fplugin-arg-dragonegg-debug-pass-arguments \ -ftime-report \ -fplugin-arg-dragonegg-enable-gcc-optzns \ -fplugin-arg-dragonegg-emit-ir \ -O1 \ -S \ wc.c \ -o $PWD/wc.c.ll \ -wrapper gdb,--args GNU gdb (GDB) 8.2.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin18.2.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/local/Cellar/gcc@6/6.4.0/libexec/gcc/x86_64-apple-darwin18/6.4.0/cc1...done. gdb$
quite weird, nothing output looks like
(gdb) r Starting program: /usr/local/Cellar/gcc@6/6.4.0/libexec/gcc/x86_64-apple-darwin18/6.4.0/cc1 -quiet -iplugindir=/usr/local/Cellar/gcc@6/6.4.0/lib/gcc/6/gcc/x86_64-apple-darwin18/6.4.0/plugin -DDYNAMIC wc.c -iplugindir=/usr/local/Cellar/gcc@6/6.4.0/lib/gcc/6/gcc/x86_64-apple-darwin18/6.4.0/plugin -fPIC -quiet -dumpbase wc.c -mmacosx-version-min=10.14.6 -mtune=core2 -auxbase-strip /Users/misuzi/developing/c/wc.c.ll -O1 -fplugin=/Users/misuzi/developing/c/dragonegg/dragonegg.so -fplugin-arg-dragonegg-debug-pass-arguments -ftime-report -fplugin-arg-dragonegg-enable-gcc-optzns -fplugin-arg-dragonegg-emit-ir -o /Users/misuzi/developing/c/wc.c.ll [New Thread 0xd03 of process 5688] During startup program terminated with signal ?, Unknown signal.
Running again with roots permission, I've seen some error outputs somehow
Assertion failed: (getValPtr() && getValPtr()->HasValueHandle && "Pointer doesn't have a use list!"), function RemoveFromUseList, file /Users/misuzi/developing/c/llvm/lib/IR/Value.cpp, line 800.
Then bt
Seems like gdb have some problem, will sort out that first, apple have switched. to lldb, since 3 years ago gdb have being somewhat quite unstable here.
successfully get a traceback here.
Assertion failed: (getValPtr() && getValPtr()->HasValueHandle && "Pointer doesn't have a use list!"), function RemoveFromUseList, file /Users/misuzi/developing/c/llvm/lib/IR/Value.cpp, line 800.
Thread 2 received signal SIGABRT, Aborted. --------------------------------------------------------------------------[regs] EAX: 0x00000000 EBX: 0x41D265C0 ECX: 0xEFBFDB78 EDX: 0x00000000 o d I t s z a P c ESI: 0x00000006 EDI: 0x00000307 EBP: 0xEFBFDBB0 ESP: 0xEFBFDB78 EIP: 0xError while running hook_stop: Value can't be converted to integer. 0x00007fff632cf2c6 in ?? () from /usr/lib/system/libsystem_kernel.dylib gdb$ gdb$ bt
Backtrace stopped: frame did not save the PC
A changed file to compile, different error though
Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file /Users/misuzi/developing/c/llvm/include/llvm/Support/Casting.h, line 92.
Thread 2 received signal SIGABRT, Aborted. --------------------------------------------------------------------------[regs] EAX: 0x00000000 EBX: 0x41D265C0 ECX: 0xEFBFDBB8 EDX: 0x00000000 o d I t s z a P c ESI: 0x00000006 EDI: 0x00000307 EBP: 0xEFBFDBF0 ESP: 0xEFBFDBB8 EIP: 0xError while running hook_stop: Value can't be converted to integer. 0x00007fff632cf2c6 in ?? () from /usr/lib/system/libsystem_kernel.dylib gdb$ bt
Backtrace stopped: frame did not save the PC
please recompile dragonegg.so:
$ make clean
$ make DRAGONEGG_DEBUG=1
The backtrace information is not detailed.
test.c:6:1: warning: return type defaults to 'int' [-Wimplicit-int] main() ^~~~ DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2246: llvm_emit_globals DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 826: InitializeBackend: x86_64-apple-darwin18 DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 691: CreateTargetMachine: triple: x86_64-apple-darwin18 cpu: x86-64 feature: +64bit,-3dnow,-3dnowa,-aes,-avx,-cx16,-fma,-fma4,+mmx,-popcnt,-rdrnd,+sse,+sse2,+sse3,-sse4.1,-sse4.2,-sse4a,-ssse3 DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 754: CreateModule: e-m:o-i64:64-f80:128-n8:16:32:64-S128 DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2181: emit_file_scope_asms DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2206: emit_cgraph_weakrefs DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2221: emit_varpool_weakrefs
Thread 2 received signal SIGSEGV, Segmentation fault. --------------------------------------------------------------------------[regs] EAX: 0x00000001 EBX: 0x42825020 ECX: 0x00000010 EDX: 0x4202CDE8 o d I t s Z a P c ESI: 0x4202CDE8 EDI: 0x42835258 EBP: 0xEFBFDA60 ESP: 0xEFBFDA30 EIP: 0xError while running hook_stop: Value can't be converted to integer. 0x0000000144f47ee6 in llvm::ValueHandleBase::RemoveFromUseList (this=0x142835258) at /Users/misuzi/developing/c/llvm/lib/IR/Value.cpp:799 799 assert(getValPtr() && getValPtr()->HasValueHandle && gdb$ bt
wc.c: In function 'main': wc.c:22:17: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration] while ((r = read(fd, BUFFER, BUFFER_SIZE)) > 0) { ^~~~ wc.c:30:5: warning: implicit declaration of function 'close' [-Wimplicit-function-declaration] close(fd); ^~~~~ DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2246: llvm_emit_globals DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 826: InitializeBackend: x86_64-apple-darwin18 DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 691: CreateTargetMachine: triple: x86_64-apple-darwin18 cpu: x86-64 feature: +64bit,-3dnow,-3dnowa,-aes,-avx,-cx16,-fma,-fma4,+mmx,-popcnt,-rdrnd,+sse,+sse2,+sse3,-sse4.1,-sse4.2,-sse4a,-ssse3 DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 754: CreateModule: e-m:o-i64:64-f80:128-n8:16:32:64-S128 DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2181: emit_file_scope_asms DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2287: llvm_emit_globals: vnode DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 1383: emit_global DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2206: emit_cgraph_weakrefs DEBUG: /Users/misuzi/developing/c/dragonegg/src/Backend.cpp, line 2221: emit_varpool_weakrefs
Thread 2 received signal SIGSEGV, Segmentation fault. --------------------------------------------------------------------------[regs] EAX: 0x00000000 EBX: 0x43024820 ECX: 0x0000001C EDX: 0x01D0EF68 o d I t s Z a P c ESI: 0x01D0EF68 EDI: 0x00000000 EBP: 0xEFBFDA10 ESP: 0xEFBFD9E0 EIP: 0xError while running hook_stop: Value can't be converted to integer. 0x0000000144f47f3d in llvm::ValueHandleBase::RemoveFromUseList (this=0x102802668) at /Users/misuzi/developing/c/llvm/lib/IR/Value.cpp:804 804 assert(*PrevPtr == this && "List invariant broken"); gdb$ bt
gdb$
What is the version of dragonegg you are using? I can not locate:
#5 0x000000014382a55b in TreeToLLVM::set_decl_local (this=<error reading variable: Could not find the frame base for "TreeToLLVM::set_decl_local(tree_node*, llvm::Value*)".>, decl=<error reading variable: Could not find the frame base for "TreeToLLVM::set_decl_local(tree_node*, llvm::Value*)".>, V=<error reading variable: Could not find the frame base for "TreeToLLVM::set_decl_local(tree_node*, llvm::Value*)".>) at /Users/misuzi/developing/c/dragonegg/src/Convert.cpp:742
In the latest commit https://github.com/xiangzhai/dragonegg/commit/e93723b7e328e05b868fca6e67ef203f8e010232
I'm using c1b5b35 this commit with gcc6 and llvm 6.0. Afterwards it starts to accommodates for later version LLVM which cannot create a working builds.
master latest commit I'm frequently seeing this error during compiling /Users/misuzi/developing/c/dragonegg/src/Backend.cpp: In function 'llvm::Value* make_decl_llvm(tree)': /Users/misuzi/developing/c/dragonegg/src/Backend.cpp:1634:20: error: 'debug_tree' was not declared in this scope debug_tree(decl); ^
I don't know if it is really a gcc compiling problem or not, because I did have gcc compiled with plugin and the compiling dragonegg versions don't have too structural difference in code(the latest master the 2017 latest version). They both contains debug_tree in the same function at a first glance. More changes were taken in header files, which I guess is accommodates different version of llvm and gcc, but older one works but not the latest one. Except for debug tree(I tried to comment out that line first for a compile), there are also some other problems as well, I'm considering to build a llvm-9 to give it a try as well.
For the debug_tree problem, the same thing happening when I compile the old version dragonegg with different version of llvm(especially for the latest working version between llvm3.2 and dragonegg3.2, a small version bump might create quite a lot similar problems).
Migrate to llvm-9 https://github.com/xiangzhai/dragonegg/issues/35
hmmm,llvm-9 is not officially released yet?
Hi,
Thanks very much to make this project continued til now :) I'm now trying to compile it on OSX with GCC6.4 and llvm-r311142. I've checkout to the c1b5b35 commit which I believe is the repo which should worlks with GCC6 and llvm this version.
Currently the code is compiling, and successfully linked. But somehow it yields out this error when I tried to do a fplugin compile.
gcc-6 a.c -S -O1 -o - -fplugin=./dragonegg/dragonegg.so -L/usr/local/llvm-6 cc1: error: cannot load plugin ./dragonegg/dragonegg.so dlopen(./dragonegg/dragonegg.so, 10): Symbol not found: _C_alloca Referenced from: ./dragonegg/dragonegg.so Expected in: flat namespace in ./dragonegg/dragonegg.so
Any hints would be real appreciated :) Now I'm trying to compile some fortran codes with dragonegg, so I have to keep a backup system for years ago. It would be really helpful if this does working here :)
Attached is gcc6 compile info.
Using built-in specs. COLLECT_GCC=gcc-6 COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc@6/6.4.0/libexec/gcc/x86_64-apple-darwin18/6.4.0/lto-wrapper Target: x86_64-apple-darwin18 Configured with: ../configure --build=x86_64-apple-darwin18 --prefix=/usr/local/Cellar/gcc@6/6.4.0 --libdir=/usr/local/Cellar/gcc@6/6.4.0/lib/gcc/6 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-6 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 6.4.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --disable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk --enable-plugin --enable-lto Thread model: posix gcc version 6.4.0 (Homebrew GCC 6.4.0)
Thx very much.