[PATCH 1/2] gdb/testsuite: Force lld-link linker on windows-msvc

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
clang windows-msvc defaults to using the Microsoft link.exe linker.
That does not work with DWARF though, we have to use lld-link instead.
That is why the whole windows-msvc support in the testsuite assumes
the linker in use is lld-link.

So far, I've been running the testsuite with
CC_FOR_TARGET/CXX_FOR_TARGET pointing at a clang wrapper script that
adds "-fuse-ld=lld-link", but I think this belongs in the testsuite
directly, since it's not really optional.

Change-Id: I5bcafa408696b349b829b4ffbd75037be25b3f3b
---
 gdb/testsuite/lib/gdb.exp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6fb04869605..912ddf1cd54 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -6660,6 +6660,15 @@ proc gdb_compile {source dest type options} {
 	}
     }
 
+    if {[istarget "*-*-windows-msvc*"]} {
+	# Clang wants to use the Microsoft linker by default.  That
+	# doesn't support DWARF, so link with lld-link instead, which
+	# does support DWARF (and PDB/CodeView).  Pass -Xarch_host so
+	# that when we're compiling HIP code, we only affect the host
+	# linker.
+	lappend new_options "early_flags=-Xarch_host -fuse-ld=lld-link"
+    }
+
     # If the 'build-id' option is used, then ensure that we generate a
     # build-id.  It is possible that the compiler is configured to do
     # so automatically, but at least for GCC the configure option
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.