[lld] r345058 - Remove a global variable that we can live without.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 10:39:43 PDT 2018
Author: ruiu
Date: Tue Oct 23 10:39:43 2018
New Revision: 345058
URL: http://llvm.org/viewvc/llvm-project?rev=345058&view=rev
Log:
Remove a global variable that we can live without.
Out::DebugInfo was used only by GdbIndex class to determine if
we need to create a .gdb_index section, but we can do the same
check without it.
Added a test that this patch doesn't change the existing behavior.
Added:
lld/trunk/test/ELF/gdb-index-no-debug.s
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=345058&r1=345057&r2=345058&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Oct 23 10:39:43 2018
@@ -32,7 +32,6 @@ using namespace lld::elf;
uint8_t Out::First;
PhdrEntry *Out::TlsPhdr;
-OutputSection *Out::DebugInfo;
OutputSection *Out::ElfHeader;
OutputSection *Out::ProgramHeaders;
OutputSection *Out::PreinitArray;
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=345058&r1=345057&r2=345058&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Tue Oct 23 10:39:43 2018
@@ -130,7 +130,6 @@ std::vector<InputSection *> getInputSect
struct Out {
static uint8_t First;
static PhdrEntry *TlsPhdr;
- static OutputSection *DebugInfo;
static OutputSection *ElfHeader;
static OutputSection *ProgramHeaders;
static OutputSection *PreinitArray;
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=345058&r1=345057&r2=345058&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Oct 23 10:39:43 2018
@@ -2595,7 +2595,7 @@ void GdbIndexSection::writeTo(uint8_t *B
}
}
-bool GdbIndexSection::empty() const { return !Out::DebugInfo; }
+bool GdbIndexSection::empty() const { return Chunks.empty(); }
EhFrameHeader::EhFrameHeader()
: SyntheticSection(SHF_ALLOC, SHT_PROGBITS, 4, ".eh_frame_hdr") {}
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=345058&r1=345057&r2=345058&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Oct 23 10:39:43 2018
@@ -1533,7 +1533,6 @@ static bool computeIsPreemptible(const S
// Create output section objects and add them to OutputSections.
template <class ELFT> void Writer<ELFT>::finalizeSections() {
- Out::DebugInfo = findSection(".debug_info");
Out::PreinitArray = findSection(".preinit_array");
Out::InitArray = findSection(".init_array");
Out::FiniArray = findSection(".fini_array");
Added: lld/trunk/test/ELF/gdb-index-no-debug.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gdb-index-no-debug.s?rev=345058&view=auto
==============================================================================
--- lld/trunk/test/ELF/gdb-index-no-debug.s (added)
+++ lld/trunk/test/ELF/gdb-index-no-debug.s Tue Oct 23 10:39:43 2018
@@ -0,0 +1,8 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld -o %t.exe -gdb-index %t.o
+# RUN: llvm-objdump --section-headers %t.exe | FileCheck %s
+# CHECK-NOT: .gdb_index
+
+.global _start
+_start:
More information about the llvm-commits
mailing list