[lld] r283585 - Improve comments.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 7 12:54:57 PDT 2016
Author: ruiu
Date: Fri Oct 7 14:54:57 2016
New Revision: 283585
URL: http://llvm.org/viewvc/llvm-project?rev=283585&view=rev
Log:
Improve comments.
Also use uint64_t instead of uintX_t so that you don't have to
think about two different cases to verify that the code is correct.
Modified:
lld/trunk/ELF/InputSection.cpp
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=283585&r1=283584&r2=283585&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Oct 7 14:54:57 2016
@@ -48,11 +48,14 @@ InputSectionBase<ELFT>::InputSectionBase
Hdr->sh_flags & SHF_COMPRESSED, !Config->GcSections),
Header(Hdr), File(File), Repl(this) {
// The ELF spec states that a value of 0 means the section has
- // no alignment constraits. Also we reject object files having insanely large
- // alignment requirements and may want to relax this limitation in the future.
- uintX_t V = std::max<uintX_t>(Header->sh_addralign, 1);
+ // no alignment constraits.
+ uint64_t V = std::max<uint64_t>(Header->sh_addralign, 1);
if (!isPowerOf2_64(V))
fatal(getFilename(File) + ": section sh_addralign is not a power of 2");
+
+ // We reject object files having insanely large alignments even though
+ // they are allowed by the spec. I think 4GB is a reasonable limitation.
+ // We might want to relax this in the future.
if (V > UINT32_MAX)
fatal(getFilename(File) + ": section sh_addralign is too large");
Alignment = V;
More information about the llvm-commits
mailing list