diff --git a/src/plugins/projectexplorer/gccparser.cpp b/src/plugins/projectexplorer/gccparser.cpp index e0f051c6b38..1753e122586 100644 --- a/src/plugins/projectexplorer/gccparser.cpp +++ b/src/plugins/projectexplorer/gccparser.cpp @@ -839,6 +839,27 @@ void ProjectExplorerPlugin::testGccOutputParsers_data() ) << QString(); + QTest::newRow("ld: .data section") + << QString::fromLatin1("foo.o:(.data+0x0): multiple definition of `foo'\n" + "bar.o:(.data+0x0): first defined here\n" + "collect2: error: ld returned 1 exit status") + << OutputParserTester::STDERR + << QString() << QString() + << (QList() + << Task(Task::Error, + QLatin1String("multiple definition of `foo'"), + Utils::FileName::fromUserInput(QLatin1String("foo.o")), -1, + categoryCompile) + << Task(Task::Unknown, + QLatin1String("first defined here"), + Utils::FileName::fromUserInput(QLatin1String("bar.o")), -1, + categoryCompile) + << Task(Task::Error, + QLatin1String("collect2: error: ld returned 1 exit status"), + Utils::FileName(), -1, + categoryCompile) + ) + << QString(); } void ProjectExplorerPlugin::testGccOutputParsers() diff --git a/src/plugins/projectexplorer/ldparser.cpp b/src/plugins/projectexplorer/ldparser.cpp index 839b2d75973..47ff09bc4c0 100644 --- a/src/plugins/projectexplorer/ldparser.cpp +++ b/src/plugins/projectexplorer/ldparser.cpp @@ -97,9 +97,12 @@ void LdParser::stdError(const QString &line) if (!ok) lineno = -1; Utils::FileName filename = Utils::FileName::fromUserInput(m_regExpLinker.cap(1)); - if (!m_regExpLinker.cap(4).isEmpty() - && !m_regExpLinker.cap(4).startsWith(QLatin1String("(.text"))) - filename = Utils::FileName::fromUserInput(m_regExpLinker.cap(4)); + const QString sourceFileName = m_regExpLinker.cap(4); + if (!sourceFileName.isEmpty() + && !sourceFileName.startsWith(QLatin1String("(.text")) + && !sourceFileName.startsWith(QLatin1String("(.data"))) { + filename = Utils::FileName::fromUserInput(sourceFileName); + } QString description = m_regExpLinker.cap(8).trimmed(); Task task(Task::Error, description, filename, lineno, Core::Id(Constants::TASK_CATEGORY_COMPILE));