From 305a3af6e39da4cc700dbe1649e374e4178dad49 Mon Sep 17 00:00:00 2001 From: Steve Chamberlain Date: Thu, 31 Aug 1995 23:46:47 +0000 Subject: [PATCH] Thu Aug 31 16:41:06 1995 steve chamberlain * write.c (fixup_segment): Remove change of 29th. * config/tc-{i386,arm}.h (TC_FORCE_RELOCATION): Keep RVA relocs. --- gas/ChangeLog | 5 +++ gas/config/tc-arm.h | 106 +++++++++++++++++++++++++++++++++++++++++++ gas/write.c | 107 ++++++++++++++++++++------------------------ 3 files changed, 160 insertions(+), 58 deletions(-) create mode 100644 gas/config/tc-arm.h diff --git a/gas/ChangeLog b/gas/ChangeLog index 0f2c8c48f91..5ddba4bfe86 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 31 16:41:06 1995 steve chamberlain + + * write.c (fixup_segment): Remove change of 29th. + * config/tc-{i386,arm}.h (TC_FORCE_RELOCATION): Keep RVA relocs. + Tue Aug 29 19:42:58 1995 Andreas Schwab * config/tc-m68k.c (m68k_ip) [case POST/PRE/BASE]: Fix typo when diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h new file mode 100644 index 00000000000..cfb8bce355b --- /dev/null +++ b/gas/config/tc-arm.h @@ -0,0 +1,106 @@ +/* This file is tc-arm.h + Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) + Modified by David Taylor (dtaylor@armltd.co.uk) + + Copyright (C) 1994, 1995 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#define TC_ARM 1 + +#define COFF_MAGIC ARMMAGIC +#define TARGET_ARCH bfd_arch_arm + +#define AOUT_MACHTYPE 0 + +#define DIFF_EXPR_OK + +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 + +/* If neither TARGET_BYTES_BIG_ENDIAN nor TARGET_BYTES_LITTLE_ENDIAN + is specified, default to little endian. */ +#ifndef TARGET_BYTES_BIG_ENDIAN +#ifndef TARGET_BYTES_LITTLE_ENDIAN +#define TARGET_BYTES_LITTLE_ENDIAN +#endif +#endif + +#ifdef OBJ_AOUT +#ifdef TE_RISCIX +#define TARGET_FORMAT "a.out-riscix" +#else +#ifdef TARGET_BYTES_BIG_ENDIAN +#define TARGET_FORMAT "a.out-arm-big" +#else +#define TARGET_FORMAT "a.out-arm-little" +#endif +#endif +#endif + +#ifdef OBJ_AIF +#define TARGET_FORMAT "aif" +#endif + +#ifdef OBJ_COFF +#ifdef TE_PE +#define TC_FORCE_RELOCATION(x) ((x)->fx_r_type==11) +#define TARGET_FORMAT (target_big_endian ? "pe-arm-big" : "pe-arm-little") +/* Tell tc-arm.c to support runtime endian selection. */ +#define ARM_BI_ENDIAN +#endif +#endif + +#define md_convert_frag(b,s,f) {as_fatal ("arm convert_frag\n");} + +#define md_after_pass_hook() arm_after_pass_hook () +#define md_start_line_hook() arm_start_line_hook () +#define tc_frob_label(S) arm_frob_label (S) + +#define obj_fix_adjustable(fixP) 0 + +#if 0 /* It isn't as simple as this */ +#define tc_frob_symbol(sym,punt) \ +{ if (S_IS_LOCAL (sym)) \ + { \ + punt = 1; \ + sym->sy_used_in_reloc = 0; \ + }} +#endif + +#if 0 +#define tc_crawl_symbol_chain(a) {;} /* not used */ +#define tc_headers_hook(a) {;} /* not used */ +#endif + +#define tc_aout_pre_write_hook(x) {;} /* not used */ + +#define LISTING_HEADER "ARM GAS " + +#define OPTIONAL_REGISTER_PREFIX '%' + +#define md_operand(x) + +#define LOCAL_LABELS_FB 1 + +/* Use defaults for OBJ_AOUT. */ +#ifndef OBJ_AOUT +#define LOCAL_LABEL(name) ((name)[0] == '.' && (name)[1] == 'L') +#define FAKE_LABEL_NAME ".L0\001" +#endif + +/* end of tc-arm.h */ diff --git a/gas/write.c b/gas/write.c index ed6f0cb171d..25399906827 100644 --- a/gas/write.c +++ b/gas/write.c @@ -940,66 +940,56 @@ write_contents (abfd, sec, xxx) count = f->fr_offset; assert (count >= 0); if (fill_size && count) -#ifdef BFD_FAST_SECTION_FILL { char buf[256]; - if (fill_size > sizeof(buf)) { - /* Do it the old way. Can this ever happen? */ - while (count--) - { - x = bfd_set_section_contents (stdoutput, sec, - fill_literal, (file_ptr) offset, - (bfd_size_type) fill_size); - if (x == false) - { - bfd_perror (stdoutput->filename); - as_perror ("FATAL: Can't write %s", stdoutput->filename); - exit (EXIT_FAILURE); - } - offset += fill_size; - } - } - else { - /* Build a buffer full of fill objects and output it as - * often as necessary. This saves on the overhead of potentially - * lots of bfd_set_section_contents calls. - */ - int n_per_buf, i; - if (fill_size == 1) - { - n_per_buf = sizeof (buf); - memset (buf, *fill_literal, n_per_buf); - } - else - { - char *bufp; - n_per_buf = sizeof(buf)/fill_size; - for (i = n_per_buf, bufp = buf; i; i--, bufp += fill_size) - memcpy(bufp, fill_literal, fill_size); - } - for (; count > 0; count -= n_per_buf) - { - n_per_buf = n_per_buf > count ? count : n_per_buf; - x = bfd_set_section_contents (stdoutput, sec, - buf, (file_ptr) offset, - (bfd_size_type) n_per_buf * fill_size); - if (x != true) - as_fatal ("Cannot write to output file."); - offset += n_per_buf * fill_size; - } - } + if (fill_size > sizeof(buf)) + { + /* Do it the old way. Can this ever happen? */ + while (count--) + { + x = bfd_set_section_contents (stdoutput, sec, + fill_literal, + (file_ptr) offset, + (bfd_size_type) fill_size); + if (x == false) + { + bfd_perror (stdoutput->filename); + as_perror ("FATAL: Can't write %s", stdoutput->filename); + exit (EXIT_FAILURE); + } + offset += fill_size; + } + } + else + { + /* Build a buffer full of fill objects and output it as + often as necessary. This saves on the overhead of + potentially lots of bfd_set_section_contents calls. */ + int n_per_buf, i; + if (fill_size == 1) + { + n_per_buf = sizeof (buf); + memset (buf, *fill_literal, n_per_buf); + } + else + { + char *bufp; + n_per_buf = sizeof(buf)/fill_size; + for (i = n_per_buf, bufp = buf; i; i--, bufp += fill_size) + memcpy(bufp, fill_literal, fill_size); + } + for (; count > 0; count -= n_per_buf) + { + n_per_buf = n_per_buf > count ? count : n_per_buf; + x = bfd_set_section_contents (stdoutput, sec, + buf, (file_ptr) offset, + (bfd_size_type) n_per_buf * fill_size); + if (x != true) + as_fatal ("Cannot write to output file."); + offset += n_per_buf * fill_size; + } + } } -#else - while (count--) - { - x = bfd_set_section_contents (stdoutput, sec, - fill_literal, (file_ptr) offset, - (bfd_size_type) fill_size); - if (x != true) - as_fatal ("Cannot write to output file."); - offset += fill_size; - } -#endif } } #endif @@ -2332,7 +2322,8 @@ fixup_segment (fixP, this_segment_type) /* Let the target machine make the final determination as to whether or not a relocation will be needed to handle this fixup. */ - if (!TC_FORCE_RELOCATION (fixP)) + + if (TC_FORCE_RELOCATION (fixP)) { fixP->fx_addsy = NULL; add_symbolP = NULL; -- 2.30.2