[PATCH][AsmParser][MC] Allow asm parser to emit elf header flags
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Oct 4 21:28:12 PDT 2013
I spent some time reading the code that is already on trunk. It is a
pretty bad violation of the MC design, which is in part why this patch
looks odd.
What needs to happen is
+ MipsMCAsmFlags Flags;
This should be added to the streamer, not the parser. The parser a
really simple layer that driver the streamer. With that, then
if (IDVal == ".abicalls") {
+ Flags.setRelocationModel(MipsMCAsmFlags::MAF_RM_CPIC);
+ if (Parser.getTok().isNot(AsmToken::EndOfStatement))
+ return Error(Parser.getTok().getLoc(), "unexpected token in directive");
+ return false;
+ }
Should call a emitAbitCalls method on the streamer.
And codegen should not have a MipsELFStreamer::emitELFHeaderFlagsCG
and a MipsELFStreamer::emitELFHeaderFlagsAsm. That is the entire point
of having MC!
For this patch, at the very minimum you should transform
EFlags |= ELF::EF_MIPS_CPIC;
to a call to emitAbitCalls before if (hasRawTextSupport()) in
emitELFHeaderFlagsCG.
I am sorry I missed emitELFHeaderFlagsCG when it went in. It should
never have happened.
Cheers,
Rafael
More information about the llvm-commits
mailing list