[lld] r301319 - [ELF] Improve error message for incompatible section flags
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 09:00:44 PDT 2017
Author: ruiu
Date: Tue Apr 25 11:00:44 2017
New Revision: 301319
URL: http://llvm.org/viewvc/llvm-project?rev=301319&view=rev
Log:
[ELF] Improve error message for incompatible section flags
Previously we were not printing out the flags of the incompatible
section which made it difficult to determine what the problem was.
The error message format has been change to the following:
error: incompatible section flags for .bar
>>> /foo/bar/incompatible-section-flags.s.tmp.o:(.bar): 0x403
>>> output section .bar: 0x3
Patch by Alexander Richardson.
Differential Revision: https://reviews.llvm.org/D32484
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/test/ELF/incompatible-section-flags.s
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=301319&r1=301318&r2=301319&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Apr 25 11:00:44 2017
@@ -405,8 +405,10 @@ void OutputSectionFactory::addInputSec(I
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;
Modified: lld/trunk/test/ELF/incompatible-section-flags.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/incompatible-section-flags.s?rev=301319&r1=301318&r2=301319&view=diff
==============================================================================
--- lld/trunk/test/ELF/incompatible-section-flags.s (original)
+++ lld/trunk/test/ELF/incompatible-section-flags.s Tue Apr 25 11:00:44 2017
@@ -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
More information about the llvm-commits
mailing list