[Scummvm-devel] dynamic plugins again

Marcus Comstedt marcus at mc.pp.se
Sun Aug 30 23:39:13 CEST 2009


yotam barnoy <yotambarnoy at gmail.com> writes:

> 1. It looks like the plugin files are built relocatable, but not position
> independent, correct? The reason I think this is because there is no code in
> the DC loader to deal with a Global Offset Table.

Correct.  This is the purpose of the "-q" flag to ld; it produces a
binary which still contains relocation records.


> 2. My second question is, how do you get the DC to have only 1 type of
> relocation? Is there a special mode for this?

Well, it turns out that only one type of allocation is needed.  The
SH4 has a fixed instruction width of 16 bits, so there are never any
immediate addresses (except for PC-relative within the same
compilation unit, the range is just 512 bytes), meaning that all
non-local address references have the form of a 32-bit data word that
contains the address (and which is then loaded using local PC-relative
adressing).  So this is the only form of relocation which actually
appears in the finished binary.

On MIPS, you have e.g. 16-bit high and 16-bit low part of addresses for
immediate addressing (unless you use PIC), so you need to handle a
few more relocation types.  Maybe up to 5 or so in total, I guess.

Unless you compile with -G0, you'll probably need to set up the global
data pointer as well.


  // Marcus






More information about the Scummvm-devel mailing list