From c4980e6bdd023eff05e444e3465c6550a660b8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Thu, 17 Jan 2019 23:23:15 +0000 Subject: patches/nasm_host-2.14.02.local.patch: initial Midipix COFF GOT support, pt. II. --- patches/nasm_host-2.14.02.local.patch | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'patches/nasm_host-2.14.02.local.patch') diff --git a/patches/nasm_host-2.14.02.local.patch b/patches/nasm_host-2.14.02.local.patch index 3493b69a..987f750f 100644 --- a/patches/nasm_host-2.14.02.local.patch +++ b/patches/nasm_host-2.14.02.local.patch @@ -1,5 +1,5 @@ --- nasm-2.14.02/output/outcoff.c.orig 2018-12-26 13:44:06.000000000 +0000 -+++ nasm-2.14.02/output/outcoff.c 2019-01-17 22:38:03.672000000 +0000 ++++ nasm-2.14.02/output/outcoff.c 2019-01-17 23:17:37.132000000 +0000 @@ -701,6 +701,7 @@ sect->len += len; } @@ -8,7 +8,7 @@ typedef struct tagString { struct tagString *next; int len; -@@ -765,6 +766,96 @@ +@@ -765,6 +766,99 @@ *rvp = NULL; } @@ -76,7 +76,7 @@ + sym = saa_wstruct(coff_syms); + sym->is_global = 1; + sym->namlen = got_sym_name_len; -+ sym->section = coff_make_section(got_sec_name, GOT_SECTION_FLAGS); ++ sym->section = coff_make_section(got_sec_name, GOT_SECTION_FLAGS) + 1; + sym->type = 0; sym->value = 0; + coff_nsyms++; + @@ -90,11 +90,14 @@ + strncpy(sym->name, got_sym_name, sizeof(sym->name)); + } + -+ if (win64) ++ if (win64) { ++ coff_sect_write(coff_sects[sym->section - 1], (const uint8_t *)&((uint64_t[]){0ULL}), 8); + reloc_type = IMAGE_REL_AMD64_ADDR64; -+ else ++ } else { ++ coff_sect_write(coff_sects[sym->section - 1], (const uint8_t *)&((uint32_t[]){0UL}), 4); + reloc_type = IMAGE_REL_I386_DIR32; -+ coff_add_reloc(coff_sects[sym->section], coff_sects[global_sym->sym->section - 1]->index, reloc_type); ++ } ++ coff_add_reloc(coff_sects[sym->section - 1], coff_sects[global_sym->sym->section - 1]->index, reloc_type); + + global_sym_next = global_sym->next; + nasm_free(global_sym); nasm_free(global_sym_name); @@ -105,7 +108,7 @@ static enum directive_result coff_directives(enum directive directive, char *value, int pass) -@@ -793,7 +884,9 @@ +@@ -793,7 +887,9 @@ nasm_error(ERR_NONFATAL, "unrecognized export qualifier `%s'", q); return DIRR_ERROR; } @@ -115,7 +118,7 @@ return DIRR_OK; } case D_SAFESEH: -@@ -888,8 +981,12 @@ +@@ -888,8 +984,12 @@ int32_t pos, sympos, vsize; int i; @@ -128,7 +131,7 @@ if (win32) { /* add default value for @feat.00, this allows to 'link /safeseh' */ -@@ -1086,7 +1183,10 @@ +@@ -1086,7 +1186,10 @@ memset(filename, 0, 18); /* useful zeroed buffer */ for (i = 0; i < (uint32_t) coff_nsects; i++) { -- cgit v1.2.3