From: K. Richard Pixley Date: Thu, 15 Aug 1991 20:34:42 +0000 (+0000) Subject: Corrected relocation overflow checks. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=60b6e7da1f8e434af20a4bb1a29985faec04f850;p=binutils-gdb.git Corrected relocation overflow checks. --- diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index c23138e3043..75935132b8f 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -1299,7 +1299,7 @@ long val; #ifndef NO_V9 case RELOC_11: if (((val > 0) && (val & ~0x7ff)) - || ((val < 0) && (~val & ~0x7ff))) { + || ((val < 0) && (~(val - 1) & ~0x7ff))) { as_bad("relocation overflow."); } /* on overflow */ @@ -1309,7 +1309,7 @@ long val; case RELOC_WDISP2_14: if (((val > 0) && (val & ~0x3fffc)) - || ((val < 0) && (~val & ~0x3fffc))) { + || ((val < 0) && (~(val - 1) & ~0x3fffc))) { as_bad("relocation overflow."); } /* on overflow */ @@ -1321,7 +1321,7 @@ long val; case RELOC_WDISP19: if (((val > 0) && (val & ~0x1ffffc)) - || ((val < 0) && (~val & ~0x1ffffc))) { + || ((val < 0) && (~(val - 1) & ~0x1ffffc))) { as_bad("relocation overflow."); } /* on overflow */