From 2586cee21dfc45c24b1bec47c0e0f7ddfae3dca8 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Fri, 16 Aug 2019 01:42:26 -0700 Subject: BR 3392472: don't complain on wraparound for lower bit modes If the address we are using is >= the size of the instruction, then don't complain on overflow as we can wrap around the top and bottom of the address space just fine. Alternatively we could downgrade it to OUT_WRAP in that case. Reported-by: C. Masloch Signed-off-by: H. Peter Anvin (Intel) --- asm/assemble.c | 3 ++- test/br3392472.asm | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/br3392472.asm diff --git a/asm/assemble.c b/asm/assemble.c index e24ebdb5..2394e765 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -376,7 +376,8 @@ static void out(struct out_data *data) amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */ if ((ofmt->flags & OFMT_KEEP_ADDR) == 0 && data->tsegment == fixseg && data->twrt == NO_SEG) { - warn_overflow_out(addrval, asize, data->sign); + if (asize < (data->bits >> 3)) + warn_overflow_out(addrval, asize, data->sign); xdata.q = cpu_to_le64(addrval); data->data = xdata.b; data->type = OUT_RAWDATA; diff --git a/test/br3392472.asm b/test/br3392472.asm new file mode 100644 index 00000000..7f326eaa --- /dev/null +++ b/test/br3392472.asm @@ -0,0 +1,12 @@ +org 0 +%ifndef SEEK + %define SEEK 0 +%endif +times SEEK - ($ - $$) nop +jmp near init + +%ifndef NUM + %define NUM 9956h +%endif +times NUM - ($ - $$) db 0 +init: -- cgit v1.2.3