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

有帮助吗?

解决方案

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.

其他提示

-c compile will produce an object file from source

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top