[PATCH] D70696: [DebugInfo] Support to emit debugInfo for extern variables

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 11:29:27 PST 2019


dblaikie added a comment.

In D70696#1765637 <https://reviews.llvm.org/D70696#1765637>, @probinson wrote:

> For the case:
>
>   cat def.c
>       int global_var = 2;
>
>
> def.o should have debug info for the definition of global_var.
>  For the case:
>
>   cat noref.c
>       extern int global_var;
>       int main() {}
>
>
> I would not expect to see debug info for the declaration of global_var.
>  For the case:
>
>   cat ref.c
>       extern int global_var;
>       int main() { return global_var; }
>
>
> I *do* expect to see debug info for the declaration of global_var.


FWIW I'd only expect it there with -fstandalone-debug - with -fno-standalone-debug I'd expect this code to rely on the assumption that def.c is also compiled with debug info.

(as it stands today, Clang/LLVM never produces debug info for global_var in ref.c, even with -fstandalone-debug & I'm not too fussed about that, but would be OK if someone wanted to fix/improve that)

> Does bpf require debug info for the declaration of global_var in `noref.c` ?

Yeah, +1, I'm still curious to know more/trying to understand this ^ requirement.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70696/new/

https://reviews.llvm.org/D70696





More information about the cfe-commits mailing list