Index: lld/trunk/ELF/OutputSections.cpp =================================================================== --- lld/trunk/ELF/OutputSections.cpp +++ lld/trunk/ELF/OutputSections.cpp @@ -429,8 +429,11 @@ if (canMergeToProgbits(Sec->Type) && canMergeToProgbits(IS->Type)) Sec->Type = SHT_PROGBITS; else - error("Section has different type from others with the same name " + - toString(IS)); + error("section type mismatch for " + IS->Name + + "\n>>> " + toString(IS) + ": " + + getELFSectionTypeName(Config->EMachine, IS->Type) + + "\n>>> output section " + Sec->Name + ": " + + getELFSectionTypeName(Config->EMachine, Sec->Type)); } Sec->Flags |= Flags; } else { Index: lld/trunk/test/ELF/incompatible-section-types2.s =================================================================== --- lld/trunk/test/ELF/incompatible-section-types2.s +++ lld/trunk/test/ELF/incompatible-section-types2.s @@ -1,7 +1,9 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s -// CHECK: error: Section has different type from others with the same name :(.shstrtab) +// CHECK: error: section type mismatch for .shstrtab +// CHECK-NEXT: >>> :(.shstrtab): SHT_STRTAB +// CHECK-NEXT: >>> output section .shstrtab: Unknown -.section .shstrtab,"" +.section .shstrtab,"",@12345 .short 20