[PATCH] [MachO] Implement -order_file as a separate ordering pass.

Rui Ueyama ruiu at google.com
Tue Jan 27 14:15:41 PST 2015


Hi kledzik,

On Mac OS you can pass a text file as an argument for -order_file
command line option. That file contains a list of symbols, and the
linker sorts these symbols in the same order as in the order file.

That custom ordering was implemented by adding a "custom" comparator
function to the LayoutPass. That made the comparator function in the
LayoutPass, which does too much stuff already, more complex.

I'm trying to make the pass simpler and faster. I found that if we
implement the feature as a separate pass, it becomes easy to understand.

In this patch, I added a new pass, OrderPass, which sorts atoms
according to the order file. Because it uses stable sort, it preserves
symbol order if they are not mentioned in the order file. We already
took similar approach in PE/COFF (PECOFF/GroupSectionPass.h).

This patch has no change in functionality.

http://reviews.llvm.org/D7212

Files:
  include/lld/Passes/LayoutPass.h
  include/lld/ReaderWriter/MachOLinkingContext.h
  lib/Passes/LayoutPass.cpp
  lib/ReaderWriter/MachO/CMakeLists.txt
  lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lib/ReaderWriter/MachO/MachOPasses.h
  lib/ReaderWriter/MachO/OrderPass.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7212.18853.patch
Type: text/x-patch
Size: 13297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150127/c9ed7783/attachment.bin>


More information about the llvm-commits mailing list