From: Alan Cox Date: Tue, 31 Oct 2017 13:44:28 +0000 (+0000) Subject: obj: add proper PCREL definitions for relocation entries X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=46011054f7dcacc0f0f4b93251efbb785594e92a;p=FUZIX.git obj: add proper PCREL definitions for relocation entries We can generate them but not yet link them --- diff --git a/Applications/MWC/cmd/asz80/as4.c b/Applications/MWC/cmd/asz80/as4.c index d15b1411..e4550590 100644 --- a/Applications/MWC/cmd/asz80/as4.c +++ b/Applications/MWC/cmd/asz80/as4.c @@ -137,9 +137,10 @@ void outrabrel(ADDR *a) check_store_allowed(segment, a->a_value); if (a->a_sym) { outbyte(REL_ESC); - outbyte((0 << 4 ) | REL_SYMBOL); + outbyte((0 << 4 ) | PCREL); outbyte(a->a_sym->s_number & 0xFF); outbyte(a->a_sym->s_number >> 8); + outaw(a->a_value); } /* relatives without a symbol don't need relocation */ } diff --git a/Applications/MWC/cmd/asz80/obj.h b/Applications/MWC/cmd/asz80/obj.h index 2bdfc295..7d477789 100644 --- a/Applications/MWC/cmd/asz80/obj.h +++ b/Applications/MWC/cmd/asz80/obj.h @@ -53,6 +53,10 @@ struct objhdr #define REL_SPECIAL 0x00 /* REL_REL REL_EOF etc */ #define REL_SYMBOL 0x01 /* Followed by a 2 byte symbol code then offset to relocate */ +#define REL_PCREL 0x02 /* Followed by a 2 byte symbol code then + a word sized value regardless of reloc size + but the resulting reloc is written to the + size given */ #define REL_REL (REL_SPECIAL| (0 << 4)) /* 00 */ #define REL_EOF (REL_SPECIAL| (1 << 4)) /* 10 */