Windows 下 MinGW Cygwin 下gcc编译
$ gcc main.c stack.c -o main
自动生成main.exe
使用readelf查看报错
$ readelf -a main.exe
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
分析:
使用file查看文件类型
$ file main.exe
main.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
显示PE32类型的可执行文件,并不是ELF文件。
还是Windows系统下的问题,和之前 int $0x80 段错误 一样。
gcc自动生成了Windows下面的可执行文件,等待在虚拟机上测试。
--
参考:
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start - Stack Overflow
https://stackoverflow.com/questions/20898986/readelf-error-not-an-elf-file-it-has-the-wrong-magic-bytes-at-the-start