[PATCH] D57190: [MC] Teach the MachO object writer about N_FUNC_COLD
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 24 13:54:30 PST 2019
vsk created this revision.
vsk added reviewers: lhames, thegameg, kledzik.
Herald added subscribers: rupprecht, hiraditya, javed.absar.
N_FUNC_COLD is a new MachO symbol attribute. It's a hint to the linker
to order a symbol towards the end of its section, to improve locality.
Example:
void a1() {}
__attribute__((cold)) void a2() {}
void a3() {}
int main() {
a1();
a2();
a3();
return 0;
}
A linker that supports N_FUNC_COLD will order _a2 to the end of the text
section. From `nm -njU` output, we see:
_a1
_a3
_main
_a2
https://reviews.llvm.org/D57190
Files:
llvm/include/llvm/BinaryFormat/MachO.h
llvm/include/llvm/MC/MCDirectives.h
llvm/include/llvm/MC/MCSymbolMachO.h
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/MC/MCMachOStreamer.cpp
llvm/test/tools/llvm-nm/AArch64/Inputs/cold-func.ll
llvm/test/tools/llvm-nm/AArch64/macho-cold.test
llvm/tools/llvm-nm/llvm-nm.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57190.183392.patch
Type: text/x-patch
Size: 4922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/5cad95d8/attachment.bin>
More information about the llvm-commits
mailing list