From a4d34d48e4e1e48b67aa579e5be4e55f2187c507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Fri, 18 Jan 2019 21:59:36 +0000 Subject: patches/nasm{_host,}-2.14.02.local.patch: initial Midipix COFF GOT support, pt. III. --- patches/nasm_host-2.14.02.local.patch | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/patches/nasm_host-2.14.02.local.patch b/patches/nasm_host-2.14.02.local.patch index 987f750f..8204455c 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 23:17:37.132000000 +0000 ++++ nasm-2.14.02/output/outcoff.c 2019-01-18 21:52:03.156000000 +0000 @@ -701,6 +701,7 @@ sect->len += len; } @@ -8,7 +8,7 @@ typedef struct tagString { struct tagString *next; int len; -@@ -765,6 +766,99 @@ +@@ -765,6 +766,101 @@ *rvp = NULL; } @@ -33,6 +33,7 @@ + +static void BuildGlobalOffsetTable(void) +{ ++ uint64_t global_sym_addr; + GLOBALSYMBOL *global_sym, *global_sym_next; + char *global_sym_name; + GLOBALSYMBOLLIST global_symbols = {NULL, NULL}; @@ -91,10 +92,11 @@ + } + + if (win64) { -+ coff_sect_write(coff_sects[sym->section - 1], (const uint8_t *)&((uint64_t[]){0ULL}), 8); ++ global_sym_addr = (uint64_t)global_sym->sym->value; ++ coff_sect_write(coff_sects[sym->section - 1], &global_sym_addr, sizeof(global_sym_addr)); + reloc_type = IMAGE_REL_AMD64_ADDR64; + } else { -+ coff_sect_write(coff_sects[sym->section - 1], (const uint8_t *)&((uint32_t[]){0UL}), 4); ++ coff_sect_write(coff_sects[sym->section - 1], &global_sym->sym->value, sizeof(global_sym->sym->value)); + reloc_type = IMAGE_REL_I386_DIR32; + } + coff_add_reloc(coff_sects[sym->section - 1], coff_sects[global_sym->sym->section - 1]->index, reloc_type); @@ -108,7 +110,7 @@ static enum directive_result coff_directives(enum directive directive, char *value, int pass) -@@ -793,7 +887,9 @@ +@@ -793,7 +889,9 @@ nasm_error(ERR_NONFATAL, "unrecognized export qualifier `%s'", q); return DIRR_ERROR; } @@ -118,7 +120,7 @@ return DIRR_OK; } case D_SAFESEH: -@@ -888,8 +984,12 @@ +@@ -888,8 +986,12 @@ int32_t pos, sympos, vsize; int i; @@ -131,7 +133,7 @@ if (win32) { /* add default value for @feat.00, this allows to 'link /safeseh' */ -@@ -1086,7 +1186,10 @@ +@@ -1086,7 +1188,10 @@ memset(filename, 0, 18); /* useful zeroed buffer */ for (i = 0; i < (uint32_t) coff_nsects; i++) { -- cgit v1.2.3