Bug 30970 - [rfe] please include HPA segelf work
Summary: [rfe] please include HPA segelf work
Status: RESOLVED INVALID
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-13 03:55 UTC by Stas Sergeev
Modified: 2023-10-27 17:54 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stas Sergeev 2023-10-13 03:55:07 UTC
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.
Comment 1 Stas Sergeev 2023-10-24 22:32:14 UTC
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?
Comment 2 Stas Sergeev 2023-10-27 17:54:03 UTC
I hacked up RELC support into nasm,
and can confirm that these segelf
relocs are completely redundant.
There is nothing to upstream.