diff --git a/libyasm/bytecode.c b/libyasm/bytecode.c index d2e658de..2c212b04 100644 --- a/libyasm/bytecode.c +++ b/libyasm/bytecode.c @@ -432,12 +432,6 @@ yasm_bc_create_data(yasm_datavalhead *datahead, unsigned int size, return yasm_bc_create_common(&bc_data_callback, data, line); } -int -yasm_bc_is_data(const yasm_bytecode *bc) -{ - return (bc->callback == &bc_data_callback); -} - static void bc_reserve_destroy(void *contents) { diff --git a/libyasm/bytecode.h b/libyasm/bytecode.h index daf56e8a..79d940b9 100644 --- a/libyasm/bytecode.h +++ b/libyasm/bytecode.h @@ -141,12 +141,6 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); /*@only@*/ yasm_bytecode *yasm_bc_create_data (yasm_datavalhead *datahead, unsigned int size, unsigned long line); -/** Find out if a bytecode is a data bytecode. - * \param bc bytecode - * \return Nonzero if bytecode is a data bytecode, otherwise 0. - */ -int yasm_bc_is_data(const yasm_bytecode *bc); - /** Create a bytecode reserving space. * \param numitems number of reserve "items" (kept, do not free) * \param itemsize reserved size (in bytes) for each item diff --git a/modules/objfmts/coff/coff-objfmt.c b/modules/objfmts/coff/coff-objfmt.c index 1f2cbcdd..a40a168b 100644 --- a/modules/objfmts/coff/coff-objfmt.c +++ b/modules/objfmts/coff/coff-objfmt.c @@ -455,7 +455,6 @@ coff_objfmt_output_expr(yasm_expr **ep, unsigned char *buf, size_t destsize, * $$ in. * For Win32 COFF, need to reference to next bytecode, so add '$' * (really $+$.len) in. - * For Win64 COFF, don't add anything in. */ if (objfmt_coff->win32) *ep = yasm_expr_create(YASM_EXPR_ADD, yasm_expr_expr(*ep), @@ -478,16 +477,8 @@ coff_objfmt_output_expr(yasm_expr **ep, unsigned char *buf, size_t destsize, if (valsize == 32) { if (info->csd->flags2 & COFF_FLAG_NOBASE) reloc->type = COFF_RELOC_AMD64_ADDR32NB; - else if (!objfmt_coff->win64 || yasm_bc_is_data(bc)) + else reloc->type = COFF_RELOC_AMD64_ADDR32; - else { - /* I don't understand this, but ML64 generates REL32 - * for all instructions, regardless of whether they - * are RIP relative. Obviously this is either handled - * by the linker or by the compiler at a higher level! - */ - reloc->type = COFF_RELOC_AMD64_REL32; - } } else if (valsize == 64) reloc->type = COFF_RELOC_AMD64_ADDR64; else { diff --git a/modules/objfmts/win64/tests/win64-dataref.hex b/modules/objfmts/win64/tests/win64-dataref.hex index 02b53df6..fa604a6f 100644 --- a/modules/objfmts/win64/tests/win64-dataref.hex +++ b/modules/objfmts/win64/tests/win64-dataref.hex @@ -682,7 +682,7 @@ c4 00 00 00 -04 +02 00 07 00 @@ -712,7 +712,7 @@ c4 00 00 00 -04 +02 00 1f 00 @@ -752,7 +752,7 @@ c4 00 00 00 -04 +02 00 42 00 @@ -762,7 +762,7 @@ c4 00 00 00 -04 +02 00 48 00 @@ -782,7 +782,7 @@ c4 00 00 00 -04 +02 00 60 00 @@ -812,7 +812,7 @@ c4 00 00 00 -04 +02 00 83 00 @@ -822,7 +822,7 @@ c4 00 00 00 -04 +02 00 89 00 @@ -862,7 +862,7 @@ a1 00 00 00 -04 +02 00 a8 00 @@ -902,7 +902,7 @@ bf 00 00 00 -04 +02 00 c4 00 @@ -912,7 +912,7 @@ c4 00 00 00 -04 +02 00 ca 00 @@ -952,7 +952,7 @@ e2 00 00 00 -04 +02 00 e9 00 @@ -992,7 +992,7 @@ f8 00 00 00 -04 +02 00 05 01 @@ -1002,7 +1002,7 @@ f8 00 00 00 -04 +02 00 0b 01 @@ -1042,7 +1042,7 @@ f8 00 00 00 -04 +02 00 2a 01 @@ -1082,7 +1082,7 @@ f8 00 00 00 -04 +02 00 46 01 @@ -1092,7 +1092,7 @@ f8 00 00 00 -04 +02 00 4c 01 @@ -1132,7 +1132,7 @@ f8 00 00 00 -04 +02 00 6b 01 @@ -1172,7 +1172,7 @@ f8 00 00 00 -04 +02 00 87 01 @@ -1560,7 +1560,7 @@ b6 00 00 00 -04 +02 00 2d 00 @@ -1600,7 +1600,7 @@ b6 00 00 00 -04 +02 00 2e 66