]> granicus.if.org Git - llvm/commitdiff
[llvm-objcopy] [COFF] Clear the unwritten tail of coff_section::Header::Name
authorMartin Storsjo <martin@martin.st>
Wed, 23 Jan 2019 09:12:53 +0000 (09:12 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 23 Jan 2019 09:12:53 +0000 (09:12 +0000)
This should fix the add-gnu-debuglink test on all buildbots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351934 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objcopy/COFF/Writer.cpp

index 05e46291c39f871b53d4361ebd2f0f0759ce9874..db897e2ff334ccbc19b3102c6953f8ea939d5344 100644 (file)
@@ -121,6 +121,7 @@ size_t COFFWriter::finalizeStringTable() {
 
   for (auto &S : Obj.getMutableSections()) {
     if (S.Name.size() > COFF::NameSize) {
+      memset(S.Header.Name, 0, sizeof(S.Header.Name));
       snprintf(S.Header.Name, sizeof(S.Header.Name), "/%d",
                (int)StrTabBuilder.getOffset(S.Name));
     } else {