obj: add proper PCREL definitions for relocation entries
authorAlan Cox <alan@linux.intel.com>
Tue, 31 Oct 2017 13:44:28 +0000 (13:44 +0000)
committerAlan Cox <alan@linux.intel.com>
Tue, 31 Oct 2017 13:44:28 +0000 (13:44 +0000)
We can generate them but not yet link them

Applications/MWC/cmd/asz80/as4.c
Applications/MWC/cmd/asz80/obj.h

index d15b141..e455059 100644 (file)
@@ -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 */
        }
index 2bdfc29..7d47778 100644 (file)
@@ -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 */