[llvm] f99eede - [MC][PowerPC] Fix a crash when redefining a symbol after .set
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 13 09:32:01 PST 2019
Author: Fangrui Song
Date: 2019-12-13T09:31:54-08:00
New Revision: f99eedeb72644671cd584f48e4c136d47f6b0020
URL: https://github.com/llvm/llvm-project/commit/f99eedeb72644671cd584f48e4c136d47f6b0020
DIFF: https://github.com/llvm/llvm-project/commit/f99eedeb72644671cd584f48e4c136d47f6b0020.diff
LOG: [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
Added:
Modified:
llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
llvm/test/MC/PowerPC/ppc64-localentry-symbols.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
index 00df9e41fdae..5e91bdb2f8de 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
@@ -201,7 +201,8 @@ class PPCTargetELFStreamer : public PPCTargetStreamer {
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 f1d5c5d0ab1a..a663af57ad45 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:
More information about the llvm-commits
mailing list