blob: 20ac6621e72876860c2c3e4364d86a73ee9f2069 [file] [log] [blame]
Matt Beaumont-Gay99fc2e12012-08-02 21:52:49 +00001RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm \
2RUN: | FileCheck %s -check-prefix COFF
3RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm \
Rafael Espindola37212572013-04-26 17:54:46 +00004RUN: | FileCheck %s -check-prefix COFF
Matt Beaumont-Gay1c1a2b82011-10-31 23:56:52 +00005RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
Michael J. Spencer2d67ed82011-01-20 06:39:15 +00006RUN: | FileCheck %s -check-prefix ELF
Matt Beaumont-Gay1c1a2b82011-10-31 23:56:52 +00007RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +00008RUN: | FileCheck %s -check-prefix ELF64
Rafael Espindolaf42c58d2014-02-04 23:53:15 +00009RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000010RUN: | FileCheck %s -check-prefix WEAK-ELF64
Rafael Espindola02eac9a2014-02-05 04:36:47 +000011RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000012RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000013RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
14RUN: | FileCheck %s -check-prefix macho
15RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
16RUN: | FileCheck %s -check-prefix macho64
Rafael Espindolafb66ef02014-02-04 23:18:52 +000017RUN: llvm-nm %p/Inputs/common.coff-i386 \
18RUN: | FileCheck %s -check-prefix COFF-COMMON
Rafael Espindolab4865d62014-04-03 00:19:35 +000019RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
Kevin Enderby6abc2e52014-05-09 23:57:49 +000020RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
Rafael Espindola5091f932014-04-03 02:20:43 +000021RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
22RUN: | FileCheck %s -check-prefix ELF-THUMB
23
Michael J. Spencer2d67ed82011-01-20 06:39:15 +000024
25COFF: 00000000 d .data
26COFF: 00000000 t .text
27COFF: 00000000 d L{{_?}}.str
28COFF: U {{_?}}SomeOtherFunction
29COFF: 00000000 T {{_?}}main
30COFF: U {{_?}}puts
31
Rafael Espindolafb66ef02014-02-04 23:18:52 +000032COFF-COMMON: 00000000 b .bss
33COFF-COMMON-NEXT: 00000000 d .data
34COFF-COMMON-NEXT: 00000000 d .drectve
35COFF-COMMON-NEXT: 00000000 n .file
36COFF-COMMON-NEXT: 00000000 r .rdata$zzz
37COFF-COMMON-NEXT: 00000000 t .text
38COFF-COMMON-NEXT: C _a
39
40
Rafael Espindola0d6b3472013-07-22 19:24:34 +000041ELF-NOT: U
Michael J. Spencer2d67ed82011-01-20 06:39:15 +000042ELF: U SomeOtherFunction
43ELF: 00000000 T main
44ELF: U puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000045
Kevin Enderby6abc2e52014-05-09 23:57:49 +000046ELF64: U SomeOtherFunction
47ELF64: 0000000000000000 T main
48ELF64: U puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000049
Kevin Enderby6abc2e52014-05-09 23:57:49 +000050WEAK-ELF64: w f1
51WEAK-ELF64: 0000000000000000 W f2
52WEAK-ELF64: v x1
53WEAK-ELF64: 0000000000000000 V x2
54
55ABSOLUTE-ELF64: 0000000000000123 a a1
56ABSOLUTE-ELF64: 0000000000000123 A a2
Rafael Espindola02eac9a2014-02-05 04:36:47 +000057
Kevin Enderby1b985af2014-05-20 23:04:47 +000058macho: U _SomeOtherFunction
Rafael Espindolaa1356322013-11-02 05:03:24 +000059macho: 00000000 T _main
Kevin Enderby1b985af2014-05-20 23:04:47 +000060macho: U _puts
Danil Malyshevcbe72fc2011-11-29 17:40:10 +000061
Kevin Enderby6abc2e52014-05-09 23:57:49 +000062macho64: 0000000000000028 s L_.str
Kevin Enderby1b985af2014-05-20 23:04:47 +000063macho64: U _SomeOtherFunction
Kevin Enderby6abc2e52014-05-09 23:57:49 +000064macho64: 0000000000000000 T _main
Kevin Enderby1b985af2014-05-20 23:04:47 +000065macho64: U _puts
Rafael Espindolab4865d62014-04-03 00:19:35 +000066
67
68Test that nm uses addresses even with ELF .o files.
Kevin Enderby6abc2e52014-05-09 23:57:49 +000069ELF-SEC-ADDR64: 0000000000000058 D a
70ELF-SEC-ADDR64-NEXT: 000000000000005c D b
71ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
72ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
73ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
Rafael Espindola5091f932014-04-03 02:20:43 +000074
75
76Test that we drop the thumb bit only from function addresses.
77ELF-THUMB: 00000000 t f
78ELF-THUMB: 00000003 t g