[llvm] Give a warning when no dwo files are provided (PR #94336)
Jinjie Huang via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 26 00:03:41 PDT 2024
https://github.com/Labman-001 updated https://github.com/llvm/llvm-project/pull/94336
>From 673778784c089d0146b293bd5c6c7331d736fb25 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Tue, 4 Jun 2024 18:31:03 +0800
Subject: [PATCH 01/18] Give a warning when now dwo found
---
llvm/tools/llvm-dwp/llvm-dwp.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 81556b3ad4bcb..f0edaeb07f0ba 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -188,8 +188,10 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
std::make_move_iterator(DWOs->end()));
}
- if (DWOFilenames.empty())
+ if (DWOFilenames.empty()) {
+ WithColor::defaultWarningHandler(make_error<DWPError>("No dwo files found!\n"));
return 0;
+ }
std::string ErrorStr;
StringRef Context = "dwarf streamer init";
>From 5899de9fb576489e9bdb30adee6a535a98942ace Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Tue, 4 Jun 2024 19:00:32 +0800
Subject: [PATCH 02/18] Give a warning when no dwo found
---
llvm/tools/llvm-dwp/llvm-dwp.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index f0edaeb07f0ba..0b3941bdc27e0 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -189,8 +189,9 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
}
if (DWOFilenames.empty()) {
- WithColor::defaultWarningHandler(make_error<DWPError>("No dwo files found!\n"));
- return 0;
+ WithColor::defaultWarningHandler(
+ make_error<DWPError>("No dwo files found!"));
+ return 0;
}
std::string ErrorStr;
>From 2a54154e77f27ccd99978fce7b9f790702cd933b Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Tue, 4 Jun 2024 19:05:25 +0800
Subject: [PATCH 03/18] Give a warning when no dwo found
---
llvm/tools/llvm-dwp/llvm-dwp.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 0b3941bdc27e0..3da408b7e8e8c 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -191,7 +191,7 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
if (DWOFilenames.empty()) {
WithColor::defaultWarningHandler(
make_error<DWPError>("No dwo files found!"));
- return 0;
+ return 0;
}
std::string ErrorStr;
>From cca758091d00d31db172eb32ba6f573f1a049052 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Fri, 7 Jun 2024 17:21:48 +0800
Subject: [PATCH 04/18] add test
---
.../llvm-dwp/Inputs/empty_warning/non_split.s | 218 +++++++++++++
.../llvm-dwp/Inputs/empty_warning/split.s | 297 ++++++++++++++++++
.../tools/llvm-dwp/X86/empty_warning.test | 6 +
llvm/tools/llvm-dwp/llvm-dwp.cpp | 2 +-
4 files changed, 522 insertions(+), 1 deletion(-)
create mode 100644 llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
create mode 100644 llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
create mode 100644 llvm/test/tools/llvm-dwp/X86/empty_warning.test
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
new file mode 100644
index 0000000000000..478db2b7e82cc
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
@@ -0,0 +1,218 @@
+# Note: This file is compiled from the following code, for
+# the purpose of creating an non split-dwarf binary.
+#
+# clang -g -S -gdwarf-4 main.c
+#
+#include <stdio.h>
+#int main() {
+# printf("hello\n");
+# return 0;
+#}
+
+ .text
+ .file "main.c"
+ .file 1 "/xxx/xxx" "main.c"
+ .globl main # -- Begin function main
+ .p2align 4, 0x90
+ .type main, at function
+main: # @main
+.Lfunc_begin0:
+ .loc 1 3 0 # main.c:3:0
+ .cfi_startproc
+# %bb.0: # %entry
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ subq $16, %rsp
+ movl $0, -4(%rbp)
+.Ltmp0:
+ .loc 1 4 5 prologue_end # main.c:4:5
+ leaq .L.str(%rip), %rdi
+ movb $0, %al
+ callq printf at PLT
+ .loc 1 5 5 # main.c:5:5
+ xorl %eax, %eax
+ .loc 1 5 5 epilogue_begin is_stmt 0 # main.c:5:5
+ addq $16, %rsp
+ popq %rbp
+ .cfi_def_cfa %rsp, 8
+ retq
+.Ltmp1:
+.Lfunc_end0:
+ .size main, .Lfunc_end0-main
+ .cfi_endproc
+ # -- End function
+ .type .L.str, at object # @.str
+ .section .rodata.str1.1,"aMS", at progbits,1
+.L.str:
+ .asciz "hello\n"
+ .size .L.str, 7
+
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 14 # DW_FORM_strp
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 14 # DW_FORM_strp
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 1 # DW_TAG_array_type
+ .byte 1 # DW_CHILDREN_yes
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 33 # DW_TAG_subrange_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 55 # DW_AT_count
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 6 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 7 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 0 # DW_CHILDREN_no
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x6b DW_TAG_compile_unit
+ .long .Linfo_string0 # DW_AT_producer
+ .short 29 # DW_AT_language
+ .long .Linfo_string1 # DW_AT_name
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .long .Linfo_string2 # DW_AT_comp_dir
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 2 # Abbrev [2] 0x2a:0x11 DW_TAG_variable
+ .long 59 # DW_AT_type
+ .byte 1 # DW_AT_decl_file
+ .byte 4 # DW_AT_decl_line
+ .byte 9 # DW_AT_location
+ .byte 3
+ .quad .L.str
+ .byte 3 # Abbrev [3] 0x3b:0xc DW_TAG_array_type
+ .long 71 # DW_AT_type
+ .byte 4 # Abbrev [4] 0x40:0x6 DW_TAG_subrange_type
+ .long 78 # DW_AT_type
+ .byte 7 # DW_AT_count
+ .byte 0 # End Of Children Mark
+ .byte 5 # Abbrev [5] 0x47:0x7 DW_TAG_base_type
+ .long .Linfo_string3 # DW_AT_name
+ .byte 6 # DW_AT_encoding
+ .byte 1 # DW_AT_byte_size
+ .byte 6 # Abbrev [6] 0x4e:0x7 DW_TAG_base_type
+ .long .Linfo_string4 # DW_AT_name
+ .byte 8 # DW_AT_byte_size
+ .byte 7 # DW_AT_encoding
+ .byte 7 # Abbrev [7] 0x55:0x19 DW_TAG_subprogram
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 86
+ .long .Linfo_string5 # DW_AT_name
+ .byte 1 # DW_AT_decl_file
+ .byte 3 # DW_AT_decl_line
+ .long 110 # DW_AT_type
+ # DW_AT_external
+ .byte 5 # Abbrev [5] 0x6e:0x7 DW_TAG_base_type
+ .long .Linfo_string6 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+ .section .debug_str,"MS", at progbits,1
+.Linfo_string0:
+ .asciz "clang version 19.0.0git" # string offset=0
+.Linfo_string1:
+ .asciz "main.c" # string offset=24
+.Linfo_string2:
+ .asciz "xxx/xxx" # string offset=31
+.Linfo_string3:
+ .asciz "char" # string offset=95
+.Linfo_string4:
+ .asciz "__ARRAY_SIZE_TYPE__" # string offset=100
+.Linfo_string5:
+ .asciz "main" # string offset=120
+.Linfo_string6:
+ .asciz "int" # string offset=125
+ .ident "clang version 19.0.0git"
+ .section ".note.GNU-stack","", at progbits
+ .addrsig
+ .addrsig_sym printf
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
new file mode 100644
index 0000000000000..50ed62f26727a
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
@@ -0,0 +1,297 @@
+# Note: This file is compiled from the following code, for
+# the purpose of creating a valid split-dwarf binary,
+# where the dwo path is modified to a non-existent path.
+#
+# clang -g -S -gsplit-dwarf -gdwarf-4 main.c
+#
+#include <stdio.h>
+#int main() {
+# printf("hello\n");
+# return 0;
+#}
+
+ .text
+ .file "main.c"
+ .file 1 "/xxx/xxx" "main.c"
+ .globl main # -- Begin function main
+ .p2align 4, 0x90
+ .type main, at function
+main: # @main
+.Lfunc_begin0:
+ .loc 1 3 0 # main.c:3:0
+ .cfi_startproc
+# %bb.0: # %entry
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ subq $16, %rsp
+ movl $0, -4(%rbp)
+.Ltmp0:
+ .loc 1 4 5 prologue_end # main.c:4:5
+ leaq .L.str(%rip), %rdi
+ movb $0, %al
+ callq printf at PLT
+ .loc 1 5 5 # main.c:5:5
+ xorl %eax, %eax
+ .loc 1 5 5 epilogue_begin is_stmt 0 # main.c:5:5
+ addq $16, %rsp
+ popq %rbp
+ .cfi_def_cfa %rsp, 8
+ retq
+.Ltmp1:
+.Lfunc_end0:
+ .size main, .Lfunc_end0-main
+ .cfi_endproc
+ # -- End function
+ .type .L.str, at object # @.str
+ .section .rodata.str1.1,"aMS", at progbits,1
+.L.str:
+ .asciz "hello\n"
+ .size .L.str, 7
+
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 0 # DW_CHILDREN_no
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 14 # DW_FORM_strp
+ .ascii "\264B" # DW_AT_GNU_pubnames
+ .byte 25 # DW_FORM_flag_present
+ .ascii "\260B" # DW_AT_GNU_dwo_name
+ .byte 14 # DW_FORM_strp
+ .ascii "\261B" # DW_AT_GNU_dwo_id
+ .byte 7 # DW_FORM_data8
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .ascii "\263B" # DW_AT_GNU_addr_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .long .Lskel_string0 # DW_AT_comp_dir
+ # DW_AT_GNU_pubnames
+ .long .Lskel_string1 # DW_AT_GNU_dwo_name
+ .quad -6752972150003664062 # DW_AT_GNU_dwo_id
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .long .Laddr_table_base0 # DW_AT_GNU_addr_base
+.Ldebug_info_end0:
+ .section .debug_str,"MS", at progbits,1
+.Lskel_string0:
+ .asciz "xxx/xxx" # string offset=0
+.Lskel_string1:
+ .asciz "main.dwo" # string offset=64
+ .section .debug_str.dwo,"eMS", at progbits,1
+.Linfo_string0:
+ .asciz "char" # string offset=0
+.Linfo_string1:
+ .asciz "__ARRAY_SIZE_TYPE__" # string offset=5
+.Linfo_string2:
+ .asciz "main" # string offset=25
+.Linfo_string3:
+ .asciz "int" # string offset=30
+.Linfo_string4:
+ .asciz "clang version 19.0.0git" # string offset=34
+.Linfo_string5:
+ .asciz "main.c" # string offset=58
+.Linfo_string6:
+ .asciz "main.dwo" # string offset=65
+ .section .debug_str_offsets.dwo,"e", at progbits
+ .long 0
+ .long 5
+ .long 25
+ .long 30
+ .long 34
+ .long 58
+ .long 65
+ .section .debug_info.dwo,"e", at progbits
+ .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
+.Ldebug_info_dwo_start0:
+ .short 4 # DWARF version number
+ .long 0 # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
+ .byte 4 # DW_AT_producer
+ .short 29 # DW_AT_language
+ .byte 5 # DW_AT_name
+ .byte 6 # DW_AT_GNU_dwo_name
+ .quad -6752972150003664062 # DW_AT_GNU_dwo_id
+ .byte 2 # Abbrev [2] 0x19:0xa DW_TAG_variable
+ .long 35 # DW_AT_type
+ .byte 1 # DW_AT_decl_file
+ .byte 4 # DW_AT_decl_line
+ .byte 2 # DW_AT_location
+ .byte 251
+ .byte 0
+ .byte 3 # Abbrev [3] 0x23:0xc DW_TAG_array_type
+ .long 47 # DW_AT_type
+ .byte 4 # Abbrev [4] 0x28:0x6 DW_TAG_subrange_type
+ .long 51 # DW_AT_type
+ .byte 7 # DW_AT_count
+ .byte 0 # End Of Children Mark
+ .byte 5 # Abbrev [5] 0x2f:0x4 DW_TAG_base_type
+ .byte 0 # DW_AT_name
+ .byte 6 # DW_AT_encoding
+ .byte 1 # DW_AT_byte_size
+ .byte 6 # Abbrev [6] 0x33:0x4 DW_TAG_base_type
+ .byte 1 # DW_AT_name
+ .byte 8 # DW_AT_byte_size
+ .byte 7 # DW_AT_encoding
+ .byte 7 # Abbrev [7] 0x37:0xf DW_TAG_subprogram
+ .byte 1 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 86
+ .byte 2 # DW_AT_name
+ .byte 1 # DW_AT_decl_file
+ .byte 3 # DW_AT_decl_line
+ .long 70 # DW_AT_type
+ # DW_AT_external
+ .byte 5 # Abbrev [5] 0x46:0x4 DW_TAG_base_type
+ .byte 3 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_dwo_end0:
+ .section .debug_abbrev.dwo,"e", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .ascii "\260B" # DW_AT_GNU_dwo_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .ascii "\261B" # DW_AT_GNU_dwo_id
+ .byte 7 # DW_FORM_data8
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 52 # DW_TAG_variable
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 2 # DW_AT_location
+ .byte 24 # DW_FORM_exprloc
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 1 # DW_TAG_array_type
+ .byte 1 # DW_CHILDREN_yes
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 4 # Abbreviation Code
+ .byte 33 # DW_TAG_subrange_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 55 # DW_AT_count
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 5 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 6 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 7 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 0 # DW_CHILDREN_no
+ .byte 17 # DW_AT_low_pc
+ .ascii "\201>" # DW_FORM_GNU_addr_index
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_addr,"", at progbits
+.Laddr_table_base0:
+ .quad .L.str
+ .quad .Lfunc_begin0
+ .section .debug_gnu_pubnames,"", at progbits
+ .long .LpubNames_end0-.LpubNames_start0 # Length of Public Names Info
+.LpubNames_start0:
+ .short 2 # DWARF Version
+ .long .Lcu_begin0 # Offset of Compilation Unit Info
+ .long 48 # Compilation Unit Length
+ .long 25 # DIE offset
+ .byte 160 # Attributes: VARIABLE, STATIC
+ .byte 0 # External Name
+ .long 55 # DIE offset
+ .byte 48 # Attributes: FUNCTION, EXTERNAL
+ .asciz "main" # External Name
+ .long 0 # End Mark
+.LpubNames_end0:
+ .section .debug_gnu_pubtypes,"", at progbits
+ .long .LpubTypes_end0-.LpubTypes_start0 # Length of Public Types Info
+.LpubTypes_start0:
+ .short 2 # DWARF Version
+ .long .Lcu_begin0 # Offset of Compilation Unit Info
+ .long 48 # Compilation Unit Length
+ .long 47 # DIE offset
+ .byte 144 # Attributes: TYPE, STATIC
+ .asciz "char" # External Name
+ .long 70 # DIE offset
+ .byte 144 # Attributes: TYPE, STATIC
+ .asciz "int" # External Name
+ .long 0 # End Mark
+.LpubTypes_end0:
+ .ident "clang version 19.0.0git"
+ .section ".note.GNU-stack","", at progbits
+ .addrsig
+ .addrsig_sym printf
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
new file mode 100644
index 0000000000000..d4bdcb124bc2a
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -0,0 +1,6 @@
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t.split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t.split.o
+; RUN: llvm-dwp -e %t.split.o -o %t.split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OUTPUT --allow-empty
+; CHECK-NO-OUTPUT-NOT: .
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t.non_split.o
+; RUN: llvm-dwp -e %t.non_split.o -o %t.non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
+; CHECK-WARNING: warning: no dwo files found
\ No newline at end of file
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 3da408b7e8e8c..40207ec5f2b3f 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -190,7 +190,7 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
if (DWOFilenames.empty()) {
WithColor::defaultWarningHandler(
- make_error<DWPError>("No dwo files found!"));
+ make_error<DWPError>("no dwo files found"));
return 0;
}
>From 4ee62b01c7b4825494a6f7ac34795e0257128a45 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Fri, 7 Jun 2024 17:46:10 +0800
Subject: [PATCH 05/18] update test
---
.../test/tools/llvm-dwp/Inputs/empty_warning/split.s | 6 +++---
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 12 +++++++-----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
index 50ed62f26727a..c706efd31cdc5 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
@@ -12,7 +12,7 @@
.text
.file "main.c"
- .file 1 "/xxx/xxx" "main.c"
+ .file 1 "/xxx/xxx/xxx" "main.c"
.globl main # -- Begin function main
.p2align 4, 0x90
.type main, at function
@@ -93,9 +93,9 @@ main: # @main
.Ldebug_info_end0:
.section .debug_str,"MS", at progbits,1
.Lskel_string0:
- .asciz "xxx/xxx" # string offset=0
+ .asciz "xxx/xxx/xxx" # string offset=0
.Lskel_string1:
- .asciz "main.dwo" # string offset=64
+ .asciz "split_invalid.dwo" # string offset=64
.section .debug_str.dwo,"eMS", at progbits,1
.Linfo_string0:
.asciz "char" # string offset=0
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index d4bdcb124bc2a..f45bbd5b6466a 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -1,6 +1,8 @@
-; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t.split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t.split.o
-; RUN: llvm-dwp -e %t.split.o -o %t.split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OUTPUT --allow-empty
-; CHECK-NO-OUTPUT-NOT: .
-; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t.non_split.o
-; RUN: llvm-dwp -e %t.non_split.o -o %t.non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
+; RUN: rm -rf %t
+; RUN: mkdir -p %t
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
+; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
+; CHECK-ERROR: error: 'xxx/xxx/xxx/split_invalid.dwo': No such file or directory
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
+; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
; CHECK-WARNING: warning: no dwo files found
\ No newline at end of file
>From 7cea95dd4f3ee571106a58da0dcf9af77fb16459 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Sun, 9 Jun 2024 22:20:48 +0800
Subject: [PATCH 06/18] modify warnging messages
---
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 4 ++--
llvm/tools/llvm-dwp/llvm-dwp.cpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index f45bbd5b6466a..ed83c3eb3cd05 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -2,7 +2,7 @@
; RUN: mkdir -p %t
; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; CHECK-ERROR: error: 'xxx/xxx/xxx/split_invalid.dwo': No such file or directory
+; CHECK-ERROR: error: 'xxx/xxx/xxx{{/\\}}split_invalid.dwo': No such file or directory
; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
-; CHECK-WARNING: warning: no dwo files found
\ No newline at end of file
+; CHECK-WARNING: warning: executable file does not contain any references to dwo files
\ No newline at end of file
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 40207ec5f2b3f..fa1a792cf4868 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -190,7 +190,7 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
if (DWOFilenames.empty()) {
WithColor::defaultWarningHandler(
- make_error<DWPError>("no dwo files found"));
+ make_error<DWPError>("executable file does not contain any references to dwo files"));
return 0;
}
>From 9ad6ffa2f7d4d6a7029f555642af0fbd07b70f45 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Sun, 9 Jun 2024 22:39:19 +0800
Subject: [PATCH 07/18] modify warnging messages
---
llvm/tools/llvm-dwp/llvm-dwp.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index fa1a792cf4868..7afcbafeef9e4 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -189,8 +189,8 @@ int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
}
if (DWOFilenames.empty()) {
- WithColor::defaultWarningHandler(
- make_error<DWPError>("executable file does not contain any references to dwo files"));
+ WithColor::defaultWarningHandler(make_error<DWPError>(
+ "executable file does not contain any references to dwo files"));
return 0;
}
>From 4b42331ed110d62a0227cd2752c9388c6c386c1f Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Sun, 9 Jun 2024 23:30:23 +0800
Subject: [PATCH 08/18] modify warnging messages
---
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index ed83c3eb3cd05..2dbea42855f4d 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -2,7 +2,7 @@
; RUN: mkdir -p %t
; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; CHECK-ERROR: error: 'xxx/xxx/xxx{{/\\}}split_invalid.dwo': No such file or directory
+; CHECK-ERROR: error: 'xxx/xxx/xxx{{[/\\]}}split_invalid.dwo': No such file or directory
; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
; CHECK-WARNING: warning: executable file does not contain any references to dwo files
\ No newline at end of file
>From 18c730dfdee78afa640a71b10c369c0a82e56418 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Mon, 10 Jun 2024 01:23:36 +0800
Subject: [PATCH 09/18] modify warnging messages
---
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index 2dbea42855f4d..db8486b107640 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -2,7 +2,7 @@
; RUN: mkdir -p %t
; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; CHECK-ERROR: error: 'xxx/xxx/xxx{{[/\\]}}split_invalid.dwo': No such file or directory
+; CHECK-ERROR: error: 'xxx/xxx/xxx{{[/\\]}}split_invalid.dwo': {{[Nn]}}o such file or directory
; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
; CHECK-WARNING: warning: executable file does not contain any references to dwo files
\ No newline at end of file
>From 42d92fc240ebcad75483218b43f70f31d5b18176 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Mon, 17 Jun 2024 10:57:40 +0800
Subject: [PATCH 10/18] modify test
---
.../llvm-dwp/Inputs/empty_warning/non_split.s | 15 ++++++++++-----
.../tools/llvm-dwp/Inputs/empty_warning/split.s | 17 +++++++++++------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
index 478db2b7e82cc..a0b9c862865ad 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
@@ -1,8 +1,13 @@
-# Note: This file is compiled from the following code, for
-# the purpose of creating an non split-dwarf binary.
-#
-# clang -g -S -gdwarf-4 main.c
-#
+## Note: This file is compiled from the following code, for
+## the purpose of creating an non split-dwarf binary.
+## clang -g -S -gdwarf-4 main.c
+
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
+# RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
+# CHECK-WARNING: warning: no dwo files found
+
#include <stdio.h>
#int main() {
# printf("hello\n");
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
index c706efd31cdc5..9274187a22d2d 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
@@ -1,9 +1,14 @@
-# Note: This file is compiled from the following code, for
-# the purpose of creating a valid split-dwarf binary,
-# where the dwo path is modified to a non-existent path.
-#
-# clang -g -S -gsplit-dwarf -gdwarf-4 main.c
-#
+## Note: This file is compiled from the following code, for
+## the purpose of creating a valid split-dwarf binary,
+## where the dwo path is modified to a non-existent path.
+## clang -g -S -gsplit-dwarf -gdwarf-4 main.c
+
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %s -o %t/split.o
+# RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
+# CHECK-ERROR: error: 'xxx/xxx/xxx/split_invalid.dwo': No such file or directory
+
#include <stdio.h>
#int main() {
# printf("hello\n");
>From bd2a43f858b318f67b5ab8495910e519a4203898 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Mon, 17 Jun 2024 11:26:13 +0800
Subject: [PATCH 11/18] modify test
---
llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s | 2 +-
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 8 --------
2 files changed, 1 insertion(+), 9 deletions(-)
delete mode 100644 llvm/test/tools/llvm-dwp/X86/empty_warning.test
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
index a0b9c862865ad..deafcc46ea6d2 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
@@ -4,7 +4,7 @@
# RUN: rm -rf %t
# RUN: mkdir -p %t
-# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
+# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %s -o %t/non_split.o
# RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
# CHECK-WARNING: warning: no dwo files found
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
deleted file mode 100644
index db8486b107640..0000000000000
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ /dev/null
@@ -1,8 +0,0 @@
-; RUN: rm -rf %t
-; RUN: mkdir -p %t
-; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
-; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; CHECK-ERROR: error: 'xxx/xxx/xxx{{[/\\]}}split_invalid.dwo': {{[Nn]}}o such file or directory
-; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
-; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
-; CHECK-WARNING: warning: executable file does not contain any references to dwo files
\ No newline at end of file
>From 853f2a74e793ce5b284bc5dd174a73d0716f8f58 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Mon, 17 Jun 2024 11:39:19 +0800
Subject: [PATCH 12/18] modify test
---
llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
index deafcc46ea6d2..52878c226d039 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
@@ -6,7 +6,7 @@
# RUN: mkdir -p %t
# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %s -o %t/non_split.o
# RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
-# CHECK-WARNING: warning: no dwo files found
+# CHECK-WARNING: warning: executable file does not contain any references to dwo files
#include <stdio.h>
#int main() {
>From f1eae5fea3b7ac17cf94c90595f4391dc838063d Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Tue, 18 Jun 2024 21:46:26 +0800
Subject: [PATCH 13/18] modify test rm printf
---
.../llvm-dwp/Inputs/empty_warning/non_split.s | 314 +++++-------
.../llvm-dwp/Inputs/empty_warning/split.s | 445 +++++++-----------
.../tools/llvm-dwp/X86/empty_warning.test | 8 +
3 files changed, 301 insertions(+), 466 deletions(-)
create mode 100644 llvm/test/tools/llvm-dwp/X86/empty_warning.test
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
index 52878c226d039..78dc2b8fa07f8 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
@@ -2,222 +2,140 @@
## the purpose of creating an non split-dwarf binary.
## clang -g -S -gdwarf-4 main.c
-# RUN: rm -rf %t
-# RUN: mkdir -p %t
-# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %s -o %t/non_split.o
-# RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
-# CHECK-WARNING: warning: executable file does not contain any references to dwo files
-
-#include <stdio.h>
#int main() {
-# printf("hello\n");
# return 0;
#}
- .text
- .file "main.c"
- .file 1 "/xxx/xxx" "main.c"
- .globl main # -- Begin function main
- .p2align 4, 0x90
- .type main, at function
+ .text
+ .file "main.c"
+ .globl main # -- Begin function main
+ .p2align 4, 0x90
+ .type main, at function
main: # @main
.Lfunc_begin0:
- .loc 1 3 0 # main.c:3:0
- .cfi_startproc
+ .file 1 "xxx/xxx/xxx" "main.c"
+ .loc 1 1 0 # main.c:1:0
+ .cfi_startproc
# %bb.0: # %entry
- pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset %rbp, -16
- movq %rsp, %rbp
- .cfi_def_cfa_register %rbp
- subq $16, %rsp
- movl $0, -4(%rbp)
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ xorl %eax, %eax
+ movl $0, -4(%rbp)
.Ltmp0:
- .loc 1 4 5 prologue_end # main.c:4:5
- leaq .L.str(%rip), %rdi
- movb $0, %al
- callq printf at PLT
- .loc 1 5 5 # main.c:5:5
- xorl %eax, %eax
- .loc 1 5 5 epilogue_begin is_stmt 0 # main.c:5:5
- addq $16, %rsp
- popq %rbp
- .cfi_def_cfa %rsp, 8
- retq
+ .loc 1 2 5 prologue_end # main.c:2:5
+ popq %rbp
+ .cfi_def_cfa %rsp, 8
+ retq
.Ltmp1:
.Lfunc_end0:
- .size main, .Lfunc_end0-main
- .cfi_endproc
+ .size main, .Lfunc_end0-main
+ .cfi_endproc
# -- End function
- .type .L.str, at object # @.str
- .section .rodata.str1.1,"aMS", at progbits,1
-.L.str:
- .asciz "hello\n"
- .size .L.str, 7
-
- .section .debug_abbrev,"", at progbits
- .byte 1 # Abbreviation Code
- .byte 17 # DW_TAG_compile_unit
- .byte 1 # DW_CHILDREN_yes
- .byte 37 # DW_AT_producer
- .byte 14 # DW_FORM_strp
- .byte 19 # DW_AT_language
- .byte 5 # DW_FORM_data2
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 16 # DW_AT_stmt_list
- .byte 23 # DW_FORM_sec_offset
- .byte 27 # DW_AT_comp_dir
- .byte 14 # DW_FORM_strp
- .byte 17 # DW_AT_low_pc
- .byte 1 # DW_FORM_addr
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 2 # Abbreviation Code
- .byte 52 # DW_TAG_variable
- .byte 0 # DW_CHILDREN_no
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 58 # DW_AT_decl_file
- .byte 11 # DW_FORM_data1
- .byte 59 # DW_AT_decl_line
- .byte 11 # DW_FORM_data1
- .byte 2 # DW_AT_location
- .byte 24 # DW_FORM_exprloc
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 3 # Abbreviation Code
- .byte 1 # DW_TAG_array_type
- .byte 1 # DW_CHILDREN_yes
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 4 # Abbreviation Code
- .byte 33 # DW_TAG_subrange_type
- .byte 0 # DW_CHILDREN_no
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 55 # DW_AT_count
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 5 # Abbreviation Code
- .byte 36 # DW_TAG_base_type
- .byte 0 # DW_CHILDREN_no
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 62 # DW_AT_encoding
- .byte 11 # DW_FORM_data1
- .byte 11 # DW_AT_byte_size
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 6 # Abbreviation Code
- .byte 36 # DW_TAG_base_type
- .byte 0 # DW_CHILDREN_no
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 11 # DW_AT_byte_size
- .byte 11 # DW_FORM_data1
- .byte 62 # DW_AT_encoding
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 7 # Abbreviation Code
- .byte 46 # DW_TAG_subprogram
- .byte 0 # DW_CHILDREN_no
- .byte 17 # DW_AT_low_pc
- .byte 1 # DW_FORM_addr
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .byte 64 # DW_AT_frame_base
- .byte 24 # DW_FORM_exprloc
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 58 # DW_AT_decl_file
- .byte 11 # DW_FORM_data1
- .byte 59 # DW_AT_decl_line
- .byte 11 # DW_FORM_data1
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 63 # DW_AT_external
- .byte 25 # DW_FORM_flag_present
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 0 # EOM(3)
- .section .debug_info,"", at progbits
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 14 # DW_FORM_strp
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 14 # DW_FORM_strp
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 0 # DW_CHILDREN_no
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
.Lcu_begin0:
- .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
.Ldebug_info_start0:
- .short 4 # DWARF version number
- .long .debug_abbrev # Offset Into Abbrev. Section
- .byte 8 # Address Size (in bytes)
- .byte 1 # Abbrev [1] 0xb:0x6b DW_TAG_compile_unit
- .long .Linfo_string0 # DW_AT_producer
- .short 29 # DW_AT_language
- .long .Linfo_string1 # DW_AT_name
- .long .Lline_table_start0 # DW_AT_stmt_list
- .long .Linfo_string2 # DW_AT_comp_dir
- .quad .Lfunc_begin0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .byte 2 # Abbrev [2] 0x2a:0x11 DW_TAG_variable
- .long 59 # DW_AT_type
- .byte 1 # DW_AT_decl_file
- .byte 4 # DW_AT_decl_line
- .byte 9 # DW_AT_location
- .byte 3
- .quad .L.str
- .byte 3 # Abbrev [3] 0x3b:0xc DW_TAG_array_type
- .long 71 # DW_AT_type
- .byte 4 # Abbrev [4] 0x40:0x6 DW_TAG_subrange_type
- .long 78 # DW_AT_type
- .byte 7 # DW_AT_count
- .byte 0 # End Of Children Mark
- .byte 5 # Abbrev [5] 0x47:0x7 DW_TAG_base_type
- .long .Linfo_string3 # DW_AT_name
- .byte 6 # DW_AT_encoding
- .byte 1 # DW_AT_byte_size
- .byte 6 # Abbrev [6] 0x4e:0x7 DW_TAG_base_type
- .long .Linfo_string4 # DW_AT_name
- .byte 8 # DW_AT_byte_size
- .byte 7 # DW_AT_encoding
- .byte 7 # Abbrev [7] 0x55:0x19 DW_TAG_subprogram
- .quad .Lfunc_begin0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .byte 1 # DW_AT_frame_base
- .byte 86
- .long .Linfo_string5 # DW_AT_name
- .byte 1 # DW_AT_decl_file
- .byte 3 # DW_AT_decl_line
- .long 110 # DW_AT_type
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
+ .long .Linfo_string0 # DW_AT_producer
+ .short 12 # DW_AT_language
+ .long .Linfo_string1 # DW_AT_name
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .long .Linfo_string2 # DW_AT_comp_dir
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 2 # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 86
+ .long .Linfo_string3 # DW_AT_name
+ .byte 1 # DW_AT_decl_file
+ .byte 1 # DW_AT_decl_line
+ .long 67 # DW_AT_type
# DW_AT_external
- .byte 5 # Abbrev [5] 0x6e:0x7 DW_TAG_base_type
- .long .Linfo_string6 # DW_AT_name
- .byte 5 # DW_AT_encoding
- .byte 4 # DW_AT_byte_size
- .byte 0 # End Of Children Mark
+ .byte 3 # Abbrev [3] 0x43:0x7 DW_TAG_base_type
+ .long .Linfo_string4 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
.Ldebug_info_end0:
- .section .debug_str,"MS", at progbits,1
+ .section .debug_str,"MS", at progbits,1
.Linfo_string0:
- .asciz "clang version 19.0.0git" # string offset=0
+ .asciz "clang version 11.0.1git" # string offset=0
.Linfo_string1:
- .asciz "main.c" # string offset=24
+ .asciz "main.c" # string offset=104
.Linfo_string2:
- .asciz "xxx/xxx" # string offset=31
+ .asciz "/data02/home/huangjinjie/origin-llvm-project/llvm-project/build" # string offset=111
.Linfo_string3:
- .asciz "char" # string offset=95
+ .asciz "main" # string offset=175
.Linfo_string4:
- .asciz "__ARRAY_SIZE_TYPE__" # string offset=100
-.Linfo_string5:
- .asciz "main" # string offset=120
-.Linfo_string6:
- .asciz "int" # string offset=125
- .ident "clang version 19.0.0git"
- .section ".note.GNU-stack","", at progbits
- .addrsig
- .addrsig_sym printf
- .section .debug_line,"", at progbits
+ .asciz "int" # string offset=180
+ .ident "clang version 11.0.1git"
+ .section .GCC.command.line,"MS", at progbits,1
+ .zero 1
+ .ascii "/usr/local/bin/clang-11 -g -S -gdwarf-4 main.c -o main_non_split.s"
+ .zero 1
+ .section .debug_str,"MS", at progbits,1
+ .section ".note.GNU-stack","", at progbits
+ .addrsig
+ .section .debug_line,"", at progbits
.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
index 9274187a22d2d..0c2b27d937eb9 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
@@ -3,300 +3,209 @@
## where the dwo path is modified to a non-existent path.
## clang -g -S -gsplit-dwarf -gdwarf-4 main.c
-# RUN: rm -rf %t
-# RUN: mkdir -p %t
-# RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %s -o %t/split.o
-# RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-# CHECK-ERROR: error: 'xxx/xxx/xxx/split_invalid.dwo': No such file or directory
-
-#include <stdio.h>
#int main() {
-# printf("hello\n");
# return 0;
#}
- .text
- .file "main.c"
- .file 1 "/xxx/xxx/xxx" "main.c"
- .globl main # -- Begin function main
- .p2align 4, 0x90
- .type main, at function
+ .text
+ .file "main.c"
+ .globl main # -- Begin function main
+ .p2align 4, 0x90
+ .type main, at function
main: # @main
.Lfunc_begin0:
- .loc 1 3 0 # main.c:3:0
- .cfi_startproc
+ .file 1 "xxx/xxx/xxx" "main.c"
+ .loc 1 1 0 # main.c:1:0
+ .cfi_startproc
# %bb.0: # %entry
- pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset %rbp, -16
- movq %rsp, %rbp
- .cfi_def_cfa_register %rbp
- subq $16, %rsp
- movl $0, -4(%rbp)
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ xorl %eax, %eax
+ movl $0, -4(%rbp)
.Ltmp0:
- .loc 1 4 5 prologue_end # main.c:4:5
- leaq .L.str(%rip), %rdi
- movb $0, %al
- callq printf at PLT
- .loc 1 5 5 # main.c:5:5
- xorl %eax, %eax
- .loc 1 5 5 epilogue_begin is_stmt 0 # main.c:5:5
- addq $16, %rsp
- popq %rbp
- .cfi_def_cfa %rsp, 8
- retq
+ .loc 1 2 5 prologue_end # main.c:2:5
+ popq %rbp
+ .cfi_def_cfa %rsp, 8
+ retq
.Ltmp1:
.Lfunc_end0:
- .size main, .Lfunc_end0-main
- .cfi_endproc
+ .size main, .Lfunc_end0-main
+ .cfi_endproc
# -- End function
- .type .L.str, at object # @.str
- .section .rodata.str1.1,"aMS", at progbits,1
-.L.str:
- .asciz "hello\n"
- .size .L.str, 7
-
- .section .debug_abbrev,"", at progbits
- .byte 1 # Abbreviation Code
- .byte 17 # DW_TAG_compile_unit
- .byte 0 # DW_CHILDREN_no
- .byte 16 # DW_AT_stmt_list
- .byte 23 # DW_FORM_sec_offset
- .byte 27 # DW_AT_comp_dir
- .byte 14 # DW_FORM_strp
- .ascii "\264B" # DW_AT_GNU_pubnames
- .byte 25 # DW_FORM_flag_present
- .ascii "\260B" # DW_AT_GNU_dwo_name
- .byte 14 # DW_FORM_strp
- .ascii "\261B" # DW_AT_GNU_dwo_id
- .byte 7 # DW_FORM_data8
- .byte 17 # DW_AT_low_pc
- .byte 1 # DW_FORM_addr
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .ascii "\263B" # DW_AT_GNU_addr_base
- .byte 23 # DW_FORM_sec_offset
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 0 # EOM(3)
- .section .debug_info,"", at progbits
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 0 # DW_CHILDREN_no
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 14 # DW_FORM_strp
+ .ascii "\264B" # DW_AT_GNU_pubnames
+ .byte 25 # DW_FORM_flag_present
+ .ascii "\260B" # DW_AT_GNU_dwo_name
+ .byte 14 # DW_FORM_strp
+ .ascii "\261B" # DW_AT_GNU_dwo_id
+ .byte 7 # DW_FORM_data8
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .ascii "\263B" # DW_AT_GNU_addr_base
+ .byte 23 # DW_FORM_sec_offset
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
.Lcu_begin0:
- .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
.Ldebug_info_start0:
- .short 4 # DWARF version number
- .long .debug_abbrev # Offset Into Abbrev. Section
- .byte 8 # Address Size (in bytes)
- .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
- .long .Lline_table_start0 # DW_AT_stmt_list
- .long .Lskel_string0 # DW_AT_comp_dir
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .long .Lskel_string0 # DW_AT_comp_dir
# DW_AT_GNU_pubnames
- .long .Lskel_string1 # DW_AT_GNU_dwo_name
- .quad -6752972150003664062 # DW_AT_GNU_dwo_id
- .quad .Lfunc_begin0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .long .Laddr_table_base0 # DW_AT_GNU_addr_base
+ .long .Lskel_string1 # DW_AT_GNU_dwo_name
+ .quad -346972125991005518 # DW_AT_GNU_dwo_id
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .long .Laddr_table_base0 # DW_AT_GNU_addr_base
.Ldebug_info_end0:
- .section .debug_str,"MS", at progbits,1
+ .section .debug_str,"MS", at progbits,1
.Lskel_string0:
- .asciz "xxx/xxx/xxx" # string offset=0
+ .asciz "xxx/xxx/xxx" # string offset=0
.Lskel_string1:
- .asciz "split_invalid.dwo" # string offset=64
- .section .debug_str.dwo,"eMS", at progbits,1
+ .asciz "split_invalid.dwoo" # string offset=64
+ .section .debug_str.dwo,"eMS", at progbits,1
.Linfo_string0:
- .asciz "char" # string offset=0
+ .asciz "main" # string offset=0
.Linfo_string1:
- .asciz "__ARRAY_SIZE_TYPE__" # string offset=5
+ .asciz "int" # string offset=5
.Linfo_string2:
- .asciz "main" # string offset=25
+ .asciz "clang version 11.0.1git" # string offset=9
.Linfo_string3:
- .asciz "int" # string offset=30
+ .asciz "main.c" # string offset=113
.Linfo_string4:
- .asciz "clang version 19.0.0git" # string offset=34
-.Linfo_string5:
- .asciz "main.c" # string offset=58
-.Linfo_string6:
- .asciz "main.dwo" # string offset=65
- .section .debug_str_offsets.dwo,"e", at progbits
- .long 0
- .long 5
- .long 25
- .long 30
- .long 34
- .long 58
- .long 65
- .section .debug_info.dwo,"e", at progbits
- .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
+ .asciz "split_invalid.dwo" # string offset=120
+ .section .debug_str_offsets.dwo,"e", at progbits
+ .long 0
+ .long 5
+ .long 9
+ .long 113
+ .long 120
+ .section .debug_info.dwo,"e", at progbits
+ .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
.Ldebug_info_dwo_start0:
- .short 4 # DWARF version number
- .long 0 # Offset Into Abbrev. Section
- .byte 8 # Address Size (in bytes)
- .byte 1 # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
- .byte 4 # DW_AT_producer
- .short 29 # DW_AT_language
- .byte 5 # DW_AT_name
- .byte 6 # DW_AT_GNU_dwo_name
- .quad -6752972150003664062 # DW_AT_GNU_dwo_id
- .byte 2 # Abbrev [2] 0x19:0xa DW_TAG_variable
- .long 35 # DW_AT_type
- .byte 1 # DW_AT_decl_file
- .byte 4 # DW_AT_decl_line
- .byte 2 # DW_AT_location
- .byte 251
- .byte 0
- .byte 3 # Abbrev [3] 0x23:0xc DW_TAG_array_type
- .long 47 # DW_AT_type
- .byte 4 # Abbrev [4] 0x28:0x6 DW_TAG_subrange_type
- .long 51 # DW_AT_type
- .byte 7 # DW_AT_count
- .byte 0 # End Of Children Mark
- .byte 5 # Abbrev [5] 0x2f:0x4 DW_TAG_base_type
- .byte 0 # DW_AT_name
- .byte 6 # DW_AT_encoding
- .byte 1 # DW_AT_byte_size
- .byte 6 # Abbrev [6] 0x33:0x4 DW_TAG_base_type
- .byte 1 # DW_AT_name
- .byte 8 # DW_AT_byte_size
- .byte 7 # DW_AT_encoding
- .byte 7 # Abbrev [7] 0x37:0xf DW_TAG_subprogram
- .byte 1 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .byte 1 # DW_AT_frame_base
- .byte 86
- .byte 2 # DW_AT_name
- .byte 1 # DW_AT_decl_file
- .byte 3 # DW_AT_decl_line
- .long 70 # DW_AT_type
+ .short 4 # DWARF version number
+ .long 0 # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x22 DW_TAG_compile_unit
+ .byte 2 # DW_AT_producer
+ .short 12 # DW_AT_language
+ .byte 3 # DW_AT_name
+ .byte 4 # DW_AT_GNU_dwo_name
+ .quad -346972125991005518 # DW_AT_GNU_dwo_id
+ .byte 2 # Abbrev [2] 0x19:0xf DW_TAG_subprogram
+ .byte 0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 86
+ .byte 0 # DW_AT_name
+ .byte 1 # DW_AT_decl_file
+ .byte 1 # DW_AT_decl_line
+ .long 40 # DW_AT_type
# DW_AT_external
- .byte 5 # Abbrev [5] 0x46:0x4 DW_TAG_base_type
- .byte 3 # DW_AT_name
- .byte 5 # DW_AT_encoding
- .byte 4 # DW_AT_byte_size
- .byte 0 # End Of Children Mark
+ .byte 3 # Abbrev [3] 0x28:0x4 DW_TAG_base_type
+ .byte 1 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
.Ldebug_info_dwo_end0:
- .section .debug_abbrev.dwo,"e", at progbits
- .byte 1 # Abbreviation Code
- .byte 17 # DW_TAG_compile_unit
- .byte 1 # DW_CHILDREN_yes
- .byte 37 # DW_AT_producer
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 19 # DW_AT_language
- .byte 5 # DW_FORM_data2
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .ascii "\260B" # DW_AT_GNU_dwo_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .ascii "\261B" # DW_AT_GNU_dwo_id
- .byte 7 # DW_FORM_data8
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 2 # Abbreviation Code
- .byte 52 # DW_TAG_variable
- .byte 0 # DW_CHILDREN_no
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 58 # DW_AT_decl_file
- .byte 11 # DW_FORM_data1
- .byte 59 # DW_AT_decl_line
- .byte 11 # DW_FORM_data1
- .byte 2 # DW_AT_location
- .byte 24 # DW_FORM_exprloc
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 3 # Abbreviation Code
- .byte 1 # DW_TAG_array_type
- .byte 1 # DW_CHILDREN_yes
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 4 # Abbreviation Code
- .byte 33 # DW_TAG_subrange_type
- .byte 0 # DW_CHILDREN_no
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 55 # DW_AT_count
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 5 # Abbreviation Code
- .byte 36 # DW_TAG_base_type
- .byte 0 # DW_CHILDREN_no
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 62 # DW_AT_encoding
- .byte 11 # DW_FORM_data1
- .byte 11 # DW_AT_byte_size
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 6 # Abbreviation Code
- .byte 36 # DW_TAG_base_type
- .byte 0 # DW_CHILDREN_no
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 11 # DW_AT_byte_size
- .byte 11 # DW_FORM_data1
- .byte 62 # DW_AT_encoding
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 7 # Abbreviation Code
- .byte 46 # DW_TAG_subprogram
- .byte 0 # DW_CHILDREN_no
- .byte 17 # DW_AT_low_pc
- .ascii "\201>" # DW_FORM_GNU_addr_index
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .byte 64 # DW_AT_frame_base
- .byte 24 # DW_FORM_exprloc
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 58 # DW_AT_decl_file
- .byte 11 # DW_FORM_data1
- .byte 59 # DW_AT_decl_line
- .byte 11 # DW_FORM_data1
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 63 # DW_AT_external
- .byte 25 # DW_FORM_flag_present
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 0 # EOM(3)
- .section .debug_addr,"", at progbits
+ .section .debug_abbrev.dwo,"e", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .ascii "\260B" # DW_AT_GNU_dwo_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .ascii "\261B" # DW_AT_GNU_dwo_id
+ .byte 7 # DW_FORM_data8
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 0 # DW_CHILDREN_no
+ .byte 17 # DW_AT_low_pc
+ .ascii "\201>" # DW_FORM_GNU_addr_index
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .ascii "\202>" # DW_FORM_GNU_str_index
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_addr,"", at progbits
.Laddr_table_base0:
- .quad .L.str
- .quad .Lfunc_begin0
- .section .debug_gnu_pubnames,"", at progbits
- .long .LpubNames_end0-.LpubNames_start0 # Length of Public Names Info
-.LpubNames_start0:
- .short 2 # DWARF Version
- .long .Lcu_begin0 # Offset of Compilation Unit Info
- .long 48 # Compilation Unit Length
- .long 25 # DIE offset
- .byte 160 # Attributes: VARIABLE, STATIC
- .byte 0 # External Name
- .long 55 # DIE offset
- .byte 48 # Attributes: FUNCTION, EXTERNAL
- .asciz "main" # External Name
- .long 0 # End Mark
+ .quad .Lfunc_begin0
+ .section .debug_gnu_pubnames,"", at progbits
+ .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info
+.LpubNames_begin0:
+ .short 2 # DWARF Version
+ .long .Lcu_begin0 # Offset of Compilation Unit Info
+ .long 48 # Compilation Unit Length
+ .long 25 # DIE offset
+ .byte 48 # Attributes: FUNCTION, EXTERNAL
+ .asciz "main" # External Name
+ .long 0 # End Mark
.LpubNames_end0:
- .section .debug_gnu_pubtypes,"", at progbits
- .long .LpubTypes_end0-.LpubTypes_start0 # Length of Public Types Info
-.LpubTypes_start0:
- .short 2 # DWARF Version
- .long .Lcu_begin0 # Offset of Compilation Unit Info
- .long 48 # Compilation Unit Length
- .long 47 # DIE offset
- .byte 144 # Attributes: TYPE, STATIC
- .asciz "char" # External Name
- .long 70 # DIE offset
- .byte 144 # Attributes: TYPE, STATIC
- .asciz "int" # External Name
- .long 0 # End Mark
+ .section .debug_gnu_pubtypes,"", at progbits
+ .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info
+.LpubTypes_begin0:
+ .short 2 # DWARF Version
+ .long .Lcu_begin0 # Offset of Compilation Unit Info
+ .long 48 # Compilation Unit Length
+ .long 40 # DIE offset
+ .byte 144 # Attributes: TYPE, STATIC
+ .asciz "int" # External Name
+ .long 0 # End Mark
.LpubTypes_end0:
- .ident "clang version 19.0.0git"
- .section ".note.GNU-stack","", at progbits
- .addrsig
- .addrsig_sym printf
- .section .debug_line,"", at progbits
+ .ident "clang version 11.0.1git"
+ .section .GCC.command.line,"MS", at progbits,1
+ .zero 1
+ .ascii "/usr/local/bin/clang-11 -g -S -gsplit-dwarf -gdwarf-4 main.c -o main_split.s"
+ .zero 1
+ .section .debug_gnu_pubtypes,"", at progbits
+ .section ".note.GNU-stack","", at progbits
+ .addrsig
+ .section .debug_line,"", at progbits
.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
new file mode 100644
index 0000000000000..db8486b107640
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -0,0 +1,8 @@
+; RUN: rm -rf %t
+; RUN: mkdir -p %t
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
+; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
+; CHECK-ERROR: error: 'xxx/xxx/xxx{{[/\\]}}split_invalid.dwo': {{[Nn]}}o such file or directory
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
+; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
+; CHECK-WARNING: warning: executable file does not contain any references to dwo files
\ No newline at end of file
>From d95fa91d416fb60787286bfa868f2cb08b3cb9c1 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Tue, 18 Jun 2024 23:46:15 +0800
Subject: [PATCH 14/18] modify test rm printf
---
llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
index 0c2b27d937eb9..7906a445b2940 100644
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
+++ b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
@@ -79,7 +79,7 @@ main: # @main
.Lskel_string0:
.asciz "xxx/xxx/xxx" # string offset=0
.Lskel_string1:
- .asciz "split_invalid.dwoo" # string offset=64
+ .asciz "split_invalid.dwo" # string offset=64
.section .debug_str.dwo,"eMS", at progbits,1
.Linfo_string0:
.asciz "main" # string offset=0
>From 058e77d204322f53ec8b16e9774c70691a2865d1 Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Wed, 19 Jun 2024 20:42:07 +0800
Subject: [PATCH 15/18] use split-file
---
.../llvm-dwp/Inputs/empty_warning/non_split.s | 141 ------------
.../llvm-dwp/Inputs/empty_warning/split.s | 211 ------------------
.../tools/llvm-dwp/X86/empty_warning.test | 15 +-
3 files changed, 8 insertions(+), 359 deletions(-)
delete mode 100644 llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
delete mode 100644 llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
deleted file mode 100644
index 78dc2b8fa07f8..0000000000000
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/non_split.s
+++ /dev/null
@@ -1,141 +0,0 @@
-## Note: This file is compiled from the following code, for
-## the purpose of creating an non split-dwarf binary.
-## clang -g -S -gdwarf-4 main.c
-
-#int main() {
-# return 0;
-#}
-
- .text
- .file "main.c"
- .globl main # -- Begin function main
- .p2align 4, 0x90
- .type main, at function
-main: # @main
-.Lfunc_begin0:
- .file 1 "xxx/xxx/xxx" "main.c"
- .loc 1 1 0 # main.c:1:0
- .cfi_startproc
-# %bb.0: # %entry
- pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset %rbp, -16
- movq %rsp, %rbp
- .cfi_def_cfa_register %rbp
- xorl %eax, %eax
- movl $0, -4(%rbp)
-.Ltmp0:
- .loc 1 2 5 prologue_end # main.c:2:5
- popq %rbp
- .cfi_def_cfa %rsp, 8
- retq
-.Ltmp1:
-.Lfunc_end0:
- .size main, .Lfunc_end0-main
- .cfi_endproc
- # -- End function
- .section .debug_abbrev,"", at progbits
- .byte 1 # Abbreviation Code
- .byte 17 # DW_TAG_compile_unit
- .byte 1 # DW_CHILDREN_yes
- .byte 37 # DW_AT_producer
- .byte 14 # DW_FORM_strp
- .byte 19 # DW_AT_language
- .byte 5 # DW_FORM_data2
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 16 # DW_AT_stmt_list
- .byte 23 # DW_FORM_sec_offset
- .byte 27 # DW_AT_comp_dir
- .byte 14 # DW_FORM_strp
- .byte 17 # DW_AT_low_pc
- .byte 1 # DW_FORM_addr
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 2 # Abbreviation Code
- .byte 46 # DW_TAG_subprogram
- .byte 0 # DW_CHILDREN_no
- .byte 17 # DW_AT_low_pc
- .byte 1 # DW_FORM_addr
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .byte 64 # DW_AT_frame_base
- .byte 24 # DW_FORM_exprloc
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 58 # DW_AT_decl_file
- .byte 11 # DW_FORM_data1
- .byte 59 # DW_AT_decl_line
- .byte 11 # DW_FORM_data1
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 63 # DW_AT_external
- .byte 25 # DW_FORM_flag_present
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 3 # Abbreviation Code
- .byte 36 # DW_TAG_base_type
- .byte 0 # DW_CHILDREN_no
- .byte 3 # DW_AT_name
- .byte 14 # DW_FORM_strp
- .byte 62 # DW_AT_encoding
- .byte 11 # DW_FORM_data1
- .byte 11 # DW_AT_byte_size
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 0 # EOM(3)
- .section .debug_info,"", at progbits
-.Lcu_begin0:
- .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
-.Ldebug_info_start0:
- .short 4 # DWARF version number
- .long .debug_abbrev # Offset Into Abbrev. Section
- .byte 8 # Address Size (in bytes)
- .byte 1 # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
- .long .Linfo_string0 # DW_AT_producer
- .short 12 # DW_AT_language
- .long .Linfo_string1 # DW_AT_name
- .long .Lline_table_start0 # DW_AT_stmt_list
- .long .Linfo_string2 # DW_AT_comp_dir
- .quad .Lfunc_begin0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .byte 2 # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
- .quad .Lfunc_begin0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .byte 1 # DW_AT_frame_base
- .byte 86
- .long .Linfo_string3 # DW_AT_name
- .byte 1 # DW_AT_decl_file
- .byte 1 # DW_AT_decl_line
- .long 67 # DW_AT_type
- # DW_AT_external
- .byte 3 # Abbrev [3] 0x43:0x7 DW_TAG_base_type
- .long .Linfo_string4 # DW_AT_name
- .byte 5 # DW_AT_encoding
- .byte 4 # DW_AT_byte_size
- .byte 0 # End Of Children Mark
-.Ldebug_info_end0:
- .section .debug_str,"MS", at progbits,1
-.Linfo_string0:
- .asciz "clang version 11.0.1git" # string offset=0
-.Linfo_string1:
- .asciz "main.c" # string offset=104
-.Linfo_string2:
- .asciz "/data02/home/huangjinjie/origin-llvm-project/llvm-project/build" # string offset=111
-.Linfo_string3:
- .asciz "main" # string offset=175
-.Linfo_string4:
- .asciz "int" # string offset=180
- .ident "clang version 11.0.1git"
- .section .GCC.command.line,"MS", at progbits,1
- .zero 1
- .ascii "/usr/local/bin/clang-11 -g -S -gdwarf-4 main.c -o main_non_split.s"
- .zero 1
- .section .debug_str,"MS", at progbits,1
- .section ".note.GNU-stack","", at progbits
- .addrsig
- .section .debug_line,"", at progbits
-.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s b/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
deleted file mode 100644
index 7906a445b2940..0000000000000
--- a/llvm/test/tools/llvm-dwp/Inputs/empty_warning/split.s
+++ /dev/null
@@ -1,211 +0,0 @@
-## Note: This file is compiled from the following code, for
-## the purpose of creating a valid split-dwarf binary,
-## where the dwo path is modified to a non-existent path.
-## clang -g -S -gsplit-dwarf -gdwarf-4 main.c
-
-#int main() {
-# return 0;
-#}
-
- .text
- .file "main.c"
- .globl main # -- Begin function main
- .p2align 4, 0x90
- .type main, at function
-main: # @main
-.Lfunc_begin0:
- .file 1 "xxx/xxx/xxx" "main.c"
- .loc 1 1 0 # main.c:1:0
- .cfi_startproc
-# %bb.0: # %entry
- pushq %rbp
- .cfi_def_cfa_offset 16
- .cfi_offset %rbp, -16
- movq %rsp, %rbp
- .cfi_def_cfa_register %rbp
- xorl %eax, %eax
- movl $0, -4(%rbp)
-.Ltmp0:
- .loc 1 2 5 prologue_end # main.c:2:5
- popq %rbp
- .cfi_def_cfa %rsp, 8
- retq
-.Ltmp1:
-.Lfunc_end0:
- .size main, .Lfunc_end0-main
- .cfi_endproc
- # -- End function
- .section .debug_abbrev,"", at progbits
- .byte 1 # Abbreviation Code
- .byte 17 # DW_TAG_compile_unit
- .byte 0 # DW_CHILDREN_no
- .byte 16 # DW_AT_stmt_list
- .byte 23 # DW_FORM_sec_offset
- .byte 27 # DW_AT_comp_dir
- .byte 14 # DW_FORM_strp
- .ascii "\264B" # DW_AT_GNU_pubnames
- .byte 25 # DW_FORM_flag_present
- .ascii "\260B" # DW_AT_GNU_dwo_name
- .byte 14 # DW_FORM_strp
- .ascii "\261B" # DW_AT_GNU_dwo_id
- .byte 7 # DW_FORM_data8
- .byte 17 # DW_AT_low_pc
- .byte 1 # DW_FORM_addr
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .ascii "\263B" # DW_AT_GNU_addr_base
- .byte 23 # DW_FORM_sec_offset
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 0 # EOM(3)
- .section .debug_info,"", at progbits
-.Lcu_begin0:
- .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
-.Ldebug_info_start0:
- .short 4 # DWARF version number
- .long .debug_abbrev # Offset Into Abbrev. Section
- .byte 8 # Address Size (in bytes)
- .byte 1 # Abbrev [1] 0xb:0x25 DW_TAG_compile_unit
- .long .Lline_table_start0 # DW_AT_stmt_list
- .long .Lskel_string0 # DW_AT_comp_dir
- # DW_AT_GNU_pubnames
- .long .Lskel_string1 # DW_AT_GNU_dwo_name
- .quad -346972125991005518 # DW_AT_GNU_dwo_id
- .quad .Lfunc_begin0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .long .Laddr_table_base0 # DW_AT_GNU_addr_base
-.Ldebug_info_end0:
- .section .debug_str,"MS", at progbits,1
-.Lskel_string0:
- .asciz "xxx/xxx/xxx" # string offset=0
-.Lskel_string1:
- .asciz "split_invalid.dwo" # string offset=64
- .section .debug_str.dwo,"eMS", at progbits,1
-.Linfo_string0:
- .asciz "main" # string offset=0
-.Linfo_string1:
- .asciz "int" # string offset=5
-.Linfo_string2:
- .asciz "clang version 11.0.1git" # string offset=9
-.Linfo_string3:
- .asciz "main.c" # string offset=113
-.Linfo_string4:
- .asciz "split_invalid.dwo" # string offset=120
- .section .debug_str_offsets.dwo,"e", at progbits
- .long 0
- .long 5
- .long 9
- .long 113
- .long 120
- .section .debug_info.dwo,"e", at progbits
- .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
-.Ldebug_info_dwo_start0:
- .short 4 # DWARF version number
- .long 0 # Offset Into Abbrev. Section
- .byte 8 # Address Size (in bytes)
- .byte 1 # Abbrev [1] 0xb:0x22 DW_TAG_compile_unit
- .byte 2 # DW_AT_producer
- .short 12 # DW_AT_language
- .byte 3 # DW_AT_name
- .byte 4 # DW_AT_GNU_dwo_name
- .quad -346972125991005518 # DW_AT_GNU_dwo_id
- .byte 2 # Abbrev [2] 0x19:0xf DW_TAG_subprogram
- .byte 0 # DW_AT_low_pc
- .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
- .byte 1 # DW_AT_frame_base
- .byte 86
- .byte 0 # DW_AT_name
- .byte 1 # DW_AT_decl_file
- .byte 1 # DW_AT_decl_line
- .long 40 # DW_AT_type
- # DW_AT_external
- .byte 3 # Abbrev [3] 0x28:0x4 DW_TAG_base_type
- .byte 1 # DW_AT_name
- .byte 5 # DW_AT_encoding
- .byte 4 # DW_AT_byte_size
- .byte 0 # End Of Children Mark
-.Ldebug_info_dwo_end0:
- .section .debug_abbrev.dwo,"e", at progbits
- .byte 1 # Abbreviation Code
- .byte 17 # DW_TAG_compile_unit
- .byte 1 # DW_CHILDREN_yes
- .byte 37 # DW_AT_producer
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 19 # DW_AT_language
- .byte 5 # DW_FORM_data2
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .ascii "\260B" # DW_AT_GNU_dwo_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .ascii "\261B" # DW_AT_GNU_dwo_id
- .byte 7 # DW_FORM_data8
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 2 # Abbreviation Code
- .byte 46 # DW_TAG_subprogram
- .byte 0 # DW_CHILDREN_no
- .byte 17 # DW_AT_low_pc
- .ascii "\201>" # DW_FORM_GNU_addr_index
- .byte 18 # DW_AT_high_pc
- .byte 6 # DW_FORM_data4
- .byte 64 # DW_AT_frame_base
- .byte 24 # DW_FORM_exprloc
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 58 # DW_AT_decl_file
- .byte 11 # DW_FORM_data1
- .byte 59 # DW_AT_decl_line
- .byte 11 # DW_FORM_data1
- .byte 73 # DW_AT_type
- .byte 19 # DW_FORM_ref4
- .byte 63 # DW_AT_external
- .byte 25 # DW_FORM_flag_present
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 3 # Abbreviation Code
- .byte 36 # DW_TAG_base_type
- .byte 0 # DW_CHILDREN_no
- .byte 3 # DW_AT_name
- .ascii "\202>" # DW_FORM_GNU_str_index
- .byte 62 # DW_AT_encoding
- .byte 11 # DW_FORM_data1
- .byte 11 # DW_AT_byte_size
- .byte 11 # DW_FORM_data1
- .byte 0 # EOM(1)
- .byte 0 # EOM(2)
- .byte 0 # EOM(3)
- .section .debug_addr,"", at progbits
-.Laddr_table_base0:
- .quad .Lfunc_begin0
- .section .debug_gnu_pubnames,"", at progbits
- .long .LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info
-.LpubNames_begin0:
- .short 2 # DWARF Version
- .long .Lcu_begin0 # Offset of Compilation Unit Info
- .long 48 # Compilation Unit Length
- .long 25 # DIE offset
- .byte 48 # Attributes: FUNCTION, EXTERNAL
- .asciz "main" # External Name
- .long 0 # End Mark
-.LpubNames_end0:
- .section .debug_gnu_pubtypes,"", at progbits
- .long .LpubTypes_end0-.LpubTypes_begin0 # Length of Public Types Info
-.LpubTypes_begin0:
- .short 2 # DWARF Version
- .long .Lcu_begin0 # Offset of Compilation Unit Info
- .long 48 # Compilation Unit Length
- .long 40 # DIE offset
- .byte 144 # Attributes: TYPE, STATIC
- .asciz "int" # External Name
- .long 0 # End Mark
-.LpubTypes_end0:
- .ident "clang version 11.0.1git"
- .section .GCC.command.line,"MS", at progbits,1
- .zero 1
- .ascii "/usr/local/bin/clang-11 -g -S -gsplit-dwarf -gdwarf-4 main.c -o main_split.s"
- .zero 1
- .section .debug_gnu_pubtypes,"", at progbits
- .section ".note.GNU-stack","", at progbits
- .addrsig
- .section .debug_line,"", at progbits
-.Lline_table_start0:
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index db8486b107640..247f2f6de1ded 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -1,8 +1,9 @@
-; RUN: rm -rf %t
-; RUN: mkdir -p %t
-; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t/split.dwo -dwarf-version=4 %p/../Inputs/empty_warning/split.s -o %t/split.o
-; RUN: not llvm-dwp -e %t/split.o -o %t/split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
-; CHECK-ERROR: error: 'xxx/xxx/xxx{{[/\\]}}split_invalid.dwo': {{[Nn]}}o such file or directory
-; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %p/../Inputs/empty_warning/non_split.s -o %t/non_split.o
+; RUN: rm -rf %t && split-file %s %t && cd %t
+; RUN: clang -g -gdwarf-4 non_split.c -o non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
-; CHECK-WARNING: warning: executable file does not contain any references to dwo files
\ No newline at end of file
+; CHECK-WARNING: warning: executable file does not contain any references to dwo files
+
+;--- non_split.c
+int main() {
+ return 0;
+}
\ No newline at end of file
>From 641c1664b81a15c95ebf7625ffe0fc812b6da41b Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Wed, 19 Jun 2024 21:06:25 +0800
Subject: [PATCH 16/18] use split-file
---
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index 247f2f6de1ded..15280b51225d7 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -1,5 +1,5 @@
; RUN: rm -rf %t && split-file %s %t && cd %t
-; RUN: clang -g -gdwarf-4 non_split.c -o non_split.o
+; RUN: clang -g -gdwarf-4 %t/non_split.c -o %t/non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
; CHECK-WARNING: warning: executable file does not contain any references to dwo files
>From 495f64d658b19c537b04ecb0f38f8501e27b3f5a Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Wed, 19 Jun 2024 22:53:02 +0800
Subject: [PATCH 17/18] modify test
---
llvm/test/tools/llvm-dwp/X86/empty_warning.test | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index 15280b51225d7..7ac5cc3f6c707 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -1,4 +1,4 @@
-; RUN: rm -rf %t && split-file %s %t && cd %t
+; RUN: rm -rf %t && mkdir -p %t && split-file %s %t && cd %t
; RUN: clang -g -gdwarf-4 %t/non_split.c -o %t/non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
; CHECK-WARNING: warning: executable file does not contain any references to dwo files
>From 105620982d70058a005fa28a286f57389e1a33ab Mon Sep 17 00:00:00 2001
From: huangjinjie <huangjinjie at bytedance.com>
Date: Wed, 26 Jun 2024 15:02:57 +0800
Subject: [PATCH 18/18] use llvm-mc to gen
---
.../tools/llvm-dwp/X86/empty_warning.test | 141 +++++++++++++++++-
1 file changed, 136 insertions(+), 5 deletions(-)
diff --git a/llvm/test/tools/llvm-dwp/X86/empty_warning.test b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
index 7ac5cc3f6c707..55080419de5f6 100644
--- a/llvm/test/tools/llvm-dwp/X86/empty_warning.test
+++ b/llvm/test/tools/llvm-dwp/X86/empty_warning.test
@@ -1,9 +1,140 @@
; RUN: rm -rf %t && mkdir -p %t && split-file %s %t && cd %t
-; RUN: clang -g -gdwarf-4 %t/non_split.c -o %t/non_split.o
+; RUN: llvm-mc --triple=x86_64-unknown-linux --filetype=obj -dwarf-version=4 %t/non_split.s -o %t/non_split.o
; RUN: llvm-dwp -e %t/non_split.o -o %t/non_split.dwp 2>&1 | FileCheck %s --check-prefix=CHECK-WARNING
; CHECK-WARNING: warning: executable file does not contain any references to dwo files
-;--- non_split.c
-int main() {
- return 0;
-}
\ No newline at end of file
+;--- non_split.s
+
+ .text
+ .file "main.c"
+ .globl main # -- Begin function main
+ .p2align 4, 0x90
+ .type main, at function
+main: # @main
+.Lfunc_begin0:
+ .file 1 "xxx/xxx/xxx" "main.c"
+ .loc 1 1 0 # main.c:1:0
+ .cfi_startproc
+# %bb.0: # %entry
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+ xorl %eax, %eax
+ movl $0, -4(%rbp)
+.Ltmp0:
+ .loc 1 2 5 prologue_end # main.c:2:5
+ popq %rbp
+ .cfi_def_cfa %rsp, 8
+ retq
+.Ltmp1:
+.Lfunc_end0:
+ .size main, .Lfunc_end0-main
+ .cfi_endproc
+ # -- End function
+ .section .debug_abbrev,"", at progbits
+ .byte 1 # Abbreviation Code
+ .byte 17 # DW_TAG_compile_unit
+ .byte 1 # DW_CHILDREN_yes
+ .byte 37 # DW_AT_producer
+ .byte 14 # DW_FORM_strp
+ .byte 19 # DW_AT_language
+ .byte 5 # DW_FORM_data2
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 16 # DW_AT_stmt_list
+ .byte 23 # DW_FORM_sec_offset
+ .byte 27 # DW_AT_comp_dir
+ .byte 14 # DW_FORM_strp
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 2 # Abbreviation Code
+ .byte 46 # DW_TAG_subprogram
+ .byte 0 # DW_CHILDREN_no
+ .byte 17 # DW_AT_low_pc
+ .byte 1 # DW_FORM_addr
+ .byte 18 # DW_AT_high_pc
+ .byte 6 # DW_FORM_data4
+ .byte 64 # DW_AT_frame_base
+ .byte 24 # DW_FORM_exprloc
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 58 # DW_AT_decl_file
+ .byte 11 # DW_FORM_data1
+ .byte 59 # DW_AT_decl_line
+ .byte 11 # DW_FORM_data1
+ .byte 73 # DW_AT_type
+ .byte 19 # DW_FORM_ref4
+ .byte 63 # DW_AT_external
+ .byte 25 # DW_FORM_flag_present
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 3 # Abbreviation Code
+ .byte 36 # DW_TAG_base_type
+ .byte 0 # DW_CHILDREN_no
+ .byte 3 # DW_AT_name
+ .byte 14 # DW_FORM_strp
+ .byte 62 # DW_AT_encoding
+ .byte 11 # DW_FORM_data1
+ .byte 11 # DW_AT_byte_size
+ .byte 11 # DW_FORM_data1
+ .byte 0 # EOM(1)
+ .byte 0 # EOM(2)
+ .byte 0 # EOM(3)
+ .section .debug_info,"", at progbits
+.Lcu_begin0:
+ .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
+.Ldebug_info_start0:
+ .short 4 # DWARF version number
+ .long .debug_abbrev # Offset Into Abbrev. Section
+ .byte 8 # Address Size (in bytes)
+ .byte 1 # Abbrev [1] 0xb:0x40 DW_TAG_compile_unit
+ .long .Linfo_string0 # DW_AT_producer
+ .short 12 # DW_AT_language
+ .long .Linfo_string1 # DW_AT_name
+ .long .Lline_table_start0 # DW_AT_stmt_list
+ .long .Linfo_string2 # DW_AT_comp_dir
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 2 # Abbrev [2] 0x2a:0x19 DW_TAG_subprogram
+ .quad .Lfunc_begin0 # DW_AT_low_pc
+ .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
+ .byte 1 # DW_AT_frame_base
+ .byte 86
+ .long .Linfo_string3 # DW_AT_name
+ .byte 1 # DW_AT_decl_file
+ .byte 1 # DW_AT_decl_line
+ .long 67 # DW_AT_type
+ # DW_AT_external
+ .byte 3 # Abbrev [3] 0x43:0x7 DW_TAG_base_type
+ .long .Linfo_string4 # DW_AT_name
+ .byte 5 # DW_AT_encoding
+ .byte 4 # DW_AT_byte_size
+ .byte 0 # End Of Children Mark
+.Ldebug_info_end0:
+ .section .debug_str,"MS", at progbits,1
+.Linfo_string0:
+ .asciz "clang version 11.0.1git" # string offset=0
+.Linfo_string1:
+ .asciz "main.c" # string offset=104
+.Linfo_string2:
+ .asciz "/data02/home/huangjinjie/origin-llvm-project/llvm-project/build" # string offset=111
+.Linfo_string3:
+ .asciz "main" # string offset=175
+.Linfo_string4:
+ .asciz "int" # string offset=180
+ .ident "clang version 11.0.1git"
+ .section .GCC.command.line,"MS", at progbits,1
+ .zero 1
+ .ascii "/usr/local/bin/clang-11 -g -S -gdwarf-4 main.c -o main_non_split.s"
+ .zero 1
+ .section .debug_str,"MS", at progbits,1
+ .section ".note.GNU-stack","", at progbits
+ .addrsig
+ .section .debug_line,"", at progbits
+.Lline_table_start0:
More information about the llvm-commits
mailing list