[Nasm-bugs] [Bug 3392533] Considerations for segment support in ELF

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Tue Dec 18 16:18:19 PST 2018


--- Comment #17 from H. Peter Anvin <hpa at zytor.com> ---
I came up with a simpler proposal, as some architectures already need these
kinds of targets in binutils.  This is based on the fact that ELF does support
multiple relocations at the same offset, and some architectures already rely on


O(S) is the base of the *output* section that contains the symbol S, which may
be a pseudo-section that will always be at a specific address (SHT_ABS?).

Given that, these are the operations we should need:

R_*_SEG16      word16    (O(S) >> 4) + A
R_*_SEGSUB16   word16    A - O(S)
R_*_SEGSUB32   word32    A - O(S)

... which seem fairly straightforward to me.

To create a typical 16-bit FAR pointer like

    dw foo, seg foo

it would end up looking like:

0  R_386_16       foo
0  R_386_SEGSUB16 foo
2  R_386_SEG16    foo

   ... or ...

    dw foo wrt there, there

0  R_386_16       foo
0  R_386_SEGSUB16 there
2  R_386_SEG16    there

... which would be the default if "foo" had been declared a member of group

You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.

More information about the Nasm-bugs mailing list