Linux – way to make objdump read from STDIN instead of a file

bashlinuxstdin

In my specific case, I want to use it to dump what I echo.
I don't want to involve any file…
Is there a way to make objdump read from STDIN instead?

Best Answer

You can't. There is no way around that, you will have to use the temporary file.

Source file readelf.c has this unconditional check (in binutils 2.22-8 at least) before even attempting to open the file:

if (! S_ISREG (statbuf.st_mode))
    {
      error (_("'%s' is not an ordinary file\n"), file_name);
      return 1;
    }

So if the file is anything but regular file (like symlink, or char device as in case of /dev/stdin, /proc/self/fd/*, etc.) it won't work.

Alternatively, you could modify the source and use modified objdump, but there goes your portability.