Hi, Thanks for pointing direction. As far, as I understand by reversing, logic, that I want to overwrite is digged into: lib/MC/MCSectionELF.cpp MCSectionELF::PrintSwitchToSection if (ShouldOmitSectionDirective(SectionName, MAI)) { OS << '\t' << getSectionName() << '\n'; return; } // otherwise print ".section" directive and then section name So I need to overwrite ShouldOmitSectionDirective behavior. But this method of MCSectionELF is not virtual. As a workaround, I stubbed it in core LLVM code (MCSectionELF::ShouldOmitSectionDirective), and everything works, but it is ugly. May be you can advise further? --- With best regards, Konstantin On Wed, Mar 14, 2012 at 9:29 PM, Anton Korobeynikov <anton at korobeynikov.info> wrote:> Hello > >> I really need in my backend value for this section, distinct from >> default. Where can I set it? > It was renamed to ReadOnlySection. You might want to check the logic > inside CodeGen/TargetLoweringObjectFileImp.cpp (in particular - > TargetLoweringObjectFile::SelectionSectionForGlobal) to see how it's > used. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University
On Thu, Mar 15, 2012 at 11:00:54AM +0400, Konstantin Vladimirov wrote:> Hi, > > Thanks for pointing direction. As far, as I understand by reversing, > logic, that I want to overwrite is digged into: > > lib/MC/MCSectionELF.cpp > > MCSectionELF::PrintSwitchToSection > > if (ShouldOmitSectionDirective(SectionName, MAI)) { > OS << '\t' << getSectionName() << '\n'; > return; > } > > // otherwise print ".section" directive and then section name > > So I need to overwrite ShouldOmitSectionDirective behavior. But this > method of MCSectionELF is not virtual. > As a workaround, I stubbed it in core LLVM code > (MCSectionELF::ShouldOmitSectionDirective), and everything works, but > it is ugly. May be you can advise further?I think you are off the mark here. The fragment above is used to create .text instead of .section ".text" or other more ugly forms. This is really just an optimisation for readiblity and compatibility with ancient tools. Joerg
Hi, What I want is to emit exact custom string to switch to rodata, without ".section" in the front of it. I can see only that place where ".section" directive is hardcoded. It is relatively new hardcode -- earlier versions had string ConstantPoolSection to operate with. --- With best regards, Konstantin On Thu, Mar 15, 2012 at 11:40 AM, Joerg Sonnenberger <joerg at britannica.bec.de> wrote:> On Thu, Mar 15, 2012 at 11:00:54AM +0400, Konstantin Vladimirov wrote: >> Hi, >> >> Thanks for pointing direction. As far, as I understand by reversing, >> logic, that I want to overwrite is digged into: >> >> lib/MC/MCSectionELF.cpp >> >> MCSectionELF::PrintSwitchToSection >> >> if (ShouldOmitSectionDirective(SectionName, MAI)) { >> OS << '\t' << getSectionName() << '\n'; >> return; >> } >> >> // otherwise print ".section" directive and then section name >> >> So I need to overwrite ShouldOmitSectionDirective behavior. But this >> method of MCSectionELF is not virtual. >> As a workaround, I stubbed it in core LLVM code >> (MCSectionELF::ShouldOmitSectionDirective), and everything works, but >> it is ugly. May be you can advise further? > > I think you are off the mark here. The fragment above is used to create > > .text > > instead of > > .section ".text" > > or other more ugly forms. This is really just an optimisation for > readiblity and compatibility with ancient tools. > > Joerg > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Hello> So I need to overwrite ShouldOmitSectionDirective behavior. But this > method of MCSectionELF is not virtual. > As a workaround, I stubbed it in core LLVM code > (MCSectionELF::ShouldOmitSectionDirective), and everything works, but > it is ugly. May be you can advise further?So, it seems that: 1. You're using ELF for your target 2. The assember you're using despite pretending to be ELF-ish is so broken, that it requires something like ".foo" instead of ".section .foo" ? Is it so? -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University