how to embed an arbitrary opcode

John Breitenbach breiten@lexmark.com
Thu Jun 18 21:26:00 GMT 2009
Hi,
  I'm looking for a way to embed an arbitrary opcode into an assembly 
file for the ARM architecture.  .long and
friends implicitly mark their data as data, using the $d, and follow it 
with a $a to resume with executable code.

This was a problem because we build code for be8 mode, and the linker 
needs to know what it executable code and
thus what to swap.  Our hand-coded opcode wasn't getting swapped.  
Objdump refuses to disassemble those
opcodes even with the --disassemble-all flag.

binutils version is a bit old, but its new to us:  GNU assembler 
(CodeSourcery 2007q1-10. Marvell 2008q3-13 20081204) 2.17

The current docs and a google search didn't help, and trying ".insn" 
didn't magically work.

I also tried an explicit "$a" in front of my .long, but the assembler 
complains about that.

contents x.S
    wfi
    .long 0xe320f003

wfi is allowed by my assembler with -mcpu=marvell-fv7.

objdump shows that they generate identical values:
t.o:     file format elf32-bigarm

Disassembly of section .text:

00000000 <.text>:
   0:   e320f003        wfi
   4:   e320f003        .word   0xe320f003

readelf shows that we switch to data at offset 4.

Thanks for any advice, John.



More information about the Binutils mailing list