[all-commits] [llvm/llvm-project] d77ae1: [DebugInfo] Support to emit debugInfo for extern v...
yonghong-song via All-commits
all-commits at lists.llvm.org
Tue Dec 10 08:10:06 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: d77ae1552fc21a9f3877f3ed7e13d631f517c825
https://github.com/llvm/llvm-project/commit/d77ae1552fc21a9f3877f3ed7e13d631f517c825
Author: Yonghong Song <yhs at fb.com>
Date: 2019-12-10 (Tue, 10 Dec 2019)
Changed paths:
M clang/include/clang/AST/ASTConsumer.h
M clang/include/clang/Basic/TargetInfo.h
M clang/include/clang/Sema/Sema.h
M clang/lib/Basic/Targets/BPF.h
M clang/lib/CodeGen/CGDebugInfo.cpp
M clang/lib/CodeGen/CGDebugInfo.h
M clang/lib/CodeGen/CodeGenAction.cpp
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/lib/CodeGen/CodeGenModule.h
M clang/lib/CodeGen/ModuleBuilder.cpp
M clang/lib/Sema/Sema.cpp
M clang/lib/Sema/SemaDecl.cpp
A clang/test/CodeGen/debug-info-extern-basic.c
A clang/test/CodeGen/debug-info-extern-duplicate.c
A clang/test/CodeGen/debug-info-extern-multi.c
A clang/test/CodeGen/debug-info-extern-unused.c
M llvm/include/llvm/IR/DIBuilder.h
M llvm/lib/IR/DIBuilder.cpp
M llvm/lib/IR/DebugInfo.cpp
M llvm/unittests/Transforms/Utils/CloningTest.cpp
Log Message:
-----------
[DebugInfo] Support to emit debugInfo for extern variables
Extern variable usage in BPF is different from traditional
pure user space application. Recent discussion in linux bpf
mailing list has two use cases where debug info types are
required to use extern variables:
- extern types are required to have a suitable interface
in libbpf (bpf loader) to provide kernel config parameters
to bpf programs.
https://lore.kernel.org/bpf/CAEf4BzYCNo5GeVGMhp3fhysQ=_axAf=23PtwaZs-yAyafmXC9g@mail.gmail.com/T/#t
- extern types are required so kernel bpf verifier can
verify program which uses external functions more precisely.
This will make later link with actual external function no
need to reverify.
https://lore.kernel.org/bpf/87eez4odqp.fsf@toke.dk/T/#m8d5c3e87ffe7f2764e02d722cb0d8cbc136880ed
This patch added clang support to emit debuginfo for extern variables
with a TargetInfo hook to enable it. The debuginfo for the
extern variable is emitted only if that extern variable is
referenced in the current compilation unit.
Currently, only BPF target enables to generate debug info for
extern variables. The emission of such debuginfo is disabled for C++
at this moment since BPF only supports a subset of C language.
Emission with C++ can be enabled later if an appropriate use case
is identified.
-fstandalone-debug permits us to see more debuginfo with the cost
of bloated binary size. This patch did not add emission of extern
variable debug info with -fstandalone-debug. This can be
re-evaluated if there is a real need.
Differential Revision: https://reviews.llvm.org/D70696
More information about the All-commits
mailing list