<div dir="ltr">And it again breaks something for us. I assume, it's also related to aliases, but it will take some time to figure out what exactly.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 18, 2014 at 9:40 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Tue Mar 18 15:40:38 2014<br>
New Revision: 204178<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204178&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=204178&view=rev</a><br>
Log:<br>
Add back r203962, r204028 and r204059.<br>
<br>
This reverts commit r204137.<br>
<br>
This includes a fix for handling aliases of aliases.<br>
<br>
Added:<br>
llvm/trunk/test/MC/ARM/thumb_set-diagnostics.s<br>
llvm/trunk/test/MC/ARM/thumb_set.s<br>
llvm/trunk/test/MC/ELF/offset.s<br>
Modified:<br>
llvm/trunk/include/llvm/MC/MCSymbol.h<br>
llvm/trunk/lib/MC/ELFObjectWriter.cpp<br>
llvm/trunk/lib/MC/MCSymbol.cpp<br>
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/MC/MCSymbol.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=204178&r1=204177&r2=204178&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbol.h?rev=204178&r1=204177&r2=204178&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/MC/MCSymbol.h (original)<br>
+++ llvm/trunk/include/llvm/MC/MCSymbol.h Tue Mar 18 15:40:38 2014<br>
@@ -18,6 +18,7 @@<br>
#include "llvm/Support/Compiler.h"<br>
<br>
namespace llvm {<br>
+ class MCAsmLayout;<br>
class MCExpr;<br>
class MCSection;<br>
class MCContext;<br>
@@ -145,6 +146,11 @@ namespace llvm {<br>
// itself.<br>
const MCSymbol &AliasedSymbol() const;<br>
<br>
+ // If this symbol is not a variable, return itself. If it is a variable,<br>
+ // evaluate it and check if it is of the form Base + ConstantOffset. If so,<br>
+ // return Base, if not, return nullptr.<br>
+ const MCSymbol *getBaseSymbol(const MCAsmLayout &Layout) const;<br>
+<br>
void setVariableValue(const MCExpr *Value);<br>
<br>
/// @}<br>
<br>
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=204178&r1=204177&r2=204178&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=204178&r1=204177&r2=204178&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)<br>
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Mar 18 15:40:38 2014<br>
@@ -271,6 +271,7 @@ class ELFObjectWriter : public MCObjectW<br>
/// \param RevGroupMap - Maps a signature symbol to the group section.<br>
/// \param NumRegularSections - Number of non-relocation sections.<br>
void ComputeSymbolTable(MCAssembler &Asm,<br>
+ const MCAsmLayout &Layout,<br>
const SectionIndexMapTy &SectionIndexMap,<br>
RevGroupMapTy RevGroupMap,<br>
unsigned NumRegularSections);<br>
@@ -462,33 +463,47 @@ void ELFObjectWriter::WriteSymbolEntry(M<br>
}<br>
}<br>
<br>
-uint64_t ELFObjectWriter::SymbolValue(MCSymbolData &Data,<br>
+uint64_t ELFObjectWriter::SymbolValue(MCSymbolData &OrigData,<br>
const MCAsmLayout &Layout) {<br>
- if (Data.isCommon() && Data.isExternal())<br>
- return Data.getCommonAlignment();<br>
-<br>
- const MCSymbol &Symbol = Data.getSymbol();<br>
+ MCSymbolData *Data = &OrigData;<br>
+ if (Data->isCommon() && Data->isExternal())<br>
+ return Data->getCommonAlignment();<br>
+<br>
+ const MCSymbol *Symbol = &Data->getSymbol();<br>
+ const bool IsThumbFunc = OrigData.getFlags() & ELF_Other_ThumbFunc;<br>
+<br>
+ uint64_t Res = 0;<br>
+ if (Symbol->isVariable()) {<br>
+ const MCExpr *Expr = Symbol->getVariableValue();<br>
+ MCValue Value;<br>
+ if (!Expr->EvaluateAsRelocatable(Value, &Layout))<br>
+ return 0;<br>
+ if (Value.getSymB())<br>
+ return 0;<br>
+<br>
+ Res = Value.getConstant();<br>
+ if (IsThumbFunc)<br>
+ Res |= 1;<br>
+<br>
+ const MCSymbolRefExpr *A = Value.getSymA();<br>
+ if (!A)<br>
+ return Res;<br>
<br>
- if (Symbol.isAbsolute() && Symbol.isVariable()) {<br>
- if (const MCExpr *Value = Symbol.getVariableValue()) {<br>
- int64_t IntValue;<br>
- if (Value->EvaluateAsAbsolute(IntValue, Layout))<br>
- return (uint64_t)IntValue;<br>
- }<br>
+ Symbol = &A->getSymbol();<br>
+ Data = &Layout.getAssembler().getSymbolData(*Symbol);<br>
}<br>
<br>
- if (!Symbol.isInSection())<br>
+ if (!Symbol->isInSection())<br>
return 0;<br>
<br>
+ if (!Data->getFragment())<br>
+ return 0;<br>
<br>
- if (Data.getFragment()) {<br>
- if (Data.getFlags() & ELF_Other_ThumbFunc)<br>
- return Layout.getSymbolOffset(&Data)+1;<br>
- else<br>
- return Layout.getSymbolOffset(&Data);<br>
- }<br>
+ Res += Layout.getSymbolOffset(Data);<br>
+ if (IsThumbFunc || Data->getFlags() & ELF_Other_ThumbFunc)<br>
+ Res |= 1;<br>
<br>
- return 0;<br>
+ return Res;<br>
}<br>
<br>
void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,<br>
@@ -569,8 +584,9 @@ void ELFObjectWriter::WriteSymbol(MCData<br>
ELFSymbolData &MSD,<br>
const MCAsmLayout &Layout) {<br>
MCSymbolData &OrigData = *MSD.SymbolData;<br>
- MCSymbolData &Data =<br>
- Layout.getAssembler().getSymbolData(OrigData.getSymbol().AliasedSymbol());<br>
+ const MCSymbol *Base = OrigData.getSymbol().getBaseSymbol(Layout);<br>
+ const MCSymbolData &Data =<br>
+ Base ? Layout.getAssembler().getSymbolData(*Base) : OrigData;<br>
<br>
bool IsReserved = Data.isCommon() || Data.getSymbol().isAbsolute() ||<br>
Data.getSymbol().isVariable();<br>
@@ -578,6 +594,8 @@ void ELFObjectWriter::WriteSymbol(MCData<br>
// Binding and Type share the same byte as upper and lower nibbles<br>
uint8_t Binding = MCELF::GetBinding(OrigData);<br>
uint8_t Type = mergeTypeForSet(MCELF::GetType(OrigData), MCELF::GetType(Data));<br>
+ if (OrigData.getFlags() & ELF_Other_ThumbFunc)<br>
+ Type = ELF::STT_FUNC;<br>
uint8_t Info = (Binding << ELF_STB_Shift) | (Type << ELF_STT_Shift);<br>
<br>
// Other and Visibility share the same byte with Visibility using the lower<br>
@@ -586,7 +604,7 @@ void ELFObjectWriter::WriteSymbol(MCData<br>
uint8_t Other = MCELF::getOther(OrigData) << (ELF_STO_Shift - ELF_STV_Shift);<br>
Other |= Visibility;<br>
<br>
- uint64_t Value = SymbolValue(Data, Layout);<br>
+ uint64_t Value = SymbolValue(OrigData, Layout);<br>
uint64_t Size = 0;<br>
<br>
assert(!(Data.isCommon() && !Data.isExternal()));<br>
@@ -897,10 +915,11 @@ void ELFObjectWriter::ComputeIndexMap(MC<br>
}<br>
}<br>
<br>
-void ELFObjectWriter::ComputeSymbolTable(MCAssembler &Asm,<br>
- const SectionIndexMapTy &SectionIndexMap,<br>
- RevGroupMapTy RevGroupMap,<br>
- unsigned NumRegularSections) {<br>
+void<br>
+ELFObjectWriter::ComputeSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout,<br>
+ const SectionIndexMapTy &SectionIndexMap,<br>
+ RevGroupMapTy RevGroupMap,<br>
+ unsigned NumRegularSections) {<br>
// FIXME: Is this the correct place to do this?<br>
// FIXME: Why is an undefined reference to _GLOBAL_OFFSET_TABLE_ needed?<br>
if (NeedsGOT) {<br>
@@ -948,33 +967,33 @@ void ELFObjectWriter::ComputeSymbolTable<br>
<br>
ELFSymbolData MSD;<br>
MSD.SymbolData = it;<br>
- const MCSymbol &RefSymbol = Symbol.AliasedSymbol();<br>
+ const MCSymbol *BaseSymbol = Symbol.getBaseSymbol(Layout);<br>
<br>
// Undefined symbols are global, but this is the first place we<br>
// are able to set it.<br>
bool Local = isLocal(*it, isSignature, Used);<br>
if (!Local && MCELF::GetBinding(*it) == ELF::STB_LOCAL) {<br>
- MCSymbolData &SD = Asm.getSymbolData(RefSymbol);<br>
+ assert(BaseSymbol);<br>
+ MCSymbolData &SD = Asm.getSymbolData(*BaseSymbol);<br>
MCELF::SetBinding(*it, ELF::STB_GLOBAL);<br>
MCELF::SetBinding(SD, ELF::STB_GLOBAL);<br>
}<br>
<br>
- if (RefSymbol.isUndefined() && !Used && WeakrefUsed)<br>
- MCELF::SetBinding(*it, ELF::STB_WEAK);<br>
-<br>
- if (it->isCommon()) {<br>
+ if (!BaseSymbol) {<br>
+ MSD.SectionIndex = ELF::SHN_ABS;<br>
+ } else if (it->isCommon()) {<br>
assert(!Local);<br>
MSD.SectionIndex = ELF::SHN_COMMON;<br>
- } else if (Symbol.isAbsolute() || RefSymbol.isVariable()) {<br>
- MSD.SectionIndex = ELF::SHN_ABS;<br>
- } else if (RefSymbol.isUndefined()) {<br>
+ } else if (BaseSymbol->isUndefined()) {<br>
if (isSignature && !Used)<br>
MSD.SectionIndex = SectionIndexMap.lookup(RevGroupMap[&Symbol]);<br>
else<br>
MSD.SectionIndex = ELF::SHN_UNDEF;<br>
+ if (!Used && WeakrefUsed)<br>
+ MCELF::SetBinding(*it, ELF::STB_WEAK);<br>
} else {<br>
const MCSectionELF &Section =<br>
- static_cast<const MCSectionELF&>(RefSymbol.getSection());<br>
+ static_cast<const MCSectionELF&>(BaseSymbol->getSection());<br>
MSD.SectionIndex = SectionIndexMap.lookup(&Section);<br>
if (MSD.SectionIndex >= ELF::SHN_LORESERVE)<br>
NeedsSymtabShndx = true;<br>
@@ -1560,8 +1579,8 @@ void ELFObjectWriter::WriteObject(MCAsse<br>
unsigned NumRegularSections = NumUserSections + NumIndexedSections;<br>
<br>
// Compute symbol table information.<br>
- ComputeSymbolTable(Asm, SectionIndexMap, RevGroupMap, NumRegularSections);<br>
-<br>
+ ComputeSymbolTable(Asm, Layout, SectionIndexMap, RevGroupMap,<br>
+ NumRegularSections);<br>
<br>
WriteRelocations(Asm, const_cast<MCAsmLayout&>(Layout), RelMap);<br>
<br>
<br>
Modified: llvm/trunk/lib/MC/MCSymbol.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=204178&r1=204177&r2=204178&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbol.cpp?rev=204178&r1=204177&r2=204178&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCSymbol.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCSymbol.cpp Tue Mar 18 15:40:38 2014<br>
@@ -9,6 +9,7 @@<br>
<br>
#include "llvm/MC/MCSymbol.h"<br>
#include "llvm/MC/MCExpr.h"<br>
+#include "llvm/MC/MCValue.h"<br>
#include "llvm/Support/Debug.h"<br>
#include "llvm/Support/raw_ostream.h"<br>
using namespace llvm;<br>
@@ -51,6 +52,27 @@ const MCSymbol &MCSymbol::AliasedSymbol(<br>
return *S;<br>
}<br>
<br>
+const MCSymbol *MCSymbol::getBaseSymbol(const MCAsmLayout &Layout) const {<br>
+ // FIXME: shouldn't EvaluateAsRelocatable be responsible for following as many<br>
+ // variables as possible?<br>
+<br>
+ const MCSymbol *S = this;<br>
+ while (S->isVariable()) {<br>
+ const MCExpr *Expr = S->getVariableValue();<br>
+ MCValue Value;<br>
+ if (!Expr->EvaluateAsRelocatable(Value, &Layout))<br>
+ return nullptr;<br>
+<br>
+ if (Value.getSymB())<br>
+ return nullptr;<br>
+ const MCSymbolRefExpr *A = Value.getSymA();<br>
+ if (!A)<br>
+ return nullptr;<br>
+ S = &A->getSymbol();<br>
+ }<br>
+ return S;<br>
+}<br>
+<br>
void MCSymbol::setVariableValue(const MCExpr *Value) {<br>
assert(!IsUsed && "Cannot set a variable that has already been used.");<br>
assert(Value && "Invalid variable value!");<br>
<br>
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=204178&r1=204177&r2=204178&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=204178&r1=204177&r2=204178&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)<br>
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Tue Mar 18 15:40:38 2014<br>
@@ -30,6 +30,7 @@<br>
#include "llvm/MC/MCInst.h"<br>
#include "llvm/MC/MCInstrDesc.h"<br>
#include "llvm/MC/MCInstrInfo.h"<br>
+#include "llvm/MC/MCObjectFileInfo.h"<br>
#include "llvm/MC/MCParser/MCAsmLexer.h"<br>
#include "llvm/MC/MCParser/MCAsmParser.h"<br>
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"<br>
@@ -41,6 +42,7 @@<br>
#include "llvm/MC/MCTargetAsmParser.h"<br>
#include "llvm/Support/ARMBuildAttributes.h"<br>
#include "llvm/Support/ARMEHABI.h"<br>
+#include "llvm/Support/COFF.h"<br>
#include "llvm/Support/Debug.h"<br>
#include "llvm/Support/ELF.h"<br>
#include "llvm/Support/MathExtras.h"<br>
@@ -229,6 +231,7 @@ class ARMAsmParser : public MCTargetAsmP<br>
bool parseDirectiveObjectArch(SMLoc L);<br>
bool parseDirectiveArchExtension(SMLoc L);<br>
bool parseDirectiveAlign(SMLoc L);<br>
+ bool parseDirectiveThumbSet(SMLoc L);<br>
<br>
StringRef splitMnemonic(StringRef Mnemonic, unsigned &PredicationCode,<br>
bool &CarrySetting, unsigned &ProcessorIMod,<br>
@@ -8030,6 +8033,8 @@ bool ARMAsmParser::ParseDirective(AsmTok<br>
return parseDirectiveArchExtension(DirectiveID.getLoc());<br>
else if (IDVal == ".align")<br>
return parseDirectiveAlign(DirectiveID.getLoc());<br>
+ else if (IDVal == ".thumb_set")<br>
+ return parseDirectiveThumbSet(DirectiveID.getLoc());<br>
return true;<br>
}<br>
<br>
@@ -9086,6 +9091,71 @@ bool ARMAsmParser::parseDirectiveAlign(S<br>
<br>
return false;<br>
}<br>
+<br>
+/// parseDirectiveThumbSet<br>
+/// ::= .thumb_set name, value<br>
+bool ARMAsmParser::parseDirectiveThumbSet(SMLoc L) {<br>
+ StringRef Name;<br>
+ if (Parser.parseIdentifier(Name)) {<br>
+ TokError("expected identifier after '.thumb_set'");<br>
+ Parser.eatToEndOfStatement();<br>
+ return false;<br>
+ }<br>
+<br>
+ if (getLexer().isNot(AsmToken::Comma)) {<br>
+ TokError("expected comma after name '" + Name + "'");<br>
+ Parser.eatToEndOfStatement();<br>
+ return false;<br>
+ }<br>
+ Lex();<br>
+<br>
+ const MCExpr *Value;<br>
+ if (Parser.parseExpression(Value)) {<br>
+ TokError("missing expression");<br>
+ Parser.eatToEndOfStatement();<br>
+ return false;<br>
+ }<br>
+<br>
+ if (getLexer().isNot(AsmToken::EndOfStatement)) {<br>
+ TokError("unexpected token");<br>
+ Parser.eatToEndOfStatement();<br>
+ return false;<br>
+ }<br>
+ Lex();<br>
+<br>
+ MCSymbol *Alias = getContext().GetOrCreateSymbol(Name);<br>
+ if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(Value)) {<br>
+ MCSymbol *Sym = getContext().LookupSymbol(SRE->getSymbol().getName());<br>
+ if (!Sym->isDefined()) {<br>
+ getStreamer().EmitSymbolAttribute(Sym, MCSA_Global);<br>
+ getStreamer().EmitAssignment(Alias, Value);<br>
+ return false;<br>
+ }<br>
+<br>
+ const MCObjectFileInfo::Environment Format =<br>
+ getContext().getObjectFileInfo()->getObjectFileType();<br>
+ switch (Format) {<br>
+ case MCObjectFileInfo::IsCOFF: {<br>
+ char Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT;<br>
+ getStreamer().EmitCOFFSymbolType(Type);<br>
+ // .set values are always local in COFF<br>
+ getStreamer().EmitSymbolAttribute(Alias, MCSA_Local);<br>
+ break;<br>
+ }<br>
+ case MCObjectFileInfo::IsELF:<br>
+ getStreamer().EmitSymbolAttribute(Alias, MCSA_ELF_TypeFunction);<br>
+ break;<br>
+ case MCObjectFileInfo::IsMachO:<br>
+ break;<br>
+ }<br>
+ }<br>
+<br>
+ // FIXME: set the function as being a thumb function via the assembler<br>
+ getStreamer().EmitThumbFunc(Alias);<br>
+ getStreamer().EmitAssignment(Alias, Value);<br>
+<br>
+ return false;<br>
+}<br>
<br>
/// Force static initialization.<br>
extern "C" void LLVMInitializeARMAsmParser() {<br>
<br>
Added: llvm/trunk/test/MC/ARM/thumb_set-diagnostics.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb_set-diagnostics.s?rev=204178&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb_set-diagnostics.s?rev=204178&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb_set-diagnostics.s (added)<br>
+++ llvm/trunk/test/MC/ARM/thumb_set-diagnostics.s Tue Mar 18 15:40:38 2014<br>
@@ -0,0 +1,43 @@<br>
+@ RUN: not llvm-mc -triple armv7-eabi -o /dev/null 2>&1 %s | FileCheck %s<br>
+<br>
+ .syntax unified<br>
+<br>
+ .thumb<br>
+<br>
+ .thumb_set<br>
+<br>
+@ CHECK: error: expected identifier after '.thumb_set'<br>
+@ CHECK: .thumb_set<br>
+@ CHECL: ^<br>
+<br>
+ .thumb_set ., 0x0b5e55ed<br>
+<br>
+@ CHECK: error: expected identifier after '.thumb_set'<br>
+@ CHECK: .thumb_set ., 0x0b5e55ed<br>
+@ CHECK: ^<br>
+<br>
+ .thumb_set labelled, 0x1abe11ed<br>
+ .thumb_set invalid, :lower16:labelled<br>
+<br>
+@ CHECK: error: unknown token in expression<br>
+@ CHECK: .thumb_set invalid, :lower16:labelled<br>
+@ CHECK: ^<br>
+<br>
+ .thumb_set missing_comma<br>
+<br>
+@ CHECK: error: expected comma after name 'missing_comma'<br>
+@ CHECK: .thumb_set missing_comma<br>
+@ CHECK: ^<br>
+<br>
+ .thumb_set missing_expression,<br>
+<br>
+@ CHECK: error: missing expression<br>
+@ CHECK: .thumb_set missing_expression,<br>
+@ CHECK: ^<br>
+<br>
+ .thumb_set trailer_trash, 0x11fe1e55,<br>
+<br>
+@ CHECK: error: unexpected token<br>
+@ CHECK: .thumb_set trailer_trash, 0x11fe1e55,<br>
+@ CHECK: ^<br>
+<br>
<br>
Added: llvm/trunk/test/MC/ARM/thumb_set.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb_set.s?rev=204178&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb_set.s?rev=204178&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ARM/thumb_set.s (added)<br>
+++ llvm/trunk/test/MC/ARM/thumb_set.s Tue Mar 18 15:40:38 2014<br>
@@ -0,0 +1,140 @@<br>
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s | llvm-readobj -t \<br>
+@ RUN: | FileCheck %s<br>
+<br>
+ .syntax unified<br>
+<br>
+ .arm<br>
+<br>
+ .type arm_func,%function<br>
+arm_func:<br>
+ nop<br>
+<br>
+ .thumb_set alias_arm_func, arm_func<br>
+<br>
+ .thumb<br>
+<br>
+ .type thumb_func,%function<br>
+ .thumb_func<br>
+thumb_func:<br>
+ nop<br>
+<br>
+ .thumb_set alias_thumb_func, thumb_func<br>
+<br>
+ .thumb_set seedless, 0x5eed1e55<br>
+ .thumb_set eggsalad, seedless + 0x87788358<br>
+ .thumb_set faceless, ~eggsalad + 0xe133c002<br>
+<br>
+ .thumb_set alias_undefined_data, badblood<br>
+<br>
+ .data<br>
+<br>
+ .type badblood,%object<br>
+badblood:<br>
+ .long 0xbadb100d<br>
+<br>
+ .type bedazzle,%object<br>
+bedazzle:<br>
+ .long 0xbeda221e<br>
+<br>
+ .text<br>
+ .thumb<br>
+<br>
+ .thumb_set alias_defined_data, bedazzle<br>
+<br>
+ .type alpha,%function<br>
+alpha:<br>
+ nop<br>
+<br>
+ .type beta,%function<br>
+beta:<br>
+ bkpt<br>
+<br>
+ .thumb_set beta, alpha<br>
+<br>
+ .thumb_set alias_undefined, undefined<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: alias_arm_func<br>
+@ CHECK: Value: 0x1<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: alias_defined_data<br>
+@ CHECK: Value: 0x5<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: alias_thumb_func<br>
+@ CHECK: Value: 0x5<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: alias_undefined_data<br>
+@ CHECK: Value: 0x0<br>
+@ CHECK: Type: Object<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: alpha<br>
+@ CHECK: Value: 0x6<br>
+@ XFAIL-CHECK: Value: 0x7<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: arm_func<br>
+@ CHECK: Value: 0x0<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: bedazzle<br>
+@ CHECK: Value: 0x4<br>
+@ CHECK: Type: Object<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: beta<br>
+@ CHECK: Value: 0x7<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: eggsalad<br>
+@ CHECK: Value: 0xE665A1AD<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: faceless<br>
+@ CHECK: Value: 0xFACE1E55<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: seedless<br>
+@ CHECK: Value: 0x5EED1E55<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: thumb_func<br>
+@ CHECK: Value: 0x5<br>
+@ CHECK: Type: Function<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: badblood<br>
+@ CHECK: Value: 0x0<br>
+@ CHECK: Type: Object<br>
+@ CHECK: }<br>
+<br>
+@ CHECK: Symbol {<br>
+@ CHECK: Name: undefined<br>
+@ CHECK: Value: 0x0<br>
+@ CHECK: Type: None<br>
+@ CHECK: }<br>
+<br>
<br>
Added: llvm/trunk/test/MC/ELF/offset.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/offset.s?rev=204178&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/offset.s?rev=204178&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/MC/ELF/offset.s (added)<br>
+++ llvm/trunk/test/MC/ELF/offset.s Tue Mar 18 15:40:38 2014<br>
@@ -0,0 +1,72 @@<br>
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t - | FileCheck %s<br>
+<br>
+// Test that a variable declared with "var = other_var + cst" is in the same<br>
+// section as other_var and its value is the value of other_var + cst.<br>
+<br>
+ .data<br>
+ .globl sym_a<br>
+ .byte 42<br>
+ .type sym_a, @object<br>
+sym_a:<br>
+<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: sym_a<br>
+// CHECK-NEXT: Value: 0x1<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .data<br>
+// CHECK-NEXT: }<br>
+<br>
+ .long 42<br>
+ .globl sym_b<br>
+sym_b:<br>
+ .globl sym_c<br>
+sym_c = sym_a<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: sym_c<br>
+// CHECK-NEXT: Value: 0x1<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .data<br>
+// CHECK-NEXT: }<br>
+<br>
+ .globl sym_d<br>
+sym_d = sym_a + 1<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: sym_d<br>
+// CHECK-NEXT: Value: 0x2<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .data<br>
+// CHECK-NEXT: }<br>
+<br>
+ .globl sym_e<br>
+sym_e = sym_a + (sym_b - sym_a) * 3<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: sym_e<br>
+// CHECK-NEXT: Value: 0xD<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .data<br>
+// CHECK-NEXT: }<br>
+<br>
+<br>
+ .globl sym_f<br>
+sym_f = sym_a + (1 - 1)<br>
+// CHECK: Symbol {<br>
+// CHECK: Name: sym_f<br>
+// CHECK-NEXT: Value: 0x1<br>
+// CHECK-NEXT: Size: 0<br>
+// CHECK-NEXT: Binding: Global<br>
+// CHECK-NEXT: Type: Object<br>
+// CHECK-NEXT: Other: 0<br>
+// CHECK-NEXT: Section: .data<br>
+// CHECK-NEXT: }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><div><br></div>
</div></div>