<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 - Support linker script as input file on MinGW"
href="https://bugs.llvm.org/show_bug.cgi?id=42135">42135</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Support linker script as input file on MinGW
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows XP
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>orgads@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org
</td>
</tr></table>
<p>
<div>
<pre>Hi,
with ld it's possible to provide a linker script as an input, just like an
object file.
This doesn't seem to work with lld on MinGW. It works as expected on linux.
$ cat test.cpp
#include <iostream>
int main(int argc, char **argv)
{
std::cout << "Hello world!" << std::endl;
return 0;
}
$ g++ -c test.cpp
$ cat link_script
INPUT(
./test.o
);
$ g++ -o test.exe link_script
$ g++ -fuse-ld=lld -o test.exe link_script
lld-link: error: link_script: unknown file type
collect2.exe: error: ld returned 1 exit status
$ g++ -v -fuse-ld=lld -o test.exe link_script
Using built-in specs.
COLLECT_GCC=F:\git-sdk-64\mingw32\bin\g++.exe
COLLECT_LTO_WRAPPER=F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-9.1.0/configure --prefix=/mingw32
--with-local-prefix=/mingw32/local --build=i686-w64-mingw32
--host=i686-w64-mingw32 --target=i686-w64-mingw32
--with-native-system-header-dir=/mingw32/i686-w64-mingw32/include
--libexecdir=/mingw32/lib --enable-bootstrap --with-arch=i686
--with-tune=generic --enable-languages=c,lto,c++,fortran --enable-shared
--enable-static --enable-libatomic --enable-threads=posix --enable-graphite
--enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes
--enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug
--disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib
--enable-checking=release --disable-rpath --disable-win32-registry
--disable-nls --disable-werror --disable-symvers --enable-plugin
--with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32
--with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev2, Built by MSYS2
project' --with-bugurl=<a href="https://sourceforge.net/projects/msys2">https://sourceforge.net/projects/msys2</a> --with-gnu-as
--with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
gcc version 9.1.0 (Rev2, Built by MSYS2 project)
COMPILER_PATH=F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/;F:/git-sdk-64/mingw32/bin/../lib/gcc/;F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/bin/
LIBRARY_PATH=F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/;F:/git-sdk-64/mingw32/bin/../lib/gcc/;F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/lib/../lib/;F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../lib/;F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/lib/;F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../
COLLECT_GCC_OPTIONS='-v' '-fuse-ld=lld' '-o' 'test.exe' '-shared-libgcc'
'-mtune=generic' '-march=i686'
F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/collect2.exe
-plugin
F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/liblto_plugin-0.dll
-plugin-opt=F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/lto-wrapper.exe
-plugin-opt=-fresolution=C:\Users\orgads\AppData\Local\Temp\ccLh9JEx.res
-plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmoldname
-plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt
-plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32
-plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32
-plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex
-plugin-opt=-pass-through=-lmsvcrt -m i386pe -Bdynamic -u
___register_frame_info -u ___deregister_frame_info -fuse-ld=lld -o test.exe
F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/lib/../lib/crt2.o
F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/crtbegin.o
-LF:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0
-LF:/git-sdk-64/mingw32/bin/../lib/gcc
-LF:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/lib/../lib
-LF:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../lib
-LF:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/lib
-LF:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../..
link_script -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt
-lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc
-lmoldname -lmingwex -lmsvcrt
F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/lib/../lib/default-manifest.o
F:/git-sdk-64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/crtend.o
lld-link: error: link_script: unknown file type
collect2.exe: error: ld returned 1 exit status</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>