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
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.
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
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.
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?
i686-pc-mingw32-objdump -x mydll.dll will list the import section, where you can find the DLL's it imports
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.