Page MenuHomePhabricator

MachO: Move LayoutPass to MachO directory.
Needs ReviewPublic

Authored by ruiu on Jan 30 2015, 6:53 PM.

Details

Reviewers
kledzik
Summary

The real user of the LayoutPass is now only Mach-O, so move that
pass out of the common directory to Mach-O directory.

"Core" architecture were using the LayoutPass. I modified that
to use a simple OrderPass. I think no one actually have authority
what feature should be in Core and what's not, but I believe the
LayoutPass is not very suitable for Core. Before more code starts
depending on the complex pass, it's better to remove that from
Core.

I could have simplified that pass because Mach-O is the only user
of the LayoutPass. For example, the second parameter of the
LayoutPass constructor can be converted from optional to mandatory.
I didn't do that in this patch to keep it simple. I'll do in a
followup patch.

Diff Detail

Event Timeline

ruiu updated this revision to Diff 19076.Jan 30 2015, 6:53 PM
ruiu retitled this revision from to MachO: Move LayoutPass to MachO directory..
ruiu updated this object.
ruiu edited the test plan for this revision. (Show Details)
ruiu added a reviewer: kledzik.
ruiu added a project: lld.
ruiu added a subscriber: Unknown Object (MLST).

Again, This pass is needed by ELF to adopt atom order file like macho at which time ELF will use it.

ruiu added a comment.Jan 30 2015, 7:27 PM

It's not correct to say we need that pass to layout atoms for order file. It's perhaps needless to say, but the LayoutPass is not the only way to sort atoms. If we need to sort atoms in some order, we can add code to elf::OrderPass to directly sort atoms in that pass.

That would be so much easier than hacking with layout references for the LayoutPass to let the LayoutPass to interpret that result.

It's just like the InputGraph design that we have just eliminated. We had complex code to set up data for the InputGraph, and the InputGraph does some very complex thing in it. That was not a good design after all, so let's not over-think this time too. When we need to tweak sort order, we can always change "compare" function in elf::OrderPass.