[Patch] Don't declare all text sections at the start of the .s

Jim Grosbach grosbach at apple.com
Thu Mar 12 17:15:32 PDT 2015


Very interesting. You’re right about the underlying problem. The file header there is to pre-set the final order of the sections, the goal of which is as you point out, to prevent debug info from changing actual code. This particular idiom goes back a ways (at least 2007) and pre-dates LLVM+MachO. As such, my worry here is that there may be other dependencies which have (likely inadvertently) crept in since then. That doesn’t mean this isn’t the right thing to do, of course, but rather that lots of testing is in order so that we can identify and fix any of those things.

-Jim


> On Mar 11, 2015, at 9:02 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
> Hi Jim,
> 
> If I understand it correctly, the code this patch removes was there to
> make sure the text sections went before the dwarf sections. That is
> necessary because MachO uses offsets relative to the start of the
> file, so adding a section can change relaxations.
> 
> The dwarf sections were being printed at the start just to produce
> symbols pointing at the start of those sections.
> 
> I think I unintentionally fixed the underlying issue in r231898. The
> dwarf sections are now printed when they are about to be used, which
> is after we printed the text sections.
> 
> Cheers,
> Rafael
> <t.patch>





More information about the llvm-commits mailing list