Maciej Piechotka
2013-Dec-25 04:33 UTC
[LLVMdev] Crash in opt.cpp:739 when loading custom pass (only on system-wide debug install of llvm)
Hi, I'm trying to write custom pass. However opt started crashed in opt.cpp. After debugging it looks like PassInf->NormalCtor points to unmapped memory (rest of struct contains correct data about my pass) - it pointed high in user memory (0x756e672e006e6f69). It happens only when I tried to install debug version of llvm system-wide (I've check that it wasn't caused by stale .a files). When I used the local install (via cmake to $HOME) or release it works[1]. My system is Gentoo, 64 bit. To bootstrap I've used gcc 4.8.2. Any idea what might be a cause of it (my build system is practically copied from documentation[2])? Best regards PS. The difference seems to be in system-wide install only optimized/assertions/expensive-checks flags (I'm using Gentoo ebuild). [1] The problem with local install is that it cause problems with clang (probably because of some incompatibilities between released version clang was compiled against and debug version it's loading) and release version don't have debug flags support etc. [2] http://llvm.org/docs/CMake.html#developing-llvm-pass-out-of-source -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131225/6bdedaf4/attachment.sig>
Maciej Piechotka
2013-Dec-25 11:56 UTC
[LLVMdev] Crash in opt.cpp:739 when loading custom pass (only on system-wide debug install of llvm)
On Wed, 2013-12-25 at 05:33 +0100, Maciej Piechotka wrote:> Hi, > > I'm trying to write custom pass. However opt started crashed in opt.cpp. > After debugging it looks like PassInf->NormalCtor points to unmapped > memory (rest of struct contains correct data about my pass) - it pointed > high in user memory (0x756e672e006e6f69). > > It happens only when I tried to install debug version of llvm > system-wide (I've check that it wasn't caused by stale .a files). When I > used the local install (via cmake to $HOME) or release it works[1]. > > My system is Gentoo, 64 bit. To bootstrap I've used gcc 4.8.2. > > Any idea what might be a cause of it (my build system is practically > copied from documentation[2])? > > Best regards > > PS. The difference seems to be in system-wide install only > optimized/assertions/expensive-checks flags (I'm using Gentoo ebuild). > > [1] The problem with local install is that it cause problems with clang > (probably because of some incompatibilities between released version > clang was compiled against and debug version it's loading) and release > version don't have debug flags support etc. > [2] http://llvm.org/docs/CMake.html#developing-llvm-pass-out-of-sourceWhen I tried to manually rewrite the RegisterPass: struct RegisterMyPass { RegisterMyPass(); }; llvm::Pass *create_my_pass() { return new vallvm::MyPass(); } RegisterMyPass::RegisterMyPass() { static llvm::PassInfo info(..., ..., &vallvm::MyPass::ID, create_my_pass, false, false); if (info.getNormalCtor() == create_closure_capture) { llvm::errs() << "???\n"; info.setNormalCtor(create_closure_capture); if (info.getNormalCtor() == create_closure_capture) { llvm::errs() << "???\n"; } } llvm::PassRegistry::getPassRegistry()->registerPass(info); } With debug built it prints "???" twice. Regards -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131225/3e059ec1/attachment.sig>
Maciej Piechotka
2013-Dec-25 12:27 UTC
[LLVMdev] Crash in opt.cpp:739 when loading custom pass (only on system-wide debug install of llvm)
On Wed, 2013-12-25 at 12:56 +0100, Maciej Piechotka wrote:> On Wed, 2013-12-25 at 05:33 +0100, Maciej Piechotka wrote: > > Hi, > > > > I'm trying to write custom pass. However opt started crashed in opt.cpp. > > After debugging it looks like PassInf->NormalCtor points to unmapped > > memory (rest of struct contains correct data about my pass) - it pointed > > high in user memory (0x756e672e006e6f69). > > > > It happens only when I tried to install debug version of llvm > > system-wide (I've check that it wasn't caused by stale .a files). When I > > used the local install (via cmake to $HOME) or release it works[1]. > > > > My system is Gentoo, 64 bit. To bootstrap I've used gcc 4.8.2. > > > > Any idea what might be a cause of it (my build system is practically > > copied from documentation[2])? > > > > Best regards > > > > PS. The difference seems to be in system-wide install only > > optimized/assertions/expensive-checks flags (I'm using Gentoo ebuild). > > > > [1] The problem with local install is that it cause problems with clang > > (probably because of some incompatibilities between released version > > clang was compiled against and debug version it's loading) and release > > version don't have debug flags support etc. > > [2] http://llvm.org/docs/CMake.html#developing-llvm-pass-out-of-source > > When I tried to manually rewrite the RegisterPass: > > struct RegisterMyPass { > RegisterMyPass(); > }; > > llvm::Pass *create_my_pass() { > return new vallvm::MyPass(); > } > > RegisterMyPass::RegisterMyPass() { > static llvm::PassInfo info(..., > ..., > &vallvm::MyPass::ID, > create_my_pass, > false, false); > if (info.getNormalCtor() == create_closure_capture) { > llvm::errs() << "???\n"; > info.setNormalCtor(create_closure_capture); > if (info.getNormalCtor() == create_closure_capture) { > llvm::errs() << "???\n"; > } > } > llvm::PassRegistry::getPassRegistry()->registerPass(info); > } >Sorry - too less coffee (I thought I wrote != instead of == - which would be strange). Regards> With debug built it prints "???" twice. > > Regards-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131225/22cbb9a9/attachment.sig>
Maciej Piechotka
2013-Dec-30 11:07 UTC
[LLVMdev] Crash in opt.cpp:739 when loading custom pass (only on system-wide debug install of llvm)
On Wed, 2013-12-25 at 05:33 +0100, Maciej Piechotka wrote:> Hi, > > I'm trying to write custom pass. However opt started crashed in opt.cpp. > After debugging it looks like PassInf->NormalCtor points to unmapped > memory (rest of struct contains correct data about my pass) - it pointed > high in user memory (0x756e672e006e6f69). > > It happens only when I tried to install debug version of llvm > system-wide (I've check that it wasn't caused by stale .a files). When I > used the local install (via cmake to $HOME) or release it works[1]. > > My system is Gentoo, 64 bit. To bootstrap I've used gcc 4.8.2. > > Any idea what might be a cause of it (my build system is practically > copied from documentation[2])? > > Best regards > > PS. The difference seems to be in system-wide install only > optimized/assertions/expensive-checks flags (I'm using Gentoo ebuild). > > [1] The problem with local install is that it cause problems with clang > (probably because of some incompatibilities between released version > clang was compiled against and debug version it's loading) and release > version don't have debug flags support etc. > [2] http://llvm.org/docs/CMake.html#developing-llvm-pass-out-of-sourceIt looks like it was compiled with _GLIBCXX_DEBUG which changes ABI. Best regards -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131230/bf5db637/attachment.sig>
Seemingly Similar Threads
- [LLVMdev] Any way to use a pass in opt, that does not have normal constructor?
- How to include a opt pass in clang driver
- [LLVMdev] Accessing an empty machine function before instruction selection?
- How to include a opt pass in clang driver
- Where put buissness logic?