This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
wanted: relocation for each field of instruction
- From: John Reiser <jreiser at BitWagon dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Fri, 06 Mar 2009 09:26:27 -0800
- Subject: wanted: relocation for each field of instruction
Hi,
I'm looking for the ability to relocate each field of an instruction,
particularly any field which holds an immediate value. My compiler
generates machine-code schemas where the opcodes are fixed, but the
immediate values (shift amounts, offsets, etc.) are variable.
I seek the ability to re-assign these "absolute" quantities
at module binding time (/bin/ld).
For instance in Thumb mode on ARM:
.code 16
lsr r0,r1,#foo /* 5-bit immediate shift count */
add r3,r2,#bar /* 3-bit immediate increment */
ldr r3,[r4,#baz] /* 8-bit base offset */
Current assembler complains:
reloc.S:2: Error: cannot represent THUMB_SHIFT relocation in this object file format
reloc.S:3: Error: cannot represent THUMB_ADD relocation in this object file format
reloc.S:4: Error: cannot represent THUMB_OFFSET relocation in this object file format
In the future my schemas might expand to allow register numbers to be
re-assigned too. This would enable cross-procedure optimization by
re-writing calling sequences to use a different register assignment.
It seems to me that making THUMB_SHIFT, THUMB_ADD, and THUMB_OFFSET
visible and known to the linker would be one way to get what I want.
Comments?
--