From 13ef84fced995ad67942349e6814bfcb005e19ea Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 25 Jan 2019 18:30:22 +0000 Subject: [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 --- llvm/lib/MC/MCAsmStreamer.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/MC/MCAsmStreamer.cpp') diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index cc473eae118..b18c82309ac 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -656,6 +656,9 @@ bool MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol, // .weak_reference case MCSA_WeakReference: OS << MAI->getWeakRefDirective(); break; case MCSA_WeakDefAutoPrivate: OS << "\t.weak_def_can_be_hidden\t"; break; + case MCSA_Cold: + // Assemblers currently do not support a .cold directive. + return false; } Symbol->print(OS, MAI); -- cgit v1.2.3