Bug 507178 - i686-pc-mingw32-readelf reports "Not an ELF file"
i686-pc-mingw32-readelf reports "Not an ELF file"
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: mingw32-binutils (Show other bugs)
11
All Linux
low Severity medium
: ---
: ---
Assigned To: Richard W.M. Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-21 10:25 EDT by Miao ZhiCheng
Modified: 2009-06-22 10:19 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-06-22 04:39:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Miao ZhiCheng 2009-06-21 10:25:53 EDT
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 11:36:22 EDT
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 Berrange 2009-06-22 04:39:22 EDT
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 07:59:35 EDT
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 08:30:15 EDT
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 09:39:07 EDT
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 10:19:10 EDT
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.