Fixed DOS version master
authorRobert Pengelly <robertapengelly@hotmail.com>
Sun, 1 Mar 2026 19:46:32 +0000 (19:46 +0000)
committerRobert Pengelly <robertapengelly@hotmail.com>
Sun, 1 Mar 2026 19:46:32 +0000 (19:46 +0000)
Makefile.wat
coff.c
ld.h
link.c

index 026fb801fadf6389dce34b1c48ddcf2f0e2ff134..0a87a546116bd7e0e80ab11ffd662edfd33a5f4a 100644 (file)
@@ -10,7 +10,7 @@ all: slink.exe
 
 slink.exe: $(SRC)
 
 
 slink.exe: $(SRC)
 
-       wcl -fe=$@ $^
+       wcl -ml -fe=$@ $^
 
 clean:
 
 
 clean:
 
diff --git a/coff.c b/coff.c
index 12f4cb59c3cd2c6302930d1fa22035101ab44b45..5ce9ae330499b6d37c8958b06f562aea6709faf7 100644 (file)
--- a/coff.c
+++ b/coff.c
@@ -44,10 +44,14 @@ struct symbol_table_entry {
 
 static void translate_relocation (struct reloc_entry *reloc, struct coff_relocation_entry *input, struct section_part *part) {
 
 
 static void translate_relocation (struct reloc_entry *reloc, struct coff_relocation_entry *input, struct section_part *part) {
 
+    uint16_t type;
+    
     reloc->symbol = part->of->symbol_arr + array_to_integer (input->SymbolTableIndex, 4, 0);
     reloc->offset = array_to_integer (input->VirtualAddress, 4, 0);
     
     reloc->symbol = part->of->symbol_arr + array_to_integer (input->SymbolTableIndex, 4, 0);
     reloc->offset = array_to_integer (input->VirtualAddress, 4, 0);
     
-    switch (array_to_integer (input->Type, 2, 0)) {
+    type = array_to_integer (input->Type, 2, 0);
+    
+    switch (type) {
     
         case IMAGE_REL_I386_ABSOLUTE:
         
     
         case IMAGE_REL_I386_ABSOLUTE:
         
diff --git a/ld.h b/ld.h
index 68db48e350ad7f580dc4eaa03a9fc90d19d4efc1..5cc67d1b07da08ae850431de459fb7af32103ec9 100644 (file)
--- a/ld.h
+++ b/ld.h
@@ -29,9 +29,9 @@ struct ld_state {
 };
 
 
 };
 
 
-#define     LD_TARGET_MACHINE_AARCH64                       (1U << 15)
-#define     LD_TARGET_MACHINE_AMD64                         (1U << 14)
-#define     LD_TARGET_MACHINE_I386                          (1U << 13)
+#define     LD_TARGET_MACHINE_AARCH64                       (1U << 14)
+#define     LD_TARGET_MACHINE_AMD64                         (1U << 13)
+#define     LD_TARGET_MACHINE_I386                          (1U << 12)
 
 
 #define     LD_EMULATION_NONE           0x00
 
 
 #define     LD_EMULATION_NONE           0x00
diff --git a/link.c b/link.c
index 49a0eb55e99ad7d29aa21e6c9d9d75dce9edb6fa..71b95627245ffc659a5a59d47faf36b003ef9df9 100644 (file)
--- a/link.c
+++ b/link.c
@@ -585,7 +585,9 @@ static void calculate_section_sizes_and_rvas (void) {
 static void reloc_generic (struct section_part *part, struct reloc_entry *rel, struct symbol *symbol) {
 
     unsigned char opcode = (part->content + rel->offset - 1)[0];
 static void reloc_generic (struct section_part *part, struct reloc_entry *rel, struct symbol *symbol) {
 
     unsigned char opcode = (part->content + rel->offset - 1)[0];
-    uint64_t result = 0, size = rel->howto->size, offset = rel->offset;
+    int size = rel->howto->size;
+    
+    uint64_t result = 0, offset = rel->offset;
     
     switch (size) {
     
     
     switch (size) {