summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/BPF/BTFDebug.cpp
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-03-15 17:39:10 +0000
committerYonghong Song <yhs@fb.com>2019-03-15 17:39:10 +0000
commit44ed286a2f80ba9b4d8a1b0ff84f44914915ea97 (patch)
treede410bf898b5da069af4361a31b0f18356c8e49e /llvm/lib/Target/BPF/BTFDebug.cpp
parent1cbbab9277af09f2da3f7eba7391452e8da8fe79 (diff)
downloadbcm5719-llvm-44ed286a2f80ba9b4d8a1b0ff84f44914915ea97.tar.gz
bcm5719-llvm-44ed286a2f80ba9b4d8a1b0ff84f44914915ea97.zip
[BPF] handle external global properly
Previous commit 6bc58e6d3dbd ("[BPF] do not generate unused local/global types") tried to exclude global variable from type generation. The condition is: if (Global.hasExternalLinkage()) continue; This is not right. It also excluded initialized globals. The correct condition (from AssemblyWriter::printGlobal()) is: if (!GV->hasInitializer() && GV->hasExternalLinkage()) Out << "external "; Let us do the same in BTF type generation. Also added a test for it. Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 356279
Diffstat (limited to 'llvm/lib/Target/BPF/BTFDebug.cpp')
-rw-r--r--llvm/lib/Target/BPF/BTFDebug.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 5d1d96fa4cd..d00bc015835 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -751,7 +751,7 @@ void BTFDebug::endModule() {
const Module *M = MMI->getModule();
for (const GlobalVariable &Global : M->globals()) {
// Ignore external globals for now.
- if (Global.hasExternalLinkage())
+ if (!Global.hasInitializer() && Global.hasExternalLinkage())
continue;
SmallVector<DIGlobalVariableExpression *, 1> GVs;
OpenPOWER on IntegriCloud