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

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 09:04:32 PDT 2023


teresajohnson 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.

> 
> > Also, this patch seems to have 2 aspects, where the second is to expand the list of runtime libcalls. Can you give some more background on that aspect of the change?
> 
> Newly added built-in functions are also internalized as a result of participation in LTO. I'm sorry I'm not really sure what additional impact the extended list will have.

I'd suggest splitting this part into its own patch since it is orthogonal to the main functionality change (although as mentioned above I would prefer the checking be moved into the caller to avoid duplication).



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


More information about the llvm-commits mailing list