Initialize OutputOff to zero.

We have a dedicated Live bit, so we don't need a special value and we
were not accounting for in at least one place.

llvm-svn: 329307
This commit is contained in:
Rafael Espindola 2018-04-05 15:56:04 +00:00
parent 9730bb8dd8
commit 5f8e77afb5
2 changed files with 11 additions and 2 deletions

View File

@ -200,7 +200,7 @@ private:
// be found by looking at the next one).
struct SectionPiece {
SectionPiece(size_t Off, uint32_t Hash, bool Live)
: InputOff(Off), Hash(Hash), OutputOff(-1),
: InputOff(Off), Hash(Hash), OutputOff(0),
Live(Live || !Config->GcSections) {}
uint32_t InputOff;

View File

@ -3,6 +3,15 @@
# RUN: ld.lld %t.o -o %t.so -shared --gc-sections
# RUN: llvm-readobj -s -section-data %t.so | FileCheck %s
# CHECK: Name: .foo
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
# CHECK-NEXT: SHF_ALLOC
# CHECK-NEXT: SHF_MERGE
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x190
# CHECK: Name: .bar
# CHECK-NEXT: Type: SHT_PROGBITS
# CHECK-NEXT: Flags [
@ -15,7 +24,7 @@
# CHECK-NEXT: AddressAlignment:
# CHECK-NEXT: EntrySize:
# CHECK-NEXT: SectionData (
# CHECK-NEXT: 0000: 90010000 00000000 91010000 00000000
# CHECK-NEXT: 0000: 91010000 00000000 92010000 00000000
# CHECK-NEXT: )
.section .foo,"aM",@progbits,8