| Issue |
233947
|
| Summary |
[BPF] CO-RE accesses into C++ template specializations
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
maxskokov
|
A CO-RE access into a template specialization crashes clang when a template argument has a qualified name, as the relocation key embeds the DI name and `generatePatchImmReloc()` splits it at colons (clang 21 terminates with `std::invalid_argument` from `stoull`):
```cpp
namespace inl { inline namespace v1 { struct t1 {}; } }
template <class T> struct S { int a, b; };
unsigned long f(S<inl::t1> *p) {
return (unsigned long)__builtin_preserve_access_index(&p->b);
}
```
Also, with #233715 the BTF names of specializations drop their template arguments (as with `-gsimple-template-names`, since released kernels only accept identifiers), so `S<int>` and `S<long>` share a name and CO-RE cannot tell them apart in a target that has both. CO-RE on template specializations should be diagnosed or given a representation that keeps their identity.
Found in review of #233715.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs