Issue 107487
Summary Confusion regarding ThinLTO for CFI checks
Labels new issue
Assignees
Reporter abhisen7
    Hi, I am enabling CFI for our project. I was testing it over the last few days, by passing the relevant CFI schemes along with the LTO flags `-flto=thin -fsplit-lto-unit` directly at the compiler level (`clang-15`). The project compiled fine, and I could see a bump in the link time, expectedly so due to the linker running its optimization pipeline. 

But now I suddenly realise, that we have a separate linker flag set in the CMake file. We use `ld.lld-*` for linking, and I am now wondering if I should also pass  `-flto=thin -fsplit-lto-unit` to the linker to enable CFI accurately. 

**Note**- We statically link all our libraries except for the obvious ones (e.g. `libstdc++`) 

I checked your [latest](https://clang.llvm.org/docs/ThinLTO.html#linkers) doc. and there was no mention about this, so I am really confused now whether CFI is actually enabled or not?

Nevertheless, I tested by passing the LTO flags to linker, and ran into an expected error due to using `objcopy` in a child CMake for renaming some symbol conflicts in static library file. I updated that to `llvm-objcopy-15` hoping it'd work,  but surprisingly, it does not work on LLVM IR bitcode files (compiled with LTO). 

Please help me to understand how to approach here with proper CFI enablement.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to