[lld] r354959 - [LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 27 02:28:23 PST 2019
Author: grimar
Date: Wed Feb 27 02:28:23 2019
New Revision: 354959
URL: http://llvm.org/viewvc/llvm-project?rev=354959&view=rev
Log:
[LLD][ELF] - Improve "sh_addralign is not a power of 2" diagnostics.
This patch removes the precompiled binary from inputs,
replacing it with a YAML. And teaches LLD to report a
section name in case of such error.
Differential revision: https://reviews.llvm.org/D58670
Removed:
lld/trunk/test/ELF/invalid/Inputs/section-alignment-notpow2.elf
Modified:
lld/trunk/ELF/InputSection.cpp
lld/trunk/test/ELF/invalid/section-alignment2.s
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=354959&r1=354958&r2=354959&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Wed Feb 27 02:28:23 2019
@@ -76,7 +76,7 @@ InputSectionBase::InputSectionBase(Input
// no alignment constraits.
uint32_t V = std::max<uint64_t>(Alignment, 1);
if (!isPowerOf2_64(V))
- fatal(toString(File) + ": section sh_addralign is not a power of 2");
+ fatal(toString(this) + ": sh_addralign is not a power of 2");
this->Alignment = V;
// In ELF, each section can be compressed by zlib, and if compressed,
Removed: lld/trunk/test/ELF/invalid/Inputs/section-alignment-notpow2.elf
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/Inputs/section-alignment-notpow2.elf?rev=354958&view=auto
==============================================================================
Binary file - no diff available.
Modified: lld/trunk/test/ELF/invalid/section-alignment2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/section-alignment2.s?rev=354959&r1=354958&r2=354959&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid/section-alignment2.s (original)
+++ lld/trunk/test/ELF/invalid/section-alignment2.s Wed Feb 27 02:28:23 2019
@@ -1,5 +1,16 @@
-## section-alignment-notpow2.elf has section alignment
-## 0xFFFFFFFF which is not a power of 2.
-# RUN: not ld.lld %p/Inputs/section-alignment-notpow2.elf -o /dev/null 2>&1 | \
-# RUN: FileCheck %s
-# CHECK: section sh_addralign is not a power of 2
+# RUN: yaml2obj %s -o %t.o
+# RUN: not ld.lld %t.o -o %tout 2>&1 | FileCheck %s
+
+# CHECK: error: {{.*}}.o:(.text): sh_addralign is not a power of 2
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ AddressAlign: 0x3
More information about the llvm-commits
mailing list