This is an archive of the discontinued LLVM Phabricator instance.

[lld/ELF] Sort sections by SHF_X86_64_LARGE
AbandonedPublic

Authored by aeubanks on Apr 14 2023, 10:47 AM.

Details

Summary

So that binaries with both large and non-large sections will have the
non-large sections together, lowering the chance of relocation overflows
between the non-large sections.

Diff Detail

Event Timeline

aeubanks created this revision.Apr 14 2023, 10:47 AM
Herald added a project: Restricted Project. · View Herald Transcript
aeubanks requested review of this revision.Apr 14 2023, 10:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 10:47 AM

The MC and lld/ELF parts belong to different patches.

The SHF_X86_64_LARGE MC change should test llvm-readelf -S or llvm-readobj -S output.

tkoeppe accepted this revision.Apr 20 2023, 1:20 PM
This revision is now accepted and ready to land.Apr 20 2023, 1:20 PM

I believe we should be able to rearrange the large sections to be "around" all of the other sections, rather than at the end, in order to reduce the overhead of additional LOAD segments. I was playing with this before my vacation last week, and will post a proposed patch soon.

@jyknight Ah yes, we did discuss that, and that would indeed be a welcome improvement!

right now lld sorts sections by R, RX, RWX, RW. do you mean put large R right before normal R, and large RW right after normal RW, and whatever for large RX and RWX?

I guess that would also be better for having fewer text->data relocation overflows if we go down the -mlarge-data-threshold route

right now lld sorts sections by R, RX, RWX, RW. do you mean put large R right before normal R, and large RW right after normal RW, and whatever for large RX and RWX?

Yes. I would suggest this.

(I didn't notice that this patch had been made green. I'll change myself to a blocking reviewer :))

MaskRay added 1 blocking reviewer(s): MaskRay.Apr 24 2023, 11:52 AM
This revision now requires review to proceed.Apr 24 2023, 11:52 AM
aeubanks abandoned this revision.May 30 2023, 10:10 AM