From 66b935dacec7ebe6c5ba596d494ae6f6e357314e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 31 Jan 1996 19:06:17 +0000 Subject: [PATCH] Wed Jan 31 14:03:17 1996 Richard Henderson * configure.in (m68*-apple-aux*): New target. * config/te-aux.h: New file. * config/obj-coff.c (compare_external_relocs): New static function if TE_AUX. (do_relocs_for): Sort relocs if TE_AUX. (fixup_segment): If TE_AUX, store common symbol value in segment. * config/tc-m68k.h (TARGET_FORMAT): Define if TE_AUX. --- gas/ChangeLog | 10 ++++++++++ gas/config/.Sanitize | 1 + gas/config/obj-coff.c | 35 ++++++++++++++++++++++++++++++++--- gas/config/te-aux.h | 17 +++++++++++++++++ gas/configure | 34 ++++++++++++++++++---------------- gas/configure.in | 2 ++ 6 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 gas/config/te-aux.h diff --git a/gas/ChangeLog b/gas/ChangeLog index 4029a67107d..b51be41b8ed 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +Wed Jan 31 14:03:17 1996 Richard Henderson + + * configure.in (m68*-apple-aux*): New target. + * config/te-aux.h: New file. + * config/obj-coff.c (compare_external_relocs): New static function + if TE_AUX. + (do_relocs_for): Sort relocs if TE_AUX. + (fixup_segment): If TE_AUX, store common symbol value in segment. + * config/tc-m68k.h (TARGET_FORMAT): Define if TE_AUX. + Wed Jan 31 12:24:58 1996 Ian Lance Taylor * config/tc-mips.c (s_mips_globl): Set BSF_OBJECT if it is not diff --git a/gas/config/.Sanitize b/gas/config/.Sanitize index f7038cbc8f3..e25270ded6d 100644 --- a/gas/config/.Sanitize +++ b/gas/config/.Sanitize @@ -126,6 +126,7 @@ tc-w65.h tc-z8k.c tc-z8k.h te-386bsd.h +te-aux.h te-delta.h te-delt88.h te-dpx2.h diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index cb36264033c..04b8ad90432 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -1,5 +1,5 @@ /* coff object file format - Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994 + Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc. This file is part of GAS. @@ -1594,6 +1594,25 @@ count_entries_in_chain (idx) return nrelocs; } +#ifdef TE_AUX + +static int compare_external_relocs PARAMS ((const PTR, const PTR)); + +/* AUX's ld expects relocations to be sorted */ +static int +compare_external_relocs (x, y) + const PTR x; + const PTR y; +{ + struct external_reloc *a = (struct external_reloc *) x; + struct external_reloc *b = (struct external_reloc *) y; + bfd_vma aadr = bfd_getb32 (a->r_vaddr); + bfd_vma badr = bfd_getb32 (b->r_vaddr); + return (aadr < badr ? -1 : badr < aadr ? 1 : 0); +} + +#endif + /* output all the relocations for a section */ void do_relocs_for (abfd, h, file_cursor) @@ -1653,6 +1672,10 @@ do_relocs_for (abfd, h, file_cursor) intr.r_offset = 0; #endif + while (S_GET_SEGMENT (symbol_ptr) == undefined_section + && symbol_ptr->sy_value.X_op == O_symbol) + symbol_ptr = symbol_ptr->sy_value.X_add_symbol; + /* Turn the segment of the symbol into an offset. */ if (symbol_ptr) { @@ -1697,6 +1720,12 @@ do_relocs_for (abfd, h, file_cursor) fix_ptr = fix_ptr->fx_next; } +#ifdef TE_AUX + /* Sort the reloc table */ + qsort ((PTR) external_reloc_vec, nrelocs, + sizeof (struct external_reloc), compare_external_relocs); +#endif + /* Write out the reloc table */ bfd_write ((PTR) external_reloc_vec, 1, external_reloc_size, abfd); @@ -3053,7 +3082,7 @@ write_object_file () /* I think the section alignment is only used on the i960; the i960 needs it, and it should do no harm on other targets. */ - segment_info[i].scnhdr.s_align = section_alignment[i]; + segment_info[i].scnhdr.s_align = 1 << section_alignment[i]; if (i == SEG_E0) H_SET_TEXT_SIZE (&headers, size); @@ -3882,7 +3911,7 @@ fixup_segment (segP, this_segment_type) continue; } /* COBR */ #endif /* TC_I960 */ -#if (defined (TC_I386) || defined (TE_LYNX)) && !defined(TE_PE) +#if (defined (TC_I386) || defined (TE_LYNX) || defined (TE_AUX)) && !defined(TE_PE) /* 386 COFF uses a peculiar format in which the value of a common symbol is stored in the .text segment (I've checked this on SVR3.2 and SCO diff --git a/gas/config/te-aux.h b/gas/config/te-aux.h new file mode 100644 index 00000000000..b2d77596658 --- /dev/null +++ b/gas/config/te-aux.h @@ -0,0 +1,17 @@ +#define TE_AUX + +/* From obj-coff.h: + This internal_lineno crap is to stop namespace pollution from the + bfd internal coff headerfile. */ +#define internal_lineno bfd_internal_lineno +#include "coff/aux.h" /* override bits in coff/internal.h */ +#undef internal_lineno + +#define COFF_NOLOAD_PROBLEM +#define KEEP_RELOC_INFO + +#include "obj-format.h" + +#ifndef LOCAL_LABELS_FB +#define LOCAL_LABELS_FB 1 +#endif diff --git a/gas/configure b/gas/configure index 34cb0dae2ef..8737f60b97a 100755 --- a/gas/configure +++ b/gas/configure @@ -818,6 +818,7 @@ for this_target in $target $canon_targets ; do em=lynx ;; i386-*-sysv4* | i386-*-solaris* | i386-*-elf) fmt=elf ;; + i386-*-sco*elf*) fmt=elf targ=sco5 ;; i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) fmt=coff targ=i386coff ;; i386-*-vsta) fmt=aout ;; @@ -851,6 +852,7 @@ for this_target in $target $canon_targets ; do m68k-*-lynxos*) fmt=coff targ=m68kcoff em=lynx ;; m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;; + m68*-apple-aux*) fmt=coff targ=m68kcoff em=aux ;; m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;; m88k-*-coff*) fmt=coff targ=m88kcoff ;; @@ -1439,7 +1441,7 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error @@ -1453,7 +1455,7 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error @@ -1486,7 +1488,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1538,7 +1540,7 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < int main() { return 0; } @@ -1594,7 +1596,7 @@ if eval "test \"`echo '$''{'ac_cv_func_alloca'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext < #include @@ -1982,7 +1984,7 @@ if eval "test \"`echo '$''{'gas_cv_decl_needed_malloc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <&6 else cat > conftest.$ac_ext <