[lld] r326918 - [ELF] - Adjust rangeToString to report ranges in a different format.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 09:54:26 PST 2018


Author: grimar
Date: Wed Mar  7 09:54:25 2018
New Revision: 326918

URL: http://llvm.org/viewvc/llvm-project?rev=326918&view=rev
Log:
[ELF] - Adjust rangeToString to report ranges in a different format.

It was raised during the review of D43819.

LLD usually use [X, Y] for reporting ranges, like below:
"relocation R_386_16 out of range: 65536 is not in [0, 65535]"

Patch changes rangeToString() to do the same.

Differential revision: https://reviews.llvm.org/D44207

Modified:
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/ELF/linkerscript/overlapping-sections.s

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=326918&r1=326917&r2=326918&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Mar  7 09:54:25 2018
@@ -1937,7 +1937,7 @@ template <class ELFT> void Writer<ELFT>:
 static std::string rangeToString(uint64_t Addr, uint64_t Len) {
   if (Len == 0)
     return "<empty range at 0x" + utohexstr(Addr) + ">";
-  return "[0x" + utohexstr(Addr) + " -> 0x" + utohexstr(Addr + Len - 1) + "]";
+  return "[0x" + utohexstr(Addr) + ", 0x" + utohexstr(Addr + Len - 1) + "]";
 }
 
 // Check whether sections overlap for a specific address range (file offsets,

Modified: lld/trunk/test/ELF/linkerscript/overlapping-sections.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/overlapping-sections.s?rev=326918&r1=326917&r2=326918&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/overlapping-sections.s (original)
+++ lld/trunk/test/ELF/linkerscript/overlapping-sections.s Wed Mar  7 09:54:25 2018
@@ -63,8 +63,8 @@
 # RUN: }" > %t-lma.script
 # RUN: not ld.lld -o %t.so --script %t-lma.script %t.o -shared 2>&1 | FileCheck %s -check-prefix LMA-OVERLAP-ERR
 # LMA-OVERLAP-ERR:      error: section .sec1 load address range overlaps with .sec2
-# LMA-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000 -> 0x80FF]
-# LMA-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8080 -> 0x817F]
+# LMA-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
+# LMA-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8080, 0x817F]
 
 # Check that we create the expected binary with --noinhibit-exec or --no-check-sections:
 # RUN: ld.lld -o %t.so --script %t-lma.script %t.o -shared --noinhibit-exec
@@ -95,8 +95,8 @@
 # RUN: }" > %t-vaddr.script
 # RUN: not ld.lld -o %t.so --script %t-vaddr.script %t.o -shared 2>&1 | FileCheck %s -check-prefix VADDR-OVERLAP-ERR
 # VADDR-OVERLAP-ERR:      error: section .sec1 virtual address range overlaps with .sec2
-# VADDR-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000 -> 0x80FF]
-# VADDR-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8020 -> 0x811F]
+# VADDR-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
+# VADDR-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8020, 0x811F]
 
 # Check that the expected binary was created with --noinhibit-exec:
 # RUN: ld.lld -o %t.so --script %t-vaddr.script %t.o -shared --noinhibit-exec
@@ -123,14 +123,14 @@
 # RUN: not ld.lld -o %t.so --script %t-both-overlap.script %t.o -shared 2>&1 | FileCheck %s -check-prefix BOTH-OVERLAP-ERR
 
 # BOTH-OVERLAP-ERR:      error: section .sec1 file range overlaps with .sec2
-# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x18000 -> 0x180FF]
-# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x18040 -> 0x1813F]
+# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x18000, 0x180FF]
+# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x18040, 0x1813F]
 # BOTH-OVERLAP-ERR:      error: section .sec1 virtual address range overlaps with .sec2
-# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000 -> 0x80FF]
-# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8040 -> 0x813F]
+# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
+# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8040, 0x813F]
 # BOTH-OVERLAP-ERR:      error: section .sec1 load address range overlaps with .sec2
-# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000 -> 0x80FF]
-# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8040 -> 0x813F]
+# BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF]
+# BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8040, 0x813F]
 
 # RUN: ld.lld -o %t.so --script %t-both-overlap.script %t.o -shared --noinhibit-exec
 # Note: I case everything overlaps we create a binary with overlapping file




More information about the llvm-commits mailing list