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/*. - FChE