xref: /llvm-project/llvm/test/tools/llvm-objdump/X86/print-symbol-addr.s (revision 5c7566cd05970fafa5d93b192ca36c4c4b114f72)
1# RUN: llvm-mc %s -filetype=obj -triple=i386 -o %t.32.o
2# RUN: llvm-mc %s -filetype=obj -triple=x86_64 -o %t.64.o
3
4## Check we print the address of `foo` and `bar`.
5# RUN: llvm-objdump -D %t.32.o | FileCheck --check-prefixes=ADDR32,ADDR %s --match-full-lines --strict-whitespace
6# RUN: llvm-objdump -D %t.64.o | FileCheck --check-prefixes=ADDR64,ADDR %s --match-full-lines --strict-whitespace
7#    ADDR32:00000000 <foo>:
8#    ADDR64:0000000000000000 <foo>:
9# ADDR-NEXT:       0: 90{{ +}}	nop
10# ADDR-NEXT:       1: 90{{ +}}	nop
11#ADDR-EMPTY:
12#    ADDR32:00000002 <bar>:
13#    ADDR64:0000000000000002 <bar>:
14# ADDR-NEXT:       2: 90{{ +}}	nop
15#      ADDR:Disassembly of section .data:
16#ADDR-EMPTY:
17#    ADDR32:00000000 <.data>:
18#    ADDR64:0000000000000000 <.data>:
19# ADDR-NEXT:       0: 01 00{{ +}}	addl	%eax, (%{{[er]}}ax)
20#ADDR-EMPTY:
21
22## Check we do not print the addresses with --no-leading-addr.
23# RUN: llvm-objdump -d --no-leading-addr %t.32.o > %t.32.txt
24# RUN: llvm-objdump -d --no-leading-addr %t.64.o > %t.64.txt
25# RUN: FileCheck --input-file=%t.32.txt %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
26# RUN: FileCheck --input-file=%t.64.txt %s --check-prefix=NOADDR --match-full-lines --strict-whitespace
27# RUN: llvm-objdump -d --no-addresses %t.32.o | diff %t.32.txt -
28# RUN: llvm-objdump -d --no-addresses %t.64.o | diff %t.64.txt -
29
30#      NOADDR:<foo>:
31# NOADDR-NEXT: 90{{ +}}	nop
32# NOADDR-NEXT: 90{{ +}}	nop
33#NOADDR-EMPTY:
34#      NOADDR:<bar>:
35# NOADDR-NEXT: 90{{ +}}	nop
36
37.text
38.globl  foo
39.type   foo, @function
40foo:
41 nop
42 nop
43
44bar:
45 nop
46
47.data
48  .word 1
49