This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: about writing a ld-extension to support linking 16-bit-gas code
Hello again
First, thanks for replying :-)
> I recommend investigating the existing i386 relocation types first;
> they might already exist. Adding new ones is the hard part. If they
> exist, supporting them better is pretty easy.
I don't know if we are talking about the same thing. My problem is, that
ld does just relocation in a 64kb address space (see example below,
"16-bit"-gas produced R_386_PC16 relocation type, meaning just a 16-bit
offset is relocated), but i need a linker to patch at the relocation
entry not only the 16-bit offset BUT patch the opcode from "call/jmp
near 32-bit offset" to "call/jmp FAR 16-bit seg + 16-bit offset" and put
the according segment and offset (both 16-bit) behind.
short: gas doesn't support 16-bit segment/offset relocation type, so
theres R_386_PC16, and i would like to override this relocation type
handling by inserting a opcode+seg+off fixup.
My trouble is now to decide: shall i extend ld or write my own little
linker ?
When such a ld-patch won't make it in the official release anyway it's
probably not worth to get familiar with the whole ld-source and maybe
easier to write my own little linker. But on the other side it would be
great to use ld's linker script support because the MEMORY+OVERLAY
macros could be of great use for my ROM-project. ??!
Btw, any other good book about linker internals (except "Linkers and
Loaders" by Morgan-Kaufman) ?
Big Thanks already for reading so far :-)
ciao
josef