From: Robert Pengelly Date: Sun, 1 Mar 2026 19:46:32 +0000 (+0000) Subject: Fixed DOS version X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;p=slink.git Fixed DOS version --- diff --git a/Makefile.wat b/Makefile.wat index 026fb80..0a87a54 100644 --- a/Makefile.wat +++ b/Makefile.wat @@ -10,7 +10,7 @@ all: slink.exe slink.exe: $(SRC) - wcl -fe=$@ $^ + wcl -ml -fe=$@ $^ clean: diff --git a/coff.c b/coff.c index 12f4cb5..5ce9ae3 100644 --- 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) { + 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); - switch (array_to_integer (input->Type, 2, 0)) { + type = array_to_integer (input->Type, 2, 0); + + switch (type) { case IMAGE_REL_I386_ABSOLUTE: diff --git a/ld.h b/ld.h index 68db48e..5cc67d1 100644 --- 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 diff --git a/link.c b/link.c index 49a0eb5..71b9562 100644 --- 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]; - 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) {