[all-commits] [llvm/llvm-project] e6f763: EntryExitInstrumenter: skip available_externally l...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Jan 3 09:25:29 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e6f76378c20bebec85f66c1574bb6bb928a79025
https://github.com/llvm/llvm-project/commit/e6f76378c20bebec85f66c1574bb6bb928a79025
Author: Fangrui Song <i at maskray.me>
Date: 2025-01-03 (Fri, 03 Jan 2025)
Changed paths:
M llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
M llvm/test/Transforms/EntryExitInstrumenter/mcount.ll
Log Message:
-----------
EntryExitInstrumenter: skip available_externally linkage
gnu::always_inline functions, which lower to available_externally, may
not have definitions external to the module. -finstrument-function
family options instrumentating the function (which takes the function
address) may lead to a linker error if the function is not optimized
out, e.g.
```
// -std=c++17 or above with libstdc++
#include <string>
std::string str;
int main() {}
```
Simplified reproduce:
```
template <typename T>
struct A {
[[gnu::always_inline]] T bar(T a) { return a * 2; }
};
extern template class A<int>;
int main(int argc, char **argv) {
return A<int>().bar(argc);
}
```
GCC's -finstrument-function instrumentation skips such functions
(https://gcc.gnu.org/PR78333). Let's skip such functions
(available_externally) as well.
Fix #50742
Pull Request: https://github.com/llvm/llvm-project/pull/121452
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list