Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DWARF] Don't process .debug_info relocations for DWO Context
When we build with split dwarf in single mode the .o files that contain both "normal" debug sections and dwo sections, along with relocaiton sections for "normal" debug sections. When we create DWARF context in DWARFObjInMemory we process relocations and store them in the map for .debug_info, etc section. For DWO Context we also do it for non dwo dwarf sections. Which I believe is not necessary. This leads to a lot of memory being wasted. We observed 70GB extra memory being used. I went with context sensitive approach, flag is passed in. I am not sure if it's always safe not to process relocations for regular debug sections if Obj contains .dwo sections. If it is alternatvie might be just to scan, in constructor, sections and if there are .dwo sections not to process regular debug ones. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D106624
- Loading branch information
Showing
8 changed files
with
95 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Test objective to verify warning is printed if DWO secton has relocations. | ||
# | ||
# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t.o | ||
# RUN: llvm-dwarfdump --debug-info %t.o | FileCheck %s | ||
# RUN: llvm-dwarfdump --debug-info %t.o 2> %t.txt | ||
# RUN: cat %t.txt | FileCheck %s --check-prefix=PART2 | ||
|
||
.section .debug_str.dwo,"MSe",@progbits,1 | ||
.dwo_producer: | ||
.asciz "Handmade DWO producer" | ||
.dwo_CU_5: | ||
.asciz "V5_dwo_compile_unit" | ||
|
||
.section .debug_str_offsets.dwo,"e",@progbits | ||
.long Lstr_offsets_end-Lstr_offsets_start # Length of String Offsets Set | ||
Lstr_offsets_start: | ||
.short 5 | ||
.short 0 | ||
.long .dwo_producer-.debug_str.dwo | ||
.long .dwo_CU_5-.debug_str.dwo | ||
Lstr_offsets_end: | ||
|
||
# And a .dwo copy for the .dwo sections. | ||
.section .debug_abbrev.dwo,"e",@progbits | ||
.byte 0x01 # Abbrev code | ||
.byte 0x11 # DW_TAG_compile_unit | ||
.byte 0x00 # DW_CHILDREN_no | ||
.byte 0x25 # DW_AT_producer | ||
.byte 0x0e # DW_FORM_strp | ||
.byte 0x03 # DW_AT_name | ||
.byte 0x25 # DW_FORM_strx1 | ||
.byte 0x00 # EOM(1) | ||
.byte 0x00 # EOM(2) | ||
|
||
.section .debug_info.dwo,"e",@progbits | ||
# CHECK-LABEL: .debug_info.dwo | ||
|
||
# DWARF v5 split CU header. | ||
.long CU_split_5_end-CU_split_5_version # Length of Unit | ||
CU_split_5_version: | ||
.short 5 # DWARF version number | ||
.byte 5 # DWARF Unit Type | ||
.byte 8 # Address Size (in bytes) | ||
.long 0 # Offset Into Abbrev. Section | ||
.quad 0x5a # DWO ID | ||
# The split compile-unit DIE, with DW_AT_producer, DW_AT_name, DW_AT_stmt_list. | ||
.byte 1 | ||
.long .dwo_producer | ||
.byte 1 | ||
.byte 0 # NULL | ||
CU_split_5_end: | ||
|
||
# CHECK: 0x00000000: Compile Unit: length = 0x00000017, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset = 0x0000, addr_size = 0x08, DWO_id = 0x000000000000005a (next unit at 0x0000001b) | ||
# CHECK: 0x00000014: DW_TAG_compile_unit | ||
# CHECK-NEXT: DW_AT_producer ("Handmade DWO producer") | ||
# CHECK-NEXT: DW_AT_name ("V5_dwo_compile_unit") | ||
# PART2: warning: Unexpected relocations for dwo section rela.debug_info.dwo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters