<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 - lld writing to Windows RAM drive fails with "cannot open output file ...: function not supported""
   href="https://bugs.llvm.org/show_bug.cgi?id=52080">52080</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld writing to Windows RAM drive fails with "cannot open output file ...: function not supported"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </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>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bernhard_mlist@outlook.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hello

Since LLVM-11.0.1-rc2, writing an output file with lld fails with the following
error when the target directory is on a RAM drive.

<span class="quote">> lld-link-11.0.1-rc2.exe /OUT:R:\llvmtest.exe llvmtest.o
> lld-link-11.0.1-rc2: error: cannot open output file llvmtest.exe: function not supported</span >

After the error is reported and lld aborts, a file named
R:\llvmtest.exe.tmpXXXXXXX (random 7 hex digit suffix) of 0 byte length
remains.

The same is also true for other lld variations like wasm-ld.exe. Both the win64
and win32 builds from the official GitHub releases page are affected. Any
version since LLVM 11.0.1-rc2 (released Dec 19, 2020) seems to be affected.
Versions 11.0.1-rc1 (released Nov 26, 2020) and older don't show the problem
and generate the output file as if it were a physical hard drive.

I use the free software "ImDisk Virtual Disk Driver for Windows" to create RAM
drives, formatted with NTFS. It is available from
<a href="http://www.ltr-data.se/opencode.html/#ImDisk">http://www.ltr-data.se/opencode.html/#ImDisk</a>
On the issue tracker of LDC (LLVM-based D Compiler) there is a report about the
same error message from someone using another software called "Primo Ramdisk":
<a href="https://github.com/ldc-developers/ldc/issues/3675#issuecomment-783864814">https://github.com/ldc-developers/ldc/issues/3675#issuecomment-783864814</a>

I tried to write to various drive targets and network shares also showed some
weirdness starting with that same version. It writes the output without error
message but then it leaves behind a 1 byte file llvmtest.exe.tmpXXXXXXX.

Here's various tests with the drives C: (physical hard drive), R: (RAM drive),
N: (Network drive) and \\x.x.x.x\x (UNC network share).

<span class="quote">> lld-link-11.0.1-rc1.exe /OUT:C:\llvmtest.exe llvmtest.o
>    => no error, leaves only C:\llvmtest.exe

> lld-link-11.0.1-rc2.exe /OUT:C:\llvmtest.exe llvmtest.o
>    => no error, leaves only C:\llvmtest.exe

> lld-link-11.0.1-rc1.exe /OUT:R:\llvmtest.exe llvmtest.o
>    => no error, leaves only N:\llvmtest.exe

> lld-link-11.0.1-rc2.exe /OUT:R:\llvmtest.exe llvmtest.o
>    => shows error, and leaves only R:\llvmtest.exe.tmpXXXXXXX (0 bytes)

> lld-link-11.0.1-rc1.exe /OUT:N:\llvmtest.exe llvmtest.o
>    => no error, leaves only N:\llvmtest.exe

> lld-link-11.0.1-rc2.exe /OUT:N:\llvmtest.exe llvmtest.o
>    => no error, but leaves both N:\llvmtest.exe (ok) and N:\llvmtest.exe.tmpXXXXXXX (1 bytes)

> lld-link-11.0.1-rc1.exe /OUT:\\x.x.x.x\x\llvmtest.exe llvmtest.o
>    => no error, leaves only \\x.x.x.x\x\llvmtest.exe

> lld-link-11.0.1-rc2.exe /OUT:\\x.x.x.x\x\llvmtest.exe llvmtest.o
>    => no error, but leaves both \\x.x.x.x\x\llvmtest.exe and \\x.x.x.x\x\llvmtest.exe.tmpXXXXXXX (1 bytes)</span >

The llvmtest.o file I tested with was created with Clang which works fine in
any version of Clang as far as I can tell.

<span class="quote">> int main() { return 1; }
> int mainCRTStartup() { return 2; }</span >

<span class="quote">> clang-11.0.1-rc2.exe -c llvmtest.c -o llvmtest.o</span >

The generated EXE file (if it succeeds) returns the exit status 2 (result of
mainCRTStartup).

Thanks for checking.</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>