summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-12-12 16:18:57 -0800
committerFangrui Song <maskray@google.com>2019-12-13 09:31:54 -0800
commitf99eedeb72644671cd584f48e4c136d47f6b0020 (patch)
treef96a25e31a3eabc8405bd7bb94e4b09747e9aac4
parenta2cd4600ec6710f3218f071128e2a81edd23a2b2 (diff)
downloadbcm5719-llvm-f99eedeb72644671cd584f48e4c136d47f6b0020.tar.gz
bcm5719-llvm-f99eedeb72644671cd584f48e4c136d47f6b0020.zip
[MC][PowerPC] Fix a crash when redefining a symbol after .set
Fix PR44284. This is probably not valid assembly but we should not crash. Reviewed By: luporl, #powerpc, steven.zhang Differential Revision: https://reviews.llvm.org/D71443
-rw-r--r--llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp3
-rw-r--r--llvm/test/MC/PowerPC/ppc64-localentry-symbols.s5
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
index 00df9e41fda..5e91bdb2f8d 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
@@ -201,7 +201,8 @@ public:
void finish() override {
for (auto *Sym : UpdateOther)
- copyLocalEntry(Sym, Sym->getVariableValue());
+ if (Sym->isVariable())
+ copyLocalEntry(Sym, Sym->getVariableValue());
}
private:
diff --git a/llvm/test/MC/PowerPC/ppc64-localentry-symbols.s b/llvm/test/MC/PowerPC/ppc64-localentry-symbols.s
index f1d5c5d0ab1..a663af57ad4 100644
--- a/llvm/test/MC/PowerPC/ppc64-localentry-symbols.s
+++ b/llvm/test/MC/PowerPC/ppc64-localentry-symbols.s
@@ -32,3 +32,8 @@ func:
nop
nop
.localentry func, 8
+
+## PR44284 Don't crash if err is redefined after .set
+.set err, _err
+.globl err
+err:
OpenPOWER on IntegriCloud