From 082dbb471fdc6381965c6813a35fbff4a88b5020 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Tue, 27 May 2008 14:01:25 -0700 Subject: [PATCH] outcoff.c: remove dead code, add check for imagerel Remove commented-out (dead) code, add check that the imagerel references are valid. --- output/outcoff.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/output/outcoff.c b/output/outcoff.c index ae880cb2..4655e21f 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -566,16 +566,10 @@ static void coff_out(int32_t segto, const void *data, int32_t fix = 0; p = mydata; if (size == 8) { -/* if (segment != NO_SEG || wrt != NO_SEG) { - if (wrt != NO_SEG) { - error(ERR_NONFATAL, "COFF format does not support" - " WRT types"); - } else if (segment % 2) { - error(ERR_NONFATAL, "COFF format does not support" - " segment base references"); - } else - fix = coff_add_reloc(s, segment, false); - } */ + if (wrt == imagebase_sect) { + error(ERR_NONFATAL, "operand size mismatch: 'wrt " + WRT_IMAGEBASE "' is a 32-bit operand"); + } fix = coff_add_reloc(s, segment, IMAGE_REL_AMD64_ADDR64); WRITEDLONG(p, *(int64_t *)data + fix); coff_sect_write(s, mydata, size); -- 2.11.4.GIT