Bug 507178 - i686-pc-mingw32-readelf reports "Not an ELF file"
Summary: i686-pc-mingw32-readelf reports "Not an ELF file"
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mingw32-binutils
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-21 14:25 UTC by Miao ZhiCheng
Modified: 2009-06-22 14:19 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-06-22 08:39:22 UTC


Attachments (Terms of Use)

Description Miao ZhiCheng 2009-06-21 14:25:53 UTC
Description of problem:
i686-pc-mingw32-readelf reports "Not an ELF file" to the exe file produes by i686-pc-mingw32-gcc.

Version-Release number of selected component (if applicable):
mingw32-binutils-2.19.1-4.fc11.i586

How reproducible:
$ cat 1.c
#include <stdio.h>

int main()
{
    printf("hellwolf\n");
}
$ i686-pc-mingw32-gcc 1.c
$ i686-pc-mingw32-readelf -d a.exe 
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start

Comment 1 Erik van Pienbroek 2009-06-21 15:36:22 UTC
What's wrong with this behaviour? Win32 executables are in the PE format instead of the ELF format so the error message is correct AFAIK.

Comment 2 Daniel Berrangé 2009-06-22 08:39:22 UTC
As Erik says, Mingw32 executes are *not* ELF files, therefore the error message from 'readelf' is correct. 

$ file virsh.exe 
virsh.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit

Comment 3 Kevin Kofler 2009-06-22 11:59:35 UTC
Why is there an i686-pc-mingw32-readelf at all? The target binaries are NOT ELF, so obviously readelf won't work, so why is upstream Binutils installing it and why are we packaging it? It doesn't make sense to ship stuff which can't work.

Comment 4 Miao ZhiCheng 2009-06-22 12:30:15 UTC
I want to know what dlls it links to, in ELF I can use readelf to get those information. What tool should I use now?

Comment 5 Thomas Sailer 2009-06-22 13:39:07 UTC
i686-pc-mingw32-objdump -x mydll.dll

will list the import section, where you can find the DLL's it imports

Comment 6 Richard W.M. Jones 2009-06-22 14:19:10 UTC
In reply to comment 3, I'm also having a hard time thinking
of a situation where i686-pc-mingw32-readelf would be
useful.  But do we really want to bother deleting it?  It
takes a miniscule amount of space in the grand scheme
of things, and might have some use to someone.


Note You need to log in before you can comment on or make changes to this bug.