================
@@ -1950,8 +1950,22 @@ ConstantLValueEmitter::tryEmitBase(const
APValue::LValueBase &base) {
if (D->hasAttr<WeakRefAttr>())
return CGM.GetWeakRefReference(D).getPointer();
- if (auto FD = dyn_cast<FunctionDecl>(D))
- return CGM.GetAddrOfFunction(FD);
+ if (auto FD = dyn_cast<FunctionDecl>(D)) {
+ auto *C = CGM.GetAddrOfFunction(FD);
+
+ // we don't normally emit debug info for extern fns referenced via
+ // variable initialisers; BPF needs it since it generates BTF from
+ // debug info and bpftool demands BTF for every symbol linked
+ if (CGM.getTarget().getTriple().isBPF() && FD->getStorageClass() ==
SC_Extern) {
----------------
efriedma-quic wrote:
Current approach seems fine.
> Sema::ActOnEndOfTranslationUnit checks whether a declaration is used (does it
> mean referenced?)
"Used" in this context corresponds to odr-used in the C++ standard... which is
stuff that Sema thinks the code generator might need to emit. In some cases we
manage to skip actually emitting some declarations due to optimizations.
https://github.com/llvm/llvm-project/pull/91310
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits