* File not recognized in objdump!!
@ 2007-03-26 5:14 Aashish Gupta
2007-03-26 5:22 ` Aashish Gupta
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Aashish Gupta @ 2007-03-26 5:14 UTC (permalink / raw)
To: binutils, binutils; +Cc: Nick Clifton
Hi..
I am trying to modify objdump to dump object file information for a
ELF64 file but on a different
kernel but its giving an error saying file format not recognized.
> [root@localhost binutils]# ./objdump -s /root/Desktop/testcase/test.o
> ./objdump: /root/Desktop/testcase/test.o: File format not recognized
Which part of the code should I look for in order to get through this error?
Thanks!!!
--
Regards,
Aashish Gupta.
---------------------------------------------------
Live life as you have no tomorrow, dream as you have eternity..!!
^ permalink raw reply [flat|nested] 12+ messages in thread
* File not recognized in objdump!! 2007-03-26 5:14 File not recognized in objdump!! Aashish Gupta @ 2007-03-26 5:22 ` Aashish Gupta 2007-03-26 5:45 ` Mike Frysinger ` (2 subsequent siblings) 3 siblings, 0 replies; 12+ messages in thread From: Aashish Gupta @ 2007-03-26 5:22 UTC (permalink / raw) To: binutils, binutils; +Cc: Nick Clifton Hi.. I am trying to modify objdump to dump object file information for a ELF64 file but on a different kernel but its giving an error saying file format not recognized. > [root@localhost binutils]# ./objdump -s /root/Desktop/testcase/test.o > ./objdump: /root/Desktop/testcase/test.o: File format not recognized Which part of the code should I look for in order to get through this error? Thanks!!! -- Regards, Aashish Gupta. --------------------------------------------------- Live life as you have no tomorrow, dream as you have eternity..!! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 5:14 File not recognized in objdump!! Aashish Gupta 2007-03-26 5:22 ` Aashish Gupta @ 2007-03-26 5:45 ` Mike Frysinger 2007-03-26 7:14 ` Aashish Gupta 2007-03-26 20:24 ` Jim Wilson 2007-03-28 8:38 ` Nick Clifton 3 siblings, 1 reply; 12+ messages in thread From: Mike Frysinger @ 2007-03-26 5:45 UTC (permalink / raw) To: binutils; +Cc: Aashish Gupta [-- Attachment #1: Type: text/plain, Size: 628 bytes --] On Monday 26 March 2007, Aashish Gupta wrote: > I am trying to modify objdump to dump object file information for a > ELF64 file but on a different > kernel but its giving an error saying file format not recognized. > > > [root@localhost binutils]# ./objdump -s /root/Desktop/testcase/test.o > > ./objdump: /root/Desktop/testcase/test.o: File format not recognized > > Which part of the code should I look for in order to get through this > error? probably none ... build up a binutils for a target that supports the ELF format you're trying to analyze and/or build up binutils with --enable-targets=all -mike [-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 5:45 ` Mike Frysinger @ 2007-03-26 7:14 ` Aashish Gupta 2007-03-26 16:57 ` H. J. Lu 0 siblings, 1 reply; 12+ messages in thread From: Aashish Gupta @ 2007-03-26 7:14 UTC (permalink / raw) To: Mike Frysinger; +Cc: binutils Mike.. we have done a configure with the --target option which recognozes the ELF64 file format and used the ia64 architecture.. Then did a build which was neat worked without any errors./warnings.. So why is this error coming? On 3/26/07, Mike Frysinger <vapier@gentoo.org> wrote: > On Monday 26 March 2007, Aashish Gupta wrote: > > I am trying to modify objdump to dump object file information for a > > ELF64 file but on a different > > kernel but its giving an error saying file format not recognized. > > > > > [root@localhost binutils]# ./objdump -s /root/Desktop/testcase/test.o > > > ./objdump: /root/Desktop/testcase/test.o: File format not recognized > > > > Which part of the code should I look for in order to get through this > > error? > > probably none ... build up a binutils for a target that supports the ELF > format you're trying to analyze and/or build up binutils > with --enable-targets=all > -mike > > -- Regards, Aashish Gupta. --------------------------------------------------- Live life as you have no tomorrow, dream as you have eternity..!! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 7:14 ` Aashish Gupta @ 2007-03-26 16:57 ` H. J. Lu 0 siblings, 0 replies; 12+ messages in thread From: H. J. Lu @ 2007-03-26 16:57 UTC (permalink / raw) To: Aashish Gupta; +Cc: Mike Frysinger, binutils On Mon, Mar 26, 2007 at 11:15:21AM +0530, Aashish Gupta wrote: > Mike.. we have done a configure with the --target option which > recognozes the ELF64 file format and used the ia64 architecture.. Then > did a build which was neat worked without any errors./warnings.. > > So why is this error coming? > What does "readelf -a" say? H.J. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 5:14 File not recognized in objdump!! Aashish Gupta 2007-03-26 5:22 ` Aashish Gupta 2007-03-26 5:45 ` Mike Frysinger @ 2007-03-26 20:24 ` Jim Wilson 2007-03-26 23:02 ` Jim Wilson ` (2 more replies) 2007-03-28 8:38 ` Nick Clifton 3 siblings, 3 replies; 12+ messages in thread From: Jim Wilson @ 2007-03-26 20:24 UTC (permalink / raw) To: Aashish Gupta; +Cc: binutils, binutils, Nick Clifton On Mon, 2007-03-26 at 10:44 +0530, Aashish Gupta wrote: > I am trying to modify objdump to dump object file information for a > ELF64 file but on a different > kernel but its giving an error saying file format not recognized. Trying the command grep "File format not recognized" we find it is defined in bfd.c. Looking at this file, we see that this is in an error, and an enum defined nearby shows that the array index is bfd_error_file_not_recognized. So now grepping for that enum, we find that there are two bfd_set_error calls in the file format.c that use it. Both calls are in the function bfd_check_format_matches. Run objdump under gdb, put a breakpoint here, and step through the code to see what it is doing. -- Jim Wilson, GNU Tools Support, http://www.specifix.com ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 20:24 ` Jim Wilson @ 2007-03-26 23:02 ` Jim Wilson 2007-03-26 23:20 ` Jim Wilson [not found] ` <2538a28f0703270019o6033dfd9x58641e94ae68a1f@mail.gmail.com> 2 siblings, 0 replies; 12+ messages in thread From: Jim Wilson @ 2007-03-26 23:02 UTC (permalink / raw) To: Aashish Gupta; +Cc: binutils, binutils, Nick Clifton On Mon, 2007-03-26 at 10:44 +0530, Aashish Gupta wrote: > I am trying to modify objdump to dump object file information for a > ELF64 file but on a different > kernel but its giving an error saying file format not recognized. Trying the command grep "File format not recognized" we find it is defined in bfd.c. Looking at this file, we see that this is in an error, and an enum defined nearby shows that the array index is bfd_error_file_not_recognized. So now grepping for that enum, we find that there are two bfd_set_error calls in the file format.c that use it. Both calls are in the function bfd_check_format_matches. Run objdump under gdb, put a breakpoint here, and step through the code to see what it is doing. -- Jim Wilson, GNU Tools Support, http://www.specifix.com ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 20:24 ` Jim Wilson 2007-03-26 23:02 ` Jim Wilson @ 2007-03-26 23:20 ` Jim Wilson [not found] ` <2538a28f0703270019o6033dfd9x58641e94ae68a1f@mail.gmail.com> 2 siblings, 0 replies; 12+ messages in thread From: Jim Wilson @ 2007-03-26 23:20 UTC (permalink / raw) To: Aashish Gupta; +Cc: binutils FYI sources.redhat.com and sourceware.org are the same machine. Please don't send the same message to both addresses. That results in everyone receiving it twice. The sourceware.org name is the preferred one. And I fixed the cc line so I'm not making the same mistake again. -- Jim Wilson, GNU Tools Support, http://www.specifix.com ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <2538a28f0703270019o6033dfd9x58641e94ae68a1f@mail.gmail.com>]
* Re: File not recognized in objdump!! [not found] ` <2538a28f0703270019o6033dfd9x58641e94ae68a1f@mail.gmail.com> @ 2007-03-27 9:13 ` Aashish Gupta 2007-03-30 14:51 ` Jim Wilson 0 siblings, 1 reply; 12+ messages in thread From: Aashish Gupta @ 2007-03-27 9:13 UTC (permalink / raw) To: Jim Wilson; +Cc: binutils Jim, I already stepped through the fucntion "bfd_check_format_matches" and figured out that its not recognizing the target format ... The error looks something like this.. (gdb) run objdump Starting program: /root/Desktop/binutils1/gas/as-new objdump Breakpoint 6, as_perror (gripe=0x80d7638 "Selected target format '%s' unknown", filename=0x80db2be "elf64-ia64-little") at messages.c:124 ((Our target is elf64-ia64-big though ..?? and have made modification accordingly..)) 124 { (gdb) break bfd_check_format_matches Breakpoint 9 at 0x8088099: file format.c, line 118. (gdb) n 126 int saved_errno = errno; (gdb) n 128 as_show_where (); (gdb) n Assembler messages: 129 fprintf (stderr, gripe, filename); (gdb) n Selected target format 'elf64-ia64-little' unknown130 errno = saved_errno; (gdb) n 131 errtxt = bfd_errmsg (bfd_get_error ()); (gdb) n 132 fprintf (stderr, ": %s\n", errtxt); (gdb) n : Invalid bfd target 133 errno = 0; (gdb) n 135 } (gdb) n 134 bfd_set_error (bfd_error_no_error); (gdb) 135 } (gdb) n as_perror (gripe=0x80d4a34 "a.out", filename=0x0) at messages.c:134 134 bfd_set_error (bfd_error_no_error); Thanks.. > On 3/27/07, Jim Wilson <wilson@specifix.com> wrote: > > On Mon, 2007-03-26 at 10:44 +0530, Aashish Gupta wrote: > > > I am trying to modify objdump to dump object file information for a > > > ELF64 file but on a different > > > kernel but its giving an error saying file format not recognized. > > > > Trying the command > > grep "File format not recognized" > > we find it is defined in bfd.c. Looking at this file, we see that this > > is in an error, and an enum defined nearby shows that the array index is > > bfd_error_file_not_recognized. So now grepping for that enum, we find > > that there are two bfd_set_error calls in the file format.c that use it. > > Both calls are in the function bfd_check_format_matches. Run objdump > > under gdb, put a breakpoint here, and step through the code to see what > > it is doing. > > -- > > Jim Wilson, GNU Tools Support, http://www.specifix.com > > > > > > > > > > > -- > Regards, > Aashish Gupta. > > > --------------------------------------------------- > Live life as you have no tomorrow, dream as you have eternity..!! -- Regards, Aashish Gupta. --------------------------------------------------- Live life as you have no tomorrow, dream as you have eternity..!! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-27 9:13 ` Aashish Gupta @ 2007-03-30 14:51 ` Jim Wilson 0 siblings, 0 replies; 12+ messages in thread From: Jim Wilson @ 2007-03-30 14:51 UTC (permalink / raw) To: Aashish Gupta; +Cc: binutils On Tue, 2007-03-27 at 12:54 +0530, Aashish Gupta wrote: > (gdb) run objdump > Starting program: /root/Desktop/binutils1/gas/as-new objdump > Breakpoint 6, as_perror (gripe=0x80d7638 "Selected target format '%s' unknown", > filename=0x80db2be "elf64-ia64-little") at messages.c:124 > ((Our target is elf64-ia64-big though ..?? and have made modification > accordingly..)) > 124 { > (gdb) break bfd_check_format_matches > Breakpoint 9 at 0x8088099: file format.c, line 118. > (gdb) n > 126 int saved_errno = errno; There are a lot of problems with what you are doing here. First of all, you are debugging the assembler, not objdump here. See the "starting program" line, and the fact that as_perror is an assembler routine. Also, you are running it incorrectly, as you passed the objdump binary to it. The assembler only accepts assembly source files as input. You need to be debugging the right program with the right input. You set the bfd_check_format_matches breakpoint after starting the program, and then typed next, which is not going to work. This will leave you where you are already stopped, which is in the as_perror function. This routine just prints out the error message, which is far too late to be useful. You need to set the breakpoint first, and then run the program. If you debug the right program, and the right function, you will see that it ends up calling the elf64_ia64_object_p function which Nick pointed you at. binutils is a large and complicated package. You will need to spend a lot more time learning how it works, and how to use basic tools like gdb, if you wish to be successful modifying it. -- Jim Wilson, GNU Tools Support, http://www.specifix.com ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-26 5:14 File not recognized in objdump!! Aashish Gupta ` (2 preceding siblings ...) 2007-03-26 20:24 ` Jim Wilson @ 2007-03-28 8:38 ` Nick Clifton 2007-03-28 9:59 ` Nick Clifton 3 siblings, 1 reply; 12+ messages in thread From: Nick Clifton @ 2007-03-28 8:38 UTC (permalink / raw) To: Aashish Gupta; +Cc: binutils, binutils Hi Aashish, > I am trying to modify objdump to dump object file information for a > ELF64 file but on a different > kernel but its giving an error saying file format not recognized. Try looking at the source code for the function elfNN_ia64_object_p in bfd/elfxx-ia64.c. This is probably where your object file should be recognised. (Note, during the binutils building process the "NN" in elfNN_ia64_object_p is replaced with "64", hence when you are debugging objdump you should look for the function elf64_ia64_object_p). Cheers Nick ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: File not recognized in objdump!! 2007-03-28 8:38 ` Nick Clifton @ 2007-03-28 9:59 ` Nick Clifton 0 siblings, 0 replies; 12+ messages in thread From: Nick Clifton @ 2007-03-28 9:59 UTC (permalink / raw) To: Aashish Gupta; +Cc: binutils, binutils Hi Aashish, > I am trying to modify objdump to dump object file information for a > ELF64 file but on a different > kernel but its giving an error saying file format not recognized. Try looking at the source code for the function elfNN_ia64_object_p in bfd/elfxx-ia64.c. This is probably where your object file should be recognised. (Note, during the binutils building process the "NN" in elfNN_ia64_object_p is replaced with "64", hence when you are debugging objdump you should look for the function elf64_ia64_object_p). Cheers Nick ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-03-29 19:50 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-03-26 5:14 File not recognized in objdump!! Aashish Gupta 2007-03-26 5:22 ` Aashish Gupta 2007-03-26 5:45 ` Mike Frysinger 2007-03-26 7:14 ` Aashish Gupta 2007-03-26 16:57 ` H. J. Lu 2007-03-26 20:24 ` Jim Wilson 2007-03-26 23:02 ` Jim Wilson 2007-03-26 23:20 ` Jim Wilson [not found] ` <2538a28f0703270019o6033dfd9x58641e94ae68a1f@mail.gmail.com> 2007-03-27 9:13 ` Aashish Gupta 2007-03-30 14:51 ` Jim Wilson 2007-03-28 8:38 ` Nick Clifton 2007-03-28 9:59 ` Nick Clifton
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).