New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.35.22] Failed to run LLVM optimizations #4078

Open
pgarnero06 opened this Issue Feb 5, 2016 · 6 comments

Comments

Projects
None yet
2 participants
@pgarnero06
Copy link

pgarnero06 commented Feb 5, 2016

Hi.

I experience the following issue at link time, using version 1.35.22:
AssertionError: Failed to run llvm optimizations:

This is the log generated:
log.txt

The program I try to generate, vSomeIP, a transport implementation for automotive, is publicly available at http://git.projects.genivi.org/vSomeIP.git
This software just relies on Boost (I have used BOOST 1.59).

Boost is built using https://github.com/tee3/boost-build-emscripten.git data. I have made a modification in emscripten.jam in order to use -s USE_PTHREADS=1 compile+link option.

vSomeIP is built as is (cmake with CXX env. var. set to em++) with these small modifications:

  • source code is modified in order to remove any dependencies to boost_log (all the traces have been commented)
  • CMakeLists.txt is altered to provide -s USE_PTHREADS=1 compile option
  • the generation is done that way:
    • cmake .. -DBOOST_ROOT=...boost location...
    • make -j4 examples
    • then a manual link command is issued (see log included) => it produces the error displayed in the title of this issue

Any information is welcome.

Cheers.

Pierre

@kripken

This comment has been minimized.

Copy link
Member

kripken commented Feb 5, 2016

Stack trace looks like its casting debug info.

  1. I would make sure you rebuild everything with this version of emscripten and it's LLVM+clang. Older bitcode might confuse debug info.
  2. A build of LLVM+clang with assertions might find something.
  3. If you can provide a simple way to reproduce the problem - bitcode file plus build command - I can test locally.
@pgarnero06

This comment has been minimized.

Copy link

pgarnero06 commented Feb 6, 2016

Hi kipken,

yes, everything is generated using version 1.35.22.

I have attached a zip file containing all materials allowing to reproduce the problem (just launch ./link.sh):
reprod.zip

I am going to try to rebuild everything in debug mode to check if I could get more information.

Cheers,

Pierre

@kripken

This comment has been minimized.

Copy link
Member

kripken commented Feb 8, 2016

Thanks. Looks like the problem can be reproduced by just running llvm-link libvsomeip.so -o linked.so, that is, just tell the linker to load that one file and emit it.

Very strange. It's accessing memory at address 0 and segfaulting. This seems like it could be an LLVM bug. It would be helpful to narrow this down - I assume that file is the result of linking together others? Perhaps we can reproduce the problem on just one of them.

@pgarnero06

This comment has been minimized.

Copy link

pgarnero06 commented Feb 8, 2016

I have tried your suggestion => I have ran llvm-link individually on each .o file used to generate libvsomeip.so. Unfortunatly, the issue does not show up in this case...

@kripken

This comment has been minimized.

Copy link
Member

kripken commented Feb 8, 2016

Well, I confirmed it's a debug issue. If you run opt -strip-debug on that file, then the output can then be linked. So I guess that's a workaround for now.

We should still try to file this as an upstream bug, though.

Assertions build says

#0  0x00007ffff6be0cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff6be40d8 in __GI_abort () at abort.c:89
#2  0x00007ffff6bd9b86 in __assert_fail_base (fmt=0x7ffff6d2a830 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x60cbc0 "Val && \"isa<> used on a null pointer\"", 
    file=file@entry=0x60cb58 "/media/alon/2f9a30d7-6124-42d9-87c5-3c80cb70ec54/home/alon/Dev/fastcomp/include/llvm/Support/Casting.h", line=line@entry=95, 
    function=function@entry=0x643980 <llvm::isa_impl_cl<llvm::DISubprogram, llvm::DIScope const*>::doit(llvm::DIScope const*)::__PRETTY_FUNCTION__> "static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::DISubprogram; From = llvm::DIScope]") at assert.c:92
#3  0x00007ffff6bd9c32 in __GI___assert_fail (assertion=0x60cbc0 "Val && \"isa<> used on a null pointer\"", 
    file=0x60cb58 "/media/alon/2f9a30d7-6124-42d9-87c5-3c80cb70ec54/home/alon/Dev/fastcomp/include/llvm/Support/Casting.h", line=95, 
    function=0x643980 <llvm::isa_impl_cl<llvm::DISubprogram, llvm::DIScope const*>::doit(llvm::DIScope const*)::__PRETTY_FUNCTION__> "static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::DISubprogram; From = llvm::DIScope]") at assert.c:101
#4  0x00000000004b0ebe in (anonymous namespace)::IRLinker::findNeededSubprograms(llvm::ValueMap<llvm::Value const*, llvm::WeakVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false> > >&) ()
#5  0x00000000004b3bb0 in llvm::IRMover::move(llvm::Module&, llvm::ArrayRef<llvm::GlobalValue*>, std::function<void (llvm::GlobalValue&, std::function<void (llvm::GlobalValue&)>)>, llvm::DenseMap<unsigned int, llvm::MDNode*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, llvm::MDNode*> >*, bool) ()
#6  0x00000000004bbe17 in (anonymous namespace)::ModuleLinker::run() ()
#7  0x00000000004bc997 in llvm::Linker::linkInModule(std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >, unsigned int, llvm::FunctionInfoIndex const*, llvm::DenseSet<llvm::GlobalValue const*, llvm::DenseMapInfo<llvm::GlobalValue const*> >*, llvm::DenseMap<unsigned int, llvm::MDNode*, llvm::DenseMapInfo<unsigned int>, llvm::detail::DenseMapPair<unsigned int, llvm::MDNode*> >*) ()
#8  0x000000000041148e in linkFiles(char const*, llvm::LLVMContext&, llvm::Linker&, llvm::cl::list<std::string, bool, llvm::cl::parser<std::string> > const&, unsigned int) ()
#9  0x000000000040c13e in main ()
@kripken

This comment has been minimized.

Copy link
Member

kripken commented Feb 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment