Question

as defaults to ELF. I have some PIC code I would like to assemble to just that - only the raw instructions, no sections, etc. I believe using nasm you could achieve this by assembling with no options, and start your code with the BITS 32 directive (for a 32 bit architecture).

How to with as?

System:
- Ubuntu 12.04.
- as 2.2.
- x86 32b

Was it helpful?

Solution

as can only generate ELF output, but you can convert an ELF binary to another format using objcopy:

objcopy -O binary mybinary.elf mybinary.bin

It supports a number of other formats as well as "binary". In particular, it supports "ihex" to produce .hex files, which some microcontroller programming tools may require.

OTHER TIPS

-c compile will produce an object file from source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top