Code prefetch targets should override the fallback symbols for weak symbols.
Open
new issue
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Today for code prefetching, we emit a weak fallback symbol after the prefetch instruction if the function is not defined in the same module. This ensures that even if the target is undefined, the prefetch site gets resolved to the next instruction address.
The problem arises when the actual prefetch target is also of weak linkage (because of the enclosing function being weak). In this case, the linker picks the symbol arbitrarily, while we should prioritize the actual prefetch target over the fallback.
I am proposing to use the `st_other` field to convey the fallback semantics to the linker. This requires some small linker change.
Contributor guide
Assessment
This issue has not been assessed yet.