atrosinenko wrote: I experimented with `-fno-plt` a bit more and still unsure I clearly understand the "ideal" behavior we would like to achieve.
@oskarwirga To simplify the review, could you please clarify the specific goals and non-goals of this PR in its current form? * Do we want GlobalISel and DAGISel to behave _identically_? If so, do we also want FastISel to behave the same way? * Does the updated title "Call nonlazybind functions directly when possible" mean the intention is to omit GOT load when possible? Or does "direct" mean the ultimate goal is to omit _both_ indirection via GOT and GOT-PLT (i.e. is this the known performance / code size regression we want to solve)? * Is pointer authentication in scope of this PR? (I guess, we might want to move PtrAuth-related work to #242028) * Are "external symbols" in scope of this PR on non-ELF platforms? As far as I understand (based on what I see in #78890), they might be used for libcalls such as `memset` and various helpers from `libgcc`/`compiler-rt` (at least, on ELF platforms when `RtLibUseGOT` module flag is set). I guess, they should be in-scope on ELF platforms, but I'm not sure they are actually used with Mach-O and COFF. Whatever the answer is, it's probably better to mention it explicitly, I think. Considering PtrAuth, the PR description mentions the instruction sequences like this: ``` adrp x17 add x17 ldr x16, [x17] braa x16, x17 ``` Is this example in sync with the current patch? (Possibly, #242028 might be a better place to discuss this) --- Just in case, here is a summary of how I currently see `nonlazybind` attribute. 46e36f0953aabb5e5cd00ed8d296d60f9f71b424 disabled generation of GOT load on AArch64 for `nonlazybind` callees by default (effectively disabling `nonlazybind` on AArch64 altogether, if I got it right). _Possibly, the reason was that Objective-C frontend produced this attribute for several library functions on every target, but on AArch64 it actually decreases the efficiency._ Later, in #78275 there was discussed a program that relies on the low-level behavior of `-fno-plt` -- then, handling of `nonlazybind` was made mandatory on ELF platforms by #78890. Therefore, `nonlazybind` seems to be not a hint but a requirement on ELF platforms. However, I'm not sure this applies to Mach-O and COFF, as `-fno-plt` doesn't seem to be supported on Mach-O (and probably anywhere except ELF). The [LLVM IR Reference](https://llvm.org/docs/LangRef.html) doesn't mention `nonlazybind` as being merely a hint, but I'm not sure if explicit guarantees were intended. Furthermore, both DAGISel and GlobalISel might have two separate code paths: one for handling regular callees and another one for "external symbols", the latter lacking a full-fledged `Function` as the callee and being controlled by an `RtLibUseGOT` module flag on ELF platforms. https://github.com/llvm/llvm-project/pull/188638 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
