[llvm] r199287 - Only mark functions as micromips.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jan 14 19:07:12 PST 2014
Author: rafael
Date: Tue Jan 14 21:07:12 2014
New Revision: 199287
URL: http://llvm.org/viewvc/llvm-project?rev=199287&view=rev
Log:
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!
Modified:
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
llvm/trunk/test/MC/Mips/elf_st_other.s
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp?rev=199287&r1=199286&r2=199287&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp Tue Jan 14 21:07:12 2014
@@ -68,12 +68,17 @@ void MipsTargetAsmStreamer::emitDirectiv
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() {
Modified: llvm/trunk/test/MC/Mips/elf_st_other.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/elf_st_other.s?rev=199287&r1=199286&r2=199287&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/elf_st_other.s (original)
+++ llvm/trunk/test/MC/Mips/elf_st_other.s Tue Jan 14 21:07:12 2014
@@ -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
More information about the llvm-commits
mailing list