mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Implement the missing bits corresponding to .mips_hack_elf_flags.
These were: * noreorder handling on the target object streamer and asm parser. * setting the initial flag bits based on the enabled features. * setting the elf header flag for micromips It is *really* depressing I am the one doing this instead of someone at mips actually taking the time to understand the infrastructure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -636,54 +636,10 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||
|
||||
}
|
||||
|
||||
static void emitELFHeaderFlagsCG(MipsTargetStreamer &TargetStreamer,
|
||||
const MipsSubtarget &Subtarget) {
|
||||
// Update e_header flags
|
||||
unsigned EFlags = 0;
|
||||
|
||||
// TODO: Need to add -mabicalls and -mno-abicalls flags.
|
||||
// Currently we assume that -mabicalls is the default.
|
||||
EFlags |= ELF::EF_MIPS_CPIC;
|
||||
|
||||
if (Subtarget.inMips16Mode())
|
||||
EFlags |= ELF::EF_MIPS_ARCH_ASE_M16;
|
||||
else
|
||||
EFlags |= ELF::EF_MIPS_NOREORDER;
|
||||
|
||||
// Architecture
|
||||
if (Subtarget.hasMips64r2())
|
||||
EFlags |= ELF::EF_MIPS_ARCH_64R2;
|
||||
else if (Subtarget.hasMips64())
|
||||
EFlags |= ELF::EF_MIPS_ARCH_64;
|
||||
else if (Subtarget.hasMips32r2())
|
||||
EFlags |= ELF::EF_MIPS_ARCH_32R2;
|
||||
else
|
||||
EFlags |= ELF::EF_MIPS_ARCH_32;
|
||||
|
||||
if (Subtarget.inMicroMipsMode())
|
||||
EFlags |= ELF::EF_MIPS_MICROMIPS;
|
||||
|
||||
// ABI
|
||||
if (Subtarget.isABI_O32())
|
||||
EFlags |= ELF::EF_MIPS_ABI_O32;
|
||||
|
||||
// Relocation Model
|
||||
Reloc::Model RM = Subtarget.getRelocationModel();
|
||||
if (RM == Reloc::PIC_ || RM == Reloc::Default)
|
||||
EFlags |= ELF::EF_MIPS_PIC;
|
||||
else if (RM == Reloc::Static)
|
||||
; // Do nothing for Reloc::Static
|
||||
else
|
||||
llvm_unreachable("Unsupported relocation model for e_flags");
|
||||
|
||||
TargetStreamer.emitMipsHackELFFlags(EFlags);
|
||||
}
|
||||
|
||||
void MipsAsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
// Emit Mips ELF register info
|
||||
Subtarget->getMReginfo().emitMipsReginfoSectionCG(
|
||||
OutStreamer, getObjFileLowering(), *Subtarget);
|
||||
emitELFHeaderFlagsCG(getTargetStreamer(), *Subtarget);
|
||||
}
|
||||
|
||||
void MipsAsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
|
||||
|
Reference in New Issue
Block a user