Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -2056,11 +2056,14 @@ SectionOffset A = Sections[I - 1]; SectionOffset B = Sections[I]; if (B.Offset < A.Offset + A.Sec->Size) - errorOrWarn( - "section " + A.Sec->Name + " " + Name + " range overlaps with " + - B.Sec->Name + "\n>>> " + A.Sec->Name + " range is " + - rangeToString(A.Offset, A.Sec->Size) + "\n>>> " + B.Sec->Name + - " range is " + rangeToString(B.Offset, B.Sec->Size)); + errorOrWarn("section " + A.Sec->Name + " " + Name + + " range overlaps with " + B.Sec->Name + + "; use --no-check-sections to disable this check if you need " + "overlays\n>>> " + + A.Sec->Name + " range is " + + rangeToString(A.Offset, A.Sec->Size) + "\n>>> " + + B.Sec->Name + " range is " + + rangeToString(B.Offset, B.Sec->Size)); } } Index: test/ELF/linkerscript/overlapping-sections.s =================================================================== --- test/ELF/linkerscript/overlapping-sections.s +++ test/ELF/linkerscript/overlapping-sections.s @@ -6,7 +6,7 @@ # RUN: .sec2 0x8800 : AT(0x8080) { sec2_start = .; *(.second_sec) sec2_end = .;} \ # 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: error: section .sec1 load address range overlaps with .sec2; use --no-check-sections to disable this check if you need overlays # LMA-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF] # LMA-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8080, 0x817F] @@ -37,7 +37,7 @@ # RUN: .sec2 0x8020 : AT(0x8800) { sec2_start = .; *(.second_sec) sec2_end = .;} \ # 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: error: section .sec1 virtual address range overlaps with .sec2; use --no-check-sections to disable this check if you need overlays # VADDR-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF] # VADDR-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8020, 0x811F] @@ -65,13 +65,13 @@ # 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: error: section .sec1 file range overlaps with .sec2; use --no-check-sections to disable this check if you need overlays # BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x2000, 0x20FF] # BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x2040, 0x213F] -# BOTH-OVERLAP-ERR: error: section .sec1 virtual address range overlaps with .sec2 +# BOTH-OVERLAP-ERR: error: section .sec1 virtual address range overlaps with .sec2; use --no-check-sections to disable this check if you need overlays # 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: error: section .sec1 load address range overlaps with .sec2; use --no-check-sections to disable this check if you need overlays # BOTH-OVERLAP-ERR-NEXT: >>> .sec1 range is [0x8000, 0x80FF] # BOTH-OVERLAP-ERR-NEXT: >>> .sec2 range is [0x8040, 0x813F]