[lld-macho] Allow order files and call graph sorting to be used together
authorLeonard Grey <lgrey@chromium.org>
Fri, 14 Jan 2022 19:37:00 +0000 (14:37 -0500)
committerLeonard Grey <lgrey@chromium.org>
Thu, 17 Feb 2022 19:19:34 +0000 (14:19 -0500)
commita52b9102d1f75ca0229e5e395d317fb9ecd51590
treec079e0f20cc664ed72a1be9aaa00708f00fe2e88
parentf56cb520d8554ca42a215e82ecfa58d0b6c178e4
[lld-macho] Allow order files and call graph sorting to be used together

If both an order file and a call graph profile are present, the edges of the
call graph which use symbols present in the order file are not used. All of
the symbols in the order file will appear at the beginning of the section just
as they do currently. In other words, the highest priority derived from the
call graph will be below the lowest priority derived from the order file.

Practically, this change renames CallGraphSort.{h,cpp} to SectionPriorities.{h,cpp},
and most order file and call graph profile related code is moved into the new
file to reduce duplication.

Differential Revision: https://reviews.llvm.org/D117354
lld/MachO/Driver.cpp
lld/MachO/SectionPriorities.cpp
lld/MachO/SectionPriorities.h
lld/test/MachO/cgprofile-orderfile.s [new file with mode: 0644]