summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-01-25 18:30:22 +0000
committerVedant Kumar <vsk@apple.com>2019-01-25 18:30:22 +0000
commit13ef84fced995ad67942349e6814bfcb005e19ea (patch)
tree3135702be53d50e4e0ff3e199847cae80ee0f6bf /llvm/tools
parent414f9b305d8284e6eab6aac1bee814953f67358a (diff)
downloadbcm5719-llvm-13ef84fced995ad67942349e6814bfcb005e19ea.tar.gz
bcm5719-llvm-13ef84fced995ad67942349e6814bfcb005e19ea.zip
[MC] Teach the MachO object writer about N_FUNC_COLD
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 ``` Differential Revision: https://reviews.llvm.org/D57190 llvm-svn: 352227
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index 08ea238ac3a..f81e909c924 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -554,6 +554,11 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I,
(NDesc & MachO::N_ALT_ENTRY) == MachO::N_ALT_ENTRY)
outs() << "[alt entry] ";
+ if (Filetype == MachO::MH_OBJECT &&
+ ((NType & MachO::N_TYPE) != MachO::N_UNDF) &&
+ (NDesc & MachO::N_COLD_FUNC) == MachO::N_COLD_FUNC)
+ outs() << "[cold] ";
+
if ((NDesc & MachO::N_ARM_THUMB_DEF) == MachO::N_ARM_THUMB_DEF)
outs() << "[Thumb] ";
OpenPOWER on IntegriCloud