From: Rafael Espindola Date: Wed, 15 Jan 2014 03:07:12 +0000 (+0000) Subject: Only mark functions as micromips. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f6cb056e416b0f424244a4ec199870264b33a2c7;p=oota-llvm.git Only mark functions as micromips. The GNU as behavior is a bit different and very strange. It will mark any label that contains an instruction. We can implement that, but using the type looks more natural since gas will not mark a function if a .word is used to output the instructions! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199287 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp index 738fa2b204d..d94d33ad24f 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -68,12 +68,17 @@ void MipsTargetAsmStreamer::emitDirectiveOptionPic0() { MipsTargetELFStreamer::MipsTargetELFStreamer() {} 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() { diff --git a/test/MC/Mips/elf_st_other.s b/test/MC/Mips/elf_st_other.s index eb685c3760c..579707b6be3 100644 --- a/test/MC/Mips/elf_st_other.s +++ b/test/MC/Mips/elf_st_other.s @@ -2,15 +2,24 @@ .globl f1 +.type f1, @function .set micromips f1: nop +.globl d1 +.type d1, @object +d1: +.word 42 + .globl f2 +.type f2, @function .set nomicromips f2: nop +// CHECK-LABEL: Name: d1 +// CHECK: Other: 0 // CHECK-LABEL: Name: f1 // CHECK: Other: 128 // CHECK-LABEL: Name: f2