From e711fc37672b3e3c25e5b152456710f04ed360d2 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 7 Mar 2016 17:43:39 +0000 Subject: [PATCH] Adjust the .bss alignment to include common symbols. llvm-svn: 262840 --- lld/ELF/Writer.cpp | 1 + lld/test/ELF/common.s | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index cf22b10f0265..a4f3d8515afe 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -722,6 +722,7 @@ void Writer::addCommonSymbols(std::vector &Syms) { uintX_t Off = getBss()->getSize(); for (DefinedCommon *C : Syms) { Off = alignTo(Off, C->MaxAlignment); + Out::Bss->updateAlign(C->MaxAlignment); C->OffsetInBss = Off; Off += C->Size; } diff --git a/lld/test/ELF/common.s b/lld/test/ELF/common.s index 67cedbccb866..f16f948fe64e 100644 --- a/lld/test/ELF/common.s +++ b/lld/test/ELF/common.s @@ -13,6 +13,9 @@ // CHECK-NEXT: Address: 0x11000 // CHECK-NEXT: Offset: // CHECK-NEXT: Size: 22 +// CHECK-NEXT: Link: 0 +// CHECK-NEXT: Info: 0 +// CHECK-NEXT: AddressAlignment: 16 // CHECK: Name: sym1 // CHECK-NEXT: Value: 0x11004