llvm / llvm/llvm-project

Code prefetch targets should override the fallback symbols for weak symbols.

Open
#200,246 5 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.