[llvm] r348248 - Revert r348243 "[llvm-mc] - Do not crash when referencing undefined debug sections."

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 02:55:04 PST 2018


Author: grimar
Date: Tue Dec  4 02:55:03 2018
New Revision: 348248

URL: http://llvm.org/viewvc/llvm-project?rev=348248&view=rev
Log:
Revert r348243 "[llvm-mc] - Do not crash when referencing undefined debug sections."

It broke msan and asan bots it seems:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/26794/steps/check-llvm%20msan/logs/stdio
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/20993/steps/ninja%20check%201/logs/stdio

Removed:
    llvm/trunk/test/MC/ELF/undefined-debug.s
Modified:
    llvm/trunk/lib/MC/ELFObjectWriter.cpp

Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=348248&r1=348247&r2=348248&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Dec  4 02:55:03 2018
@@ -669,20 +669,6 @@ void ELFWriter::computeSymbolTable(
     } else {
       const MCSectionELF &Section =
           static_cast<const MCSectionELF &>(Symbol.getSection());
-
-      // We may end up with a situation when section symbol is technically
-      // defined, but should not be. That happens because we explicitly
-      // pre-create few .debug_* sections to have accessors.
-      // And if these sections were not really defined in the code, but were
-      // referenced, we simply error out.
-      if (!Section.isRegistered()) {
-        assert(static_cast<const MCSymbolELF &>(Symbol).getType() ==
-               ELF::STT_SECTION);
-        Ctx.reportError(SMLoc(),
-                        "Undefined section reference: " + Symbol.getName());
-        continue;
-      }
-
       if (Mode == NonDwoOnly && isDwoSection(Section))
         continue;
       MSD.SectionIndex = SectionIndexMap.lookup(&Section);

Removed: llvm/trunk/test/MC/ELF/undefined-debug.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/undefined-debug.s?rev=348247&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/undefined-debug.s (original)
+++ llvm/trunk/test/MC/ELF/undefined-debug.s (removed)
@@ -1,5 +0,0 @@
-// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o %t 2>&1 | FileCheck %s
-// CHECK: error: Undefined section reference: .debug_pubnames
-
-.section .foo,"", at progbits
-  .long  .debug_pubnames




More information about the llvm-commits mailing list