[llvm-bugs] [Bug 31408] New: /dev/null is not accepted as output

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 16 07:56:55 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=31408

            Bug ID: 31408
           Summary: /dev/null is not accepted as output
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dima at golovin.in
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

When detecting compiler features it is common to use '-o /dev/null' option. It
fails with LLD.

Typical test would look like this:

    $ echo 'typedef int x;' | clang -x c - -nostdlib -shared -o /dev/null
    ld.lld: error: rename failed: Permission denied

So LLD is trying to rename /dev/null. What it is actually trying to do is the
following:

    access("/dev/nulltmp4e940395", F_OK)    = -1 ENOENT (No such file or
directory)
    rename("/dev/null", "/dev/nulltmp4e940395") = -1 EACCES (Permission denied)

I don't know what is the right behavior to implement if /dev/null is an output,
but I think that is not it.

This should also affect NUL on Windows.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161216/13859fad/attachment.html>


More information about the llvm-bugs mailing list