From cd580fbca86e21cd40638acf1429ea7d8d8a0878 Mon Sep 17 00:00:00 2001 From: law Date: Fri, 31 Aug 2001 22:43:55 +0000 Subject: [PATCH] * config/tc-h8300.c (build_bytes): For OBJ_ELF, make relocation's offset match H8 ELF spec. (md_section_align): Alternate implementation for BFD_ASSEMBLER. (md_apply_fix): Fix argument and return types for BFD_ASSEMBLER. --- gas/ChangeLog | 5 +++++ gas/config/tc-h8300.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 5bb6f2b2af..d038b8c561 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -7,6 +7,11 @@ Fri Aug 31 12:05:13 2001 J"orn Rennecke Jeff Law + * config/tc-h8300.c (build_bytes): For OBJ_ELF, make relocation's + offset match H8 ELF spec. + (md_section_align): Alternate implementation for BFD_ASSEMBLER. + (md_apply_fix): Fix argument and return types for BFD_ASSEMBLER. + * tc-h8300.c (relocation mappings): Remove. Moved to tc-h8300.h. (build_bytes): Mark fixups for PCrel branches as signed. For OBJ_ELF, make sure the reloc's offset points to the first byte diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index 19ec6dff49..f4f5063054 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -1140,6 +1140,16 @@ build_bytes (this_try, operand) } else if (x & ABSJMP) { + int where = 0; + +#ifdef OBJ_ELF + /* To be compatible with the proposed H8 ELF format, we + want the relocation's offset to point to the first byte + that will be modified, not to the start of the instruction. */ + where += 1; + + +#endif /* This jmp may be a jump or a branch. */ check_operand (operand + i, Hmode ? 0xffffff : 0xffff, "@"); @@ -1152,7 +1162,7 @@ build_bytes (this_try, operand) operand[i].exp.X_add_number = ((operand[i].exp.X_add_number & 0xffff) ^ 0x8000) - 0x8000; fix_new_exp (frag_now, - output - frag_now->fr_literal, + output - frag_now->fr_literal + where, 4, &operand[i].exp, 0, @@ -1458,21 +1468,43 @@ md_convert_frag (headers, seg, fragP) abort (); } +#ifdef BFD_ASSEMBLER +valueT +md_section_align (segment, size) + segT segment; + valueT size; +{ + int align = bfd_get_section_alignment (stdoutput, segment); + return ((size + (1 << align) - 1) & (-1 << align)); +} +#else valueT md_section_align (seg, size) segT seg; valueT size; { return ((size + (1 << section_alignment[(int) seg]) - 1) - & (-1 << section_alignment[(int) seg])); + & (-1 << section_alignment[(int) seg])); } +#endif + +#ifdef BFD_ASSEMBLER +int +md_apply_fix (fixP, valp) + fixS *fixP; + valueT *valp; +#else void md_apply_fix (fixP, val) fixS *fixP; long val; +#endif { char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; +#ifdef BFD_ASSEMBLER + long val = *valp; +#endif switch (fixP->fx_size) { -- 2.11.0