[PATCH] D63177: [lld] Allow unrecognized signatures in debug sections
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 15:19:41 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363212: [lld] Allow unrecognized signatures in debug sections (authored by rnk, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D63177?vs=204194&id=204368#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63177/new/
https://reviews.llvm.org/D63177
Files:
lld/trunk/COFF/Chunks.cpp
lld/trunk/test/COFF/allow-unknown-debug-info.test
Index: lld/trunk/test/COFF/allow-unknown-debug-info.test
===================================================================
--- lld/trunk/test/COFF/allow-unknown-debug-info.test
+++ lld/trunk/test/COFF/allow-unknown-debug-info.test
@@ -0,0 +1,26 @@
+# RUN: yaml2obj %s > %t.obj
+# RUN: lld-link /dll /noentry /debug %t.obj 2>&1 | FileCheck %s
+
+# CHECK: ignoring section .debug$S with unrecognized magic 0x1
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+ Characteristics: []
+sections:
+ - Name: '.debug$S'
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
+ SectionData: 01000000
+symbols:
+ - Name: '.debug$S'
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
+ SectionDefinition:
+ Length: 4
+ NumberOfRelocations: 0
+ NumberOfLinenumbers: 0
+ CheckSum: 0
+ Number: 0
Index: lld/trunk/COFF/Chunks.cpp
===================================================================
--- lld/trunk/COFF/Chunks.cpp
+++ lld/trunk/COFF/Chunks.cpp
@@ -601,12 +601,15 @@
if (!SectionName.startswith(".debug$"))
fatal("invalid section: " + SectionName);
- unsigned Magic = support::endian::read32le(Data.data());
- unsigned ExpectedMagic = SectionName == ".debug$H"
+ uint32_t Magic = support::endian::read32le(Data.data());
+ uint32_t ExpectedMagic = SectionName == ".debug$H"
? DEBUG_HASHES_SECTION_MAGIC
: DEBUG_SECTION_MAGIC;
- if (Magic != ExpectedMagic)
- fatal("section: " + SectionName + " has an invalid magic: " + Twine(Magic));
+ if (Magic != ExpectedMagic) {
+ warn("ignoring section " + SectionName + " with unrecognized magic 0x" +
+ utohexstr(Magic));
+ return {};
+ }
return Data.slice(4);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63177.204368.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190612/2789b412/attachment.bin>
More information about the llvm-commits
mailing list