[llvm] [Internalize] Preserve built-in functions (PR #69216)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 21:12:40 PDT 2023


DianQK wrote:

> > > Can you add some more description of the motivation? Specifically, why doesn't the earlier referenced patch ([e06bac4](https://github.com/llvm/llvm-project/commit/e06bac4796bffed2b80649497afaadfb67d767cf)) address this issue (for the existing list of runtime libcalls)?
> > 
> > 
> > This is because rust calls the `internalizeModule` method directly when implementing LTO. https://github.com/rust-lang/rust/blob/94ba57cef4987cfc1aee063ff459bcd2ff2f3fab/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp#L1146 So I think it's appropriate to add a similar rule here. In fact here are some similar rules I mentioned in the issue. For example `__ssp_canary_word`.
> 
> Is it possible to perform this in the Rust code (e.g. I see it already adds an asan internal symbol to the preserved symbols checked in the callback it passes to internalizeModule)? My concern is that for LLVM LTO we have already done all this checking, and adding an extra search through the list of builtins for each symbol is inefficient.

Thank you for responding.
Yes, it can. I found a way to do this without having to manually maintain the list at https://github.com/rust-lang/rust/pull/113923/commits/b592f29a8e7b1f83958f429ca42947f32ec6898c.
I think that could work. I'll leave this approach in the issue when Rust's PRs merge.


https://github.com/llvm/llvm-project/pull/69216


More information about the llvm-commits mailing list