2
0

nm-trivial-object.test 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. RUN: yaml2obj %p/Inputs/COFF/i386.yaml | llvm-nm -a -S - \
  2. RUN: | FileCheck %s -check-prefix COFF32
  3. RUN: yaml2obj %p/Inputs/COFF/x86-64.yaml | llvm-nm -a -S - \
  4. RUN: | FileCheck %s -check-prefix COFF64
  5. RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 \
  6. RUN: | FileCheck %s -check-prefix ELF
  7. RUN: llvm-nm %p/Inputs/trivial-object-test.elf-i386 -S \
  8. RUN: | FileCheck %s -check-prefix ELF-SIZE
  9. RUN: llvm-nm -o %p/Inputs/trivial-object-test.elf-i386 \
  10. RUN: | FileCheck %s -check-prefix ELF-o
  11. RUN: llvm-nm -u %p/Inputs/trivial-object-test.elf-i386 \
  12. RUN: | FileCheck %s -check-prefix ELF-u
  13. RUN: llvm-nm %p/Inputs/trivial-object-test.elf-x86-64 \
  14. RUN: | FileCheck %s -check-prefix ELF64
  15. RUN: llvm-nm %p/Inputs/weak.elf-x86-64 \
  16. RUN: | FileCheck %s -check-prefix WEAK-ELF64
  17. RUN: llvm-nm %p/Inputs/absolute.elf-x86-64 \
  18. RUN: | FileCheck %s -check-prefix ABSOLUTE-ELF64
  19. RUN: llvm-nm %p/Inputs/trivial-object-test.macho-i386 \
  20. RUN: | FileCheck %s -check-prefix macho
  21. RUN: llvm-nm -U %p/Inputs/trivial-object-test.macho-i386 \
  22. RUN: | FileCheck %s -check-prefix macho-U
  23. RUN: llvm-nm %p/Inputs/trivial-object-test.macho-x86-64 \
  24. RUN: | FileCheck %s -check-prefix macho64
  25. RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 \
  26. RUN: | FileCheck %s -check-prefix macho-tdb
  27. RUN: llvm-nm -j %p/Inputs/macho-text-data-bss.macho-x86_64 \
  28. RUN: | FileCheck %s -check-prefix macho-j
  29. RUN: llvm-nm -r %p/Inputs/macho-text-data-bss.macho-x86_64 \
  30. RUN: | FileCheck %s -check-prefix macho-r
  31. RUN: llvm-nm %p/Inputs/macho-text-data-bss.macho-x86_64 -s __DATA __data \
  32. RUN: | FileCheck %s -check-prefix macho-s
  33. RUN: llvm-nm -x %p/Inputs/macho-text-data-bss.macho-x86_64 \
  34. RUN: | FileCheck %s -check-prefix macho-x
  35. RUN: llvm-nm -o %p/Inputs/macho-text-data-bss.macho-x86_64 \
  36. RUN: | FileCheck %s -check-prefix macho-o
  37. RUN: llvm-nm -p -a %p/Inputs/macho-hello-g.macho-x86_64 \
  38. RUN: | FileCheck %s -check-prefix macho-pa
  39. RUN: llvm-nm -u %p/Inputs/macho-hello-g.macho-x86_64 \
  40. RUN: | FileCheck %s -check-prefix macho-u
  41. RUN: llvm-nm -S -a %p/Inputs/common.coff-i386 \
  42. RUN: | FileCheck %s -check-prefix COFF-COMMON
  43. RUN: llvm-nm %p/Inputs/relocatable-with-section-address.elf-x86-64 \
  44. RUN: | FileCheck %s -check-prefix ELF-SEC-ADDR64
  45. RUN: llvm-nm %p/Inputs/thumb-symbols.elf.arm \
  46. RUN: | FileCheck %s -check-prefix ELF-THUMB
  47. RUN: mkdir -p %t
  48. RUN: cd %t
  49. RUN: cp %p/Inputs/trivial-object-test.macho-i386 a.out
  50. RUN: llvm-nm | FileCheck %s -check-prefix A-OUT
  51. COFF32: 00000000 d .data
  52. COFF32-NEXT: 00000000 t .text
  53. COFF32-NEXT: 00000000 d L_.str
  54. COFF32-NEXT: U _SomeOtherFunction
  55. COFF32-NEXT: 00000000 T _main
  56. COFF32-NEXT: U _puts
  57. COFF64: 00000000 d .data
  58. COFF64-NEXT: 00000000 t .text
  59. COFF64-NEXT: 00000000 r ??__Ex@@YAXXZ
  60. COFF64-NEXT: 00000000 d L.str
  61. COFF64-NEXT: U SomeOtherFunction
  62. COFF64-NEXT: 00000000 T main
  63. COFF64-NEXT: U puts
  64. COFF-COMMON: 00000000 b .bss
  65. COFF-COMMON-NEXT: 00000000 d .data
  66. COFF-COMMON-NEXT: 00000000 d .drectve
  67. COFF-COMMON-NEXT: 00000000 n .file
  68. COFF-COMMON-NEXT: 00000000 r .rdata$zzz
  69. COFF-COMMON-NEXT: 00000000 t .text
  70. COFF-COMMON-NEXT: C _a
  71. ELF-NOT: U
  72. ELF: U SomeOtherFunction
  73. ELF: 00000000 T main
  74. ELF: U puts
  75. FIXME: we should not print the size of undefined symbols.
  76. ELF-SIZE: 00000000 U SomeOtherFunction
  77. ELF-SIZE-NEXT: 00000000 00000024 T main
  78. ELF-SIZE-NEXT: 00000000 U puts
  79. ELF-o: {{.*}}/trivial-object-test.elf-i386: U SomeOtherFunction
  80. ELF-o: {{.*}}/trivial-object-test.elf-i386: 00000000 T main
  81. ELF-o: {{.*}}/trivial-object-test.elf-i386: U puts
  82. ELF-u: U SomeOtherFunction
  83. ELF-u: U puts
  84. ELF64: U SomeOtherFunction
  85. ELF64: 0000000000000000 T main
  86. ELF64: U puts
  87. WEAK-ELF64: w f1
  88. WEAK-ELF64: 0000000000000000 W f2
  89. WEAK-ELF64: v x1
  90. WEAK-ELF64: 0000000000000000 V x2
  91. ABSOLUTE-ELF64: 0000000000000123 a a1
  92. ABSOLUTE-ELF64: 0000000000000123 A a2
  93. macho: U _SomeOtherFunction
  94. macho: 00000000 T _main
  95. macho: U _puts
  96. macho-U-NOT: U _SomeOtherFunction
  97. macho-U: 00000000 T _main
  98. macho-U-NOT: U _puts
  99. macho64: 0000000000000028 s L_.str
  100. macho64: U _SomeOtherFunction
  101. macho64: 0000000000000000 T _main
  102. macho64: U _puts
  103. macho-tdb: 0000000000000030 s EH_frame0
  104. macho-tdb: 0000000000000070 b _b
  105. macho-tdb: 000000000000000c D _d
  106. macho-tdb: 0000000000000000 T _t
  107. macho-tdb: 0000000000000048 S _t.eh
  108. macho-j: EH_frame0
  109. macho-j: _b
  110. macho-j: _d
  111. macho-j: _t
  112. macho-j: _t.eh
  113. macho-r: 0000000000000048 S _t.eh
  114. macho-r-NEXT: 0000000000000000 T _t
  115. macho-r-NEXT: 000000000000000c D _d
  116. macho-r-NEXT: 0000000000000070 b _b
  117. macho-r-NEXT: 0000000000000030 s EH_frame0
  118. macho-s: 000000000000000c D _d
  119. macho-s-NOT: 0000000000000048 S _t.eh
  120. macho-s-NOT: 0000000000000000 T _t
  121. macho-s-NOT: 0000000000000070 b _b
  122. macho-s-NOT: 0000000000000030 s EH_frame0
  123. macho-x: 0000000000000030 0e 05 0000 00000010 EH_frame0
  124. macho-x: 0000000000000070 0e 03 0000 0000000d _b
  125. macho-x: 000000000000000c 0f 02 0000 00000004 _d
  126. macho-x: 0000000000000000 0f 01 0000 00000001 _t
  127. macho-x: 0000000000000048 0f 05 0000 00000007 _t.eh
  128. macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000030 s EH_frame0
  129. macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000070 b _b
  130. macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 000000000000000c D _d
  131. macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000000 T _t
  132. macho-o: {{.*}}/macho-text-data-bss.macho-x86_64: 0000000000000048 S _t.eh
  133. macho-pa: 0000000000000000 - 00 0000 SO /Volumes/SandBox/
  134. macho-pa: 0000000000000000 - 00 0000 SO hello.c
  135. macho-pa: 0000000053c8408d - 03 0001 OSO /Volumes/SandBox/hello.o
  136. macho-pa: 0000000100000f30 - 01 0000 BNSYM
  137. macho-pa: 0000000100000f30 - 01 0000 FUN _main
  138. macho-pa: 000000000000003b - 00 0000 FUN
  139. macho-pa: 000000000000003b - 01 0000 ENSYM
  140. macho-pa: 0000000000000000 - 01 0000 SO
  141. macho-pa: 0000000100000000 T __mh_execute_header
  142. macho-pa: 0000000100000f30 T _main
  143. macho-pa: U _printf
  144. macho-pa: U dyld_stub_binder
  145. macho-u: _printf
  146. macho-u: dyld_stub_binder
  147. Test that nm uses addresses even with ELF .o files.
  148. ELF-SEC-ADDR64: 0000000000000058 D a
  149. ELF-SEC-ADDR64-NEXT: 000000000000005c D b
  150. ELF-SEC-ADDR64-NEXT: 0000000000000040 T f
  151. ELF-SEC-ADDR64-NEXT: 0000000000000050 T g
  152. ELF-SEC-ADDR64-NEXT: 0000000000000060 D p
  153. Test that we drop the thumb bit only from function addresses.
  154. ELF-THUMB: 00000000 t f
  155. ELF-THUMB: 00000003 t g
  156. A-OUT: U _SomeOtherFunction
  157. A-OUT: 00000000 T _main
  158. A-OUT: U _puts