• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: mkdir -p %t
3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
4
5# RUN: echo "_bar" > %t/order-file-1
6# RUN: echo "_foo" >> %t/order-file-1
7# RUN: echo "_main" >> %t/order-file-1
8## _qux is marked as .alt_entry, so it should not create a new subsection and
9## its contents should move with _bar to the start of the output despite the
10## order file listing it at the end.
11# RUN: echo "_qux" >> %t/order-file-1
12
13## _bar and _baz point to the same address, so both order files should achieve
14## the same result.
15# RUN: echo "_baz" > %t/order-file-2
16# RUN: echo "_foo" >> %t/order-file-2
17# RUN: echo "_main" >> %t/order-file-2
18# RUN: echo "_qux" >> %t/order-file-2
19
20# RUN: %lld -o %t/test-1 %t/test.o -order_file %t/order-file-1
21# RUN: llvm-objdump -d --no-show-raw-insn %t/test-1 | FileCheck %s
22# RUN: %lld -o %t/test-2 %t/test.o -order_file %t/order-file-2
23# RUN: llvm-objdump -d --no-show-raw-insn %t/test-2 | FileCheck %s
24# CHECK-LABEL: Disassembly of section __TEXT,__text:
25# CHECK:       <_ba{{r|z}}>:
26# CHECK-NEXT:    callq {{.*}} <_foo>
27# CHECK-EMPTY:
28# CHECK-NEXT:  <_qux>:
29# CHECK-NEXT:    retq
30# CHECK:       <_foo>:
31# CHECK-NEXT:    retq
32# CHECK:       <_main>:
33# CHECK-NEXT:    callq {{.*}} <_ba{{r|z}}>
34# CHECK-NEXT:    movq $0, %rax
35# CHECK-NEXT:    retq
36
37.text
38.globl _main, _foo, _bar, _qux
39.alt_entry _qux
40
41_foo:
42  retq
43
44_main:
45  callq _bar
46  movq $0, %rax
47  retq
48
49_bar:
50_baz:
51  callq _foo
52_qux:
53  retq
54
55.subsections_via_symbols
56