[llvm-dev] llvm CFI seems not work well when compiling for a shared object and errors were reported during link time
陈凯翔 via llvm-dev
llvm-dev at lists.llvm.org
Tue Jul 23 01:08:00 PDT 2019
When I try to protect both main binary and shared objects using llvm cfi, I
firstly build a CFI protected shared object as blow:
clang++ -fsanitize=cfi -fvisibility=hidden -flto -fPIC -shared
./sharedobjsrc.cpp -o libsharedobj.so
Then I can assume
"Calls inside any instrumented DSO are fully protected."
In the next step, I try to compile the main.cpp, and dynamically link
main.o with libsharedobj.so. By no means can I succeed with command like
that:
clang++ -fsanitize=cfi -fvisibility=hidden -flto
-fsanitize-cfi-cross-dso ./main.cpp
./libsharedobj.so -o target -Wl,-rpath,./
report like: ld-temp.o:function main.cfi: error: undefined reference to
'functionname()’ returns to screen
Even if I trace the instructions line by line according to
https://github.com/llvm-mirror/compiler-rt/tree/master/test/cfi/cross-dso,
I failed to manage it.
You can reproduce my operations with my attachment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190723/5a93f18f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attachment.zip
Type: application/zip
Size: 2197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190723/5a93f18f/attachment.zip>
More information about the llvm-dev
mailing list