From f3751617c3f3f34e1edbbf0dc4b8650aad66e8cf Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 26 Oct 1993 21:58:41 +0000 Subject: [PATCH] * config/tc-m68k.c (md_apply_fix_2): Error if a short branch uses an illegal offset of 0 or -1. --- gas/ChangeLog | 3 +++ gas/config/tc-m68k.c | 12 +++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 0f665204f00..1d60a2d2fe7 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,8 @@ Tue Oct 26 16:58:36 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + * config/tc-m68k.c (md_apply_fix_2): Error if a short branch uses + an illegal offset of 0 or -1. + * config/obj-elf.c (obj_elf_init_stab_section): Align .stab section to a longword boundary. diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 5fe9ff9b7e9..0e9ddbe3c76 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -4032,7 +4032,17 @@ md_apply_fix_2 (fixP, val) upper_limit = upper_limit * 2 + 1; if ((unsigned) val > upper_limit && (val > 0 || val < lower_limit)) - as_bad ("value out of range"); + as_bad_where (fixP->fx_file, fixP->fx_line, "value out of range"); + + /* A one byte PC-relative reloc means a short branch. We can't use + a short branch with a value of 0 or -1, because those indicate + different opcodes (branches with longer offsets). */ + if (fixP->fx_pcrel + && fixP->fx_size == 1 + && (fixP->fx_addsy == NULL + || S_IS_DEFINED (fixP->fx_addsy)) + && (val == 0 || val == -1)) + as_bad_where (fixP->fx_file, fixP->fx_line, "invalid byte branch offset"); } #ifdef BFD_ASSEMBLER -- 2.30.2