[llvm-dev] [RFC] [tools] Changing Behavior of LLVM binutils When No File Is Specified

Michael Spencer via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 25 17:28:38 PDT 2019


On Tue, Jun 25, 2019 at 4:58 PM Alex Brachet-Mialot via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Some binutils, nm comes to mind, when to input file is specified will
> default to a.out. Others do not do this and read from stdin by default. The
> rest of this email will be specifically referencing these which read from
> stdin, and not the tools which for various reasons do things differently.
>
> I propose that we change the behavior of these tools to use a.out when
> appropriate. By appropriate I mean firstly, no input file specified and
> also no stream redirection to stdin. These are the file types of stdin in
> these scenarios:
> $ writes-to-stdout | prog # named pipe (fifo)
> $ prog < file # regular file
> $ prog # reading from tty, character device
>
> Perhaps if stdin is a named pipe or regular file, then the default
> behavior should be as it always was, to read from stdin, but if stdin is a
> tty then we should use a.out as a default file. This lets these tools act
> the same as their gnu counterparts (when meaningful) but also adds what I
> think is convenient to not have to specify a.out.
>
> This proposal would look something like this:
> $ llvm-strings # not meanigful to read from stdin here, look for a.out
> $ llvm-strings < file # use stdin
>
> I may have got the behavior of stream redirection wrong here, or missed a
> situation when reading from the terminal is useful. I would love some
> feedback.
>
> Best,
> Alex
>
>
Does anyone actually use the default to a.out behavior?  I think it would
be much friendlier to just print "file or pipe expected" and then print the
help.

- Michael Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190625/901438d8/attachment.html>


More information about the llvm-dev mailing list