llvm error: Relocation not implemented yet! when running RxCpp in orcjit or lli
Asked Answered
W

1

6

I would like to run RxCpp example in llvm's IR interpreter lli.

Unfortunately, running any of the RxCpp examples fails in lli:

git clone https://github.com/Reactive-Extensions/RxCpp.git --depth 1
cd RxCpp/Rx/v2/examples/pythogerian
clang++ -S -emit-llvm -fno-use-cxa-exit -I../../src main.cpp 
lli main.ll

error-message:

Relocation type not implemented yet!
UNREACHABLE executed at llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp:232!

Questions:

What does this error exactly mean ? - what assumptions are made within llvm's orc-jit that are not satisfied ?

Is there a workaround ? - are there any LLVM-IR transformations i can apply to make this work(e.g. through a compiler-flag) ?

What special features is RxCpp using that cause this problem in llvm's orcjit ?

tested on:

clang version 5.0.0 (https://github.com/llvm-mirror/clang.git 6c9e299494de2a5b0425e46bc937f29a05128252) 
clang version 4.0.0-+rc1-1 (tags/RELEASE_400/rc1)
clang version 3.9.0-1 (tags/RELEASE_390/final)
clang version 3.8.1-12 (tags/RELEASE_381/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Woody answered 3/2, 2017 at 12:25 Comment(1)
you may want to mention which clang version you are using, and which platform you're on.Trothplight
W
1

Seems to be an issue with thread_local / __thread.

Replacing #define RXCPP_THREAD_LOCAL __thread in rx-utils.hpp with whitespace "fixes" this issue.

The reason is a failure in the LLVM backend as it does not support TLS yet. This is related to Bug 21431 and the fact that some relocation strategies are missing in llvm's RuntimeDyld.

Woody answered 7/2, 2017 at 18:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.