summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-01-19 17:30:24 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-01-19 17:30:24 +0000
commitc569ac46ebd59ee9e6a40f2e6cb90bd83c3e1dd1 (patch)
tree957ae36e4522af50c64d32dda6cb0fad77d1ed09 /llvm/lib
parent3131e85eddb1026a9267d2998c7d5dda74e81923 (diff)
downloadbcm5719-llvm-c569ac46ebd59ee9e6a40f2e6cb90bd83c3e1dd1.tar.gz
bcm5719-llvm-c569ac46ebd59ee9e6a40f2e6cb90bd83c3e1dd1.zip
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. llvm-svn: 226470
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index e3c2443f4a2..b5b72827299 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -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 {
OpenPOWER on IntegriCloud