This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?

-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]