On Wed, Aug 8, 2012 at 4:23 AM, Frank Ch. Eigler <f...@redhat.com> wrote: > Ian Lance Taylor <i...@google.com> writes: > >> [...] >> ELF is designed to permit fast program loading at runtime, and to >> permit fast linking. Changing symbol and relocation values to take >> general expressions works against that goal. >> [...] > > It may interest you to know that, for an older Cygnus project (mep), > we implemented a facility called computed/complex relocations, as an > ELF extension. This is a way of encoding general symbol/arithmetic > expressions to be evaluated at link time and substituted into the > binary output. (It may be similar to the vms-alpha ETIR facility.) > > This has been merged into gnu binutils some time ago, though is not > widely known, and only used by a single cgen-based gas port. See the > OBJ_COMPLEX_RELC conditionals in gas/*, the BSF_*RELC/STT_RELC logic > in bfd/*.
Thanks, I was trying to remember that. It is perhaps also worth noting that the IEEE-695 object file format supports arbitrary expressions in a number of different ways, including for relocation calculations. The format is not widely used today, for more or less that reason. Ian