[lld] r338956 - [LLD][ELF] - Fix bug when reporting memory intersections.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 4 03:34:52 PDT 2018


Author: grimar
Date: Sat Aug  4 03:34:52 2018
New Revision: 338956

URL: http://llvm.org/viewvc/llvm-project?rev=338956&view=rev
Log:
[LLD][ELF] - Fix bug when reporting memory intersections.

rangeToString() takes addres and length,
previously it was called incorrectly.

Modified:
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/ELF/linkerscript/sections-va-overflow.test

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=338956&r1=338955&r2=338956&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sat Aug  4 03:34:52 2018
@@ -2050,7 +2050,7 @@ template <class ELFT> void Writer<ELFT>:
       continue;
     if ((Sec->Offset > FileSize) || (Sec->Offset + Sec->Size > FileSize))
       error("unable to place section " + Sec->Name + " at file offset " +
-            rangeToString(Sec->Offset, Sec->Offset + Sec->Size) +
+            rangeToString(Sec->Offset, Sec->Size) +
             "; check your linker script for overflows");
   }
 }

Modified: lld/trunk/test/ELF/linkerscript/sections-va-overflow.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/sections-va-overflow.test?rev=338956&r1=338955&r2=338956&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/sections-va-overflow.test (original)
+++ lld/trunk/test/ELF/linkerscript/sections-va-overflow.test Sat Aug  4 03:34:52 2018
@@ -7,7 +7,7 @@ PHDRS {
   ph_text PT_LOAD FILEHDR PHDRS FLAGS (0x1 | 0x4);
 }
 
-SECTIONS { 
+SECTIONS {
  . = 0xffffffff20000000;
  .text : { *(.text*) } : ph_text
  .test 0x1000 : { BYTE(0) }
@@ -18,5 +18,5 @@ SECTIONS {
 ## with VA 0xffffffff20000000. That might be technically correct, but most probably
 ## is a result of a broken script file and causes file offset calculation overflow.
 ## It seems we do not have to support it, so we don't and we report an error in this case.
-# ERR: error: unable to place section .text at file offset [0xFFFFFFFF20000000, 0xFFFFFFFE40000000]; check your linker script for overflows
+# ERR: error: unable to place section .text at file offset [0xFFFFFFFF20000000, 0xFFFFFFFF20000000]; check your linker script for overflows
 # ERR-NOT: unable to place section .bss




More information about the llvm-commits mailing list