[PATCH] D153602: [DWARF] Adjust warning condition for .dwo sections with relocations
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 24 10:06:32 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe28b3ea52aa6: [DWARF] Adjust warning condition for .dwo sections with relocations (authored by MaskRay).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153602/new/
https://reviews.llvm.org/D153602
Files:
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/test/DebugInfo/X86/dwarfdump-rela-dwo.s
Index: llvm/test/DebugInfo/X86/dwarfdump-rela-dwo.s
===================================================================
--- llvm/test/DebugInfo/X86/dwarfdump-rela-dwo.s
+++ llvm/test/DebugInfo/X86/dwarfdump-rela-dwo.s
@@ -3,7 +3,7 @@
# 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
+# RUN: FileCheck --input-file=%t.txt %s --check-prefix=PART2 --implicit-check-not=warning:
.section .debug_str.dwo,"MSe", at progbits,1
.dwo_producer:
@@ -33,6 +33,9 @@
.byte 0x00 # EOM(2)
.byte 0x00 # EOM(3)
+# PART2: warning: unexpected relocations for dwo section '.debug_abbrev.dwo'
+ .reloc ., R_X86_64_NONE, 0
+
.section .debug_info.dwo,"e", at progbits
# CHECK-LABEL: .debug_info.dwo
@@ -55,4 +58,10 @@
# 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
+# PART2: warning: unexpected relocations for dwo section '.debug_info.dwo'
+
+## No warning, even if their names end with ".dwo".
+ .section .rodata.dwo,"a"
+ .long ext
+ .section .foo.dwo,""
+ .long .dwo_producer
Index: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -1887,10 +1887,6 @@
S.Data = Data;
}
- if (RelocatedSection != Obj.section_end() && Name.contains(".dwo"))
- HandleWarning(
- createError("Unexpected relocations for dwo section " + Name));
-
if (RelocatedSection == Obj.section_end() ||
(RelocAction == DWARFContext::ProcessDebugRelocations::Ignore))
continue;
@@ -1916,6 +1912,12 @@
if (!L && isa<MachOObjectFile>(&Obj))
continue;
+ if (!Section.relocations().empty() && Name.ends_with(".dwo") &&
+ RelSecName.startswith(".debug")) {
+ HandleWarning(createError("unexpected relocations for dwo section '" +
+ RelSecName + "'"));
+ }
+
RelSecName = RelSecName.substr(
RelSecName.find_first_not_of("._z")); // Skip . and _ prefixes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153602.534234.patch
Type: text/x-patch
Size: 2452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230624/845a8c9a/attachment.bin>
More information about the llvm-commits
mailing list