From: George Rimar Date: Tue, 4 Dec 2018 10:55:03 +0000 (+0000) Subject: Revert r348243 "[llvm-mc] - Do not crash when referencing undefined debug sections." X-Git-Tag: llvmorg-8.0.0-rc1~2952 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c968d83399869dd2a769fc559b8ee0c0a72b63aa;p=platform%2Fupstream%2Fllvm.git 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 llvm-svn: 348248 --- diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 89f3b30..5b8b013 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -669,20 +669,6 @@ void ELFWriter::computeSymbolTable( } else { const MCSectionELF &Section = static_cast(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(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); diff --git a/llvm/test/MC/ELF/undefined-debug.s b/llvm/test/MC/ELF/undefined-debug.s deleted file mode 100644 index 95ead70..0000000 --- a/llvm/test/MC/ELF/undefined-debug.s +++ /dev/null @@ -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,"",@progbits - .long .debug_pubnames