Hi guys. I've recently discovered this binutils fork by HPA: https://git.syslinux.org/users/hpa/segelf/binutils.git/ Which implements this elf extension proposal: https://git.syslinux.org/users/hpa/segelf/abi.git/tree/segelf.txt I've also found his nasm elf16 fork: https://github.com/netwide-assembler/nasm/tree/elf16 I built these things locally and ported my project to this segelf scheme without a slightest issue: https://github.com/dosemu2/fdpp/issues/172#issuecomment-1760271090 So its an absolutely marvelous piece of code, but unfortunately HPA has lost an interest to it many years ago. How feasible would it be for binutils gurus to take it over and upstream? I myself can't tell if something is missing in his impl. But it works for me perfectly well.
It turned out R_RELC can be used instead of the custom reloc schemes. So that HPA work can be reduced to just this patch: diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 80d66c1ce15..7b036a785b0 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -392,6 +392,9 @@ extern offsetT x86_sframe_cfa_ra_offset (void); extern unsigned char x86_sframe_get_abi_arch (void); #define sframe_get_abi_arch x86_sframe_get_abi_arch +/* Support computed relocations. */ +#define OBJ_COMPLEX_RELC + #endif #ifdef TE_PE Any reason why computed relocs are currently disabled in gas, and can that be changed?
I hacked up RELC support into nasm, and can confirm that these segelf relocs are completely redundant. There is nothing to upstream.