aboutsummaryrefslogtreecommitdiff
path: root/contrib/binutils/gas/config
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2002-02-22 04:18:42 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2002-02-22 04:18:42 +0000
commiteb1d121cb55ff0f0d8e40ad598525b3ac11eae35 (patch)
tree70c0d6a941b83c97839ec1237622c20ea8beb870 /contrib/binutils/gas/config
parentdbbf32dd39b128be2abe8393933bc942be4c0925 (diff)
downloadsrc-eb1d121cb55ff0f0d8e40ad598525b3ac11eae35.tar.gz
src-eb1d121cb55ff0f0d8e40ad598525b3ac11eae35.zip
Import of Binutils from the FSF 2.12 branch (pre-.0 release).
These bits are taken from the FSF anoncvs repo on 21-Feburary-2002 20:15 PST.
Notes
Notes: svn path=/vendor/binutils/dist/; revision=91041
Diffstat (limited to 'contrib/binutils/gas/config')
-rw-r--r--contrib/binutils/gas/config/obj-coff.c24
-rw-r--r--contrib/binutils/gas/config/obj-coff.h199
-rw-r--r--contrib/binutils/gas/config/obj-elf.c12
-rw-r--r--contrib/binutils/gas/config/tc-alpha.c65
-rw-r--r--contrib/binutils/gas/config/tc-alpha.h2
-rw-r--r--contrib/binutils/gas/config/tc-i386.c68
-rw-r--r--contrib/binutils/gas/config/tc-ppc.c2
-rw-r--r--contrib/binutils/gas/config/tc-sparc.c22
8 files changed, 248 insertions, 146 deletions
diff --git a/contrib/binutils/gas/config/obj-coff.c b/contrib/binutils/gas/config/obj-coff.c
index 759389acdf6b..c956d62d56a8 100644
--- a/contrib/binutils/gas/config/obj-coff.c
+++ b/contrib/binutils/gas/config/obj-coff.c
@@ -1,6 +1,6 @@
/* coff object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001
+ 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GAS.
@@ -1889,7 +1889,7 @@ count_entries_in_chain (idx)
{
if (fixup_ptr->fx_done == 0 && TC_COUNT_RELOC (fixup_ptr))
{
-#ifdef TC_A29K
+#if defined(TC_A29K) || defined(TC_OR32)
if (fixup_ptr->fx_r_type == RELOC_CONSTH)
nrelocs += 2;
else
@@ -2048,6 +2048,20 @@ do_relocs_for (abfd, h, file_cursor)
ext_ptr++;
}
#endif
+#if defined(TC_OR32)
+ /* The or32 has a special kludge for the high 16 bit
+ reloc. Two relocations are emited, R_IHIHALF,
+ and R_IHCONST. The second one doesn't contain a
+ symbol, but uses the value for offset. */
+ if (intr.r_type == R_IHIHALF)
+ {
+ /* Now emit the second bit. */
+ intr.r_type = R_IHCONST;
+ intr.r_symndx = fix_ptr->fx_addnumber;
+ (void) bfd_coff_swap_reloc_out (abfd, & intr, ext_ptr);
+ ext_ptr ++;
+ }
+#endif
}
fix_ptr = fix_ptr->fx_next;
@@ -2127,6 +2141,7 @@ fill_section (abfd, h, file_cursor)
COFF_NOLOAD_PROBLEM, and have only one test here. */
#ifndef TC_I386
#ifndef TC_A29K
+#ifndef TC_OR32
#ifndef COFF_NOLOAD_PROBLEM
/* Apparently the SVR3 linker (and exec syscall) and UDI
mondfe progrem are confused by noload sections. */
@@ -2134,6 +2149,7 @@ fill_section (abfd, h, file_cursor)
#endif
#endif
#endif
+#endif
}
else if (strcmp (s->s_name, ".lit") == 0)
s->s_flags = STYP_LIT | STYP_TEXT;
@@ -4420,7 +4436,7 @@ fixup_segment (segP, this_segment_type)
break;
default:
-#if defined(TC_A29K) || (defined(TE_PE) && defined(TC_I386)) || defined(TC_M88K)
+#if defined(TC_A29K) || (defined(TE_PE) && defined(TC_I386)) || defined(TC_M88K) || defined(TC_OR32)
/* This really should be handled in the linker, but
backward compatibility forbids. */
add_number += S_GET_VALUE (add_symbolP);
@@ -4466,7 +4482,7 @@ fixup_segment (segP, this_segment_type)
if (pcrel)
{
-#if !defined(TC_M88K) && !(defined(TE_PE) && defined(TC_I386)) && !defined(TC_A29K)
+#if !defined(TC_M88K) && !(defined(TE_PE) && defined(TC_I386)) && !defined(TC_A29K) && !defined(TC_OR32)
/* This adjustment is not correct on the m88k, for which the
linker does all the computation. */
add_number -= md_pcrel_from (fixP);
diff --git a/contrib/binutils/gas/config/obj-coff.h b/contrib/binutils/gas/config/obj-coff.h
index 98948bea5315..8d2ae736ac96 100644
--- a/contrib/binutils/gas/config/obj-coff.h
+++ b/contrib/binutils/gas/config/obj-coff.h
@@ -1,6 +1,6 @@
/* coff object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000
+ 1999, 2000, 2002
Free Software Foundation, Inc.
This file is part of GAS.
@@ -90,6 +90,11 @@
#define TARGET_FORMAT "coff-a29k-big"
#endif
+#ifdef TC_OR32
+#include "coff/or32.h"
+#define TARGET_FORMAT "coff-or32-big"
+#endif
+
#ifdef TC_I960
#include "coff/i960.h"
#define TARGET_FORMAT "coff-Intel-little"
@@ -122,15 +127,10 @@
#define TARGET_FORMAT "pe-shl"
#else
-#if 0 /* FIXME: The "shl" varaible does not appear to exist. What happened to it ? */
#define TARGET_FORMAT \
- (shl \
+ (!target_big_endian \
? (sh_small ? "coff-shl-small" : "coff-shl") \
: (sh_small ? "coff-sh-small" : "coff-sh"))
-#else
-#define TARGET_FORMAT \
- (sh_small ? "coff-shl-small" : "coff-shl")
-#endif
#endif
#endif
@@ -190,9 +190,7 @@ extern void coff_obj_symbol_new_hook PARAMS ((symbolS *));
extern void coff_obj_read_begin_hook PARAMS ((void));
#define obj_read_begin_hook coff_obj_read_begin_hook
-/* ***********************************************************************
-
- This file really contains two implementations of the COFF back end.
+/* This file really contains two implementations of the COFF back end.
They are in the process of being merged, but this is only a
preliminary, mechanical merging. Many definitions that are
identical between the two are still found in both versions.
@@ -226,9 +224,7 @@ extern void coff_obj_read_begin_hook PARAMS ((void));
See doc/internals.texi for a brief discussion of the history, if
you care.
- Ken Raeburn, 5 May 1994
-
- *********************************************************************** */
+ Ken Raeburn, 5 May 1994. */
#ifdef BFD_ASSEMBLER
@@ -257,10 +253,10 @@ extern void coff_obj_read_begin_hook PARAMS ((void));
extern void obj_coff_section PARAMS ((int));
-/* The number of auxiliary entries */
+/* The number of auxiliary entries. */
#define S_GET_NUMBER_AUXILIARY(s) \
(coffsymbol (symbol_get_bfdsym (s))->native->u.syment.n_numaux)
-/* The number of auxiliary entries */
+/* The number of auxiliary entries. */
#define S_SET_NUMBER_AUXILIARY(s,v) (S_GET_NUMBER_AUXILIARY (s) = (v))
/* True if a symbol name is in the string table, i.e. its length is > 8. */
@@ -271,9 +267,9 @@ extern int S_SET_STORAGE_CLASS PARAMS ((symbolS *, int));
extern int S_GET_STORAGE_CLASS PARAMS ((symbolS *));
extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
-/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
-/* Omit the tv related fields */
-/* Accessors */
+/* Auxiliary entry macros. SA_ stands for symbol auxiliary. */
+/* Omit the tv related fields. */
+/* Accessors. */
#define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l)
#define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno)
@@ -297,15 +293,13 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v))
#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
-/*
- * Internal use only definitions. SF_ stands for symbol flags.
- *
- * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
- *
- * You'll break i960 if you shift the SYSPROC bits anywhere else. for
- * more on the balname/callname hack, see tc-i960.h. b.out is done
- * differently.
- */
+/* Internal use only definitions. SF_ stands for symbol flags.
+
+ These values can be assigned to sy_symbol.ost_flags field of a symbolS.
+
+ You'll break i960 if you shift the SYSPROC bits anywhere else. for
+ more on the balname/callname hack, see tc-i960.h. b.out is done
+ differently. */
#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
@@ -330,7 +324,7 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
/* All other bits are unused. */
-/* Accessors */
+/* Accessors. */
#define SF_GET(s) (*symbol_get_obj (s))
#define SF_GET_DEBUG(s) (symbol_get_bfdsym (s)->flags & BSF_DEBUGGING)
#define SF_SET_DEBUG(s) (symbol_get_bfdsym (s)->flags |= BSF_DEBUGGING)
@@ -352,7 +346,7 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */
#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */
-/* Modifiers */
+/* Modifiers. */
#define SF_SET(s,v) (SF_GET (s) = (v))
#define SF_SET_NORMAL_FIELD(s,v) (SF_GET (s) |= ((v) & SF_NORMAL_MASK))
#define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK))
@@ -414,7 +408,7 @@ extern symbolS *coff_last_function;
#endif
#endif
-/* sanity check */
+/* Sanity check. */
#ifdef TC_I960
#ifndef C_LEAFSTAT
@@ -424,8 +418,8 @@ hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on i
#else /* not BFD_ASSEMBLER */
-#ifdef TC_A29K
-/* Allow translate from aout relocs to coff relocs */
+#if defined TC_A29K || defined TC_OR32
+/* Allow translate from aout relocs to coff relocs. */
#define NO_RELOC 20
#define RELOC_32 1
#define RELOC_8 2
@@ -447,7 +441,7 @@ extern const segT N_TYPE_seg[];
/* SYMBOL TABLE */
-/* Symbol table entry data type */
+/* Symbol table entry data type. */
typedef struct
{
@@ -455,18 +449,17 @@ typedef struct
struct internal_syment ost_entry;
/* Auxiliary entry. */
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES];
- /* obj_coff internal use only flags */
+ /* obj_coff internal use only flags. */
unsigned int ost_flags;
} obj_symbol_type;
#ifndef DO_NOT_STRIP
#define DO_NOT_STRIP 0
#endif
-/* Symbol table macros and constants */
+/* Symbol table macros and constants. */
/* Possible and usefull section number in symbol table
- * The values of TEXT, DATA and BSS may not be portable.
- */
+ The values of TEXT, DATA and BSS may not be portable. */
#define C_ABS_SECTION N_ABS
#define C_UNDEF_SECTION N_UNDEF
@@ -475,27 +468,25 @@ typedef struct
#define C_PTV_SECTION P_TV
#define C_REGISTER_SECTION 50
-/*
- * 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.
- */
+/* 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. */
-/* Predicates */
-/* True if the symbol is external */
+/* Predicates. */
+/* True if the symbol is external. */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
/* True if symbol has been defined, ie :
section > 0 (DATA, TEXT or BSS)
- section == 0 and value > 0 (external bss symbol) */
+ section == 0 and value > 0 (external bss symbol). */
#define S_IS_DEFINED(s) \
((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION \
|| ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION \
&& S_GET_VALUE (s) > 0) \
|| ((s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
-/* True if a debug special symbol entry */
+/* True if a debug special symbol entry. */
#define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
-/* True if a symbol is local symbol name */
-/* A symbol name whose name includes ^A is a gas internal pseudo symbol */
+/* True if a symbol is local symbol name. */
+/* A symbol name whose name includes ^A is a gas internal pseudo symbol. */
#define S_IS_LOCAL(s) \
((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
|| (S_LOCAL_NAME(s) && ! flag_keep_locals && ! S_IS_DEBUG (s)) \
@@ -504,13 +495,11 @@ typedef struct
|| (flag_strip_local_absolute \
&& !S_IS_EXTERNAL(s) \
&& (s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
-/* True if a symbol is not defined in this file */
+/* True if a symbol is not defined in this file. */
#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
&& S_GET_VALUE (s) == 0)
-/*
- * True if a symbol can be multiply defined (bss symbols have this def
- * though it is bad practice)
- */
+/* True if a symbol can be multiply defined (bss symbols have this def
+ though it is bad practice). */
#define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 \
&& S_GET_VALUE (s) != 0)
/* True if a symbol name is in the string table, i.e. its length is > 8. */
@@ -526,41 +515,41 @@ typedef struct
((s)->sy_symbol.ost_entry.n_sclass == C_WEAKEXT)
#endif
-/* Accessors */
-/* The name of the symbol */
+/* Accessors. */
+/* The name of the symbol. */
#define S_GET_NAME(s) ((char*) (s)->sy_symbol.ost_entry.n_offset)
-/* The pointer to the string table */
+/* The pointer to the string table. */
#define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset)
-/* The numeric value of the segment */
+/* The numeric value of the segment. */
#define S_GET_SEGMENT(s) s_get_segment(s)
-/* The data type */
+/* The data type. */
#define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type)
-/* The storage class */
+/* The storage class. */
#define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass)
-/* The number of auxiliary entries */
+/* The number of auxiliary entries. */
#define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux)
-/* Modifiers */
-/* Set the name of the symbol */
+/* Modifiers. */
+/* Set the name of the symbol. */
#define S_SET_NAME(s,v) ((s)->sy_symbol.ost_entry.n_offset = (unsigned long) (v))
-/* Set the offset of the symbol */
+/* Set the offset of the symbol. */
#define S_SET_OFFSET(s,v) ((s)->sy_symbol.ost_entry.n_offset = (v))
-/* The numeric value of the segment */
+/* The numeric value of the segment. */
#define S_SET_SEGMENT(s,v) ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
-/* The data type */
+/* The data type. */
#define S_SET_DATA_TYPE(s,v) ((s)->sy_symbol.ost_entry.n_type = (v))
-/* The storage class */
+/* The storage class. */
#define S_SET_STORAGE_CLASS(s,v) ((s)->sy_symbol.ost_entry.n_sclass = (v))
-/* The number of auxiliary entries */
+/* The number of auxiliary entries. */
#define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_symbol.ost_entry.n_numaux = (v))
-/* Additional modifiers */
-/* The symbol is external (does not mean undefined) */
+/* Additional modifiers. */
+/* The symbol is external (does not mean undefined). */
#define S_SET_EXTERNAL(s) { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
-/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
-/* Omit the tv related fields */
-/* Accessors */
+/* Auxiliary entry macros. SA_ stands for symbol auxiliary. */
+/* Omit the tv related fields. */
+/* Accessors. */
#define SYM_AUXENT(S) (&(S)->sy_symbol.ost_auxent[0])
#define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l)
@@ -577,7 +566,7 @@ typedef struct
#define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc)
#define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno)
-/* Modifiers */
+/* Modifiers. */
#define SA_SET_SYM_TAGNDX(s,v) (SYM_AUXENT (s)->x_sym.x_tagndx.l=(v))
#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno=(v))
#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size=(v))
@@ -592,15 +581,13 @@ typedef struct
#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v))
#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
-/*
- * Internal use only definitions. SF_ stands for symbol flags.
- *
- * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
- *
- * You'll break i960 if you shift the SYSPROC bits anywhere else. for
- * more on the balname/callname hack, see tc-i960.h. b.out is done
- * differently.
- */
+/* Internal use only definitions. SF_ stands for symbol flags.
+
+ These values can be assigned to sy_symbol.ost_flags field of a symbolS.
+
+ You'll break i960 if you shift the SYSPROC bits anywhere else. for
+ more on the balname/callname hack, see tc-i960.h. b.out is done
+ differently. */
#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
@@ -626,7 +613,7 @@ typedef struct
#define SF_ADJ_LNNOPTR (0x00400000) /* Has a lnnoptr */
/* All other bits are unused. */
-/* Accessors */
+/* Accessors. */
#define SF_GET(s) ((s)->sy_symbol.ost_flags)
#define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK)
#define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK)
@@ -648,7 +635,7 @@ typedef struct
#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */
#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */
-/* Modifiers */
+/* Modifiers. */
#define SF_SET(s,v) (SF_GET (s) = (v))
#define SF_SET_NORMAL_FIELD(s,v) (SF_GET (s) |= ((v) & SF_NORMAL_MASK))
#define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK))
@@ -671,12 +658,10 @@ typedef struct
#define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* used by i960 */
#define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* used by i960 */
-/* File header macro and type definition */
+/* File header macro and type definition. */
-/*
- * File position calculators. Beware to use them when all the
- * appropriate fields are set in the header.
- */
+/* File position calculators. Beware to use them when all the
+ appropriate fields are set in the header. */
#ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER
#define OBJ_COFF_AOUTHDRSZ (0)
@@ -714,8 +699,8 @@ typedef struct
H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
-/* Accessors */
-/* aouthdr */
+/* Accessors. */
+/* aouthdr. */
#define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic)
#define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp)
#define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize)
@@ -724,7 +709,7 @@ typedef struct
#define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry)
#define H_GET_TEXT_START(h) ((h)->aouthdr.text_start)
#define H_GET_DATA_START(h) ((h)->aouthdr.data_start)
-/* filehdr */
+/* filehdr. */
#define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic)
#define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns)
#define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat)
@@ -733,7 +718,7 @@ typedef struct
#define H_GET_SYMBOL_TABLE_SIZE(h) (H_GET_SYMBOL_COUNT(h) * SYMESZ)
#define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr)
#define H_GET_FLAGS(h) ((h)->filehdr.f_flags)
-/* Extra fields to achieve bsd a.out compatibility and for convenience */
+/* Extra fields to achieve bsd a.out compatibility and for convenience. */
#define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size)
#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
#define H_GET_LINENO_SIZE(h) ((h)->lineno_size)
@@ -750,8 +735,8 @@ typedef struct
#define H_GET_TEXT_RELOCATION_SIZE(h) (text_section_header.s_nreloc * RELSZ)
#define H_GET_DATA_RELOCATION_SIZE(h) (data_section_header.s_nreloc * RELSZ)
-/* Modifiers */
-/* aouthdr */
+/* Modifiers. */
+/* aouthdr. */
#define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v))
#define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v))
#define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v))
@@ -760,7 +745,7 @@ typedef struct
#define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v))
#define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v))
#define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v))
-/* filehdr */
+/* filehdr. */
#define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
#define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v))
#define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v))
@@ -768,30 +753,30 @@ typedef struct
#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v))
#define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
#define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v))
-/* Extra fields to achieve bsd a.out compatibility and for convinience */
+/* Extra fields to achieve bsd a.out compatibility and for convinience. */
#define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d))
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
#define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
-/* Segment flipping */
+/* Segment flipping. */
typedef struct
{
struct internal_aouthdr aouthdr; /* a.out header */
struct internal_filehdr filehdr; /* File header, not machine dep. */
- long string_table_size; /* names + '\0' + sizeof (int) */
- long relocation_size; /* Cumulated size of relocation
- information for all sections in
- bytes. */
- long lineno_size; /* Size of the line number information
- table in bytes */
+ long string_table_size; /* names + '\0' + sizeof (int) */
+ long relocation_size; /* Cumulated size of relocation
+ information for all sections in
+ bytes. */
+ long lineno_size; /* Size of the line number information
+ table in bytes. */
} object_headers;
struct lineno_list
{
struct bfd_internal_lineno line;
- char *frag; /* Frag to which the line number is related */
- struct lineno_list *next; /* Forward chain pointer */
+ char *frag; /* Frag to which the line number is related. */
+ struct lineno_list *next; /* Forward chain pointer. */
};
#define obj_segment_name(i) (segment_info[(int) (i)].scnhdr.s_name)
@@ -823,7 +808,7 @@ extern void c_section_header PARAMS ((struct internal_scnhdr * header,
void tc_coff_symbol_emit_hook PARAMS ((symbolS *));
#endif
-/* sanity check */
+/* Sanity check. */
#ifdef TC_I960
#ifndef C_LEAFSTAT
diff --git a/contrib/binutils/gas/config/obj-elf.c b/contrib/binutils/gas/config/obj-elf.c
index 6ec08820242c..13c748211c49 100644
--- a/contrib/binutils/gas/config/obj-elf.c
+++ b/contrib/binutils/gas/config/obj-elf.c
@@ -1995,9 +1995,9 @@ elf_frob_file_before_adjust ()
symbolS *symp;
for (symp = symbol_rootP; symp; symp = symbol_next (symp))
- if (symbol_get_obj (symp)->versioned_name)
+ if (!S_IS_DEFINED (symp))
{
- if (!S_IS_DEFINED (symp))
+ if (symbol_get_obj (symp)->versioned_name)
{
char *p;
@@ -2017,6 +2017,14 @@ elf_frob_file_before_adjust ()
&& symbol_used_in_reloc_p (symp) == 0)
symbol_remove (symp, &symbol_rootP, &symbol_lastP);
}
+
+ /* If there was .weak foo, but foo was neither defined nor
+ used anywhere, remove it. */
+
+ else if (S_IS_WEAK (symp)
+ && symbol_used_p (symp) == 0
+ && symbol_used_in_reloc_p (symp) == 0)
+ symbol_remove (symp, &symbol_rootP, &symbol_lastP);
}
}
}
diff --git a/contrib/binutils/gas/config/tc-alpha.c b/contrib/binutils/gas/config/tc-alpha.c
index b1a34710085f..ae6f76b95006 100644
--- a/contrib/binutils/gas/config/tc-alpha.c
+++ b/contrib/binutils/gas/config/tc-alpha.c
@@ -117,6 +117,7 @@ struct alpha_macro {
#define O_gprelhigh O_md9 /* !gprelhigh relocation */
#define O_gprellow O_md10 /* !gprellow relocation */
#define O_gprel O_md11 /* !gprel relocation */
+#define O_samegp O_md12 /* !samegp relocation */
#define DUMMY_RELOC_LITUSE_ADDR (BFD_RELOC_UNUSED + 1)
#define DUMMY_RELOC_LITUSE_BASE (BFD_RELOC_UNUSED + 2)
@@ -128,7 +129,7 @@ struct alpha_macro {
#define LITUSE_BYTOFF 2
#define LITUSE_JSR 3
-#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_gprel)
+#define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_samegp)
/* Macros for extracting the type and number of encoded register tokens */
@@ -498,7 +499,8 @@ static const struct alpha_reloc_op_tag {
DEF(gpdisp, BFD_RELOC_ALPHA_GPDISP, 1, 1),
DEF(gprelhigh, BFD_RELOC_ALPHA_GPREL_HI16, 0, 0),
DEF(gprellow, BFD_RELOC_ALPHA_GPREL_LO16, 0, 0),
- DEF(gprel, BFD_RELOC_GPREL16, 0, 0)
+ DEF(gprel, BFD_RELOC_GPREL16, 0, 0),
+ DEF(samegp, BFD_RELOC_ALPHA_BRSGP, 0, 0)
};
#undef DEF
@@ -1219,6 +1221,11 @@ md_apply_fix3 (fixP, valP, seg)
}
return;
+#ifdef OBJ_ELF
+ case BFD_RELOC_ALPHA_BRSGP:
+ return;
+#endif
+
#ifdef OBJ_ECOFF
case BFD_RELOC_ALPHA_LITERAL:
md_number_to_chars (fixpos, value, 2);
@@ -1364,6 +1371,49 @@ alpha_define_label (sym)
alpha_insn_label = sym;
}
+/* If we have a BRSGP reloc to a local symbol, adjust it to BRADDR and
+ let it get resolved at assembly time. */
+
+void
+alpha_validate_fix (f)
+ fixS *f;
+{
+#ifdef OBJ_ELF
+ int offset = 0;
+ const char *name;
+
+ if (f->fx_r_type != BFD_RELOC_ALPHA_BRSGP)
+ return;
+
+ if (! S_IS_DEFINED (f->fx_addsy))
+ return;
+
+ switch (S_GET_OTHER (f->fx_addsy) & STO_ALPHA_STD_GPLOAD)
+ {
+ case STO_ALPHA_NOPV:
+ break;
+ case STO_ALPHA_STD_GPLOAD:
+ offset = 8;
+ break;
+ default:
+ if (S_IS_LOCAL (f->fx_addsy))
+ name = "<local>";
+ else
+ name = S_GET_NAME (f->fx_addsy);
+ as_bad_where (f->fx_file, f->fx_line,
+ _("!samegp reloc against symbol without .prologue: %s"),
+ name);
+ break;
+ }
+
+ if (! (S_IS_EXTERN (f->fx_addsy) || S_IS_WEAK (f->fx_addsy)))
+ {
+ f->fx_r_type = BFD_RELOC_23_PCREL_S2;
+ f->fx_offset += offset;
+ }
+#endif
+}
+
/* Return true if we must always emit a reloc for a type and false if
there is some hope of resolving it at assembly time. */
@@ -1388,6 +1438,7 @@ alpha_force_relocation (f)
case BFD_RELOC_ALPHA_GPREL_LO16:
case BFD_RELOC_ALPHA_LINKAGE:
case BFD_RELOC_ALPHA_CODEADDR:
+ case BFD_RELOC_ALPHA_BRSGP:
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
return 1;
@@ -1399,8 +1450,6 @@ alpha_force_relocation (f)
return 0;
default:
- assert ((int) f->fx_r_type < 0
- && -(int) f->fx_r_type < (int) alpha_num_operands);
return 0;
}
}
@@ -1424,6 +1473,7 @@ alpha_fix_adjustable (f)
case BFD_RELOC_ALPHA_GPDISP_HI16:
case BFD_RELOC_ALPHA_GPDISP_LO16:
case BFD_RELOC_ALPHA_GPDISP:
+ case BFD_RELOC_ALPHA_BRSGP:
return 0;
case BFD_RELOC_ALPHA_LITERAL:
@@ -1448,8 +1498,6 @@ alpha_fix_adjustable (f)
return 1;
default:
- assert ((int) f->fx_r_type < 0
- && - (int) f->fx_r_type < (int) alpha_num_operands);
return 1;
}
/*NOTREACHED*/
@@ -1767,6 +1815,7 @@ debug_exp (tok, ntok)
case O_pregister: name = "O_pregister"; break;
case O_cpregister: name = "O_cpregister"; break;
case O_literal: name = "O_literal"; break;
+ case O_lituse_addr: name = "O_lituse_addr"; break;
case O_lituse_base: name = "O_lituse_base"; break;
case O_lituse_bytoff: name = "O_lituse_bytoff"; break;
case O_lituse_jsr: name = "O_lituse_jsr"; break;
@@ -1774,8 +1823,7 @@ debug_exp (tok, ntok)
case O_gprelhigh: name = "O_gprelhigh"; break;
case O_gprellow: name = "O_gprellow"; break;
case O_gprel: name = "O_gprel"; break;
- case O_md11: name = "O_md11"; break;
- case O_md12: name = "O_md12"; break;
+ case O_samegp: name = "O_samegp"; break;
case O_md13: name = "O_md13"; break;
case O_md14: name = "O_md14"; break;
case O_md15: name = "O_md15"; break;
@@ -2170,6 +2218,7 @@ find_macro_match (first_macro, tok, pntok)
case O_gprelhigh:
case O_gprellow:
case O_gprel:
+ case O_samegp:
goto match_failed;
default:
diff --git a/contrib/binutils/gas/config/tc-alpha.h b/contrib/binutils/gas/config/tc-alpha.h
index fb428f9f32eb..5505861316df 100644
--- a/contrib/binutils/gas/config/tc-alpha.h
+++ b/contrib/binutils/gas/config/tc-alpha.h
@@ -39,12 +39,14 @@
#define NEED_LITERAL_POOL
#define REPEAT_CONS_EXPRESSIONS
+extern void alpha_validate_fix PARAMS ((struct fix *));
extern int alpha_force_relocation PARAMS ((struct fix *));
extern int alpha_fix_adjustable PARAMS ((struct fix *));
extern unsigned long alpha_gprmask, alpha_fprmask;
extern valueT alpha_gp_value;
+#define TC_VALIDATE_FIX(FIXP,SEGTYPE,SKIP) alpha_validate_fix (FIXP)
#define TC_FORCE_RELOCATION(FIXP) alpha_force_relocation (FIXP)
#define tc_fix_adjustable(FIXP) alpha_fix_adjustable (FIXP)
#define RELOC_REQUIRES_SYMBOL
diff --git a/contrib/binutils/gas/config/tc-i386.c b/contrib/binutils/gas/config/tc-i386.c
index c81f87027c90..2b82037a8ba5 100644
--- a/contrib/binutils/gas/config/tc-i386.c
+++ b/contrib/binutils/gas/config/tc-i386.c
@@ -1,6 +1,6 @@
/* i386.c -- Assemble code for the Intel 80386
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -48,8 +48,12 @@
#define SCALE1_WHEN_NO_INDEX 1
#endif
+#ifndef true
#define true 1
+#endif
+#ifndef false
#define false 0
+#endif
static unsigned int mode_from_disp_size PARAMS ((unsigned int));
static int fits_in_signed_byte PARAMS ((offsetT));
@@ -1174,7 +1178,12 @@ tc_i386_fix_adjustable (fixP)
/* Prevent all adjustments to global symbols, or else dynamic
linking will not work correctly. */
if (S_IS_EXTERNAL (fixP->fx_addsy)
- || S_IS_WEAK (fixP->fx_addsy))
+ || S_IS_WEAK (fixP->fx_addsy)
+ /* Don't adjust pc-relative references to merge sections in 64-bit
+ mode. */
+ || (use_rela_relocations
+ && (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
+ && fixP->fx_pcrel))
return 0;
#endif
/* adjust_reloc_syms doesn't know about the GOT. */
@@ -1294,6 +1303,7 @@ md_assemble (line)
/* If we are in 16-bit mode, do not allow addr16 or data16.
Similarly, in 32-bit mode, do not allow addr32 or data32. */
if ((current_templates->start->opcode_modifier & (Size16 | Size32))
+ && flag_code != CODE_64BIT
&& (((current_templates->start->opcode_modifier & Size32) != 0)
^ (flag_code == CODE_16BIT)))
{
@@ -2259,6 +2269,14 @@ md_assemble (line)
return;
}
+ if (i.suffix != QWORD_MNEM_SUFFIX && (flag_code == CODE_64BIT)
+ && !(i.tm.opcode_modifier & IgnoreSize)
+ && (i.tm.opcode_modifier & JumpByte))
+ {
+ if (! add_prefix (ADDR_PREFIX_OPCODE))
+ return;
+ }
+
/* Set mode64 for an operand. */
if (i.suffix == QWORD_MNEM_SUFFIX
&& !(i.tm.opcode_modifier & NoRex64))
@@ -2411,13 +2429,15 @@ md_assemble (line)
if (! i.index_reg)
{
/* Operand is just <disp> */
- if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
+ if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0)
+ && (flag_code != CODE_64BIT))
{
i.rm.regmem = NO_BASE_REGISTER_16;
i.types[op] &= ~Disp;
i.types[op] |= Disp16;
}
- else if (flag_code != CODE_64BIT)
+ else if (flag_code != CODE_64BIT
+ || (i.prefix[ADDR_PREFIX] != 0))
{
i.rm.regmem = NO_BASE_REGISTER;
i.types[op] &= ~Disp;
@@ -3434,10 +3454,13 @@ i386_displacement (disp_start, disp_end)
#endif
int bigdisp = Disp32;
- if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
- bigdisp = Disp16;
if (flag_code == CODE_64BIT)
- bigdisp = Disp64;
+ {
+ if (!i.prefix[ADDR_PREFIX])
+ bigdisp = Disp64;
+ }
+ else if ((flag_code == CODE_16BIT) ^ (i.prefix[ADDR_PREFIX] != 0))
+ bigdisp = Disp16;
i.types[this_operand] |= bigdisp;
exp = &disp_expressions[i.disp_operands];
@@ -3592,15 +3615,28 @@ i386_index_check (operand_string)
ok = 1;
if (flag_code == CODE_64BIT)
{
- /* 64bit checks. */
- if ((i.base_reg
- && ((i.base_reg->reg_type & Reg64) == 0)
- && (i.base_reg->reg_type != BaseIndex
- || i.index_reg))
- || (i.index_reg
- && ((i.index_reg->reg_type & (Reg64|BaseIndex))
- != (Reg64|BaseIndex))))
- ok = 0;
+ if (i.prefix[ADDR_PREFIX] == 0)
+ {
+ /* 64bit checks. */
+ if ((i.base_reg
+ && ((i.base_reg->reg_type & Reg64) == 0)
+ && (i.base_reg->reg_type != BaseIndex
+ || i.index_reg))
+ || (i.index_reg
+ && ((i.index_reg->reg_type & (Reg64|BaseIndex))
+ != (Reg64|BaseIndex))))
+ ok = 0;
+ }
+ else
+ {
+ /* 32bit checks. */
+ if ((i.base_reg
+ && (i.base_reg->reg_type & (Reg32 | RegRex)) != Reg32)
+ || (i.index_reg
+ && ((i.index_reg->reg_type & (Reg32|BaseIndex|RegRex))
+ != (Reg32|BaseIndex))))
+ ok = 0;
+ }
}
else
{
diff --git a/contrib/binutils/gas/config/tc-ppc.c b/contrib/binutils/gas/config/tc-ppc.c
index 8bf09db71ad6..5a3f68bdcd60 100644
--- a/contrib/binutils/gas/config/tc-ppc.c
+++ b/contrib/binutils/gas/config/tc-ppc.c
@@ -5165,7 +5165,7 @@ md_apply_fix3 (fixP, valP, seg)
if ((operand->flags & PPC_OPERAND_PARENS) != 0
&& operand->bits == 16
&& operand->shift == 0
- && operand->insert == NULL
+ && (operand->insert == NULL || ppc_xcoff64)
&& fixP->fx_addsy != NULL
&& symbol_get_tc (fixP->fx_addsy)->subseg != 0
&& symbol_get_tc (fixP->fx_addsy)->class != XMC_TC
diff --git a/contrib/binutils/gas/config/tc-sparc.c b/contrib/binutils/gas/config/tc-sparc.c
index fe9f3f7b776c..2d75fef4ad07 100644
--- a/contrib/binutils/gas/config/tc-sparc.c
+++ b/contrib/binutils/gas/config/tc-sparc.c
@@ -1,6 +1,6 @@
/* tc-sparc.c -- Assemble for the SPARC
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001
+ 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -32,6 +32,12 @@
#include "dwarf2dbg.h"
#endif
+/* Some ancient Sun C compilers would not take such hex constants as
+ unsigned, and would end up sign-extending them to form an offsetT,
+ so use these constants instead. */
+#define U0xffffffff ((((unsigned long) 1 << 16) << 16) - 1)
+#define U0x80000000 ((((unsigned long) 1 << 16) << 15))
+
static struct sparc_arch *lookup_arch PARAMS ((char *));
static void init_default_arch PARAMS ((void));
static int sparc_ip PARAMS ((char *, const struct sparc_opcode **));
@@ -916,7 +922,7 @@ in_signed_range (val, max)
if (sparc_arch_size == 32)
{
bfd_signed_vma sign = (bfd_signed_vma) 1 << 31;
- val = ((val & 0xffffffff) ^ sign) - sign;
+ val = ((val & U0xffffffff) ^ sign) - sign;
}
if (val > max)
return 0;
@@ -1019,14 +1025,14 @@ synthetize_setuw (insn)
{
if (sizeof (offsetT) > 4
&& (the_insn.exp.X_add_number < 0
- || the_insn.exp.X_add_number > (offsetT) 0xffffffff))
+ || the_insn.exp.X_add_number > (offsetT) U0xffffffff))
as_warn (_("set: number not in 0..4294967295 range"));
}
else
{
if (sizeof (offsetT) > 4
- && (the_insn.exp.X_add_number < -(offsetT) 0x80000000
- || the_insn.exp.X_add_number > (offsetT) 0xffffffff))
+ && (the_insn.exp.X_add_number < -(offsetT) U0x80000000
+ || the_insn.exp.X_add_number > (offsetT) U0xffffffff))
as_warn (_("set: number not in -2147483648..4294967295 range"));
the_insn.exp.X_add_number = (int) the_insn.exp.X_add_number;
}
@@ -1085,8 +1091,8 @@ synthetize_setsw (insn)
}
if (sizeof (offsetT) > 4
- && (the_insn.exp.X_add_number < -(offsetT) 0x80000000
- || the_insn.exp.X_add_number > (offsetT) 0xffffffff))
+ && (the_insn.exp.X_add_number < -(offsetT) U0x80000000
+ || the_insn.exp.X_add_number > (offsetT) U0xffffffff))
as_warn (_("setsw: number not in -2147483648..4294967295 range"));
low32 = the_insn.exp.X_add_number;
@@ -1128,7 +1134,7 @@ synthetize_setx (insn)
int need_hh22_p = 0, need_hm10_p = 0, need_hi22_p = 0, need_lo10_p = 0;
int need_xor10_p = 0;
-#define SIGNEXT32(x) ((((x) & 0xffffffff) ^ 0x80000000) - 0x80000000)
+#define SIGNEXT32(x) ((((x) & U0xffffffff) ^ U0x80000000) - U0x80000000)
lower32 = SIGNEXT32 (the_insn.exp.X_add_number);
upper32 = SIGNEXT32 (BSR (the_insn.exp.X_add_number, 32));
#undef SIGNEXT32