Creating ELF instead of a.out

I need to generate a simple ELF32 Hello World executable using gcc. Although it seems I don't have the gcc-elf command. Is it possible to create ELF binaries instead of a.out without creating gcc again?

(I assume this is possible with some options, but I'm not sure how to do this)

+3
source share
2 answers

a.out is very old, we are talking about Linux kernel version linux 1.2. Assuming you are running on any remote linux platform, you are generating elf executables by default. Use the command filefor the output executable to verify. For example:.

$ file server
server: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
+8
source

Check the a.out file

$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

, a.out, ELF.

+10

Source: https://habr.com/ru/post/1526250/


All Articles