1993-06-16 10:25:53 +08:00
|
|
|
|
/* Main header file for the bfd library -- portable access to object files.
|
1995-02-06 16:31:27 +08:00
|
|
|
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
1993-06-16 10:25:53 +08:00
|
|
|
|
Contributed by Cygnus Support.
|
|
|
|
|
|
1993-08-06 02:36:19 +08:00
|
|
|
|
** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them;
|
|
|
|
|
** instead, change bfd-in.h or the other BFD source files processed to
|
|
|
|
|
** generate these files.
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
|
|
|
|
|
/* bfd.h -- The only header file required by users of the bfd library
|
|
|
|
|
|
|
|
|
|
The bfd.h file is generated from bfd-in.h and various .c files; if you
|
|
|
|
|
change it, your changes will probably be lost.
|
|
|
|
|
|
|
|
|
|
All the prototypes and definitions following the comment "THE FOLLOWING
|
|
|
|
|
IS EXTRACTED FROM THE SOURCE" are extracted from the source files for
|
|
|
|
|
BFD. If you change it, someone oneday will extract it from the source
|
|
|
|
|
again, and your changes will be lost. To save yourself from this bind,
|
|
|
|
|
change the definitions in the source in the bfd directory. Type "make
|
|
|
|
|
docs" and then "make headers" in that directory, and magically this file
|
|
|
|
|
will change to reflect your changes.
|
|
|
|
|
|
|
|
|
|
If you don't have the tools to perform the extraction, then you are
|
|
|
|
|
safe from someone on your system trampling over your header files.
|
|
|
|
|
You should still maintain the equivalence between the source and this
|
|
|
|
|
file though; every change you make to the .c file should be reflected
|
|
|
|
|
here. */
|
|
|
|
|
|
|
|
|
|
#ifndef __BFD_H_SEEN__
|
|
|
|
|
#define __BFD_H_SEEN__
|
|
|
|
|
|
|
|
|
|
#include "ansidecl.h"
|
|
|
|
|
#include "obstack.h"
|
|
|
|
|
|
1994-03-18 07:47:00 +08:00
|
|
|
|
/* These two lines get substitutions done by commands in Makefile.in. */
|
|
|
|
|
#define BFD_VERSION "@VERSION@"
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define BFD_ARCH_SIZE @WORDSIZE@
|
|
|
|
|
|
|
|
|
|
#if BFD_ARCH_SIZE >= 64
|
|
|
|
|
#define BFD64
|
|
|
|
|
#endif
|
|
|
|
|
|
* configure.in (*-*-netware, i[34]86-*-netware): New configs.
* Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
* Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
* Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
* Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
* bfd-in2.h (INLINE): Defines moved here.
* {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
* libelf.h (CAT4): Move define to bfd-in2.h.
* bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
* bfd-in2.h (union tdata): Add nlm_obj_data.
* bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
* targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
* targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
* (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
for NLM support.
1993-07-20 12:45:13 +08:00
|
|
|
|
#ifndef INLINE
|
|
|
|
|
#if __GNUC__ >= 2
|
|
|
|
|
#define INLINE __inline__
|
|
|
|
|
#else
|
|
|
|
|
#define INLINE
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
1993-06-21 08:50:48 +08:00
|
|
|
|
/* 64-bit type definition (if any) from bfd's sysdep.h goes here */
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* forward declaration */
|
|
|
|
|
typedef struct _bfd bfd;
|
|
|
|
|
|
|
|
|
|
/* To squelch erroneous compiler warnings ("illegal pointer
|
|
|
|
|
combination") from the SVR3 compiler, we would like to typedef
|
|
|
|
|
boolean to int (it doesn't like functions which return boolean.
|
|
|
|
|
Making sure they are never implicitly declared to return int
|
|
|
|
|
doesn't seem to help). But this file is not configured based on
|
|
|
|
|
the host. */
|
|
|
|
|
/* General rules: functions which are boolean return true on success
|
|
|
|
|
and false on failure (unless they're a predicate). -- bfd.doc */
|
|
|
|
|
/* I'm sure this is going to break something and someone is going to
|
|
|
|
|
force me to change it. */
|
|
|
|
|
/* typedef enum boolean {false, true} boolean; */
|
|
|
|
|
/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
|
1994-01-08 03:03:10 +08:00
|
|
|
|
/* It gets worse if the host also defines a true/false enum... -sts */
|
|
|
|
|
#ifndef TRUE_FALSE_ALREADY_DEFINED
|
1993-06-16 10:25:53 +08:00
|
|
|
|
typedef enum bfd_boolean {false, true} boolean;
|
1994-01-08 03:03:10 +08:00
|
|
|
|
#define BFD_TRUE_FALSE
|
|
|
|
|
#else
|
|
|
|
|
typedef enum bfd_boolean {bfd_false, bfd_true} boolean;
|
|
|
|
|
#endif
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* A pointer to a position in a file. */
|
|
|
|
|
/* FIXME: This should be using off_t from <sys/types.h>.
|
|
|
|
|
For now, try to avoid breaking stuff by not including <sys/types.h> here.
|
|
|
|
|
This will break on systems with 64-bit file offsets (e.g. 4.4BSD).
|
|
|
|
|
Probably the best long-term answer is to avoid using file_ptr AND off_t
|
|
|
|
|
in this header file, and to handle this in the BFD implementation
|
|
|
|
|
rather than in its interface. */
|
|
|
|
|
/* typedef off_t file_ptr; */
|
|
|
|
|
typedef long int file_ptr;
|
|
|
|
|
|
1994-08-31 00:04:40 +08:00
|
|
|
|
/* Support for different sizes of target format ints and addresses.
|
|
|
|
|
If the host implements 64-bit values, it defines BFD_HOST_64_BIT to
|
|
|
|
|
be the appropriate type. Otherwise, this code will fall back on
|
|
|
|
|
gcc's "long long" type if gcc is being used. BFD_HOST_64_BIT must
|
|
|
|
|
be defined in such a way as to be a valid type name by itself or
|
|
|
|
|
with "unsigned" prefixed. It should be a signed type by itself.
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-08-31 00:04:40 +08:00
|
|
|
|
If neither is the case, then compilation will fail if 64-bit
|
|
|
|
|
targets are requested. If you don't request any 64-bit targets,
|
|
|
|
|
you should be safe. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
#ifdef BFD64
|
|
|
|
|
|
1994-02-03 11:33:20 +08:00
|
|
|
|
#if defined (__GNUC__) && !defined (BFD_HOST_64_BIT)
|
|
|
|
|
#define BFD_HOST_64_BIT long long
|
|
|
|
|
typedef BFD_HOST_64_BIT int64_type;
|
|
|
|
|
typedef unsigned BFD_HOST_64_BIT uint64_type;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
1993-07-07 04:46:32 +08:00
|
|
|
|
#if !defined (uint64_type) && defined (__GNUC__)
|
|
|
|
|
#define uint64_type unsigned long long
|
|
|
|
|
#define int64_type long long
|
1994-01-20 08:07:58 +08:00
|
|
|
|
#endif
|
|
|
|
|
#ifndef uint64_typeLOW
|
1993-12-02 03:41:16 +08:00
|
|
|
|
#define uint64_typeLOW(x) ((unsigned long)(((x) & 0xffffffff)))
|
|
|
|
|
#define uint64_typeHIGH(x) ((unsigned long)(((x) >> 32) & 0xffffffff))
|
1993-07-07 04:46:32 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
1994-02-03 11:33:20 +08:00
|
|
|
|
typedef unsigned BFD_HOST_64_BIT bfd_vma;
|
|
|
|
|
typedef BFD_HOST_64_BIT bfd_signed_vma;
|
|
|
|
|
typedef unsigned BFD_HOST_64_BIT bfd_size_type;
|
|
|
|
|
typedef unsigned BFD_HOST_64_BIT symvalue;
|
1994-01-20 08:07:58 +08:00
|
|
|
|
#ifndef fprintf_vma
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define fprintf_vma(s,x) \
|
1993-12-02 03:41:16 +08:00
|
|
|
|
fprintf(s,"%08lx%08lx", uint64_typeHIGH(x), uint64_typeLOW(x))
|
1993-07-07 04:46:32 +08:00
|
|
|
|
#define sprintf_vma(s,x) \
|
1993-12-02 03:41:16 +08:00
|
|
|
|
sprintf(s,"%08lx%08lx", uint64_typeHIGH(x), uint64_typeLOW(x))
|
1994-01-20 08:07:58 +08:00
|
|
|
|
#endif
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#else /* not BFD64 */
|
|
|
|
|
|
|
|
|
|
/* Represent a target address. Also used as a generic unsigned type
|
|
|
|
|
which is guaranteed to be big enough to hold any arithmetic types
|
|
|
|
|
we need to deal with. */
|
|
|
|
|
typedef unsigned long bfd_vma;
|
|
|
|
|
|
|
|
|
|
/* A generic signed type which is guaranteed to be big enough to hold any
|
|
|
|
|
arithmetic types we need to deal with. Can be assumed to be compatible
|
|
|
|
|
with bfd_vma in the same way that signed and unsigned ints are compatible
|
|
|
|
|
(as parameters, in assignment, etc). */
|
|
|
|
|
typedef long bfd_signed_vma;
|
|
|
|
|
|
|
|
|
|
typedef unsigned long symvalue;
|
|
|
|
|
typedef unsigned long bfd_size_type;
|
|
|
|
|
|
|
|
|
|
/* Print a bfd_vma x on stream s. */
|
|
|
|
|
#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
|
1993-07-07 04:46:32 +08:00
|
|
|
|
#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#endif /* not BFD64 */
|
|
|
|
|
#define printf_vma(x) fprintf_vma(stdout,x)
|
|
|
|
|
|
|
|
|
|
typedef unsigned int flagword; /* 32 bits of flags */
|
1995-02-06 16:31:27 +08:00
|
|
|
|
typedef unsigned char bfd_byte;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/** File formats */
|
|
|
|
|
|
|
|
|
|
typedef enum bfd_format {
|
|
|
|
|
bfd_unknown = 0, /* file format is unknown */
|
|
|
|
|
bfd_object, /* linker/assember/compiler output */
|
|
|
|
|
bfd_archive, /* object archive file */
|
|
|
|
|
bfd_core, /* core dump */
|
|
|
|
|
bfd_type_end} /* marks the end; don't use it! */
|
|
|
|
|
bfd_format;
|
|
|
|
|
|
1993-11-01 02:59:59 +08:00
|
|
|
|
/* Values that may appear in the flags field of a BFD. These also
|
|
|
|
|
appear in the object_flags field of the bfd_target structure, where
|
|
|
|
|
they indicate the set of flags used by that backend (not all flags
|
|
|
|
|
are meaningful for all object file formats) (FIXME: at the moment,
|
|
|
|
|
the object_flags values have mostly just been copied from backend
|
|
|
|
|
to another, and are not necessarily correct). */
|
|
|
|
|
|
|
|
|
|
/* No flags. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define NO_FLAGS 0x00
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD contains relocation entries. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define HAS_RELOC 0x01
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD is directly executable. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define EXEC_P 0x02
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD has line number information (basically used for F_LNNO in a
|
|
|
|
|
COFF header). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define HAS_LINENO 0x04
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD has debugging information. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define HAS_DEBUG 0x08
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD has symbols. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define HAS_SYMS 0x10
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD has local symbols (basically used for F_LSYMS in a COFF
|
|
|
|
|
header). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define HAS_LOCALS 0x20
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD is a dynamic object. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define DYNAMIC 0x40
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* Text section is write protected (if D_PAGED is not set, this is
|
|
|
|
|
like an a.out NMAGIC file) (the linker sets this by default, but
|
|
|
|
|
clears it for -r or -N). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define WP_TEXT 0x80
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
|
|
|
|
|
linker sets this by default, but clears it for -r or -n or -N). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define D_PAGED 0x100
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
|
|
|
|
/* BFD is relaxable (this means that bfd_relax_section may be able to
|
1994-08-31 00:04:40 +08:00
|
|
|
|
do something) (sometimes bfd_relax_section can do something even if
|
|
|
|
|
this is not set). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define BFD_IS_RELAXABLE 0x200
|
1994-06-15 13:46:46 +08:00
|
|
|
|
|
|
|
|
|
/* This may be set before writing out a BFD to request using a
|
|
|
|
|
traditional format. For example, this is used to request that when
|
|
|
|
|
writing out an a.out object the symbols not be hashed to eliminate
|
|
|
|
|
duplicates. */
|
|
|
|
|
#define BFD_TRADITIONAL_FORMAT 0x400
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* symbols and relocation */
|
|
|
|
|
|
1994-01-22 10:18:02 +08:00
|
|
|
|
/* A count of carsyms (canonical archive symbols). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
typedef unsigned long symindex;
|
|
|
|
|
|
1995-02-06 16:31:27 +08:00
|
|
|
|
/* How to perform a relocation. */
|
|
|
|
|
typedef const struct reloc_howto_struct reloc_howto_type;
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
|
|
|
|
|
|
1994-01-22 10:18:02 +08:00
|
|
|
|
/* General purpose part of a symbol X;
|
|
|
|
|
target specific parts are in libcoff.h, libaout.h, etc. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
#define bfd_get_section(x) ((x)->section)
|
|
|
|
|
#define bfd_get_output_section(x) ((x)->section->output_section)
|
|
|
|
|
#define bfd_set_section(x,y) ((x)->section) = (y)
|
|
|
|
|
#define bfd_asymbol_base(x) ((x)->section->vma)
|
|
|
|
|
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
|
|
|
|
|
#define bfd_asymbol_name(x) ((x)->name)
|
|
|
|
|
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
|
|
|
|
|
#define bfd_asymbol_bfd(x) ((x)->the_bfd)
|
|
|
|
|
#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
|
|
|
|
|
|
1994-01-22 10:18:02 +08:00
|
|
|
|
/* A canonical archive symbol. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* This is a type pun with struct ranlib on purpose! */
|
|
|
|
|
typedef struct carsym {
|
|
|
|
|
char *name;
|
|
|
|
|
file_ptr file_offset; /* look here to find the file */
|
|
|
|
|
} carsym; /* to make these you call a carsymogen */
|
|
|
|
|
|
|
|
|
|
|
1994-01-22 10:18:02 +08:00
|
|
|
|
/* Used in generating armaps (archive tables of contents).
|
|
|
|
|
Perhaps just a forward definition would do? */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct orl { /* output ranlib */
|
|
|
|
|
char **name; /* symbol name */
|
|
|
|
|
file_ptr pos; /* bfd* or file position */
|
|
|
|
|
int namidx; /* index into string table */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Linenumber stuff */
|
|
|
|
|
typedef struct lineno_cache_entry {
|
|
|
|
|
unsigned int line_number; /* Linenumber from start of function*/
|
|
|
|
|
union {
|
1994-01-22 10:18:02 +08:00
|
|
|
|
struct symbol_cache_entry *sym; /* Function name */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
unsigned long offset; /* Offset into section */
|
|
|
|
|
} u;
|
|
|
|
|
} alent;
|
|
|
|
|
|
|
|
|
|
/* object and core file sections */
|
|
|
|
|
|
|
|
|
|
#define align_power(addr, align) \
|
|
|
|
|
( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
|
|
|
|
|
|
|
|
|
|
typedef struct sec *sec_ptr;
|
|
|
|
|
|
|
|
|
|
#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
|
|
|
|
|
#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
|
|
|
|
|
#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
|
|
|
|
|
#define bfd_section_name(bfd, ptr) ((ptr)->name)
|
|
|
|
|
#define bfd_section_size(bfd, ptr) (bfd_get_section_size_before_reloc(ptr))
|
|
|
|
|
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
|
|
|
|
|
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
|
|
|
|
|
#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
|
|
|
|
|
#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
|
|
|
|
|
|
|
|
|
|
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
|
|
|
|
|
|
|
|
|
|
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = true), true)
|
|
|
|
|
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
|
|
|
|
|
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
|
|
|
|
|
|
|
|
|
|
typedef struct stat stat_type;
|
|
|
|
|
|
|
|
|
|
typedef enum bfd_print_symbol
|
|
|
|
|
{
|
|
|
|
|
bfd_print_symbol_name,
|
|
|
|
|
bfd_print_symbol_more,
|
|
|
|
|
bfd_print_symbol_all
|
|
|
|
|
} bfd_print_symbol_type;
|
|
|
|
|
|
|
|
|
|
/* Information about a symbol that nm needs. */
|
|
|
|
|
|
|
|
|
|
typedef struct _symbol_info
|
|
|
|
|
{
|
|
|
|
|
symvalue value;
|
1994-01-22 10:18:02 +08:00
|
|
|
|
char type;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
CONST char *name; /* Symbol name. */
|
|
|
|
|
char stab_other; /* Unused. */
|
|
|
|
|
short stab_desc; /* Info for N_TYPE. */
|
|
|
|
|
CONST char *stab_name;
|
|
|
|
|
} symbol_info;
|
|
|
|
|
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
/* Hash table routines. There is no way to free up a hash table. */
|
|
|
|
|
|
|
|
|
|
/* An element in the hash table. Most uses will actually use a larger
|
|
|
|
|
structure, and an instance of this will be the first field. */
|
|
|
|
|
|
|
|
|
|
struct bfd_hash_entry
|
|
|
|
|
{
|
|
|
|
|
/* Next entry for this hash code. */
|
|
|
|
|
struct bfd_hash_entry *next;
|
|
|
|
|
/* String being hashed. */
|
|
|
|
|
const char *string;
|
|
|
|
|
/* Hash code. This is the full hash code, not the index into the
|
|
|
|
|
table. */
|
|
|
|
|
unsigned long hash;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* A hash table. */
|
|
|
|
|
|
|
|
|
|
struct bfd_hash_table
|
|
|
|
|
{
|
|
|
|
|
/* The hash array. */
|
|
|
|
|
struct bfd_hash_entry **table;
|
|
|
|
|
/* The number of slots in the hash table. */
|
|
|
|
|
unsigned int size;
|
|
|
|
|
/* A function used to create new elements in the hash table. The
|
|
|
|
|
first entry is itself a pointer to an element. When this
|
|
|
|
|
function is first invoked, this pointer will be NULL. However,
|
|
|
|
|
having the pointer permits a hierarchy of method functions to be
|
|
|
|
|
built each of which calls the function in the superclass. Thus
|
|
|
|
|
each function should be written to allocate a new block of memory
|
|
|
|
|
only if the argument is NULL. */
|
|
|
|
|
struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,
|
|
|
|
|
struct bfd_hash_table *,
|
|
|
|
|
const char *));
|
|
|
|
|
/* An obstack for this hash table. */
|
|
|
|
|
struct obstack memory;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Initialize a hash table. */
|
|
|
|
|
extern boolean bfd_hash_table_init
|
|
|
|
|
PARAMS ((struct bfd_hash_table *,
|
|
|
|
|
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
|
|
|
|
struct bfd_hash_table *,
|
|
|
|
|
const char *)));
|
|
|
|
|
|
|
|
|
|
/* Initialize a hash table specifying a size. */
|
|
|
|
|
extern boolean bfd_hash_table_init_n
|
|
|
|
|
PARAMS ((struct bfd_hash_table *,
|
|
|
|
|
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
|
|
|
|
struct bfd_hash_table *,
|
|
|
|
|
const char *),
|
|
|
|
|
unsigned int size));
|
|
|
|
|
|
|
|
|
|
/* Free up a hash table. */
|
|
|
|
|
extern void bfd_hash_table_free PARAMS ((struct bfd_hash_table *));
|
|
|
|
|
|
|
|
|
|
/* Look up a string in a hash table. If CREATE is true, a new entry
|
|
|
|
|
will be created for this string if one does not already exist. The
|
|
|
|
|
COPY argument must be true if this routine should copy the string
|
|
|
|
|
into newly allocated memory when adding an entry. */
|
|
|
|
|
extern struct bfd_hash_entry *bfd_hash_lookup
|
|
|
|
|
PARAMS ((struct bfd_hash_table *, const char *, boolean create,
|
|
|
|
|
boolean copy));
|
|
|
|
|
|
|
|
|
|
/* Base method for creating a hash table entry. */
|
|
|
|
|
extern struct bfd_hash_entry *bfd_hash_newfunc
|
|
|
|
|
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *,
|
|
|
|
|
const char *));
|
|
|
|
|
|
|
|
|
|
/* Grab some space for a hash table entry. */
|
1994-01-07 04:04:43 +08:00
|
|
|
|
extern PTR bfd_hash_allocate PARAMS ((struct bfd_hash_table *,
|
|
|
|
|
unsigned int));
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
|
|
|
|
|
/* Traverse a hash table in a random order, calling a function on each
|
|
|
|
|
element. If the function returns false, the traversal stops. The
|
|
|
|
|
INFO argument is passed to the function. */
|
|
|
|
|
extern void bfd_hash_traverse PARAMS ((struct bfd_hash_table *,
|
|
|
|
|
boolean (*) (struct bfd_hash_entry *,
|
|
|
|
|
PTR),
|
|
|
|
|
PTR info));
|
|
|
|
|
|
* configure.in (*-*-netware, i[34]86-*-netware): New configs.
* Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
* Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
* Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
* Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
* bfd-in2.h (INLINE): Defines moved here.
* {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
* libelf.h (CAT4): Move define to bfd-in2.h.
* bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
* bfd-in2.h (union tdata): Add nlm_obj_data.
* bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
* targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
* targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
* (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
for NLM support.
1993-07-20 12:45:13 +08:00
|
|
|
|
/* Semi-portable string concatenation in cpp.
|
|
|
|
|
The CAT4 hack is to avoid a problem with some strict ANSI C preprocessors.
|
|
|
|
|
The problem is, "32_" is not a valid preprocessing token, and we don't
|
|
|
|
|
want extra underscores (e.g., "nlm_32_"). The XCAT2 macro will cause the
|
|
|
|
|
inner CAT macros to be evaluated first, producing still-valid pp-tokens.
|
|
|
|
|
Then the final concatenation can be done. (Sigh.) */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#ifndef CAT
|
* configure.in (*-*-netware, i[34]86-*-netware): New configs.
* Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
* Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
* Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
* Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
* bfd-in2.h (INLINE): Defines moved here.
* {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
* libelf.h (CAT4): Move define to bfd-in2.h.
* bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
* bfd-in2.h (union tdata): Add nlm_obj_data.
* bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
* targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
* targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
* (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
for NLM support.
1993-07-20 12:45:13 +08:00
|
|
|
|
#ifdef SABER
|
|
|
|
|
#define CAT(a,b) a##b
|
|
|
|
|
#define CAT3(a,b,c) a##b##c
|
|
|
|
|
#define CAT4(a,b,c,d) a##b##c##d
|
|
|
|
|
#else
|
1994-01-08 03:03:10 +08:00
|
|
|
|
#if defined(__STDC__) || defined(ALMOST_STDC)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define CAT(a,b) a##b
|
|
|
|
|
#define CAT3(a,b,c) a##b##c
|
* configure.in (*-*-netware, i[34]86-*-netware): New configs.
* Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
* Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
* Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
* Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
* bfd-in2.h (INLINE): Defines moved here.
* {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
* libelf.h (CAT4): Move define to bfd-in2.h.
* bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
* bfd-in2.h (union tdata): Add nlm_obj_data.
* bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
* targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
* targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
* (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
for NLM support.
1993-07-20 12:45:13 +08:00
|
|
|
|
#define XCAT2(a,b) CAT(a,b)
|
|
|
|
|
#define CAT4(a,b,c,d) XCAT2(CAT(a,b),CAT(c,d))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#else
|
|
|
|
|
#define CAT(a,b) a/**/b
|
|
|
|
|
#define CAT3(a,b,c) a/**/b/**/c
|
* configure.in (*-*-netware, i[34]86-*-netware): New configs.
* Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
* Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
* Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
* Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
* bfd-in2.h (INLINE): Defines moved here.
* {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
* libelf.h (CAT4): Move define to bfd-in2.h.
* bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
* bfd-in2.h (union tdata): Add nlm_obj_data.
* bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
* targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
* targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
* (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
for NLM support.
1993-07-20 12:45:13 +08:00
|
|
|
|
#define CAT4(a,b,c,d) a/**/b/**/c/**/d
|
|
|
|
|
#endif
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define COFF_SWAP_TABLE (PTR) &bfd_coff_std_swap_table
|
|
|
|
|
|
|
|
|
|
/* User program access to BFD facilities */
|
|
|
|
|
|
1994-08-31 00:04:40 +08:00
|
|
|
|
/* Direct I/O routines, for programs which know more about the object
|
|
|
|
|
file than BFD does. Use higher level routines if possible. */
|
|
|
|
|
|
|
|
|
|
extern bfd_size_type bfd_read
|
|
|
|
|
PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
|
|
|
|
|
extern bfd_size_type bfd_write
|
|
|
|
|
PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
|
1994-09-26 23:01:59 +08:00
|
|
|
|
extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
|
1994-08-31 00:04:40 +08:00
|
|
|
|
extern long bfd_tell PARAMS ((bfd *abfd));
|
|
|
|
|
extern int bfd_flush PARAMS ((bfd *abfd));
|
|
|
|
|
extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Cast from const char * to char * so that caller can assign to
|
|
|
|
|
a char * without a warning. */
|
|
|
|
|
#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
|
1993-11-05 16:34:09 +08:00
|
|
|
|
#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_get_format(abfd) ((abfd)->format)
|
|
|
|
|
#define bfd_get_target(abfd) ((abfd)->xvec->name)
|
1993-11-01 02:59:59 +08:00
|
|
|
|
#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_get_file_flags(abfd) ((abfd)->flags)
|
|
|
|
|
#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
|
|
|
|
|
#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
|
|
|
|
|
#define bfd_my_archive(abfd) ((abfd)->my_archive)
|
|
|
|
|
#define bfd_has_map(abfd) ((abfd)->has_armap)
|
|
|
|
|
|
|
|
|
|
#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
|
|
|
|
|
#define bfd_usrdata(abfd) ((abfd)->usrdata)
|
|
|
|
|
|
|
|
|
|
#define bfd_get_start_address(abfd) ((abfd)->start_address)
|
|
|
|
|
#define bfd_get_symcount(abfd) ((abfd)->symcount)
|
|
|
|
|
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
|
|
|
|
|
#define bfd_count_sections(abfd) ((abfd)->section_count)
|
|
|
|
|
|
|
|
|
|
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
|
|
|
|
|
|
1993-11-05 16:34:09 +08:00
|
|
|
|
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (bool)), true)
|
|
|
|
|
|
1993-09-22 22:54:50 +08:00
|
|
|
|
/* Byte swapping routines. */
|
|
|
|
|
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma bfd_getb64 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_vma bfd_getl64 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_signed_vma bfd_getb_signed_64 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_signed_vma bfd_getl_signed_64 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_vma bfd_getb32 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_vma bfd_getl32 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_signed_vma bfd_getb_signed_32 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_signed_vma bfd_getl_signed_32 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_vma bfd_getb16 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_vma bfd_getl16 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_signed_vma bfd_getb_signed_16 PARAMS ((const unsigned char *));
|
|
|
|
|
bfd_signed_vma bfd_getl_signed_16 PARAMS ((const unsigned char *));
|
1993-09-22 22:54:50 +08:00
|
|
|
|
void bfd_putb64 PARAMS ((bfd_vma, unsigned char *));
|
|
|
|
|
void bfd_putl64 PARAMS ((bfd_vma, unsigned char *));
|
|
|
|
|
void bfd_putb32 PARAMS ((bfd_vma, unsigned char *));
|
|
|
|
|
void bfd_putl32 PARAMS ((bfd_vma, unsigned char *));
|
|
|
|
|
void bfd_putb16 PARAMS ((bfd_vma, unsigned char *));
|
|
|
|
|
void bfd_putl16 PARAMS ((bfd_vma, unsigned char *));
|
1994-05-11 02:29:19 +08:00
|
|
|
|
|
|
|
|
|
/* Externally visible ECOFF routines. */
|
1993-09-22 22:54:50 +08:00
|
|
|
|
|
1994-01-08 03:03:10 +08:00
|
|
|
|
#if defined(__STDC__) || defined(ALMOST_STDC)
|
1993-11-24 15:21:28 +08:00
|
|
|
|
struct ecoff_debug_info;
|
|
|
|
|
struct ecoff_debug_swap;
|
|
|
|
|
struct ecoff_extr;
|
|
|
|
|
struct symbol_cache_entry;
|
1994-01-20 08:07:58 +08:00
|
|
|
|
struct bfd_link_info;
|
1993-11-24 15:21:28 +08:00
|
|
|
|
#endif
|
1994-05-11 02:29:19 +08:00
|
|
|
|
extern bfd_vma bfd_ecoff_get_gp_value PARAMS ((bfd * abfd));
|
|
|
|
|
extern boolean bfd_ecoff_set_gp_value PARAMS ((bfd *abfd, bfd_vma gp_value));
|
|
|
|
|
extern boolean bfd_ecoff_set_regmasks
|
|
|
|
|
PARAMS ((bfd *abfd, unsigned long gprmask, unsigned long fprmask,
|
|
|
|
|
unsigned long *cprmask));
|
1994-01-20 08:07:58 +08:00
|
|
|
|
extern PTR bfd_ecoff_debug_init
|
1993-11-24 15:21:28 +08:00
|
|
|
|
PARAMS ((bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
1994-01-20 08:07:58 +08:00
|
|
|
|
const struct ecoff_debug_swap *output_swap,
|
|
|
|
|
struct bfd_link_info *));
|
|
|
|
|
extern void bfd_ecoff_debug_free
|
|
|
|
|
PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
|
|
|
|
const struct ecoff_debug_swap *output_swap,
|
|
|
|
|
struct bfd_link_info *));
|
|
|
|
|
extern boolean bfd_ecoff_debug_accumulate
|
|
|
|
|
PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
1993-11-24 15:21:28 +08:00
|
|
|
|
const struct ecoff_debug_swap *output_swap,
|
|
|
|
|
bfd *input_bfd, struct ecoff_debug_info *input_debug,
|
|
|
|
|
const struct ecoff_debug_swap *input_swap,
|
1994-01-20 08:07:58 +08:00
|
|
|
|
struct bfd_link_info *));
|
|
|
|
|
extern boolean bfd_ecoff_debug_accumulate_other
|
|
|
|
|
PARAMS ((PTR handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
|
|
|
|
|
const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
|
|
|
|
|
struct bfd_link_info *));
|
1993-11-24 15:21:28 +08:00
|
|
|
|
extern boolean bfd_ecoff_debug_externals
|
|
|
|
|
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
|
|
|
|
const struct ecoff_debug_swap *swap,
|
|
|
|
|
boolean relocateable,
|
|
|
|
|
boolean (*get_extr) (struct symbol_cache_entry *,
|
|
|
|
|
struct ecoff_extr *),
|
|
|
|
|
void (*set_index) (struct symbol_cache_entry *,
|
|
|
|
|
bfd_size_type)));
|
1994-01-07 04:04:43 +08:00
|
|
|
|
extern boolean bfd_ecoff_debug_one_external
|
|
|
|
|
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
|
|
|
|
const struct ecoff_debug_swap *swap,
|
|
|
|
|
const char *name, struct ecoff_extr *esym));
|
1993-11-24 15:21:28 +08:00
|
|
|
|
extern bfd_size_type bfd_ecoff_debug_size
|
|
|
|
|
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
|
|
|
|
const struct ecoff_debug_swap *swap));
|
|
|
|
|
extern boolean bfd_ecoff_write_debug
|
|
|
|
|
PARAMS ((bfd *abfd, struct ecoff_debug_info *debug,
|
|
|
|
|
const struct ecoff_debug_swap *swap, file_ptr where));
|
1994-01-20 08:07:58 +08:00
|
|
|
|
extern boolean bfd_ecoff_write_accumulated_debug
|
|
|
|
|
PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
|
|
|
|
|
const struct ecoff_debug_swap *swap,
|
|
|
|
|
struct bfd_link_info *info, file_ptr where));
|
1995-01-12 10:41:04 +08:00
|
|
|
|
extern boolean bfd_mips_ecoff_create_embedded_relocs
|
|
|
|
|
PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
|
|
|
|
|
char **));
|
1993-11-24 15:21:28 +08:00
|
|
|
|
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-20 02:23:40 +08:00
|
|
|
|
/* Externally visible ELF routines. */
|
|
|
|
|
|
|
|
|
|
extern boolean bfd_elf32_record_link_assignment
|
|
|
|
|
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
|
|
|
|
extern boolean bfd_elf64_record_link_assignment
|
|
|
|
|
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
|
|
|
|
extern boolean bfd_elf32_size_dynamic_sections
|
1994-11-18 06:46:22 +08:00
|
|
|
|
PARAMS ((bfd *, const char *, const char *, boolean,
|
|
|
|
|
struct bfd_link_info *, struct sec **));
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-20 02:23:40 +08:00
|
|
|
|
extern boolean bfd_elf64_size_dynamic_sections
|
1994-11-18 06:46:22 +08:00
|
|
|
|
PARAMS ((bfd *, const char *, const char *, boolean,
|
|
|
|
|
struct bfd_link_info *, struct sec **));
|
1994-06-16 08:01:32 +08:00
|
|
|
|
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
|
Add support for ELF shared libraries. Loosely based on work by
Eric Youngdale <ericy@cais.com>.
* libelf.h (struct elf_backend_data): Add new fields for dynamic
linking: elf_backend_create_dynamic_sections,
elf_backend_adjust_dynamic_symbol,
elf_backend_size_dynamic_sections,
elf_backend_finish_dynamic_symbol,
elf_backend_finish_dynamic_sections.
(struct elf_link_hash_entry): Change type of align field to
bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
elf_link_hash_flags.
(struct elf_link_hash_table): Add fields dynobj, dynsymcount,
dynstr, bucketcount.
(bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
(bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
(bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
(bfd_elf32_add_dynamic_entry): Declare.
(bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
(bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
(bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
(bfd_elf64_add_dynamic_entry): Declare.
* elfcode.h (Elf_External_Dyn): Define.
(elf_swap_reloc_in): Define as macro using NAME. Make externally
visible.
(elf_swap_reloc_out): Likewise.
(elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
(elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
and as new externally visible function.
(elf_fake_sections): Set section type of dynamic sections based on
section names.
(elf_write_phdrs): Remove.
(assign_file_position_for_section): Add new align argument.
Change all callers.
(get_program_header_size): New static function.
(struct seg_info): Remove.
(map_program_segments): Completely rewrite.
(assign_file_positions_except_relocs): Completely rewrite.
(assign_file_positions_for_relocs): Don't set a file position for
sections which already have one. Don't bother to align the file
position here.
(section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
section types.
(elf_section_from_bfd_section): Likewise.
(elf_slurp_symbol_table): If section_from_elf_index fails, just
use bfd_abs_section rather than returning an error.
(elf_sizeof_headers): Make useful.
(elf_link_record_dynamic_symbol): New static function.
(elf_link_add_object_symbols): Handle dynamic objects.
(elf_link_create_dynamic_sections): New static function.
(elf_add_dynamic_entry): Define as macro using NAME and as new
externally visible function.
(NAME(bfd_elf,record_link_assignment)): New function.
(elf_buckets): New static variable.
(NAME(bfd_elf,size_dynamic_sections)): New function.
(struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
(elf_bfd_final_link): Handle dynamic linking. Create a section
symbol for all ELF sections, not all BFD sections. Store section
symbol index in target_index field, not index field. Traverse
over global symbols even if stripping.
(elf_link_output_extsym): Output dynamic symbols. Mark symbols
defined by dynamic objects as undefined.
(elf_link_input_bfd): Ignore dynamic objects. Use target_index
field for section relocs, and make sure it is set.
(elf_reloc_link_order): Use target_index field for section relocs,
and make sure it is set.
* elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
weakdef and elf_link_hash_flags fields.
(_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
dynstr and bucketcount fields.
* elf32-target.h: Initialize new dynamic linking fields.
* elf64-target.h: Likewise.
* elf32-i386.c: New functions for dynamic linking support.
* elf32-sparc.c: Likewise.
* bfd-in.h (bfd_elf32_record_link_assignment): Declare.
(bfd_elf64_record_link_assignment): Declare.
(bfd_elf32_size_dynamic_sections): Declare.
(bfd_elf64_size_dynamic_sections): Declare.
* bfd-in2.h: Rebuilt.
1994-05-20 02:23:40 +08:00
|
|
|
|
|
1994-06-15 13:46:46 +08:00
|
|
|
|
/* SunOS shared library support routines for the linker. */
|
|
|
|
|
|
|
|
|
|
extern boolean bfd_sunos_record_link_assignment
|
|
|
|
|
PARAMS ((bfd *, struct bfd_link_info *, const char *));
|
|
|
|
|
extern boolean bfd_sunos_size_dynamic_sections
|
|
|
|
|
PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
|
|
|
|
|
struct sec **));
|
|
|
|
|
|
1994-06-17 02:29:21 +08:00
|
|
|
|
/* Linux shared library support routines for the linker. */
|
|
|
|
|
|
|
|
|
|
extern boolean bfd_linux_size_dynamic_sections
|
|
|
|
|
PARAMS ((bfd *, struct bfd_link_info *));
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* And more from the source. */
|
|
|
|
|
void
|
|
|
|
|
bfd_init PARAMS ((void));
|
|
|
|
|
|
|
|
|
|
bfd *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_openr PARAMS ((CONST char *filename, CONST char *target));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
bfd *
|
|
|
|
|
bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd));
|
|
|
|
|
|
1995-01-18 03:26:56 +08:00
|
|
|
|
bfd *
|
|
|
|
|
bfd_openstreamr PARAMS (());
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd *
|
|
|
|
|
bfd_openw PARAMS ((CONST char *filename, CONST char *target));
|
|
|
|
|
|
|
|
|
|
boolean
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_close PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
bfd_close_all_done PARAMS ((bfd *));
|
|
|
|
|
|
|
|
|
|
bfd_size_type
|
|
|
|
|
bfd_alloc_size PARAMS ((bfd *abfd));
|
|
|
|
|
|
|
|
|
|
bfd *
|
1993-07-22 09:08:25 +08:00
|
|
|
|
bfd_create PARAMS ((CONST char *filename, bfd *templ));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Byte swapping macros for user section data. */
|
|
|
|
|
|
|
|
|
|
#define bfd_put_8(abfd, val, ptr) \
|
1993-11-09 07:22:49 +08:00
|
|
|
|
(*((unsigned char *)(ptr)) = (unsigned char)(val))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_put_signed_8 \
|
|
|
|
|
bfd_put_8
|
|
|
|
|
#define bfd_get_8(abfd, ptr) \
|
|
|
|
|
(*(unsigned char *)(ptr))
|
|
|
|
|
#define bfd_get_signed_8(abfd, ptr) \
|
|
|
|
|
((*(unsigned char *)(ptr) ^ 0x80) - 0x80)
|
|
|
|
|
|
|
|
|
|
#define bfd_put_16(abfd, val, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))
|
|
|
|
|
#define bfd_put_signed_16 \
|
|
|
|
|
bfd_put_16
|
|
|
|
|
#define bfd_get_16(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_getx16, (ptr))
|
|
|
|
|
#define bfd_get_signed_16(abfd, ptr) \
|
|
|
|
|
BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
|
|
|
|
|
|
|
|
|
|
#define bfd_put_32(abfd, val, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))
|
|
|
|
|
#define bfd_put_signed_32 \
|
|
|
|
|
bfd_put_32
|
|
|
|
|
#define bfd_get_32(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_getx32, (ptr))
|
|
|
|
|
#define bfd_get_signed_32(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_getx_signed_32, (ptr))
|
|
|
|
|
|
|
|
|
|
#define bfd_put_64(abfd, val, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))
|
|
|
|
|
#define bfd_put_signed_64 \
|
|
|
|
|
bfd_put_64
|
|
|
|
|
#define bfd_get_64(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_getx64, (ptr))
|
|
|
|
|
#define bfd_get_signed_64(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Byte swapping macros for file header data. */
|
|
|
|
|
|
|
|
|
|
#define bfd_h_put_8(abfd, val, ptr) \
|
|
|
|
|
bfd_put_8 (abfd, val, ptr)
|
|
|
|
|
#define bfd_h_put_signed_8(abfd, val, ptr) \
|
|
|
|
|
bfd_put_8 (abfd, val, ptr)
|
|
|
|
|
#define bfd_h_get_8(abfd, ptr) \
|
|
|
|
|
bfd_get_8 (abfd, ptr)
|
|
|
|
|
#define bfd_h_get_signed_8(abfd, ptr) \
|
|
|
|
|
bfd_get_signed_8 (abfd, ptr)
|
|
|
|
|
|
|
|
|
|
#define bfd_h_put_16(abfd, val, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_putx16,(val,ptr))
|
|
|
|
|
#define bfd_h_put_signed_16 \
|
|
|
|
|
bfd_h_put_16
|
|
|
|
|
#define bfd_h_get_16(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_getx16,(ptr))
|
|
|
|
|
#define bfd_h_get_signed_16(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))
|
|
|
|
|
|
|
|
|
|
#define bfd_h_put_32(abfd, val, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_putx32,(val,ptr))
|
|
|
|
|
#define bfd_h_put_signed_32 \
|
|
|
|
|
bfd_h_put_32
|
|
|
|
|
#define bfd_h_get_32(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_getx32,(ptr))
|
|
|
|
|
#define bfd_h_get_signed_32(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))
|
|
|
|
|
|
|
|
|
|
#define bfd_h_put_64(abfd, val, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_putx64,(val, ptr))
|
|
|
|
|
#define bfd_h_put_signed_64 \
|
|
|
|
|
bfd_h_put_64
|
|
|
|
|
#define bfd_h_get_64(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_getx64,(ptr))
|
|
|
|
|
#define bfd_h_get_signed_64(abfd, ptr) \
|
|
|
|
|
BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
|
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
typedef struct sec
|
1993-06-16 10:25:53 +08:00
|
|
|
|
{
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The name of the section; the name isn't a copy, the pointer is
|
1993-06-16 10:25:53 +08:00
|
|
|
|
the same as that passed to bfd_make_section. */
|
|
|
|
|
|
|
|
|
|
CONST char *name;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* Which section is it; 0..nth. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
int index;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* The next section in the list belonging to the BFD, or NULL. */
|
|
|
|
|
|
|
|
|
|
struct sec *next;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The field flags contains attributes of the section. Some
|
1993-06-16 10:25:53 +08:00
|
|
|
|
flags are read in from the object file, and some are
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
synthesized from other information. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
flagword flags;
|
|
|
|
|
|
|
|
|
|
#define SEC_NO_FLAGS 0x000
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* Tells the OS to allocate space for this section when loading.
|
|
|
|
|
This is clear for a section containing debug information
|
1993-06-16 10:25:53 +08:00
|
|
|
|
only. */
|
|
|
|
|
#define SEC_ALLOC 0x001
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Tells the OS to load the section from the file when loading.
|
1993-11-06 03:51:52 +08:00
|
|
|
|
This is clear for a .bss section. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define SEC_LOAD 0x002
|
1993-08-10 03:25:56 +08:00
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The section contains data still to be relocated, so there is
|
|
|
|
|
some relocation information too. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define SEC_RELOC 0x004
|
|
|
|
|
|
1993-08-28 08:35:56 +08:00
|
|
|
|
#if 0 /* Obsolete ? */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define SEC_BALIGN 0x008
|
1993-08-28 08:35:56 +08:00
|
|
|
|
#endif
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* A signal to the OS that the section contains read only
|
|
|
|
|
data. */
|
|
|
|
|
#define SEC_READONLY 0x010
|
|
|
|
|
|
|
|
|
|
/* The section contains code only. */
|
|
|
|
|
#define SEC_CODE 0x020
|
|
|
|
|
|
|
|
|
|
/* The section contains data only. */
|
1993-08-28 08:35:56 +08:00
|
|
|
|
#define SEC_DATA 0x040
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* The section will reside in ROM. */
|
|
|
|
|
#define SEC_ROM 0x080
|
|
|
|
|
|
|
|
|
|
/* The section contains constructor information. This section
|
|
|
|
|
type is used by the linker to create lists of constructors and
|
|
|
|
|
destructors used by <<g++>>. When a back end sees a symbol
|
|
|
|
|
which should be used in a constructor list, it creates a new
|
1993-11-06 03:51:52 +08:00
|
|
|
|
section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
|
|
|
|
|
the symbol to it, and builds a relocation. To build the lists
|
1993-09-04 04:09:31 +08:00
|
|
|
|
of constructors, all the linker has to do is catenate all the
|
1993-11-06 03:51:52 +08:00
|
|
|
|
sections called <<__CTOR_LIST__>> and relocate the data
|
1993-06-16 10:25:53 +08:00
|
|
|
|
contained within - exactly the operations it would peform on
|
|
|
|
|
standard data. */
|
|
|
|
|
#define SEC_CONSTRUCTOR 0x100
|
|
|
|
|
|
|
|
|
|
/* The section is a constuctor, and should be placed at the
|
1993-08-28 08:35:56 +08:00
|
|
|
|
end of the text, data, or bss section(?). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define SEC_CONSTRUCTOR_TEXT 0x1100
|
|
|
|
|
#define SEC_CONSTRUCTOR_DATA 0x2100
|
|
|
|
|
#define SEC_CONSTRUCTOR_BSS 0x3100
|
|
|
|
|
|
|
|
|
|
/* The section has contents - a data section could be
|
1993-11-06 03:51:52 +08:00
|
|
|
|
<<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
|
1993-06-16 10:25:53 +08:00
|
|
|
|
<<SEC_HAS_CONTENTS>> */
|
|
|
|
|
#define SEC_HAS_CONTENTS 0x200
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* An instruction to the linker to not output the section
|
1994-05-11 02:29:19 +08:00
|
|
|
|
even if it has information which would normally be written. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define SEC_NEVER_LOAD 0x400
|
|
|
|
|
|
1994-05-11 02:29:19 +08:00
|
|
|
|
/* The section is a COFF shared library section. This flag is
|
|
|
|
|
only for the linker. If this type of section appears in
|
|
|
|
|
the input file, the linker must copy it to the output file
|
|
|
|
|
without changing the vma or size. FIXME: Although this
|
|
|
|
|
was originally intended to be general, it really is COFF
|
|
|
|
|
specific (and the flag was renamed to indicate this). It
|
|
|
|
|
might be cleaner to have some more general mechanism to
|
|
|
|
|
allow the back end to control what the linker does with
|
|
|
|
|
sections. */
|
|
|
|
|
#define SEC_COFF_SHARED_LIBRARY 0x800
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* The section is a common section (symbols may be defined
|
|
|
|
|
multiple times, the value of a symbol is the amount of
|
|
|
|
|
space it requires, and the largest symbol value is the one
|
1993-08-28 08:35:56 +08:00
|
|
|
|
used). Most targets have exactly one of these (which we
|
1994-07-15 05:35:54 +08:00
|
|
|
|
translate to bfd_com_section_ptr), but ECOFF has two. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define SEC_IS_COMMON 0x8000
|
|
|
|
|
|
1993-09-29 04:44:43 +08:00
|
|
|
|
/* The section contains only debugging information. For
|
|
|
|
|
example, this is set for ELF .debug and .stab sections.
|
|
|
|
|
strip tests this flag to see if a section can be
|
|
|
|
|
discarded. */
|
|
|
|
|
#define SEC_DEBUGGING 0x10000
|
|
|
|
|
|
1994-02-28 07:45:18 +08:00
|
|
|
|
/* The contents of this section are held in memory pointed to
|
|
|
|
|
by the contents field. This is checked by
|
|
|
|
|
bfd_get_section_contents, and the data is retrieved from
|
|
|
|
|
memory if appropriate. */
|
|
|
|
|
#define SEC_IN_MEMORY 0x20000
|
|
|
|
|
|
1993-08-28 08:35:56 +08:00
|
|
|
|
/* End of section flags. */
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* The virtual memory address of the section - where it will be
|
1993-08-28 08:35:56 +08:00
|
|
|
|
at run time. The symbols are relocated against this. The
|
|
|
|
|
user_set_vma flag is maintained by bfd; if it's not set, the
|
|
|
|
|
backend can assign addresses (for example, in <<a.out>>, where
|
|
|
|
|
the default address for <<.data>> is dependent on the specific
|
|
|
|
|
target and various flags). */
|
1993-08-10 03:25:56 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_vma vma;
|
1993-08-28 08:35:56 +08:00
|
|
|
|
boolean user_set_vma;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* The load address of the section - where it would be in a
|
1993-11-06 03:51:52 +08:00
|
|
|
|
rom image; really only used for writing section header
|
1993-08-28 08:35:56 +08:00
|
|
|
|
information. */
|
1993-08-10 03:25:56 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_vma lma;
|
|
|
|
|
|
|
|
|
|
/* The size of the section in bytes, as it will be output.
|
1993-11-06 03:51:52 +08:00
|
|
|
|
contains a value even if the section has no contents (e.g., the
|
1993-06-16 10:25:53 +08:00
|
|
|
|
size of <<.bss>>). This will be filled in after relocation */
|
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
bfd_size_type _cooked_size;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The original size on disk of the section, in bytes. Normally this
|
1993-06-16 10:25:53 +08:00
|
|
|
|
value is the same as the size, but if some relaxing has
|
|
|
|
|
been done, then this value will be bigger. */
|
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
bfd_size_type _raw_size;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* If this section is going to be output, then this value is the
|
|
|
|
|
offset into the output section of the first byte in the input
|
1993-11-06 03:51:52 +08:00
|
|
|
|
section. E.g., if this was going to start at the 100th byte in
|
1993-06-16 10:25:53 +08:00
|
|
|
|
the output section, this value would be 100. */
|
|
|
|
|
|
|
|
|
|
bfd_vma output_offset;
|
|
|
|
|
|
|
|
|
|
/* The output section through which to map on output. */
|
|
|
|
|
|
|
|
|
|
struct sec *output_section;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The alignment requirement of the section, as an exponent of 2 -
|
|
|
|
|
e.g., 3 aligns to 2^3 (or 8). */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
unsigned int alignment_power;
|
|
|
|
|
|
|
|
|
|
/* If an input section, a pointer to a vector of relocation
|
|
|
|
|
records for the data in this section. */
|
|
|
|
|
|
|
|
|
|
struct reloc_cache_entry *relocation;
|
|
|
|
|
|
|
|
|
|
/* If an output section, a pointer to a vector of pointers to
|
|
|
|
|
relocation records for the data in this section. */
|
|
|
|
|
|
|
|
|
|
struct reloc_cache_entry **orelocation;
|
|
|
|
|
|
|
|
|
|
/* The number of relocation records in one of the above */
|
|
|
|
|
|
|
|
|
|
unsigned reloc_count;
|
|
|
|
|
|
|
|
|
|
/* Information below is back end specific - and not always used
|
1993-08-10 03:25:56 +08:00
|
|
|
|
or updated. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1993-08-10 03:25:56 +08:00
|
|
|
|
/* File position of section data */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
file_ptr filepos;
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* File position of relocation info */
|
|
|
|
|
|
|
|
|
|
file_ptr rel_filepos;
|
|
|
|
|
|
|
|
|
|
/* File position of line data */
|
|
|
|
|
|
|
|
|
|
file_ptr line_filepos;
|
|
|
|
|
|
|
|
|
|
/* Pointer to data for applications */
|
|
|
|
|
|
|
|
|
|
PTR userdata;
|
|
|
|
|
|
1994-02-28 07:45:18 +08:00
|
|
|
|
/* If the SEC_IN_MEMORY flag is set, this points to the actual
|
|
|
|
|
contents. */
|
|
|
|
|
unsigned char *contents;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* Attached line number information */
|
|
|
|
|
|
|
|
|
|
alent *lineno;
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Number of line number records */
|
|
|
|
|
|
|
|
|
|
unsigned int lineno_count;
|
|
|
|
|
|
|
|
|
|
/* When a section is being output, this value changes as more
|
|
|
|
|
linenumbers are written out */
|
|
|
|
|
|
|
|
|
|
file_ptr moving_line_filepos;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* What the section number is in the target world */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
int target_index;
|
|
|
|
|
|
|
|
|
|
PTR used_by_bfd;
|
|
|
|
|
|
|
|
|
|
/* If this is a constructor section then here is a list of the
|
|
|
|
|
relocations created to relocate items within it. */
|
|
|
|
|
|
|
|
|
|
struct relent_chain *constructor_chain;
|
|
|
|
|
|
|
|
|
|
/* The BFD which owns the section. */
|
|
|
|
|
|
|
|
|
|
bfd *owner;
|
|
|
|
|
|
|
|
|
|
boolean reloc_done;
|
|
|
|
|
/* A symbol which points at this section only */
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
struct symbol_cache_entry *symbol;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct symbol_cache_entry **symbol_ptr_ptr;
|
1993-08-10 03:25:56 +08:00
|
|
|
|
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
struct bfd_link_order *link_order_head;
|
|
|
|
|
struct bfd_link_order *link_order_tail;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
} asection ;
|
|
|
|
|
|
1993-08-28 08:35:56 +08:00
|
|
|
|
/* These sections are global, and are managed by BFD. The application
|
|
|
|
|
and target back end are not permitted to change the values in
|
1994-07-15 05:35:54 +08:00
|
|
|
|
these sections. New code should use the section_ptr macros rather
|
|
|
|
|
than referring directly to the const sections. The const sections
|
|
|
|
|
may eventually vanish. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define BFD_ABS_SECTION_NAME "*ABS*"
|
|
|
|
|
#define BFD_UND_SECTION_NAME "*UND*"
|
|
|
|
|
#define BFD_COM_SECTION_NAME "*COM*"
|
|
|
|
|
#define BFD_IND_SECTION_NAME "*IND*"
|
|
|
|
|
|
|
|
|
|
/* the absolute section */
|
1994-07-15 05:35:54 +08:00
|
|
|
|
extern const asection bfd_abs_section;
|
|
|
|
|
#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
|
|
|
|
|
#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Pointer to the undefined section */
|
1994-07-15 05:35:54 +08:00
|
|
|
|
extern const asection bfd_und_section;
|
|
|
|
|
#define bfd_und_section_ptr ((asection *) &bfd_und_section)
|
|
|
|
|
#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Pointer to the common section */
|
1994-07-15 05:35:54 +08:00
|
|
|
|
extern const asection bfd_com_section;
|
|
|
|
|
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Pointer to the indirect section */
|
1994-07-15 05:35:54 +08:00
|
|
|
|
extern const asection bfd_ind_section;
|
|
|
|
|
#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
|
|
|
|
|
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
|
|
|
|
|
|
|
|
|
|
extern const struct symbol_cache_entry * const bfd_abs_symbol;
|
|
|
|
|
extern const struct symbol_cache_entry * const bfd_com_symbol;
|
|
|
|
|
extern const struct symbol_cache_entry * const bfd_und_symbol;
|
|
|
|
|
extern const struct symbol_cache_entry * const bfd_ind_symbol;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_get_section_size_before_reloc(section) \
|
|
|
|
|
(section->reloc_done ? (abort(),1): (section)->_raw_size)
|
|
|
|
|
#define bfd_get_section_size_after_reloc(section) \
|
|
|
|
|
((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
|
|
|
|
|
asection *
|
|
|
|
|
bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
|
|
|
|
|
|
|
|
|
|
asection *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_make_section_old_way PARAMS ((bfd *abfd, CONST char *name));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1993-09-29 04:44:43 +08:00
|
|
|
|
asection *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_make_section_anyway PARAMS ((bfd *abfd, CONST char *name));
|
1993-09-29 04:44:43 +08:00
|
|
|
|
|
|
|
|
|
asection *
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_make_section PARAMS ((bfd *, CONST char *name));
|
|
|
|
|
|
|
|
|
|
boolean
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bfd_map_over_sections PARAMS ((bfd *abfd,
|
|
|
|
|
void (*func)(bfd *abfd,
|
|
|
|
|
asection *sect,
|
|
|
|
|
PTR obj),
|
|
|
|
|
PTR obj));
|
|
|
|
|
|
|
|
|
|
boolean
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_section_size PARAMS ((bfd *abfd, asection *sec, bfd_size_type val));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
bfd_set_section_contents
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
PARAMS ((bfd *abfd,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
asection *section,
|
|
|
|
|
PTR data,
|
|
|
|
|
file_ptr offset,
|
|
|
|
|
bfd_size_type count));
|
|
|
|
|
|
|
|
|
|
boolean
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
bfd_get_section_contents
|
1993-06-16 10:25:53 +08:00
|
|
|
|
PARAMS ((bfd *abfd, asection *section, PTR location,
|
|
|
|
|
file_ptr offset, bfd_size_type count));
|
|
|
|
|
|
1994-03-18 07:47:00 +08:00
|
|
|
|
boolean
|
|
|
|
|
bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, asection *osec));
|
|
|
|
|
|
|
|
|
|
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
|
|
|
|
|
BFD_SEND (ibfd, _bfd_copy_private_section_data, \
|
|
|
|
|
(ibfd, isection, obfd, osection))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
enum bfd_architecture
|
|
|
|
|
{
|
|
|
|
|
bfd_arch_unknown, /* File arch not known */
|
|
|
|
|
bfd_arch_obscure, /* Arch known, not one of these */
|
|
|
|
|
bfd_arch_m68k, /* Motorola 68xxx */
|
|
|
|
|
bfd_arch_vax, /* DEC Vax */
|
|
|
|
|
bfd_arch_i960, /* Intel 960 */
|
|
|
|
|
/* The order of the following is important.
|
|
|
|
|
lower number indicates a machine type that
|
|
|
|
|
only accepts a subset of the instructions
|
|
|
|
|
available to machines with higher numbers.
|
|
|
|
|
The exception is the "ca", which is
|
|
|
|
|
incompatible with all other machines except
|
|
|
|
|
"core". */
|
|
|
|
|
|
|
|
|
|
#define bfd_mach_i960_core 1
|
|
|
|
|
#define bfd_mach_i960_ka_sa 2
|
|
|
|
|
#define bfd_mach_i960_kb_sb 3
|
|
|
|
|
#define bfd_mach_i960_mc 4
|
|
|
|
|
#define bfd_mach_i960_xa 5
|
|
|
|
|
#define bfd_mach_i960_ca 6
|
1994-07-27 08:21:43 +08:00
|
|
|
|
/* start-sanitize-i960xl */
|
|
|
|
|
#define bfd_mach_i960_xl 7
|
|
|
|
|
/* end-sanitize-i960xl */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
bfd_arch_a29k, /* AMD 29000 */
|
|
|
|
|
bfd_arch_sparc, /* SPARC */
|
|
|
|
|
bfd_arch_mips, /* MIPS Rxxxx */
|
|
|
|
|
bfd_arch_i386, /* Intel 386 */
|
|
|
|
|
bfd_arch_we32k, /* AT&T WE32xxx */
|
|
|
|
|
bfd_arch_tahoe, /* CCI/Harris Tahoe */
|
|
|
|
|
bfd_arch_i860, /* Intel 860 */
|
|
|
|
|
bfd_arch_romp, /* IBM ROMP PC/RT */
|
|
|
|
|
bfd_arch_alliant, /* Alliant */
|
|
|
|
|
bfd_arch_convex, /* Convex */
|
|
|
|
|
bfd_arch_m88k, /* Motorola 88xxx */
|
|
|
|
|
bfd_arch_pyramid, /* Pyramid Technology */
|
|
|
|
|
bfd_arch_h8300, /* Hitachi H8/300 */
|
|
|
|
|
#define bfd_mach_h8300 1
|
|
|
|
|
#define bfd_mach_h8300h 2
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
bfd_arch_powerpc, /* PowerPC */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_arch_rs6000, /* IBM RS/6000 */
|
|
|
|
|
bfd_arch_hppa, /* HP PA RISC */
|
|
|
|
|
bfd_arch_z8k, /* Zilog Z8000 */
|
|
|
|
|
#define bfd_mach_z8001 1
|
|
|
|
|
#define bfd_mach_z8002 2
|
|
|
|
|
bfd_arch_h8500, /* Hitachi H8/500 */
|
|
|
|
|
bfd_arch_sh, /* Hitachi SH */
|
|
|
|
|
bfd_arch_alpha, /* Dec Alpha */
|
1994-09-26 23:01:59 +08:00
|
|
|
|
bfd_arch_arm, /* Advanced Risc Machines ARM */
|
1994-07-15 05:35:54 +08:00
|
|
|
|
bfd_arch_ns32k, /* National Semiconductors ns32000 */
|
1995-01-16 13:44:00 +08:00
|
|
|
|
bfd_arch_w65, /* WDC 65816 */
|
1994-11-25 10:14:11 +08:00
|
|
|
|
/* start-sanitize-rce */
|
1994-11-30 09:29:26 +08:00
|
|
|
|
bfd_arch_rce, /* Motorola RCE */
|
1994-11-25 10:14:11 +08:00
|
|
|
|
/* end-sanitize-rce */
|
1994-11-30 09:29:26 +08:00
|
|
|
|
/* start-sanitize-arc */
|
|
|
|
|
bfd_arch_arc, /* Argonaut RISC Core */
|
1995-02-10 09:41:57 +08:00
|
|
|
|
#define bfd_mach_arc_base 0
|
|
|
|
|
#define bfd_mach_arc_host 1
|
|
|
|
|
#define bfd_mach_arc_graphics 2
|
|
|
|
|
#define bfd_mach_arc_audio 3
|
1994-11-30 09:29:26 +08:00
|
|
|
|
/* end-sanitize-arc */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_arch_last
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct bfd_arch_info
|
|
|
|
|
{
|
|
|
|
|
int bits_per_word;
|
|
|
|
|
int bits_per_address;
|
|
|
|
|
int bits_per_byte;
|
|
|
|
|
enum bfd_architecture arch;
|
|
|
|
|
long mach;
|
|
|
|
|
char *arch_name;
|
|
|
|
|
CONST char *printable_name;
|
|
|
|
|
unsigned int section_align_power;
|
|
|
|
|
/* true if this is the default machine for the architecture */
|
|
|
|
|
boolean the_default;
|
|
|
|
|
CONST struct bfd_arch_info * (*compatible)
|
|
|
|
|
PARAMS ((CONST struct bfd_arch_info *a,
|
|
|
|
|
CONST struct bfd_arch_info *b));
|
|
|
|
|
|
|
|
|
|
boolean (*scan) PARAMS ((CONST struct bfd_arch_info *, CONST char *));
|
|
|
|
|
/* How to disassemble an instruction, producing a printable
|
|
|
|
|
representation on a specified stdio stream. This isn't
|
|
|
|
|
defined for most processors at present, because of the size
|
|
|
|
|
of the additional tables it would drag in, and because gdb
|
|
|
|
|
wants to use a different interface. */
|
|
|
|
|
unsigned int (*disassemble) PARAMS ((bfd_vma addr, CONST char *data,
|
|
|
|
|
PTR stream));
|
|
|
|
|
|
|
|
|
|
struct bfd_arch_info *next;
|
|
|
|
|
} bfd_arch_info_type;
|
|
|
|
|
CONST char *
|
|
|
|
|
bfd_printable_name PARAMS ((bfd *abfd));
|
|
|
|
|
|
|
|
|
|
bfd_arch_info_type *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_scan_arch PARAMS ((CONST char *string));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
CONST bfd_arch_info_type *
|
|
|
|
|
bfd_arch_get_compatible PARAMS ((
|
|
|
|
|
CONST bfd *abfd,
|
|
|
|
|
CONST bfd *bbfd));
|
|
|
|
|
|
|
|
|
|
void
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_arch_info PARAMS ((bfd *abfd, bfd_arch_info_type *arg));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
enum bfd_architecture
|
|
|
|
|
bfd_get_arch PARAMS ((bfd *abfd));
|
|
|
|
|
|
|
|
|
|
unsigned long
|
|
|
|
|
bfd_get_mach PARAMS ((bfd *abfd));
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
bfd_arch_bits_per_byte PARAMS ((bfd *abfd));
|
|
|
|
|
|
|
|
|
|
unsigned int
|
|
|
|
|
bfd_arch_bits_per_address PARAMS ((bfd *abfd));
|
|
|
|
|
|
|
|
|
|
bfd_arch_info_type *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_get_arch_info PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
bfd_arch_info_type *
|
|
|
|
|
bfd_lookup_arch
|
|
|
|
|
PARAMS ((enum bfd_architecture
|
|
|
|
|
arch,
|
|
|
|
|
long machine));
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
CONST char *
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_printable_arch_mach
|
|
|
|
|
PARAMS ((enum bfd_architecture arch, unsigned long machine));
|
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
typedef enum bfd_reloc_status
|
1993-06-16 10:25:53 +08:00
|
|
|
|
{
|
|
|
|
|
/* No errors detected */
|
|
|
|
|
bfd_reloc_ok,
|
|
|
|
|
|
|
|
|
|
/* The relocation was performed, but there was an overflow. */
|
|
|
|
|
bfd_reloc_overflow,
|
|
|
|
|
|
|
|
|
|
/* The address to relocate was not within the section supplied. */
|
|
|
|
|
bfd_reloc_outofrange,
|
|
|
|
|
|
|
|
|
|
/* Used by special functions */
|
|
|
|
|
bfd_reloc_continue,
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* Unsupported relocation size requested. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_reloc_notsupported,
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* Unused */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_reloc_other,
|
|
|
|
|
|
|
|
|
|
/* The symbol to relocate against was undefined. */
|
|
|
|
|
bfd_reloc_undefined,
|
|
|
|
|
|
|
|
|
|
/* The relocation was performed, but may not be ok - presently
|
|
|
|
|
generated only when linking i960 coff files with i960 b.out
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
symbols. If this type is returned, the error_message argument
|
|
|
|
|
to bfd_perform_relocation will be set. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_reloc_dangerous
|
|
|
|
|
}
|
|
|
|
|
bfd_reloc_status_type;
|
|
|
|
|
|
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
typedef struct reloc_cache_entry
|
1993-06-16 10:25:53 +08:00
|
|
|
|
{
|
|
|
|
|
/* A pointer into the canonical table of pointers */
|
|
|
|
|
struct symbol_cache_entry **sym_ptr_ptr;
|
|
|
|
|
|
|
|
|
|
/* offset in section */
|
|
|
|
|
bfd_size_type address;
|
|
|
|
|
|
|
|
|
|
/* addend for relocation value */
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
bfd_vma addend;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* Pointer to how to perform the required relocation */
|
1995-02-06 16:31:27 +08:00
|
|
|
|
reloc_howto_type *howto;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
} arelent;
|
1993-07-23 02:03:51 +08:00
|
|
|
|
enum complain_overflow
|
|
|
|
|
{
|
|
|
|
|
/* Do not complain on overflow. */
|
|
|
|
|
complain_overflow_dont,
|
|
|
|
|
|
|
|
|
|
/* Complain if the bitfield overflows, whether it is considered
|
|
|
|
|
as signed or unsigned. */
|
|
|
|
|
complain_overflow_bitfield,
|
|
|
|
|
|
|
|
|
|
/* Complain if the value overflows when considered as signed
|
|
|
|
|
number. */
|
|
|
|
|
complain_overflow_signed,
|
|
|
|
|
|
|
|
|
|
/* Complain if the value overflows when considered as an
|
|
|
|
|
unsigned number. */
|
|
|
|
|
complain_overflow_unsigned
|
|
|
|
|
};
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-07-15 05:35:54 +08:00
|
|
|
|
struct reloc_howto_struct
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
{
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* The type field has mainly a documetary use - the back end can
|
1993-11-06 03:51:52 +08:00
|
|
|
|
do what it wants with it, though normally the back end's
|
|
|
|
|
external idea of what a reloc number is stored
|
|
|
|
|
in this field. For example, a PC relative word relocation
|
|
|
|
|
in a coff environment has the type 023 - because that's
|
1993-06-16 10:25:53 +08:00
|
|
|
|
what the outside world calls a R_PCRWORD reloc. */
|
|
|
|
|
unsigned int type;
|
|
|
|
|
|
|
|
|
|
/* The value the final relocation is shifted right by. This drops
|
|
|
|
|
unwanted data from the relocation. */
|
|
|
|
|
unsigned int rightshift;
|
|
|
|
|
|
1993-11-01 02:59:59 +08:00
|
|
|
|
/* The size of the item to be relocated. This is *not* a
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
power-of-two measure. To get the number of bytes operated
|
|
|
|
|
on by a type of relocation, use bfd_get_reloc_size. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
int size;
|
|
|
|
|
|
1993-07-23 02:03:51 +08:00
|
|
|
|
/* The number of bits in the item to be relocated. This is used
|
|
|
|
|
when doing overflow checking. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
unsigned int bitsize;
|
|
|
|
|
|
|
|
|
|
/* Notes that the relocation is relative to the location in the
|
|
|
|
|
data section of the addend. The relocation function will
|
|
|
|
|
subtract from the relocation value the address of the location
|
|
|
|
|
being relocated. */
|
|
|
|
|
boolean pc_relative;
|
|
|
|
|
|
1993-07-23 02:03:51 +08:00
|
|
|
|
/* The bit position of the reloc value in the destination.
|
|
|
|
|
The relocated value is left shifted by this amount. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
unsigned int bitpos;
|
|
|
|
|
|
1993-07-23 02:03:51 +08:00
|
|
|
|
/* What type of overflow error should be checked for when
|
|
|
|
|
relocating. */
|
|
|
|
|
enum complain_overflow complain_on_overflow;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* If this field is non null, then the supplied function is
|
|
|
|
|
called rather than the normal function. This allows really
|
|
|
|
|
strange relocation methods to be accomodated (e.g., i960 callj
|
|
|
|
|
instructions). */
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
bfd_reloc_status_type (*special_function)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
PARAMS ((bfd *abfd,
|
|
|
|
|
arelent *reloc_entry,
|
|
|
|
|
struct symbol_cache_entry *symbol,
|
|
|
|
|
PTR data,
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
asection *input_section,
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
bfd *output_bfd,
|
|
|
|
|
char **error_message));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* The textual name of the relocation type. */
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
|
|
/* When performing a partial link, some formats must modify the
|
|
|
|
|
relocations rather than the data - this flag signals this.*/
|
|
|
|
|
boolean partial_inplace;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The src_mask selects which parts of the read in data
|
1993-06-16 10:25:53 +08:00
|
|
|
|
are to be used in the relocation sum. E.g., if this was an 8 bit
|
|
|
|
|
bit of data which we read and relocated, this would be
|
|
|
|
|
0x000000ff. When we have relocs which have an addend, such as
|
|
|
|
|
sun4 extended relocs, the value in the offset part of a
|
|
|
|
|
relocating field is garbage so we never use it. In this case
|
|
|
|
|
the mask would be 0x00000000. */
|
|
|
|
|
bfd_vma src_mask;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The dst_mask selects which parts of the instruction are replaced
|
1993-06-16 10:25:53 +08:00
|
|
|
|
into the instruction. In most cases src_mask == dst_mask,
|
|
|
|
|
except in the above special case, where dst_mask would be
|
|
|
|
|
0x000000ff, and src_mask would be 0x00000000. */
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
bfd_vma dst_mask;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* When some formats create PC relative instructions, they leave
|
|
|
|
|
the value of the pc of the place being relocated in the offset
|
|
|
|
|
slot of the instruction, so that a PC relative relocation can
|
|
|
|
|
be made just by adding in an ordinary offset (e.g., sun3 a.out).
|
|
|
|
|
Some formats leave the displacement part of an instruction
|
1993-11-06 03:51:52 +08:00
|
|
|
|
empty (e.g., m88k bcs); this flag signals the fact.*/
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean pcrel_offset;
|
|
|
|
|
|
1994-07-15 05:35:54 +08:00
|
|
|
|
};
|
1993-07-23 02:03:51 +08:00
|
|
|
|
#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
|
1994-07-27 08:21:43 +08:00
|
|
|
|
{(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
|
1993-07-23 02:03:51 +08:00
|
|
|
|
#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
#define HOWTO_PREPARE(relocation, symbol) \
|
|
|
|
|
{ \
|
|
|
|
|
if (symbol != (asymbol *)NULL) { \
|
|
|
|
|
if (bfd_is_com_section (symbol->section)) { \
|
|
|
|
|
relocation = 0; \
|
|
|
|
|
} \
|
|
|
|
|
else { \
|
|
|
|
|
relocation = symbol->value; \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
}
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
int
|
1995-01-12 10:41:04 +08:00
|
|
|
|
bfd_get_reloc_size PARAMS ((reloc_howto_type *));
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
typedef struct relent_chain {
|
|
|
|
|
arelent relent;
|
|
|
|
|
struct relent_chain *next;
|
|
|
|
|
} arelent_chain;
|
|
|
|
|
bfd_reloc_status_type
|
|
|
|
|
|
|
|
|
|
bfd_perform_relocation
|
1993-11-06 03:51:52 +08:00
|
|
|
|
PARAMS ((bfd *abfd,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
arelent *reloc_entry,
|
|
|
|
|
PTR data,
|
|
|
|
|
asection *input_section,
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
bfd *output_bfd,
|
|
|
|
|
char **error_message));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-11-18 06:46:22 +08:00
|
|
|
|
bfd_reloc_status_type
|
|
|
|
|
|
|
|
|
|
bfd_install_relocation
|
|
|
|
|
PARAMS ((bfd *abfd,
|
|
|
|
|
arelent *reloc_entry,
|
|
|
|
|
PTR data, bfd_vma data_start,
|
|
|
|
|
asection *input_section,
|
|
|
|
|
char **error_message));
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
enum bfd_reloc_code_real {
|
|
|
|
|
_dummy_first_bfd_reloc_code_real,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Basic absolute relocations of N bits. */
|
1993-07-07 04:46:32 +08:00
|
|
|
|
BFD_RELOC_64,
|
|
|
|
|
BFD_RELOC_32,
|
1994-04-01 03:08:22 +08:00
|
|
|
|
BFD_RELOC_26,
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
BFD_RELOC_16,
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_14,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_8,
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* PC-relative relocations. Sometimes these are relative to the address
|
|
|
|
|
of the relocation itself; sometimes they are relative to the start of
|
|
|
|
|
the section containing the relocation. It depends on the specific target.
|
|
|
|
|
|
|
|
|
|
The 24-bit relocation is used in some Intel 960 configurations. */
|
1993-11-01 02:59:59 +08:00
|
|
|
|
BFD_RELOC_64_PCREL,
|
|
|
|
|
BFD_RELOC_32_PCREL,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
BFD_RELOC_24_PCREL,
|
1993-11-01 02:59:59 +08:00
|
|
|
|
BFD_RELOC_16_PCREL,
|
1994-11-18 06:46:22 +08:00
|
|
|
|
BFD_RELOC_12_PCREL,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_8_PCREL,
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Linkage-table relative. */
|
1993-11-01 02:59:59 +08:00
|
|
|
|
BFD_RELOC_32_BASEREL,
|
|
|
|
|
BFD_RELOC_16_BASEREL,
|
|
|
|
|
BFD_RELOC_8_BASEREL,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
|
1993-11-01 02:59:59 +08:00
|
|
|
|
BFD_RELOC_8_FFnn,
|
|
|
|
|
|
1994-11-18 06:46:22 +08:00
|
|
|
|
/* These PC-relative relocations are stored as word displacements --
|
|
|
|
|
i.e., byte displacements shifted right two bits. The 30-bit word
|
|
|
|
|
displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
|
|
|
|
|
SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
|
|
|
|
|
signed 16-bit displacement is used on the MIPS, and the 23-bit
|
|
|
|
|
displacement is used on the Alpha. */
|
1993-11-01 02:59:59 +08:00
|
|
|
|
BFD_RELOC_32_PCREL_S2,
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_16_PCREL_S2,
|
|
|
|
|
BFD_RELOC_23_PCREL_S2,
|
1993-11-01 02:59:59 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
|
|
|
|
|
the target word. These are used on the SPARC. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_HI22,
|
|
|
|
|
BFD_RELOC_LO10,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* For systems that allocate a Global Pointer register, these are
|
|
|
|
|
displacements off that register. These relocation types are
|
|
|
|
|
handled specially, because the value the register will have is
|
|
|
|
|
decided relatively late. */
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_GPREL16,
|
|
|
|
|
BFD_RELOC_GPREL32,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Reloc types used for i960/b.out. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_I960_CALLJ,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* SPARC ELF relocations. There is probably some overlap with other
|
|
|
|
|
relocation types already defined. */
|
|
|
|
|
BFD_RELOC_NONE,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_SPARC_WDISP22,
|
|
|
|
|
BFD_RELOC_SPARC22,
|
|
|
|
|
BFD_RELOC_SPARC13,
|
|
|
|
|
BFD_RELOC_SPARC_GOT10,
|
|
|
|
|
BFD_RELOC_SPARC_GOT13,
|
|
|
|
|
BFD_RELOC_SPARC_GOT22,
|
|
|
|
|
BFD_RELOC_SPARC_PC10,
|
|
|
|
|
BFD_RELOC_SPARC_PC22,
|
|
|
|
|
BFD_RELOC_SPARC_WPLT30,
|
|
|
|
|
BFD_RELOC_SPARC_COPY,
|
|
|
|
|
BFD_RELOC_SPARC_GLOB_DAT,
|
|
|
|
|
BFD_RELOC_SPARC_JMP_SLOT,
|
|
|
|
|
BFD_RELOC_SPARC_RELATIVE,
|
|
|
|
|
BFD_RELOC_SPARC_UA32,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* I think these are specific to SPARC a.out (e.g., Sun 4). */
|
1993-07-12 22:48:13 +08:00
|
|
|
|
BFD_RELOC_SPARC_BASE13,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_SPARC_BASE22,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Some relocations we're using for SPARC V9 -- subject to change. */
|
|
|
|
|
#define BFD_RELOC_SPARC_64 BFD_RELOC_64
|
1993-07-07 04:46:32 +08:00
|
|
|
|
BFD_RELOC_SPARC_10,
|
|
|
|
|
BFD_RELOC_SPARC_11,
|
|
|
|
|
BFD_RELOC_SPARC_OLO10,
|
|
|
|
|
BFD_RELOC_SPARC_HH22,
|
|
|
|
|
BFD_RELOC_SPARC_HM10,
|
|
|
|
|
BFD_RELOC_SPARC_LM22,
|
|
|
|
|
BFD_RELOC_SPARC_PC_HH22,
|
|
|
|
|
BFD_RELOC_SPARC_PC_HM10,
|
|
|
|
|
BFD_RELOC_SPARC_PC_LM22,
|
|
|
|
|
BFD_RELOC_SPARC_WDISP16,
|
1993-07-12 22:48:13 +08:00
|
|
|
|
BFD_RELOC_SPARC_WDISP19,
|
1993-07-07 04:46:32 +08:00
|
|
|
|
BFD_RELOC_SPARC_GLOB_JMP,
|
|
|
|
|
BFD_RELOC_SPARC_LO7,
|
1993-07-12 22:48:13 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Alpha ECOFF relocations. Some of these treat the symbol or "addend"
|
|
|
|
|
in some special way.
|
|
|
|
|
For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
|
|
|
|
|
writing; when reading, it will be the absolute section symbol. The
|
|
|
|
|
addend is the displacement in bytes of the "lda" instruction from
|
|
|
|
|
the "ldah" instruction (which is at the address of this reloc). */
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_ALPHA_GPDISP_HI16,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
|
|
|
|
|
with GPDISP_HI16 relocs. The addend is ignored when writing the
|
|
|
|
|
relocations out, and is filled in with the file's GP value on
|
|
|
|
|
reading, for convenience. */
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_ALPHA_GPDISP_LO16,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
|
|
|
|
|
the assembler turns it into a LDQ instruction to load the address of
|
|
|
|
|
the symbol, and then fills in a register in the real instruction.
|
|
|
|
|
|
|
|
|
|
The LITERAL reloc, at the LDQ instruction, refers to the .lita
|
|
|
|
|
section symbol. The addend is ignored when writing, but is filled
|
|
|
|
|
in with the file's GP value on reading, for convenience, as with the
|
|
|
|
|
GPDISP_LO16 reloc.
|
|
|
|
|
|
|
|
|
|
The LITUSE reloc, on the instruction using the loaded address, gives
|
|
|
|
|
information to the linker that it might be able to use to optimize
|
|
|
|
|
away some literal section references. The symbol is ignored (read
|
|
|
|
|
as the absolute section symbol), and the "addend" indicates the type
|
|
|
|
|
of instruction using the register:
|
|
|
|
|
1 - "memory" fmt insn
|
|
|
|
|
2 - byte-manipulation (byte offset reg)
|
|
|
|
|
3 - jsr (target of branch)
|
|
|
|
|
|
|
|
|
|
The GNU linker currently doesn't do any of this optimizing. */
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_ALPHA_LITERAL,
|
|
|
|
|
BFD_RELOC_ALPHA_LITUSE,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* The HINT relocation indicates a value that should be filled into the
|
|
|
|
|
"hint" field of a jmp/jsr/ret instruction, for possible branch-
|
|
|
|
|
prediction logic which may be provided on some processors. */
|
1994-01-20 08:07:58 +08:00
|
|
|
|
BFD_RELOC_ALPHA_HINT,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Bits 27..2 of the relocation address shifted right 2 bits;
|
|
|
|
|
simple reloc otherwise. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_MIPS_JMP,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* High 16 bits of 32-bit value; simple reloc. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_HI16,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* High 16 bits of 32-bit value but the low 16 bits will be sign
|
|
|
|
|
extended and added to form the final result. If the low 16
|
|
|
|
|
bits form a negative number, we need to add one to the high value
|
|
|
|
|
to compensate for the borrow when the low bits are added. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_HI16_S,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* Low 16 bits. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
BFD_RELOC_LO16,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* Like BFD_RELOC_HI16_S, but PC relative. */
|
1994-04-15 01:08:31 +08:00
|
|
|
|
BFD_RELOC_PCREL_HI16_S,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* Like BFD_RELOC_LO16, but PC relative. */
|
1994-04-15 01:08:31 +08:00
|
|
|
|
BFD_RELOC_PCREL_LO16,
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Relocation relative to the global pointer. */
|
1994-01-20 08:07:58 +08:00
|
|
|
|
#define BFD_RELOC_MIPS_GPREL BFD_RELOC_GPREL16
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* Relocation against a MIPS literal section. */
|
1993-11-05 16:34:09 +08:00
|
|
|
|
BFD_RELOC_MIPS_LITERAL,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* MIPS ELF relocations. */
|
1993-11-05 16:34:09 +08:00
|
|
|
|
BFD_RELOC_MIPS_GOT16,
|
|
|
|
|
BFD_RELOC_MIPS_CALL16,
|
1994-01-20 08:07:58 +08:00
|
|
|
|
#define BFD_RELOC_MIPS_GPREL32 BFD_RELOC_GPREL32
|
1993-11-05 16:34:09 +08:00
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* i386/elf relocations */
|
1993-08-06 02:36:19 +08:00
|
|
|
|
BFD_RELOC_386_GOT32,
|
|
|
|
|
BFD_RELOC_386_PLT32,
|
|
|
|
|
BFD_RELOC_386_COPY,
|
|
|
|
|
BFD_RELOC_386_GLOB_DAT,
|
|
|
|
|
BFD_RELOC_386_JUMP_SLOT,
|
|
|
|
|
BFD_RELOC_386_RELATIVE,
|
|
|
|
|
BFD_RELOC_386_GOTOFF,
|
|
|
|
|
BFD_RELOC_386_GOTPC,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* ns32k relocations */
|
1994-07-15 05:35:54 +08:00
|
|
|
|
BFD_RELOC_NS32K_IMM_8,
|
|
|
|
|
BFD_RELOC_NS32K_IMM_16,
|
|
|
|
|
BFD_RELOC_NS32K_IMM_32,
|
|
|
|
|
BFD_RELOC_NS32K_IMM_8_PCREL,
|
|
|
|
|
BFD_RELOC_NS32K_IMM_16_PCREL,
|
|
|
|
|
BFD_RELOC_NS32K_IMM_32_PCREL,
|
|
|
|
|
BFD_RELOC_NS32K_DISP_8,
|
|
|
|
|
BFD_RELOC_NS32K_DISP_16,
|
|
|
|
|
BFD_RELOC_NS32K_DISP_32,
|
|
|
|
|
BFD_RELOC_NS32K_DISP_8_PCREL,
|
|
|
|
|
BFD_RELOC_NS32K_DISP_16_PCREL,
|
|
|
|
|
BFD_RELOC_NS32K_DISP_32_PCREL,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* PowerPC/POWER (RS/6000) relocs.
|
|
|
|
|
26 bit relative branch. Low two bits must be zero. High 24
|
|
|
|
|
bits installed in bits 6 through 29 of instruction. */
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
BFD_RELOC_PPC_B26,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* 26 bit absolute branch, like BFD_RELOC_PPC_B26 but absolute. */
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
BFD_RELOC_PPC_BA26,
|
1994-09-03 02:21:41 +08:00
|
|
|
|
|
|
|
|
|
/* 16 bit TOC relative reference. */
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
BFD_RELOC_PPC_TOC16,
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
/* The type of reloc used to build a contructor table - at the moment
|
|
|
|
|
probably a 32 bit wide absolute relocation, but the target can choose.
|
|
|
|
|
It generally does map to one of the other relocation types. */
|
|
|
|
|
BFD_RELOC_CTOR,
|
1994-09-26 23:01:59 +08:00
|
|
|
|
|
|
|
|
|
/* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
|
|
|
|
|
not stored in the instruction. */
|
|
|
|
|
BFD_RELOC_ARM_PCREL_BRANCH,
|
|
|
|
|
|
|
|
|
|
/* These relocs are only used within the ARM assembler. They are not
|
|
|
|
|
(at present) written to any object files. */
|
|
|
|
|
BFD_RELOC_ARM_IMMEDIATE,
|
|
|
|
|
BFD_RELOC_ARM_OFFSET_IMM,
|
|
|
|
|
BFD_RELOC_ARM_SHIFT_IMM,
|
|
|
|
|
BFD_RELOC_ARM_SWI,
|
|
|
|
|
BFD_RELOC_ARM_MULTI,
|
|
|
|
|
BFD_RELOC_ARM_CP_OFF_IMM,
|
1994-11-30 09:29:26 +08:00
|
|
|
|
/* start-sanitize-arc */
|
|
|
|
|
|
|
|
|
|
/* Argonaut RISC Core (ARC) relocs.
|
|
|
|
|
ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
|
|
|
|
|
not stored in the instruction. High 20 bits installed in bits 7 through 26
|
|
|
|
|
of instruction. */
|
|
|
|
|
BFD_RELOC_ARC_B22_PCREL,
|
|
|
|
|
/* end-sanitize-arc */
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
BFD_RELOC_UNUSED };
|
|
|
|
|
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
|
1995-02-06 16:31:27 +08:00
|
|
|
|
reloc_howto_type *
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
|
|
|
|
|
1994-09-03 02:21:41 +08:00
|
|
|
|
const char *
|
|
|
|
|
bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
|
|
|
|
|
|
1993-08-10 03:25:56 +08:00
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
typedef struct symbol_cache_entry
|
1993-06-16 10:25:53 +08:00
|
|
|
|
{
|
|
|
|
|
/* A pointer to the BFD which owns the symbol. This information
|
|
|
|
|
is necessary so that a back end can work out what additional
|
|
|
|
|
information (invisible to the application writer) is carried
|
|
|
|
|
with the symbol.
|
|
|
|
|
|
|
|
|
|
This field is *almost* redundant, since you can use section->owner
|
|
|
|
|
instead, except that some symbols point to the global sections
|
|
|
|
|
bfd_{abs,com,und}_section. This could be fixed by making
|
|
|
|
|
these globals be per-bfd (or per-target-flavor). FIXME. */
|
|
|
|
|
|
|
|
|
|
struct _bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The text of the symbol. The name is left alone, and not copied; the
|
1993-06-16 10:25:53 +08:00
|
|
|
|
application may not alter it. */
|
|
|
|
|
CONST char *name;
|
|
|
|
|
|
|
|
|
|
/* The value of the symbol. This really should be a union of a
|
|
|
|
|
numeric value with a pointer, since some flags indicate that
|
|
|
|
|
a pointer to another symbol is stored here. */
|
|
|
|
|
symvalue value;
|
|
|
|
|
|
|
|
|
|
/* Attributes of a symbol: */
|
|
|
|
|
|
|
|
|
|
#define BSF_NO_FLAGS 0x00
|
|
|
|
|
|
|
|
|
|
/* The symbol has local scope; <<static>> in <<C>>. The value
|
|
|
|
|
is the offset into the section of the data. */
|
|
|
|
|
#define BSF_LOCAL 0x01
|
|
|
|
|
|
|
|
|
|
/* The symbol has global scope; initialized data in <<C>>. The
|
|
|
|
|
value is the offset into the section of the data. */
|
|
|
|
|
#define BSF_GLOBAL 0x02
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The symbol has global scope and is exported. The value is
|
1993-06-16 10:25:53 +08:00
|
|
|
|
the offset into the section of the data. */
|
1993-08-10 03:25:56 +08:00
|
|
|
|
#define BSF_EXPORT BSF_GLOBAL /* no real difference */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* A normal C symbol would be one of:
|
|
|
|
|
<<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
|
1993-08-10 03:25:56 +08:00
|
|
|
|
<<BSF_GLOBAL>> */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* The symbol is a debugging record. The value has an arbitary
|
|
|
|
|
meaning. */
|
|
|
|
|
#define BSF_DEBUGGING 0x08
|
|
|
|
|
|
|
|
|
|
/* The symbol denotes a function entry point. Used in ELF,
|
|
|
|
|
perhaps others someday. */
|
|
|
|
|
#define BSF_FUNCTION 0x10
|
|
|
|
|
|
|
|
|
|
/* Used by the linker. */
|
|
|
|
|
#define BSF_KEEP 0x20
|
|
|
|
|
#define BSF_KEEP_G 0x40
|
|
|
|
|
|
1993-08-06 02:36:19 +08:00
|
|
|
|
/* A weak global symbol, overridable without warnings by
|
|
|
|
|
a regular global symbol of the same name. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define BSF_WEAK 0x80
|
|
|
|
|
|
|
|
|
|
/* This symbol was created to point to a section, e.g. ELF's
|
|
|
|
|
STT_SECTION symbols. */
|
|
|
|
|
#define BSF_SECTION_SYM 0x100
|
|
|
|
|
|
|
|
|
|
/* The symbol used to be a common symbol, but now it is
|
|
|
|
|
allocated. */
|
|
|
|
|
#define BSF_OLD_COMMON 0x200
|
|
|
|
|
|
|
|
|
|
/* The default value for common data. */
|
|
|
|
|
#define BFD_FORT_COMM_DEFAULT_VALUE 0
|
|
|
|
|
|
|
|
|
|
/* In some files the type of a symbol sometimes alters its
|
|
|
|
|
location in an output file - ie in coff a <<ISFCN>> symbol
|
|
|
|
|
which is also <<C_EXT>> symbol appears where it was
|
|
|
|
|
declared and not at the end of a section. This bit is set
|
|
|
|
|
by the target BFD part to convey this information. */
|
|
|
|
|
|
|
|
|
|
#define BSF_NOT_AT_END 0x400
|
|
|
|
|
|
|
|
|
|
/* Signal that the symbol is the label of constructor section. */
|
|
|
|
|
#define BSF_CONSTRUCTOR 0x800
|
|
|
|
|
|
|
|
|
|
/* Signal that the symbol is a warning symbol. If the symbol
|
|
|
|
|
is a warning symbol, then the value field (I know this is
|
|
|
|
|
tacky) will point to the asymbol which when referenced will
|
|
|
|
|
cause the warning. */
|
|
|
|
|
#define BSF_WARNING 0x1000
|
|
|
|
|
|
|
|
|
|
/* Signal that the symbol is indirect. The value of the symbol
|
|
|
|
|
is a pointer to an undefined asymbol which contains the
|
|
|
|
|
name to use instead. */
|
|
|
|
|
#define BSF_INDIRECT 0x2000
|
|
|
|
|
|
|
|
|
|
/* BSF_FILE marks symbols that contain a file name. This is used
|
|
|
|
|
for ELF STT_FILE symbols. */
|
|
|
|
|
#define BSF_FILE 0x4000
|
|
|
|
|
|
* syms.c (BSF_DYNAMIC): New symbol flag.
(bfd_print_symbol_vandf): Print it.
* bfd-in2.h: Rebuilt.
* libaout.h (struct aout_backend_data): New read_dynamic_symbols
and read_dynamic_relocs fields.
(struct aoutdata): New dynamic_info field.
(obj_aout_dynamic_info): New accessor macro.
* sunos.c (struct sunos_dynamic_info): New structure.
(sunos_read_dynamic_info, MY(read_dynamic_symbols),
MY(read_dynamic_relocs)): New functions to read dynamic symbols
and relocs.
* aoutx.h (NAME(aout,some_aout_object_p)): If the object is
dynamically linked, set SEC_RELOC for both the .text and .data
sections.
(translate_from_native_sym_flags): Don't set BSF_LOCAL for an
undefined symbol.
(translate_symbol_table): New function, split out of
slurp_symbol_table; set the BSF_DYNAMIC flag appropriately.
(NAME(aout,slurp_symbol_table)): Read dynamic symbols, if any.
(NAME(aout,slurp_reloc_table)): Read dynamic relocs, if any.
(NAME(aout,get_reloc_upper_bound)): Include dynamic reloc count in
return value.
* aoutf1.h (NAME(aout,sunos4_write_object_contents)): Don't write
out dynamic symbols or relocs against reloc symbols, since they
are already in the .text section and we wouldn't know where to
write them anyhow.
(sunos4_aout_backend): Initialize read_dynamic_symbols and
read_dynamic_relocs fields.
* aout-target.h (MY(backend_data)): Initialize
read_dynamic_symbols and read_dynamic_relocs fields.
1994-01-21 14:29:21 +08:00
|
|
|
|
/* Symbol is from dynamic linking information. */
|
|
|
|
|
#define BSF_DYNAMIC 0x8000
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
flagword flags;
|
|
|
|
|
|
* Most files:
Replace DEFUN and DEFUN_VOID with K&R-style function definition.
Indent some of them to GNU standards.
* aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
Update copyright years.
1994-03-15 23:13:13 +08:00
|
|
|
|
/* A pointer to the section to which this symbol is
|
1993-06-16 10:25:53 +08:00
|
|
|
|
relative. This will always be non NULL, there are special
|
1994-11-18 06:46:22 +08:00
|
|
|
|
sections for undefined and absolute symbols. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct sec *section;
|
|
|
|
|
|
1994-11-18 06:46:22 +08:00
|
|
|
|
/* Back end special data. */
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
PTR p;
|
|
|
|
|
bfd_vma i;
|
|
|
|
|
} udata;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
} asymbol;
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
#define bfd_get_symtab_upper_bound(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
|
1994-03-18 07:47:00 +08:00
|
|
|
|
boolean
|
|
|
|
|
bfd_is_local_label PARAMS ((bfd *abfd, asymbol *sym));
|
|
|
|
|
|
|
|
|
|
#define bfd_is_local_label(abfd, sym) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_is_local_label,(abfd, sym))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_canonicalize_symtab(abfd, location) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_canonicalize_symtab,\
|
|
|
|
|
(abfd, location))
|
|
|
|
|
boolean
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_symtab PARAMS ((bfd *abfd, asymbol **location, unsigned int count));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
|
|
|
|
|
|
|
|
|
|
#define bfd_make_empty_symbol(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
|
|
|
|
|
#define bfd_make_debug_symbol(abfd,ptr,size) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
|
|
|
|
|
int
|
|
|
|
|
bfd_decode_symclass PARAMS ((asymbol *symbol));
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
|
|
|
|
|
|
|
|
|
|
struct _bfd
|
|
|
|
|
{
|
|
|
|
|
/* The filename the application opened the BFD with. */
|
|
|
|
|
CONST char *filename;
|
|
|
|
|
|
|
|
|
|
/* A pointer to the target jump table. */
|
1994-06-21 05:55:45 +08:00
|
|
|
|
const struct bfd_target *xvec;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
/* To avoid dragging too many header files into every file that
|
|
|
|
|
includes `<<bfd.h>>', IOSTREAM has been declared as a "char
|
|
|
|
|
*", and MTIME as a "long". Their correct types, to which they
|
|
|
|
|
are cast when used, are "FILE *" and "time_t". The iostream
|
|
|
|
|
is the result of an fopen on the filename. */
|
|
|
|
|
char *iostream;
|
|
|
|
|
|
1993-11-05 16:34:09 +08:00
|
|
|
|
/* Is the file descriptor being cached? That is, can it be closed as
|
|
|
|
|
needed, and re-opened when accessed later? */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean cacheable;
|
|
|
|
|
|
|
|
|
|
/* Marks whether there was a default target specified when the
|
1993-11-06 03:51:52 +08:00
|
|
|
|
BFD was opened. This is used to select which matching algorithm
|
|
|
|
|
to use to choose the back end. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean target_defaulted;
|
|
|
|
|
|
|
|
|
|
/* The caching routines use these to maintain a
|
|
|
|
|
least-recently-used list of BFDs */
|
|
|
|
|
|
|
|
|
|
struct _bfd *lru_prev, *lru_next;
|
|
|
|
|
|
|
|
|
|
/* When a file is closed by the caching routines, BFD retains
|
1993-11-06 03:51:52 +08:00
|
|
|
|
state information on the file here: */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
file_ptr where;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* and here: (``once'' means at least once) */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean opened_once;
|
|
|
|
|
|
|
|
|
|
/* Set if we have a locally maintained mtime value, rather than
|
|
|
|
|
getting it from the file each time: */
|
|
|
|
|
|
|
|
|
|
boolean mtime_set;
|
|
|
|
|
|
|
|
|
|
/* File modified time, if mtime_set is true: */
|
|
|
|
|
|
|
|
|
|
long mtime;
|
|
|
|
|
|
|
|
|
|
/* Reserved for an unimplemented file locking extension.*/
|
|
|
|
|
|
|
|
|
|
int ifd;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* The format which belongs to the BFD. (object, core, etc.) */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
bfd_format format;
|
|
|
|
|
|
|
|
|
|
/* The direction the BFD was opened with*/
|
|
|
|
|
|
|
|
|
|
enum bfd_direction {no_direction = 0,
|
|
|
|
|
read_direction = 1,
|
|
|
|
|
write_direction = 2,
|
|
|
|
|
both_direction = 3} direction;
|
|
|
|
|
|
|
|
|
|
/* Format_specific flags*/
|
|
|
|
|
|
|
|
|
|
flagword flags;
|
|
|
|
|
|
|
|
|
|
/* Currently my_archive is tested before adding origin to
|
|
|
|
|
anything. I believe that this can become always an add of
|
|
|
|
|
origin, with origin set to 0 for non archive files. */
|
|
|
|
|
|
|
|
|
|
file_ptr origin;
|
|
|
|
|
|
|
|
|
|
/* Remember when output has begun, to stop strange things
|
1993-11-06 03:51:52 +08:00
|
|
|
|
from happening. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean output_has_begun;
|
|
|
|
|
|
|
|
|
|
/* Pointer to linked list of sections*/
|
|
|
|
|
struct sec *sections;
|
|
|
|
|
|
|
|
|
|
/* The number of sections */
|
|
|
|
|
unsigned int section_count;
|
|
|
|
|
|
|
|
|
|
/* Stuff only useful for object files:
|
|
|
|
|
The start address. */
|
|
|
|
|
bfd_vma start_address;
|
|
|
|
|
|
|
|
|
|
/* Used for input and output*/
|
|
|
|
|
unsigned int symcount;
|
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
/* Symbol table for output BFD (with symcount entries) */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct symbol_cache_entry **outsymbols;
|
|
|
|
|
|
|
|
|
|
/* Pointer to structure which contains architecture information*/
|
|
|
|
|
struct bfd_arch_info *arch_info;
|
|
|
|
|
|
|
|
|
|
/* Stuff only useful for archives:*/
|
|
|
|
|
PTR arelt_data;
|
1993-11-06 03:51:52 +08:00
|
|
|
|
struct _bfd *my_archive; /* The containing archive BFD. */
|
|
|
|
|
struct _bfd *next; /* The next BFD in the archive. */
|
|
|
|
|
struct _bfd *archive_head; /* The first BFD in the archive. */
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean has_armap;
|
|
|
|
|
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
/* A chain of BFD structures involved in a link. */
|
|
|
|
|
struct _bfd *link_next;
|
|
|
|
|
|
|
|
|
|
/* A field used by _bfd_generic_link_add_archive_symbols. This will
|
|
|
|
|
be used only for archive elements. */
|
|
|
|
|
int archive_pass;
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
/* Used by the back end to hold private data. */
|
|
|
|
|
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
struct aout_data_struct *aout_data;
|
|
|
|
|
struct artdata *aout_ar_data;
|
|
|
|
|
struct _oasys_data *oasys_obj_data;
|
|
|
|
|
struct _oasys_ar_data *oasys_ar_data;
|
|
|
|
|
struct coff_tdata *coff_obj_data;
|
|
|
|
|
struct ecoff_tdata *ecoff_obj_data;
|
|
|
|
|
struct ieee_data_struct *ieee_data;
|
|
|
|
|
struct ieee_ar_data_struct *ieee_ar_data;
|
|
|
|
|
struct srec_data_struct *srec_data;
|
|
|
|
|
struct tekhex_data_struct *tekhex_data;
|
|
|
|
|
struct elf_obj_tdata *elf_obj_data;
|
* configure.in (*-*-netware, i[34]86-*-netware): New configs.
* Makefile.in (BFD32_BACKENDS): Add nlm.o, nlm32.o, nlm32-gen.o.
* Makefile.in (BFD64_BACKENDS): Add nlm64.o, nlm64-gen.o.
* Makefile.in (CFILES): Add nlm{32,64}.c, nlm{32,64}-gen.c.
* Makefile.in (nlm.o, nlm{32,64}.o, nlm{32,64}-gen.o: New targets.
* bfd-in2.h (INLINE): Defines moved here.
* {aoutx.h, elf.c, elfcode.h}: Move INLINE defines to bfd-in2.h.
* libelf.h (CAT4): Move define to bfd-in2.h.
* bfd-in2.h (CAT4): Merge CAT4 macro with other CAT macros.
* bfd-in2.h (union tdata): Add nlm_obj_data.
* bfd-in2.h (enum target_flavour): Add bfd_target_nlm_flavour.
* targets.c (bfd_nlm{32,64}_{big,little}_vec): Add prototypes.
* targets.c (target_vector): Add bfd_nlm{32,64}_{big,little}_vec.
* (libnlm.h, nlm.c, nlmcode.h, nlm{32,64}-gen.c,
nlm{32,64}-target.h, nlm{32,64}.c, config/i386-nlm.mt): New files
for NLM support.
1993-07-20 12:45:13 +08:00
|
|
|
|
struct nlm_obj_tdata *nlm_obj_data;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct bout_data_struct *bout_data;
|
|
|
|
|
struct sun_core_struct *sun_core_data;
|
|
|
|
|
struct trad_core_struct *trad_core_data;
|
1993-11-01 02:59:59 +08:00
|
|
|
|
struct som_data_struct *som_data;
|
1993-08-06 02:36:19 +08:00
|
|
|
|
struct hpux_core_struct *hpux_core_data;
|
1993-11-24 15:21:28 +08:00
|
|
|
|
struct hppabsd_core_struct *hppabsd_core_data;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct sgi_core_struct *sgi_core_data;
|
1993-09-22 22:54:50 +08:00
|
|
|
|
struct lynx_core_struct *lynx_core_data;
|
1993-09-29 04:44:43 +08:00
|
|
|
|
struct osf_core_struct *osf_core_data;
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
struct cisco_core_struct *cisco_core_data;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
PTR any;
|
|
|
|
|
} tdata;
|
|
|
|
|
|
|
|
|
|
/* Used by the application to hold private data*/
|
|
|
|
|
PTR usrdata;
|
|
|
|
|
|
|
|
|
|
/* Where all the allocated stuff under this BFD goes */
|
|
|
|
|
struct obstack memory;
|
|
|
|
|
};
|
|
|
|
|
|
1994-01-22 10:18:02 +08:00
|
|
|
|
typedef enum bfd_error
|
|
|
|
|
{
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
bfd_error_no_error = 0,
|
|
|
|
|
bfd_error_system_call,
|
|
|
|
|
bfd_error_invalid_target,
|
|
|
|
|
bfd_error_wrong_format,
|
|
|
|
|
bfd_error_invalid_operation,
|
|
|
|
|
bfd_error_no_memory,
|
|
|
|
|
bfd_error_no_symbols,
|
|
|
|
|
bfd_error_no_more_archived_files,
|
|
|
|
|
bfd_error_malformed_archive,
|
|
|
|
|
bfd_error_file_not_recognized,
|
|
|
|
|
bfd_error_file_ambiguously_recognized,
|
|
|
|
|
bfd_error_no_contents,
|
|
|
|
|
bfd_error_nonrepresentable_section,
|
|
|
|
|
bfd_error_no_debug_section,
|
|
|
|
|
bfd_error_bad_value,
|
|
|
|
|
bfd_error_file_truncated,
|
1995-02-06 16:31:27 +08:00
|
|
|
|
bfd_error_file_too_big,
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
bfd_error_invalid_error_code
|
|
|
|
|
} bfd_error_type;
|
|
|
|
|
|
|
|
|
|
bfd_error_type
|
|
|
|
|
bfd_get_error PARAMS ((void));
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bfd_set_error PARAMS ((bfd_error_type error_tag));
|
1994-01-22 10:18:02 +08:00
|
|
|
|
|
|
|
|
|
CONST char *
|
* bfd.c (bfd_get_error, bfd_set_error): New functions.
(bfd_error): Make static.
(bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
all values.
* bfd-in2.h: Regenerated.
* aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
aoutf1.h, aoutx.h, archive.c, archures.c,
bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
srec.c, sunos.c, syms.c, targets.c, tekhex.c,
trad-core.c: Change callers.
1994-02-18 02:08:41 +08:00
|
|
|
|
bfd_errmsg PARAMS ((bfd_error_type error_tag));
|
1994-01-22 10:18:02 +08:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bfd_perror PARAMS ((CONST char *message));
|
|
|
|
|
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
long
|
1993-11-09 07:22:49 +08:00
|
|
|
|
bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
|
|
|
|
|
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
long
|
1993-11-09 07:22:49 +08:00
|
|
|
|
bfd_canonicalize_reloc
|
|
|
|
|
PARAMS ((bfd *abfd,
|
|
|
|
|
asection *sec,
|
|
|
|
|
arelent **loc,
|
|
|
|
|
asymbol **syms));
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
bfd_set_reloc
|
|
|
|
|
PARAMS ((bfd *abfd, asection *sec, arelent **rel, unsigned int count)
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean
|
|
|
|
|
bfd_set_file_flags PARAMS ((bfd *abfd, flagword flags));
|
|
|
|
|
|
|
|
|
|
boolean
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_start_address PARAMS ((bfd *abfd, bfd_vma vma));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
long
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_get_mtime PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
long
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_get_size PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
int
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_get_gp_size PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
void
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_gp_size PARAMS ((bfd *abfd, int i));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1993-08-10 03:25:56 +08:00
|
|
|
|
bfd_vma
|
|
|
|
|
bfd_scan_vma PARAMS ((CONST char *string, CONST char **end, int base));
|
|
|
|
|
|
1994-03-18 07:47:00 +08:00
|
|
|
|
boolean
|
|
|
|
|
bfd_copy_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
|
|
|
|
|
|
|
|
|
|
#define bfd_copy_private_bfd_data(ibfd, obfd) \
|
|
|
|
|
BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \
|
|
|
|
|
(ibfd, obfd))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_sizeof_headers(abfd, reloc) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
|
|
|
|
|
|
|
|
|
|
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_find_nearest_line, (abfd, sec, syms, off, file, func, line))
|
|
|
|
|
|
|
|
|
|
/* Do these three do anything useful at all, for any back end? */
|
|
|
|
|
#define bfd_debug_info_start(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
|
|
|
|
|
|
|
|
|
|
#define bfd_debug_info_end(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
|
|
|
|
|
|
|
|
|
|
#define bfd_debug_info_accumulate(abfd, section) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define bfd_stat_arch_elt(abfd, stat) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
|
|
|
|
|
|
1994-08-31 00:04:40 +08:00
|
|
|
|
#define bfd_update_armap_timestamp(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define bfd_set_arch_mach(abfd, arch, mach)\
|
|
|
|
|
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
|
|
|
|
|
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
#define bfd_get_relocated_section_contents(abfd, link_info, link_order, data, relocateable, symbols) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_get_relocated_section_contents, \
|
|
|
|
|
(abfd, link_info, link_order, data, relocateable, symbols))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
#define bfd_relax_section(abfd, section, link_info, again) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
|
|
|
|
|
#define bfd_link_hash_table_create(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
|
|
|
|
|
|
|
|
|
#define bfd_link_add_symbols(abfd, info) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
|
|
|
|
|
|
|
|
|
|
#define bfd_final_link(abfd, info) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_final_link, (abfd, info))
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-04-02 01:55:47 +08:00
|
|
|
|
#define bfd_free_cached_info(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
|
|
|
|
|
|
1994-04-07 09:48:51 +08:00
|
|
|
|
#define bfd_get_dynamic_symtab_upper_bound(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
|
|
|
|
|
|
|
|
|
|
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
|
|
|
|
|
|
|
|
|
|
#define bfd_get_dynamic_reloc_upper_bound(abfd) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
|
|
|
|
|
|
|
|
|
|
#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
|
|
|
|
|
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
symindex
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
bfd_set_archive_head PARAMS ((bfd *output, bfd *new_head));
|
|
|
|
|
|
|
|
|
|
bfd *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_get_elt_at_index PARAMS ((bfd *archive, int index));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd *
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_openr_next_archived_file PARAMS ((bfd *archive, bfd *previous));
|
|
|
|
|
|
|
|
|
|
CONST char *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_core_file_failing_command PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
int
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_core_file_failing_signal PARAMS ((bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
core_file_matches_executable_p
|
|
|
|
|
PARAMS ((bfd *core_bfd, bfd *exec_bfd));
|
|
|
|
|
|
|
|
|
|
#define BFD_SEND(bfd, message, arglist) \
|
|
|
|
|
((*((bfd)->xvec->message)) arglist)
|
1994-02-28 07:45:18 +08:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_BFD_SEND
|
|
|
|
|
#undef BFD_SEND
|
|
|
|
|
#define BFD_SEND(bfd, message, arglist) \
|
|
|
|
|
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
|
|
|
|
((*((bfd)->xvec->message)) arglist) : \
|
|
|
|
|
(bfd_assert (__FILE__,__LINE__), NULL))
|
|
|
|
|
#endif
|
1993-06-16 10:25:53 +08:00
|
|
|
|
#define BFD_SEND_FMT(bfd, message, arglist) \
|
|
|
|
|
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
|
1994-02-28 07:45:18 +08:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_BFD_SEND
|
|
|
|
|
#undef BFD_SEND_FMT
|
|
|
|
|
#define BFD_SEND_FMT(bfd, message, arglist) \
|
|
|
|
|
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
|
|
|
|
|
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
|
|
|
|
|
(bfd_assert (__FILE__,__LINE__), NULL))
|
|
|
|
|
#endif
|
1993-11-01 02:59:59 +08:00
|
|
|
|
enum bfd_flavour {
|
|
|
|
|
bfd_target_unknown_flavour,
|
|
|
|
|
bfd_target_aout_flavour,
|
|
|
|
|
bfd_target_coff_flavour,
|
|
|
|
|
bfd_target_ecoff_flavour,
|
|
|
|
|
bfd_target_elf_flavour,
|
|
|
|
|
bfd_target_ieee_flavour,
|
|
|
|
|
bfd_target_nlm_flavour,
|
|
|
|
|
bfd_target_oasys_flavour,
|
|
|
|
|
bfd_target_tekhex_flavour,
|
|
|
|
|
bfd_target_srec_flavour,
|
1994-03-02 10:36:07 +08:00
|
|
|
|
bfd_target_som_flavour,
|
1995-02-06 16:31:27 +08:00
|
|
|
|
bfd_target_os9k_flavour,
|
|
|
|
|
bfd_target_msdos_flavour
|
|
|
|
|
};
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
|
|
|
|
|
/* Forward declaration. */
|
|
|
|
|
typedef struct bfd_link_info _bfd_link_info;
|
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
typedef struct bfd_target
|
|
|
|
|
{
|
|
|
|
|
char *name;
|
1993-11-01 02:59:59 +08:00
|
|
|
|
enum bfd_flavour flavour;
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean byteorder_big_p;
|
|
|
|
|
boolean header_byteorder_big_p;
|
|
|
|
|
flagword object_flags;
|
|
|
|
|
flagword section_flags;
|
|
|
|
|
char symbol_leading_char;
|
|
|
|
|
char ar_pad_char;
|
|
|
|
|
unsigned short ar_max_namelen;
|
|
|
|
|
unsigned int align_power_min;
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
|
|
|
|
|
bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
|
|
|
|
|
bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
|
|
|
|
|
bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
|
|
|
|
|
bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
|
|
|
|
|
bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
* bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* bfd-in2.h: Rebuilt.
* libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
be a const pointer.
* targets.c (bfd_target): Change swap function pointers
accordingly.
* archive.c (do_slurp_coff_armap): Change swap accordingly.
* aix386-core.c: Change NO_GET and NO_GETS accordingly.
* hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
accordingly.
1994-01-04 05:28:43 +08:00
|
|
|
|
bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
|
|
|
|
|
bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
1994-06-21 05:55:45 +08:00
|
|
|
|
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
|
|
|
|
|
boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
|
|
|
|
|
/* Generic entry points. */
|
|
|
|
|
#define BFD_JUMP_TABLE_GENERIC(NAME)\
|
|
|
|
|
CAT(NAME,_close_and_cleanup),\
|
|
|
|
|
CAT(NAME,_bfd_free_cached_info),\
|
|
|
|
|
CAT(NAME,_new_section_hook),\
|
|
|
|
|
CAT(NAME,_get_section_contents)
|
|
|
|
|
/* Called when the BFD is being closed to do any necessary cleanup. */
|
|
|
|
|
boolean (*_close_and_cleanup) PARAMS ((bfd *));
|
|
|
|
|
/* Ask the BFD to free all cached information. */
|
|
|
|
|
boolean (*_bfd_free_cached_info) PARAMS ((bfd *));
|
|
|
|
|
/* Called when a new section is created. */
|
|
|
|
|
boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
|
|
|
|
|
/* Read the contents of a section. */
|
|
|
|
|
boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
|
|
|
|
|
file_ptr, bfd_size_type));
|
|
|
|
|
|
|
|
|
|
/* Entry points to copy private data. */
|
|
|
|
|
#define BFD_JUMP_TABLE_COPY(NAME)\
|
|
|
|
|
CAT(NAME,_bfd_copy_private_bfd_data),\
|
|
|
|
|
CAT(NAME,_bfd_copy_private_section_data)
|
|
|
|
|
/* Called to copy BFD general private data from one object file
|
|
|
|
|
to another. */
|
|
|
|
|
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
|
|
|
|
|
/* Called to copy BFD private section data from one object file
|
|
|
|
|
to another. */
|
|
|
|
|
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
|
|
|
|
|
bfd *, sec_ptr));
|
|
|
|
|
|
|
|
|
|
/* Core file entry points. */
|
|
|
|
|
#define BFD_JUMP_TABLE_CORE(NAME)\
|
|
|
|
|
CAT(NAME,_core_file_failing_command),\
|
|
|
|
|
CAT(NAME,_core_file_failing_signal),\
|
|
|
|
|
CAT(NAME,_core_file_matches_executable_p)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
char * (*_core_file_failing_command) PARAMS ((bfd *));
|
|
|
|
|
int (*_core_file_failing_signal) PARAMS ((bfd *));
|
|
|
|
|
boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
|
|
|
|
|
/* Archive entry points. */
|
|
|
|
|
#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
|
|
|
|
|
CAT(NAME,_slurp_armap),\
|
|
|
|
|
CAT(NAME,_slurp_extended_name_table),\
|
1994-11-18 06:46:22 +08:00
|
|
|
|
CAT(NAME,_construct_extended_name_table),\
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
CAT(NAME,_truncate_arname),\
|
|
|
|
|
CAT(NAME,_write_armap),\
|
|
|
|
|
CAT(NAME,_openr_next_archived_file),\
|
1994-08-31 00:04:40 +08:00
|
|
|
|
CAT(NAME,_generic_stat_arch_elt),\
|
|
|
|
|
CAT(NAME,_update_armap_timestamp)
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
|
|
|
|
|
boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
|
1994-11-18 06:46:22 +08:00
|
|
|
|
boolean (*_bfd_construct_extended_name_table)
|
|
|
|
|
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
|
|
|
|
|
boolean (*write_armap) PARAMS ((bfd *arch,
|
|
|
|
|
unsigned int elength,
|
|
|
|
|
struct orl *map,
|
|
|
|
|
unsigned int orl_count,
|
|
|
|
|
int stridx));
|
1994-08-31 00:04:40 +08:00
|
|
|
|
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
|
|
|
|
|
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
|
|
|
|
|
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
|
|
|
|
|
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
/* Entry points used for symbols. */
|
|
|
|
|
#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
|
|
|
|
|
CAT(NAME,_get_symtab_upper_bound),\
|
|
|
|
|
CAT(NAME,_get_symtab),\
|
|
|
|
|
CAT(NAME,_make_empty_symbol),\
|
|
|
|
|
CAT(NAME,_print_symbol),\
|
|
|
|
|
CAT(NAME,_get_symbol_info),\
|
|
|
|
|
CAT(NAME,_bfd_is_local_label),\
|
|
|
|
|
CAT(NAME,_get_lineno),\
|
|
|
|
|
CAT(NAME,_find_nearest_line),\
|
|
|
|
|
CAT(NAME,_bfd_make_debug_symbol)
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
|
|
|
|
long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
|
|
|
|
struct symbol_cache_entry **));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
struct symbol_cache_entry *
|
|
|
|
|
(*_bfd_make_empty_symbol) PARAMS ((bfd *));
|
|
|
|
|
void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,
|
|
|
|
|
struct symbol_cache_entry *,
|
|
|
|
|
bfd_print_symbol_type));
|
|
|
|
|
#define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))
|
|
|
|
|
void (*_bfd_get_symbol_info) PARAMS ((bfd *,
|
|
|
|
|
struct symbol_cache_entry *,
|
|
|
|
|
symbol_info *));
|
|
|
|
|
#define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))
|
1994-03-18 07:47:00 +08:00
|
|
|
|
boolean (*_bfd_is_local_label) PARAMS ((bfd *, asymbol *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,
|
|
|
|
|
struct sec *section, struct symbol_cache_entry **symbols,
|
|
|
|
|
bfd_vma offset, CONST char **file, CONST char **func,
|
|
|
|
|
unsigned int *line));
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
/* Back-door to allow format-aware applications to create debug symbols
|
|
|
|
|
while using BFD for everything else. Currently used by the assembler
|
|
|
|
|
when creating COFF files. */
|
|
|
|
|
asymbol * (*_bfd_make_debug_symbol) PARAMS ((
|
|
|
|
|
bfd *abfd,
|
|
|
|
|
void *ptr,
|
|
|
|
|
unsigned long size));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
/* Routines for relocs. */
|
|
|
|
|
#define BFD_JUMP_TABLE_RELOCS(NAME)\
|
|
|
|
|
CAT(NAME,_get_reloc_upper_bound),\
|
|
|
|
|
CAT(NAME,_canonicalize_reloc),\
|
|
|
|
|
CAT(NAME,_bfd_reloc_type_lookup)
|
|
|
|
|
long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));
|
|
|
|
|
long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
|
|
|
|
|
struct symbol_cache_entry **));
|
|
|
|
|
/* See documentation on reloc types. */
|
1995-02-06 16:31:27 +08:00
|
|
|
|
reloc_howto_type *
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
(*reloc_type_lookup) PARAMS ((bfd *abfd,
|
|
|
|
|
bfd_reloc_code_real_type code));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
/* Routines used when writing an object file. */
|
|
|
|
|
#define BFD_JUMP_TABLE_WRITE(NAME)\
|
|
|
|
|
CAT(NAME,_set_arch_mach),\
|
|
|
|
|
CAT(NAME,_set_section_contents)
|
|
|
|
|
boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,
|
|
|
|
|
unsigned long));
|
|
|
|
|
boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
|
|
|
|
|
file_ptr, bfd_size_type));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
* targets.c (bfd_target): Rearranged fields in target vector.
Removed _bfd_debug_info_start, _bfd_debug_info_end and
_bfd_debug_info_accumulate, which were never used.
(BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
(BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
(BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
(BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
* All backends: Changed to use the new BFD_JUMP_TABLE_* macros
rather than the single JUMP_TABLE macro. Removed many of the
weird macro definitions needed to support the monolithic
JUMP_TABLE.
* bfd-in.h (JUMP_TABLE): Removed.
* libbfd-in.h: Define a bunch of macros, and declare a few
functions, for use with the new BFD_JUMP_TABLE_* macros.
* libbfd.c (_bfd_dummy_new_section_hook): Removed.
(bfd_false): Set bfd_error_invalid_operation.
(bfd_nullvoidptr): Likewise.
(bfd_n1): New function.
(_bfd_nocore_core_file_matches_executable_p): Renamed from
_bfd_dummy_core_file_matches_executable_p.
(_bfd_nocore_core_file_failing_command): Similar rename. Set
bfd_error_invalid_operation.
(_bfd_nocore_core_file_failing_signal): Likewise.
(_bfd_generic_get_section_contents): Renamed from
bfd_generic_get_section_contents. Changed all callers.
(_bfd_generic_set_section_contents): Similar rename.
* ieee.c: #if 0 out ieee_bfd_debug_info_start,
ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
were never called.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
1994-04-07 06:00:40 +08:00
|
|
|
|
/* Routines used by the linker. */
|
|
|
|
|
#define BFD_JUMP_TABLE_LINK(NAME)\
|
|
|
|
|
CAT(NAME,_sizeof_headers),\
|
|
|
|
|
CAT(NAME,_bfd_get_relocated_section_contents),\
|
|
|
|
|
CAT(NAME,_bfd_relax_section),\
|
|
|
|
|
CAT(NAME,_bfd_link_hash_table_create),\
|
|
|
|
|
CAT(NAME,_bfd_link_add_symbols),\
|
|
|
|
|
CAT(NAME,_bfd_final_link)
|
|
|
|
|
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
struct bfd_link_info *, struct bfd_link_order *,
|
|
|
|
|
bfd_byte *data, boolean relocateable,
|
|
|
|
|
struct symbol_cache_entry **));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
|
Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Changes to let BFD return an error indication from
get_symtab_upper_bound, bfd_canonicalize_symtab,
bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
return long instead of unsigned int, and use -1 to indicate an
error. Along the way, rename get_symtab_upper_bound to
bfd_get_symtab_upper_bound.
* bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
errors.
(bfd_canonicalize_reloc): Likewise.
* syms.c (bfd_get_symtab_upper_bound): Renamed from
get_symtab_upper_bound.
* targets.c (bfd_target): Renamed _get_symtab_upper_bound to
_bfd_get_symtab_upper_bound, and changed it and
_bfd_canonicalize_symtab and _get_reloc_upper_bound and
_bfd_canonicalize_reloc to all return long.
* aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
(NAME(aout,get_symtab_upper_bound)): Likewise.
* bout.c (b_out_canonicalize_reloc): Likewise.
(b_out_get_reloc_upper_bound): Likewise.
* coffcode.h (coff_canonicalize_reloc): Likewise.
* coffgen.c (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* elfcode.h (elf_get_symtab_upper_bound): Likewise.
(elf_get_reloc_upper_bound): Likewise.
(elf_canonicalize_reloc): Likewise.
(elf_get_symtab): Likewise.
* hp300hpux.c (MY(get_symtab)): Likewise.
(MY(get_symtab_upper_bound)): Likewise.
(MY(canonicalize_reloc)): Likewise.
* i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
* ieee.c (ieee_slurp_external_symbols): Change return type to
boolean. Check for errors from get_symbol.
(ieee_slurp_symbol_table): Change return type to boolean. Check
for errors from ieee_slurp_external_symbols.
(ieee_get_symtab_upper_bound): Return long, and -1 on errors.
(ieee_get_symtab): Likewise.
(ieee_get_reloc_upper_bound): Likewise.
(ieee_canonicalize_reloc): Likewise.
* mipsbsd.c (MY(canonicalize_reloc)): Likewise.
* nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
(nlm_get_symtab): Likewise.
(nlm_get_reloc_upper_bound): Likewise.
(nlm_canonicalize_reloc): Likewise.
* oasys.c (oasys_get_symtab_upper_bound): Likewise.
(oasys_get_symtab): Likewise.
(oasys_get_reloc_upper_bound): Likewise.
(oasys_canonicalize_reloc): Likewise.
* som.c (som_get_symtab_upper_bound): Likewise.
(som_get_symtab): Likewise.
(som_get_reloc_upper_bound): Likewise.
(som_canonicalize_reloc): Likewise.
* srec.c (srec_get_symtab_upper_bound): Likewise.
(srec_get_symtab): Likewise.
(srec_get_reloc_upper_bound): Define as bfd_0l.
(srec_canonicalize_reloc): Likewise.
* tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
(tekhex_get_symtab_upper_bound): Likewise.
(tekhex_get_reloc_upper_bound): Define as bfd_0l.
(tekhex_canonicalize_reloc): Likewise.
* libaout.h (NAME(aout,get_symtab_upper_bound)): Change
declaration to return long.
(NAME(aout,get_symtab)): Likewise.
(NAME(aout,canonicalize_reloc)): Likewise.
(NAME(aout,get_reloc_upper_bound)): Likewise.
* libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
(coff_get_symtab): Likewise.
(coff_get_reloc_upper_bound): Likewise.
* libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
(ecoff_get_symtab): Likewise.
(ecoff_canonicalize_reloc): Likewise.
* libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
(bfd_elf32_get_symtab): Likewise.
(bfd_elf32_get_reloc_upper_bound): Likewise.
(bfd_elf32_canonicalize_reloc): Likewise.
(bfd_elf64_get_symtab_upper_bound): Likewise.
(bfd_elf64_get_symtab): Likewise.
(bfd_elf64_get_reloc_upper_bound): Likewise.
(bfd_elf64_canonicalize_reloc): Likewise.
* libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
(nlmNAME(get_symtab)): Likewise.
(nlmNAME(get_reloc_upper_bound)): Likewise.
(nlmNAME(canonicalize_reloc)): Likewise.
* archive.c (compute_and_write_armap): Use error_return and
no_memory_return labels rather than freeing information in various
places. Change storage, symcount and src_count to long. Check
errors from bfd_get_symtab_upper_bound and
bfd_canonicalize_symtab.
* bout.c (b_out_relax_section): Change reloc_size to long. Check
for errors from bfd_get_reloc_upper_bound and
bfd_canonicalize_reloc.
(b_out_get_relocated_section_contents): Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
Likewise.
* elf32-mips.c: Likewise.
* elf32-hppa.c (hppa_elf_stub_finish): Likewise.
(hppa_look_for_stubs_in_section): Check for errors from
bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
bfd_canonicalize_reloc.
* ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
* linker.c (generic_link_read_symbols): Likewise.
(_bfd_generic_final_link): Check for errors from
bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
* reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
(bfd_coff_reloc16_get_relocated_section_contents): Likewise.
* libbfd.c (bfd_0l): New function.
* libbfd-in.h (bfd_0l): Declare.
* aix386-core.c: Change get_symtab_upper_bound, get_symtab,
get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
than bfd_0u.
* cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
* irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* libcoff.h: Rebuilt.
* nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
temp and name.
1994-03-31 06:15:07 +08:00
|
|
|
|
struct bfd_link_info *, boolean *again));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-04-07 09:48:51 +08:00
|
|
|
|
/* Create a hash table for the linker. Different backends store
|
|
|
|
|
different information in this table. */
|
|
|
|
|
struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));
|
|
|
|
|
|
|
|
|
|
/* Add symbols from this object file into the hash table. */
|
|
|
|
|
boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));
|
|
|
|
|
|
|
|
|
|
/* Do a link based on the link_order structures attached to each
|
|
|
|
|
section of the BFD. */
|
|
|
|
|
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
|
|
|
|
|
|
|
|
|
|
/* Routines to handle dynamic symbols and relocs. */
|
|
|
|
|
#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
|
|
|
|
|
CAT(NAME,_get_dynamic_symtab_upper_bound),\
|
|
|
|
|
CAT(NAME,_canonicalize_dynamic_symtab),\
|
|
|
|
|
CAT(NAME,_get_dynamic_reloc_upper_bound),\
|
|
|
|
|
CAT(NAME,_canonicalize_dynamic_reloc)
|
|
|
|
|
/* Get the amount of memory required to hold the dynamic symbols. */
|
|
|
|
|
long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));
|
|
|
|
|
/* Read in the dynamic symbols. */
|
|
|
|
|
long (*_bfd_canonicalize_dynamic_symtab)
|
|
|
|
|
PARAMS ((bfd *, struct symbol_cache_entry **));
|
|
|
|
|
/* Get the amount of memory required to hold the dynamic relocs. */
|
|
|
|
|
long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));
|
|
|
|
|
/* Read in the dynamic relocs. */
|
|
|
|
|
long (*_bfd_canonicalize_dynamic_reloc)
|
|
|
|
|
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
|
Extensive changes to move the bulk of the linker into BFD so that
more efficient backend code can be written for specific object
files. Only existing efficient backend is a.out.
* seclet.c, seclet.h: Removed.
* hash.c, linker.c, genlink.h: New files.
* bfd-in.h: Removed bfd_error_vector. Declared hash table
structures and functions.
(JUMP_TABLE): Removed bfd_seclet_link, added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* All backends: Changed accordingly.
* bfd-in2.h: Rebuilt.
* bfd.c (struct _bfd): Added link_next and archive_pass fields.
Removed ld_symbols field.
(bfd_nonrepresentable_section, bfd_undefined_symbol,
bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
bfd_error_vector): Removed.
(bfd_default_error_trap, bfd_error_trap,
bfd_error_nonrepresentabltrap): Removed.
(bfd_get_relocated_section_contents): Pass link_info. Pass
link_order instead of seclet. Pass symbols.
(bfd_relax_section): Pass link_info.
(bfd_seclet_link): Removed.
(bfd_link_hash_table_create, bfd_link_add_symbols,
bfd_final_link): New macros.
* libbfd-in.h: If __GNUC__ is defined and alloca is not, define
alloca as __builtin_alloca. Declare internal linking functions.
* libbfd.h: Rebuilt.
* libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
for months.
* reloc.c (reloc_howto_type): Added error_message argument to
special_function field. Changed all callers and all definitions.
(bfd_get_reloc_size): Make argument a const pointer.
(bfd_perform_relocation): Add error_message argument to hold
string set if return value if bfd_reloc_dangerous. Changed all
callers.
(_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
* section.c (asection): Renamed seclets_head and seclets_tail to
link_order_head and link_order_tail.
* targets.c (bfd_target): Replaced seclet argument with link_info
and link_order and symbols arguments in
bfd_get_relocated_section_contents. Added symbols argument to
bfd_relax_section. Removed bfd_seclet_link. Added
bfd_link_hash_table_create, bfd_link_add_symbols and
bfd_final_link.
* libaout.h (struct aoutdata): Added external_syms,
external_sym_count, external_strings, sym_hashes fields.
(obj_aout_external_syms, obj_aout_external_sym_count,
obj_aout_external_strings, obj_aout_sym_hashes): New accessor
macros.
(WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
* aoutx.h: Wrote new back end linker routines.
(translate_to_native_sym_flags): Return boolean value. Don't use
bfd_error_vector.
(NAME(aout,write_syms)): Return boolean value. Check return value
of translate_to_native_sym_flags and bfd_write.
* aout-target.h (final_link_callback): New function.
(MY_bfd_final_link): New function.
* aout-adobe.c (aout_adobe_write_object_contents): Check return
value of aout_32_write_syms.
* hp300hpux.c (MY(write_object_contents)): Likewise.
* i386lynx.c (WRITE_HEADERS): Likewise.
* libaout.h (WRITE_HEADERS): Likewise.
* bout.c: Changed functions to use link_info->callbacks rather
than bfd_error_vector, and link_orders rather than seclets.
* coff-alpha.c: Likewise.
* coff-h8300.c: Likewise.
* coff-h8500.c: Likewise.
* coff-sh.c: Likewise.
* coff-z8k.c: Likewise.
* elf32-hppa.c: Likewise.
* reloc16.c: Likewise.
* coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
up _gp in the hash table rather than in outsymbols.
* coff-a29k.c (a29k_reloc): Pass errors back in new error_message
argument rather than printing them.
* coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
link_order arguments rather than seclet. Changed all uses and
definitions.
(bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
all uses and definitions.
* libcoff.h: Rebuilt.
* ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
not by ECOFF, make it scAbs.
(ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
rewritten.
* elf32-mips.c (mips_elf_final_link): Renamed from
mips_elf_seclet_link and rewritten.
* elf32-hppa.c (elf32_hppa_stub_description): Added link_info
field.
(new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
Added link_info arguments. Changed all callers.
* elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
not NULL.
* oasys.c (oasys_write_sections): Return boolean value rather than
using bfd_error_vector.
(oasys_write_object_contents): Check return value of
oasys_write_sections.
* hosts/std-host.h: Don't declare qsort or strtol.
* Makefile.in: Rebuild dependencies.
(BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
(CFILES): Removed seclet.c. Added hash.c and linker.c.
(HFILES): Removed seclet.h. Added genlink.h.
1993-12-31 03:56:50 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
PTR backend_data;
|
|
|
|
|
} bfd_target;
|
1994-06-21 05:55:45 +08:00
|
|
|
|
const bfd_target *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
1994-06-21 05:55:45 +08:00
|
|
|
|
const char **
|
1993-06-16 10:25:53 +08:00
|
|
|
|
bfd_target_list PARAMS ((void));
|
|
|
|
|
|
|
|
|
|
boolean
|
|
|
|
|
bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
|
|
|
|
|
|
1994-01-25 07:33:23 +08:00
|
|
|
|
boolean
|
|
|
|
|
bfd_check_format_matches PARAMS ((bfd *abfd, bfd_format format, char ***matching));
|
1994-01-22 12:28:17 +08:00
|
|
|
|
|
1993-06-16 10:25:53 +08:00
|
|
|
|
boolean
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_set_format PARAMS ((bfd *abfd, bfd_format format));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
CONST char *
|
1993-11-06 03:51:52 +08:00
|
|
|
|
bfd_format_string PARAMS ((bfd_format format));
|
1993-06-16 10:25:53 +08:00
|
|
|
|
|
|
|
|
|
#endif
|