<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Regression: "fatal error: error in backend: invalid llvm.linker.options" when using clang-cl PCH flags with --target flag"
href="https://bugs.llvm.org/show_bug.cgi?id=36552">36552</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Regression: "fatal error: error in backend: invalid llvm.linker.options" when using clang-cl PCH flags with --target flag
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I have this test locally at tools/clang/test/Driver/cl-pch-build.c:
$ cat ../llvm-rw/tools/clang/test/Driver/cl-pch-build.c
// Note: %s and %S must be preceded by --, otherwise it may be interpreted as a
// command-line option, e.g. on Mac where %s is commonly under /Users.
// REQUIRES: x86-registered-target
// Regression test for PR30195.
// RUN: %clang_cl -Werror --target=x86_64 /Yc%S/Inputs/pchfile.h
/FI%S/Inputs/pchfile.h /c /Fo%t.obj /Fp%t.pch -- %s
It used to pass, but today it fails:
$ bin/llvm-lit ../llvm-rw/tools/clang/test/Driver/cl-pch-build.c -v -v
llvm-lit:
/usr/local/google/home/thakis/src/llvm-rw/utils/lit/lit/llvm/config.py:334:
note: using clang: /usr/local/google/home/thakis/src/llvm-build-goma/bin/clang
-- Testing: 1 tests, 1 threads --
FAIL: Clang :: Driver/cl-pch-build.c (1 of 1)
******************** TEST 'Clang :: Driver/cl-pch-build.c' FAILED
********************
Script:
--
/usr/local/google/home/thakis/src/llvm-build-goma/bin/clang --driver-mode=cl
-Werror --target=x86_64
/Yc/usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/Inputs/pchfile.h
/FI/usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/Inputs/pchfile.h
/c
/Fo/usr/local/google/home/thakis/src/llvm-build-goma/tools/clang/test/Driver/Output/cl-pch-build.c.tmp.obj
/Fp/usr/local/google/home/thakis/src/llvm-build-goma/tools/clang/test/Driver/Output/cl-pch-build.c.tmp.pch
--
/usr/local/google/home/thakis/src/llvm-rw/tools/clang/test/Driver/cl-pch-build.c
--
Exit Code: 70
Command Output (stderr):
--
fatal error: error in backend: invalid llvm.linker.options
I added a debug printf:
$ svn diff
Index: lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- lib/CodeGen/TargetLoweringObjectFileImpl.cpp (revision 326353)
+++ lib/CodeGen/TargetLoweringObjectFileImpl.cpp (working copy)
@@ -102,6 +102,9 @@
Streamer.SwitchSection(S);
for (const auto &Operand : LinkerOptions->operands()) {
+ for (const auto &Option : cast<MDNode>(Operand)->operands()) {
+ fprintf(stderr, "foo %s\n",
cast<MDString>(Option)->getString().str().c_str());
+ }
if (cast<MDNode>(Operand)->getNumOperands() != 2)
report_fatal_error("invalid llvm.linker.options");
for (const auto &Option : cast<MDNode>(Operand)->operands()) {
It prints:
foo -llibcmt
I don't know if this has been broken since the assert was added in
<a href="https://reviews.llvm.org/D40849">https://reviews.llvm.org/D40849</a>. Without the --target= flag, the test passes
(which is the form used in test/Driver/cl-pch.c).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>