This reverts commit r200064 and r200051.
[oota-llvm.git] / lib / Target / Mips / MCTargetDesc / MipsTargetStreamer.cpp
index 738fa2b204da521c5cf8ad717124559edcd33df8..6b57dff2c83d8c1b74bc3d701418f801a50ce61d 100644 (file)
@@ -65,15 +65,20 @@ void MipsTargetAsmStreamer::emitDirectiveOptionPic0() {
 }
 
 // This part is for ELF object output.
-MipsTargetELFStreamer::MipsTargetELFStreamer() {}
+MipsTargetELFStreamer::MipsTargetELFStreamer() : MicroMipsEnabled(false) {}
 
 void MipsTargetELFStreamer::emitLabel(MCSymbol *Symbol) {
+  if (!isMicroMipsEnabled())
+    return;
   MCSymbolData &Data = getStreamer().getOrCreateSymbolData(Symbol);
+  uint8_t Type = MCELF::GetType(Data);
+  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 (isMicroMipsEnabled())
-    MCELF::setOther(Data, ELF::STO_MIPS_MICROMIPS >> 2);
+  MCELF::setOther(Data, ELF::STO_MIPS_MICROMIPS >> 2);
 }
 
 MCELFStreamer &MipsTargetELFStreamer::getStreamer() {
@@ -94,7 +99,10 @@ void MipsTargetELFStreamer::emitDirectiveSetNoMicroMips() {
 }
 
 void MipsTargetELFStreamer::emitDirectiveSetMips16() {
-  // FIXME: implement.
+  MCAssembler &MCA = getStreamer().getAssembler();
+  unsigned Flags = MCA.getELFHeaderEFlags();
+  Flags |= ELF::EF_MIPS_ARCH_ASE_M16;
+  MCA.setELFHeaderEFlags(Flags);
 }
 
 void MipsTargetELFStreamer::emitDirectiveSetNoMips16() {