This is an archive of the discontinued LLVM Phabricator instance.

[mips] Put some MIPS-specific sections to separate segments
ClosedPublic

Authored by atanasyan on Feb 19 2019, 3:19 AM.

Details

Summary

Three MIPS-specific sections .reginfo, .MIPS.options, and .MIPS.abiflags are used by loader to read their contents and setup environment for running a program. Loader looks up these data in the corresponding segments: PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS respectively.

This patch put these sections to separate segments like we do already for ARM SHT_ARM_EXIDX section.

Diff Detail

Repository
rL LLVM

Event Timeline

atanasyan created this revision.Feb 19 2019, 3:19 AM
grimar added inline comments.Feb 19 2019, 3:49 AM
lld/ELF/Writer.cpp
2070 ↗(On Diff #187338)

Hdrs was Phdrs originally and it seems how it is named in the code usually.
I would keep it.

lld/test/ELF/basic-mips.s
329 ↗(On Diff #187338)

Seems PT_MIPS_OPTIONS is untested?

lld/test/ELF/eh-frame-hdr-abs-fde.s
1 ↗(On Diff #187338)

I was wondering why this test case changed until saw it requires mips.
Should it just use x86 it seems?

atanasyan marked 3 inline comments as done.Feb 19 2019, 6:29 AM

Thanks for review.

lld/ELF/Writer.cpp
2070 ↗(On Diff #187338)

Agreed.

lld/test/ELF/basic-mips.s
329 ↗(On Diff #187338)

Good point. I will add a test case.

lld/test/ELF/eh-frame-hdr-abs-fde.s
1 ↗(On Diff #187338)

Do you like to convert this test for using x86 as a target architecture? If so, what is the reason?

grimar added inline comments.Feb 19 2019, 6:40 AM
lld/test/ELF/eh-frame-hdr-abs-fde.s
1 ↗(On Diff #187338)

Seems the functionality tested by this test is not MIPS specific, but generic and so is can be useful for all targets.
x86 is probably tested on more bots and used as a generic target in LLD (where all not target specific
features are usually tested).

atanasyan updated this revision to Diff 187375.Feb 19 2019, 8:04 AM
  • Fixed function arguments' names
  • Added test for the PT_MIPS_OPTIONS segment creation
grimar accepted this revision.Feb 20 2019, 3:26 AM

LGTM

This revision is now accepted and ready to land.Feb 20 2019, 3:26 AM
This revision was automatically updated to reflect the committed changes.