[PATCH] D20217: Add direct control of whether or not a symbol is preemtable at runtime

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 11:21:58 PDT 2017


sfertile added a comment.

> ! In https://reviews.llvm.org/D20217#863605, @rnk wrote:
>  This should update LangRef with a description of how this is supposed to interact with our existing linkages. For example, today we can inline external function definitions because they are not interposable according to our model. LLVM basically implements the C++ model: multiple definitions of an external linkage function would be an ODR violation, widespread usage of malloc interposition notwithstanding. You seem to be proposing to change that, because dso_local defaults to false. dso_preemptible seems to be your default.

I removed the tri-state enum after thinking about Rafaels question on what the long term goal is. If the long term goal is to have IR producers marking every GlobalValue as either local/preemptable then introducing a 'default' enum value is undesirable. I can get the same behavior by treating one of the other enum values as a default in the interim.  I picked the preemptable value to treat as 'unkown' for 2 reasons:

1. So I could use local to represent the case where we can't infer from a single compilation unit if a symbol will resolve local but do know at link time with lto Use the linker resolutions to mark global values as dso_local. <https://reviews.llvm.org/D35702>
2. If we want to support an option similar to gcc '-fsemantic-interposition' then we essentially can't mark a symbol as local by default. We must consider a function as preemptable unless we know for sure it can't be interposed.



> ! In https://reviews.llvm.org/D20217#863605, @rnk wrote:
> 
>   It seems like we could use the third state to preserve our existing behavior unless the frontend tells us otherwise.

I don't intend to change the default behavior to start considering runtime interposition, basically if we do add '-fsemantic-interposition'  then it would default to off and let users who wanted full elf interpostion semantics to opt in.

I had replied to the commits list trying to get some feedback before updating the lang-ref but never got any replies. I'll go ahead and update it with what I currently have planned and hopefully that gets the discussion moving again.


Repository:
  rL LLVM

https://reviews.llvm.org/D20217





More information about the llvm-commits mailing list