From 752a8c3e5574b39c4f5f943c1ca7e5cbaf8f67bb Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 7 Apr 2015 03:44:26 +0000 Subject: [PATCH] ELF: Minimum alignment value is 1, not 0. NFC. Maybe we can interpret alignment 0 as "don't care", but for consistency, it's good to set 1 instead of 0 where we allow any alignments. llvm-svn: 234284 --- lld/lib/ReaderWriter/ELF/Chunk.h | 2 +- lld/lib/ReaderWriter/ELF/SectionChunks.h | 2 +- lld/lib/ReaderWriter/ELF/SegmentChunks.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/Chunk.h b/lld/lib/ReaderWriter/ELF/Chunk.h index 2e03ca8..f223b6c 100644 --- a/lld/lib/ReaderWriter/ELF/Chunk.h +++ b/lld/lib/ReaderWriter/ELF/Chunk.h @@ -98,7 +98,7 @@ protected: const ELFLinkingContext &_ctx; uint64_t _fsize = 0; uint64_t _msize = 0; - uint64_t _alignment = 0; + uint64_t _alignment = 1; uint32_t _order = 0; uint64_t _ordinal = 1; uint64_t _start = 0; diff --git a/lld/lib/ReaderWriter/ELF/SectionChunks.h b/lld/lib/ReaderWriter/ELF/SectionChunks.h index e716faf..613858a 100644 --- a/lld/lib/ReaderWriter/ELF/SectionChunks.h +++ b/lld/lib/ReaderWriter/ELF/SectionChunks.h @@ -530,7 +530,7 @@ private: int64_t _shInfo = 0; int64_t _entSize = 0; int64_t _link = 0; - uint64_t _alignment = 0; + uint64_t _alignment = 1; int64_t _kind = 0; int64_t _type = 0; bool _isLoadableSection = false; diff --git a/lld/lib/ReaderWriter/ELF/SegmentChunks.h b/lld/lib/ReaderWriter/ELF/SegmentChunks.h index b0b071e..cff9530 100644 --- a/lld/lib/ReaderWriter/ELF/SegmentChunks.h +++ b/lld/lib/ReaderWriter/ELF/SegmentChunks.h @@ -317,7 +317,7 @@ Segment::Segment(const ELFLinkingContext &ctx, StringRef name, const typename TargetLayout::SegmentType type) : Chunk(name, Chunk::Kind::ELFSegment, ctx), _segmentType(type), _flags(0), _atomflags(0) { - this->_alignment = 0; + this->_alignment = 1; this->_fsize = 0; _outputMagic = ctx.getOutputMagic(); } -- 2.7.4