Hi Tim, Thanks for your suggestion! I built LLVM with Debug and tried this with my custom pass. But it has the following error error: unable to load plugin '../../trace-extractor/build/TracePass.so': '../../trace-extractor/build/TracePass.so: undefined symbol: _ZTIN4llvm10ModulePassE’ Originally I used a builtin Clang in the system and it does not produce this issue. When I search for this issue on Google, it seems to be relevant to “RTTI”. But as I know LLVM is built by default -fno-rtti. I also explicitly turned off it. Here is my cmake command: $ cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_RTTI=OFF -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm Any thought? Best, - Kihong> On Jun 28, 2019, at 5:39 AM, Tim Northover <t.p.northover at gmail.com> wrote: > > Hi Kihong, > > On Fri, 28 Jun 2019 at 05:58, Kihong Heo via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> - Is there any guide line to write a custom pass to avoid such a conflict? > > The most likely cause for the error is that the IR you're generating > is somehow invalid, and causing issues later. > > It also looks like you might have an LLVM built without assertions, so > if that's the case you should fix that (e.g. CMake a debug build with > -DCMAKE_BUILD_TYPE=Debug). That might cause an error immediately when > you create the IR, or at should at least give more information about > why SCCP is failing. > >> - Is there any existing framework to print out dynamic path in LLVM-IR format? > > Not as far as I know. > > Cheers. > > Tim.
On Fri, 28 Jun 2019 at 21:18, Kihong Heo <kihong.heo at gmail.com> wrote:> When I search for this issue on Google, it seems to be relevant to “RTTI”.Yep, that's a typeinfo symbol.> But as I know LLVM is built by default -fno-rtti. I also explicitly turned off it. Here is my cmake command: > > $ cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_RTTI=OFF -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm > > Any thought?My best guess is that your pass was built *with* RTTI (i.e. no -fno-rtti) but LLVM without. A quick fix would be to switch to -DLLVM_ENABLE_RTTI=ON, but longer term you may want to look into your pass's build system. Cheers. tim.
You are right. Thanks! I fixed that one as well as some other issues. I built LLVM-8 with Debug + no-rtti. But it now has the following error: Stack dump: 0. Program arguments: clang-8 -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -disable-free -main-file-name time-1.7.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /home/khheo/project/parametric-symexe/test/toy1/time-1.7.gcno -resource-dir /home/khheo/project/llvm-8/build/lib/clang/8.0.1 -internal-isystem /usr/local/include -internal-isystem /home/khheo/project/llvm-8/build/lib/clang/8.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -fdebug-compilation-dir /home/khheo/project/parametric-symexe/test/toy1 -ferror-limit 19 -fmessage-length 364 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -load ../../trace-extractor/build/TracePass.so -o time-1.7.ll -x c /home/khheo/project/all/time-1.7.c -faddrsig 1. <eof> parser at end of file 2. Per-module optimization passes 3. Running pass 'Unnamed pass: implement Pass::getPassName()' on module '/home/khheo/project/all/time-1.7.c'. … What does "Running pass 'Unnamed pass: implement Pass::getPassName()' on module” mean? - Kihong> On Jun 28, 2019, at 4:48 PM, Tim Northover <t.p.northover at gmail.com> wrote: > > On Fri, 28 Jun 2019 at 21:18, Kihong Heo <kihong.heo at gmail.com> wrote: >> When I search for this issue on Google, it seems to be relevant to “RTTI”. > > Yep, that's a typeinfo symbol. > >> But as I know LLVM is built by default -fno-rtti. I also explicitly turned off it. Here is my cmake command: >> >> $ cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_RTTI=OFF -DLLVM_ENABLE_PROJECTS=clang -G "Unix Makefiles" ../llvm >> >> Any thought? > > My best guess is that your pass was built *with* RTTI (i.e. no > -fno-rtti) but LLVM without. A quick fix would be to switch to > -DLLVM_ENABLE_RTTI=ON, but longer term you may want to look into your > pass's build system. > > Cheers. > > tim.