[PATCH] D33175: ELF: --gdb-index: Do not add dead sections to the address area.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 14 16:37:00 PDT 2017
pcc created this revision.
Fixes PR33032.
https://reviews.llvm.org/D33175
Files:
lld/ELF/SyntheticSections.cpp
lld/test/ELF/Inputs/gdb-index-gc-sections.o
lld/test/ELF/Inputs/gdb-index-gc-sections.o.sh
lld/test/ELF/gdb-index-gc-sections.test
Index: lld/test/ELF/gdb-index-gc-sections.test
===================================================================
--- /dev/null
+++ lld/test/ELF/gdb-index-gc-sections.test
@@ -0,0 +1,5 @@
+RUN: ld.lld --gdb-index --gc-sections -o %t %S/Inputs/gdb-index-gc-sections.o
+RUN: llvm-dwarfdump -debug-dump=gdb_index %t | FileCheck %s
+
+CHECK: Address area offset = 0x28, has 1 entries:
+CHECK-NEXT: Low/High address = [0x201000, 0x201001) (Size: 0x1), CU id = 0
Index: lld/test/ELF/Inputs/gdb-index-gc-sections.o.sh
===================================================================
--- /dev/null
+++ lld/test/ELF/Inputs/gdb-index-gc-sections.o.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo "void _start() {} void dead() {}" | \
+clang -Os -g -c -ffunction-sections -o gdb-index-gc-sections.o -x c - -Xclang -fdebug-compilation-dir -Xclang .
Index: lld/ELF/SyntheticSections.cpp
===================================================================
--- lld/ELF/SyntheticSections.cpp
+++ lld/ELF/SyntheticSections.cpp
@@ -1704,7 +1704,7 @@
static InputSectionBase *findSection(ArrayRef<InputSectionBase *> Arr,
uint64_t Offset) {
for (InputSectionBase *S : Arr)
- if (S && S != &InputSection::Discarded)
+ if (S && S != &InputSection::Discarded && S->Live)
if (Offset >= S->getOffsetInFile() &&
Offset < S->getOffsetInFile() + S->getSize())
return S;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33175.98936.patch
Type: text/x-patch
Size: 1415 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170514/8c6e6b91/attachment.bin>
More information about the llvm-commits
mailing list