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]

Help with getting Complex Relocation to work (z80)


Hi all.

A while back I reported an issue with the z80-unknown-coff target and
complex relocation (though I didn't know it was called that then).
I've decided to bite the bullet and fix this, learning a bit more
about the engineering of binutils in the process :-)

Take this example:

.section .text
??????????? org?? 32768

??????????? LD??? A, label >> 8    ; Get MSB of 16bit address
label: ? ?? defw? 0x4000

Fails to assemble, giving " Error: invalid operands (.text and *ABS*
sections) for `>>'"
(I'm doing this on the 5th October 2.22.51 snapshot - I used to get
"Error: invalid sections for operation on `pos' and `L0'" on an
earlier 2.21 release).

Similarly for label/equ expressions involving <<, * and /.

After a few days poking about, finding my way through the gas and ld
sources, single stepping and turning DEBUG on, I stumbled upon
defining #define OBJ_COMPLEX_RELC, so I added this to tc-Z80.h.

Now things are looking up. No longer do I get an error, and inspecting
the symbol table through nm reveals:

00000000 t .text
???????? U >>:s5:label:#00000100
00008002 t label

Excellent. But now I need help!

Out of the box, ld errors with test.coff:fake:(.text+0x8001):
undefined reference to `>>:s5:label:#00000100'

Can someone point me in the right direction so I can have a go at
getting ld to resolve these "complex relocations" ? I've frankly being
going round in circles!

Also, do you also think that such locally (to the object file)
resolvable references should be carried out by gas before spitting out
the object (coff) file?

Many thanks.
Chris


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