Pass MCSymbols to the helper functions in MCELF.h.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 29 May 2015 18:47:23 +0000 (18:47 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 29 May 2015 18:47:23 +0000 (18:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238596 91177308-0d34-0410-b5e6-96231b3b80d8

14 files changed:
include/llvm/MC/MCELF.h
lib/MC/ELFObjectWriter.cpp
lib/MC/MCELF.cpp
lib/MC/MCELFStreamer.cpp
lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp
lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp

index f409988d5726c1f38dc90de22144811abdf5aa38..14274cf5370e394030b98894cc53d177d57d292f 100644 (file)
 #define LLVM_MC_MCELF_H
 
 namespace llvm {
 #define LLVM_MC_MCELF_H
 
 namespace llvm {
-class MCSymbolData;
+class MCSymbol;
 
 class MCELF {
  public:
 
 class MCELF {
  public:
-  static void SetBinding(MCSymbolData &SD, unsigned Binding);
-  static unsigned GetBinding(const MCSymbolData &SD);
-  static void SetType(MCSymbolData &SD, unsigned Type);
-  static unsigned GetType(const MCSymbolData &SD);
-  static void SetVisibility(MCSymbolData &SD, unsigned Visibility);
-  static unsigned GetVisibility(const MCSymbolData &SD);
-  static void setOther(MCSymbolData &SD, unsigned Other);
-  static unsigned getOther(const MCSymbolData &SD);
+   static void SetBinding(const MCSymbol &Sym, unsigned Binding);
+   static unsigned GetBinding(const MCSymbol &Sym);
+   static void SetType(const MCSymbol &Sym, unsigned Type);
+   static unsigned GetType(const MCSymbol &Sym);
+   static void SetVisibility(MCSymbol &Sym, unsigned Visibility);
+   static unsigned GetVisibility(const MCSymbol &Sym);
+   static void setOther(MCSymbol &Sym, unsigned Other);
+   static unsigned getOther(const MCSymbol &Sym);
 };
 
 }
 };
 
 }
index 00986d63258ebe6f068fad92c485c3036f8a3af6..05a779c1b1e9d0bfaeae9b6293f0d607c0f7b961 100644 (file)
@@ -85,8 +85,8 @@ class ELFObjectWriter : public MCObjectWriter {
 
       // Support lexicographic sorting.
       bool operator<(const ELFSymbolData &RHS) const {
 
       // Support lexicographic sorting.
       bool operator<(const ELFSymbolData &RHS) const {
-        unsigned LHSType = MCELF::GetType(Symbol->getData());
-        unsigned RHSType = MCELF::GetType(RHS.Symbol->getData());
+        unsigned LHSType = MCELF::GetType(*Symbol);
+        unsigned RHSType = MCELF::GetType(*RHS.Symbol);
         if (LHSType == ELF::STT_SECTION && RHSType != ELF::STT_SECTION)
           return false;
         if (LHSType != ELF::STT_SECTION && RHSType == ELF::STT_SECTION)
         if (LHSType == ELF::STT_SECTION && RHSType != ELF::STT_SECTION)
           return false;
         if (LHSType != ELF::STT_SECTION && RHSType == ELF::STT_SECTION)
@@ -398,7 +398,7 @@ void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
     // Aliases defined with .symvar copy the binding from the symbol they alias.
     // This is the first place we are able to copy this information.
     OriginalData.setExternal(SD.isExternal());
     // Aliases defined with .symvar copy the binding from the symbol they alias.
     // This is the first place we are able to copy this information.
     OriginalData.setExternal(SD.isExternal());
-    MCELF::SetBinding(OriginalData, MCELF::GetBinding(SD));
+    MCELF::SetBinding(Alias, MCELF::GetBinding(Symbol));
 
     StringRef Rest = AliasName.substr(Pos);
     if (!Symbol.isUndefined() && !Rest.startswith("@@@"))
 
     StringRef Rest = AliasName.substr(Pos);
     if (!Symbol.isUndefined() && !Rest.startswith("@@@"))
@@ -462,19 +462,20 @@ void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
   bool IsReserved = !Base || MSD.Symbol->isCommon();
 
   // Binding and Type share the same byte as upper and lower nibbles
   bool IsReserved = !Base || MSD.Symbol->isCommon();
 
   // Binding and Type share the same byte as upper and lower nibbles
-  uint8_t Binding = MCELF::GetBinding(OrigData);
-  uint8_t Type = MCELF::GetType(OrigData);
+  uint8_t Binding = MCELF::GetBinding(*MSD.Symbol);
+  uint8_t Type = MCELF::GetType(*MSD.Symbol);
   MCSymbolData *BaseSD = nullptr;
   if (Base) {
     BaseSD = &Base->getData();
   MCSymbolData *BaseSD = nullptr;
   if (Base) {
     BaseSD = &Base->getData();
-    Type = mergeTypeForSet(Type, MCELF::GetType(*BaseSD));
+    Type = mergeTypeForSet(Type, MCELF::GetType(*Base));
   }
   uint8_t Info = (Binding << ELF_STB_Shift) | (Type << ELF_STT_Shift);
 
   // Other and Visibility share the same byte with Visibility using the lower
   // 2 bits
   }
   uint8_t Info = (Binding << ELF_STB_Shift) | (Type << ELF_STT_Shift);
 
   // Other and Visibility share the same byte with Visibility using the lower
   // 2 bits
-  uint8_t Visibility = MCELF::GetVisibility(OrigData);
-  uint8_t Other = MCELF::getOther(OrigData) << (ELF_STO_Shift - ELF_STV_Shift);
+  uint8_t Visibility = MCELF::GetVisibility(*MSD.Symbol);
+  uint8_t Other = MCELF::getOther(*MSD.Symbol)
+                  << (ELF_STO_Shift - ELF_STV_Shift);
   Other |= Visibility;
 
   uint64_t Value = SymbolValue(*MSD.Symbol, Layout);
   Other |= Visibility;
 
   uint64_t Value = SymbolValue(*MSD.Symbol, Layout);
@@ -503,8 +504,6 @@ bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm,
                                                const MCSymbolRefExpr *RefA,
                                                const MCSymbol *Sym, uint64_t C,
                                                unsigned Type) const {
                                                const MCSymbolRefExpr *RefA,
                                                const MCSymbol *Sym, uint64_t C,
                                                unsigned Type) const {
-  MCSymbolData *SD = Sym ? &Sym->getData() : nullptr;
-
   // A PCRel relocation to an absolute value has no symbol (or section). We
   // represent that with a relocation to a null section.
   if (!RefA)
   // A PCRel relocation to an absolute value has no symbol (or section). We
   // represent that with a relocation to a null section.
   if (!RefA)
@@ -543,7 +542,7 @@ bool ELFObjectWriter::shouldRelocateWithSymbol(const MCAssembler &Asm,
   if (Sym->isUndefined())
     return true;
 
   if (Sym->isUndefined())
     return true;
 
-  unsigned Binding = MCELF::GetBinding(*SD);
+  unsigned Binding = MCELF::GetBinding(*Sym);
   switch(Binding) {
   default:
     llvm_unreachable("Invalid Binding");
   switch(Binding) {
   default:
     llvm_unreachable("Invalid Binding");
@@ -620,11 +619,11 @@ static const MCSymbol *getWeakRef(const MCSymbolRefExpr &Ref) {
 // True if the assembler knows nothing about the final value of the symbol.
 // This doesn't cover the comdat issues, since in those cases the assembler
 // can at least know that all symbols in the section will move together.
 // True if the assembler knows nothing about the final value of the symbol.
 // This doesn't cover the comdat issues, since in those cases the assembler
 // can at least know that all symbols in the section will move together.
-static bool isWeak(const MCSymbolData &D) {
-  if (MCELF::GetType(D) == ELF::STT_GNU_IFUNC)
+static bool isWeak(const MCSymbol &Sym) {
+  if (MCELF::GetType(Sym) == ELF::STT_GNU_IFUNC)
     return true;
 
     return true;
 
-  switch (MCELF::GetBinding(D)) {
+  switch (MCELF::GetBinding(Sym)) {
   default:
     llvm_unreachable("Unknown binding");
   case ELF::STB_LOCAL:
   default:
     llvm_unreachable("Unknown binding");
   case ELF::STB_LOCAL:
@@ -676,7 +675,7 @@ void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,
       Asm.getContext().reportFatalError(
           Fixup.getLoc(), "Cannot represent a difference across sections");
 
       Asm.getContext().reportFatalError(
           Fixup.getLoc(), "Cannot represent a difference across sections");
 
-    if (::isWeak(SymB.getData()))
+    if (::isWeak(SymB))
       Asm.getContext().reportFatalError(
           Fixup.getLoc(), "Cannot represent a subtraction with a weak symbol");
 
       Asm.getContext().reportFatalError(
           Fixup.getLoc(), "Cannot represent a subtraction with a weak symbol");
 
@@ -730,7 +729,6 @@ void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,
 bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
                                  const MCSymbol &Symbol, bool Used,
                                  bool Renamed) {
 bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
                                  const MCSymbol &Symbol, bool Used,
                                  bool Renamed) {
-  const MCSymbolData &Data = Symbol.getData();
   if (Symbol.isVariable()) {
     const MCExpr *Expr = Symbol.getVariableValue();
     if (const MCSymbolRefExpr *Ref = dyn_cast<MCSymbolRefExpr>(Expr)) {
   if (Symbol.isVariable()) {
     const MCExpr *Expr = Symbol.getVariableValue();
     if (const MCSymbolRefExpr *Ref = dyn_cast<MCSymbolRefExpr>(Expr)) {
@@ -754,11 +752,11 @@ bool ELFObjectWriter::isInSymtab(const MCAsmLayout &Layout,
       return false;
   }
 
       return false;
   }
 
-  bool IsGlobal = MCELF::GetBinding(Data) == ELF::STB_GLOBAL;
+  bool IsGlobal = MCELF::GetBinding(Symbol) == ELF::STB_GLOBAL;
   if (!Symbol.isVariable() && Symbol.isUndefined() && !IsGlobal)
     return false;
 
   if (!Symbol.isVariable() && Symbol.isUndefined() && !IsGlobal)
     return false;
 
-  if (MCELF::GetType(Data) == ELF::STT_SECTION)
+  if (MCELF::GetType(Symbol) == ELF::STT_SECTION)
     return true;
 
   if (Symbol.isTemporary())
     return true;
 
   if (Symbol.isTemporary())
@@ -811,8 +809,6 @@ void ELFObjectWriter::computeSymbolTable(
   // Add the data for the symbols.
   bool HasLargeSectionIndex = false;
   for (const MCSymbol &Symbol : Asm.symbols()) {
   // Add the data for the symbols.
   bool HasLargeSectionIndex = false;
   for (const MCSymbol &Symbol : Asm.symbols()) {
-    MCSymbolData &SD = Symbol.getData();
-
     bool Used = UsedInReloc.count(&Symbol);
     bool WeakrefUsed = WeakrefUsedInReloc.count(&Symbol);
     bool isSignature = RevGroupMap.count(&Symbol);
     bool Used = UsedInReloc.count(&Symbol);
     bool WeakrefUsed = WeakrefUsedInReloc.count(&Symbol);
     bool isSignature = RevGroupMap.count(&Symbol);
@@ -827,8 +823,8 @@ void ELFObjectWriter::computeSymbolTable(
     // Undefined symbols are global, but this is the first place we
     // are able to set it.
     bool Local = isLocal(Symbol, Used, isSignature);
     // Undefined symbols are global, but this is the first place we
     // are able to set it.
     bool Local = isLocal(Symbol, Used, isSignature);
-    if (!Local && MCELF::GetBinding(SD) == ELF::STB_LOCAL)
-      MCELF::SetBinding(SD, ELF::STB_GLOBAL);
+    if (!Local && MCELF::GetBinding(Symbol) == ELF::STB_LOCAL)
+      MCELF::SetBinding(Symbol, ELF::STB_GLOBAL);
 
     if (Symbol.isAbsolute()) {
       MSD.SectionIndex = ELF::SHN_ABS;
 
     if (Symbol.isAbsolute()) {
       MSD.SectionIndex = ELF::SHN_ABS;
@@ -844,7 +840,7 @@ void ELFObjectWriter::computeSymbolTable(
         MSD.SectionIndex = ELF::SHN_UNDEF;
       }
       if (!Used && WeakrefUsed)
         MSD.SectionIndex = ELF::SHN_UNDEF;
       }
       if (!Used && WeakrefUsed)
-        MCELF::SetBinding(SD, ELF::STB_WEAK);
+        MCELF::SetBinding(Symbol, ELF::STB_WEAK);
     } else {
       const MCSectionELF &Section =
           static_cast<const MCSectionELF &>(Symbol.getSection());
     } else {
       const MCSectionELF &Section =
           static_cast<const MCSectionELF &>(Symbol.getSection());
@@ -894,7 +890,7 @@ void ELFObjectWriter::computeSymbolTable(
     }
 
     // Sections have their own string table
     }
 
     // Sections have their own string table
-    if (MCELF::GetType(SD) != ELF::STT_SECTION)
+    if (MCELF::GetType(Symbol) != ELF::STT_SECTION)
       MSD.Name = StrTabBuilder.add(Name);
 
     if (Local)
       MSD.Name = StrTabBuilder.add(Name);
 
     if (Local)
@@ -930,10 +926,9 @@ void ELFObjectWriter::computeSymbolTable(
   unsigned Index = FileNames.size() + 1;
 
   for (ELFSymbolData &MSD : LocalSymbolData) {
   unsigned Index = FileNames.size() + 1;
 
   for (ELFSymbolData &MSD : LocalSymbolData) {
-    unsigned StringIndex =
-        MCELF::GetType(MSD.Symbol->getData()) == ELF::STT_SECTION
-            ? 0
-            : StrTabBuilder.getOffset(MSD.Name);
+    unsigned StringIndex = MCELF::GetType(*MSD.Symbol) == ELF::STT_SECTION
+                               ? 0
+                               : StrTabBuilder.getOffset(MSD.Name);
     MSD.Symbol->setIndex(Index++);
     writeSymbol(Writer, StringIndex, MSD, Layout);
   }
     MSD.Symbol->setIndex(Index++);
     writeSymbol(Writer, StringIndex, MSD, Layout);
   }
@@ -945,7 +940,7 @@ void ELFObjectWriter::computeSymbolTable(
     unsigned StringIndex = StrTabBuilder.getOffset(MSD.Name);
     MSD.Symbol->setIndex(Index++);
     writeSymbol(Writer, StringIndex, MSD, Layout);
     unsigned StringIndex = StrTabBuilder.getOffset(MSD.Name);
     MSD.Symbol->setIndex(Index++);
     writeSymbol(Writer, StringIndex, MSD, Layout);
-    assert(MCELF::GetBinding(MSD.Symbol->getData()) != ELF::STB_LOCAL);
+    assert(MCELF::GetBinding(*MSD.Symbol) != ELF::STB_LOCAL);
   }
 
   uint64_t SecEnd = OS.tell();
   }
 
   uint64_t SecEnd = OS.tell();
@@ -1361,7 +1356,7 @@ bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
     bool InSet, bool IsPCRel) const {
   if (IsPCRel) {
     assert(!InSet);
     bool InSet, bool IsPCRel) const {
   if (IsPCRel) {
     assert(!InSet);
-    if (::isWeak(SymA.getData()))
+    if (::isWeak(SymA))
       return false;
   }
   return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
       return false;
   }
   return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
@@ -1369,8 +1364,7 @@ bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
 }
 
 bool ELFObjectWriter::isWeak(const MCSymbol &Sym) const {
 }
 
 bool ELFObjectWriter::isWeak(const MCSymbol &Sym) const {
-  const MCSymbolData &SD = Sym.getData();
-  if (::isWeak(SD))
+  if (::isWeak(Sym))
     return true;
 
   // It is invalid to replace a reference to a global in a comdat
     return true;
 
   // It is invalid to replace a reference to a global in a comdat
@@ -1379,7 +1373,7 @@ bool ELFObjectWriter::isWeak(const MCSymbol &Sym) const {
   // We could try to return false for more cases, like the reference
   // being in the same comdat or Sym being an alias to another global,
   // but it is not clear if it is worth the effort.
   // We could try to return false for more cases, like the reference
   // being in the same comdat or Sym being an alias to another global,
   // but it is not clear if it is worth the effort.
-  if (MCELF::GetBinding(SD) != ELF::STB_GLOBAL)
+  if (MCELF::GetBinding(Sym) != ELF::STB_GLOBAL)
     return false;
 
   if (!Sym.isInSection())
     return false;
 
   if (!Sym.isInSection())
index 369063431fefcabfc4f2ba39d9ac7494cbfae362..3cccc80408242cb98bcf7a75106839836812abb4 100644 (file)
 
 namespace llvm {
 
 
 namespace llvm {
 
-void MCELF::SetBinding(MCSymbolData &SD, unsigned Binding) {
+void MCELF::SetBinding(const MCSymbol &Sym, unsigned Binding) {
+  MCSymbolData &SD = Sym.getData();
   assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
          Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
   uint32_t OtherFlags = SD.getFlags() & ~(0xf << ELF_STB_Shift);
   SD.setFlags(OtherFlags | (Binding << ELF_STB_Shift));
 }
 
   assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
          Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
   uint32_t OtherFlags = SD.getFlags() & ~(0xf << ELF_STB_Shift);
   SD.setFlags(OtherFlags | (Binding << ELF_STB_Shift));
 }
 
-unsigned MCELF::GetBinding(const MCSymbolData &SD) {
+unsigned MCELF::GetBinding(const MCSymbol &Sym) {
+  MCSymbolData &SD = Sym.getData();
   uint32_t Binding = (SD.getFlags() & (0xf << ELF_STB_Shift)) >> ELF_STB_Shift;
   assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
          Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
   return Binding;
 }
 
   uint32_t Binding = (SD.getFlags() & (0xf << ELF_STB_Shift)) >> ELF_STB_Shift;
   assert(Binding == ELF::STB_LOCAL || Binding == ELF::STB_GLOBAL ||
          Binding == ELF::STB_WEAK || Binding == ELF::STB_GNU_UNIQUE);
   return Binding;
 }
 
-void MCELF::SetType(MCSymbolData &SD, unsigned Type) {
+void MCELF::SetType(const MCSymbol &Sym, unsigned Type) {
+  MCSymbolData &SD = Sym.getData();
   assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
          Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
          Type == ELF::STT_COMMON || Type == ELF::STT_TLS ||
   assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
          Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
          Type == ELF::STT_COMMON || Type == ELF::STT_TLS ||
@@ -43,7 +46,8 @@ void MCELF::SetType(MCSymbolData &SD, unsigned Type) {
   SD.setFlags(OtherFlags | (Type << ELF_STT_Shift));
 }
 
   SD.setFlags(OtherFlags | (Type << ELF_STT_Shift));
 }
 
-unsigned MCELF::GetType(const MCSymbolData &SD) {
+unsigned MCELF::GetType(const MCSymbol &Sym) {
+  MCSymbolData &SD = Sym.getData();
   uint32_t Type = (SD.getFlags() & (0xf << ELF_STT_Shift)) >> ELF_STT_Shift;
   assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
          Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
   uint32_t Type = (SD.getFlags() & (0xf << ELF_STT_Shift)) >> ELF_STT_Shift;
   assert(Type == ELF::STT_NOTYPE || Type == ELF::STT_OBJECT ||
          Type == ELF::STT_FUNC || Type == ELF::STT_SECTION ||
@@ -53,7 +57,8 @@ unsigned MCELF::GetType(const MCSymbolData &SD) {
 
 // Visibility is stored in the first two bits of st_other
 // st_other values are stored in the second byte of get/setFlags
 
 // Visibility is stored in the first two bits of st_other
 // st_other values are stored in the second byte of get/setFlags
-void MCELF::SetVisibility(MCSymbolData &SD, unsigned Visibility) {
+void MCELF::SetVisibility(MCSymbol &Sym, unsigned Visibility) {
+  MCSymbolData &SD = Sym.getData();
   assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
          Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED);
 
   assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
          Visibility == ELF::STV_HIDDEN || Visibility == ELF::STV_PROTECTED);
 
@@ -61,7 +66,8 @@ void MCELF::SetVisibility(MCSymbolData &SD, unsigned Visibility) {
   SD.setFlags(OtherFlags | (Visibility << ELF_STV_Shift));
 }
 
   SD.setFlags(OtherFlags | (Visibility << ELF_STV_Shift));
 }
 
-unsigned MCELF::GetVisibility(const MCSymbolData &SD) {
+unsigned MCELF::GetVisibility(const MCSymbol &Sym) {
+  MCSymbolData &SD = Sym.getData();
   unsigned Visibility =
     (SD.getFlags() & (0x3 << ELF_STV_Shift)) >> ELF_STV_Shift;
   assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
   unsigned Visibility =
     (SD.getFlags() & (0x3 << ELF_STV_Shift)) >> ELF_STV_Shift;
   assert(Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_INTERNAL ||
@@ -71,12 +77,14 @@ unsigned MCELF::GetVisibility(const MCSymbolData &SD) {
 
 // Other is stored in the last six bits of st_other
 // st_other values are stored in the second byte of get/setFlags
 
 // Other is stored in the last six bits of st_other
 // st_other values are stored in the second byte of get/setFlags
-void MCELF::setOther(MCSymbolData &SD, unsigned Other) {
+void MCELF::setOther(MCSymbol &Sym, unsigned Other) {
+  MCSymbolData &SD = Sym.getData();
   uint32_t OtherFlags = SD.getFlags() & ~(0x3f << ELF_STO_Shift);
   SD.setFlags(OtherFlags | (Other << ELF_STO_Shift));
 }
 
   uint32_t OtherFlags = SD.getFlags() & ~(0x3f << ELF_STO_Shift);
   SD.setFlags(OtherFlags | (Other << ELF_STO_Shift));
 }
 
-unsigned MCELF::getOther(const MCSymbolData &SD) {
+unsigned MCELF::getOther(const MCSymbol &Sym) {
+  MCSymbolData &SD = Sym.getData();
   unsigned Other =
     (SD.getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
   return Other;
   unsigned Other =
     (SD.getFlags() & (0x3f << ELF_STO_Shift)) >> ELF_STO_Shift;
   return Other;
index 8224d635062164560d9e48aea9cde2d8f90ad9b0..7fb51ae486817a2ec5ee709d7e4bd5f511cb026c 100644 (file)
@@ -113,9 +113,8 @@ void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
 
   const MCSectionELF &Section =
     static_cast<const MCSectionELF&>(Symbol->getSection());
 
   const MCSectionELF &Section =
     static_cast<const MCSectionELF&>(Symbol->getSection());
-  MCSymbolData &SD = Symbol->getData();
   if (Section.getFlags() & ELF::SHF_TLS)
   if (Section.getFlags() & ELF::SHF_TLS)
-    MCELF::SetType(SD, ELF::STT_TLS);
+    MCELF::SetType(*Symbol, ELF::STT_TLS);
 }
 
 void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
 }
 
 void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
@@ -165,8 +164,10 @@ void MCELFStreamer::ChangeSection(MCSection *Section,
     Begin = Ctx.getOrCreateSectionSymbol(*SectionELF);
     Section->setBeginSymbol(Begin);
   }
     Begin = Ctx.getOrCreateSectionSymbol(*SectionELF);
     Section->setBeginSymbol(Begin);
   }
-  if (Begin->isUndefined())
-    MCELF::SetType(Asm.getOrCreateSymbolData(*Begin), ELF::STT_SECTION);
+  if (Begin->isUndefined()) {
+    Asm.getOrCreateSymbolData(*Begin);
+    MCELF::SetType(*Begin, ELF::STT_SECTION);
+  }
 }
 
 void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
 }
 
 void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
@@ -236,72 +237,73 @@ bool MCELFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
     break;
 
   case MCSA_ELF_TypeGnuUniqueObject:
     break;
 
   case MCSA_ELF_TypeGnuUniqueObject:
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD), ELF::STT_OBJECT));
-    MCELF::SetBinding(SD, ELF::STB_GNU_UNIQUE);
+    MCELF::SetType(
+        *Symbol, CombineSymbolTypes(MCELF::GetType(*Symbol), ELF::STT_OBJECT));
+    MCELF::SetBinding(*Symbol, ELF::STB_GNU_UNIQUE);
     SD.setExternal(true);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_Global:
     SD.setExternal(true);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_Global:
-    MCELF::SetBinding(SD, ELF::STB_GLOBAL);
+    MCELF::SetBinding(*Symbol, ELF::STB_GLOBAL);
     SD.setExternal(true);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_WeakReference:
   case MCSA_Weak:
     SD.setExternal(true);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_WeakReference:
   case MCSA_Weak:
-    MCELF::SetBinding(SD, ELF::STB_WEAK);
+    MCELF::SetBinding(*Symbol, ELF::STB_WEAK);
     SD.setExternal(true);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_Local:
     SD.setExternal(true);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_Local:
-    MCELF::SetBinding(SD, ELF::STB_LOCAL);
+    MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
     SD.setExternal(false);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_ELF_TypeFunction:
     SD.setExternal(false);
     BindingExplicitlySet.insert(Symbol);
     break;
 
   case MCSA_ELF_TypeFunction:
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD),
-                                          ELF::STT_FUNC));
+    MCELF::SetType(*Symbol,
+                   CombineSymbolTypes(MCELF::GetType(*Symbol), ELF::STT_FUNC));
     break;
 
   case MCSA_ELF_TypeIndFunction:
     break;
 
   case MCSA_ELF_TypeIndFunction:
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD),
-                                          ELF::STT_GNU_IFUNC));
+    MCELF::SetType(*Symbol, CombineSymbolTypes(MCELF::GetType(*Symbol),
+                                               ELF::STT_GNU_IFUNC));
     break;
 
   case MCSA_ELF_TypeObject:
     break;
 
   case MCSA_ELF_TypeObject:
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD),
-                                          ELF::STT_OBJECT));
+    MCELF::SetType(
+        *Symbol, CombineSymbolTypes(MCELF::GetType(*Symbol), ELF::STT_OBJECT));
     break;
 
   case MCSA_ELF_TypeTLS:
     break;
 
   case MCSA_ELF_TypeTLS:
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD),
-                                          ELF::STT_TLS));
+    MCELF::SetType(*Symbol,
+                   CombineSymbolTypes(MCELF::GetType(*Symbol), ELF::STT_TLS));
     break;
 
   case MCSA_ELF_TypeCommon:
     // TODO: Emit these as a common symbol.
     break;
 
   case MCSA_ELF_TypeCommon:
     // TODO: Emit these as a common symbol.
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD),
-                                          ELF::STT_OBJECT));
+    MCELF::SetType(
+        *Symbol, CombineSymbolTypes(MCELF::GetType(*Symbol), ELF::STT_OBJECT));
     break;
 
   case MCSA_ELF_TypeNoType:
     break;
 
   case MCSA_ELF_TypeNoType:
-    MCELF::SetType(SD, CombineSymbolTypes(MCELF::GetType(SD),
-                                          ELF::STT_NOTYPE));
+    MCELF::SetType(
+        *Symbol, CombineSymbolTypes(MCELF::GetType(*Symbol), ELF::STT_NOTYPE));
     break;
 
   case MCSA_Protected:
     break;
 
   case MCSA_Protected:
-    MCELF::SetVisibility(SD, ELF::STV_PROTECTED);
+    MCELF::SetVisibility(*Symbol, ELF::STV_PROTECTED);
     break;
 
   case MCSA_Hidden:
     break;
 
   case MCSA_Hidden:
-    MCELF::SetVisibility(SD, ELF::STV_HIDDEN);
+    MCELF::SetVisibility(*Symbol, ELF::STV_HIDDEN);
     break;
 
   case MCSA_Internal:
     break;
 
   case MCSA_Internal:
-    MCELF::SetVisibility(SD, ELF::STV_INTERNAL);
+    MCELF::SetVisibility(*Symbol, ELF::STV_INTERNAL);
     break;
   }
 
     break;
   }
 
@@ -313,13 +315,13 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
   MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
 
   if (!BindingExplicitlySet.count(Symbol)) {
   MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
 
   if (!BindingExplicitlySet.count(Symbol)) {
-    MCELF::SetBinding(SD, ELF::STB_GLOBAL);
+    MCELF::SetBinding(*Symbol, ELF::STB_GLOBAL);
     SD.setExternal(true);
   }
 
     SD.setExternal(true);
   }
 
-  MCELF::SetType(SD, ELF::STT_OBJECT);
+  MCELF::SetType(*Symbol, ELF::STT_OBJECT);
 
 
-  if (MCELF::GetBinding(SD) == ELF_STB_Local) {
+  if (MCELF::GetBinding(*Symbol) == ELF_STB_Local) {
     MCSection *Section = getAssembler().getContext().getELFSection(
         ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
 
     MCSection *Section = getAssembler().getContext().getELFSection(
         ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
 
@@ -342,7 +344,7 @@ void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
                                           unsigned ByteAlignment) {
   // FIXME: Should this be caught and done earlier?
   MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
                                           unsigned ByteAlignment) {
   // FIXME: Should this be caught and done earlier?
   MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
-  MCELF::SetBinding(SD, ELF::STB_LOCAL);
+  MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
   SD.setExternal(false);
   BindingExplicitlySet.insert(Symbol);
   EmitCommonSymbol(Symbol, Size, ByteAlignment);
   SD.setExternal(false);
   BindingExplicitlySet.insert(Symbol);
   EmitCommonSymbol(Symbol, Size, ByteAlignment);
@@ -458,8 +460,8 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) {
     case MCSymbolRefExpr::VK_PPC_TLSLD:
       break;
     }
     case MCSymbolRefExpr::VK_PPC_TLSLD:
       break;
     }
-    MCSymbolData &SD = getAssembler().getOrCreateSymbolData(symRef.getSymbol());
-    MCELF::SetType(SD, ELF::STT_TLS);
+    getAssembler().getOrCreateSymbolData(symRef.getSymbol());
+    MCELF::SetType(symRef.getSymbol(), ELF::STT_TLS);
     break;
   }
 
     break;
   }
 
index 204a1abe72b53f84c1b868116b06d7ab05df547c..3bf480fb9a45418f8d94cdbf8bff53705f285c53 100644 (file)
@@ -165,8 +165,8 @@ private:
         Name + "." + Twine(MappingSymbolCounter++));
 
     MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
         Name + "." + Twine(MappingSymbolCounter++));
 
     MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
-    MCELF::SetType(SD, ELF::STT_NOTYPE);
-    MCELF::SetBinding(SD, ELF::STB_LOCAL);
+    MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
+    MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
     SD.setExternal(false);
     auto Sec = getCurrentSection().first;
     assert(Sec && "need a section");
     SD.setExternal(false);
     auto Sec = getCurrentSection().first;
     assert(Sec && "need a section");
index 74b81af2cb4d61a97e83cac8d6d1212e4bf9d7a8..c7ce35d826644f34dbda1b309cdf547c55065590 100644 (file)
@@ -121,8 +121,7 @@ static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm) {
     // We're known to be under a TLS fixup, so any symbol should be
     // modified. There should be only one.
     const MCSymbolRefExpr &SymRef = *cast<MCSymbolRefExpr>(Expr);
     // We're known to be under a TLS fixup, so any symbol should be
     // modified. There should be only one.
     const MCSymbolRefExpr &SymRef = *cast<MCSymbolRefExpr>(Expr);
-    MCSymbolData &SD = Asm.getOrCreateSymbolData(SymRef.getSymbol());
-    MCELF::SetType(SD, ELF::STT_TLS);
+    MCELF::SetType(SymRef.getSymbol(), ELF::STT_TLS);
     break;
   }
 
     break;
   }
 
index 4dc3dac7f5619a7dd5d81c67f8d2a94373ab2df7..10d66e9d10860f407347b03d89ac3f8dac997926 100644 (file)
@@ -567,8 +567,8 @@ private:
                                      Twine(MappingSymbolCounter++));
 
     MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
                                      Twine(MappingSymbolCounter++));
 
     MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
-    MCELF::SetType(SD, ELF::STT_NOTYPE);
-    MCELF::SetBinding(SD, ELF::STB_LOCAL);
+    MCELF::SetType(*Symbol, ELF::STT_NOTYPE);
+    MCELF::SetBinding(*Symbol, ELF::STB_LOCAL);
     SD.setExternal(false);
     AssignSection(Symbol, getCurrentSection().first);
 
     SD.setExternal(false);
     AssignSection(Symbol, getCurrentSection().first);
 
@@ -972,8 +972,8 @@ void ARMTargetELFStreamer::emitLabel(MCSymbol *Symbol) {
   if (!Streamer.IsThumb)
     return;
 
   if (!Streamer.IsThumb)
     return;
 
-  const MCSymbolData &SD = Streamer.getOrCreateSymbolData(Symbol);
-  unsigned Type = MCELF::GetType(SD);
+  Streamer.getOrCreateSymbolData(Symbol);
+  unsigned Type = MCELF::GetType(*Symbol);
   if (Type == ELF_STT_Func || Type == ELF_STT_GnuIFunc)
     Streamer.EmitThumbFunc(Symbol);
 }
   if (Type == ELF_STT_Func || Type == ELF_STT_GnuIFunc)
     Streamer.EmitThumbFunc(Symbol);
 }
index d95b448c4b08b1785d5ce9b1075469f101162767..8cc6b3b1354497ab939d080be6ce9a7ecd614b45 100644 (file)
@@ -271,9 +271,7 @@ static unsigned getMatchingLoType(const MCAssembler &Asm,
   if (Type == ELF::R_MIPS16_HI16)
     return ELF::R_MIPS16_LO16;
 
   if (Type == ELF::R_MIPS16_HI16)
     return ELF::R_MIPS16_LO16;
 
-  const MCSymbolData &SD = Reloc.Symbol->getData();
-
-  if (MCELF::GetBinding(SD) != ELF::STB_LOCAL)
+  if (MCELF::GetBinding(*Reloc.Symbol) != ELF::STB_LOCAL)
     return ELF::R_MIPS_NONE;
 
   if (Type == ELF::R_MIPS_GOT16)
     return ELF::R_MIPS_NONE;
 
   if (Type == ELF::R_MIPS_GOT16)
@@ -433,7 +431,7 @@ bool MipsELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
     return true;
 
   case ELF::R_MIPS_32:
     return true;
 
   case ELF::R_MIPS_32:
-    if (MCELF::getOther(Sym.getData()) & (ELF::STO_MIPS_MICROMIPS >> 2))
+    if (MCELF::getOther(Sym) & (ELF::STO_MIPS_MICROMIPS >> 2))
       return true;
     // falltrough
   case ELF::R_MIPS_26:
       return true;
     // falltrough
   case ELF::R_MIPS_26:
index d2b51831245a84a0dc00df77757321d10ac67049..8abd93bd6684ccf78cdc9055fad26f73c34c0107 100644 (file)
@@ -42,11 +42,11 @@ void MipsELFStreamer::createPendingLabelRelocs() {
   // FIXME: Also mark labels when in MIPS16 mode.
   if (ELFTargetStreamer->isMicroMipsEnabled()) {
     for (auto Label : Labels) {
   // FIXME: Also mark labels when in MIPS16 mode.
   if (ELFTargetStreamer->isMicroMipsEnabled()) {
     for (auto Label : Labels) {
-      MCSymbolData &Data = getOrCreateSymbolData(Label);
+      getOrCreateSymbolData(Label);
       // The "other" values are stored in the last 6 bits of the second byte.
       // The traditional defines for STO values assume the full byte and thus
       // the shift to pack it.
       // The "other" values are stored in the last 6 bits of the second byte.
       // The traditional defines for STO values assume the full byte and thus
       // the shift to pack it.
-      MCELF::setOther(Data, ELF::STO_MIPS_MICROMIPS >> 2);
+      MCELF::setOther(*Label, ELF::STO_MIPS_MICROMIPS >> 2);
     }
   }
 
     }
   }
 
index 0ff14e495c15465e365e73a1ec6c282fb691206e..aa414d73ac3ec8266ae8f85d04b572f58187b15c 100644 (file)
@@ -441,15 +441,15 @@ MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S,
 void MipsTargetELFStreamer::emitLabel(MCSymbol *Symbol) {
   if (!isMicroMipsEnabled())
     return;
 void MipsTargetELFStreamer::emitLabel(MCSymbol *Symbol) {
   if (!isMicroMipsEnabled())
     return;
-  MCSymbolData &Data = getStreamer().getOrCreateSymbolData(Symbol);
-  uint8_t Type = MCELF::GetType(Data);
+  getStreamer().getOrCreateSymbolData(Symbol);
+  uint8_t Type = MCELF::GetType(*Symbol);
   if (Type != ELF::STT_FUNC)
     return;
 
   // The "other" values are stored in the last 6 bits of the second byte
   // The traditional defines for STO values assume the full byte and thus
   // the shift to pack it.
   if (Type != ELF::STT_FUNC)
     return;
 
   // The "other" values are stored in the last 6 bits of the second byte
   // The traditional defines for STO values assume the full byte and thus
   // the shift to pack it.
-  MCELF::setOther(Data, ELF::STO_MIPS_MICROMIPS >> 2);
+  MCELF::setOther(*Symbol, ELF::STO_MIPS_MICROMIPS >> 2);
 }
 
 void MipsTargetELFStreamer::finish() {
 }
 
 void MipsTargetELFStreamer::finish() {
@@ -510,16 +510,14 @@ void MipsTargetELFStreamer::emitAssignment(MCSymbol *Symbol,
     return;
   const MCSymbol &RhsSym =
       static_cast<const MCSymbolRefExpr *>(Value)->getSymbol();
     return;
   const MCSymbol &RhsSym =
       static_cast<const MCSymbolRefExpr *>(Value)->getSymbol();
-  MCSymbolData &Data = getStreamer().getOrCreateSymbolData(&RhsSym);
 
 
-  if (!(MCELF::getOther(Data) & (ELF::STO_MIPS_MICROMIPS >> 2)))
+  if (!(MCELF::getOther(RhsSym) & (ELF::STO_MIPS_MICROMIPS >> 2)))
     return;
 
     return;
 
-  MCSymbolData &SymbolData = getStreamer().getOrCreateSymbolData(Symbol);
   // The "other" values are stored in the last 6 bits of the second byte.
   // The traditional defines for STO values assume the full byte and thus
   // the shift to pack it.
   // The "other" values are stored in the last 6 bits of the second byte.
   // The traditional defines for STO values assume the full byte and thus
   // the shift to pack it.
-  MCELF::setOther(SymbolData, ELF::STO_MIPS_MICROMIPS >> 2);
+  MCELF::setOther(*Symbol, ELF::STO_MIPS_MICROMIPS >> 2);
 }
 
 MCELFStreamer &MipsTargetELFStreamer::getStreamer() {
 }
 
 MCELFStreamer &MipsTargetELFStreamer::getStreamer() {
index 1bfa1534ae6c7e7239e3d0b0b3672e7281ee243d..0fe3534ad62074c4061396bccd8f9dcecf9bbff8 100644 (file)
@@ -142,11 +142,10 @@ public:
       // to resolve the fixup directly.  Emit a relocation and leave
       // resolution of the final target address to the linker.
       if (const MCSymbolRefExpr *A = Target.getSymA()) {
       // to resolve the fixup directly.  Emit a relocation and leave
       // resolution of the final target address to the linker.
       if (const MCSymbolRefExpr *A = Target.getSymA()) {
-        const MCSymbolData &Data = A->getSymbol().getData();
         // The "other" values are stored in the last 6 bits of the second byte.
         // The traditional defines for STO values assume the full byte and thus
         // the shift to pack it.
         // The "other" values are stored in the last 6 bits of the second byte.
         // The traditional defines for STO values assume the full byte and thus
         // the shift to pack it.
-        unsigned Other = MCELF::getOther(Data) << 2;
+        unsigned Other = MCELF::getOther(A->getSymbol()) << 2;
         if ((Other & ELF::STO_PPC64_LOCAL_MASK) != 0)
           IsResolved = false;
       }
         if ((Other & ELF::STO_PPC64_LOCAL_MASK) != 0)
           IsResolved = false;
       }
index 704cafff8898257b956321e2319934d27377ff0f..c0147763dbc9d2fdae99cc853c73021edf326688 100644 (file)
@@ -407,7 +407,7 @@ bool PPCELFObjectWriter::needsRelocateWithSymbol(const MCSymbol &Sym,
       // The "other" values are stored in the last 6 bits of the second byte.
       // The traditional defines for STO values assume the full byte and thus
       // the shift to pack it.
       // The "other" values are stored in the last 6 bits of the second byte.
       // The traditional defines for STO values assume the full byte and thus
       // the shift to pack it.
-      unsigned Other = MCELF::getOther(Sym.getData()) << 2;
+      unsigned Other = MCELF::getOther(Sym) << 2;
       return (Other & ELF::STO_PPC64_LOCAL_MASK) != 0;
   }
 }
       return (Other & ELF::STO_PPC64_LOCAL_MASK) != 0;
   }
 }
index 847437611a5fb7310d9b175246866932ca25e3e6..ef1db075ccf5faa1efd2b9e6787a9612bd88abc9 100644 (file)
@@ -161,7 +161,6 @@ public:
   }
   void emitLocalEntry(MCSymbol *S, const MCExpr *LocalOffset) override {
     MCAssembler &MCA = getStreamer().getAssembler();
   }
   void emitLocalEntry(MCSymbol *S, const MCExpr *LocalOffset) override {
     MCAssembler &MCA = getStreamer().getAssembler();
-    MCSymbolData &Data = getStreamer().getOrCreateSymbolData(S);
 
     int64_t Res;
     if (!LocalOffset->EvaluateAsAbsolute(Res, MCA))
 
     int64_t Res;
     if (!LocalOffset->EvaluateAsAbsolute(Res, MCA))
@@ -174,10 +173,10 @@ public:
     // The "other" values are stored in the last 6 bits of the second byte.
     // The traditional defines for STO values assume the full byte and thus
     // the shift to pack it.
     // The "other" values are stored in the last 6 bits of the second byte.
     // The traditional defines for STO values assume the full byte and thus
     // the shift to pack it.
-    unsigned Other = MCELF::getOther(Data) << 2;
+    unsigned Other = MCELF::getOther(*S) << 2;
     Other &= ~ELF::STO_PPC64_LOCAL_MASK;
     Other |= Encoded;
     Other &= ~ELF::STO_PPC64_LOCAL_MASK;
     Other |= Encoded;
-    MCELF::setOther(Data, Other >> 2);
+    MCELF::setOther(*S, Other >> 2);
 
     // For GAS compatibility, unless we already saw a .abiversion directive,
     // set e_flags to indicate ELFv2 ABI.
 
     // For GAS compatibility, unless we already saw a .abiversion directive,
     // set e_flags to indicate ELFv2 ABI.
@@ -192,15 +191,13 @@ public:
       return;
     const MCSymbol &RhsSym =
         static_cast<const MCSymbolRefExpr *>(Value)->getSymbol();
       return;
     const MCSymbol &RhsSym =
         static_cast<const MCSymbolRefExpr *>(Value)->getSymbol();
-    MCSymbolData &Data = getStreamer().getOrCreateSymbolData(&RhsSym);
-    MCSymbolData &SymbolData = getStreamer().getOrCreateSymbolData(Symbol);
     // The "other" values are stored in the last 6 bits of the second byte.
     // The traditional defines for STO values assume the full byte and thus
     // the shift to pack it.
     // The "other" values are stored in the last 6 bits of the second byte.
     // The traditional defines for STO values assume the full byte and thus
     // the shift to pack it.
-    unsigned Other = MCELF::getOther(SymbolData) << 2;
+    unsigned Other = MCELF::getOther(*Symbol) << 2;
     Other &= ~ELF::STO_PPC64_LOCAL_MASK;
     Other &= ~ELF::STO_PPC64_LOCAL_MASK;
-    Other |= (MCELF::getOther(Data) << 2) & ELF::STO_PPC64_LOCAL_MASK;
-    MCELF::setOther(SymbolData, Other >> 2);
+    Other |= (MCELF::getOther(RhsSym) << 2) & ELF::STO_PPC64_LOCAL_MASK;
+    MCELF::setOther(*Symbol, Other >> 2);
   }
 };
 
   }
 };
 
index d97e3a25c5a792326a52a6401e5316599acf678d..c4853205d15415014d577c30f664ee949a4b5ccd 100644 (file)
@@ -184,8 +184,7 @@ static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm) {
 
   case MCExpr::SymbolRef: {
     const MCSymbolRefExpr &SymRef = *cast<MCSymbolRefExpr>(Expr);
 
   case MCExpr::SymbolRef: {
     const MCSymbolRefExpr &SymRef = *cast<MCSymbolRefExpr>(Expr);
-    MCSymbolData &SD = Asm.getOrCreateSymbolData(SymRef.getSymbol());
-    MCELF::SetType(SD, ELF::STT_TLS);
+    MCELF::SetType(SymRef.getSymbol(), ELF::STT_TLS);
     break;
   }
 
     break;
   }