From 8a99824c5a1eddb6f298163f0c1068d025fab6f6 Mon Sep 17 00:00:00 2001 From: Alexander Kornienko Date: Tue, 18 Mar 2014 10:36:11 +0000 Subject: [PATCH] Revert r203962 and two revisions depending on it: r204028 and r204059. The revision I'm reverting breaks handling of transitive aliases. This blocks us and breaks sanitizer bootstrap: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/2651 (and checked locally by Alexey). This revision is the result of: svn merge -r204059:204058 -r204028:204027 -r203962:203961 . + the regression test added to test/MC/ELF/alias.s Another way to reproduce the regression with clang: $ cat q.c void a1(); void a2() __attribute__((alias("a1"))); void a3() __attribute__((alias("a2"))); void a1() {} $ ~/work/llvm-build/bin/clang-3.5-good -c q.c && mv q.o good.o && \ ~/work/llvm-build/bin/clang-3.5-bad -c q.c && mv q.o bad.o && \ objdump -t good.o bad.o good.o: file format elf64-x86-64 SYMBOL TABLE: 0000000000000000 l df *ABS* 0000000000000000 q.c 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l d .data 0000000000000000 .data 0000000000000000 l d .bss 0000000000000000 .bss 0000000000000000 l d .comment 0000000000000000 .comment 0000000000000000 l d .note.GNU-stack 0000000000000000 .note.GNU-stack 0000000000000000 l d .eh_frame 0000000000000000 .eh_frame 0000000000000000 g F .text 0000000000000006 a1 0000000000000000 g F .text 0000000000000006 a2 0000000000000000 g F .text 0000000000000006 a3 bad.o: file format elf64-x86-64 SYMBOL TABLE: 0000000000000000 l df *ABS* 0000000000000000 q.c 0000000000000000 l d .text 0000000000000000 .text 0000000000000000 l d .data 0000000000000000 .data 0000000000000000 l d .bss 0000000000000000 .bss 0000000000000000 l d .comment 0000000000000000 .comment 0000000000000000 l d .note.GNU-stack 0000000000000000 .note.GNU-stack 0000000000000000 l d .eh_frame 0000000000000000 .eh_frame 0000000000000000 g F .text 0000000000000006 a1 0000000000000000 g F .text 0000000000000006 a2 0000000000000000 g .text 0000000000000000 a3 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204137 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCSymbol.h | 6 - lib/MC/ELFObjectWriter.cpp | 97 ++++++--------- lib/MC/MCSymbol.cpp | 17 --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 70 ----------- test/MC/ARM/thumb_set-diagnostics.s | 43 ------- test/MC/ARM/thumb_set.s | 140 ---------------------- test/MC/ELF/alias.s | 12 ++ test/MC/ELF/offset.s | 72 ----------- 8 files changed, 51 insertions(+), 406 deletions(-) delete mode 100644 test/MC/ARM/thumb_set-diagnostics.s delete mode 100644 test/MC/ARM/thumb_set.s delete mode 100644 test/MC/ELF/offset.s diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h index 866d9a9a68b..ea14da1e15b 100644 --- a/include/llvm/MC/MCSymbol.h +++ b/include/llvm/MC/MCSymbol.h @@ -18,7 +18,6 @@ #include "llvm/Support/Compiler.h" namespace llvm { - class MCAsmLayout; class MCExpr; class MCSection; class MCContext; @@ -146,11 +145,6 @@ namespace llvm { // itself. const MCSymbol &AliasedSymbol() const; - // If this symbol is not a variable, return itself. If it is a variable, - // evaluate it and check if it is of the form Base + ConstantOffset. If so, - // return Base, if not, return nullptr. - const MCSymbol *getBaseSymbol(const MCAsmLayout &Layout) const; - void setVariableValue(const MCExpr *Value); /// @} diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index dd06304b715..909ea800830 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -271,7 +271,6 @@ class ELFObjectWriter : public MCObjectWriter { /// \param RevGroupMap - Maps a signature symbol to the group section. /// \param NumRegularSections - Number of non-relocation sections. void ComputeSymbolTable(MCAssembler &Asm, - const MCAsmLayout &Layout, const SectionIndexMapTy &SectionIndexMap, RevGroupMapTy RevGroupMap, unsigned NumRegularSections); @@ -463,47 +462,33 @@ void ELFObjectWriter::WriteSymbolEntry(MCDataFragment *SymtabF, } } -uint64_t ELFObjectWriter::SymbolValue(MCSymbolData &OrigData, +uint64_t ELFObjectWriter::SymbolValue(MCSymbolData &Data, const MCAsmLayout &Layout) { - MCSymbolData *Data = &OrigData; - if (Data->isCommon() && Data->isExternal()) - return Data->getCommonAlignment(); - - const MCSymbol *Symbol = &Data->getSymbol(); - const bool IsThumbFunc = OrigData.getFlags() & ELF_Other_ThumbFunc; - - uint64_t Res = 0; - if (Symbol->isVariable()) { - const MCExpr *Expr = Symbol->getVariableValue(); - MCValue Value; - if (!Expr->EvaluateAsRelocatable(Value, &Layout)) - return 0; - if (Value.getSymB()) - return 0; - - Res = Value.getConstant(); - if (IsThumbFunc) - Res |= 1; - - const MCSymbolRefExpr *A = Value.getSymA(); - if (!A) - return Res; - - Symbol = &A->getSymbol(); - Data = &Layout.getAssembler().getSymbolData(*Symbol); + if (Data.isCommon() && Data.isExternal()) + return Data.getCommonAlignment(); + + const MCSymbol &Symbol = Data.getSymbol(); + + if (Symbol.isAbsolute() && Symbol.isVariable()) { + if (const MCExpr *Value = Symbol.getVariableValue()) { + int64_t IntValue; + if (Value->EvaluateAsAbsolute(IntValue, Layout)) + return (uint64_t)IntValue; + } } - if (!Symbol->isInSection()) + if (!Symbol.isInSection()) return 0; - if (!Data->getFragment()) - return 0; - Res += Layout.getSymbolOffset(Data); - if (IsThumbFunc || Data->getFlags() & ELF_Other_ThumbFunc) - Res |= 1; + if (Data.getFragment()) { + if (Data.getFlags() & ELF_Other_ThumbFunc) + return Layout.getSymbolOffset(&Data)+1; + else + return Layout.getSymbolOffset(&Data); + } - return Res; + return 0; } void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm, @@ -584,9 +569,8 @@ void ELFObjectWriter::WriteSymbol(MCDataFragment *SymtabF, ELFSymbolData &MSD, const MCAsmLayout &Layout) { MCSymbolData &OrigData = *MSD.SymbolData; - const MCSymbol *Base = OrigData.getSymbol().getBaseSymbol(Layout); - const MCSymbolData &Data = - Base ? Layout.getAssembler().getSymbolData(*Base) : OrigData; + MCSymbolData &Data = + Layout.getAssembler().getSymbolData(OrigData.getSymbol().AliasedSymbol()); bool IsReserved = Data.isCommon() || Data.getSymbol().isAbsolute() || Data.getSymbol().isVariable(); @@ -594,8 +578,6 @@ void ELFObjectWriter::WriteSymbol(MCDataFragment *SymtabF, // Binding and Type share the same byte as upper and lower nibbles uint8_t Binding = MCELF::GetBinding(OrigData); uint8_t Type = mergeTypeForSet(MCELF::GetType(OrigData), MCELF::GetType(Data)); - if (OrigData.getFlags() & ELF_Other_ThumbFunc) - Type = ELF::STT_FUNC; uint8_t Info = (Binding << ELF_STB_Shift) | (Type << ELF_STT_Shift); // Other and Visibility share the same byte with Visibility using the lower @@ -604,7 +586,7 @@ void ELFObjectWriter::WriteSymbol(MCDataFragment *SymtabF, uint8_t Other = MCELF::getOther(OrigData) << (ELF_STO_Shift - ELF_STV_Shift); Other |= Visibility; - uint64_t Value = SymbolValue(OrigData, Layout); + uint64_t Value = SymbolValue(Data, Layout); uint64_t Size = 0; assert(!(Data.isCommon() && !Data.isExternal())); @@ -915,11 +897,10 @@ void ELFObjectWriter::ComputeIndexMap(MCAssembler &Asm, } } -void -ELFObjectWriter::ComputeSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout, - const SectionIndexMapTy &SectionIndexMap, - RevGroupMapTy RevGroupMap, - unsigned NumRegularSections) { +void ELFObjectWriter::ComputeSymbolTable(MCAssembler &Asm, + const SectionIndexMapTy &SectionIndexMap, + RevGroupMapTy RevGroupMap, + unsigned NumRegularSections) { // FIXME: Is this the correct place to do this? // FIXME: Why is an undefined reference to _GLOBAL_OFFSET_TABLE_ needed? if (NeedsGOT) { @@ -967,33 +948,33 @@ ELFObjectWriter::ComputeSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout, ELFSymbolData MSD; MSD.SymbolData = it; - const MCSymbol *BaseSymbol = Symbol.getBaseSymbol(Layout); + const MCSymbol &RefSymbol = Symbol.AliasedSymbol(); // Undefined symbols are global, but this is the first place we // are able to set it. bool Local = isLocal(*it, isSignature, Used); if (!Local && MCELF::GetBinding(*it) == ELF::STB_LOCAL) { - assert(BaseSymbol); - MCSymbolData &SD = Asm.getSymbolData(*BaseSymbol); + MCSymbolData &SD = Asm.getSymbolData(RefSymbol); MCELF::SetBinding(*it, ELF::STB_GLOBAL); MCELF::SetBinding(SD, ELF::STB_GLOBAL); } - if (!BaseSymbol) { - MSD.SectionIndex = ELF::SHN_ABS; - } else if (it->isCommon()) { + if (RefSymbol.isUndefined() && !Used && WeakrefUsed) + MCELF::SetBinding(*it, ELF::STB_WEAK); + + if (it->isCommon()) { assert(!Local); MSD.SectionIndex = ELF::SHN_COMMON; - } else if (BaseSymbol->isUndefined()) { + } else if (Symbol.isAbsolute() || RefSymbol.isVariable()) { + MSD.SectionIndex = ELF::SHN_ABS; + } else if (RefSymbol.isUndefined()) { if (isSignature && !Used) MSD.SectionIndex = SectionIndexMap.lookup(RevGroupMap[&Symbol]); else MSD.SectionIndex = ELF::SHN_UNDEF; - if (!Used && WeakrefUsed) - MCELF::SetBinding(*it, ELF::STB_WEAK); } else { const MCSectionELF &Section = - static_cast(BaseSymbol->getSection()); + static_cast(RefSymbol.getSection()); MSD.SectionIndex = SectionIndexMap.lookup(&Section); if (MSD.SectionIndex >= ELF::SHN_LORESERVE) NeedsSymtabShndx = true; @@ -1579,8 +1560,8 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm, unsigned NumRegularSections = NumUserSections + NumIndexedSections; // Compute symbol table information. - ComputeSymbolTable(Asm, Layout, SectionIndexMap, RevGroupMap, - NumRegularSections); + ComputeSymbolTable(Asm, SectionIndexMap, RevGroupMap, NumRegularSections); + WriteRelocations(Asm, const_cast(Layout), RelMap); diff --git a/lib/MC/MCSymbol.cpp b/lib/MC/MCSymbol.cpp index d0283a635be..24165254e56 100644 --- a/lib/MC/MCSymbol.cpp +++ b/lib/MC/MCSymbol.cpp @@ -9,7 +9,6 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCValue.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -52,22 +51,6 @@ const MCSymbol &MCSymbol::AliasedSymbol() const { return *S; } -const MCSymbol *MCSymbol::getBaseSymbol(const MCAsmLayout &Layout) const { - if (!isVariable()) - return this; - - const MCExpr *Expr = getVariableValue(); - MCValue Value; - if (!Expr->EvaluateAsRelocatable(Value, &Layout)) - return nullptr; - - if (Value.getSymB()) - return nullptr; - if (const MCSymbolRefExpr *A = Value.getSymA()) - return &A->getSymbol(); - return nullptr; -} - void MCSymbol::setVariableValue(const MCExpr *Value) { assert(!IsUsed && "Cannot set a variable that has already been used."); assert(Value && "Invalid variable value!"); diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index ccb1c641efe..b581ef25418 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -30,7 +30,6 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrDesc.h" #include "llvm/MC/MCInstrInfo.h" -#include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCParser/MCAsmLexer.h" #include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h" @@ -42,7 +41,6 @@ #include "llvm/MC/MCTargetAsmParser.h" #include "llvm/Support/ARMBuildAttributes.h" #include "llvm/Support/ARMEHABI.h" -#include "llvm/Support/COFF.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ELF.h" #include "llvm/Support/MathExtras.h" @@ -231,7 +229,6 @@ class ARMAsmParser : public MCTargetAsmParser { bool parseDirectiveObjectArch(SMLoc L); bool parseDirectiveArchExtension(SMLoc L); bool parseDirectiveAlign(SMLoc L); - bool parseDirectiveThumbSet(SMLoc L); StringRef splitMnemonic(StringRef Mnemonic, unsigned &PredicationCode, bool &CarrySetting, unsigned &ProcessorIMod, @@ -8033,8 +8030,6 @@ bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) { return parseDirectiveArchExtension(DirectiveID.getLoc()); else if (IDVal == ".align") return parseDirectiveAlign(DirectiveID.getLoc()); - else if (IDVal == ".thumb_set") - return parseDirectiveThumbSet(DirectiveID.getLoc()); return true; } @@ -9092,71 +9087,6 @@ bool ARMAsmParser::parseDirectiveAlign(SMLoc L) { return false; } -/// parseDirectiveThumbSet -/// ::= .thumb_set name, value -bool ARMAsmParser::parseDirectiveThumbSet(SMLoc L) { - StringRef Name; - if (Parser.parseIdentifier(Name)) { - TokError("expected identifier after '.thumb_set'"); - Parser.eatToEndOfStatement(); - return false; - } - - if (getLexer().isNot(AsmToken::Comma)) { - TokError("expected comma after name '" + Name + "'"); - Parser.eatToEndOfStatement(); - return false; - } - Lex(); - - const MCExpr *Value; - if (Parser.parseExpression(Value)) { - TokError("missing expression"); - Parser.eatToEndOfStatement(); - return false; - } - - if (getLexer().isNot(AsmToken::EndOfStatement)) { - TokError("unexpected token"); - Parser.eatToEndOfStatement(); - return false; - } - Lex(); - - MCSymbol *Alias = getContext().GetOrCreateSymbol(Name); - if (const MCSymbolRefExpr *SRE = dyn_cast(Value)) { - MCSymbol *Sym = getContext().LookupSymbol(SRE->getSymbol().getName()); - if (!Sym->isDefined()) { - getStreamer().EmitSymbolAttribute(Sym, MCSA_Global); - getStreamer().EmitAssignment(Alias, Value); - return false; - } - - const MCObjectFileInfo::Environment Format = - getContext().getObjectFileInfo()->getObjectFileType(); - switch (Format) { - case MCObjectFileInfo::IsCOFF: { - char Type = COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT; - getStreamer().EmitCOFFSymbolType(Type); - // .set values are always local in COFF - getStreamer().EmitSymbolAttribute(Alias, MCSA_Local); - break; - } - case MCObjectFileInfo::IsELF: - getStreamer().EmitSymbolAttribute(Alias, MCSA_ELF_TypeFunction); - break; - case MCObjectFileInfo::IsMachO: - break; - } - } - - // FIXME: set the function as being a thumb function via the assembler - getStreamer().EmitThumbFunc(Alias); - getStreamer().EmitAssignment(Alias, Value); - - return false; -} - /// Force static initialization. extern "C" void LLVMInitializeARMAsmParser() { RegisterMCAsmParser X(TheARMTarget); diff --git a/test/MC/ARM/thumb_set-diagnostics.s b/test/MC/ARM/thumb_set-diagnostics.s deleted file mode 100644 index 5f1844de01f..00000000000 --- a/test/MC/ARM/thumb_set-diagnostics.s +++ /dev/null @@ -1,43 +0,0 @@ -@ RUN: not llvm-mc -triple armv7-eabi -o /dev/null 2>&1 %s | FileCheck %s - - .syntax unified - - .thumb - - .thumb_set - -@ CHECK: error: expected identifier after '.thumb_set' -@ CHECK: .thumb_set -@ CHECL: ^ - - .thumb_set ., 0x0b5e55ed - -@ CHECK: error: expected identifier after '.thumb_set' -@ CHECK: .thumb_set ., 0x0b5e55ed -@ CHECK: ^ - - .thumb_set labelled, 0x1abe11ed - .thumb_set invalid, :lower16:labelled - -@ CHECK: error: unknown token in expression -@ CHECK: .thumb_set invalid, :lower16:labelled -@ CHECK: ^ - - .thumb_set missing_comma - -@ CHECK: error: expected comma after name 'missing_comma' -@ CHECK: .thumb_set missing_comma -@ CHECK: ^ - - .thumb_set missing_expression, - -@ CHECK: error: missing expression -@ CHECK: .thumb_set missing_expression, -@ CHECK: ^ - - .thumb_set trailer_trash, 0x11fe1e55, - -@ CHECK: error: unexpected token -@ CHECK: .thumb_set trailer_trash, 0x11fe1e55, -@ CHECK: ^ - diff --git a/test/MC/ARM/thumb_set.s b/test/MC/ARM/thumb_set.s deleted file mode 100644 index 7381a98134d..00000000000 --- a/test/MC/ARM/thumb_set.s +++ /dev/null @@ -1,140 +0,0 @@ -@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s | llvm-readobj -t \ -@ RUN: | FileCheck %s - - .syntax unified - - .arm - - .type arm_func,%function -arm_func: - nop - - .thumb_set alias_arm_func, arm_func - - .thumb - - .type thumb_func,%function - .thumb_func -thumb_func: - nop - - .thumb_set alias_thumb_func, thumb_func - - .thumb_set seedless, 0x5eed1e55 - .thumb_set eggsalad, seedless + 0x87788358 - .thumb_set faceless, ~eggsalad + 0xe133c002 - - .thumb_set alias_undefined_data, badblood - - .data - - .type badblood,%object -badblood: - .long 0xbadb100d - - .type bedazzle,%object -bedazzle: - .long 0xbeda221e - - .text - .thumb - - .thumb_set alias_defined_data, bedazzle - - .type alpha,%function -alpha: - nop - - .type beta,%function -beta: - bkpt - - .thumb_set beta, alpha - - .thumb_set alias_undefined, undefined - -@ CHECK: Symbol { -@ CHECK: Name: alias_arm_func -@ CHECK: Value: 0x1 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: alias_defined_data -@ CHECK: Value: 0x5 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: alias_thumb_func -@ CHECK: Value: 0x5 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: alias_undefined_data -@ CHECK: Value: 0x0 -@ CHECK: Type: Object -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: alpha -@ CHECK: Value: 0x6 -@ XFAIL-CHECK: Value: 0x7 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: arm_func -@ CHECK: Value: 0x0 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: bedazzle -@ CHECK: Value: 0x4 -@ CHECK: Type: Object -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: beta -@ CHECK: Value: 0x7 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: eggsalad -@ CHECK: Value: 0xE665A1AD -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: faceless -@ CHECK: Value: 0xFACE1E55 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: seedless -@ CHECK: Value: 0x5EED1E55 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: thumb_func -@ CHECK: Value: 0x5 -@ CHECK: Type: Function -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: badblood -@ CHECK: Value: 0x0 -@ CHECK: Type: Object -@ CHECK: } - -@ CHECK: Symbol { -@ CHECK: Name: undefined -@ CHECK: Value: 0x0 -@ CHECK: Type: None -@ CHECK: } - diff --git a/test/MC/ELF/alias.s b/test/MC/ELF/alias.s index 8da75f7ef2d..d529ab18902 100644 --- a/test/MC/ELF/alias.s +++ b/test/MC/ELF/alias.s @@ -15,6 +15,9 @@ bar3 = foo3 foo4: bar4 = foo4 +// Test that bar5 is also a function +bar5 = bar4 + .long foo2 // CHECK: Symbols [ @@ -46,6 +49,15 @@ bar4 = foo4 // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: bar5 +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local +// CHECK-NEXT: Type: Function +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: foo // CHECK-NEXT: Value: 0x0 // CHECK-NEXT: Size: 0 diff --git a/test/MC/ELF/offset.s b/test/MC/ELF/offset.s deleted file mode 100644 index bc4252c1a78..00000000000 --- a/test/MC/ELF/offset.s +++ /dev/null @@ -1,72 +0,0 @@ -// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -t - | FileCheck %s - -// Test that a variable declared with "var = other_var + cst" is in the same -// section as other_var and its value is the value of other_var + cst. - - .data - .globl sym_a - .byte 42 - .type sym_a, @object -sym_a: - -// CHECK: Symbol { -// CHECK: Name: sym_a -// CHECK-NEXT: Value: 0x1 -// CHECK-NEXT: Size: 0 -// CHECK-NEXT: Binding: Global -// CHECK-NEXT: Type: Object -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: .data -// CHECK-NEXT: } - - .long 42 - .globl sym_b -sym_b: - .globl sym_c -sym_c = sym_a -// CHECK: Symbol { -// CHECK: Name: sym_c -// CHECK-NEXT: Value: 0x1 -// CHECK-NEXT: Size: 0 -// CHECK-NEXT: Binding: Global -// CHECK-NEXT: Type: Object -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: .data -// CHECK-NEXT: } - - .globl sym_d -sym_d = sym_a + 1 -// CHECK: Symbol { -// CHECK: Name: sym_d -// CHECK-NEXT: Value: 0x2 -// CHECK-NEXT: Size: 0 -// CHECK-NEXT: Binding: Global -// CHECK-NEXT: Type: Object -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: .data -// CHECK-NEXT: } - - .globl sym_e -sym_e = sym_a + (sym_b - sym_a) * 3 -// CHECK: Symbol { -// CHECK: Name: sym_e -// CHECK-NEXT: Value: 0xD -// CHECK-NEXT: Size: 0 -// CHECK-NEXT: Binding: Global -// CHECK-NEXT: Type: Object -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: .data -// CHECK-NEXT: } - - - .globl sym_f -sym_f = sym_a + (1 - 1) -// CHECK: Symbol { -// CHECK: Name: sym_f -// CHECK-NEXT: Value: 0x1 -// CHECK-NEXT: Size: 0 -// CHECK-NEXT: Binding: Global -// CHECK-NEXT: Type: Object -// CHECK-NEXT: Other: 0 -// CHECK-NEXT: Section: .data -// CHECK-NEXT: } -- 2.34.1