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)
{
/*@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
if (valsize == 32) {
if (info->csd->flags2 & COFF_FLAG_NOBASE)
reloc->type = COFF_RELOC_AMD64_ADDR32NB;
- else
+ else if (yasm_bc_is_data(bc))
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 {