mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 23:31:37 +00:00
Produce errors when an assignment expression would use a common symbol.
An assignment will produce a symbol with a given section and offset. There is no way to represent something like "1 byte after a common symbol". This matches the behavior of GNU as. Part of PR22217. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226470 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0041050116
commit
a7e4c407ad
@ -201,7 +201,17 @@ const MCSymbol *MCAsmLayout::getBaseSymbol(const MCSymbol &Symbol) const {
|
||||
if (!A)
|
||||
return nullptr;
|
||||
|
||||
return &A->getSymbol();
|
||||
const MCSymbol &ASym = A->getSymbol();
|
||||
const MCAssembler &Asm = getAssembler();
|
||||
const MCSymbolData &ASD = Asm.getSymbolData(ASym);
|
||||
if (ASD.isCommon()) {
|
||||
// FIXME: we should probably add a SMLoc to MCExpr.
|
||||
Asm.getContext().FatalError(SMLoc(),
|
||||
"Common symbol " + ASym.getName() +
|
||||
" cannot be used in assignment expr");
|
||||
}
|
||||
|
||||
return &ASym;
|
||||
}
|
||||
|
||||
uint64_t MCAsmLayout::getSectionAddressSize(const MCSectionData *SD) const {
|
||||
|
6
test/MC/ELF/common-error1.s
Normal file
6
test/MC/ELF/common-error1.s
Normal file
@ -0,0 +1,6 @@
|
||||
// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux < %s 2>&1 | FileCheck %s
|
||||
|
||||
.comm C,4,4
|
||||
.set A,C
|
||||
|
||||
// CHECK: Common symbol C cannot be used in assignment expr
|
6
test/MC/ELF/common-error2.s
Normal file
6
test/MC/ELF/common-error2.s
Normal file
@ -0,0 +1,6 @@
|
||||
// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux < %s 2>&1 | FileCheck %s
|
||||
|
||||
.set A,C
|
||||
.comm C,4,4
|
||||
|
||||
// CHECK: Common symbol C cannot be used in assignment expr
|
Loading…
x
Reference in New Issue
Block a user