Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
Could you please explain your situation a little more? – quanta Nov 9 '11 at 3:36

2 Answers 2

you can always do

objdump -d /dev/stdin < t2.o


cat t2.o | objdump -d /dev/stdin


[root@myhost cc]# objdump -h /dev/stdin < t2.o

/dev/stdin: file format elf64-x86-64

Sections: Idx Name Size VMA LMA
File off Algn 0 .group 00000008 0000000000000000 0000000000000000 00000040 2**2 CONTENTS, READONLY, EXCLUDE, GROUP, LINK_ONCE_DISCARD

share|improve this answer
cat t2.o | objdump -d /dev/stdin does not work. /dev/stdin only works when it corresponds to a real file. Since your solution requires the presence of that file, this does not answer the OP. – dragonroot Nov 9 '12 at 5:04
This may work for this invocation of objdump in particular, but it might fail for others in case it does seek operations on the file. When tools don't have - for stdin, that is often the case. – Ciro Santilli 六四事件 法轮功 包卓轩 Aug 28 at 9:18

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.