Rafael Espíndola
2010-Oct-21 14:50 UTC
[LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
> Hmm, I wish we had this discussion way earlier.. > > How would I emit things in different subsections? I can do a high > level switch to .ARM.attributes, and if I were emitting one blob from > begin to end, using the higher level interface would be preferable, > but it contains additional subsections - which are naturally > represented by MCDataFragments - Is there an MC equivalent of a > SubSection (which is-a Section so I can switch back and forth?) > Currently we only have stuff that go into the File subsection only, > but.. for futureproofing?We cross that bridge when we get there. It might be that the best thing to do is organize the code so that we output the subsections in order. It might be to add some missing feature. For now using the regular streamer API will make this code a lot easier to read.> > -jasonCheers, Rafael
Renato Golin
2010-Oct-21 18:17 UTC
[LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
2010/10/21 Jason Kim <jasonwkim at google.com>:> Of the 45 remaining, there are 4 interesting uses in MCAsmStreamer.cpp > - (I suppose for emitting data constants in a cross platform manner) > The other remaining uses are in AsmPrinter, again to do cross platform things. > It seems a bit strange to use a high level hammer to do ballpeen > work..... But when in Rome.... :-)Hi Jason, Are you printing ELF symbols and sections with AsmPrinter? I was under the impression that you'd create an MCPrinter to deal with the format-independent and only use AsmPrinter/ELFPrinter for specific calls (to AsmStreamer/ObjectStreamer). Or maybe I got it all wrong... cheers, --renato
Rafael Espíndola
2010-Oct-21 18:42 UTC
[LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
> Also what is the preferred method for MC way of setting out subsection > sizes after the fact? I am guessing I need to use an MCFixup? > How do I get an MCExpr to evaluate a method for the subsection size? > Is there an equivalent use in the places using MCFixup? > Do I need to add a new subclass to MCExpr for doing this? > > JimG, can you please comment on the MachO specific parts in the > ARMAsmPrinter.cpp? Is there an example of a "subsection size" that is > "Fixed up" after all the blobs that go into that subsection are > emitted? The closest examples I could find weren't that close :-( > (Matter of fact, for ELF, it looks like the section sizes are actually > calculated after everything has been processed by MCAssembler, and the > headers sizes are not "fixed up" but completely rewritten from the > beginning)I really don't follow. Please just convert the current patch to use the existing APIs. If in the next one you really need a missing feature it will be a lot easier to explain what it is.> Thanks! > > -jasonCheers, Rafael
Jim Grosbach
2010-Oct-21 20:11 UTC
[LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
On Oct 21, 2010, at 11:07 AM, Jason Kim wrote:> On Thu, Oct 21, 2010 at 7:50 AM, Rafael Espíndola > <rafael.espindola at gmail.com> wrote: >>> Hmm, I wish we had this discussion way earlier.. >>> >>> How would I emit things in different subsections? I can do a high >>> level switch to .ARM.attributes, and if I were emitting one blob from >>> begin to end, using the higher level interface would be preferable, >>> but it contains additional subsections - which are naturally >>> represented by MCDataFragments - Is there an MC equivalent of a >>> SubSection (which is-a Section so I can switch back and forth?) >>> Currently we only have stuff that go into the File subsection only, >>> but.. for futureproofing? >> >> We cross that bridge when we get there. It might be that the best >> thing to do is organize the code so that we output the subsections in >> order. It might be to add some missing feature. For now using the >> regular streamer API will make this code a lot easier to read. > > Of the roughly 111 or so calls to EmitIntValue(), rouighly half are in > the Dwarf code, which is cross-architecture. > (And they have their own MCSection types to deal with back and forth > type issues) > > Of the 45 remaining, there are 4 interesting uses in MCAsmStreamer.cpp > - (I suppose for emitting data constants in a cross platform manner) > The other remaining uses are in AsmPrinter, again to do cross platform things. > It seems a bit strange to use a high level hammer to do ballpeen > work..... But when in Rome.... :-) > > Also what is the preferred method for MC way of setting out subsection > sizes after the fact? I am guessing I need to use an MCFixup? > How do I get an MCExpr to evaluate a method for the subsection size? > Is there an equivalent use in the places using MCFixup? > Do I need to add a new subclass to MCExpr for doing this? > > JimG, can you please comment on the MachO specific parts in the > ARMAsmPrinter.cpp? Is there an example of a "subsection size" that is > "Fixed up" after all the blobs that go into that subsection are > emitted? The closest examples I could find weren't that close :-( > (Matter of fact, for ELF, it looks like the section sizes are actually > calculated after everything has been processed by MCAssembler, and the > headers sizes are not "fixed up" but completely rewritten from the > beginning)There's no real equivalent to that for MachO in ARMAsmPrinter that I'm aware of. The Darwin linker can do quite a bit with rearranging things, so those sorts of values at compile/assemble time don't have much meaning. The parts that deal with section/subsection sizes for the object file format are, as far as I can tell, in the object file and section writer classes.> > Thanks! > > -jason >> >>> >>> -jason >> >> Cheers, >> Rafael >>
Reasonably Related Threads
- [LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
- [LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
- [LLVMdev] Fwd: [llvm-commits] Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
- [LLVMdev] Fwd: [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes
- [LLVMdev] [llvm-commits] Fwd: Proof of concept patch for unifying the .s/ELF emission of .ARM.attributes