brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.3 KiB · e254df6 Raw
241 lines · plain
1## Check that printing line numbers isn't attempted for files like bitcode,2## which have symbols but limited/no section or debug info.3# RUN: llvm-nm --line-numbers %p/Inputs/test.IRobj-x86_64 | FileCheck %s --check-prefix=BITCODE --match-full-lines --implicit-check-not={{.}}4# BITCODE:      ---------------- S _global_const5# BITCODE-NEXT: ---------------- D _global_data6# BITCODE-NEXT: ---------------- T _global_func7# BITCODE-NEXT: ---------------- S _hidden_const8# BITCODE-NEXT: ---------------- D _hidden_data9# BITCODE-NEXT: ---------------- T _hidden_func10# BITCODE-NEXT: ---------------- s _static_const11# BITCODE-NEXT: ---------------- d _static_data12# BITCODE-NEXT: ---------------- t _static_func13 14## Check that various symbol types can use debug information if available to15## print line numbers, and if unavailable, don't print anything erroneous. The16## specific cases checked are given by the symbol names below. Other test cases17## place requirements on the contents of the whole file, so they are kept out18## of main.o.19# RUN: rm -rf %t20# RUN: split-file %s %t21# RUN: llvm-mc -g --filetype=obj -triple=x86_64-pc-linux %t/main.s -o %t/main.o22# RUN: llvm-nm -l %t/main.o | FileCheck %s --match-full-lines --implicit-check-not={{.}}23# RUN: llvm-nm --line-numbers %t/main.o | FileCheck %s --match-full-lines --implicit-check-not={{.}}24 25# CHECK:      0000000000001234 a absolute_symbol26# CHECK-NEXT: 0000000000000000 d data_no_dwarf27# CHECK-NEXT: 0000000000000000 T defined_global_function [[FILENAME:.*main.s]]:428# CHECK-NEXT: 0000000000000001 t defined_local_function [[FILENAME]]:729# CHECK-NEXT: 0000000000000000 t function_no_dwarf30# CHECK-NEXT:                  U undef1 [[FILENAME]]:1231# CHECK-NEXT:                  U undef2 [[FILENAME]]:1432# CHECK-NEXT:                  U undef_no_reloc33# CHECK-NEXT: 0000000000000002 t undefined_references [[FILENAME]]:1234 35## Check that in the absence of DWARF in the whole object, no line number36## information is printed.37# RUN: llvm-mc --filetype=obj %t/main.s -triple=x86_64-pc-linux -o %t/no-dwarf.o38# RUN: llvm-nm -l %t/no-dwarf.o | FileCheck %s --check-prefix=NO-DWARF --match-full-lines --implicit-check-not={{.}}39 40# NO-DWARF:      0000000000001234 a absolute_symbol41# NO-DWARF-NEXT: 0000000000000000 d data_no_dwarf42# NO-DWARF-NEXT: 0000000000000000 T defined_global_function43# NO-DWARF-NEXT: 0000000000000001 t defined_local_function44# NO-DWARF-NEXT: 0000000000000000 t function_no_dwarf45# NO-DWARF-NEXT:                  U undef146# NO-DWARF-NEXT:                  U undef247# NO-DWARF-NEXT:                  U undef_no_reloc48# NO-DWARF-NEXT: 0000000000000002 t undefined_references49 50## Check that printing line numbers for undefined values is not attempted in51## the absence of any relocation section.52# RUN: llvm-mc --filetype=obj %t/undef-no-reloc-sections.s -triple=x86_64-pc-linux -o %t/undef-no-reloc-sections.o53# RUN: llvm-nm --line-numbers %t/undef-no-reloc-sections.o | FileCheck %s --check-prefix=UNDEF-NO-RELOC-SECTIONS --match-full-lines --implicit-check-not={{.}}54 55# UNDEF-NO-RELOC-SECTIONS: U undef56 57## Check that printing line numbers for undefined values does not include58## relocations for non-text sections. This is broken out of main.s to ensure59## that the data relocation for undef comes first.60# RUN: llvm-mc -g --filetype=obj %t/undef-data-reloc.s -triple=x86_64-pc-linux -o %t/undef-data-reloc.o61# RUN: llvm-nm --line-numbers %t/undef-data-reloc.o | FileCheck %s --check-prefix=UNDEF-DATA-RELOC --match-full-lines --implicit-check-not={{.}}62 63# UNDEF-DATA-RELOC:      0000000000000000 r data_reloc64# UNDEF-DATA-RELOC-NEXT:                  U undef65 66## Check that line numbers can be printed for data definitions. These are broken67## out of main.s since their DWARF cannot be generated with llvm-mc -g.68# RUN: llvm-mc -g --filetype=obj %t/data-dwarf.s -triple=x86_64-pc-linux -o %t/data-dwarf.o69# RUN: llvm-nm --line-numbers %t/data-dwarf.o | FileCheck %s --check-prefix=DATA-DWARF --match-full-lines --implicit-check-not={{.}}70 71# DATA-DWARF: 0000000000000000 D defined_data /tmp{{\\|/}}tmp.c:172 73#--- main.s74.text75.globl defined_global_function76defined_global_function:77  ret78 79defined_local_function:80  ret81 82absolute_symbol = 0x123483 84undefined_references:85  nop86  .long undef187  nop88  .long undef289  ret90 91# Note: llvm-mc -g produces no DWARF for data.92.data93data_no_dwarf:94  .byte 095 96.globl undef_no_reloc97 98# Note: llvm-mc -g does not produce DWARF for non-SHF_ALLOC sections.99.section no_alloc_text,"x",@progbits100function_no_dwarf:101  ret102 103#--- undef-no-reloc-sections.s104.globl undef105 106#--- undef-data-reloc.s107.globl undef108.rodata109data_reloc:110  .long undef111 112#--- data-dwarf.s113# char defined_data = 42114	.text115	.file	"tmp.c"116	.file	0 "/tmp" "/tmp/tmp.c" md5 0x39602a53b15a32d6a622ca86936e88d7117	.file	1 "tmp.c" md5 0x39602a53b15a32d6a622ca86936e88d7118	.type	defined_data,@object            # @defined_data119	.data120	.globl	defined_data121defined_data:122	.byte	42                              # 0x2a123	.size	defined_data, 1124 125	.section	.debug_abbrev,"",@progbits126	.byte	1                               # Abbreviation Code127	.byte	17                              # DW_TAG_compile_unit128	.byte	1                               # DW_CHILDREN_yes129	.byte	37                              # DW_AT_producer130	.byte	37                              # DW_FORM_strx1131	.byte	19                              # DW_AT_language132	.byte	5                               # DW_FORM_data2133	.byte	3                               # DW_AT_name134	.byte	37                              # DW_FORM_strx1135	.byte	114                             # DW_AT_str_offsets_base136	.byte	23                              # DW_FORM_sec_offset137	.byte	16                              # DW_AT_stmt_list138	.byte	23                              # DW_FORM_sec_offset139	.byte	27                              # DW_AT_comp_dir140	.byte	37                              # DW_FORM_strx1141	.byte	115                             # DW_AT_addr_base142	.byte	23                              # DW_FORM_sec_offset143	.byte	0                               # EOM(1)144	.byte	0                               # EOM(2)145	.byte	2                               # Abbreviation Code146	.byte	52                              # DW_TAG_variable147	.byte	0                               # DW_CHILDREN_no148	.byte	3                               # DW_AT_name149	.byte	37                              # DW_FORM_strx1150	.byte	73                              # DW_AT_type151	.byte	19                              # DW_FORM_ref4152	.byte	63                              # DW_AT_external153	.byte	25                              # DW_FORM_flag_present154	.byte	58                              # DW_AT_decl_file155	.byte	11                              # DW_FORM_data1156	.byte	59                              # DW_AT_decl_line157	.byte	11                              # DW_FORM_data1158	.byte	2                               # DW_AT_location159	.byte	24                              # DW_FORM_exprloc160	.byte	0                               # EOM(1)161	.byte	0                               # EOM(2)162	.byte	3                               # Abbreviation Code163	.byte	36                              # DW_TAG_base_type164	.byte	0                               # DW_CHILDREN_no165	.byte	3                               # DW_AT_name166	.byte	37                              # DW_FORM_strx1167	.byte	62                              # DW_AT_encoding168	.byte	11                              # DW_FORM_data1169	.byte	11                              # DW_AT_byte_size170	.byte	11                              # DW_FORM_data1171	.byte	0                               # EOM(1)172	.byte	0                               # EOM(2)173	.byte	0                               # EOM(3)174	.section	.debug_info,"",@progbits175.Lcu_begin0:176	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit177.Ldebug_info_start0:178	.short	5                               # DWARF version number179	.byte	1                               # DWARF Unit Type180	.byte	8                               # Address Size (in bytes)181	.long	.debug_abbrev                   # Offset Into Abbrev. Section182	.byte	1                               # Abbrev [1] 0xc:0x22 DW_TAG_compile_unit183	.byte	0                               # DW_AT_producer184	.short	12                              # DW_AT_language185	.byte	1                               # DW_AT_name186	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base187	.long	.Lline_table_start0             # DW_AT_stmt_list188	.byte	2                               # DW_AT_comp_dir189	.long	.Laddr_table_base0              # DW_AT_addr_base190	.byte	2                               # Abbrev [2] 0x1e:0xb DW_TAG_variable191	.byte	3                               # DW_AT_name192	.long	41                              # DW_AT_type193                                        # DW_AT_external194	.byte	1                               # DW_AT_decl_file195	.byte	1                               # DW_AT_decl_line196	.byte	2                               # DW_AT_location197	.byte	161198	.byte	0199	.byte	3                               # Abbrev [3] 0x29:0x4 DW_TAG_base_type200	.byte	4                               # DW_AT_name201	.byte	6                               # DW_AT_encoding202	.byte	1                               # DW_AT_byte_size203	.byte	0                               # End Of Children Mark204.Ldebug_info_end0:205	.section	.debug_str_offsets,"",@progbits206	.long	24                              # Length of String Offsets Set207	.short	5208	.short	0209.Lstr_offsets_base0:210	.section	.debug_str,"MS",@progbits,1211.Linfo_string0:212	.asciz	"Debian clang version 14.0.6"   # string offset=0213.Linfo_string1:214	.asciz	"/tmp/tmp.c"                    # string offset=28215.Linfo_string2:216	.asciz	"/tmp"                          # string offset=39217.Linfo_string3:218	.asciz	"defined_data"                  # string offset=44219.Linfo_string4:220	.asciz	"char"                          # string offset=57221	.section	.debug_str_offsets,"",@progbits222	.long	.Linfo_string0223	.long	.Linfo_string1224	.long	.Linfo_string2225	.long	.Linfo_string3226	.long	.Linfo_string4227	.section	.debug_addr,"",@progbits228	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution229.Ldebug_addr_start0:230	.short	5                               # DWARF version number231	.byte	8                               # Address size232	.byte	0                               # Segment selector size233.Laddr_table_base0:234	.quad	defined_data235.Ldebug_addr_end0:236	.ident	"Debian clang version 14.0.6"237	.section	".note.GNU-stack","",@progbits238	.addrsig239	.section	.debug_line,"",@progbits240.Lline_table_start0:241