[PATCH] D131628: [LangRef] Add description for nocallback attribute

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 08:06:38 PDT 2022


nlopes added a comment.

In D131628#3724731 <https://reviews.llvm.org/D131628#3724731>, @gulfem wrote:

>> That shows the linker already drops the nocallback attribute. However, it seems the linker only drops the attribute when linking in the definition. But I don't think this is sufficient. nocallback means you don't call any function in that file. Once you bring in more functions you can't ensure you won't call those extra functions. You'll get the call graph potentially wrong.
>
> I don't think `nocallback` means you don't call any function in that file. Functions with `leaf` attributes can still call other functions, even functions in other translation units based on GCC spec.
>
>   Leaf functions might still call functions from other compilation units and thus they are not necessarily leaf in the sense that they contain no function calls at all. 
>
> Are we on the same page on that?

They can call functions on other translation units. But the problem is when you merge translation units. What was a fine call before, may not be anymore after linking. Before linking. the leaf function would call a callback from another file (which is ok), after linking it suddenly calls a callback in the same file (not ok).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131628/new/

https://reviews.llvm.org/D131628



More information about the llvm-commits mailing list