1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/MC/AArch64/cold.s
Vedant Kumar 8057a16e18 [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
2019-01-25 18:30:22 +00:00

14 lines
362 B
ArmAsm

// RUN: llvm-mc -triple aarch64-apple-ios -o - -filetype=obj %s | \
// RUN: llvm-readobj -symbols | FileCheck %s -check-prefix=READOBJ
// READOBJ-LABEL: Name: cold_func
// READOBJ-NEXT: Type: Section
// READOBJ-NEXT: Section: __text
// READOBJ-NEXT: RefType: UndefinedNonLazy (0x0)
// READOBJ-NEXT: Flags [ (0x400)
.text
.cold cold_func
cold_func:
ret