From 434341be5be6b3de96b608747176c60b3b561f2c Mon Sep 17 00:00:00 2001 From: George Rimar Date: Sat, 4 Aug 2018 10:34:52 +0000 Subject: [PATCH] [LLD][ELF] - Fix bug when reporting memory intersections. rangeToString() takes addres and length, previously it was called incorrectly. llvm-svn: 338956 --- lld/ELF/Writer.cpp | 2 +- lld/test/ELF/linkerscript/sections-va-overflow.test | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 88a2d5c71266..5333ad827e16 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -2050,7 +2050,7 @@ template void Writer::assignFileOffsets() { 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"); } } diff --git a/lld/test/ELF/linkerscript/sections-va-overflow.test b/lld/test/ELF/linkerscript/sections-va-overflow.test index 7ede6ecc3de8..142d2e5ef2d7 100644 --- a/lld/test/ELF/linkerscript/sections-va-overflow.test +++ b/lld/test/ELF/linkerscript/sections-va-overflow.test @@ -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