[PATCH][AsmParser][MC] Allow asm parser to emit elf header flags

Jim Grosbach grosbach at apple.com
Fri Oct 25 14:15:36 PDT 2013


On Oct 25, 2013, at 2:04 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:

> On 25 October 2013 15:16, Jack Carter <Jack.Carter at imgtec.com> wrote:
>> Rafael,
>> 
>> I believe the following is all you are trying to get across to us:
>> 
>> The main point is that for every line of ascii assembler code that can be written out, a streamer method must represent it so that AsmPrinter will just be making one generic call for each of them oblivious of the output type. The underlying streamer type would determine the form of the output.  AsmParser would use the same interface.
> 
> Correct.
> 
>> Non-assembler code output such as commandline information is to be output through different methods and not through the streamer since it is not going to be seen in a resultant .s file.
> 
> Correct.
> 
>> If it can be seen in a .s file it goes through the streamer. If not, it doesn't.
> 
> Correct.
> 
>> There may be a single method for any directive that changes/sets the relocation model. It would not only be used of .abicalls, but also for -call_nonpic, -call_shared, -KPIC, -non_shared, etc.
> 
> Normally there is one method per directive, but there is some
> flexibility if two directives are closely related.
> 

Just poking in quickly to agree with all the above.

That said, options that end up in the .o file but can’t be represented in the .s file are really unfortunate, as it makes it harder to reproduce differences between direct-to-object vs. object via assembler, but fixing that is out of scope for this, really. The general design is that everything like this should be on the streamer, but that’s a consequence of everything supposedly having an assembly source file representation. When the latter breaks down, so does the former and we have to improvise.


> 
>> There may be another method (emitMipsArchDir) that would handle the -mips[1-4], -mips32r2, etc.
> 
> Sorry, what is -mips32r2 a command line option?
> 
>> Is this a reasonable definition?
>> 
>> Jack
> 
> Cheers,
> Rafael





More information about the llvm-commits mailing list