From a9a675966b01b17739c927872b25e6585b209342 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 9 Nov 1995 21:15:10 +0000 Subject: [PATCH] * config/tc-a29k.c (md_apply_fix): Warn if an attempt is made to generate a reloc which the linker will not handle correctly. Fix overflow checking--R_IREL is 18 bits, not 17. --- gas/config/tc-a29k.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c index 015d90193cf..4c24f9e52a1 100644 --- a/gas/config/tc-a29k.c +++ b/gas/config/tc-a29k.c @@ -851,11 +851,21 @@ md_apply_fix (fixP, val) case RELOC_JUMPTARG: /* 00XX00XX pattern in a word */ if (!fixP->fx_done) - /* let linker deal */ - ; + { + /* The linker tries to support both AMD and old GNU style + R_IREL relocs. That means that if the addend is exactly + the negative of the address within the section, the + linker will not handle it correctly. */ + if (fixP->fx_pcrel + && val != 0 + && val == - (fixP->fx_frag->fr_address + fixP->fx_where)) + as_bad_where + (fixP->fx_file, fixP->fx_line, + "the linker will not handle this relocation correctly"); + } else if (fixP->fx_pcrel) { - long v = val >> 16; + long v = val >> 17; if (v != 0 && v != -1) as_bad_where (fixP->fx_file, fixP->fx_line, "call/jmp target out of range");