diff options
-rw-r--r-- | lld/ELF/OutputSections.cpp | 6 | ||||
-rw-r--r-- | lld/test/ELF/incompatible-section-flags.s | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index a40818d2d30..71fc00ac35e 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -405,8 +405,10 @@ void OutputSectionFactory::addInputSec(InputSectionBase *IS, OutputSection *&Sec = Map[Key]; if (Sec) { if (getIncompatibleFlags(Sec->Flags) != getIncompatibleFlags(IS->Flags)) - error("Section has flags incompatible with others with the same name " + - toString(IS)); + error("incompatible section flags for " + Sec->Name + + "\n>>> " + toString(IS) + ": 0x" + utohexstr(IS->Flags) + + "\n>>> output section " + Sec->Name + ": 0x" + + utohexstr(Sec->Flags)); if (Sec->Type != IS->Type) { if (canMergeToProgbits(Sec->Type) && canMergeToProgbits(IS->Type)) Sec->Type = SHT_PROGBITS; diff --git a/lld/test/ELF/incompatible-section-flags.s b/lld/test/ELF/incompatible-section-flags.s index efca31bb9a8..25d99945e00 100644 --- a/lld/test/ELF/incompatible-section-flags.s +++ b/lld/test/ELF/incompatible-section-flags.s @@ -1,8 +1,13 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o // RUN: not ld.lld -shared %t.o -o %t 2>&1 | FileCheck %s -// CHECK: error: Section has flags incompatible with others with the same name {{.*}}incompatible-section-flags.s.tmp.o:(.foo) -// CHECK: error: Section has flags incompatible with others with the same name {{.*}}incompatible-section-flags.s.tmp.o:(.bar) +// CHECK: error: incompatible section flags for .foo +// CHECK-NEXT: >>> {{.*}}incompatible-section-flags.s.tmp.o:(.foo): 0x3 +// CHECK-NEXT: >>> output section .foo: 0x403 + +// CHECK: error: incompatible section flags for .bar +// CHECK-NEXT: >>> {{.*}}incompatible-section-flags.s.tmp.o:(.bar): 0x403 +// CHECK-NEXT: >>> output section .bar: 0x3 .section .foo, "awT", @progbits, unique, 1 .quad 0 |