Discussion:
FIX_OFF16
(too old to reply)
muta...@gmail.com
2021-04-19 10:34:54 UTC
Permalink
jwasm has these defines:

enum fixup_types {
FIX_SEG, /* 0 */
FIX_LOBYTE, /* 1, OMF only */
FIX_HIBYTE, /* 2, OMF only */
FIX_RELOFF8, /* 3 */
FIX_RELOFF16, /* 4 */
FIX_RELOFF32, /* 5 */
FIX_OFF16, /* 6 */
FIX_OFF32, /* 7 */
FIX_PTR16, /* 8, OMF only */
FIX_PTR32, /* 9, OMF only */
FIX_OFF32_IMGREL, /* 10, COFF+ELF only */
FIX_OFF32_SECREL /* 11, COFF+ELF only */
};

And it seems from here:

https://github.com/JWasm/JWasm/blob/master/elf.c

#if GNURELOCS
case FIX_OFF16: em->extused = TRUE; elftype = R_386_16; break;

that FIX_OFF16 is non-standard for ELF.

Is there a reason for that?

This is the code that I am assembling:

https://sourceforge.net/p/pdos/gitcode/ci/master/tree/pdpclib/smlstart.asm

I'm planning on adding the above code to my
version of jwasm 1.94c.

But I'm wondering what it actually means.

Any ideas?

Thanks. Paul.
JJ
2021-04-19 12:24:18 UTC
Permalink
Post by ***@gmail.com
enum fixup_types {
FIX_SEG, /* 0 */
FIX_LOBYTE, /* 1, OMF only */
FIX_HIBYTE, /* 2, OMF only */
FIX_RELOFF8, /* 3 */
FIX_RELOFF16, /* 4 */
FIX_RELOFF32, /* 5 */
FIX_OFF16, /* 6 */
FIX_OFF32, /* 7 */
FIX_PTR16, /* 8, OMF only */
FIX_PTR32, /* 9, OMF only */
FIX_OFF32_IMGREL, /* 10, COFF+ELF only */
FIX_OFF32_SECREL /* 11, COFF+ELF only */
};
https://github.com/JWasm/JWasm/blob/master/elf.c
#if GNURELOCS
case FIX_OFF16: em->extused = TRUE; elftype = R_386_16; break;
that FIX_OFF16 is non-standard for ELF.
Is there a reason for that?
Probably for supporting 16-bit code within 32-bit module.
muta...@gmail.com
2021-04-20 18:59:13 UTC
Permalink
Post by JJ
Post by ***@gmail.com
that FIX_OFF16 is non-standard for ELF.
Is there a reason for that?
Probably for supporting 16-bit code within 32-bit module.
I've made this change to jwasm 1.94c:

C:\devel\jwasm>cvs diff
cvs diff: Diffing .
Index: elf.c
===================================================================
RCS file: c:\cvsroot/jwasm/elf.c,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 elf.c
760a761,764
Post by JJ
printf("unusual FIX_OFF16 encountered\n");
elftype = R_386_16;
break;
cvs diff: Diffing H
Index: H/elf.h
===================================================================
RCS file: c:\cvsroot/jwasm/H/elf.h,v
retrieving revision 1.1.1.1
diff -r1.1.1.1 elf.h
277a278
Post by JJ
#define R_386_16 20
And then I went to find out what caused messages like:

unusual FIX_OFF16 encountered

I was expecting this:
mov esi, offset __start__relot
or this:
mov esi, offset ___start__

But it was actually this:

rt:
dd offset rt

ie it is already a 32-bit value (dd). Seems to me it could
have been done with a normal FIX_OFF32/R_386_32?

BFN. Paul.

Loading...