Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22113

How can I compile C program to 32bit elf64?

$
0
0

I want to achieve a similar effect as assemblying a program with nasm -f elf64 that uses BITS 32 directive.

Such a code:

BITS 64mov eax, 0xamov edx, 0xfimul eax, edxret

assembled with this command looks like this:

b8 0a 00 00 00 ba 0f 00 00 00 0f af c2 c3

Such a code:

BITS 32mov eax, 0xamov edx, 0xfimul eax, edxret

assembled with this command looks like this:

66 b8 0a 00 00 00 66 ba 0f 00 00 00 66 0f af c2 c3

I want to achieve similar effect in C. Preferably with GCC compiler, but it can also be LLVM or any other.


Viewing all articles
Browse latest Browse all 22113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>