MaskRay added a comment. (Sorry for my belated response.)
If we make ThinLTO properly track combined the address-taken property, and combine precise `addressTaken` and `VisibleToRegularObj`, it seems that we can use this condition to decide whether ENDBR is needed with an appropriate code model: `F.hasAddressTaken() || (!F.hasLocalLinkage() && (VisibleToRegularObj || !F.hasHiddenVisibility()))` (For AArch64, even an local linkage symbol may be reached by a range extension thunk. For x86-64 we can rule out range extension thunks, but there is a caution, as internally I know pending feature requests to use range extension thunks even for small code model to decrease relocation overflow pressure.) Then we don't even need another compiler option like `-mibt-seal`. The Linux kernel `Makefile` uses `-fvisibility=hidden` for Clang LTO. I think it can use `-fvisibility=hidden` for non-LTO as well, if it doesn't have dynamic linking semantics. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138337/new/ https://reviews.llvm.org/D138337 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits