applied patch to bring it in sync with latest CVS head

This commit is contained in:
Jens Maus
2006-03-16 00:07:44 +00:00
parent ee7d707911
commit d6af3b0691
40 changed files with 2385 additions and 3091 deletions
+5 -3
View File
@@ -979,12 +979,14 @@ cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
amigaos.lo: amigaos.c libamiga.h bfd.h
amigaoslink.lo: bfd.h libamiga.h amigaoslink.c
aout-amiga.lo: aout-amiga.c aoutf1.h bfd.h
amigaos.lo: amigaos.c libamiga.h
amigaoslink.lo: amigaoslink.c $(INCDIR)/bfdlink.h genlink.h libamiga.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
$(INCDIR)/bfdlink.h
aout-amiga.lo: aout-amiga.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+5 -3
View File
@@ -1508,12 +1508,14 @@ cpu-w65.lo: cpu-w65.c $(INCDIR)/filenames.h
cpu-xstormy16.lo: cpu-xstormy16.c $(INCDIR)/filenames.h
cpu-xtensa.lo: cpu-xtensa.c $(INCDIR)/filenames.h
cpu-z8k.lo: cpu-z8k.c $(INCDIR)/filenames.h
amigaos.lo: amigaos.c libamiga.h bfd.h
amigaoslink.lo: bfd.h libamiga.h amigaoslink.c
aout-amiga.lo: aout-amiga.c aoutf1.h bfd.h
amigaos.lo: amigaos.c libamiga.h
amigaoslink.lo: amigaoslink.c $(INCDIR)/bfdlink.h genlink.h libamiga.h
aout-adobe.lo: aout-adobe.c $(INCDIR)/filenames.h $(INCDIR)/aout/adobe.h \
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h \
$(INCDIR)/bfdlink.h
aout-amiga.lo: aout-amiga.c libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
aout-arm.lo: aout-arm.c $(INCDIR)/filenames.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h aoutx.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
+1250 -1385
View File
File diff suppressed because it is too large Load Diff
+485 -574
View File
File diff suppressed because it is too large Load Diff
+107 -22
View File
@@ -1,6 +1,6 @@
/* BFD backend for Amiga style a.out with flags set to 0
Copyright (C) 1990, 91, 92, 93, 1994 Free Software Foundation, Inc.
Written by Stephan Thesing.
/* BFD back-end for Amiga style m68k a.out binaries.
Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
Contributed by Stephan Thesing.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,6 +19,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define TARGETNAME "a.out-amiga"
#define MACHTYPE_OK(m) ((m)==M_UNKNOWN || (m)==M_68010 || (m)==M_68020)
#define TARGET_IS_BIG_ENDIAN_P
#define TARGET_PAGE_SIZE 0x2000
#define N_HEADER_IN_TEXT(x) 0
#define N_SHARED_LIB(x) 0
#define TEXT_START_ADDR 0
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
remove whitespace added here, and thus will fail to concatenate
@@ -26,27 +32,106 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define MY(OP) CONCAT2 (aout_amiga_,OP)
#include "bfd.h"
#define MY_exec_hdr_flags 0
extern bfd_boolean
amiga_final_link(bfd *,struct bfd_link_info *);
#define MY_bfd_final_link amiga_final_link
extern bfd_byte *
get_relocated_section_contents(bfd *, struct bfd_link_info *,
struct bfd_link_order *, bfd_byte *,
bfd_boolean , asymbol **);
#define MY_bfd_get_relocated_section_contents get_relocated_section_contents
/* Include the usual a.out support. */
#include "aoutf1.h"
/* Final link routine. We need to use a call back to get the correct
offsets in the output file. */
#include "sysdep.h"
#include "libbfd.h"
#include "libaout.h"
#include "aout/aout64.h"
bfd_boolean
amiga_aout_bfd_final_link (abfd, info)
MY(final_link) PARAMS ((bfd *, struct bfd_link_info *));
bfd_boolean
amiga_final_link PARAMS ((bfd *, struct bfd_link_info *));
#define MY_bfd_final_link amiga_final_link
bfd_byte *
get_relocated_section_contents PARAMS ((bfd *, struct bfd_link_info *,
struct bfd_link_order *, bfd_byte *, bfd_boolean, asymbol **));
#define MY_bfd_get_relocated_section_contents get_relocated_section_contents
static unsigned long MY(get_mach) PARAMS ((enum machine_type));
static bfd_boolean MY(write_object_contents) PARAMS ((bfd *));
static bfd_boolean MY(set_sizes) PARAMS ((bfd *));
static unsigned long
MY(get_mach) (machtype)
enum machine_type machtype;
{
unsigned long machine;
switch (machtype)
{
default:
case M_UNKNOWN:
/* Some Sun3s make magic numbers without cpu types in them, so
we'll default to the 68000. */
machine = bfd_mach_m68000;
break;
case M_68010:
machine = bfd_mach_m68010;
break;
case M_68020:
machine = bfd_mach_m68020;
break;
}
return machine;
}
#define SET_ARCH_MACH(ABFD, EXEC) \
bfd_set_arch_mach (ABFD, bfd_arch_m68k, MY(get_mach) (N_MACHTYPE (EXEC)))
static bfd_boolean
MY(write_object_contents) (abfd)
bfd *abfd;
{
struct external_exec exec_bytes;
struct internal_exec *execp = exec_hdr (abfd);
/* Magic number, maestro, please! */
switch (bfd_get_arch (abfd))
{
case bfd_arch_m68k:
switch (bfd_get_mach (abfd))
{
case bfd_mach_m68000:
N_SET_MACHTYPE (*execp, M_UNKNOWN);
break;
case bfd_mach_m68010:
N_SET_MACHTYPE (*execp, M_68010);
break;
default:
case bfd_mach_m68020:
N_SET_MACHTYPE (*execp, M_68020);
break;
}
break;
default:
N_SET_MACHTYPE (*execp, M_UNKNOWN);
}
WRITE_HEADERS (abfd, execp);
return TRUE;
}
#define MY_write_object_contents MY(write_object_contents)
static bfd_boolean
MY(set_sizes) (abfd)
bfd *abfd;
{
adata (abfd).page_size = TARGET_PAGE_SIZE;
adata (abfd).segment_size = TARGET_PAGE_SIZE;
adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return TRUE;
}
#define MY_set_sizes MY(set_sizes)
/* Include the usual a.out support. */
#include "aout-target.h"
/* Public final_link routine. */
bfd_boolean
MY(final_link) (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
+12 -15
View File
@@ -2066,27 +2066,24 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr)
PUT_WORD (abfd, g->address, natptr->r_address);
r_length = g->howto->size ; /* Size as a power of two */
r_length = g->howto->size ; /* Size as a power of two. */
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
#if 1
/* FIXME! "#if 1" is the wrong way to select this Amiga specific code.
We can't just test for __amigaos__ defined either, since we may be
building a cross compiler and __amigaos__ is only defined if the
compiler we are using is targeted for the Amiga. */
/* Changed for cooperation with AMIGA backend */
/* This only applies, if aout flavour 191194 ST*/
/* XXX This relies on relocs coming from a.out files. */
if (bfd_asymbol_bfd(sym)->xvec->flavour==bfd_target_aout_flavour)
{
r_baserel = (g->howto->type & 8) != 0;
r_jmptable = (g->howto->type & 16) != 0;
r_relative = (g->howto->type & 32) != 0;
}
else
/* FIXME! "#if 1" is the wrong way to select this Amiga specific code. */
switch (bfd_asymbol_bfd(sym)->xvec->flavour)
{
case bfd_target_amiga_flavour:
case bfd_target_aout_flavour:
r_baserel = (g->howto->type & 8) != 0;
r_jmptable = (g->howto->type & 16) != 0;
r_relative = (g->howto->type & 32) != 0;
break;
default:
r_baserel=r_jmptable=r_relative=0;
break;
}
#else
/* XXX This relies on relocs coming from a.out files. */
r_baserel = (g->howto->type & 8) != 0;
r_jmptable = (g->howto->type & 16) != 0;
r_relative = (g->howto->type & 32) != 0;
+2 -3
View File
@@ -3485,8 +3485,7 @@ assembler-expanded instructions. This is commonly used
internally by the linker after analysis of a
BFD_RELOC_XTENSA_ASM_EXPAND. */
BFD_RELOC_XTENSA_ASM_SIMPLIFY,
BFD_RELOC_UNUSED};
BFD_RELOC_UNUSED };
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
reloc_howto_type *
bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
@@ -3817,12 +3816,12 @@ struct bfd
struct cisco_core_struct *cisco_core_data;
struct versados_data_struct *versados_data;
struct netbsd_core_struct *netbsd_core_data;
struct amiga_data_struct *amiga_data;
struct mach_o_data_struct *mach_o_data;
struct mach_o_fat_data_struct *mach_o_fat_data;
struct bfd_pef_data_struct *pef_data;
struct bfd_pef_xlib_data_struct *pef_xlib_data;
struct bfd_sym_data_struct *sym_data;
struct amiga_data_struct *amiga_data;
PTR any;
}
tdata;
+1 -1
View File
@@ -183,12 +183,12 @@ CODE_FRAGMENT
. struct cisco_core_struct *cisco_core_data;
. struct versados_data_struct *versados_data;
. struct netbsd_core_struct *netbsd_core_data;
. struct amiga_data_struct *amiga_data;
. struct mach_o_data_struct *mach_o_data;
. struct mach_o_fat_data_struct *mach_o_fat_data;
. struct bfd_pef_data_struct *pef_data;
. struct bfd_pef_xlib_data_struct *pef_xlib_data;
. struct bfd_sym_data_struct *sym_data;
. struct amiga_data_struct *amiga_data;
. PTR any;
. }
. tdata;
+1 -1
View File
@@ -544,8 +544,8 @@ do
# use one entry per line, even though this leads to long lines.
a29kcoff_big_vec) tb="$tb coff-a29k.lo cofflink.lo" ;;
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
amiga_vec) tb="$tb amigaos.lo amigaoslink.lo" ;;
aix5coff64_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
amiga_vec) tb="$tb amigaos.lo amigaoslink.lo" ;;
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
aout_amiga_vec) tb="$tb aout-amiga.lo aout32.lo";;
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
+93 -128
View File
@@ -1,7 +1,8 @@
/* BFD back-end data structures for AmigaOS.
Copyright (C) 1992-1994 Free Software Foundation, Inc.
/* BFD back-end for Commodore-Amiga AmigaOS binaries. Data structures.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998
Free Software Foundation, Inc.
Contributed by Leonard Norrgard.
Extended by Stephan Thesing Nov 94
Extended by Stephan Thesing 11/1994.
This file is part of BFD, the Binary File Descriptor library.
@@ -19,20 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef __STDC__
#define CAT3(a,b,c) a##b##c
#else
#define CAT3(a,b,c) a/**/b/**/c
#endif
/* Hunk ID numbers. */
#define GET_WORD bfd_h_get_32
#define GET_SWORD (int32_type)GET_WORD
#define PUT_WORD bfd_h_put_32
#define NAME(x,y) CAT3(x,_32_,y)
#define JNAME(x) CAT(x,_32)
#define BYTES_IN_WORD 4
/* Hunk ID numbers.*/
#define HUNK_UNIT 999
#define HUNK_NAME 1000
#define HUNK_CODE 1001
@@ -49,7 +38,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HUNK_DEBUG 1009
#define HUNK_END 1010
#define HUNK_HEADER 1011
#define HUNK_HEADER_POS (0x00001000 | 1011)
#define HUNK_OVERLAY 1013
#define HUNK_BREAK 1014
#define HUNK_DREL32 1015
@@ -60,6 +48,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HUNK_RELOC32SHORT 1020
#define HUNK_RELRELOC32 1021
#define HUNK_ABSRELOC16 1022
/* EHF extensions */
#define HUNK_PPC_CODE 1257
#define HUNK_RELRELOC26 1260
/* The hunk ID part. */
@@ -68,9 +59,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Attributes of a hunk. */
#define HUNK_ATTRIBUTE(hunk_id) ((hunk_id) >> 30)
#define HUNK_ATTR_CHIP 0x01 /* Hunk contents must go into chip ram. */
#define HUNK_ATTR_CHIP 0x01 /* hunk content must go into chip ram */
#define HUNK_ATTR_FAST 0x02 /* fast */
#define HUNK_ATTR_FOLLOWS 0x03 /* Mem id follows */
#define HUNK_ATTR_FOLLOWS 0x03 /* mem id follows */
/* HUNK_EXT subtypes. */
#define EXT_SYMB 0
#define EXT_DEF 1
@@ -85,16 +78,26 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define EXT_REF8 132
#define EXT_RELREF8 EXT_REF8
#define EXT_DEXT32 133
#define EXT_DREF32 EXT_DEXT32
#define EXT_DEXT16 134
#define EXT_DREF16 EXT_DEXT16
#define EXT_DEXT8 135
#define EXT_DREF8 EXT_DEXT8
#define EXT_RELREF32 136
#define EXT_RELCOMMON 137
#define EXT_ABSREF16 138
#define EXT_ABSREF8 139
/* VBCC extensions */
#define EXT_DEXT32COMMON 208
#define EXT_DEXT16COMMON 209
#define EXT_DEXT8COMMON 210
/* EHF extensions */
#define EXT_RELREF26 229
/* HOWTO types almost matching aoutx.h/howto_table_std. */
enum {
H_ABS8=0,H_ABS16,H_ABS32,H_ABS32SHORT,H_PC8,H_PC16,H_PC32,H_PC26,H_SD8,H_SD16,H_SD32
};
/* Various structures. */
typedef struct amiga_reloc {
arelent relent;
@@ -105,120 +108,82 @@ typedef struct amiga_reloc {
typedef struct amiga_symbol {
asymbol symbol;
/* struct amiga_symbol *next;*/
unsigned short hunk_number;
long index;
/* these come from a.out. Not used yet, but needed to compile */
short desc;
char other;
unsigned char type;
/* amiga data */
long index,hunk_number;
} amiga_symbol_type;
struct amiga_raw_symbol {
struct amiga_raw_symbol *next;
unsigned long data[1];
};
typedef struct amiga_per_section
{
amiga_reloc_type *reloc_tail; /* last reloc */ /* first is in section->relocation */
int attribute; /* Memory type required by this section */
unsigned long disk_size; /* Section size on disk. _raw_size may be larger than this */
int max_raw_relocs; /* Size of array */
unsigned long int num_raw_relocs8, num_raw_relocs16, num_raw_relocs32;
unsigned long raw_relocs8, raw_relocs16, raw_relocs32;
struct amiga_raw_symbol *first;
struct amiga_raw_symbol *last; /* tail */
/* the symbols for this section */
amiga_symbol_type *amiga_symbols;
unsigned long hunk_ext_pos; /* offset of hunk_ext in the bfd file */
unsigned long hunk_symbol_pos; /* offset of hunk_symbol in the bfd file */
} amiga_per_section_type;
#define amiga_per_section(x) ((amiga_per_section_type *)((x)->used_by_bfd))
/* The `tdata' struct for all a.out-like object file formats.
Various things depend on this struct being around any time an a.out
file is being handled. An example is dbxread.c in GDB. */
struct amiga_data {
struct internal_exec *hdr; /* exec file header */
amiga_symbol_type *symbols; /* symtab for input bfd */
/* Filler, so we can pretend to be an a.out to GDB. */
asection *textsec;
asection *datasec;
asection *bsssec;
int nb_hunks; /* number of hunks in the file */
/* The positions of the string table and symbol table. */
file_ptr sym_filepos;
file_ptr str_filepos;
unsigned int n_symbols; /* number of symbols */
/* Size of a relocation entry in external form */
unsigned dummy_reloc_entry_size;
/* Size of a symbol table entry in external form */
unsigned symbol_entry_size;
unsigned exec_bytes_size;
unsigned vma_adjusted : 1;
};
typedef struct amiga_data_struct {
struct amiga_data a;
unsigned long symtab_size;
unsigned long stringtab_size;
unsigned long *first_byte;
unsigned long *file_end;
unsigned long *file_pointer;
amiga_symbol_type *symbols;
amiga_symbol_type *symbol_tail;
bfd_boolean IsLoadFile; /* If true, this is a load file (for output bfd only) */
int maxsymbols; /* Used by final_link routine to add symbols to output bfd.
This is the # of entries, allocated in abdfd->osymbols */
int nb_hunks;
/* The next two fields are set at final_link time
for the output bfd only */
bfd_boolean baserel; /* true if there is ___init_a4 in the global hash table */
bfd_vma a4init; /* cache the value for efficiency */
} amiga_data_type;
struct arch_syms {
unsigned long offset; /* disk offset in the archive */
unsigned long size; /* size of the block of symbols */
unsigned long unit_offset; /* start of unit on disk */
struct arch_syms *next; /* linked list */
};
#define adata(bfd) ((bfd)->tdata.amiga_data->a)
/* We take the address of the first element of an asymbol to ensure that the
macro is only ever applied to an asymbol */
#define amiga_symbol(asymbol) ((amiga_symbol_type *)(&(asymbol)->the_bfd))
#define AMIGA_DATA(abfd) ((abfd)->tdata.amiga_data)
typedef struct raw_reloc {
unsigned long num,pos;
struct raw_reloc *next;
} raw_reloc_type;
#define HUNKB_ADVISORY 29
#define HUNKB_CHIP 30
#define HUNKB_FAST 31
#define HUNKF_ADVISORY (1L << HUNKB_ADVISORY)
#define HUNKF_CHIP (1L << HUNKB_CHIP)
#define HUNKF_FAST (1L << HUNKB_FAST)
typedef struct amiga_per_section {
amiga_reloc_type *reloc_tail; /* last reloc, first is in section->relocation */
int attribute; /* Memory type required by this section */
unsigned long disk_size; /* Section size on disk, _raw_size may be larger than this */
amiga_symbol_type *amiga_symbols; /* the symbols for this section */
unsigned long hunk_ext_pos; /* offset of hunk_ext in the bfd file */
unsigned long hunk_symbol_pos; /* offset of hunk_symbol in the bfd file */
raw_reloc_type *relocs;
} amiga_per_section_type;
#define MEMF_ANY (0L)
#define MEMF_PUBLIC (1L << 0)
#define MEMF_CHIP (1L << 1)
#define MEMF_FAST (1L << 2)
#define MEMF_LOCAL (1L << 8)
#define MEMF_24BITDMA (1L << 9)
#define MEMF_KICK (1L << 10)
#define MEMF_CLEAR (1L << 16)
#define MEMF_LARGEST (1L << 17)
#define MEMF_REVERSE (1L << 18)
#define MEMF_TOTAL (1L << 19)
#define MEMF_NO_EXPUNGE (1L << 31)
#define amiga_per_section(x) ((amiga_per_section_type *)((x)->used_by_bfd))
/* The `tdata' struct for all a.out-like object file formats.
Various things depend on this struct being around any time an a.out
file is being handled. An example is dbxread.c in GDB. */
/* Structure layout *must* match <<libaout.h/struct aoutdata>> */
struct amiga_data {
char *dummy[2];
sec_ptr textsec;
sec_ptr datasec;
sec_ptr bsssec;
file_ptr sym_filepos;
file_ptr str_filepos;
/* rest intentionally omitted */
};
typedef struct amiga_data_struct {
struct amiga_data a;
unsigned long symtab_size;
unsigned long stringtab_size;
amiga_symbol_type *symbols;
bfd_boolean IsLoadFile; /* If true, this is a load file (for output bfd only) */
unsigned int nb_hunks;
/* The next two fields are set at final_link time (for the output bfd only) */
bfd_boolean baserel;/* true if there is ___init_a4 in the global hash table */
bfd_vma a4init; /* cache the value for efficiency */
} amiga_data_type;
#define adata(bfd) ((bfd)->tdata.amiga_data->a)
#define AMIGA_DATA(bfd) ((bfd)->tdata.amiga_data)
#define HUNKB_ADVISORY 29
#define HUNKB_CHIP 30
#define HUNKB_FAST 31
#define HUNKF_ADVISORY (1L << HUNKB_ADVISORY)
#define HUNKF_CHIP (1L << HUNKB_CHIP)
#define HUNKF_FAST (1L << HUNKB_FAST)
#ifndef MEMF_ANY
#define MEMF_ANY (0L)
#define MEMF_PUBLIC (1L << 0)
#define MEMF_CHIP (1L << 1)
#define MEMF_FAST (1L << 2)
#define MEMF_LOCAL (1L << 8)
#define MEMF_24BITDMA (1L << 9)
#define MEMF_KICK (1L << 10)
#define MEMF_CLEAR (1L << 16)
#define MEMF_LARGEST (1L << 17)
#define MEMF_REVERSE (1L << 18)
#define MEMF_TOTAL (1L << 19)
#define MEMF_NO_EXPUNGE (1L << 31)
#endif /* MEMF_ANY */
-1
View File
@@ -1493,7 +1493,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_XTENSA_OP2",
"BFD_RELOC_XTENSA_ASM_EXPAND",
"BFD_RELOC_XTENSA_ASM_SIMPLIFY",
"@@overflow: BFD_RELOC_UNUSED@@",
};
#endif
+2 -2
View File
@@ -2482,7 +2482,7 @@ ENUMX
BFD_RELOC_PPC64_DTPREL16_HIGHESTA
ENUMDOC
PowerPC and PowerPC64 thread-local storage relocations.
ENUMX
BFD_RELOC_PPC_AMIGAOS_BREL
ENUMX
@@ -2493,7 +2493,7 @@ ENUMX
BFD_RELOC_PPC_AMIGAOS_BREL_HA
ENUMDOC
AmigaOS4 PowerPC specific relocations.
ENUM
BFD_RELOC_I370_D12
ENUMDOC
+2 -2
View File
@@ -489,9 +489,9 @@ to find an alternative output format that is suitable.
extern const bfd_target a29kcoff_big_vec;
extern const bfd_target a_out_adobe_vec;
extern const bfd_target aix5coff64_vec;
extern const bfd_target aout0_big_vec;
extern const bfd_target amiga_vec;
extern const bfd_target aout_amiga_vec;
extern const bfd_target aout0_big_vec;
extern const bfd_target aout_arm_big_vec;
extern const bfd_target aout_arm_little_vec;
extern const bfd_target aout_mips_big_vec;
@@ -769,9 +769,9 @@ static const bfd_target * const _bfd_target_vector[] = {
#ifdef BFD64
&aix5coff64_vec,
#endif
&aout0_big_vec,
&amiga_vec,
&aout_amiga_vec,
&aout0_big_vec,
#if 0
/* We have no way of distinguishing these from other a.out variants. */
&aout_arm_big_vec,
+6 -6
View File
@@ -981,6 +981,9 @@ tentative_cc=""
host_makefile_frag=/dev/null
if test -d ${srcdir}/config ; then
case "${host}" in
m68k-*-amigaos*)
host_makefile_frag="config/mh-amigaos"
;;
m68k-hp-hpux*)
# Avoid "too much defining" errors from HPUX compiler.
tentative_cc="cc -Wp,-H256000"
@@ -1085,12 +1088,6 @@ case "${host}" in
i[[3456]]86-*-msdosdjgpp*)
host_makefile_frag="config/mh-djgpp"
;;
*-*-amigaos*)
host_makefile_frag="${host_makefile_frag} config/mh-amigaos"
;;
*-*-morphos*)
host_makefile_frag="${host_makefile_frag} config/mh-morphos"
;;
*-cygwin*)
host_makefile_frag="config/mh-cygwin"
;;
@@ -1100,6 +1097,9 @@ case "${host}" in
*-interix*)
host_makefile_frag="config/mh-interix"
;;
*-morphos*)
host_makefile_frag="config/mh-morphos"
;;
vax-*-ultrix2*)
# The old BSD pcc isn't up to compiling parts of gdb so use gcc
tentative_cc=gcc
-17
View File
@@ -373,17 +373,6 @@ Tue Oct 21 10:20:11 1997 Doug Evans <devans@canuck.cygnus.com>
* config/tc-sparc.c (md_apply_fix3, cases ..._H44, ..._HIX22): Leave
overflow signalling to linker.
Mon Oct 20 21:42:55 1997 Fred Fish <fnf@ninemoons.com>
* config/tc-sh.c (insert): Add extra 0 arg for fix_new_exp call.
(md_assemble): Add extra 0 arg for fix_new call.
(sh_frob_label): Add extra 0 arg for fix_new call.
(sh_flush_pending_output): Add extra 0 arg for fix_new call.
(s_uses): Add extra 0 arg for fix_new_exp call.
(sh_frob_section): Add extra 0 arg for fix_new call.
(md_convert_frag): Add extra 0 arg for fix_new calls.
(sh_handle_align): Add extra 0 arg for fix_new call.
Mon Oct 20 14:54:06 1997 Klaus K"ampf <kkaempf@progis.de>
* makefile.vms: Fix for dec c.
@@ -538,12 +527,6 @@ Wed Oct 8 12:33:32 1997 Richard Henderson <rth@cygnus.com>
recognizes alphaev5 etc.
* configure: Rebuild.
Wed Oct 8 10:40:55 1997 Fred Fish <fnf@ninemoons.com>
* config/tc-i386.c (md_assemble): Add extra 0 arg for fix_new_exp calls.
(md_create_long_jump): Add extra 0 arg for fix_new calls.
(md_estimate_size_before_relax): Ditto.
Wed Oct 8 00:04:05 1997 Gavin Koch <gavin@cygnus.com>
* config/tc-mips.c (md_begin): Replace the TARGET_CPU value
-10
View File
@@ -3472,11 +3472,6 @@ Sat Jun 6 00:02:41 1998 Nick Clifton <nickc@cygnus.com>
* config/tc-d30v.c (md_assemble): Set execution type to unknown
after emitting a word of noops.
Sat Jun 6 23:06:18 1998 Fred Fish <fnf@ninemoons.com>
* config/tc-i386.c (md_section_align): Re-enable use of forced
section alignment based only on BFD_ASSEMBLER being defined.
Fri Jun 5 23:27:04 1998 Alan Modra <alan@spri.levels.unisa.edu.au>
* config/tc-i386.c (mode_from_disp_size): Disp16 is mode 2.
@@ -3528,11 +3523,6 @@ Fri Jun 5 10:50:53 1998 Nick Clifton <nickc@cygnus.com>
* config/tc-d30v.c (md_assemble): Store previous segment state
with previous instruction.
Thu Jun 4 22:18:50 1998 Fred Fish <fnf@ninemoons.com>
* read.c (output_leb128): Do not inline as it is used externally
for some configuration.s
Wed Jun 3 18:21:56 1998 Alan Modra <alan@spri.levels.unisa.edu.au>
* config/tc-i386.c (SCALE1_WHEN_NO_INDEX): Define.
+5 -6
View File
@@ -1221,11 +1221,10 @@ DEPTC_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
$(INCDIR)/opcode/m68hc11.h dwarf2dbg.h $(INCDIR)/elf/m68hc11.h \
$(INCDIR)/elf/reloc-macros.h
DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \
dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
DEPTC_m68k_amigaoshunk = $(INCDIR)/symcat.h $(srcdir)/config/obj-amigahunk.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h \
$(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \
dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
@@ -2215,8 +2214,8 @@ DEP_m68hc11_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68hc11.h \
DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h
DEP_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h $(srcdir)/config/tc-m68k.h \
$(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h
DEP_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h
DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
DEP_m68k_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-m68k.h \
+7 -8
View File
@@ -1002,12 +1002,11 @@ DEPTC_m68hc11_elf = $(INCDIR)/symcat.h $(srcdir)/config/obj-elf.h \
$(INCDIR)/opcode/m68hc11.h dwarf2dbg.h $(INCDIR)/elf/m68hc11.h \
$(INCDIR)/elf/reloc-macros.h
DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \
dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
DEPTC_m68k_amigaoshunk = $(INCDIR)/symcat.h $(srcdir)/config/obj-amigahunk.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h \
$(INCDIR)/obstack.h subsegs.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
DEPTC_m68k_aout = $(INCDIR)/symcat.h $(srcdir)/config/obj-aout.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h \
$(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h subsegs.h \
dwarf2dbg.h $(INCDIR)/opcode/m68k.h $(srcdir)/config/m68k-parse.h
@@ -2232,8 +2231,8 @@ DEP_m68hc11_elf = $(srcdir)/config/obj-elf.h $(INCDIR)/symcat.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(srcdir)/config/tc-m68hc11.h
DEP_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h $(srcdir)/config/tc-m68k.h \
$(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h
DEP_m68k_amigaoshunk = $(srcdir)/config/obj-amigahunk.h \
$(srcdir)/config/tc-m68k.h $(BFDDIR)/libamiga.h $(INCDIR)/bfdlink.h
DEP_m68k_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-m68k.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
@@ -2545,7 +2544,7 @@ LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS)
YLWRAP = $(top_srcdir)/ylwrap
YLWRAP = $(top_srcdir)/../ylwrap
DIST_SOURCES = $(as_new_SOURCES) $(EXTRA_as_new_SOURCES) \
$(itbl_test_SOURCES)
+3 -3
View File
@@ -88,7 +88,7 @@ char *myname;
#ifdef BFD_ASSEMBLER
segT reg_section, expr_section;
segT text_section, data_section, bss_section;
#ifdef TE_AMIGA
#ifdef OBJ_AMIGAHUNK
segT data_chip_section, bss_chip_section;
#endif
#endif
@@ -1047,7 +1047,7 @@ perform_an_assembly_pass (argc, argv)
text_section = subseg_new (TEXT_SECTION_NAME, 0);
data_section = subseg_new (DATA_SECTION_NAME, 0);
bss_section = subseg_new (BSS_SECTION_NAME, 0);
#ifdef TE_AMIGA
#ifdef OBJ_AMIGAHUNK
data_chip_section = subseg_new (".data_chip", 0);
bss_chip_section = subseg_new (".bss_chip", 0);
#endif
@@ -1061,7 +1061,7 @@ perform_an_assembly_pass (argc, argv)
applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
| SEC_DATA));
bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
#ifdef TE_AMIGA
#ifdef OBJ_AMIGAHUNK
bfd_set_section_flags (stdoutput, data_chip_section,
applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC));
bfd_set_section_flags (stdoutput, bss_chip_section, applicable & SEC_ALLOC);
+16
View File
@@ -397,6 +397,22 @@ typedef unsigned int relax_substateT;
/* Enough bits for address, but still an integer type.
Could be a problem, cross-assembling for 64-bit machines. */
typedef addressT relax_addressT;
struct relax_type
{
/* Forward reach. Signed number. > 0. */
long rlx_forward;
/* Backward reach. Signed number. < 0. */
long rlx_backward;
/* Bytes length of this address. */
unsigned char rlx_length;
/* Next longer relax-state. 0 means there is no 'next' relax-state. */
relax_substateT rlx_more;
};
typedef struct relax_type relax_typeS;
/* main program "as.c" (command arguments etc) */
-13
View File
@@ -1,13 +0,0 @@
# Host makefile fragment for Commodore Amiga running AmigaOS.
# There is no standard system compiler. Assume use GNU C.
CC = gcc
# There is no support for -g yet. But use -O instead.
CFLAGS = -O
# We have both types of links under AmigaOS with GNU
# utils, however the links need to be made in canonical
# AmigaOS format (foo:bar/bell/file) rather than UNIX
# format (/foo/bar/bell/file). When this is fixed, then
# these can go away.
SYMLINK = cp
HARDLINK = cp
+1 -1
View File
@@ -267,7 +267,7 @@ struct m68k_exp
/* The expression itself. */
expressionS exp;
/* base-relative? */
short baserel;
};
-13
View File
@@ -1,13 +0,0 @@
# Host makefile fragment for MorphOS.
# There is no standard system compiler. Assume use GNU C.
CC = gcc
# There is no support for -g yet. But use -O instead.
CFLAGS = -O
# We have both types of links under AmigaOS with GNU
# utils, however the links need to be made in canonical
# AmigaOS format (foo:bar/bell/file) rather than UNIX
# format (/foo/bar/bell/file). When this is fixed, then
# these can go away.
SYMLINK = cp
HARDLINK = cp
+53 -401
View File
@@ -1,5 +1,5 @@
/* AmigaOS object file format
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -13,110 +13,66 @@ 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. */
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. */
#include "as.h"
#ifdef BFD_ASSEMBLER
#undef NO_RELOC
#endif
#include "obstack.h"
#ifndef BFD_ASSEMBLER
/* in: segT out: N_TYPE bits */
const short seg_N_TYPE[] =
{
N_ABS,
N_TEXT,
N_DATA,
N_BSS,
N_UNDF, /* unknown */
N_UNDF, /* error */
N_UNDF, /* expression */
N_UNDF, /* debug */
N_UNDF, /* ntv */
N_UNDF, /* ptv */
N_REGISTER, /* register */
enum {
N_UNDF=0,
/*N_ABS=2,*/
/*N_TEXT=4,*/
/*N_DATA=6,*/
/*N_BSS=8,*/
N_INDR=0xa,
/*N_COMM=0x12,*/
N_SETA=0x14,
N_SETT=0x16,
N_SETD=0x18,
N_SETB=0x1a,
/*N_SETV=0x1c,*/
N_WARNING=0x1e,
/*N_FN=0x1f*/
N_EXT=1,
N_TYPE=0x1e,
/*N_STAB=0xe0,*/
};
const segT N_TYPE_seg[N_TYPE + 2] =
{ /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
SEG_GOOF,
SEG_TEXT, /* N_TEXT == 4 */
SEG_GOOF,
SEG_DATA, /* N_DATA == 6 */
SEG_GOOF,
SEG_BSS, /* N_BSS == 8 */
SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_GOOF, SEG_GOOF, SEG_GOOF, SEG_GOOF,
SEG_REGISTER, /* dummy N_REGISTER for regs = 30 */
SEG_GOOF,
};
#endif
static void obj_amiga_line PARAMS ((int));
static void obj_amiga_weak PARAMS ((int));
const pseudo_typeS obj_pseudo_table[] =
{
{"line", obj_amiga_line, 0}, /* source code line number */
{"ln", obj_amiga_line, 0}, /* coff line number that we use anyway */
{"weak", obj_amiga_weak, 0}, /* mark symbol as weak. */
/* coff debug pseudos (ignored) */
{"def", s_ignore, 0},
{"dim", s_ignore, 0},
{"endef", s_ignore, 0},
{"ident", s_ignore, 0},
{"line", s_ignore, 0},
{"ln", s_ignore, 0},
{"scl", s_ignore, 0},
{"size", s_ignore, 0},
{"tag", s_ignore, 0},
{"type", s_ignore, 0},
{"val", s_ignore, 0},
{"version", s_ignore, 0},
{"optim", s_ignore, 0}, /* For sun386i cc (?) */
/* other stuff */
{"ABORT", s_abort, 0},
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
{NULL, NULL, 0} /* end sentinel */
};
#ifdef BFD_ASSEMBLER
void
obj_amiga_frob_symbol (sym, punt)
symbolS *sym;
int *punt;
int *punt ATTRIBUTE_UNUSED;
{
flagword flags;
asection *sec;
int desc, type, other;
flags = sym->bsym->flags;
type = S_GET_TYPE (sym);
desc = S_GET_DESC (sym);
other = S_GET_OTHER (sym);
sec = sym->bsym->section;
sec_ptr sec = S_GET_SEGMENT (sym);
unsigned int type = amiga_symbol (symbol_get_bfdsym (sym))->type;
/* Only frob simple symbols this way right now. */
if (! (type & ~ (N_TYPE | N_EXT)))
{
if (type == (N_UNDF | N_EXT)
&& sec == &bfd_abs_section)
sym->bsym->section = sec = bfd_und_section_ptr;
{
sec = bfd_und_section_ptr;
S_SET_SEGMENT (sym, sec);
}
if ((type & N_TYPE) != N_INDR
&& (type & N_TYPE) != N_SETA
@@ -127,7 +83,7 @@ obj_amiga_frob_symbol (sym, punt)
&& (sec == &bfd_abs_section
|| sec == &bfd_und_section))
return;
if (flags & BSF_EXPORT)
if (symbol_get_bfdsym (sym)->flags & BSF_EXPORT)
type |= N_EXT;
switch (type & N_TYPE)
@@ -138,7 +94,7 @@ obj_amiga_frob_symbol (sym, punt)
case N_SETB:
/* Set the debugging flag for constructor symbols so that
BFD leaves them alone. */
sym->bsym->flags |= BSF_DEBUGGING;
symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
/* You can't put a common symbol in a set. The way a set
element works is that the symbol has a definition and a
@@ -151,54 +107,54 @@ obj_amiga_frob_symbol (sym, punt)
on the other hand, we certainly don't want anybody to be
mislead into thinking that their code will work. */
if (S_IS_COMMON (sym))
as_bad ("Attempt to put a common symbol into set %s",
as_bad (_("Attempt to put a common symbol into set %s"),
S_GET_NAME (sym));
/* Similarly, you can't put an undefined symbol in a set. */
else if (! S_IS_DEFINED (sym))
as_bad ("Attempt to put an undefined symbol into set %s",
as_bad (_("Attempt to put an undefined symbol into set %s"),
S_GET_NAME (sym));
break;
case N_INDR:
/* Put indirect symbols in the indirect section. */
sym->bsym->section = bfd_ind_section_ptr;
sym->bsym->flags |= BSF_INDIRECT;
S_SET_SEGMENT (sym, bfd_ind_section_ptr);
symbol_get_bfdsym (sym)->flags |= BSF_INDIRECT;
if (type & N_EXT)
{
sym->bsym->flags |= BSF_EXPORT;
sym->bsym->flags &=~ BSF_LOCAL;
symbol_get_bfdsym (sym)->flags |= BSF_EXPORT;
symbol_get_bfdsym (sym)->flags &=~ BSF_LOCAL;
}
break;
case N_WARNING:
/* Mark warning symbols. */
sym->bsym->flags |= BSF_WARNING;
symbol_get_bfdsym (sym)->flags |= BSF_WARNING;
break;
}
}
else
{
sym->bsym->flags |= BSF_DEBUGGING;
symbol_get_bfdsym (sym)->flags |= BSF_DEBUGGING;
}
S_SET_TYPE (sym, type);
amiga_symbol (symbol_get_bfdsym (sym))->type = type;
/* Double check weak symbols. */
if (sym->bsym->flags & BSF_WEAK)
if (S_IS_WEAK (sym))
{
if (S_IS_COMMON (sym))
as_bad ("Symbol `%s' can not be both weak and common",
as_bad (_("Symbol `%s' can not be both weak and common"),
S_GET_NAME (sym));
}
}
void
obj_amiga_frob_file ()
obj_amiga_frob_file_before_fix ()
{
/* Relocation processing may require knowing the VMAs of the sections.
Since writing to a section will cause the BFD back end to compute the
VMAs, fake it out here.... */
bfd_byte b = 0;
boolean x = true;
bfd_boolean x = TRUE;
if (bfd_section_size (stdoutput, text_section) != 0)
{
x = bfd_set_section_contents (stdoutput, text_section, &b, (file_ptr) 0,
@@ -209,145 +165,27 @@ obj_amiga_frob_file ()
x = bfd_set_section_contents (stdoutput, data_section, &b, (file_ptr) 0,
(bfd_size_type) 1);
}
assert (x == true);
assert (x);
}
#else
/* Relocation. */
/*
* emit_relocations()
*
* Crawl along a fixS chain. Emit the segment's relocations.
*/
void
obj_emit_relocations (where, fixP, segment_address_in_file)
char **where;
fixS *fixP; /* Fixup chain for this segment. */
relax_addressT segment_address_in_file;
{
for (; fixP; fixP = fixP->fx_next)
if (fixP->fx_done == 0)
{
tc_aout_fix_to_chars (*where, fixP, segment_address_in_file);
*where += md_reloc_size;
}
}
#ifndef obj_header_append
/* Aout file generation & utilities */
void
obj_header_append (where, headers)
char **where;
object_headers *headers;
{
tc_headers_hook (headers);
#ifdef CROSS_COMPILE
md_number_to_chars (*where, headers->header.a_info, sizeof (headers->header.a_info));
*where += sizeof (headers->header.a_info);
md_number_to_chars (*where, headers->header.a_text, sizeof (headers->header.a_text));
*where += sizeof (headers->header.a_text);
md_number_to_chars (*where, headers->header.a_data, sizeof (headers->header.a_data));
*where += sizeof (headers->header.a_data);
md_number_to_chars (*where, headers->header.a_bss, sizeof (headers->header.a_bss));
*where += sizeof (headers->header.a_bss);
md_number_to_chars (*where, headers->header.a_syms, sizeof (headers->header.a_syms));
*where += sizeof (headers->header.a_syms);
md_number_to_chars (*where, headers->header.a_entry, sizeof (headers->header.a_entry));
*where += sizeof (headers->header.a_entry);
md_number_to_chars (*where, headers->header.a_trsize, sizeof (headers->header.a_trsize));
*where += sizeof (headers->header.a_trsize);
md_number_to_chars (*where, headers->header.a_drsize, sizeof (headers->header.a_drsize));
*where += sizeof (headers->header.a_drsize);
#else /* CROSS_COMPILE */
append (where, (char *) &headers->header, sizeof (headers->header));
#endif /* CROSS_COMPILE */
}
#endif
void
obj_symbol_to_chars (where, symbolP)
char **where;
symbolS *symbolP;
{
md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)),
S_GET_OFFSET (symbolP),
sizeof (S_GET_OFFSET (symbolP)));
md_number_to_chars ((char *) &(S_GET_DESC (symbolP)),
S_GET_DESC (symbolP),
sizeof (S_GET_DESC (symbolP)));
md_number_to_chars ((char *) &(symbolP->sy_symbol.n_value),
S_GET_VALUE (symbolP),
sizeof (symbolP->sy_symbol.n_value));
append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type));
}
void
obj_emit_symbols (where, symbol_rootP)
char **where;
symbolS *symbol_rootP;
{
symbolS *symbolP;
/* Emit all symbols left in the symbol chain. */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
/* Used to save the offset of the name. It is used to point
to the string in memory but must be a file offset. */
register char *temp;
temp = S_GET_NAME (symbolP);
S_SET_OFFSET (symbolP, symbolP->sy_name_offset);
/* Any symbol still undefined and is not a dbg symbol is made N_EXT. */
if (!S_IS_DEBUG (symbolP) && !S_IS_DEFINED (symbolP))
S_SET_EXTERNAL (symbolP);
/* Adjust the type of a weak symbol. */
if (S_GET_WEAK (symbolP))
{
switch (S_GET_TYPE (symbolP))
{
case N_UNDF: S_SET_TYPE (symbolP, N_WEAKU); break;
case N_ABS: S_SET_TYPE (symbolP, N_WEAKA); break;
case N_TEXT: S_SET_TYPE (symbolP, N_WEAKT); break;
case N_DATA: S_SET_TYPE (symbolP, N_WEAKD); break;
case N_BSS: S_SET_TYPE (symbolP, N_WEAKB); break;
default: as_bad ("%s: bad type for weak symbol", temp); break;
}
}
obj_symbol_to_chars (where, symbolP);
S_SET_NAME (symbolP, temp);
}
}
#endif /* ! BFD_ASSEMBLER */
#endif /* BFD_ASSEMBLER */
static void
obj_amiga_line (ignore)
int ignore;
int ignore ATTRIBUTE_UNUSED;
{
/* Assume delimiter is part of expression.
BSD4.2 as fails with delightful bug, so we
are not being incompatible here. */
are not being incompatible here. */
new_logical_line ((char *) NULL, (int) (get_absolute_expression ()));
demand_empty_rest_of_line ();
} /* obj_aout_line() */
} /* obj_amiga_line() */
/* Handle .weak. This is a GNU extension. */
static void
obj_amiga_weak (ignore)
int ignore;
int ignore ATTRIBUTE_UNUSED;
{
char *name;
int c;
@@ -372,189 +210,3 @@ obj_amiga_weak (ignore)
while (c == ',');
demand_empty_rest_of_line ();
}
void
obj_read_begin_hook ()
{
}
#ifndef BFD_ASSEMBLER
void
obj_crawl_symbol_chain (headers)
object_headers *headers;
{
symbolS *symbolP;
symbolS **symbolPP;
int symbol_number = 0;
tc_crawl_symbol_chain (headers);
symbolPP = &symbol_rootP; /*->last symbol chain link. */
while ((symbolP = *symbolPP) != NULL)
{
if (symbolP->sy_mri_common)
{
if (S_IS_EXTERNAL (symbolP))
as_bad ("%s: global symbols not supported in common sections",
S_GET_NAME (symbolP));
*symbolPP = symbol_next (symbolP);
continue;
}
if (flag_readonly_data_in_text && (S_GET_SEGMENT (symbolP) == SEG_DATA))
{
S_SET_SEGMENT (symbolP, SEG_TEXT);
} /* if pusing data into text */
resolve_symbol_value (symbolP);
/* OK, here is how we decide which symbols go out into the brave
new symtab. Symbols that do are:
* symbols with no name (stabd's?)
* symbols with debug info in their N_TYPE
Symbols that don't are:
* symbols that are registers
* symbols with \1 as their 3rd character (numeric labels)
* "local labels" as defined by S_LOCAL_NAME(name) if the -L
switch was passed to gas.
All other symbols are output. We complain if a deleted
symbol was marked external. */
if (!S_IS_REGISTER (symbolP)
&& (!S_GET_NAME (symbolP)
|| S_IS_DEBUG (symbolP)
|| !S_IS_DEFINED (symbolP)
|| S_IS_EXTERNAL (symbolP)
|| (S_GET_NAME (symbolP)[0] != '\001'
&& (flag_keep_locals || !S_LOCAL_NAME (symbolP)))))
{
symbolP->sy_number = symbol_number++;
/* The + 1 after strlen account for the \0 at the
end of each string */
if (!S_IS_STABD (symbolP))
{
/* Ordinary case. */
symbolP->sy_name_offset = string_byte_count;
string_byte_count += strlen (S_GET_NAME (symbolP)) + 1;
}
else /* .Stabd case. */
symbolP->sy_name_offset = 0;
symbolPP = &(symbol_next (symbolP));
}
else
{
if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP))
/* This warning should never get triggered any more.
Well, maybe if you're doing twisted things with
register names... */
{
as_bad ("Local symbol %s never defined.", decode_local_label_name (S_GET_NAME (symbolP)));
} /* oops. */
/* Unhook it from the chain */
*symbolPP = symbol_next (symbolP);
} /* if this symbol should be in the output */
} /* for each symbol */
H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number);
}
/*
* Find strings by crawling along symbol table chain.
*/
void
obj_emit_strings (where)
char **where;
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count));
*where += sizeof (string_byte_count);
#else /* CROSS_COMPILE */
append (where, (char *) &string_byte_count, (unsigned long) sizeof (string_byte_count));
#endif /* CROSS_COMPILE */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
if (S_GET_NAME (symbolP))
append (&next_object_file_charP, S_GET_NAME (symbolP),
(unsigned long) (strlen (S_GET_NAME (symbolP)) + 1));
} /* walk symbol chain */
}
void
obj_pre_write_hook (headers)
object_headers *headers;
{
H_SET_DYNAMIC (headers, 0);
H_SET_VERSION (headers, AOUT_VERSION);
H_SET_MACHTYPE (headers, AOUT_MACHTYPE);
tc_aout_pre_write_hook (headers);
}
void
DEFUN_VOID (s_sect)
{
/* Strip out the section name */
char *section_name;
char *section_name_end;
char c;
unsigned int len;
unsigned int exp;
char *save;
section_name = input_line_pointer;
c = get_symbol_end ();
section_name_end = input_line_pointer;
len = section_name_end - section_name;
input_line_pointer++;
save = input_line_pointer;
SKIP_WHITESPACE ();
if (c == ',')
{
exp = get_absolute_expression ();
}
else if (*input_line_pointer == ',')
{
input_line_pointer++;
exp = get_absolute_expression ();
}
else
{
input_line_pointer = save;
exp = 0;
}
if (exp >= 1000)
{
as_bad ("subsegment index too high");
}
if (strcmp (section_name, ".text") == 0)
{
subseg_set (SEG_TEXT, (subsegT) exp);
}
if (strcmp (section_name, ".data") == 0)
{
if (flag_readonly_data_in_text)
subseg_set (SEG_TEXT, (subsegT) exp + 1000);
else
subseg_set (SEG_DATA, (subsegT) exp);
}
*section_name_end = c;
}
#endif /* ! BFD_ASSEMBLER */
+17 -182
View File
@@ -1,5 +1,5 @@
/* obj-amigahunk.h, AmigaOS object file format for gas, the assembler.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -13,15 +13,15 @@
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. */
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. */
/* Tag to validate an amiga object file format processing */
#define OBJ_AMIGAHUNK 1
#include "targ-cpu.h"
#include "aout_gnu.h"
#ifdef BFD_ASSEMBLER
@@ -29,191 +29,26 @@
#define OUTPUT_FLAVOR bfd_target_amiga_flavour
#else /* ! BFD_ASSEMBLER */
extern const short seg_N_TYPE[];
extern const segT N_TYPE_seg[];
#ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (HUNK_UNIT)
#endif
#endif /* ! BFD_ASSEMBLER */
/* SYMBOL TABLE */
/* Symbol table macros and constants */
#ifdef BFD_ASSEMBLER
#define S_SET_OTHER(S,V) (amiga_symbol (symbol_get_bfdsym (S))->other = (V))
#define S_SET_TYPE(S,T) (amiga_symbol (symbol_get_bfdsym (S))->type = (T))
#define S_SET_DESC(S,D) (amiga_symbol (symbol_get_bfdsym (S))->desc = (D))
#define S_GET_TYPE(S) (amiga_symbol (symbol_get_bfdsym (S))->type)
#define obj_frob_symbol(S,PUNT) obj_amiga_frob_symbol (S, &PUNT)
extern void obj_amiga_frob_symbol PARAMS ((symbolS *, int *));
#define S_SET_OTHER(S,V) (amiga_symbol((S)->bsym)->other = (V))
#define S_SET_TYPE(S,T) (amiga_symbol((S)->bsym)->type = (T))
#define S_SET_DESC(S,D) (amiga_symbol((S)->bsym)->desc = (D))
#define S_GET_OTHER(S) (amiga_symbol((S)->bsym)->other)
#define S_GET_TYPE(S) (amiga_symbol((S)->bsym)->type)
#define S_GET_DESC(S) (amiga_symbol((S)->bsym)->desc)
asection *text_section, *data_section, *bss_section;
#define obj_frob_symbol(S,PUNT) obj_amiga_frob_symbol (S, &PUNT)
#define obj_frob_file() obj_amiga_frob_file ()
extern void obj_amiga_frob_symbol PARAMS ((struct symbol *, int *));
extern void obj_amiga_frob_file PARAMS ((void));
#define obj_frob_file_before_fix() obj_amiga_frob_file_before_fix ()
extern void obj_amiga_frob_file_before_fix PARAMS ((void));
#define obj_sec_sym_ok_for_reloc(SEC) (1)
#else
#endif /* BFD_ASSEMBLER */
/* We use the sy_obj field to record whether a symbol is weak. */
#define OBJ_SYMFIELD_TYPE char
/*
* Macros to extract information from a symbol table entry.
* This syntaxic indirection allows independence regarding a.out or coff.
* The argument (s) of all these macros is a pointer to a symbol table entry.
*/
/* True if the symbol is external */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_OTHER(s) != 0) || (S_GET_DESC(s) != 0))
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
/* True if a debug special symbol entry */
#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
/* True if a symbol is local symbol name */
/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
nameless symbols come from .stab directives. */
#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
!S_IS_DEBUG(s) && \
(S_GET_NAME(s)[0] == '\001' || \
(S_LOCAL_NAME(s) && !flag_keep_locals)))
/* True if a symbol is not defined in this file */
#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
/* True if the symbol has been generated because of a .stabd directive */
#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0)
/* Accessors */
/* The name of the symbol */
#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
/* The pointer to the string table */
#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
/* The type of the symbol */
#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE)
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)])
/* The n_other expression value */
#define S_GET_OTHER(s) ((s)->sy_symbol.n_other)
/* The n_desc expression value */
#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
/* Whether the symbol is weak. */
#define S_GET_WEAK(s) ((s)->sy_obj)
/* Modifiers */
/* Assume that a symbol cannot be simultaneously in more than on segment */
/* set segment */
#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
/* The symbol is external */
#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT)
/* The symbol is not external */
#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
/* Set the name of the symbol */
#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
/* Set the offset in the string table */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
/* Set the n_type field */
#define S_SET_TYPE(s,t) ((s)->sy_symbol.n_type = (t))
/* Set the n_other expression value */
#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
/* Set the n_desc expression value */
#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
/* Mark the symbol as weak. This causes n_type to be adjusted when
the symbol is written out. */
#define S_SET_WEAK(s) ((s)->sy_obj = 1)
/* File header macro and type definition */
#define H_GET_FILE_SIZE(h) (H_GET_HEADER_SIZE(h) \
+ H_GET_TEXT_SIZE(h) \
+ H_GET_DATA_SIZE(h) \
+ H_GET_SYMBOL_TABLE_SIZE(h) \
+ H_GET_TEXT_RELOCATION_SIZE(h) \
+ H_GET_DATA_RELOCATION_SIZE(h) \
+ H_GET_STRING_SIZE(h))
#define H_GET_HEADER_SIZE(h) (EXEC_BYTES_SIZE)
#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize)
#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize)
#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms)
#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry)
#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
#define H_GET_LINENO_SIZE(h) (0)
#define H_GET_DYNAMIC(h) ((h)->header.a_info >> 31)
#define H_GET_VERSION(h) (((h)->header.a_info >> 24) & 0x7f)
#define H_GET_MACHTYPE(h) (((h)->header.a_info >> 16) & 0xff)
#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info & 0xffff)
#define H_SET_DYNAMIC(h,v) ((h)->header.a_info = (((v) << 31) \
| (H_GET_VERSION(h) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_VERSION(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| ((v) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_MACHTYPE(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| (H_GET_VERSION(h) << 24) \
| ((v) << 16) \
| (H_GET_MAGIC_NUMBER(h))))
#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
| (H_GET_VERSION(h) << 24) \
| (H_GET_MACHTYPE(h) << 16) \
| ((v))))
#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v)))
#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v)))
#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v)))
#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
H_SET_DATA_RELOCATION_SIZE((h),(d)))
#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * 12)
#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
typedef struct
{
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
}
object_headers;
/* line numbering stuff. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
struct fix;
void tc_aout_fix_to_chars PARAMS ((char *where, struct fix *fixP, relax_addressT segment_address));
#endif
#define obj_symbol_new_hook(s) {;}
#define EMIT_SECTION_SYMBOLS 0
#define obj_read_begin_hook() {;}
#define obj_symbol_new_hook(s) {;}
#define EMIT_SECTION_SYMBOLS (0)
#define AOUT_STABS
/* end of obj-aout.h */
+105 -90
View File
@@ -39,6 +39,10 @@
#define N_TEXT 4
#endif
#ifndef OBJ_AMIGAHUNK
#define OBJ_AMIGAHUNK 0
#endif
/* This string holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. The macro
tc_comment_chars points to this. We use this, rather than the
@@ -83,7 +87,7 @@ int flag_want_pic;
static int flag_short_refs; /* -l option */
static int flag_long_jumps; /* -S option */
static int flag_keep_pcrel; /* --pcrel option. */
static int flag_small_code; /* -sc option */
static int flag_small_code; /* -sc option */
#ifdef REGISTER_PREFIX_OPTIONAL
int flag_reg_prefix_optional = REGISTER_PREFIX_OPTIONAL;
@@ -472,17 +476,18 @@ static const int n_archs = sizeof (archs) / sizeof (archs[0]);
#define PCREL1632 7 /* 16-bit or 32-bit PC-relative */
#define PCINDEX 8 /* PC+displacement+index */
#define ABSTOPCREL 9 /* absolute relax down to 16-bit PC-relative */
#define ABSREL 10
#define IMMREL 11
/* ABSREL (nice name;-)) is used in small-code, it might be
* implemented base-relative (a4), pc-relative, or base-rel with an extra
* add instruction to add the base-register
/* ABSREL (nice name;-)) is used in small-code, it might be implemented
* base-relative (a4), pc-relative, or base-relative with an extra add
* instruction to add the base-register.
*
* IMMREL is the analogous mode for immediate addressing of variables. This
* one can lead into situations, where a replacement is not possible:
* addl #foo,a0
* can't be made pc-relative, if foo is in the text segment */
* addl #foo,a0
* can't be made pc-relative, if foo is in the text segment. */
#define ABSREL 10
#define IMMREL 11
/* Note that calls to frag_var need to specify the maximum expansion
needed; this is currently 10 bytes for DBCC. */
@@ -546,15 +551,15 @@ relax_typeS md_relax_table[] =
{ 0, 0, 4, 0 },
{ 1, 1, 0, 0 },
{127, -128, 0, 0},
{32767, -32768, 2, TAB(ABSREL,LONG)},
{0, 0, 6, 0},
{1, 1, 0, 0},
{ 127, -128, 0, 0 },
{ 32767, -32768, 2, TAB(ABSREL,LONG) },
{ 0, 0, 6, 0 },
{ 1, 1, 0, 0 },
{127, -128, 0, 0},
{32767, -32768, 2, TAB(IMMREL,LONG)},
{0, 0, 6, 0},
{1, 1, 0, 0},
{ 127, -128, 0, 0 },
{ 32767, -32768, 2, TAB(IMMREL,LONG) },
{ 0, 0, 6, 0 },
{ 1, 1, 0, 0 },
};
/* These are the machine dependent pseudo-ops. These are included so
@@ -576,13 +581,11 @@ const pseudo_typeS md_pseudo_table[] =
{"even", s_even, 0},
{"skip", s_space, 0},
{"proc", s_proc, 0},
#ifndef __amigaos__
#if defined (TE_SUN3) || defined (OBJ_ELF)
{"align", s_align_bytes, 0},
#endif
#ifdef OBJ_ELF
{"swbeg", s_ignore, 0},
#endif
#endif
{"extend", float_cons, 'x'},
{"ldouble", float_cons, 'x'},
@@ -979,6 +982,17 @@ tc_gen_reloc (section, fixp)
}
}
}
else if (fixp->tc_fix_data)
{
switch (fixp->fx_size)
{
case 1: code = BFD_RELOC_8_BASEREL; break;
case 2: code = BFD_RELOC_16_BASEREL; break;
case 4: code = BFD_RELOC_32_BASEREL; break;
default:
abort ();
}
}
else
{
#define F(SZ,PCREL) (((SZ) << 1) + (PCREL))
@@ -1970,18 +1984,16 @@ m68k_ip (instring)
else
nextword = get_num (&opP->disp, 0);
if (isvar (&opP->disp))
{
/* This doesn't work when the symbol is N_UNDF! So we ignore this for the moment.
if (flag_small_code)
{
add_frag (adds(&opP->disp),
offs(&opP->disp),
TAB(IMMREL, SZ_UNDEF));
break;
}
else
*/
{
/* This doesn't work when the symbol is N_UNDF! We ignore this for now. */
if (0 && flag_small_code)
{
add_frag (adds(&opP->disp),
offs(&opP->disp),
TAB(IMMREL, SZ_UNDEF));
break;
}
else
add_fix(s[1], &opP->disp, 0, 0, opP->disp.baserel);
}
switch (s[1])
@@ -2468,10 +2480,8 @@ m68k_ip (instring)
}
/* Fall through into long */
case SIZE_LONG:
#if 0
/* This doesn't work when the symbol is N_UNDF! We ignore this for now. */
if (flag_small_code)
/* This doesn't work when the symbol is N_UNDF! We ignore this for now. */
if (0 && flag_small_code)
{
tmpreg=0x3A; /* 7.2 */
add_frag (adds(&opP->disp),
@@ -2479,7 +2489,6 @@ m68k_ip (instring)
TAB(ABSREL, SZ_UNDEF));
break;
}
#endif
if (isvar (&opP->disp))
add_fix ('l', &opP->disp, 0, 0, opP->disp.baserel);
@@ -3376,6 +3385,12 @@ struct init_entry
int number;
};
#if defined(TE_AMIGA)
#define FRAME ADDR5
#else
#define FRAME ADDR6
#endif
static const struct init_entry init_table[] =
{
{ "d0", DATA0 },
@@ -3392,8 +3407,8 @@ static const struct init_entry init_table[] =
{ "a3", ADDR3 },
{ "a4", ADDR4 },
{ "a5", ADDR5 },
{ "fp", ADDR5 },
{ "a6", ADDR6 },
{ "fp", FRAME },
{ "a7", ADDR7 },
{ "sp", ADDR7 },
{ "ssp", ADDR7 },
@@ -4444,8 +4459,8 @@ md_convert_frag_1 (fragP)
break;
case TAB (BRABSJUNC, LONG):
if (flag_small_code)
{
as_bad("Long branch in small code model, not supported.");
{
as_bad (_("Long branch in small code model, not supported."));
}
else if (fragP->fr_opcode[0] == 0x61) /* jbsr */
{
@@ -4599,68 +4614,65 @@ md_convert_frag_1 (fragP)
fragP->fr_fix += 4;
break;
case TAB(ABSREL,BYTE):
as_bad ("ABSREL_BYTE: how the ** does this look ?? \n");
as_bad (_("ABSREL_BYTE: how the ** does this look??"));
break;
case TAB(ABSREL,SHORT):
subseg_change (text_section, 0);
fragP->fr_fix += 2;
fragP->fr_opcode[1] &= ~0x3f;
fragP->fr_fix += 2;
if ((S_GET_TYPE (fragP->fr_symbol)) == N_TEXT)
{
/* so this is really a pc-relative address */
fragP->fr_opcode[1] |= 0x3a;
fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol, fragP->fr_offset+2, 1, NO_RELOC, 0);
break;
}
{
/* so this is really a pc-relative address */
fragP->fr_opcode[1] |= 0x3a;
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, 1, NO_RELOC, 0);
break;
}
/* in that case we have to generate base-relative code
* (note: if we're in N_UNDF, this could as well be pc-relative, but the linker
* will have to do the final patch in that case) */
fragP->fr_opcode[1] |= 0x2c; /* (a4) */
fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol,fragP->fr_offset, 0, NO_RELOC, 1);
fragP->fr_opcode[1] |= 0x2c; /* (a4) */
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 1);
break;
case TAB(ABSREL,LONG):
as_bad ("ABSREL_LONG: sorry, not supported.\n");
as_bad (_("ABSREL_LONG: sorry, not supported."));
break;
case TAB(IMMREL,BYTE):
as_bad ("IMMREL_BYTE: how the ** does this look ?? \n");
as_bad (_("IMMREL_BYTE: how the ** does this look??"));
break;
case TAB(IMMREL,SHORT):
subseg_change (text_section, 0);
if ((S_GET_TYPE (fragP->fr_symbol)) == N_TEXT)
{
/* we can only fix operations on data registers, not on <ea> */
if ((fragP->fr_opcode[1] & 0x38) != 0)
{
/* use the normal reloc32, sigh... */
fix_new (fragP,(int)(fragP->fr_fix),4,fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
break;
}
/* so this is really a pc-relative address
* What we have to do now is a VERY UGLY AND BIG KLUDGE. Basically do the
* following thing:
* turn
* addl #foo,d0 (foo is N_TEXT)
* into
* pea foo(pc)
* addl (sp)+,d0
*/
*buffer_address++ = fragP->fr_opcode[0]; /* save the original command */
*buffer_address++ = fragP->fr_opcode[1];
fragP->fr_opcode[0] = 0x48; /* PEA */
fragP->fr_opcode[1] = 0x7a;
fix_new(fragP,(int)(fragP->fr_fix),2,fragP->fr_symbol, fragP->fr_offset+2, 1, NO_RELOC, 0);
*buffer_address++ = 0x9f; /* sp@+ */
fragP->fr_fix += 4; /* two byte fix, two byte code extension */
break;
}
{
/* we can only fix operations on data registers, not on <ea> */
if ((fragP->fr_opcode[1] & 0x38) != 0)
{
/* use the normal reloc32, sigh... */
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 0);
fragP->fr_fix += 4;
break;
}
/* so this is really a pc-relative address
* What we have to do now is a VERY UGLY AND BIG KLUDGE. Basically do the
* following thing:
* turn
* addl #foo,d0 (foo is N_TEXT)
* into
* pea foo(pc)
* addl (sp)+,d0
*/
*buffer_address++ = fragP->fr_opcode[0]; /* save the original command */
*buffer_address++ = fragP->fr_opcode[1];
fragP->fr_opcode[0] = 0x48; /* PEA */
fragP->fr_opcode[1] = 0x7a;
fix_new (fragP, fragP->fr_fix, 2, fragP->fr_symbol, fragP->fr_offset, 1, NO_RELOC, 0);
*buffer_address++ = 0x9f; /* sp@+ */
fragP->fr_fix += 4; /* two byte fix, two byte code extension */
break;
}
/* in that case we have to generate base-relative code
* (note: if we're in N_UNDF, this could as well be pc-relative, but the linker
* will have to do the final patch in that case) */
/* analogous (more or less;-)) to above, the following conversion is done
* turn
* addl #bar,d0 (bar is N_DATA)
@@ -4668,8 +4680,8 @@ md_convert_frag_1 (fragP)
* addl #<bar>,d0 where <bar> is a baserel-reloc
* addl a4,d0
*/
fix_new(fragP,(int)(fragP->fr_fix), 4,fragP->fr_symbol,fragP->fr_offset, 0, NO_RELOC, 1);
fix_new (fragP, fragP->fr_fix, 4, fragP->fr_symbol, fragP->fr_offset, 0, NO_RELOC, 1);
*buffer_address++ = 0xd0;
*buffer_address++ = 0x8c;
break;
@@ -4719,7 +4731,7 @@ md_estimate_size_before_relax (fragP, segment)
{
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE);
}
else if (flag_short_refs)
else if (flag_short_refs || flag_small_code)
{
/* Symbol is undefined and we want short ref. */
fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
@@ -6882,7 +6894,7 @@ s_mri_endw (ignore)
#ifdef OBJ_ELF
const char *md_shortopts = "lSA:m:kQ:V";
#else
const char *md_shortopts = "lSA:m:k";
const char *md_shortopts = "lSA:m:s:k";
#endif
struct option md_longopts[] = {
@@ -6931,11 +6943,11 @@ md_parse_option (c, arg)
case 's':
if (!strcmp(arg, "c") || !strcmp(arg, "mallcode"))
flag_small_code = 1;
flag_small_code = 1;
else
return 0;
return 0;
break;
case 'A':
if (*arg == 'm')
arg++;
@@ -7117,6 +7129,7 @@ md_show_usage (stream)
[default yes for 68020 and up]\n\
-pic, -k generate position independent code\n\
-S turn jbsr into jsr\n\
-smallcode, -sc small code model\n\
--pcrel never turn PC-relative branches into absolute jumps\n\
--register-prefix-optional\n\
recognize register names without prefix character\n\
@@ -7265,6 +7278,8 @@ md_pcrel_from (fixP)
adjust = ((fixP->fx_pcrel_adjust & 0xff) ^ 0x80) - 0x80;
if (adjust == 64)
adjust = -1;
if (OBJ_AMIGAHUNK)
return -adjust;
return fixP->fx_where + fixP->fx_frag->fr_address - adjust;
}
+6
View File
@@ -81,10 +81,16 @@ struct fix;
#define TC_COFF_FIX2RTYPE(FIX) tc_coff_fix2rtype(FIX)
#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep(frag)
extern int tc_coff_sizemachdep PARAMS ((struct frag *));
#ifdef TE_SUN3
/* This variable contains the value to write out at the beginning of
the a.out file. The 2<<16 means that this is a 68020 file instead
of an old-style 68000 file */
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (2<<16|OMAGIC); /* Magic byte for file header */
#endif /* TE_SUN3 */
#ifdef TE_AMIGA
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC); /* Magic byte for file header */
#endif
#ifndef AOUT_MACHTYPE
#define AOUT_MACHTYPE m68k_aout_machtype
+10
View File
@@ -12,3 +12,13 @@
#else
#include "obj-format.h"
#endif
#define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
do { \
if ((SIZE) >= 4) \
(P2VAR) = 2; \
else if ((SIZE) >= 2) \
(P2VAR) = 1; \
else \
(P2VAR) = 0; \
} while (0)
+3 -3
View File
@@ -328,8 +328,8 @@ changequote([,])dnl
m68hc11-*-* | m6811-*-*) fmt=elf ;;
m68hc12-*-* | m6812-*-*) fmt=elf ;;
m68*-*-amigaoshunk) fmt=amigahunk em=amiga bfd_gas=yes ;;
m68*-*-amigaos*) fmt=aout em=amiga ;;
m68k-*-amigaoshunk) fmt=amigahunk em=amiga bfd_gas=yes ;;
m68k-*-amigaos*) fmt=aout em=amiga ;;
m68k-*-vxworks*) fmt=aout em=sun3 ;;
m68k-ericsson-ose) fmt=aout em=sun3 ;;
m68k-*-sunos*) fmt=aout em=sun3 ;;
@@ -959,7 +959,7 @@ AC_PROG_CC
AC_MSG_CHECKING(for host dependent CFLAGS)
other_host_cflags=""
case "${host}" in
m68*-*-amigaos*) other_host_cflags="-mstackextend" ;;
m68k-*-amigaos*) other_host_cflags="-mstackextend" ;;
esac
test -n "$other_host_cflags" && CFLAGS="$CFLAGS $other_host_cflags"
AC_MSG_RESULT($other_host_cflags)
+1 -1
View File
@@ -1562,7 +1562,7 @@ s_data (ignore)
#ifdef OBJ_AMIGAHUNK
void
s_data_chip (ignore)
int ignore;
int ignore ATTRIBUTE_UNUSED;
{
int temp = get_absolute_expression ();
subseg_set (data_chip_section, (subsegT) temp);
-19
View File
@@ -24,25 +24,6 @@
extern const pseudo_typeS md_pseudo_table[];
/* JF moved this here from as.h under the theory that nobody except MACHINE.c
and write.c care about it anyway. */
struct relax_type
{
/* Forward reach. Signed number. > 0. */
long rlx_forward;
/* Backward reach. Signed number. < 0. */
long rlx_backward;
/* Bytes length of this address. */
unsigned char rlx_length;
/* Next longer relax-state. 0 means there is no 'next' relax-state. */
relax_substateT rlx_more;
};
typedef struct relax_type relax_typeS;
extern const int md_reloc_size; /* Size of a relocation record */
char *md_atof PARAMS ((int what_statement_type, char *literalP, int *sizeP));
+4 -14
View File
@@ -199,7 +199,7 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
offsetT offset; /* X_add_number. */
int pcrel; /* TRUE if PC-relative relocation. */
RELOC_ENUM r_type ATTRIBUTE_UNUSED; /* Relocation type. */
int baserel; /* TRUE if base-relative data */
int baserel ATTRIBUTE_UNUSED; /* TRUE if base-relative data */
{
fixS *fixP;
@@ -293,7 +293,7 @@ fix_new (frag, where, size, add_symbol, offset, pcrel, r_type, baserel)
offsetT offset; /* X_add_number. */
int pcrel; /* TRUE if PC-relative relocation. */
RELOC_ENUM r_type; /* Relocation type. */
int baserel; /* TRUE if base-relative data */
int baserel; /* TRUE if base-relative data */
{
return fix_new_internal (frag, where, size, add_symbol,
(symbolS *) NULL, offset, pcrel, r_type, baserel);
@@ -311,7 +311,7 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type, baserel)
expressionS *exp; /* Expression. */
int pcrel; /* TRUE if PC-relative relocation. */
RELOC_ENUM r_type; /* Relocation type. */
int baserel; /* TRUE if base-relative data */
int baserel; /* TRUE if base-relative data */
{
symbolS *add = NULL;
symbolS *sub = NULL;
@@ -2568,11 +2568,6 @@ fixup_segment (fixP, this_segment)
{
long seg_reloc_count = 0;
valueT add_number;
int size;
char *place;
long where;
int pcrel, plt;
char baserel = 0;
fragS *fragP;
segT add_symbol_segment = absolute_section;
@@ -2626,11 +2621,6 @@ fixup_segment (fixP, this_segment)
TC_VALIDATE_FIX (fixP, this_segment, skip);
#endif
add_number = fixP->fx_offset;
pcrel = fixP->fx_pcrel;
plt = fixP->fx_plt;
#ifdef TC_FIX_TYPE
baserel = fixP->tc_fix_data;
#endif
if (fixP->fx_addsy != NULL
&& symbol_mri_common_p (fixP->fx_addsy))
@@ -2768,7 +2758,7 @@ fixup_segment (fixP, this_segment)
}
#if !defined(BFD_ASSEMBLER) && !defined(MANY_SEGMENTS)
if (baserel && add_number)
if (fixP->tc_fix_data && add_number)
add_number -= text_last_frag->fr_address;
#endif
+1
View File
@@ -150,6 +150,7 @@ mips*-*-linux-gnu*)
m68*-*-amigaos*)
HDEFINES=-mstackextend
;;
m68*-*-linux-gnu*)
HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
;;
+108 -114
View File
@@ -28,22 +28,27 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "getopt.h"
#include "ld.h"
#include "config.h"
#include "ldmain.h"
#include "ldemul.h"
#include "ldfile.h"
#include "ldmisc.h"
#include "ldexp.h"
#include "ldlang.h"
#include "ldfile.h"
#include "ldemul.h"
#include "ldctor.h"
#if defined(TARGET_IS_amiga) || defined (TARGET_IS_ppcamiga)
#include "libamiga.h"
#else
extern int amiga_base_relative; /* defined in amigaoslink.c */
#endif
/* shared functions */
void amiga_add_options PARAMS ((int, char **, int, struct option **, int, struct option **));
bfd_boolean amiga_handle_option PARAMS ((int));
void amiga_after_parse PARAMS ((void));
void amiga_after_open PARAMS ((void));
void amiga_after_allocation PARAMS ((void));
/* amigaoslink.c variables */
/* 1 means, write out debug hunk, when producing a load file */
extern int write_debug_hunk;
@@ -51,80 +56,76 @@ extern int write_debug_hunk;
/* This is the attribute to use for the next file */
extern int amiga_attribute;
/* generate a combined data+bss hunk */
extern int amiga_base_relative;
/* generate a resident executable */
extern int amiga_resident;
/* generate a pOS executable */
extern int amiga_pOS_flg;
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
static char *gld${EMULATION_NAME}_get_script PARAMS ((int *isfile));
static int gld${EMULATION_NAME}_parse_args PARAMS ((int, char **));
#if defined(TARGET_IS_amiga)
/* Handle amiga specific options */
static int
gld${EMULATION_NAME}_parse_args (argc, argv)
int argc;
char **argv;
enum {
OPTION_IGNORE = 300,
OPTION_AMIGA_CHIP,
OPTION_AMIGA_FAST,
OPTION_AMIGA_ATTRIBUTE,
OPTION_AMIGA_DEBUG,
OPTION_AMIGA_DATABSS_TOGETHER,
OPTION_AMIGA_DATADATA_RELOC,
OPTION_FLAVOR
};
void
amiga_add_options (ns, shortopts, nl, longopts, nrl, really_longopts)
int ns ATTRIBUTE_UNUSED;
char **shortopts ATTRIBUTE_UNUSED;
int nl;
struct option **longopts;
int nrl ATTRIBUTE_UNUSED;
struct option **really_longopts ATTRIBUTE_UNUSED;
{
int prevoptind = optind;
int prevopterr = opterr;
int indx;
int longind;
int optc;
long val;
char *end;
#define OPTION_IGNORE (300)
#define OPTION_AMIGA_CHIP (OPTION_IGNORE + 1)
#define OPTION_AMIGA_FAST (OPTION_AMIGA_CHIP + 1)
#define OPTION_AMIGA_ATTRIBUTE (OPTION_AMIGA_FAST + 1)
#define OPTION_AMIGA_DEBUG (OPTION_AMIGA_ATTRIBUTE + 1)
#define OPTION_AMIGA_DATADATA_RELOC (OPTION_AMIGA_DEBUG + 1)
#define OPTION_FLAVOR (OPTION_AMIGA_DATADATA_RELOC + 1)
#define OPTION_AMIGA_POS (OPTION_FLAVOR + 1)
static struct option longopts[] = {
{"amiga-datadata-reloc", no_argument, NULL, OPTION_AMIGA_DATADATA_RELOC},
/* '\0', NULL, "Relocate for resident program", ONE_DASH },*/
{"amiga-debug-hunk", no_argument, NULL, OPTION_AMIGA_DEBUG},
/* '\0', NULL, "Output encapsulated stabs in debug hunk", ONE_DASH },*/
{"attribute", required_argument, NULL, OPTION_AMIGA_ATTRIBUTE},
/*'\0', NULL, "Set section attributes", ONE_DASH },*/
{"chip", no_argument, NULL, OPTION_AMIGA_CHIP},
/*'\0', NULL, "Force sections in chip memory", ONE_DASH },*/
{"fast", no_argument, NULL, OPTION_AMIGA_FAST},
/*'\0', NULL, "Force sections in fast memory", ONE_DASH },*/
static const struct option xtra_long[] = {
{"flavor", required_argument, NULL, OPTION_FLAVOR},
/*'\0', NULL, "Select a library flavor", ONE_DASH },*/
{"pos", no_argument, NULL, OPTION_AMIGA_POS},
/*'\0', NULL, "Output a pOS executable", ONE_DASH },*/
{"amiga-datadata-reloc", no_argument, NULL, OPTION_AMIGA_DATADATA_RELOC},
{"amiga-databss-together", no_argument, NULL, OPTION_AMIGA_DATABSS_TOGETHER},
{"amiga-debug-hunk", no_argument, NULL, OPTION_AMIGA_DEBUG},
{"attribute", required_argument, NULL, OPTION_AMIGA_ATTRIBUTE},
{"fast", no_argument, NULL, OPTION_AMIGA_FAST},
{"chip", no_argument, NULL, OPTION_AMIGA_CHIP},
{NULL, no_argument, NULL, 0}
};
indx = optind;
if (indx == 0)
indx = 1;
*longopts = (struct option *)
xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
}
opterr = 0;
optc = getopt_long_only (argc, argv, "-", longopts, &longind);
opterr = prevopterr;
bfd_boolean
amiga_handle_option (optc)
int optc;
{
switch (optc)
{
default:
optind = prevoptind;
return 0;
return FALSE;
case 0:
/* Long option which just sets a flag. */
break;
case OPTION_AMIGA_CHIP:
amiga_attribute=2; /* We do not use MEMF_FAST, so we do not have to include exec/memory.h*/
amiga_attribute = MEMF_CHIP;
break;
case OPTION_AMIGA_FAST:
amiga_attribute=4;
amiga_attribute = MEMF_FAST;
break;
case OPTION_AMIGA_ATTRIBUTE:
{
char *end;
@@ -133,68 +134,41 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
einfo ("%P%F: invalid number \`%s\'\n", optarg);
}
break;
case OPTION_AMIGA_DEBUG:
write_debug_hunk=1; /* Write out debug hunk */
write_debug_hunk = 1; /* Write out debug hunk */
break;
case OPTION_AMIGA_DATABSS_TOGETHER:
amiga_base_relative = 1; /* Combine data and bss */
break;
case OPTION_AMIGA_DATADATA_RELOC:
amiga_resident=1; /* Write out datadata_reloc array */
amiga_resident = 1; /* Write out datadata_reloc array */
break;
case OPTION_FLAVOR:
{
extern void ldfile_add_flavor (char*);
ldfile_add_flavor (optarg);
}
break;
case OPTION_AMIGA_POS:
amiga_pOS_flg = 1;
ldfile_add_flavor (optarg);
break;
}
return 1;
return TRUE;
}
static void
gld${EMULATION_NAME}_before_parse()
void
amiga_after_parse ()
{
#if defined(TARGET_IS_amiga_bss) || defined (TARGET_IS_ppcamiga_bss)
amiga_base_relative=1;
amiga_resident=0;
#endif
#ifndef TARGET_ /* I.e., if not generic. */
ldfile_output_architecture = bfd_arch_${ARCH};
#endif /* not TARGET_ */
ldfile_sort_flavors();
}
static void
gld${EMULATION_NAME}_after_parse()
{
sort_flavors();
}
static void
gld${EMULATION_NAME}_after_open()
void
amiga_after_open ()
{
ldctor_build_sets ();
}
#if defined(TARGET_IS_amiga) || defined (TARGET_IS_ppcamiga)
static void
amiga_assign_attribute(lang_input_statement_type *);
void
amiga_after_allocation()
{
#if 0 /* Does not work at the moment */
lang_for_each_input_file (amiga_assign_attribute);
#endif
}
static void
amiga_assign_attribute(inp)
amiga_assign_attribute (inp)
lang_input_statement_type *inp;
{
asection *s;
@@ -204,15 +178,33 @@ amiga_assign_attribute(inp)
for (s=inp->the_bfd->sections;s!=NULL;s=s->next)
amiga_per_section(s)->attribute=inp->amiga_attribute;
}
}
#else
extern void
amiga_after_allocation();
void
amiga_after_allocation ()
{
if (0) /* Does not work at the moment */
lang_for_each_input_file (amiga_assign_attribute);
}
#endif
static void
gld${EMULATION_NAME}_before_parse ()
{
write_debug_hunk = 0;
#if defined(TARGET_IS_amiga_bss)
amiga_base_relative = 1;
#endif
#ifndef TARGET_ /* I.e., if not generic. */
ldfile_output_architecture = bfd_arch_${ARCH};
#endif /* not TARGET_ */
}
static char *
gld${EMULATION_NAME}_get_script(isfile)
gld${EMULATION_NAME}_get_script (isfile)
int *isfile;
EOF
@@ -224,7 +216,7 @@ then
sc="-f stringify.sed"
cat >>e${EMULATION_NAME}.c <<EOF
{
{
*isfile = 0;
if (link_info.relocateable == TRUE && config.build_constructors == TRUE)
@@ -245,7 +237,7 @@ else
# Scripts read from the filesystem.
cat >>e${EMULATION_NAME}.c <<EOF
{
{
*isfile = 1;
if (link_info.relocateable == TRUE && config.build_constructors == TRUE)
@@ -270,8 +262,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
gld${EMULATION_NAME}_before_parse, /* before_parse */
syslib_default, /* syslib */
hll_default, /* hll */
gld${EMULATION_NAME}_after_parse,
gld${EMULATION_NAME}_after_open,
amiga_after_parse, /* after_parse */
amiga_after_open, /* after_open */
amiga_after_allocation, /* after_allocation */
set_output_arch_default, /* set_output_arch */
ldemul_default_target, /* choose_target */
@@ -284,11 +276,13 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
NULL, /* open_dynamic_library */
NULL, /* place_orphan */
NULL, /* set_symbols */
gld${EMULATION_NAME}_parse_args,
NULL, /* parse_args */
amiga_add_options, /* add_options */
amiga_handle_option, /* handle_option */
NULL, /* unrecognized file */
NULL, /* list_options */
NULL, /* recognized_file */
NULL, /* find_potential_libraries */
NULL /* new_vers_pattern */
NULL, /* list_options */
NULL, /* recognized_file */
NULL, /* find potential_libraries */
NULL /* new_vers_pattern */
};
EOF
+4 -4
View File
@@ -273,6 +273,7 @@ ldctor_build_sets ()
(p->h->type == bfd_link_hash_defined
|| p->h->type == bfd_link_hash_defweak))
continue;
/* For each set we build:
set:
.long number_of_elements
@@ -364,11 +365,10 @@ ldctor_build_sets ()
if (e->name != NULL)
minfo ("%T\n", e->name);
else
if (e->section->owner)
else if (e->section->owner)
minfo ("%G\n", e->section->owner, e->section, e->value);
else
minfo ("%s\n", "** ABS **");
else
minfo ("%s\n", "** ABS **");
}
/* Need SEC_KEEP for --gc-sections. */
+58 -42
View File
@@ -37,9 +37,6 @@
#include "libiberty.h"
#include "filenames.h"
static int n_flavors, flavors_len;
char **flavors;
const char * ldfile_input_filename;
bfd_boolean ldfile_assumed_script = FALSE;
const char * ldfile_output_machine_name = "";
@@ -77,6 +74,40 @@ static FILE *try_open
static bfd_boolean is_sysrooted_pathname
PARAMS ((const char *, bfd_boolean));
/* Flavour support. */
static int flavors_cmp PARAMS ((const void *f1, const void *f2));
static int n_flavors, flavors_len;
static char **flavors;
static int
flavors_cmp (f1, f2)
const void *f1, *f2;
{
return strcmp (*(char **)f1, *(char **)f2);
}
void
ldfile_sort_flavors ()
{
if (n_flavors > 1)
qsort ((void *) flavors, n_flavors, sizeof (char **), flavors_cmp);
}
void
ldfile_add_flavor (name)
const char *name;
{
n_flavors++;
if (flavors)
flavors = (char **) xrealloc ((PTR)flavors, n_flavors * sizeof (char *));
else
flavors = (char **) xmalloc (sizeof (char *));
flavors [n_flavors-1] = (char *) name;
flavors_len += strlen (name);
}
/* Test whether a pathname, after canonicalization, is the same or a
sub-directory of the sysroot directory. */
@@ -112,32 +143,6 @@ is_sysrooted_pathname (name, notsame)
/* Adds NAME to the library search path.
Makes a copy of NAME using xmalloc(). */
static int flavors_cmp (f1, f2)
const void *f1, *f2;
{
return strcmp (*(char**)f1, *(char**)f2);
}
void
sort_flavors ()
{
if (n_flavors > 1)
qsort ((void*)flavors, n_flavors, sizeof(char**), flavors_cmp);
}
void
ldfile_add_flavor (name)
char *name;
{
n_flavors++;
if (flavors)
flavors = (char**) xrealloc ((PTR)flavors, n_flavors*sizeof (char*));
else
flavors = (char**) xmalloc (sizeof (char*));
flavors [n_flavors-1] = name;
flavors_len += strlen (name);
}
void
ldfile_add_library_path (name, cmdline)
const char *name;
@@ -333,8 +338,8 @@ ldfile_open_file_search (arch, entry, lib, suffix)
const char *lib;
const char *suffix;
{
search_dirs_type *search;
char *flavor_dir = (char *) alloca (flavors_len + n_flavors + 1);
search_dirs_type *search;
/* If this is not an archive, try to open it in the current
directory first. */
@@ -367,7 +372,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
search = search->next)
{
char *string;
int i, count=n_flavors;
int i, count;
if (entry->dynamic && ! link_info.relocateable)
{
@@ -378,6 +383,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
}
}
#if 0
string = (char *) xmalloc (strlen (search->name)
+ strlen (slash)
+ strlen (lib)
@@ -392,13 +398,22 @@ ldfile_open_file_search (arch, entry, lib, suffix)
else
sprintf (string, "%s%s%s", search->name, slash, entry->filename);
for (count = n_flavors; count>=0; count--) {
if (ldfile_try_open_bfd (string, entry))
{
entry->filename = string;
entry->sysrooted = search->sysrooted;
return TRUE;
}
free (string);
#else
for (count=n_flavors; count>=0; count--) {
*flavor_dir = '\0';
for (i=0; i<count; i++) {
strcat (flavor_dir, flavors[i]);
strcat (flavor_dir, slash);
}
string = (char *) xmalloc (strlen (search->name)
+ strlen (slash)
+ strlen (flavor_dir)
@@ -407,7 +422,7 @@ ldfile_open_file_search (arch, entry, lib, suffix)
+ strlen (arch)
+ strlen (suffix)
+ 1);
if (entry->is_archive)
sprintf (string, "%s%s%s%s%s%s%s", search->name, slash, flavor_dir,
lib, entry->filename, arch, suffix);
@@ -416,15 +431,16 @@ ldfile_open_file_search (arch, entry, lib, suffix)
else
sprintf (string, "%s%s%s%s", search->name, slash, flavor_dir,
entry->filename);
if (ldfile_try_open_bfd (string, entry))
{
entry->filename = string;
return TRUE;
}
free (string);
}
if (ldfile_try_open_bfd (string, entry))
{
entry->filename = string;
return TRUE;
}
free (string);
}
#endif
}
return FALSE;
+5
View File
@@ -61,4 +61,9 @@ extern bfd_boolean ldfile_open_file_search
PARAMS ((const char *arch, struct lang_input_statement_struct *,
const char *lib, const char *suffix));
extern void ldfile_sort_flavors
PARAMS ((void));
extern void ldfile_add_flavor
PARAMS ((const char *));
#endif
+1
View File
@@ -479,6 +479,7 @@ main (argc, argv)
else
output_bfd->flags |= EXEC_P;
#endif
ldwrite ();
if (config.map_file != NULL)
+4 -2
View File
@@ -14,6 +14,7 @@ SECTIONS
${RELOCATING+___machtype = ABSOLUTE(0x0);}
${RELOCATING+__stext = .;}
*(.text)
${RELOCATING+___datadata_relocs = .;}
${RELOCATING+__etext = .;}
${RELOCATING+___text_size = ABSOLUTE(__etext - __stext);}
${PAD_TEXT+${RELOCATING+. = ${DATA_ALIGNMENT};}}
@@ -24,16 +25,17 @@ SECTIONS
${RELOCATING+__sdata = .;}
${CONSTRUCTING+CONSTRUCTORS}
*(.data)
${RELOCATING+___a4_init = 0x7ffe;}
${RELOCATING+__edata = .;}
${RELOCATING+___data_size = ABSOLUTE(__edata - __sdata);}
}
${RELOCATING+. = ALIGN(0x0);}
.bss :
{
${RELOCATING+ __bss_start = .};
${RELOCATING+__bss_start = .;}
*(.bss)
*(COMMON)
${RELOCATING+__end = . };
${RELOCATING+__end = .;}
${RELOCATING+___bss_size = ABSOLUTE(__end - __bss_start);}
}
.data_chip :
+2 -2
View File
@@ -33,8 +33,8 @@ SECTIONS
{
*(.bss)
*(COMMON)
${RELOCATING+__edata = .;}
${RELOCATING+__bss_start = .;}
${RELOCATING+__edata = .;}
${RELOCATING+__bss_start = .;}
${RELOCATING+__end = ALIGN(4) };
}
}