forked from Imagelibrary/binutils-gdb
Compare commits
1 Commits
users/sima
...
binutils_l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6feb0544f |
42
.gitignore
vendored
42
.gitignore
vendored
@@ -1,42 +0,0 @@
|
||||
*.diff
|
||||
*.patch
|
||||
*.orig
|
||||
*.rej
|
||||
|
||||
*~
|
||||
.#*
|
||||
*#
|
||||
|
||||
*.flt
|
||||
*.gmo
|
||||
*.info
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
*.pyc
|
||||
*.tmp
|
||||
|
||||
.deps
|
||||
.libs
|
||||
|
||||
autom4te.cache
|
||||
config.cache
|
||||
config.h
|
||||
config.intl
|
||||
config.log
|
||||
config.status
|
||||
libtool
|
||||
POTFILES
|
||||
*-POTFILES
|
||||
|
||||
TAGS
|
||||
TAGS.sub
|
||||
|
||||
.gdbinit
|
||||
.gdb_history
|
||||
|
||||
# ignore core files, but not java/net/protocol/core/
|
||||
core
|
||||
!core/
|
||||
|
||||
lost+found
|
||||
239
bfd/aout-encap.c
Normal file
239
bfd/aout-encap.c
Normal file
@@ -0,0 +1,239 @@
|
||||
/* BFD back-end for a.out files encapsulated with COFF headers.
|
||||
Copyright 1990, 1991, 1994, 1995, 2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* THIS MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */
|
||||
|
||||
#if 0
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define TEXT_START_ADDR 0
|
||||
#endif
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "aout/aout64.h"
|
||||
#include "aout/stab_gnu.h"
|
||||
#include "aout/ar.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
const bfd_target *encap_real_callback ();
|
||||
|
||||
const bfd_target *
|
||||
encap_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
unsigned char magicbuf[4]; /* Raw bytes of magic number from file */
|
||||
unsigned long magic; /* Swapped magic number */
|
||||
short coff_magic;
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec exec;
|
||||
bfd_size_type amt = sizeof (magicbuf);
|
||||
|
||||
if (bfd_bread ((PTR) magicbuf, amt, abfd) != amt)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
coff_magic = H_GET_16 (abfd, magicbuf);
|
||||
if (coff_magic != COFF_MAGIC)
|
||||
return 0; /* Not an encap coff file */
|
||||
|
||||
magic = H_GET_32 (abfd, magicbuf);
|
||||
|
||||
if (N_BADMAG (*((struct internal_exec *) &magic)))
|
||||
return 0;
|
||||
|
||||
if (bfd_seek (abfd, (file_ptr) sizeof (struct coffheader), SEEK_SET) != 0)
|
||||
return 0;
|
||||
|
||||
amt = EXEC_BYTES_SIZE;
|
||||
if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
}
|
||||
NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
|
||||
|
||||
return aout_32_some_aout_object_p (abfd, &exec, encap_realcallback);
|
||||
}
|
||||
|
||||
/* Finish up the reading of an encapsulated-coff a.out file header. */
|
||||
const bfd_target *
|
||||
encap_real_callback (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
MY(callback) (abfd, execp);
|
||||
|
||||
/* If we have a coff header, it can give us better values for
|
||||
text_start and exec_data_start. This is particularly useful
|
||||
for remote debugging of embedded systems. */
|
||||
if (N_FLAGS(exec_aouthdr) & N_FLAGS_COFF_ENCAPSULATE)
|
||||
{
|
||||
struct coffheader ch;
|
||||
int val;
|
||||
val = lseek (execchan, -(sizeof (AOUTHDR) + sizeof (ch)), 1);
|
||||
if (val == -1)
|
||||
perror_with_name (filename);
|
||||
val = myread (execchan, &ch, sizeof (ch));
|
||||
if (val < 0)
|
||||
perror_with_name (filename);
|
||||
text_start = ch.text_start;
|
||||
exec_data_start = ch.data_start;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_start =
|
||||
IS_OBJECT_FILE (exec_aouthdr) ? 0 : N_TXTADDR (exec_aouthdr);
|
||||
exec_data_start = (IS_OBJECT_FILE (exec_aouthdr)
|
||||
? exec_aouthdr.a_text
|
||||
: N_DATADDR (exec_aouthdr));
|
||||
}
|
||||
|
||||
/* Determine the architecture and machine type of the object file. */
|
||||
bfd_default_set_arch_mach(abfd, bfd_arch_m68k, 0); /* FIXME */
|
||||
|
||||
return abfd->xvec;
|
||||
}
|
||||
|
||||
/* Write an object file in Encapsulated COFF format.
|
||||
Section contents have already been written. We write the
|
||||
file header, symbols, and relocation. */
|
||||
|
||||
bfd_boolean
|
||||
encap_write_object_contents (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
bfd_size_type data_pad = 0;
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
/* FIXME: Fragments from the old GNU LD program for dealing with
|
||||
encap coff. */
|
||||
struct coffheader coffheader;
|
||||
int need_coff_header;
|
||||
|
||||
/* Determine whether to count the header as part of
|
||||
the text size, and initialize the text size accordingly.
|
||||
This depends on the kind of system and on the output format selected. */
|
||||
|
||||
N_SET_MAGIC (outheader, magic);
|
||||
#ifdef INITIALIZE_HEADER
|
||||
INITIALIZE_HEADER;
|
||||
#endif
|
||||
|
||||
text_size = sizeof (struct exec);
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
if (relocatable_output == 0 && file_table[0].just_syms_flag == 0)
|
||||
{
|
||||
need_coff_header = 1;
|
||||
/* set this flag now, since it will change the values of N_TXTOFF, etc */
|
||||
N_SET_FLAGS (outheader, aout_backend_info (abfd)->exec_hdr_flags);
|
||||
text_size += sizeof (struct coffheader);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
if (need_coff_header)
|
||||
{
|
||||
/* We are encapsulating BSD format within COFF format. */
|
||||
struct coffscn *tp, *dp, *bp;
|
||||
|
||||
tp = &coffheader.scns[0];
|
||||
dp = &coffheader.scns[1];
|
||||
bp = &coffheader.scns[2];
|
||||
|
||||
strcpy (tp->s_name, ".text");
|
||||
tp->s_paddr = text_start;
|
||||
tp->s_vaddr = text_start;
|
||||
tp->s_size = text_size;
|
||||
tp->s_scnptr = sizeof (struct coffheader) + sizeof (struct exec);
|
||||
tp->s_relptr = 0;
|
||||
tp->s_lnnoptr = 0;
|
||||
tp->s_nreloc = 0;
|
||||
tp->s_nlnno = 0;
|
||||
tp->s_flags = 0x20;
|
||||
strcpy (dp->s_name, ".data");
|
||||
dp->s_paddr = data_start;
|
||||
dp->s_vaddr = data_start;
|
||||
dp->s_size = data_size;
|
||||
dp->s_scnptr = tp->s_scnptr + tp->s_size;
|
||||
dp->s_relptr = 0;
|
||||
dp->s_lnnoptr = 0;
|
||||
dp->s_nreloc = 0;
|
||||
dp->s_nlnno = 0;
|
||||
dp->s_flags = 0x40;
|
||||
strcpy (bp->s_name, ".bss");
|
||||
bp->s_paddr = dp->s_vaddr + dp->s_size;
|
||||
bp->s_vaddr = bp->s_paddr;
|
||||
bp->s_size = bss_size;
|
||||
bp->s_scnptr = 0;
|
||||
bp->s_relptr = 0;
|
||||
bp->s_lnnoptr = 0;
|
||||
bp->s_nreloc = 0;
|
||||
bp->s_nlnno = 0;
|
||||
bp->s_flags = 0x80;
|
||||
|
||||
coffheader.f_magic = COFF_MAGIC;
|
||||
coffheader.f_nscns = 3;
|
||||
/* store an unlikely time so programs can
|
||||
* tell that there is a bsd header
|
||||
*/
|
||||
coffheader.f_timdat = 1;
|
||||
coffheader.f_symptr = 0;
|
||||
coffheader.f_nsyms = 0;
|
||||
coffheader.f_opthdr = 28;
|
||||
coffheader.f_flags = 0x103;
|
||||
/* aouthdr */
|
||||
coffheader.magic = ZMAGIC;
|
||||
coffheader.vstamp = 0;
|
||||
coffheader.tsize = tp->s_size;
|
||||
coffheader.dsize = dp->s_size;
|
||||
coffheader.bsize = bp->s_size;
|
||||
coffheader.entry = outheader.a_entry;
|
||||
coffheader.text_start = tp->s_vaddr;
|
||||
coffheader.data_start = dp->s_vaddr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ENCAPSULATE
|
||||
if (need_coff_header)
|
||||
mywrite (&coffheader, sizeof coffheader, 1, outdesc);
|
||||
#endif
|
||||
|
||||
#ifndef COFF_ENCAPSULATE
|
||||
padfile (N_TXTOFF (outheader) - sizeof outheader, outdesc);
|
||||
#endif
|
||||
|
||||
text_size -= N_TXTOFF (outheader);
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define MY_write_object_content encap_write_object_contents
|
||||
#define MY_object_p encap_object_p
|
||||
#define MY_exec_hdr_flags N_FLAGS_COFF_ENCAPSULATE
|
||||
|
||||
#include "aout-target.h"
|
||||
729
bfd/arange-set.c
Normal file
729
bfd/arange-set.c
Normal file
@@ -0,0 +1,729 @@
|
||||
/* DWARF 2 Arange-Set.
|
||||
Copyright 2007 Free Software Foundation, Inc.
|
||||
Contributed by Doug Kwan, Google Inc.
|
||||
|
||||
This file is part of BFD.
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "libiberty.h"
|
||||
#include "libbfd.h"
|
||||
#include "arange-set.h"
|
||||
#include "splay-tree.h"
|
||||
|
||||
/* Implementation of an arange-set. The set is implemented using the
|
||||
splay tree support in libiberty. The advantage of using this is
|
||||
that it has been well tested and is relatively simple to use. The
|
||||
disadvantage is that it is too general and it does not fit our design
|
||||
exactly. So we waste a bit of memory for unneeded generality and work
|
||||
around for mis-match between the splay tree API and the arange-set
|
||||
internals. A specialized implentation of a balanced tree type for
|
||||
arange-set exclusively may speed up things a little and reduce memory
|
||||
consumption. Until there is a pressing need, we stick to the splay
|
||||
tree in libiberty. */
|
||||
|
||||
struct arange_set_s
|
||||
{
|
||||
/* Splay tree containing aranges. */
|
||||
splay_tree ranges;
|
||||
|
||||
/* Lowest address in set. If set is empty, it is ~0. */
|
||||
bfd_vma lower_bound;
|
||||
|
||||
/* Highest address in set. If set is empty, it is 0. */
|
||||
bfd_vma upper_bound;
|
||||
|
||||
/* TRUE if aranges in this set have values. */
|
||||
bfd_boolean value_p;
|
||||
|
||||
/* Function to compare arange values. */
|
||||
arange_value_equal_fn value_equal_fn;
|
||||
|
||||
/* Function to copy an arange value. */
|
||||
arange_value_copy_fn value_copy_fn;
|
||||
|
||||
/* Function to combine arange values. */
|
||||
arange_value_combine_fn value_combine_fn;
|
||||
|
||||
/* Function to delete an arange value. */
|
||||
arange_value_delete_fn value_delete_fn;
|
||||
|
||||
/* Function to allocate a piece of memory. */
|
||||
arange_set_allocate_fn allocate_fn;
|
||||
|
||||
/* Function to deallocate a piece of memory. */
|
||||
arange_set_deallocate_fn deallocate_fn;
|
||||
|
||||
/* Call back data shared by all callbacks. */
|
||||
void *data;
|
||||
};
|
||||
|
||||
/* Structure for aranges with a value attached. Since a splay tree
|
||||
node can only hold one value, we need to use the container struct
|
||||
to store data associated with an arange and have the splay tree value
|
||||
to be a pointer to this struct. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* High-pc of an arange. This is different from the DWARF2 semantics that
|
||||
the high-pc is really the last location in an arange. */
|
||||
bfd_vma high;
|
||||
|
||||
/* We need to store a pointer to the set because splay_tree_value_delete
|
||||
only takes a pointer to the value deleted. If we use a deallocator
|
||||
that need extra information like a pointer to the memory pool, we need to
|
||||
look up via the set pointer. This adds one extra pointer per arange. */
|
||||
arange_set set;
|
||||
|
||||
/* Value associated with this arange. */
|
||||
arange_value_type value;
|
||||
|
||||
} arange_value_container_t;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
arange_set_delete_value (arange_set set, arange_value_type value)
|
||||
{
|
||||
if (set->value_delete_fn)
|
||||
(set->value_delete_fn) (value, set->data);
|
||||
}
|
||||
|
||||
/* Compare two VMAs as keys of splay tree nodes. */
|
||||
|
||||
static int
|
||||
splay_tree_compare_bfd_vmas (splay_tree_key k1, splay_tree_key k2)
|
||||
{
|
||||
if ((bfd_vma) k1 < (bfd_vma) k2)
|
||||
return -1;
|
||||
else if ((bfd_vma) k1 > (bfd_vma) k2)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Default memory allocator and deallocator. */
|
||||
|
||||
void *
|
||||
arange_set_allocate (arange_set set, int size)
|
||||
{
|
||||
if (set->allocate_fn)
|
||||
return (set->allocate_fn) (size, set->data);
|
||||
|
||||
return xmalloc (size);
|
||||
}
|
||||
|
||||
void
|
||||
arange_set_deallocate (arange_set set, void *object)
|
||||
{
|
||||
if (set->deallocate_fn)
|
||||
(set->deallocate_fn) (object, set->data);
|
||||
else
|
||||
free (object);
|
||||
}
|
||||
|
||||
static void
|
||||
arange_set_delete_value_container (splay_tree_value value)
|
||||
{
|
||||
arange_value_container_t *container;
|
||||
|
||||
container = (arange_value_container_t*) value;
|
||||
arange_set_delete_value (container->set, container->value);
|
||||
arange_set_deallocate (container->set, container);
|
||||
}
|
||||
|
||||
/* Create an arange set. Return the new set of NULL if there is any
|
||||
error.
|
||||
|
||||
allocate_fn is the memory allocator function of this arange set. If
|
||||
it is NULL, the default allocator will be used.
|
||||
|
||||
deallocate_fn is the memory deallocator function of this arange set. If
|
||||
it is NULL, the default allocator will be used.
|
||||
|
||||
value_p specifies whether an arange set supports values. If it is
|
||||
TURE. Each arange can be associated with a value of type arange_value_type.
|
||||
If it is FALSE, the following parameters value_equal_fn, value_copy_fn,
|
||||
value_combine_fn and value_delete_fn will be ignored.
|
||||
|
||||
value_equal_fn is the value equality function. An arange uses it to
|
||||
check if two values are the same. If it is NULL, the default bit-wise
|
||||
equality function will be used.
|
||||
|
||||
value_copy_fn is the value copy function. An arange uses it to copy
|
||||
values of type arange_value_type. If it is NULL, the default bit-wise
|
||||
copy function will be used.
|
||||
|
||||
value_combine_fn is the value combine function. An arange uses it to
|
||||
combine values of two identical arange. If it is NULL, the default
|
||||
constant zero function will be used.
|
||||
|
||||
value_delete_fn is the value deletion function. If it is not NULL,
|
||||
it will be called when an arange deletes a value.
|
||||
|
||||
data is pointer to an object, which will be passed to all allocate_fn,
|
||||
deallocate_fn, value_equal_fn, value_copy_fn, value_combine_fn and
|
||||
value_delete_fn. */
|
||||
|
||||
arange_set
|
||||
arange_set_new (arange_set_allocate_fn allocate_fn,
|
||||
arange_set_deallocate_fn deallocate_fn,
|
||||
bfd_boolean value_p,
|
||||
arange_value_equal_fn value_equal_fn,
|
||||
arange_value_copy_fn value_copy_fn,
|
||||
arange_value_combine_fn value_combine_fn,
|
||||
arange_value_delete_fn value_delete_fn,
|
||||
void *data)
|
||||
{
|
||||
arange_set set;
|
||||
splay_tree sp;
|
||||
splay_tree_delete_value_fn fn;
|
||||
|
||||
/* Allocate space for arange structure. */
|
||||
set = (arange_set)
|
||||
(*allocate_fn) (sizeof (struct arange_set_s), data);
|
||||
if (!set)
|
||||
return set;
|
||||
|
||||
fn = value_p ? arange_set_delete_value_container : NULL;
|
||||
sp = splay_tree_new_with_allocator (splay_tree_compare_bfd_vmas, NULL,
|
||||
fn, allocate_fn, deallocate_fn,
|
||||
data);
|
||||
if (!sp)
|
||||
{
|
||||
(deallocate_fn) (set, data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
set->ranges = sp;
|
||||
set->lower_bound = ~0;
|
||||
set->upper_bound = 0;
|
||||
set->value_p = value_p;
|
||||
set->allocate_fn = allocate_fn;
|
||||
set->deallocate_fn = deallocate_fn;
|
||||
set->value_equal_fn = value_equal_fn;
|
||||
set->value_copy_fn = value_copy_fn;
|
||||
set->value_combine_fn = value_combine_fn;
|
||||
set->value_delete_fn = value_delete_fn;
|
||||
set->data = data;
|
||||
return set;
|
||||
}
|
||||
|
||||
/* Delete an arange set. */
|
||||
|
||||
void
|
||||
arange_set_delete (arange_set set)
|
||||
{
|
||||
splay_tree_delete (set->ranges);
|
||||
(*set->deallocate_fn) (set, set->data);
|
||||
}
|
||||
|
||||
/* Return TRUE if and only if arange set is empty. */
|
||||
|
||||
bfd_boolean
|
||||
arange_set_empty_p (arange_set set)
|
||||
{
|
||||
return set->lower_bound > set->upper_bound;
|
||||
}
|
||||
|
||||
/* Accessors for low and high of an arange.
|
||||
|
||||
There is no arange_set_node_set_low since the low address is the
|
||||
key of the splay tree node. */
|
||||
|
||||
/* Get the high VMA address of a node. */
|
||||
|
||||
static bfd_vma
|
||||
arange_set_node_high (arange_set set, splay_tree_node node)
|
||||
{
|
||||
arange_value_container_t *container;
|
||||
|
||||
if (set->value_p)
|
||||
{
|
||||
container = (arange_value_container_t*) node->value;
|
||||
return container->high;
|
||||
}
|
||||
|
||||
return (bfd_vma) node->value;
|
||||
}
|
||||
|
||||
/* Set the high VMA address of a node. */
|
||||
|
||||
static void
|
||||
arange_set_node_set_high (arange_set set, splay_tree_node node, bfd_vma address)
|
||||
{
|
||||
arange_value_container_t *container;
|
||||
|
||||
if (set->value_p)
|
||||
{
|
||||
container = (arange_value_container_t*) node->value;
|
||||
container->high = address;
|
||||
}
|
||||
else
|
||||
node->value = (splay_tree_value) address;
|
||||
}
|
||||
|
||||
/* Get the low VMA address of a node. */
|
||||
|
||||
static bfd_vma
|
||||
arange_set_node_low (splay_tree_node node)
|
||||
{
|
||||
return (bfd_vma) node->key;
|
||||
}
|
||||
|
||||
/* If arange set supports values, return value of an arange; otheriwse
|
||||
always return 0 so that it appears that all aranges have the same value. */
|
||||
|
||||
static arange_value_type
|
||||
arange_set_node_value (arange_set set, splay_tree_node node)
|
||||
{
|
||||
arange_value_container_t *container;
|
||||
|
||||
if (set->value_p)
|
||||
{
|
||||
container = (arange_value_container_t*) node->value;
|
||||
return container->value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If arange set supports values, return value of an arange; otheriwse
|
||||
always return 0 so that it appears that all aranges have the same value. */
|
||||
|
||||
static void
|
||||
arange_set_node_set_value (arange_set set,
|
||||
splay_tree_node node,
|
||||
arange_value_type value)
|
||||
{
|
||||
arange_value_container_t *container;
|
||||
|
||||
if (set->value_p)
|
||||
{
|
||||
container = (arange_value_container_t*) node->value;
|
||||
container->value = value;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return TRUE if and only if arange set supports values. */
|
||||
|
||||
bfd_boolean
|
||||
arange_set_has_values_p (arange_set set)
|
||||
{
|
||||
return set->value_p;
|
||||
}
|
||||
|
||||
/* Copy a value using the value copying function of an arange set. If
|
||||
the set does not support values or if there is not value copying
|
||||
function specified, it simply returns the input value. */
|
||||
|
||||
arange_value_type
|
||||
arange_set_copy_value (arange_set set, arange_value_type value)
|
||||
{
|
||||
/* If no copy function is specified or set does not support values,
|
||||
default is bit-wise copy. */
|
||||
if (set->value_p && set->value_copy_fn)
|
||||
return (set->value_copy_fn) (value, set->data);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static arange_value_type
|
||||
arange_set_combine_value (arange_set set,
|
||||
arange_value_type value1,
|
||||
arange_value_type value2)
|
||||
{
|
||||
/* If no combine function is specified or set does not support values,
|
||||
default is returning 0. */
|
||||
if (set->value_p && set->value_combine_fn)
|
||||
return (set->value_combine_fn) (value1, value2, set->data);
|
||||
|
||||
return (arange_value_type) 0;
|
||||
}
|
||||
|
||||
/* Compares two values for equality. If the arange set does not support values
|
||||
or if no value equality function is specified, this function simply does
|
||||
a bit-wise comparison. */
|
||||
|
||||
bfd_boolean
|
||||
arange_set_value_equal_p (arange_set set,
|
||||
arange_value_type value1,
|
||||
arange_value_type value2)
|
||||
{
|
||||
/* If no equality function is specified or set does not support values,
|
||||
default is bit-wise comparison. */
|
||||
if (set->value_p && set->value_equal_fn)
|
||||
return (set->value_equal_fn) (value1, value2, set->data);
|
||||
|
||||
return value1 == value2;
|
||||
}
|
||||
|
||||
/* Check to see if a given address is in an arange set. Return TRUE if the
|
||||
address is inside one of the aranges. If low_ptr, high_ptr and value_ptr are
|
||||
used to return lower address, upper address and value associated with a
|
||||
found arounge. If anyone of them is NULL, the corresponding information
|
||||
is not returned. For arange set without values, no information is returned
|
||||
through the pointer value_ptr. */
|
||||
|
||||
bfd_boolean
|
||||
arange_set_lookup_address (arange_set set, bfd_vma address,
|
||||
bfd_vma *low_ptr, bfd_vma *high_ptr,
|
||||
arange_value_type *value_ptr)
|
||||
{
|
||||
splay_tree_node pred, node;
|
||||
|
||||
if (address < set->lower_bound || address > set->upper_bound)
|
||||
return FALSE;
|
||||
|
||||
/* Find immediate predecessor. */
|
||||
pred = splay_tree_predecessor (set->ranges, (splay_tree_key) address);
|
||||
if (pred
|
||||
&& arange_set_node_high (set, pred) >= address)
|
||||
node = pred;
|
||||
else
|
||||
/* If the predecessor range does not cover this address, the address
|
||||
is in the arange set only if itself starts an arange. */
|
||||
node = splay_tree_lookup (set->ranges, (splay_tree_key) address);
|
||||
|
||||
if (node)
|
||||
{
|
||||
/* Also return arange boundaries if caller supplies pointers. */
|
||||
if (low_ptr)
|
||||
*low_ptr = arange_set_node_low (node);
|
||||
if (high_ptr)
|
||||
*high_ptr = arange_set_node_high (set, node);
|
||||
if (set->value_p && value_ptr)
|
||||
*value_ptr = arange_set_node_value (set, node);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Insert an arange [low, high] into a set's splay tree. If the set supports
|
||||
value, also insert with the given value. Return the inserted node if there
|
||||
is no error or NULL otherwise. */
|
||||
|
||||
static splay_tree_node
|
||||
arange_set_splay_tree_insert (arange_set set,
|
||||
bfd_vma low,
|
||||
bfd_vma high,
|
||||
arange_value_type value)
|
||||
{
|
||||
splay_tree_value sp_value;
|
||||
arange_value_container_t *container;
|
||||
|
||||
if (set->value_p)
|
||||
{
|
||||
int size = sizeof (arange_value_container_t);
|
||||
void *data = set->ranges->allocate_data;
|
||||
|
||||
container =
|
||||
(arange_value_container_t*) (*set->ranges->allocate) (size, data);
|
||||
if (!container)
|
||||
return NULL;
|
||||
container->high = high;
|
||||
|
||||
/* Due to the design of splay tree API, there is no way of passing
|
||||
callback data to the splay tree value delete function. Hence we need
|
||||
to store a pointer to set in every containier! */
|
||||
container->set = set;
|
||||
|
||||
container->value = value;
|
||||
sp_value = (splay_tree_value) container;
|
||||
}
|
||||
else
|
||||
sp_value = (splay_tree_value) high;
|
||||
|
||||
/* Currently splay_tree_insert does not return any status to tell if there
|
||||
is an error. */
|
||||
return splay_tree_insert (set->ranges, (splay_tree_key) low, sp_value);
|
||||
}
|
||||
|
||||
/* Split [low, high] to [low, address) & [address, high]. */
|
||||
|
||||
static bfd_boolean
|
||||
arange_set_split_node (arange_set set, splay_tree_node node, bfd_vma address)
|
||||
{
|
||||
splay_tree_node node2;
|
||||
arange_value_type value;
|
||||
bfd_vma low, high;
|
||||
|
||||
low = arange_set_node_low (node);
|
||||
high = arange_set_node_high (set, node);
|
||||
|
||||
BFD_ASSERT (low < address && address <= high);
|
||||
|
||||
value = arange_set_copy_value (set, arange_set_node_value (set, node));
|
||||
node2 = arange_set_splay_tree_insert (set, address, high, value);
|
||||
if (!node2)
|
||||
return FALSE;
|
||||
|
||||
arange_set_node_set_high (set, node, address - 1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static splay_tree_node
|
||||
arange_set_maybe_merge_with_predecessor (arange_set set, splay_tree_node node)
|
||||
{
|
||||
splay_tree_node pred;
|
||||
bfd_vma low, high;
|
||||
|
||||
low = arange_set_node_low (node);
|
||||
high = arange_set_node_high (set, node);
|
||||
|
||||
pred = splay_tree_predecessor (set->ranges, low);
|
||||
if (! pred)
|
||||
return node;
|
||||
|
||||
if (arange_set_node_high (set, pred) + 1 == low
|
||||
&& arange_set_value_equal_p (set,
|
||||
arange_set_node_value (set, pred),
|
||||
arange_set_node_value (set, node)))
|
||||
{
|
||||
splay_tree_remove (set->ranges, arange_set_node_low (node));
|
||||
arange_set_node_set_high (set, pred, high);
|
||||
return arange_set_maybe_merge_with_predecessor (set, pred);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Insert an arange [low,high] into a set. Return TRUE if and only if there
|
||||
is no error. Note that the address high is also included where as in
|
||||
DWARF2 an address range between low & high means [low,high).
|
||||
|
||||
This only handles sets with values. For the simpler case of sets without
|
||||
value, it is handled in arange_set_insert(). This function is
|
||||
tail-recurive. It is guaranteed to terminate because it only recurses
|
||||
with a smaller range than it is given. */
|
||||
|
||||
static bfd_boolean
|
||||
arange_set_insert_value (arange_set set,
|
||||
bfd_vma low,
|
||||
bfd_vma high,
|
||||
arange_value_type value)
|
||||
{
|
||||
splay_tree_node succ, pred, node;
|
||||
bfd_vma succ_high, succ_low;
|
||||
arange_value_type combined, old_value;
|
||||
|
||||
if (low > high)
|
||||
{
|
||||
arange_set_delete_value (set, value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pred = splay_tree_predecessor (set->ranges, low);
|
||||
if (pred && arange_set_node_high (set, pred) >= low)
|
||||
arange_set_split_node (set, pred, low);
|
||||
|
||||
node = splay_tree_lookup (set->ranges, low);
|
||||
if (node)
|
||||
{
|
||||
/* Split node if its arange is larger than inserted arange. */
|
||||
if (arange_set_node_high (set, node) > high)
|
||||
arange_set_split_node (set, node, high + 1);
|
||||
|
||||
old_value = arange_set_node_value (set, node);
|
||||
combined = arange_set_combine_value (set, old_value, value);
|
||||
arange_set_node_set_value (set, node, combined);
|
||||
node = arange_set_maybe_merge_with_predecessor (set, node);
|
||||
arange_set_delete_value (set, old_value);
|
||||
|
||||
/* Insert remaining arange by tail-recursion. */
|
||||
if (high > arange_set_node_high (set, node))
|
||||
return arange_set_insert_value (set,
|
||||
arange_set_node_high (set, node) + 1,
|
||||
high, value);
|
||||
else
|
||||
{
|
||||
/* Node must cover exactly the range. */
|
||||
BFD_ASSERT (high == arange_set_node_high (set, node));
|
||||
arange_set_delete_value (set, value);
|
||||
succ = splay_tree_successor (set->ranges, arange_set_node_low (node));
|
||||
if (succ)
|
||||
succ = arange_set_maybe_merge_with_predecessor (set, succ);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
succ = splay_tree_successor (set->ranges, low);
|
||||
if (succ)
|
||||
{
|
||||
succ_low = arange_set_node_low (succ);
|
||||
succ_high = arange_set_node_high (set, succ);
|
||||
|
||||
if (succ_low <= high)
|
||||
{
|
||||
node = arange_set_splay_tree_insert (set, low, succ_low - 1, value);
|
||||
if (!node)
|
||||
return FALSE;
|
||||
|
||||
/* Update set lower bound only after insertion is successful. */
|
||||
if (low < set->lower_bound)
|
||||
set->lower_bound = low;
|
||||
|
||||
node = arange_set_maybe_merge_with_predecessor (set, node);
|
||||
|
||||
/* Recurse to handle rest of insertion. Note that we have to copy
|
||||
value here since it has already been used in the node above. */
|
||||
return arange_set_insert_value (set, succ_low, high,
|
||||
arange_set_copy_value (set, value));
|
||||
}
|
||||
}
|
||||
|
||||
node = arange_set_splay_tree_insert (set, low, high, value);
|
||||
if (!node)
|
||||
return FALSE;
|
||||
|
||||
/* Update set boundaries only after insertion is successful. */
|
||||
if (low < set->lower_bound)
|
||||
set->lower_bound = low;
|
||||
if (high > set->upper_bound)
|
||||
set->upper_bound = high;
|
||||
|
||||
node = arange_set_maybe_merge_with_predecessor (set, node);
|
||||
|
||||
succ = splay_tree_successor (set->ranges, arange_set_node_low (node));
|
||||
if (succ)
|
||||
succ = arange_set_maybe_merge_with_predecessor (set, succ);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bfd_boolean
|
||||
arange_set_insert (arange_set set,
|
||||
bfd_vma low,
|
||||
bfd_vma high,
|
||||
arange_value_type value)
|
||||
{
|
||||
splay_tree tree = set->ranges;
|
||||
splay_tree_node pred, succ, node = NULL;
|
||||
bfd_vma pred_high, node_low;
|
||||
|
||||
if (set->value_p)
|
||||
return arange_set_insert_value (set, low, high, value);
|
||||
|
||||
if (low > high)
|
||||
return FALSE;
|
||||
|
||||
pred = splay_tree_predecessor (tree, low);
|
||||
if (pred)
|
||||
{
|
||||
pred_high = arange_set_node_high (set, pred);
|
||||
|
||||
/* Nothing to be done if predecessor contains new aranges. */
|
||||
if (pred_high >= high)
|
||||
return TRUE;
|
||||
|
||||
/* If we can expand predecessor, do so. Test for the case in which
|
||||
predecessor does not contain new arange but touches it. */
|
||||
if (pred_high >= low || pred_high + 1 == low)
|
||||
{
|
||||
node = pred;
|
||||
arange_set_node_set_high (set, node, high);
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to see if [low,something] is already in splay tree. */
|
||||
if (node == NULL)
|
||||
{
|
||||
node = splay_tree_lookup (tree, low);
|
||||
if (node)
|
||||
{
|
||||
/* Nothing to be done if node contains new aranges. */
|
||||
if (arange_set_node_high (set, node) >= high)
|
||||
return TRUE;
|
||||
|
||||
arange_set_node_set_high (set, node, high);
|
||||
}
|
||||
}
|
||||
|
||||
if (node == NULL)
|
||||
{
|
||||
node = arange_set_splay_tree_insert (set, low, high, 0);
|
||||
if (!node)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BFD_ASSERT (node
|
||||
&& arange_set_node_low (node) <= low
|
||||
&& arange_set_node_high (set, node) >= high);
|
||||
|
||||
/* Update set upper and lower bounds. */
|
||||
if (low < set->lower_bound)
|
||||
set->lower_bound = low;
|
||||
if (high > set->upper_bound)
|
||||
set->upper_bound = high;
|
||||
|
||||
/* Merge successor if it overlaps or touches node. */
|
||||
node_low = arange_set_node_low (node);
|
||||
while ((succ = splay_tree_successor (tree, node_low)) != NULL
|
||||
&& ((arange_set_node_high (set, node) >= arange_set_node_low (succ))
|
||||
|| (arange_set_node_high (set, node) + 1
|
||||
== arange_set_node_low (succ))))
|
||||
{
|
||||
if (arange_set_node_high (set, succ) > high)
|
||||
arange_set_node_set_high (set, node, arange_set_node_high (set, succ));
|
||||
splay_tree_remove (tree, arange_set_node_low (succ));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
struct arange_set_foreach_adapter_data
|
||||
{
|
||||
void *data;
|
||||
arange_set set;
|
||||
arange_set_foreach_fn foreach_fn;
|
||||
};
|
||||
|
||||
/* Adaptor to make arange_set_foreach works with splay_tree_foreach. */
|
||||
|
||||
static int
|
||||
arange_set_foreach_adapter (splay_tree_node node, void *data)
|
||||
{
|
||||
struct arange_set_foreach_adapter_data *adapter_data;
|
||||
arange_set set;
|
||||
|
||||
adapter_data = data;
|
||||
set = adapter_data->set;
|
||||
return (adapter_data->foreach_fn) (arange_set_node_low (node),
|
||||
arange_set_node_high (set, node),
|
||||
arange_set_node_value (set, node),
|
||||
adapter_data->data);
|
||||
}
|
||||
|
||||
/* Traverse aranges in a set. For each arange in ascending order of
|
||||
low addresses, call foreach_fn with arange boundaries and data.
|
||||
If any invocation of foreach_fn returns a non-zero value, stop traversal
|
||||
and return that value. Otherwise, return 0. */
|
||||
|
||||
int
|
||||
arange_set_foreach (arange_set set,
|
||||
arange_set_foreach_fn foreach_fn,
|
||||
void *data)
|
||||
{
|
||||
struct arange_set_foreach_adapter_data adapter_data;
|
||||
|
||||
adapter_data.data = data;
|
||||
adapter_data.foreach_fn = foreach_fn;
|
||||
adapter_data.set = set;
|
||||
return splay_tree_foreach (set->ranges, arange_set_foreach_adapter,
|
||||
(void *) &adapter_data);
|
||||
}
|
||||
187
bfd/arange-set.h
Normal file
187
bfd/arange-set.h
Normal file
@@ -0,0 +1,187 @@
|
||||
/* DWARF 2 Arange-Set.
|
||||
Copyright 2007 Free Software Foundation, Inc.
|
||||
Contributed by Doug Kwan, Google Inc.
|
||||
|
||||
This file is part of BFD.
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* Scalable DWARF2 Arange Set.
|
||||
|
||||
The original code in dwarf2.c uses an unsorted singly-linked list to
|
||||
represent aranges in a compilation unit. Looking up for an address
|
||||
became very in-efficient for extremely large binaries with many
|
||||
compilation units, each of which having long list of aranges.
|
||||
|
||||
The arange-set implemented here supports insertion and address
|
||||
containment queries for an arbitrary large collection of aranges in
|
||||
an efficient manner. In addition, it also supports aranges with
|
||||
values.
|
||||
|
||||
Arange insertion with value.
|
||||
|
||||
For valued arange-set, we need to specify 4 operations during set
|
||||
creation. If unspecified, reasonable default behaviours are assumed.
|
||||
The operations define how arange insertion merges two identical aranges
|
||||
with different values. The 4 operations are:
|
||||
|
||||
Equality
|
||||
Copy
|
||||
Combination
|
||||
Deletion
|
||||
|
||||
When arange_set_insert () inserts an arange. It breaks the to-be-inserted
|
||||
arange into smaller aranges using the boundaries of any overlapping
|
||||
aranges as cutting point. In addition, arange_set_insert () may also
|
||||
splilt any existing arange that overlap the ends of the to-be-inserted
|
||||
arange. After such splitting of the new and existing aranges, the
|
||||
to-be-inserted arange becomes a collection of smaller aranges, each of
|
||||
which either does not overlapping with any existing arange or overlapping
|
||||
completely with one existing arange. While splitting aranges, values
|
||||
are copied using the Copy operation specified in the set.
|
||||
|
||||
The for each smaller new arange, arange_set_insert () inserts the new
|
||||
arange according to these rules:
|
||||
|
||||
1. If there is no overlapping existing arange, insert new arange.
|
||||
|
||||
2. If there is an overlapping existing arange and its value equals
|
||||
to the inserted value according to the value equality operation
|
||||
of the set, do nothing.
|
||||
|
||||
3. If there is an overlapping existing arange and its value is not
|
||||
the inserted value according to the value equality operation,
|
||||
combine the inserted value with that of the existing arange using
|
||||
the value combination operation of set.
|
||||
|
||||
If as a result of insertion, there are adjacent aranges with equal values,
|
||||
the adjacent aranges will be merge. */
|
||||
|
||||
#ifndef ARANGE_SET_H
|
||||
#define ARANGE_SET_H
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
/* An arange_set is a pointer to an arange_set_s struct, whose implementation
|
||||
is opaque to clients using the arange set. */
|
||||
typedef struct arange_set_s *arange_set;
|
||||
|
||||
#ifndef _WIN64
|
||||
typedef unsigned long int arange_set_uhostptr_t;
|
||||
#else
|
||||
typedef unsigned long long arange_set_uhostptr_t;
|
||||
#endif
|
||||
|
||||
/* Type of value attached to an arange. This should be wide enough to be
|
||||
converted from and back to any type without loss. */
|
||||
typedef arange_set_uhostptr_t arange_value_type;
|
||||
|
||||
/* Type of function that is used to allocate memory for an arange-set. */
|
||||
typedef void* (*arange_set_allocate_fn)(int, void*);
|
||||
|
||||
/* Type of function that is used to deallocate memory of an arange-set. */
|
||||
typedef void (*arange_set_deallocate_fn)(void*, void*);
|
||||
|
||||
/* Type of function that is called for each arange during a traversal of
|
||||
the set containing that arange. */
|
||||
typedef int (*arange_set_foreach_fn)(bfd_vma, bfd_vma, arange_value_type,
|
||||
void *);
|
||||
|
||||
/* Type of function that is called to test equality of range values. */
|
||||
typedef bfd_boolean (*arange_value_equal_fn)(arange_value_type,
|
||||
arange_value_type, void *);
|
||||
|
||||
/* Type of function that is called to copy a range value. */
|
||||
typedef arange_value_type (*arange_value_copy_fn)(arange_value_type, void *);
|
||||
|
||||
/* Type of function that is called to combine two range values. */
|
||||
typedef arange_value_type (*arange_value_combine_fn)(arange_value_type,
|
||||
arange_value_type,
|
||||
void *);
|
||||
|
||||
/* Type of function that is called to delete a range value. */
|
||||
typedef void (*arange_value_delete_fn)(arange_value_type, void *);
|
||||
|
||||
/* Create an arange set. Return the new set of NULL if there is any
|
||||
error. */
|
||||
extern arange_set arange_set_new (arange_set_allocate_fn,
|
||||
arange_set_deallocate_fn,
|
||||
bfd_boolean,
|
||||
arange_value_equal_fn,
|
||||
arange_value_copy_fn,
|
||||
arange_value_combine_fn,
|
||||
arange_value_delete_fn,
|
||||
void *);
|
||||
|
||||
/* Delete an arange set. */
|
||||
extern void arange_set_delete (arange_set);
|
||||
|
||||
/* Return TRUE if an only if arange set is empty. */
|
||||
extern bfd_boolean arange_set_empty_p (arange_set);
|
||||
|
||||
/* Check to see if a given address is in an arange set. Return TRUE if the
|
||||
address is inside one of the aranges and if also low_ptr and high_ptr are
|
||||
not NULL, return the boundaries of the arange.
|
||||
|
||||
If the address is not in any arange in set, return FALSE. */
|
||||
extern bfd_boolean arange_set_lookup_address (arange_set, bfd_vma, bfd_vma *,
|
||||
bfd_vma *, arange_value_type *);
|
||||
|
||||
/* Insert an arange [low,high] into a set. Note that the address high is
|
||||
also included where as in DWARF2 an address range between low & high means
|
||||
[low,high).
|
||||
|
||||
If the set is created with no capability of storing values, the value
|
||||
argument is ignored. Otherwise, the value is stored in the inserted range.
|
||||
If there are overlapping ranges, values are combined according to
|
||||
value_combine_fn.
|
||||
|
||||
If value is an object, arange_set_insert () takes ownership of that objec.
|
||||
Caller should not deallocate objects that are passed to arange_set_insert().
|
||||
|
||||
Return TRUE if and only if there is no error. */
|
||||
extern bfd_boolean arange_set_insert (arange_set, bfd_vma, bfd_vma,
|
||||
arange_value_type);
|
||||
|
||||
/* Return TRUE if and only if arange set supports arang evalues. */
|
||||
extern bfd_boolean arange_set_has_values_p (arange_set);
|
||||
|
||||
/* Traverse aranges in a set. For each arange in ascending order of
|
||||
low addresses, call foreach_fn with arange boundaries and data.
|
||||
If any invocation of foreach_fn returns a non-zero value, stop traversal
|
||||
and return that value. Otherwise, return 0. */
|
||||
extern int arange_set_foreach (arange_set, arange_set_foreach_fn, void *);
|
||||
|
||||
/* Return TRUE if two values are considered equal by the value comparison
|
||||
function of an arange_set. If the arange set does not support values or
|
||||
if it has no value equality function specified, this function performs
|
||||
a bit-wise comparison of its input. */
|
||||
extern bfd_boolean arange_set_value_equal_p (arange_set, arange_value_type,
|
||||
arange_value_type);
|
||||
|
||||
/* Duplicate a value. If the arange set does not support values or if it
|
||||
has no value copying function specified, this function returns the input
|
||||
value. */
|
||||
extern arange_value_type arange_set_copy_value (arange_set, arange_value_type);
|
||||
|
||||
/* Allocate memory using the allocator of an arange set. */
|
||||
extern void * arange_set_allocate (arange_set, int);
|
||||
|
||||
/* Deallocate memory allocated from arange_set_allocate (). */
|
||||
extern void arange_set_deallocate (arange_set, void *);
|
||||
|
||||
#endif /* ARANGE_SET_H */
|
||||
28
bfd/cf-m68klynx.c
Normal file
28
bfd/cf-m68klynx.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* BFD back-end for Motorola M68K COFF LynxOS files.
|
||||
Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#define TARGET_SYM m68klynx_coff_vec
|
||||
#define TARGET_NAME "coff-m68k-lynx"
|
||||
#define LYNXOS
|
||||
#define COFF_LONG_FILENAMES
|
||||
#define STATIC_RELOCS
|
||||
#define COFF_COMMON_ADDEND
|
||||
|
||||
#include "coff-m68k.c"
|
||||
584
bfd/coff-a29k.c
Normal file
584
bfd/coff-a29k.c
Normal file
@@ -0,0 +1,584 @@
|
||||
/* BFD back-end for AMD 29000 COFF binaries.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
|
||||
2002, 2003, 2004
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by David Wood at New York University 7/8/91.
|
||||
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#define A29K 1
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/a29k.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
static long get_symbol_value PARAMS ((asymbol *));
|
||||
static bfd_reloc_status_type a29k_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static bfd_boolean coff_a29k_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
struct internal_reloc *, struct internal_syment *, asection **));
|
||||
static bfd_boolean coff_a29k_adjust_symndx
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
|
||||
struct internal_reloc *, bfd_boolean *));
|
||||
static void reloc_processing
|
||||
PARAMS ((arelent *, struct internal_reloc *, asymbol **, bfd *, asection *));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
|
||||
#define INSERT_HWORD(WORD,HWORD) \
|
||||
(((WORD) & 0xff00ff00) | (((HWORD) & 0xff00) << 8) | ((HWORD)& 0xff))
|
||||
#define EXTRACT_HWORD(WORD) \
|
||||
((((WORD) & 0x00ff0000) >> 8) | ((WORD) & 0xff))
|
||||
#define SIGN_EXTEND_HWORD(HWORD) \
|
||||
(((HWORD) ^ 0x8000) - 0x8000)
|
||||
|
||||
/* Provided the symbol, returns the value reffed. */
|
||||
|
||||
static long
|
||||
get_symbol_value (symbol)
|
||||
asymbol *symbol;
|
||||
{
|
||||
long relocation = 0;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
relocation = 0;
|
||||
else
|
||||
relocation = symbol->value +
|
||||
symbol->section->output_section->vma +
|
||||
symbol->section->output_offset;
|
||||
|
||||
return relocation;
|
||||
}
|
||||
|
||||
/* This function is in charge of performing all the 29k relocations. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
a29k_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* The consth relocation comes in two parts, we have to remember
|
||||
the state between calls, in these variables. */
|
||||
static bfd_boolean part1_consth_active = FALSE;
|
||||
static unsigned long part1_consth_value;
|
||||
unsigned long insn;
|
||||
unsigned long sym_value;
|
||||
unsigned long unsigned_value;
|
||||
unsigned short r_type;
|
||||
long signed_value;
|
||||
unsigned long addr = reloc_entry->address ; /*+ input_section->vma*/
|
||||
bfd_byte *hit_data =addr + (bfd_byte *) (data);
|
||||
|
||||
r_type = reloc_entry->howto->type;
|
||||
|
||||
if (output_bfd)
|
||||
{
|
||||
/* Partial linking - do nothing. */
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
if (symbol_in != NULL
|
||||
&& bfd_is_und_section (symbol_in->section))
|
||||
{
|
||||
/* Keep the state machine happy in case we're called again. */
|
||||
if (r_type == R_IHIHALF)
|
||||
{
|
||||
part1_consth_active = TRUE;
|
||||
part1_consth_value = 0;
|
||||
}
|
||||
return bfd_reloc_undefined;
|
||||
}
|
||||
|
||||
if ((part1_consth_active) && (r_type != R_IHCONST))
|
||||
{
|
||||
part1_consth_active = FALSE;
|
||||
*error_message = (char *) _("Missing IHCONST");
|
||||
|
||||
return bfd_reloc_dangerous;
|
||||
}
|
||||
|
||||
sym_value = get_symbol_value(symbol_in);
|
||||
|
||||
switch (r_type)
|
||||
{
|
||||
case R_IREL:
|
||||
insn = bfd_get_32 (abfd, hit_data);
|
||||
/* Take the value in the field and sign extend it. */
|
||||
signed_value = EXTRACT_HWORD(insn);
|
||||
signed_value = SIGN_EXTEND_HWORD(signed_value);
|
||||
signed_value <<= 2;
|
||||
|
||||
/* See the note on the R_IREL reloc in coff_a29k_relocate_section. */
|
||||
if (signed_value == - (long) reloc_entry->address)
|
||||
signed_value = 0;
|
||||
|
||||
signed_value += sym_value + reloc_entry->addend;
|
||||
if ((signed_value & ~0x3ffff) == 0)
|
||||
{ /* Absolute jmp/call */
|
||||
insn |= (1 << 24); /* Make it absolute */
|
||||
/* FIXME: Should we change r_type to R_IABS. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Relative jmp/call, so subtract from the value the
|
||||
address of the place we're coming from. */
|
||||
signed_value -= (reloc_entry->address
|
||||
+ input_section->output_section->vma
|
||||
+ input_section->output_offset);
|
||||
if (signed_value > 0x1ffff || signed_value < -0x20000)
|
||||
return bfd_reloc_overflow;
|
||||
}
|
||||
signed_value >>= 2;
|
||||
insn = INSERT_HWORD (insn, signed_value);
|
||||
bfd_put_32 (abfd, (bfd_vma) insn ,hit_data);
|
||||
break;
|
||||
case R_ILOHALF:
|
||||
insn = bfd_get_32 (abfd, hit_data);
|
||||
unsigned_value = EXTRACT_HWORD(insn);
|
||||
unsigned_value += sym_value + reloc_entry->addend;
|
||||
insn = INSERT_HWORD(insn, unsigned_value);
|
||||
bfd_put_32 (abfd, (bfd_vma) insn, hit_data);
|
||||
break;
|
||||
case R_IHIHALF:
|
||||
insn = bfd_get_32 (abfd, hit_data);
|
||||
/* consth, part 1
|
||||
Just get the symbol value that is referenced. */
|
||||
part1_consth_active = TRUE;
|
||||
part1_consth_value = sym_value + reloc_entry->addend;
|
||||
/* Don't modify insn until R_IHCONST. */
|
||||
break;
|
||||
case R_IHCONST:
|
||||
insn = bfd_get_32 (abfd, hit_data);
|
||||
/* consth, part 2
|
||||
Now relocate the reference. */
|
||||
if (! part1_consth_active)
|
||||
{
|
||||
*error_message = (char *) _("Missing IHIHALF");
|
||||
return bfd_reloc_dangerous;
|
||||
}
|
||||
/* sym_ptr_ptr = r_symndx, in coff_slurp_reloc_table() */
|
||||
unsigned_value = 0; /*EXTRACT_HWORD(insn) << 16;*/
|
||||
unsigned_value += reloc_entry->addend; /* r_symndx */
|
||||
unsigned_value += part1_consth_value;
|
||||
unsigned_value = unsigned_value >> 16;
|
||||
insn = INSERT_HWORD(insn, unsigned_value);
|
||||
part1_consth_active = FALSE;
|
||||
bfd_put_32 (abfd, (bfd_vma) insn, hit_data);
|
||||
break;
|
||||
case R_BYTE:
|
||||
insn = bfd_get_8 (abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
if (unsigned_value & 0xffffff00)
|
||||
return bfd_reloc_overflow;
|
||||
bfd_put_8 (abfd, unsigned_value, hit_data);
|
||||
break;
|
||||
case R_HWORD:
|
||||
insn = bfd_get_16 (abfd, hit_data);
|
||||
unsigned_value = insn + sym_value + reloc_entry->addend;
|
||||
if (unsigned_value & 0xffff0000)
|
||||
return bfd_reloc_overflow;
|
||||
bfd_put_16 (abfd, (bfd_vma) insn, hit_data);
|
||||
break;
|
||||
case R_WORD:
|
||||
insn = bfd_get_32 (abfd, hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
bfd_put_32 (abfd, (bfd_vma) insn, hit_data);
|
||||
break;
|
||||
default:
|
||||
*error_message = _("Unrecognized reloc");
|
||||
return bfd_reloc_dangerous;
|
||||
}
|
||||
|
||||
return(bfd_reloc_ok);
|
||||
}
|
||||
|
||||
/*FIXME: I'm not real sure about this table. */
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
{R_ABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield,a29k_reloc,"ABS", TRUE, 0xffffffff,0xffffffff, FALSE},
|
||||
EMPTY_HOWTO (1),
|
||||
EMPTY_HOWTO (2),
|
||||
EMPTY_HOWTO (3),
|
||||
EMPTY_HOWTO (4),
|
||||
EMPTY_HOWTO (5),
|
||||
EMPTY_HOWTO (6),
|
||||
EMPTY_HOWTO (7),
|
||||
EMPTY_HOWTO (8),
|
||||
EMPTY_HOWTO (9),
|
||||
EMPTY_HOWTO (10),
|
||||
EMPTY_HOWTO (11),
|
||||
EMPTY_HOWTO (12),
|
||||
EMPTY_HOWTO (13),
|
||||
EMPTY_HOWTO (14),
|
||||
EMPTY_HOWTO (15),
|
||||
EMPTY_HOWTO (16),
|
||||
EMPTY_HOWTO (17),
|
||||
EMPTY_HOWTO (18),
|
||||
EMPTY_HOWTO (19),
|
||||
EMPTY_HOWTO (20),
|
||||
EMPTY_HOWTO (21),
|
||||
EMPTY_HOWTO (22),
|
||||
EMPTY_HOWTO (23),
|
||||
{R_IREL, 0, 3, 32, TRUE, 0, complain_overflow_signed,a29k_reloc,"IREL", TRUE, 0xffffffff,0xffffffff, FALSE},
|
||||
{R_IABS, 0, 3, 32, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"IABS", TRUE, 0xffffffff,0xffffffff, FALSE},
|
||||
{R_ILOHALF, 0, 3, 16, TRUE, 0, complain_overflow_signed, a29k_reloc,"ILOHALF", TRUE, 0x0000ffff,0x0000ffff, FALSE},
|
||||
{R_IHIHALF, 0, 3, 16, TRUE, 16, complain_overflow_signed, a29k_reloc,"IHIHALF", TRUE, 0xffff0000,0xffff0000, FALSE},
|
||||
{R_IHCONST, 0, 3, 16, TRUE, 0, complain_overflow_signed, a29k_reloc,"IHCONST", TRUE, 0xffff0000,0xffff0000, FALSE},
|
||||
{R_BYTE, 0, 0, 8, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"BYTE", TRUE, 0x000000ff,0x000000ff, FALSE},
|
||||
{R_HWORD, 0, 1, 16, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"HWORD", TRUE, 0x0000ffff,0x0000ffff, FALSE},
|
||||
{R_WORD, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, a29k_reloc,"WORD", TRUE, 0xffffffff,0xffffffff, FALSE},
|
||||
};
|
||||
|
||||
#define BADMAG(x) A29KBADMAG(x)
|
||||
|
||||
#define RELOC_PROCESSING(relent, reloc, symbols, abfd, section) \
|
||||
reloc_processing(relent, reloc, symbols, abfd, section)
|
||||
|
||||
static void
|
||||
reloc_processing (relent,reloc, symbols, abfd, section)
|
||||
arelent *relent;
|
||||
struct internal_reloc *reloc;
|
||||
asymbol **symbols;
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
{
|
||||
static bfd_vma ihihalf_vaddr = (bfd_vma) -1;
|
||||
|
||||
relent->address = reloc->r_vaddr;
|
||||
relent->howto = howto_table + reloc->r_type;
|
||||
if (reloc->r_type == R_IHCONST)
|
||||
{
|
||||
/* The address of an R_IHCONST should always be the address of
|
||||
the immediately preceding R_IHIHALF. relocs generated by gas
|
||||
are correct, but relocs generated by High C are different (I
|
||||
can't figure out what the address means for High C). We can
|
||||
handle both gas and High C by ignoring the address here, and
|
||||
simply reusing the address saved for R_IHIHALF. */
|
||||
if (ihihalf_vaddr == (bfd_vma) -1)
|
||||
abort ();
|
||||
relent->address = ihihalf_vaddr;
|
||||
ihihalf_vaddr = (bfd_vma) -1;
|
||||
relent->addend = reloc->r_symndx;
|
||||
relent->sym_ptr_ptr= bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
asymbol *ptr;
|
||||
|
||||
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
|
||||
|
||||
ptr = *(relent->sym_ptr_ptr);
|
||||
|
||||
if (ptr
|
||||
&& bfd_asymbol_bfd(ptr) == abfd
|
||||
&& ((ptr->flags & BSF_OLD_COMMON) == 0))
|
||||
relent->addend = 0;
|
||||
else
|
||||
relent->addend = 0;
|
||||
|
||||
relent->address-= section->vma;
|
||||
if (reloc->r_type == R_IHIHALF)
|
||||
ihihalf_vaddr = relent->address;
|
||||
else if (ihihalf_vaddr != (bfd_vma) -1)
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* The reloc processing routine for the optimized COFF linker. */
|
||||
|
||||
static bfd_boolean
|
||||
coff_a29k_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
contents, relocs, syms, sections)
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
struct bfd_link_info *info;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
bfd_byte *contents;
|
||||
struct internal_reloc *relocs;
|
||||
struct internal_syment *syms;
|
||||
asection **sections;
|
||||
{
|
||||
struct internal_reloc *rel;
|
||||
struct internal_reloc *relend;
|
||||
bfd_boolean hihalf;
|
||||
bfd_vma hihalf_val;
|
||||
|
||||
/* If we are performing a relocatable link, we don't need to do a
|
||||
thing. The caller will take care of adjusting the reloc
|
||||
addresses and symbol indices. */
|
||||
if (info->relocatable)
|
||||
return TRUE;
|
||||
|
||||
hihalf = FALSE;
|
||||
hihalf_val = 0;
|
||||
|
||||
rel = relocs;
|
||||
relend = rel + input_section->reloc_count;
|
||||
for (; rel < relend; rel++)
|
||||
{
|
||||
long symndx;
|
||||
bfd_byte *loc;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
asection *sec;
|
||||
bfd_vma val;
|
||||
bfd_boolean overflow;
|
||||
unsigned long insn;
|
||||
long signed_value;
|
||||
unsigned long unsigned_value;
|
||||
bfd_reloc_status_type rstat;
|
||||
|
||||
symndx = rel->r_symndx;
|
||||
loc = contents + rel->r_vaddr - input_section->vma;
|
||||
|
||||
if (symndx == -1 || rel->r_type == R_IHCONST)
|
||||
h = NULL;
|
||||
else
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
|
||||
sym = NULL;
|
||||
sec = NULL;
|
||||
val = 0;
|
||||
|
||||
/* An R_IHCONST reloc does not have a symbol. Instead, the
|
||||
symbol index is an addend. R_IHCONST is always used in
|
||||
conjunction with R_IHHALF. */
|
||||
if (rel->r_type != R_IHCONST)
|
||||
{
|
||||
if (h == NULL)
|
||||
{
|
||||
if (symndx == -1)
|
||||
sec = bfd_abs_section_ptr;
|
||||
else
|
||||
{
|
||||
sym = syms + symndx;
|
||||
sec = sections[symndx];
|
||||
val = (sec->output_section->vma
|
||||
+ sec->output_offset
|
||||
+ sym->n_value
|
||||
- sec->vma);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
sec = h->root.u.def.section;
|
||||
val = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma, TRUE)))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (hihalf)
|
||||
{
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info, _("missing IHCONST reloc"), input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return FALSE;
|
||||
hihalf = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
overflow = FALSE;
|
||||
|
||||
switch (rel->r_type)
|
||||
{
|
||||
default:
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
|
||||
case R_IREL:
|
||||
insn = bfd_get_32 (input_bfd, loc);
|
||||
|
||||
/* Extract the addend. */
|
||||
signed_value = EXTRACT_HWORD (insn);
|
||||
signed_value = SIGN_EXTEND_HWORD (signed_value);
|
||||
signed_value <<= 2;
|
||||
|
||||
/* Unfortunately, there are two different versions of COFF
|
||||
a29k. In the original AMD version, the value stored in
|
||||
the field for the R_IREL reloc is a simple addend. In
|
||||
the GNU version, the value is the negative of the address
|
||||
of the reloc within section. We try to cope here by
|
||||
assuming the AMD version, unless the addend is exactly
|
||||
the negative of the address; in the latter case we assume
|
||||
the GNU version. This means that something like
|
||||
.text
|
||||
nop
|
||||
jmp i-4
|
||||
will fail, because the addend of -4 will happen to equal
|
||||
the negative of the address within the section. The
|
||||
compiler will never generate code like this.
|
||||
|
||||
At some point in the future we may want to take out this
|
||||
check. */
|
||||
|
||||
if (signed_value == - (long) (rel->r_vaddr - input_section->vma))
|
||||
signed_value = 0;
|
||||
|
||||
/* Determine the destination of the jump. */
|
||||
signed_value += val;
|
||||
|
||||
if ((signed_value & ~0x3ffff) == 0)
|
||||
{
|
||||
/* We can use an absolute jump. */
|
||||
insn |= (1 << 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make the destination PC relative. */
|
||||
signed_value -= (input_section->output_section->vma
|
||||
+ input_section->output_offset
|
||||
+ (rel->r_vaddr - input_section->vma));
|
||||
if (signed_value > 0x1ffff || signed_value < - 0x20000)
|
||||
{
|
||||
overflow = TRUE;
|
||||
signed_value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put the adjusted value back into the instruction. */
|
||||
signed_value >>= 2;
|
||||
insn = INSERT_HWORD (insn, signed_value);
|
||||
|
||||
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||
break;
|
||||
|
||||
case R_ILOHALF:
|
||||
insn = bfd_get_32 (input_bfd, loc);
|
||||
unsigned_value = EXTRACT_HWORD (insn);
|
||||
unsigned_value += val;
|
||||
insn = INSERT_HWORD (insn, unsigned_value);
|
||||
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||
break;
|
||||
|
||||
case R_IHIHALF:
|
||||
/* Save the value for the R_IHCONST reloc. */
|
||||
hihalf = TRUE;
|
||||
hihalf_val = val;
|
||||
break;
|
||||
|
||||
case R_IHCONST:
|
||||
if (! hihalf)
|
||||
{
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info, _("missing IHIHALF reloc"), input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return FALSE;
|
||||
hihalf_val = 0;
|
||||
}
|
||||
|
||||
insn = bfd_get_32 (input_bfd, loc);
|
||||
unsigned_value = rel->r_symndx + hihalf_val;
|
||||
unsigned_value >>= 16;
|
||||
insn = INSERT_HWORD (insn, unsigned_value);
|
||||
bfd_put_32 (input_bfd, (bfd_vma) insn, loc);
|
||||
|
||||
hihalf = FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case R_BYTE:
|
||||
case R_HWORD:
|
||||
case R_WORD:
|
||||
rstat = _bfd_relocate_contents (howto_table + rel->r_type,
|
||||
input_bfd, val, loc);
|
||||
if (rstat == bfd_reloc_overflow)
|
||||
overflow = TRUE;
|
||||
else if (rstat != bfd_reloc_ok)
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (overflow)
|
||||
{
|
||||
const char *name;
|
||||
char buf[SYMNMLEN + 1];
|
||||
|
||||
if (symndx == -1)
|
||||
name = "*ABS*";
|
||||
else if (h != NULL)
|
||||
name = NULL;
|
||||
else if (sym == NULL)
|
||||
name = "*unknown*";
|
||||
else if (sym->_n._n_n._n_zeroes == 0
|
||||
&& sym->_n._n_n._n_offset != 0)
|
||||
name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
|
||||
else
|
||||
{
|
||||
strncpy (buf, sym->_n._n_name, SYMNMLEN);
|
||||
buf[SYMNMLEN] = '\0';
|
||||
name = buf;
|
||||
}
|
||||
|
||||
if (! ((*info->callbacks->reloc_overflow)
|
||||
(info, (h ? &h->root : NULL), name,
|
||||
howto_table[rel->r_type].name, (bfd_vma) 0, input_bfd,
|
||||
input_section, rel->r_vaddr - input_section->vma)))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define coff_relocate_section coff_a29k_relocate_section
|
||||
|
||||
/* We don't want to change the symndx of a R_IHCONST reloc, since it
|
||||
is actually an addend, not a symbol index at all. */
|
||||
|
||||
static bfd_boolean
|
||||
coff_a29k_adjust_symndx (obfd, info, ibfd, sec, irel, adjustedp)
|
||||
bfd *obfd ATTRIBUTE_UNUSED;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
bfd *ibfd ATTRIBUTE_UNUSED;
|
||||
asection *sec ATTRIBUTE_UNUSED;
|
||||
struct internal_reloc *irel;
|
||||
bfd_boolean *adjustedp;
|
||||
{
|
||||
if (irel->r_type == R_IHCONST)
|
||||
*adjustedp = TRUE;
|
||||
else
|
||||
*adjustedp = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define coff_adjust_symndx coff_a29k_adjust_symndx
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
CREATE_BIG_COFF_TARGET_VEC (a29kcoff_big_vec, "coff-a29k-big", 0, SEC_READONLY, '_', NULL, COFF_SWAP_TABLE)
|
||||
447
bfd/coff-maxq.c
Normal file
447
bfd/coff-maxq.c
Normal file
@@ -0,0 +1,447 @@
|
||||
/* BFD back-end for MAXQ COFF binaries.
|
||||
Copyright 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by Vineet Sharma (vineets@noida.hcltech.com) Inderpreet S.
|
||||
(inderpreetb@noida.hcltech.com)
|
||||
|
||||
HCL Technologies Ltd.
|
||||
|
||||
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 3 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.,
|
||||
51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/maxq.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
#include "libiberty.h"
|
||||
|
||||
#ifndef MAXQ20
|
||||
#define MAXQ20 1
|
||||
#endif
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
((cache_ptr)->howto = \
|
||||
((dst)->r_type < 48 \
|
||||
? howto_table + (((dst)->r_type==47) ? 6: ((dst)->r_type)) \
|
||||
: NULL))
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
|
||||
/* Code to swap in the reloc offset. */
|
||||
#define SWAP_IN_RELOC_OFFSET H_GET_16
|
||||
#define SWAP_OUT_RELOC_OFFSET H_PUT_16
|
||||
|
||||
#define SHORT_JUMP BFD_RELOC_16_PCREL_S2
|
||||
#define LONG_JUMP BFD_RELOC_14
|
||||
#define ABSOLUTE_ADDR_FOR_DATA BFD_RELOC_24
|
||||
|
||||
/* checks the range of short jump -127 to 128 */
|
||||
#define IS_SJUMP_RANGE(x) ((x > -128) && (x < 129))
|
||||
#define HIGH_WORD_MASK 0xff00
|
||||
#define LOW_WORD_MASK 0x00ff
|
||||
|
||||
static long
|
||||
get_symbol_value (asymbol *symbol)
|
||||
{
|
||||
long relocation = 0;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
relocation = 0;
|
||||
else
|
||||
relocation = symbol->value +
|
||||
symbol->section->output_section->vma + symbol->section->output_offset;
|
||||
|
||||
return relocation;
|
||||
}
|
||||
|
||||
/* This function performs all the maxq relocations.
|
||||
FIXME: The handling of the addend in the 'BFD_*'
|
||||
relocations types. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
coff_maxq20_reloc (bfd * abfd,
|
||||
arelent * reloc_entry,
|
||||
asymbol * symbol_in,
|
||||
void * data,
|
||||
asection * input_section ATTRIBUTE_UNUSED,
|
||||
bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
char ** error_message ATTRIBUTE_UNUSED)
|
||||
{
|
||||
unsigned char *addr = NULL;
|
||||
unsigned long x = 0;
|
||||
long call_addr = 0;
|
||||
short addend = 0;
|
||||
long diff = 0;
|
||||
|
||||
/* If this is an undefined symbol, return error. */
|
||||
if (symbol_in->section == &bfd_und_section
|
||||
&& (symbol_in->flags & BSF_WEAK) == 0)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
if (data && reloc_entry)
|
||||
{
|
||||
addr = (unsigned char *) data + reloc_entry->address;
|
||||
call_addr = call_addr - call_addr;
|
||||
call_addr = get_symbol_value (symbol_in);
|
||||
|
||||
/* Over here the value val stores the 8 bit/16 bit value. We will put a
|
||||
check if we are moving a 16 bit immediate value into an 8 bit
|
||||
register. In that case we will generate a Upper bytes into PFX[0]
|
||||
and move the lower 8 bits as SRC. */
|
||||
|
||||
switch (reloc_entry->howto->type)
|
||||
{
|
||||
/* BFD_RELOC_16_PCREL_S2 47 Handles all the relative jumps and
|
||||
calls Note: Every relative jump or call is in words. */
|
||||
case SHORT_JUMP:
|
||||
/* Handle any addend. */
|
||||
addend = reloc_entry->addend;
|
||||
|
||||
if (addend > call_addr || addend > 0)
|
||||
call_addr = symbol_in->section->output_section->vma + addend;
|
||||
else if (addend < call_addr && addend > 0)
|
||||
call_addr = call_addr + addend;
|
||||
else if (addend < 0)
|
||||
call_addr = call_addr + addend;
|
||||
|
||||
diff = ((call_addr << 1) - (reloc_entry->address << 1));
|
||||
|
||||
if (!IS_SJUMP_RANGE (diff))
|
||||
{
|
||||
bfd_perror (_("Can't Make it a Short Jump"));
|
||||
return bfd_reloc_outofrange;
|
||||
}
|
||||
|
||||
x = bfd_get_16 (abfd, addr);
|
||||
|
||||
x = x & LOW_WORD_MASK;
|
||||
x = x | (diff << 8);
|
||||
bfd_put_16 (abfd, (bfd_vma) x, addr);
|
||||
|
||||
return bfd_reloc_ok;
|
||||
|
||||
case ABSOLUTE_ADDR_FOR_DATA:
|
||||
case LONG_JUMP:
|
||||
/* BFD_RELOC_14 Handles intersegment or long jumps which might be
|
||||
from code to code or code to data segment jumps. Note: When this
|
||||
fucntion is called by gas the section flags somehow do not
|
||||
contain the info about the section type(CODE or DATA). Thus the
|
||||
user needs to evoke the linker after assembling the files
|
||||
because the Code-Code relocs are word aligned but code-data are
|
||||
byte aligned. */
|
||||
addend = (reloc_entry->addend - reloc_entry->addend);
|
||||
|
||||
/* Handle any addend. */
|
||||
addend = reloc_entry->addend;
|
||||
|
||||
/* For relocation involving multiple file added becomes zero thus
|
||||
this fails - check for zero added. In another case when we try
|
||||
to add a stub to a file the addend shows the offset from the
|
||||
start od this file. */
|
||||
addend = 0;
|
||||
|
||||
if (!bfd_is_com_section (symbol_in->section) &&
|
||||
((symbol_in->flags & BSF_OLD_COMMON) == 0))
|
||||
{
|
||||
if (reloc_entry->addend > symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
|
||||
if ((reloc_entry->addend < symbol_in->value)
|
||||
&& (reloc_entry->addend != 0))
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
|
||||
if (reloc_entry->addend == symbol_in->value)
|
||||
addend = 0;
|
||||
}
|
||||
|
||||
if (bfd_is_com_section (symbol_in->section) ||
|
||||
((symbol_in->flags & BSF_OLD_COMMON) != 0))
|
||||
addend = reloc_entry->addend;
|
||||
|
||||
if (addend < 0
|
||||
&& (call_addr < (long) (addend * (-1))))
|
||||
addend = 0;
|
||||
|
||||
call_addr += addend;
|
||||
|
||||
/* FIXME: This check does not work well with the assembler,
|
||||
linker needs to be run always. */
|
||||
if ((symbol_in->section->flags & SEC_CODE) == SEC_CODE)
|
||||
{
|
||||
/* Convert it into words. */
|
||||
call_addr = call_addr >> 1;
|
||||
|
||||
if (call_addr > 0xFFFF) /* Intersegment Jump. */
|
||||
{
|
||||
bfd_perror (_("Exceeds Long Jump Range"));
|
||||
return bfd_reloc_outofrange;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* case ABSOLUTE_ADDR_FOR_DATA : Resolves any code-data
|
||||
segemnt relocs. These are NOT word aligned. */
|
||||
|
||||
if (call_addr > 0xFFFF) /* Intersegment Jump. */
|
||||
{
|
||||
bfd_perror (_("Absolute address Exceeds 16 bit Range"));
|
||||
return bfd_reloc_outofrange;
|
||||
}
|
||||
}
|
||||
|
||||
x = bfd_get_32 (abfd, addr);
|
||||
|
||||
x = (x & 0xFF00FF00);
|
||||
x = (x | ((call_addr & HIGH_WORD_MASK) >> 8));
|
||||
x = (x | (call_addr & LOW_WORD_MASK) << 16);
|
||||
|
||||
bfd_put_32 (abfd, (bfd_vma) x, addr);
|
||||
return bfd_reloc_ok;
|
||||
|
||||
case BFD_RELOC_8:
|
||||
addend = (reloc_entry->addend - reloc_entry->addend);
|
||||
|
||||
if (!bfd_is_com_section (symbol_in->section) &&
|
||||
((symbol_in->flags & BSF_OLD_COMMON) == 0))
|
||||
{
|
||||
if (reloc_entry->addend > symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
if (reloc_entry->addend < symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
if (reloc_entry->addend == symbol_in->value)
|
||||
addend = 0;
|
||||
}
|
||||
|
||||
if (bfd_is_com_section (symbol_in->section) ||
|
||||
((symbol_in->flags & BSF_OLD_COMMON) != 0))
|
||||
addend = reloc_entry->addend;
|
||||
|
||||
if (addend < 0
|
||||
&& (call_addr < (long) (addend * (-1))))
|
||||
addend = 0;
|
||||
|
||||
if (call_addr + addend > 0xFF)
|
||||
{
|
||||
bfd_perror (_("Absolute address Exceeds 8 bit Range"));
|
||||
return bfd_reloc_outofrange;
|
||||
}
|
||||
|
||||
x = bfd_get_8 (abfd, addr);
|
||||
x = x & 0x00;
|
||||
x = x | (call_addr + addend);
|
||||
|
||||
bfd_put_8 (abfd, (bfd_vma) x, addr);
|
||||
return bfd_reloc_ok;
|
||||
|
||||
case BFD_RELOC_16:
|
||||
addend = (reloc_entry->addend - reloc_entry->addend);
|
||||
if (!bfd_is_com_section (symbol_in->section) &&
|
||||
((symbol_in->flags & BSF_OLD_COMMON) == 0))
|
||||
{
|
||||
if (reloc_entry->addend > symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
|
||||
if (reloc_entry->addend < symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
|
||||
if (reloc_entry->addend == symbol_in->value)
|
||||
addend = 0;
|
||||
}
|
||||
|
||||
if (bfd_is_com_section (symbol_in->section) ||
|
||||
((symbol_in->flags & BSF_OLD_COMMON) != 0))
|
||||
addend = reloc_entry->addend;
|
||||
|
||||
if (addend < 0
|
||||
&& (call_addr < (long) (addend * (-1))))
|
||||
addend = 0;
|
||||
|
||||
if ((call_addr + addend) > 0xFFFF)
|
||||
{
|
||||
bfd_perror (_("Absolute address Exceeds 16 bit Range"));
|
||||
return bfd_reloc_outofrange;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned short val = (call_addr + addend);
|
||||
|
||||
x = bfd_get_16 (abfd, addr);
|
||||
|
||||
/* LE */
|
||||
x = (x & 0x0000); /* Flush garbage value. */
|
||||
x = val;
|
||||
if ((symbol_in->section->flags & SEC_CODE) == SEC_CODE)
|
||||
x = x >> 1; /* Convert it into words. */
|
||||
}
|
||||
|
||||
bfd_put_16 (abfd, (bfd_vma) x, addr);
|
||||
return bfd_reloc_ok;
|
||||
|
||||
case BFD_RELOC_32:
|
||||
addend = (reloc_entry->addend - reloc_entry->addend);
|
||||
|
||||
if (!bfd_is_com_section (symbol_in->section) &&
|
||||
((symbol_in->flags & BSF_OLD_COMMON) == 0))
|
||||
{
|
||||
if (reloc_entry->addend > symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
if (reloc_entry->addend < symbol_in->value)
|
||||
addend = reloc_entry->addend - symbol_in->value;
|
||||
if (reloc_entry->addend == symbol_in->value)
|
||||
addend = 0;
|
||||
}
|
||||
|
||||
if (bfd_is_com_section (symbol_in->section) ||
|
||||
((symbol_in->flags & BSF_OLD_COMMON) != 0))
|
||||
addend = reloc_entry->addend;
|
||||
|
||||
if (addend < 0
|
||||
&& (call_addr < (long) (addend * (-1))))
|
||||
addend = 0;
|
||||
|
||||
if ((call_addr + addend) < 0)
|
||||
{
|
||||
bfd_perror ("Absolute address Exceeds 32 bit Range");
|
||||
return bfd_reloc_outofrange;
|
||||
}
|
||||
|
||||
x = bfd_get_32 (abfd, addr);
|
||||
x = (x & 0x0000); /* Flush garbage value. */
|
||||
x = call_addr + addend;
|
||||
if ((symbol_in->section->flags & SEC_CODE) == SEC_CODE)
|
||||
x = x >> 1; /* Convert it into words. */
|
||||
|
||||
bfd_put_32 (abfd, (bfd_vma) x, addr);
|
||||
return bfd_reloc_ok;
|
||||
|
||||
default:
|
||||
bfd_perror (_("Unrecognized Reloc Type"));
|
||||
return bfd_reloc_notsupported;
|
||||
}
|
||||
}
|
||||
|
||||
return bfd_reloc_notsupported;
|
||||
}
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
EMPTY_HOWTO (0),
|
||||
EMPTY_HOWTO (1),
|
||||
{
|
||||
BFD_RELOC_32, 0, 1, 8, FALSE, 0, complain_overflow_bitfield,
|
||||
coff_maxq20_reloc, "32Bit", TRUE, 0x000000ff, 0x000000ff, TRUE
|
||||
},
|
||||
{
|
||||
SHORT_JUMP, 0, 1, 8, FALSE, 0, complain_overflow_bitfield,
|
||||
coff_maxq20_reloc, "SHORT_JMP", TRUE, 0x000000ff, 0x000000ff, TRUE
|
||||
},
|
||||
{
|
||||
ABSOLUTE_ADDR_FOR_DATA, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
|
||||
coff_maxq20_reloc, "INTERSEGMENT_RELOC", TRUE, 0x00000000, 0x00000000,
|
||||
FALSE
|
||||
},
|
||||
{
|
||||
BFD_RELOC_16, 0, 1, 8, FALSE, 0, complain_overflow_bitfield,
|
||||
coff_maxq20_reloc, "16Bit", TRUE, 0x000000ff, 0x000000ff, TRUE
|
||||
},
|
||||
{
|
||||
LONG_JUMP, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,
|
||||
coff_maxq20_reloc, "LONG_JUMP", TRUE, 0x00000000, 0x00000000, FALSE
|
||||
},
|
||||
{
|
||||
BFD_RELOC_8, 0, 1, 8, FALSE, 0, complain_overflow_bitfield,
|
||||
coff_maxq20_reloc, "8bit", TRUE, 0x000000ff, 0x000000ff, TRUE
|
||||
},
|
||||
EMPTY_HOWTO (8),
|
||||
EMPTY_HOWTO (9),
|
||||
EMPTY_HOWTO (10),
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
maxq_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
|
||||
bfd_reloc_code_real_type code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
/* SHORT JUMP */
|
||||
case BFD_RELOC_16_PCREL_S2:
|
||||
return howto_table + 3;
|
||||
|
||||
/* INTERSEGMENT JUMP */
|
||||
case BFD_RELOC_24:
|
||||
return howto_table + 4;
|
||||
|
||||
/* BYTE RELOC */
|
||||
case BFD_RELOC_8:
|
||||
return howto_table + 7;
|
||||
|
||||
/* WORD RELOC */
|
||||
case BFD_RELOC_16:
|
||||
return howto_table + 5;
|
||||
|
||||
/* LONG RELOC */
|
||||
case BFD_RELOC_32:
|
||||
return howto_table + 2;
|
||||
|
||||
/* LONG JUMP */
|
||||
case BFD_RELOC_14:
|
||||
return howto_table + 6;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static reloc_howto_type *
|
||||
maxq_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++)
|
||||
if (howto_table[i].name != NULL
|
||||
&& strcasecmp (howto_table[i].name, r_name) == 0)
|
||||
return &howto_table[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define coff_bfd_reloc_type_lookup maxq_reloc_type_lookup
|
||||
#define coff_bfd_reloc_name_lookup maxq_reloc_name_lookup
|
||||
|
||||
/* Perform any necessary magic to the addend in a reloc entry. */
|
||||
#define CALC_ADDEND(abfd, symbol, ext_reloc, cache_ptr) \
|
||||
cache_ptr->addend = ext_reloc.r_offset;
|
||||
|
||||
#ifndef bfd_pe_print_pdata
|
||||
#define bfd_pe_print_pdata NULL
|
||||
#endif
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
#ifndef TARGET_UNDERSCORE
|
||||
#define TARGET_UNDERSCORE 1
|
||||
#endif
|
||||
|
||||
#ifndef EXTRA_S_FLAGS
|
||||
#define EXTRA_S_FLAGS 0
|
||||
#endif
|
||||
|
||||
/* Forward declaration for use initialising alternative_target field. */
|
||||
CREATE_LITTLE_COFF_TARGET_VEC (maxqcoff_vec, "coff-maxq", 0, EXTRA_S_FLAGS,
|
||||
TARGET_UNDERSCORE, NULL, COFF_SWAP_TABLE);
|
||||
|
||||
34
bfd/coff-pmac.c
Normal file
34
bfd/coff-pmac.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/* BFD back-end for Apple et al PowerPC Mac "XCOFF" files.
|
||||
Copyright 1995, 2000, 2001, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
/* Tweak coffcode.h based on this being a PowerMac instead of RS/6000. */
|
||||
|
||||
#define POWERMAC
|
||||
|
||||
#define TARGET_SYM pmac_xcoff_vec
|
||||
#define TARGET_NAME "xcoff-powermac"
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/internal.h"
|
||||
#include "coff/rs6000.h"
|
||||
#include "libcoff.h"
|
||||
#include "xcoff-target.h"
|
||||
39
bfd/cpu-a29k.c
Normal file
39
bfd/cpu-a29k.c
Normal file
@@ -0,0 +1,39 @@
|
||||
/* BFD support for the AMD 29000 architecture.
|
||||
Copyright 1992, 2000, 2002 Free Software Foundation, Inc.
|
||||
Hacked by Steve Chamberlain of Cygnus Support.
|
||||
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
const bfd_arch_info_type bfd_a29k_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_a29k,
|
||||
0, /* only 1 machine */
|
||||
"a29k",
|
||||
"a29k",
|
||||
4,
|
||||
TRUE, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
||||
60
bfd/cpu-maxq.c
Normal file
60
bfd/cpu-maxq.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/* BFD support for the MAXQ20/10 architecture.
|
||||
Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by Vineet Sharma(vineets@noida.hcltech.com)
|
||||
Inderpreet Singh(inderpreetb@noida.hcltech.com)
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
/* MAXQ Archtecture info. */
|
||||
static const bfd_arch_info_type bfd_maxq10_arch =
|
||||
{
|
||||
16, /* 16 bits in a word. */
|
||||
16, /* 16 bits in an address. */
|
||||
8, /* 16 bits in a byte. */
|
||||
bfd_arch_maxq, /* Architecture number. */
|
||||
bfd_mach_maxq10, /* Machine number. */
|
||||
"maxq", /* Architecture name. */
|
||||
"maxq10", /* Machine name. */
|
||||
0, /* Section align power. */
|
||||
FALSE, /* Not the default machine. */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
const bfd_arch_info_type bfd_maxq_arch =
|
||||
{
|
||||
16, /* 16 bits in a word. */
|
||||
16, /* 16 bits in an address. */
|
||||
8, /* 16 bits in a byte. */
|
||||
bfd_arch_maxq, /* Architecture number. */
|
||||
bfd_mach_maxq20, /* Machine number. */
|
||||
"maxq", /* Architecture name. */
|
||||
"maxq20", /* Machine name. */
|
||||
0, /* Section align power. */
|
||||
TRUE, /* This is the default machine. */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan,
|
||||
& bfd_maxq10_arch
|
||||
};
|
||||
71
bfd/cpu-ms1.c
Normal file
71
bfd/cpu-ms1.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/* BFD support for the Morpho Technologies MS1 processor.
|
||||
Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
{
|
||||
32, /* Bits per word - not really true. */
|
||||
32, /* Bits per address. */
|
||||
8, /* Bits per byte. */
|
||||
bfd_arch_ms1, /* Architecture. */
|
||||
bfd_mach_mrisc2, /* Machine. */
|
||||
"ms1", /* Architecture name. */
|
||||
"ms1-003", /* Printable name. */
|
||||
1, /* Section align power. */
|
||||
FALSE, /* The default ? */
|
||||
bfd_default_compatible, /* Architecture comparison fn. */
|
||||
bfd_default_scan, /* String to architecture convert fn. */
|
||||
&arch_info_struct[1] /* Next in list. */
|
||||
},
|
||||
{
|
||||
32, /* Bits per word - not really true. */
|
||||
32, /* Bits per address. */
|
||||
8, /* Bits per byte. */
|
||||
bfd_arch_ms1, /* Architecture. */
|
||||
bfd_mach_ms2, /* Machine. */
|
||||
"ms1", /* Architecture name. */
|
||||
"ms2", /* Printable name. */
|
||||
1, /* Section align power. */
|
||||
FALSE, /* The default ? */
|
||||
bfd_default_compatible, /* Architecture comparison fn. */
|
||||
bfd_default_scan, /* String to architecture convert fn. */
|
||||
NULL /* Next in list. */
|
||||
},
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_ms1_arch =
|
||||
{
|
||||
32, /* Bits per word - not really true. */
|
||||
32, /* Bits per address. */
|
||||
8, /* Bits per byte. */
|
||||
bfd_arch_ms1, /* Architecture. */
|
||||
bfd_mach_ms1, /* Machine. */
|
||||
"ms1", /* Architecture name. */
|
||||
"ms1", /* Printable name. */
|
||||
1, /* Section align power. */
|
||||
TRUE, /* The default ? */
|
||||
bfd_default_compatible, /* Architecture comparison fn. */
|
||||
bfd_default_scan, /* String to architecture convert fn. */
|
||||
&arch_info_struct[0] /* Next in list. */
|
||||
};
|
||||
|
||||
211
bfd/doc/aoutx.texi
Normal file
211
bfd/doc/aoutx.texi
Normal file
@@ -0,0 +1,211 @@
|
||||
@section a.out backends
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
BFD supports a number of different flavours of a.out format,
|
||||
though the major differences are only the sizes of the
|
||||
structures on disk, and the shape of the relocation
|
||||
information.
|
||||
|
||||
The support is split into a basic support file @file{aoutx.h}
|
||||
and other files which derive functions from the base. One
|
||||
derivation file is @file{aoutf1.h} (for a.out flavour 1), and
|
||||
adds to the basic a.out functions support for sun3, sun4, 386
|
||||
and 29k a.out files, to create a target jump vector for a
|
||||
specific target.
|
||||
|
||||
This information is further split out into more specific files
|
||||
for each machine, including @file{sunos.c} for sun3 and sun4,
|
||||
@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a
|
||||
demonstration of a 64 bit a.out format.
|
||||
|
||||
The base file @file{aoutx.h} defines general mechanisms for
|
||||
reading and writing records to and from disk and various
|
||||
other methods which BFD requires. It is included by
|
||||
@file{aout32.c} and @file{aout64.c} to form the names
|
||||
@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc.
|
||||
|
||||
As an example, this is what goes on to make the back end for a
|
||||
sun4, from @file{aout32.c}:
|
||||
|
||||
@example
|
||||
#define ARCH_SIZE 32
|
||||
#include "aoutx.h"
|
||||
@end example
|
||||
|
||||
Which exports names:
|
||||
|
||||
@example
|
||||
...
|
||||
aout_32_canonicalize_reloc
|
||||
aout_32_find_nearest_line
|
||||
aout_32_get_lineno
|
||||
aout_32_get_reloc_upper_bound
|
||||
...
|
||||
@end example
|
||||
|
||||
from @file{sunos.c}:
|
||||
|
||||
@example
|
||||
#define TARGET_NAME "a.out-sunos-big"
|
||||
#define VECNAME sunos_big_vec
|
||||
#include "aoutf1.h"
|
||||
@end example
|
||||
|
||||
requires all the names from @file{aout32.c}, and produces the jump vector
|
||||
|
||||
@example
|
||||
sunos_big_vec
|
||||
@end example
|
||||
|
||||
The file @file{host-aout.c} is a special case. It is for a large set
|
||||
of hosts that use ``more or less standard'' a.out files, and
|
||||
for which cross-debugging is not interesting. It uses the
|
||||
standard 32-bit a.out support routines, but determines the
|
||||
file offsets and addresses of the text, data, and BSS
|
||||
sections, the machine architecture and machine type, and the
|
||||
entry point address, in a host-dependent manner. Once these
|
||||
values have been determined, generic code is used to handle
|
||||
the object file.
|
||||
|
||||
When porting it to run on a new system, you must supply:
|
||||
|
||||
@example
|
||||
HOST_PAGE_SIZE
|
||||
HOST_SEGMENT_SIZE
|
||||
HOST_MACHINE_ARCH (optional)
|
||||
HOST_MACHINE_MACHINE (optional)
|
||||
HOST_TEXT_START_ADDR
|
||||
HOST_STACK_END_ADDR
|
||||
@end example
|
||||
|
||||
in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These
|
||||
values, plus the structures and macros defined in @file{a.out.h} on
|
||||
your host system, will produce a BFD target that will access
|
||||
ordinary a.out files on your host. To configure a new machine
|
||||
to use @file{host-aout.c}, specify:
|
||||
|
||||
@example
|
||||
TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
|
||||
TDEPFILES= host-aout.o trad-core.o
|
||||
@end example
|
||||
|
||||
in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
|
||||
to use the
|
||||
@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your
|
||||
configuration is selected.
|
||||
|
||||
@subsection Relocations
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
The file @file{aoutx.h} provides for both the @emph{standard}
|
||||
and @emph{extended} forms of a.out relocation records.
|
||||
|
||||
The standard records contain only an
|
||||
address, a symbol index, and a type field. The extended records
|
||||
(used on 29ks and sparcs) also have a full integer for an
|
||||
addend.
|
||||
|
||||
@subsection Internal entry points
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
@file{aoutx.h} exports several routines for accessing the
|
||||
contents of an a.out file, which are gathered and exported in
|
||||
turn by various format specific files (eg sunos.c).
|
||||
|
||||
@findex aout_@var{size}_swap_exec_header_in
|
||||
@subsubsection @code{aout_@var{size}_swap_exec_header_in}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void aout_@var{size}_swap_exec_header_in,
|
||||
(bfd *abfd,
|
||||
struct external_exec *raw_bytes,
|
||||
struct internal_exec *execp);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Swap the information in an executable header @var{raw_bytes} taken
|
||||
from a raw byte stream memory image into the internal exec header
|
||||
structure @var{execp}.
|
||||
|
||||
@findex aout_@var{size}_swap_exec_header_out
|
||||
@subsubsection @code{aout_@var{size}_swap_exec_header_out}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void aout_@var{size}_swap_exec_header_out
|
||||
(bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
struct external_exec *raw_bytes);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Swap the information in an internal exec header structure
|
||||
@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
|
||||
|
||||
@findex aout_@var{size}_some_aout_object_p
|
||||
@subsubsection @code{aout_@var{size}_some_aout_object_p}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_target *aout_@var{size}_some_aout_object_p
|
||||
(bfd *abfd,
|
||||
const bfd_target *(*callback_to_real_object_p)());
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Some a.out variant thinks that the file open in @var{abfd}
|
||||
checking is an a.out file. Do some more checking, and set up
|
||||
for access if it really is. Call back to the calling
|
||||
environment's "finish up" function just before returning, to
|
||||
handle any last-minute setup.
|
||||
|
||||
@findex aout_@var{size}_mkobject
|
||||
@subsubsection @code{aout_@var{size}_mkobject}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean aout_@var{size}_mkobject, (bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Initialize BFD @var{abfd} for use with a.out files.
|
||||
|
||||
@findex aout_@var{size}_machine_type
|
||||
@subsubsection @code{aout_@var{size}_machine_type}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
enum machine_type aout_@var{size}_machine_type
|
||||
(enum bfd_architecture arch,
|
||||
unsigned long machine));
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Keep track of machine architecture and machine type for
|
||||
a.out's. Return the @code{machine_type} for a particular
|
||||
architecture and machine, or @code{M_UNKNOWN} if that exact architecture
|
||||
and machine can't be represented in a.out format.
|
||||
|
||||
If the architecture is understood, machine type 0 (default)
|
||||
is always understood.
|
||||
|
||||
@findex aout_@var{size}_set_arch_mach
|
||||
@subsubsection @code{aout_@var{size}_set_arch_mach}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean aout_@var{size}_set_arch_mach,
|
||||
(bfd *,
|
||||
enum bfd_architecture arch,
|
||||
unsigned long machine));
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the architecture and the machine of the BFD @var{abfd} to the
|
||||
values @var{arch} and @var{machine}. Verify that @var{abfd}'s format
|
||||
can support the architecture required.
|
||||
|
||||
@findex aout_@var{size}_new_section_hook
|
||||
@subsubsection @code{aout_@var{size}_new_section_hook}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean aout_@var{size}_new_section_hook,
|
||||
(bfd *abfd,
|
||||
asection *newsect));
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Called by the BFD in response to a @code{bfd_make_section}
|
||||
request.
|
||||
|
||||
95
bfd/doc/archive.texi
Normal file
95
bfd/doc/archive.texi
Normal file
@@ -0,0 +1,95 @@
|
||||
@section Archives
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
An archive (or library) is just another BFD. It has a symbol
|
||||
table, although there's not much a user program will do with it.
|
||||
|
||||
The big difference between an archive BFD and an ordinary BFD
|
||||
is that the archive doesn't have sections. Instead it has a
|
||||
chain of BFDs that are considered its contents. These BFDs can
|
||||
be manipulated like any other. The BFDs contained in an
|
||||
archive opened for reading will all be opened for reading. You
|
||||
may put either input or output BFDs into an archive opened for
|
||||
output; they will be handled correctly when the archive is closed.
|
||||
|
||||
Use @code{bfd_openr_next_archived_file} to step through
|
||||
the contents of an archive opened for input. You don't
|
||||
have to read the entire archive if you don't want
|
||||
to! Read it until you find what you want.
|
||||
|
||||
Archive contents of output BFDs are chained through the
|
||||
@code{next} pointer in a BFD. The first one is findable through
|
||||
the @code{archive_head} slot of the archive. Set it with
|
||||
@code{bfd_set_archive_head} (q.v.). A given BFD may be in only one
|
||||
open output archive at a time.
|
||||
|
||||
As expected, the BFD archive code is more general than the
|
||||
archive code of any given environment. BFD archives may
|
||||
contain files of different formats (e.g., a.out and coff) and
|
||||
even different architectures. You may even place archives
|
||||
recursively into archives!
|
||||
|
||||
This can cause unexpected confusion, since some archive
|
||||
formats are more expressive than others. For instance, Intel
|
||||
COFF archives can preserve long filenames; SunOS a.out archives
|
||||
cannot. If you move a file from the first to the second
|
||||
format and back again, the filename may be truncated.
|
||||
Likewise, different a.out environments have different
|
||||
conventions as to how they truncate filenames, whether they
|
||||
preserve directory names in filenames, etc. When
|
||||
interoperating with native tools, be sure your files are
|
||||
homogeneous.
|
||||
|
||||
Beware: most of these formats do not react well to the
|
||||
presence of spaces in filenames. We do the best we can, but
|
||||
can't always handle this case due to restrictions in the format of
|
||||
archives. Many Unix utilities are braindead in regards to
|
||||
spaces and such in filenames anyway, so this shouldn't be much
|
||||
of a restriction.
|
||||
|
||||
Archives are supported in BFD in @code{archive.c}.
|
||||
|
||||
@findex bfd_get_next_mapent
|
||||
@subsubsection @code{bfd_get_next_mapent}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
symindex bfd_get_next_mapent(bfd *abfd, symindex previous, carsym **sym);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Step through archive @var{abfd}'s symbol table (if it
|
||||
has one). Successively update @var{sym} with the next symbol's
|
||||
information, returning that symbol's (internal) index into the
|
||||
symbol table.
|
||||
|
||||
Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get
|
||||
the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already
|
||||
got the last one.
|
||||
|
||||
A @code{carsym} is a canonical archive symbol. The only
|
||||
user-visible element is its name, a null-terminated string.
|
||||
|
||||
@findex bfd_set_archive_head
|
||||
@subsubsection @code{bfd_set_archive_head}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_archive_head(bfd *output, bfd *new_head);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the head of the chain of
|
||||
BFDs contained in the archive @var{output} to @var{new_head}.
|
||||
|
||||
@findex bfd_openr_next_archived_file
|
||||
@subsubsection @code{bfd_openr_next_archived_file}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd *bfd_openr_next_archived_file(bfd *archive, bfd *previous);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Provided a BFD, @var{archive}, containing an archive and NULL, open
|
||||
an input BFD on the first contained element and returns that.
|
||||
Subsequent calls should pass
|
||||
the archive and the previous return value to return a created
|
||||
BFD to the next contained element. NULL is returned when there
|
||||
are no more.
|
||||
|
||||
409
bfd/doc/archures.texi
Normal file
409
bfd/doc/archures.texi
Normal file
@@ -0,0 +1,409 @@
|
||||
@section Architectures
|
||||
BFD keeps one atom in a BFD describing the
|
||||
architecture of the data attached to the BFD: a pointer to a
|
||||
@code{bfd_arch_info_type}.
|
||||
|
||||
Pointers to structures can be requested independently of a BFD
|
||||
so that an architecture's information can be interrogated
|
||||
without access to an open BFD.
|
||||
|
||||
The architecture information is provided by each architecture package.
|
||||
The set of default architectures is selected by the macro
|
||||
@code{SELECT_ARCHITECTURES}. This is normally set up in the
|
||||
@file{config/@var{target}.mt} file of your choice. If the name is not
|
||||
defined, then all the architectures supported are included.
|
||||
|
||||
When BFD starts up, all the architectures are called with an
|
||||
initialize method. It is up to the architecture back end to
|
||||
insert as many items into the list of architectures as it wants to;
|
||||
generally this would be one for each machine and one for the
|
||||
default case (an item with a machine field of 0).
|
||||
|
||||
BFD's idea of an architecture is implemented in @file{archures.c}.
|
||||
|
||||
@subsection bfd_architecture
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
This enum gives the object file's CPU architecture, in a
|
||||
global sense---i.e., what processor family does it belong to?
|
||||
Another field indicates which processor within
|
||||
the family is in use. The machine gives a number which
|
||||
distinguishes different versions of the architecture,
|
||||
containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
|
||||
and 68020 and 68030 for Motorola 68020 and 68030.
|
||||
@example
|
||||
enum bfd_architecture
|
||||
@{
|
||||
bfd_arch_unknown, /* File arch not known */
|
||||
bfd_arch_obscure, /* Arch known, not one of these */
|
||||
bfd_arch_m68k, /* Motorola 68xxx */
|
||||
#define bfd_mach_m68000 1
|
||||
#define bfd_mach_m68008 2
|
||||
#define bfd_mach_m68010 3
|
||||
#define bfd_mach_m68020 4
|
||||
#define bfd_mach_m68030 5
|
||||
#define bfd_mach_m68040 6
|
||||
#define bfd_mach_m68060 7
|
||||
#define bfd_mach_cpu32 8
|
||||
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
|
||||
#define bfd_mach_i960_jx 7
|
||||
#define bfd_mach_i960_hx 8
|
||||
|
||||
bfd_arch_a29k, /* AMD 29000 */
|
||||
bfd_arch_sparc, /* SPARC */
|
||||
#define bfd_mach_sparc 1
|
||||
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
|
||||
#define bfd_mach_sparc_sparclet 2
|
||||
#define bfd_mach_sparc_sparclite 3
|
||||
#define bfd_mach_sparc_v8plus 4
|
||||
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */
|
||||
#define bfd_mach_sparc_sparclite_le 6
|
||||
#define bfd_mach_sparc_v9 7
|
||||
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */
|
||||
/* Nonzero if MACH has the v9 instruction set. */
|
||||
#define bfd_mach_sparc_v9_p(mach) \
|
||||
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
|
||||
bfd_arch_mips, /* MIPS Rxxxx */
|
||||
#define bfd_mach_mips3000 3000
|
||||
#define bfd_mach_mips3900 3900
|
||||
#define bfd_mach_mips4000 4000
|
||||
#define bfd_mach_mips4010 4010
|
||||
#define bfd_mach_mips4100 4100
|
||||
#define bfd_mach_mips4111 4111
|
||||
#define bfd_mach_mips4300 4300
|
||||
#define bfd_mach_mips4400 4400
|
||||
#define bfd_mach_mips4600 4600
|
||||
#define bfd_mach_mips4650 4650
|
||||
#define bfd_mach_mips5000 5000
|
||||
#define bfd_mach_mips6000 6000
|
||||
#define bfd_mach_mips8000 8000
|
||||
#define bfd_mach_mips10000 10000
|
||||
#define bfd_mach_mips16 16
|
||||
bfd_arch_i386, /* Intel 386 */
|
||||
#define bfd_mach_i386_i386 0
|
||||
#define bfd_mach_i386_i8086 1
|
||||
#define bfd_mach_i386_i386_intel_syntax 2
|
||||
bfd_arch_we32k, /* AT&T WE32xxx */
|
||||
bfd_arch_tahoe, /* CCI/Harris Tahoe */
|
||||
bfd_arch_i860, /* Intel 860 */
|
||||
bfd_arch_i370, /* IBM 360/370 Mainframes */
|
||||
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
|
||||
#define bfd_mach_h8300s 3
|
||||
bfd_arch_powerpc, /* PowerPC */
|
||||
bfd_arch_rs6000, /* IBM RS/6000 */
|
||||
bfd_arch_hppa, /* HP PA RISC */
|
||||
bfd_arch_d10v, /* Mitsubishi D10V */
|
||||
#define bfd_mach_d10v 0
|
||||
#define bfd_mach_d10v_ts2 2
|
||||
#define bfd_mach_d10v_ts3 3
|
||||
bfd_arch_d30v, /* Mitsubishi D30V */
|
||||
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 */
|
||||
#define bfd_mach_sh 0
|
||||
#define bfd_mach_sh2 0x20
|
||||
#define bfd_mach_sh_dsp 0x2d
|
||||
#define bfd_mach_sh3 0x30
|
||||
#define bfd_mach_sh3_dsp 0x3d
|
||||
#define bfd_mach_sh3e 0x3e
|
||||
#define bfd_mach_sh4 0x40
|
||||
bfd_arch_alpha, /* Dec Alpha */
|
||||
#define bfd_mach_alpha_ev4 0x10
|
||||
#define bfd_mach_alpha_ev5 0x20
|
||||
#define bfd_mach_alpha_ev6 0x30
|
||||
bfd_arch_arm, /* Advanced Risc Machines ARM */
|
||||
#define bfd_mach_arm_2 1
|
||||
#define bfd_mach_arm_2a 2
|
||||
#define bfd_mach_arm_3 3
|
||||
#define bfd_mach_arm_3M 4
|
||||
#define bfd_mach_arm_4 5
|
||||
#define bfd_mach_arm_4T 6
|
||||
#define bfd_mach_arm_5 7
|
||||
#define bfd_mach_arm_5T 8
|
||||
bfd_arch_ns32k, /* National Semiconductors ns32000 */
|
||||
bfd_arch_w65, /* WDC 65816 */
|
||||
bfd_arch_tic30, /* Texas Instruments TMS320C30 */
|
||||
bfd_arch_tic80, /* TI TMS320c80 (MVP) */
|
||||
bfd_arch_v850, /* NEC V850 */
|
||||
#define bfd_mach_v850 0
|
||||
#define bfd_mach_v850e 'E'
|
||||
#define bfd_mach_v850ea 'A'
|
||||
bfd_arch_arc, /* Argonaut RISC Core */
|
||||
#define bfd_mach_arc_base 0
|
||||
bfd_arch_m32r, /* Mitsubishi M32R/D */
|
||||
#define bfd_mach_m32r 0 /* backwards compatibility */
|
||||
#define bfd_mach_m32rx 'x'
|
||||
bfd_arch_mn10200, /* Matsushita MN10200 */
|
||||
bfd_arch_mn10300, /* Matsushita MN10300 */
|
||||
#define bfd_mach_mn10300 300
|
||||
#define bfd_mach_am33 330
|
||||
bfd_arch_fr30,
|
||||
#define bfd_mach_fr30 0x46523330
|
||||
bfd_arch_mcore,
|
||||
bfd_arch_pj,
|
||||
bfd_arch_avr, /* Atmel AVR microcontrollers */
|
||||
#define bfd_mach_avr1 1
|
||||
#define bfd_mach_avr2 2
|
||||
#define bfd_mach_avr3 3
|
||||
#define bfd_mach_avr4 4
|
||||
bfd_arch_last
|
||||
@};
|
||||
@end example
|
||||
|
||||
@subsection bfd_arch_info
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
This structure contains information on architectures for use
|
||||
within BFD.
|
||||
@example
|
||||
|
||||
typedef struct bfd_arch_info
|
||||
@{
|
||||
int bits_per_word;
|
||||
int bits_per_address;
|
||||
int bits_per_byte;
|
||||
enum bfd_architecture arch;
|
||||
unsigned long mach;
|
||||
const 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 *));
|
||||
|
||||
const struct bfd_arch_info *next;
|
||||
@} bfd_arch_info_type;
|
||||
@end example
|
||||
|
||||
@findex bfd_printable_name
|
||||
@subsubsection @code{bfd_printable_name}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const char *bfd_printable_name(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a printable string representing the architecture and machine
|
||||
from the pointer to the architecture info structure.
|
||||
|
||||
@findex bfd_scan_arch
|
||||
@subsubsection @code{bfd_scan_arch}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_arch_info_type *bfd_scan_arch(const char *string);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Figure out if BFD supports any cpu which could be described with
|
||||
the name @var{string}. Return a pointer to an @code{arch_info}
|
||||
structure if a machine is found, otherwise NULL.
|
||||
|
||||
@findex bfd_arch_list
|
||||
@subsubsection @code{bfd_arch_list}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const char **bfd_arch_list(void);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a freshly malloced NULL-terminated vector of the names
|
||||
of all the valid BFD architectures. Do not modify the names.
|
||||
|
||||
@findex bfd_arch_get_compatible
|
||||
@subsubsection @code{bfd_arch_get_compatible}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_arch_info_type *bfd_arch_get_compatible(
|
||||
const bfd *abfd,
|
||||
const bfd *bbfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Determine whether two BFDs'
|
||||
architectures and machine types are compatible. Calculates
|
||||
the lowest common denominator between the two architectures
|
||||
and machine types implied by the BFDs and returns a pointer to
|
||||
an @code{arch_info} structure describing the compatible machine.
|
||||
|
||||
@findex bfd_default_arch_struct
|
||||
@subsubsection @code{bfd_default_arch_struct}
|
||||
@strong{Description}@*
|
||||
The @code{bfd_default_arch_struct} is an item of
|
||||
@code{bfd_arch_info_type} which has been initialized to a fairly
|
||||
generic state. A BFD starts life by pointing to this
|
||||
structure, until the correct back end has determined the real
|
||||
architecture of the file.
|
||||
@example
|
||||
extern const bfd_arch_info_type bfd_default_arch_struct;
|
||||
@end example
|
||||
|
||||
@findex bfd_set_arch_info
|
||||
@subsubsection @code{bfd_set_arch_info}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the architecture info of @var{abfd} to @var{arg}.
|
||||
|
||||
@findex bfd_default_set_arch_mach
|
||||
@subsubsection @code{bfd_default_set_arch_mach}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_default_set_arch_mach(bfd *abfd,
|
||||
enum bfd_architecture arch,
|
||||
unsigned long mach);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the architecture and machine type in BFD @var{abfd}
|
||||
to @var{arch} and @var{mach}. Find the correct
|
||||
pointer to a structure and insert it into the @code{arch_info}
|
||||
pointer.
|
||||
|
||||
@findex bfd_get_arch
|
||||
@subsubsection @code{bfd_get_arch}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
enum bfd_architecture bfd_get_arch(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the enumerated type which describes the BFD @var{abfd}'s
|
||||
architecture.
|
||||
|
||||
@findex bfd_get_mach
|
||||
@subsubsection @code{bfd_get_mach}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
unsigned long bfd_get_mach(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the long type which describes the BFD @var{abfd}'s
|
||||
machine.
|
||||
|
||||
@findex bfd_arch_bits_per_byte
|
||||
@subsubsection @code{bfd_arch_bits_per_byte}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
unsigned int bfd_arch_bits_per_byte(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the number of bits in one of the BFD @var{abfd}'s
|
||||
architecture's bytes.
|
||||
|
||||
@findex bfd_arch_bits_per_address
|
||||
@subsubsection @code{bfd_arch_bits_per_address}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
unsigned int bfd_arch_bits_per_address(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the number of bits in one of the BFD @var{abfd}'s
|
||||
architecture's addresses.
|
||||
|
||||
@findex bfd_default_compatible
|
||||
@subsubsection @code{bfd_default_compatible}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_arch_info_type *bfd_default_compatible
|
||||
(const bfd_arch_info_type *a,
|
||||
const bfd_arch_info_type *b);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
The default function for testing for compatibility.
|
||||
|
||||
@findex bfd_default_scan
|
||||
@subsubsection @code{bfd_default_scan}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
The default function for working out whether this is an
|
||||
architecture hit and a machine hit.
|
||||
|
||||
@findex bfd_get_arch_info
|
||||
@subsubsection @code{bfd_get_arch_info}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the architecture info struct in @var{abfd}.
|
||||
|
||||
@findex bfd_lookup_arch
|
||||
@subsubsection @code{bfd_lookup_arch}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_arch_info_type *bfd_lookup_arch
|
||||
(enum bfd_architecture
|
||||
arch,
|
||||
unsigned long machine);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Look for the architecure info structure which matches the
|
||||
arguments @var{arch} and @var{machine}. A machine of 0 matches the
|
||||
machine/architecture structure which marks itself as the
|
||||
default.
|
||||
|
||||
@findex bfd_printable_arch_mach
|
||||
@subsubsection @code{bfd_printable_arch_mach}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const char *bfd_printable_arch_mach
|
||||
(enum bfd_architecture arch, unsigned long machine);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a printable string representing the architecture and
|
||||
machine type.
|
||||
|
||||
This routine is depreciated.
|
||||
|
||||
@findex bfd_octets_per_byte
|
||||
@subsubsection @code{bfd_octets_per_byte}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
unsigned int bfd_octets_per_byte(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the number of octets (8-bit quantities) per target byte
|
||||
(minimum addressable unit). In most cases, this will be one, but some
|
||||
DSP targets have 16, 32, or even 48 bits per byte.
|
||||
|
||||
@findex bfd_arch_mach_octets_per_byte
|
||||
@subsubsection @code{bfd_arch_mach_octets_per_byte}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,
|
||||
unsigned long machine);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
See bfd_octets_per_byte.
|
||||
This routine is provided for those cases where a bfd * is not
|
||||
available
|
||||
|
||||
95
bfd/doc/bfd.info
Normal file
95
bfd/doc/bfd.info
Normal file
@@ -0,0 +1,95 @@
|
||||
This is bfd.info, produced by makeinfo version 4.0 from bfd.texinfo.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* Bfd: (bfd). The Binary File Descriptor library.
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
This file documents the BFD library.
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, subject to the
|
||||
terms of the GNU General Public License, which includes the provision
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions.
|
||||
|
||||
|
||||
Indirect:
|
||||
bfd.info-1: 916
|
||||
bfd.info-2: 37727
|
||||
bfd.info-3: 81566
|
||||
bfd.info-4: 126215
|
||||
bfd.info-5: 175891
|
||||
bfd.info-6: 205826
|
||||
bfd.info-7: 233431
|
||||
|
||||
Tag Table:
|
||||
(Indirect)
|
||||
Node: Top916
|
||||
Node: Overview1181
|
||||
Node: History2231
|
||||
Node: How It Works3172
|
||||
Node: What BFD Version 2 Can Do4710
|
||||
Node: BFD information loss6024
|
||||
Node: Canonical format8547
|
||||
Node: BFD front end12908
|
||||
Node: Memory Usage31825
|
||||
Node: Initialization33048
|
||||
Node: Sections33425
|
||||
Node: Section Input33903
|
||||
Node: Section Output35259
|
||||
Node: typedef asection37727
|
||||
Node: section prototypes53227
|
||||
Node: Symbols59441
|
||||
Node: Reading Symbols61031
|
||||
Node: Writing Symbols62205
|
||||
Node: Mini Symbols63895
|
||||
Node: typedef asymbol64860
|
||||
Node: symbol handling functions70089
|
||||
Node: Archives74418
|
||||
Node: Formats78036
|
||||
Node: Relocations80846
|
||||
Node: typedef arelent81566
|
||||
Node: howto manager97725
|
||||
Node: Core Files123231
|
||||
Node: Targets124252
|
||||
Node: bfd_target126215
|
||||
Node: Architectures145125
|
||||
Node: Opening and Closing158434
|
||||
Node: Internal162831
|
||||
Node: File Caching168829
|
||||
Node: Linker Functions171607
|
||||
Node: Creating a Linker Hash Table173273
|
||||
Node: Adding Symbols to the Hash Table175001
|
||||
Node: Differing file formats175891
|
||||
Node: Adding symbols from an object file177624
|
||||
Node: Adding symbols from an archive179760
|
||||
Node: Performing the Final Link182159
|
||||
Node: Information provided by the linker183390
|
||||
Node: Relocating the section contents184526
|
||||
Node: Writing the symbol table186263
|
||||
Node: Hash Tables188857
|
||||
Node: Creating and Freeing a Hash Table190048
|
||||
Node: Looking Up or Entering a String191205
|
||||
Node: Traversing a Hash Table192447
|
||||
Node: Deriving a New Hash Table Type193225
|
||||
Node: Define the Derived Structures194280
|
||||
Node: Write the Derived Creation Routine195346
|
||||
Node: Write Other Derived Routines198045
|
||||
Node: BFD back ends199345
|
||||
Node: What to Put Where199564
|
||||
Node: aout199702
|
||||
Node: coff205826
|
||||
Node: elf232598
|
||||
Node: Index233431
|
||||
|
||||
End Tag Table
|
||||
1017
bfd/doc/bfd.info-1
Normal file
1017
bfd/doc/bfd.info-1
Normal file
File diff suppressed because it is too large
Load Diff
1187
bfd/doc/bfd.info-2
Normal file
1187
bfd/doc/bfd.info-2
Normal file
File diff suppressed because it is too large
Load Diff
1297
bfd/doc/bfd.info-3
Normal file
1297
bfd/doc/bfd.info-3
Normal file
File diff suppressed because it is too large
Load Diff
1292
bfd/doc/bfd.info-4
Normal file
1292
bfd/doc/bfd.info-4
Normal file
File diff suppressed because it is too large
Load Diff
736
bfd/doc/bfd.info-5
Normal file
736
bfd/doc/bfd.info-5
Normal file
@@ -0,0 +1,736 @@
|
||||
This is bfd.info, produced by makeinfo version 4.0 from bfd.texinfo.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* Bfd: (bfd). The Binary File Descriptor library.
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
This file documents the BFD library.
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, subject to the
|
||||
terms of the GNU General Public License, which includes the provision
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions.
|
||||
|
||||
|
||||
File: bfd.info, Node: Differing file formats, Next: Adding symbols from an object file, Prev: Adding Symbols to the Hash Table, Up: Adding Symbols to the Hash Table
|
||||
|
||||
Differing file formats
|
||||
......................
|
||||
|
||||
Normally all the files involved in a link will be of the same
|
||||
format, but it is also possible to link together different format
|
||||
object files, and the back end must support that. The
|
||||
`_bfd_link_add_symbols' entry point is called via the target vector of
|
||||
the file to be added. This has an important consequence: the function
|
||||
may not assume that the hash table is the type created by the
|
||||
corresponding `_bfd_link_hash_table_create' vector. All the
|
||||
`_bfd_link_add_symbols' function can assume about the hash table is
|
||||
that it is derived from `struct bfd_link_hash_table'.
|
||||
|
||||
Sometimes the `_bfd_link_add_symbols' function must store some
|
||||
information in the hash table entry to be used by the `_bfd_final_link'
|
||||
function. In such a case the `creator' field of the hash table must be
|
||||
checked to make sure that the hash table was created by an object file
|
||||
of the same format.
|
||||
|
||||
The `_bfd_final_link' routine must be prepared to handle a hash
|
||||
entry without any extra information added by the
|
||||
`_bfd_link_add_symbols' function. A hash entry without extra
|
||||
information will also occur when the linker script directs the linker
|
||||
to create a symbol. Note that, regardless of how a hash table entry is
|
||||
added, all the fields will be initialized to some sort of null value by
|
||||
the hash table entry initialization function.
|
||||
|
||||
See `ecoff_link_add_externals' for an example of how to check the
|
||||
`creator' field before saving information (in this case, the ECOFF
|
||||
external symbol debugging information) in a hash table entry.
|
||||
|
||||
|
||||
File: bfd.info, Node: Adding symbols from an object file, Next: Adding symbols from an archive, Prev: Differing file formats, Up: Adding Symbols to the Hash Table
|
||||
|
||||
Adding symbols from an object file
|
||||
..................................
|
||||
|
||||
When the `_bfd_link_add_symbols' routine is passed an object file,
|
||||
it must add all externally visible symbols in that object file to the
|
||||
hash table. The actual work of adding the symbol to the hash table is
|
||||
normally handled by the function `_bfd_generic_link_add_one_symbol'.
|
||||
The `_bfd_link_add_symbols' routine is responsible for reading all the
|
||||
symbols from the object file and passing the correct information to
|
||||
`_bfd_generic_link_add_one_symbol'.
|
||||
|
||||
The `_bfd_link_add_symbols' routine should not use
|
||||
`bfd_canonicalize_symtab' to read the symbols. The point of providing
|
||||
this routine is to avoid the overhead of converting the symbols into
|
||||
generic `asymbol' structures.
|
||||
|
||||
`_bfd_generic_link_add_one_symbol' handles the details of combining
|
||||
common symbols, warning about multiple definitions, and so forth. It
|
||||
takes arguments which describe the symbol to add, notably symbol flags,
|
||||
a section, and an offset. The symbol flags include such things as
|
||||
`BSF_WEAK' or `BSF_INDIRECT'. The section is a section in the object
|
||||
file, or something like `bfd_und_section_ptr' for an undefined symbol
|
||||
or `bfd_com_section_ptr' for a common symbol.
|
||||
|
||||
If the `_bfd_final_link' routine is also going to need to read the
|
||||
symbol information, the `_bfd_link_add_symbols' routine should save it
|
||||
somewhere attached to the object file BFD. However, the information
|
||||
should only be saved if the `keep_memory' field of the `info' argument
|
||||
is true, so that the `-no-keep-memory' linker switch is effective.
|
||||
|
||||
The a.out function which adds symbols from an object file is
|
||||
`aout_link_add_object_symbols', and most of the interesting work is in
|
||||
`aout_link_add_symbols'. The latter saves pointers to the hash tables
|
||||
entries created by `_bfd_generic_link_add_one_symbol' indexed by symbol
|
||||
number, so that the `_bfd_final_link' routine does not have to call the
|
||||
hash table lookup routine to locate the entry.
|
||||
|
||||
|
||||
File: bfd.info, Node: Adding symbols from an archive, Prev: Adding symbols from an object file, Up: Adding Symbols to the Hash Table
|
||||
|
||||
Adding symbols from an archive
|
||||
..............................
|
||||
|
||||
When the `_bfd_link_add_symbols' routine is passed an archive, it
|
||||
must look through the symbols defined by the archive and decide which
|
||||
elements of the archive should be included in the link. For each such
|
||||
element it must call the `add_archive_element' linker callback, and it
|
||||
must add the symbols from the object file to the linker hash table.
|
||||
|
||||
In most cases the work of looking through the symbols in the archive
|
||||
should be done by the `_bfd_generic_link_add_archive_symbols' function.
|
||||
This function builds a hash table from the archive symbol table and
|
||||
looks through the list of undefined symbols to see which elements
|
||||
should be included. `_bfd_generic_link_add_archive_symbols' is passed
|
||||
a function to call to make the final decision about adding an archive
|
||||
element to the link and to do the actual work of adding the symbols to
|
||||
the linker hash table.
|
||||
|
||||
The function passed to `_bfd_generic_link_add_archive_symbols' must
|
||||
read the symbols of the archive element and decide whether the archive
|
||||
element should be included in the link. If the element is to be
|
||||
included, the `add_archive_element' linker callback routine must be
|
||||
called with the element as an argument, and the elements symbols must
|
||||
be added to the linker hash table just as though the element had itself
|
||||
been passed to the `_bfd_link_add_symbols' function.
|
||||
|
||||
When the a.out `_bfd_link_add_symbols' function receives an archive,
|
||||
it calls `_bfd_generic_link_add_archive_symbols' passing
|
||||
`aout_link_check_archive_element' as the function argument.
|
||||
`aout_link_check_archive_element' calls `aout_link_check_ar_symbols'.
|
||||
If the latter decides to add the element (an element is only added if
|
||||
it provides a real, non-common, definition for a previously undefined
|
||||
or common symbol) it calls the `add_archive_element' callback and then
|
||||
`aout_link_check_archive_element' calls `aout_link_add_symbols' to
|
||||
actually add the symbols to the linker hash table.
|
||||
|
||||
The ECOFF back end is unusual in that it does not normally call
|
||||
`_bfd_generic_link_add_archive_symbols', because ECOFF archives already
|
||||
contain a hash table of symbols. The ECOFF back end searches the
|
||||
archive itself to avoid the overhead of creating a new hash table.
|
||||
|
||||
|
||||
File: bfd.info, Node: Performing the Final Link, Prev: Adding Symbols to the Hash Table, Up: Linker Functions
|
||||
|
||||
Performing the final link
|
||||
-------------------------
|
||||
|
||||
When all the input files have been processed, the linker calls the
|
||||
`_bfd_final_link' entry point of the output BFD. This routine is
|
||||
responsible for producing the final output file, which has several
|
||||
aspects. It must relocate the contents of the input sections and copy
|
||||
the data into the output sections. It must build an output symbol
|
||||
table including any local symbols from the input files and the global
|
||||
symbols from the hash table. When producing relocateable output, it
|
||||
must modify the input relocs and write them into the output file.
|
||||
There may also be object format dependent work to be done.
|
||||
|
||||
The linker will also call the `write_object_contents' entry point
|
||||
when the BFD is closed. The two entry points must work together in
|
||||
order to produce the correct output file.
|
||||
|
||||
The details of how this works are inevitably dependent upon the
|
||||
specific object file format. The a.out `_bfd_final_link' routine is
|
||||
`NAME(aout,final_link)'.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Information provided by the linker::
|
||||
* Relocating the section contents::
|
||||
* Writing the symbol table::
|
||||
|
||||
|
||||
File: bfd.info, Node: Information provided by the linker, Next: Relocating the section contents, Prev: Performing the Final Link, Up: Performing the Final Link
|
||||
|
||||
Information provided by the linker
|
||||
..................................
|
||||
|
||||
Before the linker calls the `_bfd_final_link' entry point, it sets
|
||||
up some data structures for the function to use.
|
||||
|
||||
The `input_bfds' field of the `bfd_link_info' structure will point
|
||||
to a list of all the input files included in the link. These files are
|
||||
linked through the `link_next' field of the `bfd' structure.
|
||||
|
||||
Each section in the output file will have a list of `link_order'
|
||||
structures attached to the `link_order_head' field (the `link_order'
|
||||
structure is defined in `bfdlink.h'). These structures describe how to
|
||||
create the contents of the output section in terms of the contents of
|
||||
various input sections, fill constants, and, eventually, other types of
|
||||
information. They also describe relocs that must be created by the BFD
|
||||
backend, but do not correspond to any input file; this is used to
|
||||
support -Ur, which builds constructors while generating a relocateable
|
||||
object file.
|
||||
|
||||
|
||||
File: bfd.info, Node: Relocating the section contents, Next: Writing the symbol table, Prev: Information provided by the linker, Up: Performing the Final Link
|
||||
|
||||
Relocating the section contents
|
||||
...............................
|
||||
|
||||
The `_bfd_final_link' function should look through the `link_order'
|
||||
structures attached to each section of the output file. Each
|
||||
`link_order' structure should either be handled specially, or it should
|
||||
be passed to the function `_bfd_default_link_order' which will do the
|
||||
right thing (`_bfd_default_link_order' is defined in `linker.c').
|
||||
|
||||
For efficiency, a `link_order' of type `bfd_indirect_link_order'
|
||||
whose associated section belongs to a BFD of the same format as the
|
||||
output BFD must be handled specially. This type of `link_order'
|
||||
describes part of an output section in terms of a section belonging to
|
||||
one of the input files. The `_bfd_final_link' function should read the
|
||||
contents of the section and any associated relocs, apply the relocs to
|
||||
the section contents, and write out the modified section contents. If
|
||||
performing a relocateable link, the relocs themselves must also be
|
||||
modified and written out.
|
||||
|
||||
The functions `_bfd_relocate_contents' and
|
||||
`_bfd_final_link_relocate' provide some general support for performing
|
||||
the actual relocations, notably overflow checking. Their arguments
|
||||
include information about the symbol the relocation is against and a
|
||||
`reloc_howto_type' argument which describes the relocation to perform.
|
||||
These functions are defined in `reloc.c'.
|
||||
|
||||
The a.out function which handles reading, relocating, and writing
|
||||
section contents is `aout_link_input_section'. The actual relocation
|
||||
is done in `aout_link_input_section_std' and
|
||||
`aout_link_input_section_ext'.
|
||||
|
||||
|
||||
File: bfd.info, Node: Writing the symbol table, Prev: Relocating the section contents, Up: Performing the Final Link
|
||||
|
||||
Writing the symbol table
|
||||
........................
|
||||
|
||||
The `_bfd_final_link' function must gather all the symbols in the
|
||||
input files and write them out. It must also write out all the symbols
|
||||
in the global hash table. This must be controlled by the `strip' and
|
||||
`discard' fields of the `bfd_link_info' structure.
|
||||
|
||||
The local symbols of the input files will not have been entered into
|
||||
the linker hash table. The `_bfd_final_link' routine must consider
|
||||
each input file and include the symbols in the output file. It may be
|
||||
convenient to do this when looking through the `link_order' structures,
|
||||
or it may be done by stepping through the `input_bfds' list.
|
||||
|
||||
The `_bfd_final_link' routine must also traverse the global hash
|
||||
table to gather all the externally visible symbols. It is possible
|
||||
that most of the externally visible symbols may be written out when
|
||||
considering the symbols of each input file, but it is still necessary
|
||||
to traverse the hash table since the linker script may have defined
|
||||
some symbols that are not in any of the input files.
|
||||
|
||||
The `strip' field of the `bfd_link_info' structure controls which
|
||||
symbols are written out. The possible values are listed in
|
||||
`bfdlink.h'. If the value is `strip_some', then the `keep_hash' field
|
||||
of the `bfd_link_info' structure is a hash table of symbols to keep;
|
||||
each symbol should be looked up in this hash table, and only symbols
|
||||
which are present should be included in the output file.
|
||||
|
||||
If the `strip' field of the `bfd_link_info' structure permits local
|
||||
symbols to be written out, the `discard' field is used to further
|
||||
controls which local symbols are included in the output file. If the
|
||||
value is `discard_l', then all local symbols which begin with a certain
|
||||
prefix are discarded; this is controlled by the
|
||||
`bfd_is_local_label_name' entry point.
|
||||
|
||||
The a.out backend handles symbols by calling
|
||||
`aout_link_write_symbols' on each input BFD and then traversing the
|
||||
global hash table with the function `aout_link_write_other_symbol'. It
|
||||
builds a string table while writing out the symbols, which is written
|
||||
to the output file at the end of `NAME(aout,final_link)'.
|
||||
|
||||
`bfd_link_split_section'
|
||||
........................
|
||||
|
||||
*Synopsis*
|
||||
boolean bfd_link_split_section(bfd *abfd, asection *sec);
|
||||
*Description*
|
||||
Return nonzero if SEC should be split during a reloceatable or final
|
||||
link.
|
||||
#define bfd_link_split_section(abfd, sec) \
|
||||
BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
|
||||
|
||||
|
||||
File: bfd.info, Node: Hash Tables, Prev: Linker Functions, Up: BFD front end
|
||||
|
||||
Hash Tables
|
||||
===========
|
||||
|
||||
BFD provides a simple set of hash table functions. Routines are
|
||||
provided to initialize a hash table, to free a hash table, to look up a
|
||||
string in a hash table and optionally create an entry for it, and to
|
||||
traverse a hash table. There is currently no routine to delete an
|
||||
string from a hash table.
|
||||
|
||||
The basic hash table does not permit any data to be stored with a
|
||||
string. However, a hash table is designed to present a base class from
|
||||
which other types of hash tables may be derived. These derived types
|
||||
may store additional information with the string. Hash tables were
|
||||
implemented in this way, rather than simply providing a data pointer in
|
||||
a hash table entry, because they were designed for use by the linker
|
||||
back ends. The linker may create thousands of hash table entries, and
|
||||
the overhead of allocating private data and storing and following
|
||||
pointers becomes noticeable.
|
||||
|
||||
The basic hash table code is in `hash.c'.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Creating and Freeing a Hash Table::
|
||||
* Looking Up or Entering a String::
|
||||
* Traversing a Hash Table::
|
||||
* Deriving a New Hash Table Type::
|
||||
|
||||
|
||||
File: bfd.info, Node: Creating and Freeing a Hash Table, Next: Looking Up or Entering a String, Prev: Hash Tables, Up: Hash Tables
|
||||
|
||||
Creating and freeing a hash table
|
||||
---------------------------------
|
||||
|
||||
To create a hash table, create an instance of a `struct
|
||||
bfd_hash_table' (defined in `bfd.h') and call `bfd_hash_table_init' (if
|
||||
you know approximately how many entries you will need, the function
|
||||
`bfd_hash_table_init_n', which takes a SIZE argument, may be used).
|
||||
`bfd_hash_table_init' returns `false' if some sort of error occurs.
|
||||
|
||||
The function `bfd_hash_table_init' take as an argument a function to
|
||||
use to create new entries. For a basic hash table, use the function
|
||||
`bfd_hash_newfunc'. *Note Deriving a New Hash Table Type::, for why
|
||||
you would want to use a different value for this argument.
|
||||
|
||||
`bfd_hash_table_init' will create an objalloc which will be used to
|
||||
allocate new entries. You may allocate memory on this objalloc using
|
||||
`bfd_hash_allocate'.
|
||||
|
||||
Use `bfd_hash_table_free' to free up all the memory that has been
|
||||
allocated for a hash table. This will not free up the `struct
|
||||
bfd_hash_table' itself, which you must provide.
|
||||
|
||||
|
||||
File: bfd.info, Node: Looking Up or Entering a String, Next: Traversing a Hash Table, Prev: Creating and Freeing a Hash Table, Up: Hash Tables
|
||||
|
||||
Looking up or entering a string
|
||||
-------------------------------
|
||||
|
||||
The function `bfd_hash_lookup' is used both to look up a string in
|
||||
the hash table and to create a new entry.
|
||||
|
||||
If the CREATE argument is `false', `bfd_hash_lookup' will look up a
|
||||
string. If the string is found, it will returns a pointer to a `struct
|
||||
bfd_hash_entry'. If the string is not found in the table
|
||||
`bfd_hash_lookup' will return `NULL'. You should not modify any of the
|
||||
fields in the returns `struct bfd_hash_entry'.
|
||||
|
||||
If the CREATE argument is `true', the string will be entered into
|
||||
the hash table if it is not already there. Either way a pointer to a
|
||||
`struct bfd_hash_entry' will be returned, either to the existing
|
||||
structure or to a newly created one. In this case, a `NULL' return
|
||||
means that an error occurred.
|
||||
|
||||
If the CREATE argument is `true', and a new entry is created, the
|
||||
COPY argument is used to decide whether to copy the string onto the
|
||||
hash table objalloc or not. If COPY is passed as `false', you must be
|
||||
careful not to deallocate or modify the string as long as the hash table
|
||||
exists.
|
||||
|
||||
|
||||
File: bfd.info, Node: Traversing a Hash Table, Next: Deriving a New Hash Table Type, Prev: Looking Up or Entering a String, Up: Hash Tables
|
||||
|
||||
Traversing a hash table
|
||||
-----------------------
|
||||
|
||||
The function `bfd_hash_traverse' may be used to traverse a hash
|
||||
table, calling a function on each element. The traversal is done in a
|
||||
random order.
|
||||
|
||||
`bfd_hash_traverse' takes as arguments a function and a generic
|
||||
`void *' pointer. The function is called with a hash table entry (a
|
||||
`struct bfd_hash_entry *') and the generic pointer passed to
|
||||
`bfd_hash_traverse'. The function must return a `boolean' value, which
|
||||
indicates whether to continue traversing the hash table. If the
|
||||
function returns `false', `bfd_hash_traverse' will stop the traversal
|
||||
and return immediately.
|
||||
|
||||
|
||||
File: bfd.info, Node: Deriving a New Hash Table Type, Prev: Traversing a Hash Table, Up: Hash Tables
|
||||
|
||||
Deriving a new hash table type
|
||||
------------------------------
|
||||
|
||||
Many uses of hash tables want to store additional information which
|
||||
each entry in the hash table. Some also find it convenient to store
|
||||
additional information with the hash table itself. This may be done
|
||||
using a derived hash table.
|
||||
|
||||
Since C is not an object oriented language, creating a derived hash
|
||||
table requires sticking together some boilerplate routines with a few
|
||||
differences specific to the type of hash table you want to create.
|
||||
|
||||
An example of a derived hash table is the linker hash table. The
|
||||
structures for this are defined in `bfdlink.h'. The functions are in
|
||||
`linker.c'.
|
||||
|
||||
You may also derive a hash table from an already derived hash table.
|
||||
For example, the a.out linker backend code uses a hash table derived
|
||||
from the linker hash table.
|
||||
|
||||
* Menu:
|
||||
|
||||
* Define the Derived Structures::
|
||||
* Write the Derived Creation Routine::
|
||||
* Write Other Derived Routines::
|
||||
|
||||
|
||||
File: bfd.info, Node: Define the Derived Structures, Next: Write the Derived Creation Routine, Prev: Deriving a New Hash Table Type, Up: Deriving a New Hash Table Type
|
||||
|
||||
Define the derived structures
|
||||
.............................
|
||||
|
||||
You must define a structure for an entry in the hash table, and a
|
||||
structure for the hash table itself.
|
||||
|
||||
The first field in the structure for an entry in the hash table must
|
||||
be of the type used for an entry in the hash table you are deriving
|
||||
from. If you are deriving from a basic hash table this is `struct
|
||||
bfd_hash_entry', which is defined in `bfd.h'. The first field in the
|
||||
structure for the hash table itself must be of the type of the hash
|
||||
table you are deriving from itself. If you are deriving from a basic
|
||||
hash table, this is `struct bfd_hash_table'.
|
||||
|
||||
For example, the linker hash table defines `struct
|
||||
bfd_link_hash_entry' (in `bfdlink.h'). The first field, `root', is of
|
||||
type `struct bfd_hash_entry'. Similarly, the first field in `struct
|
||||
bfd_link_hash_table', `table', is of type `struct bfd_hash_table'.
|
||||
|
||||
|
||||
File: bfd.info, Node: Write the Derived Creation Routine, Next: Write Other Derived Routines, Prev: Define the Derived Structures, Up: Deriving a New Hash Table Type
|
||||
|
||||
Write the derived creation routine
|
||||
..................................
|
||||
|
||||
You must write a routine which will create and initialize an entry
|
||||
in the hash table. This routine is passed as the function argument to
|
||||
`bfd_hash_table_init'.
|
||||
|
||||
In order to permit other hash tables to be derived from the hash
|
||||
table you are creating, this routine must be written in a standard way.
|
||||
|
||||
The first argument to the creation routine is a pointer to a hash
|
||||
table entry. This may be `NULL', in which case the routine should
|
||||
allocate the right amount of space. Otherwise the space has already
|
||||
been allocated by a hash table type derived from this one.
|
||||
|
||||
After allocating space, the creation routine must call the creation
|
||||
routine of the hash table type it is derived from, passing in a pointer
|
||||
to the space it just allocated. This will initialize any fields used
|
||||
by the base hash table.
|
||||
|
||||
Finally the creation routine must initialize any local fields for
|
||||
the new hash table type.
|
||||
|
||||
Here is a boilerplate example of a creation routine. FUNCTION_NAME
|
||||
is the name of the routine. ENTRY_TYPE is the type of an entry in the
|
||||
hash table you are creating. BASE_NEWFUNC is the name of the creation
|
||||
routine of the hash table type your hash table is derived from.
|
||||
|
||||
struct bfd_hash_entry *
|
||||
FUNCTION_NAME (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
{
|
||||
struct ENTRY_TYPE *ret = (ENTRY_TYPE *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
derived class. */
|
||||
if (ret == (ENTRY_TYPE *) NULL)
|
||||
{
|
||||
ret = ((ENTRY_TYPE *)
|
||||
bfd_hash_allocate (table, sizeof (ENTRY_TYPE)));
|
||||
if (ret == (ENTRY_TYPE *) NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Call the allocation method of the base class. */
|
||||
ret = ((ENTRY_TYPE *)
|
||||
BASE_NEWFUNC ((struct bfd_hash_entry *) ret, table, string));
|
||||
|
||||
/* Initialize the local fields here. */
|
||||
|
||||
return (struct bfd_hash_entry *) ret;
|
||||
}
|
||||
*Description*
|
||||
The creation routine for the linker hash table, which is in `linker.c',
|
||||
looks just like this example. FUNCTION_NAME is
|
||||
`_bfd_link_hash_newfunc'. ENTRY_TYPE is `struct bfd_link_hash_entry'.
|
||||
BASE_NEWFUNC is `bfd_hash_newfunc', the creation routine for a basic
|
||||
hash table.
|
||||
|
||||
`_bfd_link_hash_newfunc' also initializes the local fields in a
|
||||
linker hash table entry: `type', `written' and `next'.
|
||||
|
||||
|
||||
File: bfd.info, Node: Write Other Derived Routines, Prev: Write the Derived Creation Routine, Up: Deriving a New Hash Table Type
|
||||
|
||||
Write other derived routines
|
||||
............................
|
||||
|
||||
You will want to write other routines for your new hash table, as
|
||||
well.
|
||||
|
||||
You will want an initialization routine which calls the
|
||||
initialization routine of the hash table you are deriving from and
|
||||
initializes any other local fields. For the linker hash table, this is
|
||||
`_bfd_link_hash_table_init' in `linker.c'.
|
||||
|
||||
You will want a lookup routine which calls the lookup routine of the
|
||||
hash table you are deriving from and casts the result. The linker hash
|
||||
table uses `bfd_link_hash_lookup' in `linker.c' (this actually takes an
|
||||
additional argument which it uses to decide how to return the looked up
|
||||
value).
|
||||
|
||||
You may want a traversal routine. This should just call the
|
||||
traversal routine of the hash table you are deriving from with
|
||||
appropriate casts. The linker hash table uses `bfd_link_hash_traverse'
|
||||
in `linker.c'.
|
||||
|
||||
These routines may simply be defined as macros. For example, the
|
||||
a.out backend linker hash table, which is derived from the linker hash
|
||||
table, uses macros for the lookup and traversal routines. These are
|
||||
`aout_link_hash_lookup' and `aout_link_hash_traverse' in aoutx.h.
|
||||
|
||||
|
||||
File: bfd.info, Node: BFD back ends, Next: Index, Prev: BFD front end, Up: Top
|
||||
|
||||
BFD back ends
|
||||
*************
|
||||
|
||||
* Menu:
|
||||
|
||||
* What to Put Where::
|
||||
* aout :: a.out backends
|
||||
* coff :: coff backends
|
||||
* elf :: elf backends
|
||||
|
||||
|
||||
File: bfd.info, Node: What to Put Where, Next: aout, Prev: BFD back ends, Up: BFD back ends
|
||||
|
||||
All of BFD lives in one directory.
|
||||
|
||||
|
||||
File: bfd.info, Node: aout, Next: coff, Prev: What to Put Where, Up: BFD back ends
|
||||
|
||||
a.out backends
|
||||
==============
|
||||
|
||||
*Description*
|
||||
BFD supports a number of different flavours of a.out format, though the
|
||||
major differences are only the sizes of the structures on disk, and the
|
||||
shape of the relocation information.
|
||||
|
||||
The support is split into a basic support file `aoutx.h' and other
|
||||
files which derive functions from the base. One derivation file is
|
||||
`aoutf1.h' (for a.out flavour 1), and adds to the basic a.out functions
|
||||
support for sun3, sun4, 386 and 29k a.out files, to create a target
|
||||
jump vector for a specific target.
|
||||
|
||||
This information is further split out into more specific files for
|
||||
each machine, including `sunos.c' for sun3 and sun4, `newsos3.c' for
|
||||
the Sony NEWS, and `demo64.c' for a demonstration of a 64 bit a.out
|
||||
format.
|
||||
|
||||
The base file `aoutx.h' defines general mechanisms for reading and
|
||||
writing records to and from disk and various other methods which BFD
|
||||
requires. It is included by `aout32.c' and `aout64.c' to form the names
|
||||
`aout_32_swap_exec_header_in', `aout_64_swap_exec_header_in', etc.
|
||||
|
||||
As an example, this is what goes on to make the back end for a sun4,
|
||||
from `aout32.c':
|
||||
|
||||
#define ARCH_SIZE 32
|
||||
#include "aoutx.h"
|
||||
|
||||
Which exports names:
|
||||
|
||||
...
|
||||
aout_32_canonicalize_reloc
|
||||
aout_32_find_nearest_line
|
||||
aout_32_get_lineno
|
||||
aout_32_get_reloc_upper_bound
|
||||
...
|
||||
|
||||
from `sunos.c':
|
||||
|
||||
#define TARGET_NAME "a.out-sunos-big"
|
||||
#define VECNAME sunos_big_vec
|
||||
#include "aoutf1.h"
|
||||
|
||||
requires all the names from `aout32.c', and produces the jump vector
|
||||
|
||||
sunos_big_vec
|
||||
|
||||
The file `host-aout.c' is a special case. It is for a large set of
|
||||
hosts that use "more or less standard" a.out files, and for which
|
||||
cross-debugging is not interesting. It uses the standard 32-bit a.out
|
||||
support routines, but determines the file offsets and addresses of the
|
||||
text, data, and BSS sections, the machine architecture and machine
|
||||
type, and the entry point address, in a host-dependent manner. Once
|
||||
these values have been determined, generic code is used to handle the
|
||||
object file.
|
||||
|
||||
When porting it to run on a new system, you must supply:
|
||||
|
||||
HOST_PAGE_SIZE
|
||||
HOST_SEGMENT_SIZE
|
||||
HOST_MACHINE_ARCH (optional)
|
||||
HOST_MACHINE_MACHINE (optional)
|
||||
HOST_TEXT_START_ADDR
|
||||
HOST_STACK_END_ADDR
|
||||
|
||||
in the file `../include/sys/h-XXX.h' (for your host). These values,
|
||||
plus the structures and macros defined in `a.out.h' on your host
|
||||
system, will produce a BFD target that will access ordinary a.out files
|
||||
on your host. To configure a new machine to use `host-aout.c', specify:
|
||||
|
||||
TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
|
||||
TDEPFILES= host-aout.o trad-core.o
|
||||
|
||||
in the `config/XXX.mt' file, and modify `configure.in' to use the
|
||||
`XXX.mt' file (by setting "`bfd_target=XXX'") when your configuration
|
||||
is selected.
|
||||
|
||||
Relocations
|
||||
-----------
|
||||
|
||||
*Description*
|
||||
The file `aoutx.h' provides for both the _standard_ and _extended_
|
||||
forms of a.out relocation records.
|
||||
|
||||
The standard records contain only an address, a symbol index, and a
|
||||
type field. The extended records (used on 29ks and sparcs) also have a
|
||||
full integer for an addend.
|
||||
|
||||
Internal entry points
|
||||
---------------------
|
||||
|
||||
*Description*
|
||||
`aoutx.h' exports several routines for accessing the contents of an
|
||||
a.out file, which are gathered and exported in turn by various format
|
||||
specific files (eg sunos.c).
|
||||
|
||||
`aout_SIZE_swap_exec_header_in'
|
||||
...............................
|
||||
|
||||
*Synopsis*
|
||||
void aout_SIZE_swap_exec_header_in,
|
||||
(bfd *abfd,
|
||||
struct external_exec *raw_bytes,
|
||||
struct internal_exec *execp);
|
||||
*Description*
|
||||
Swap the information in an executable header RAW_BYTES taken from a raw
|
||||
byte stream memory image into the internal exec header structure EXECP.
|
||||
|
||||
`aout_SIZE_swap_exec_header_out'
|
||||
................................
|
||||
|
||||
*Synopsis*
|
||||
void aout_SIZE_swap_exec_header_out
|
||||
(bfd *abfd,
|
||||
struct internal_exec *execp,
|
||||
struct external_exec *raw_bytes);
|
||||
*Description*
|
||||
Swap the information in an internal exec header structure EXECP into
|
||||
the buffer RAW_BYTES ready for writing to disk.
|
||||
|
||||
`aout_SIZE_some_aout_object_p'
|
||||
..............................
|
||||
|
||||
*Synopsis*
|
||||
const bfd_target *aout_SIZE_some_aout_object_p
|
||||
(bfd *abfd,
|
||||
const bfd_target *(*callback_to_real_object_p)());
|
||||
*Description*
|
||||
Some a.out variant thinks that the file open in ABFD checking is an
|
||||
a.out file. Do some more checking, and set up for access if it really
|
||||
is. Call back to the calling environment's "finish up" function just
|
||||
before returning, to handle any last-minute setup.
|
||||
|
||||
`aout_SIZE_mkobject'
|
||||
....................
|
||||
|
||||
*Synopsis*
|
||||
boolean aout_SIZE_mkobject, (bfd *abfd);
|
||||
*Description*
|
||||
Initialize BFD ABFD for use with a.out files.
|
||||
|
||||
`aout_SIZE_machine_type'
|
||||
........................
|
||||
|
||||
*Synopsis*
|
||||
enum machine_type aout_SIZE_machine_type
|
||||
(enum bfd_architecture arch,
|
||||
unsigned long machine));
|
||||
*Description*
|
||||
Keep track of machine architecture and machine type for a.out's. Return
|
||||
the `machine_type' for a particular architecture and machine, or
|
||||
`M_UNKNOWN' if that exact architecture and machine can't be represented
|
||||
in a.out format.
|
||||
|
||||
If the architecture is understood, machine type 0 (default) is
|
||||
always understood.
|
||||
|
||||
`aout_SIZE_set_arch_mach'
|
||||
.........................
|
||||
|
||||
*Synopsis*
|
||||
boolean aout_SIZE_set_arch_mach,
|
||||
(bfd *,
|
||||
enum bfd_architecture arch,
|
||||
unsigned long machine));
|
||||
*Description*
|
||||
Set the architecture and the machine of the BFD ABFD to the values ARCH
|
||||
and MACHINE. Verify that ABFD's format can support the architecture
|
||||
required.
|
||||
|
||||
`aout_SIZE_new_section_hook'
|
||||
............................
|
||||
|
||||
*Synopsis*
|
||||
boolean aout_SIZE_new_section_hook,
|
||||
(bfd *abfd,
|
||||
asection *newsect));
|
||||
*Description*
|
||||
Called by the BFD in response to a `bfd_make_section' request.
|
||||
|
||||
683
bfd/doc/bfd.info-6
Normal file
683
bfd/doc/bfd.info-6
Normal file
@@ -0,0 +1,683 @@
|
||||
This is bfd.info, produced by makeinfo version 4.0 from bfd.texinfo.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* Bfd: (bfd). The Binary File Descriptor library.
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
This file documents the BFD library.
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, subject to the
|
||||
terms of the GNU General Public License, which includes the provision
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions.
|
||||
|
||||
|
||||
File: bfd.info, Node: coff, Next: elf, Prev: aout, Up: BFD back ends
|
||||
|
||||
coff backends
|
||||
=============
|
||||
|
||||
BFD supports a number of different flavours of coff format. The
|
||||
major differences between formats are the sizes and alignments of
|
||||
fields in structures on disk, and the occasional extra field.
|
||||
|
||||
Coff in all its varieties is implemented with a few common files and
|
||||
a number of implementation specific files. For example, The 88k bcs
|
||||
coff format is implemented in the file `coff-m88k.c'. This file
|
||||
`#include's `coff/m88k.h' which defines the external structure of the
|
||||
coff format for the 88k, and `coff/internal.h' which defines the
|
||||
internal structure. `coff-m88k.c' also defines the relocations used by
|
||||
the 88k format *Note Relocations::.
|
||||
|
||||
The Intel i960 processor version of coff is implemented in
|
||||
`coff-i960.c'. This file has the same structure as `coff-m88k.c',
|
||||
except that it includes `coff/i960.h' rather than `coff-m88k.h'.
|
||||
|
||||
Porting to a new version of coff
|
||||
--------------------------------
|
||||
|
||||
The recommended method is to select from the existing
|
||||
implementations the version of coff which is most like the one you want
|
||||
to use. For example, we'll say that i386 coff is the one you select,
|
||||
and that your coff flavour is called foo. Copy `i386coff.c' to
|
||||
`foocoff.c', copy `../include/coff/i386.h' to `../include/coff/foo.h',
|
||||
and add the lines to `targets.c' and `Makefile.in' so that your new
|
||||
back end is used. Alter the shapes of the structures in
|
||||
`../include/coff/foo.h' so that they match what you need. You will
|
||||
probably also have to add `#ifdef's to the code in `coff/internal.h' and
|
||||
`coffcode.h' if your version of coff is too wild.
|
||||
|
||||
You can verify that your new BFD backend works quite simply by
|
||||
building `objdump' from the `binutils' directory, and making sure that
|
||||
its version of what's going on and your host system's idea (assuming it
|
||||
has the pretty standard coff dump utility, usually called `att-dump' or
|
||||
just `dump') are the same. Then clean up your code, and send what
|
||||
you've done to Cygnus. Then your stuff will be in the next release, and
|
||||
you won't have to keep integrating it.
|
||||
|
||||
How the coff backend works
|
||||
--------------------------
|
||||
|
||||
File layout
|
||||
...........
|
||||
|
||||
The Coff backend is split into generic routines that are applicable
|
||||
to any Coff target and routines that are specific to a particular
|
||||
target. The target-specific routines are further split into ones which
|
||||
are basically the same for all Coff targets except that they use the
|
||||
external symbol format or use different values for certain constants.
|
||||
|
||||
The generic routines are in `coffgen.c'. These routines work for
|
||||
any Coff target. They use some hooks into the target specific code;
|
||||
the hooks are in a `bfd_coff_backend_data' structure, one of which
|
||||
exists for each target.
|
||||
|
||||
The essentially similar target-specific routines are in
|
||||
`coffcode.h'. This header file includes executable C code. The
|
||||
various Coff targets first include the appropriate Coff header file,
|
||||
make any special defines that are needed, and then include `coffcode.h'.
|
||||
|
||||
Some of the Coff targets then also have additional routines in the
|
||||
target source file itself.
|
||||
|
||||
For example, `coff-i960.c' includes `coff/internal.h' and
|
||||
`coff/i960.h'. It then defines a few constants, such as `I960', and
|
||||
includes `coffcode.h'. Since the i960 has complex relocation types,
|
||||
`coff-i960.c' also includes some code to manipulate the i960 relocs.
|
||||
This code is not in `coffcode.h' because it would not be used by any
|
||||
other target.
|
||||
|
||||
Bit twiddling
|
||||
.............
|
||||
|
||||
Each flavour of coff supported in BFD has its own header file
|
||||
describing the external layout of the structures. There is also an
|
||||
internal description of the coff layout, in `coff/internal.h'. A major
|
||||
function of the coff backend is swapping the bytes and twiddling the
|
||||
bits to translate the external form of the structures into the normal
|
||||
internal form. This is all performed in the `bfd_swap'_thing_direction
|
||||
routines. Some elements are different sizes between different versions
|
||||
of coff; it is the duty of the coff version specific include file to
|
||||
override the definitions of various packing routines in `coffcode.h'.
|
||||
E.g., the size of line number entry in coff is sometimes 16 bits, and
|
||||
sometimes 32 bits. `#define'ing `PUT_LNSZ_LNNO' and `GET_LNSZ_LNNO'
|
||||
will select the correct one. No doubt, some day someone will find a
|
||||
version of coff which has a varying field size not catered to at the
|
||||
moment. To port BFD, that person will have to add more `#defines'.
|
||||
Three of the bit twiddling routines are exported to `gdb';
|
||||
`coff_swap_aux_in', `coff_swap_sym_in' and `coff_swap_lineno_in'. `GDB'
|
||||
reads the symbol table on its own, but uses BFD to fix things up. More
|
||||
of the bit twiddlers are exported for `gas'; `coff_swap_aux_out',
|
||||
`coff_swap_sym_out', `coff_swap_lineno_out', `coff_swap_reloc_out',
|
||||
`coff_swap_filehdr_out', `coff_swap_aouthdr_out',
|
||||
`coff_swap_scnhdr_out'. `Gas' currently keeps track of all the symbol
|
||||
table and reloc drudgery itself, thereby saving the internal BFD
|
||||
overhead, but uses BFD to swap things on the way out, making cross
|
||||
ports much safer. Doing so also allows BFD (and thus the linker) to
|
||||
use the same header files as `gas', which makes one avenue to disaster
|
||||
disappear.
|
||||
|
||||
Symbol reading
|
||||
..............
|
||||
|
||||
The simple canonical form for symbols used by BFD is not rich enough
|
||||
to keep all the information available in a coff symbol table. The back
|
||||
end gets around this problem by keeping the original symbol table
|
||||
around, "behind the scenes".
|
||||
|
||||
When a symbol table is requested (through a call to
|
||||
`bfd_canonicalize_symtab'), a request gets through to
|
||||
`coff_get_normalized_symtab'. This reads the symbol table from the coff
|
||||
file and swaps all the structures inside into the internal form. It
|
||||
also fixes up all the pointers in the table (represented in the file by
|
||||
offsets from the first symbol in the table) into physical pointers to
|
||||
elements in the new internal table. This involves some work since the
|
||||
meanings of fields change depending upon context: a field that is a
|
||||
pointer to another structure in the symbol table at one moment may be
|
||||
the size in bytes of a structure at the next. Another pass is made
|
||||
over the table. All symbols which mark file names (`C_FILE' symbols)
|
||||
are modified so that the internal string points to the value in the
|
||||
auxent (the real filename) rather than the normal text associated with
|
||||
the symbol (`".file"').
|
||||
|
||||
At this time the symbol names are moved around. Coff stores all
|
||||
symbols less than nine characters long physically within the symbol
|
||||
table; longer strings are kept at the end of the file in the string
|
||||
table. This pass moves all strings into memory and replaces them with
|
||||
pointers to the strings.
|
||||
|
||||
The symbol table is massaged once again, this time to create the
|
||||
canonical table used by the BFD application. Each symbol is inspected
|
||||
in turn, and a decision made (using the `sclass' field) about the
|
||||
various flags to set in the `asymbol'. *Note Symbols::. The generated
|
||||
canonical table shares strings with the hidden internal symbol table.
|
||||
|
||||
Any linenumbers are read from the coff file too, and attached to the
|
||||
symbols which own the functions the linenumbers belong to.
|
||||
|
||||
Symbol writing
|
||||
..............
|
||||
|
||||
Writing a symbol to a coff file which didn't come from a coff file
|
||||
will lose any debugging information. The `asymbol' structure remembers
|
||||
the BFD from which the symbol was taken, and on output the back end
|
||||
makes sure that the same destination target as source target is present.
|
||||
|
||||
When the symbols have come from a coff file then all the debugging
|
||||
information is preserved.
|
||||
|
||||
Symbol tables are provided for writing to the back end in a vector
|
||||
of pointers to pointers. This allows applications like the linker to
|
||||
accumulate and output large symbol tables without having to do too much
|
||||
byte copying.
|
||||
|
||||
This function runs through the provided symbol table and patches
|
||||
each symbol marked as a file place holder (`C_FILE') to point to the
|
||||
next file place holder in the list. It also marks each `offset' field
|
||||
in the list with the offset from the first symbol of the current symbol.
|
||||
|
||||
Another function of this procedure is to turn the canonical value
|
||||
form of BFD into the form used by coff. Internally, BFD expects symbol
|
||||
values to be offsets from a section base; so a symbol physically at
|
||||
0x120, but in a section starting at 0x100, would have the value 0x20.
|
||||
Coff expects symbols to contain their final value, so symbols have
|
||||
their values changed at this point to reflect their sum with their
|
||||
owning section. This transformation uses the `output_section' field of
|
||||
the `asymbol''s `asection' *Note Sections::.
|
||||
|
||||
* `coff_mangle_symbols'
|
||||
This routine runs though the provided symbol table and uses the
|
||||
offsets generated by the previous pass and the pointers generated when
|
||||
the symbol table was read in to create the structured hierachy required
|
||||
by coff. It changes each pointer to a symbol into the index into the
|
||||
symbol table of the asymbol.
|
||||
|
||||
* `coff_write_symbols'
|
||||
This routine runs through the symbol table and patches up the
|
||||
symbols from their internal form into the coff way, calls the bit
|
||||
twiddlers, and writes out the table to the file.
|
||||
|
||||
`coff_symbol_type'
|
||||
..................
|
||||
|
||||
*Description*
|
||||
The hidden information for an `asymbol' is described in a
|
||||
`combined_entry_type':
|
||||
|
||||
|
||||
typedef struct coff_ptr_struct
|
||||
{
|
||||
|
||||
/* Remembers the offset from the first symbol in the file for
|
||||
this symbol. Generated by coff_renumber_symbols. */
|
||||
unsigned int offset;
|
||||
|
||||
/* Should the value of this symbol be renumbered. Used for
|
||||
XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
|
||||
unsigned int fix_value : 1;
|
||||
|
||||
/* Should the tag field of this symbol be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_tag : 1;
|
||||
|
||||
/* Should the endidx field of this symbol be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_end : 1;
|
||||
|
||||
/* Should the x_csect.x_scnlen field be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_scnlen : 1;
|
||||
|
||||
/* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
|
||||
index into the line number entries. Set by
|
||||
coff_slurp_symbol_table. */
|
||||
unsigned int fix_line : 1;
|
||||
|
||||
/* The container for the symbol structure as read and translated
|
||||
from the file. */
|
||||
|
||||
union {
|
||||
union internal_auxent auxent;
|
||||
struct internal_syment syment;
|
||||
} u;
|
||||
} combined_entry_type;
|
||||
|
||||
|
||||
/* Each canonical asymbol really looks like this: */
|
||||
|
||||
typedef struct coff_symbol_struct
|
||||
{
|
||||
/* The actual symbol which the rest of BFD works with */
|
||||
asymbol symbol;
|
||||
|
||||
/* A pointer to the hidden information for this symbol */
|
||||
combined_entry_type *native;
|
||||
|
||||
/* A pointer to the linenumber information for this symbol */
|
||||
struct lineno_cache_entry *lineno;
|
||||
|
||||
/* Have the line numbers been relocated yet ? */
|
||||
boolean done_lineno;
|
||||
} coff_symbol_type;
|
||||
|
||||
`bfd_coff_backend_data'
|
||||
.......................
|
||||
|
||||
/* COFF symbol classifications. */
|
||||
|
||||
enum coff_symbol_classification
|
||||
{
|
||||
/* Global symbol. */
|
||||
COFF_SYMBOL_GLOBAL,
|
||||
/* Common symbol. */
|
||||
COFF_SYMBOL_COMMON,
|
||||
/* Undefined symbol. */
|
||||
COFF_SYMBOL_UNDEFINED,
|
||||
/* Local symbol. */
|
||||
COFF_SYMBOL_LOCAL,
|
||||
/* PE section symbol. */
|
||||
COFF_SYMBOL_PE_SECTION
|
||||
};
|
||||
Special entry points for gdb to swap in coff symbol table parts:
|
||||
typedef struct
|
||||
{
|
||||
void (*_bfd_coff_swap_aux_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
int type,
|
||||
int class,
|
||||
int indaux,
|
||||
int numaux,
|
||||
PTR in));
|
||||
|
||||
void (*_bfd_coff_swap_sym_in) PARAMS ((
|
||||
bfd *abfd ,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
|
||||
void (*_bfd_coff_swap_lineno_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
Special entry points for gas to swap out coff parts:
|
||||
unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
int type,
|
||||
int class,
|
||||
int indaux,
|
||||
int numaux,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR src,
|
||||
PTR dst));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
Special entry points for generic COFF routines to call target
|
||||
dependent COFF routines:
|
||||
unsigned int _bfd_filhsz;
|
||||
unsigned int _bfd_aoutsz;
|
||||
unsigned int _bfd_scnhsz;
|
||||
unsigned int _bfd_symesz;
|
||||
unsigned int _bfd_auxesz;
|
||||
unsigned int _bfd_relsz;
|
||||
unsigned int _bfd_linesz;
|
||||
unsigned int _bfd_filnmlen;
|
||||
boolean _bfd_coff_long_filenames;
|
||||
boolean _bfd_coff_long_section_names;
|
||||
unsigned int _bfd_coff_default_section_alignment_power;
|
||||
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_reloc_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr));
|
||||
boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr));
|
||||
PTR (*_bfd_coff_mkobject_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr,
|
||||
PTR internal_aouthdr));
|
||||
flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_scnhdr,
|
||||
const char *name,
|
||||
asection *section));
|
||||
void (*_bfd_set_alignment_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
PTR internal_scnhdr));
|
||||
boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
|
||||
bfd *abfd));
|
||||
boolean (*_bfd_coff_symname_in_debug) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *sym));
|
||||
boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
combined_entry_type *table_base,
|
||||
combined_entry_type *symbol,
|
||||
unsigned int indaux,
|
||||
combined_entry_type *aux));
|
||||
boolean (*_bfd_coff_print_aux) PARAMS ((
|
||||
bfd *abfd,
|
||||
FILE *file,
|
||||
combined_entry_type *table_base,
|
||||
combined_entry_type *symbol,
|
||||
combined_entry_type *aux,
|
||||
unsigned int indaux));
|
||||
void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct bfd_link_info *link_info,
|
||||
struct bfd_link_order *link_order,
|
||||
arelent *reloc,
|
||||
bfd_byte *data,
|
||||
unsigned int *src_ptr,
|
||||
unsigned int *dst_ptr));
|
||||
int (*_bfd_coff_reloc16_estimate) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *input_section,
|
||||
arelent *r,
|
||||
unsigned int shrink,
|
||||
struct bfd_link_info *link_info));
|
||||
enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *));
|
||||
boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||
bfd *abfd));
|
||||
boolean (*_bfd_coff_start_final_link) PARAMS ((
|
||||
bfd *output_bfd,
|
||||
struct bfd_link_info *info));
|
||||
boolean (*_bfd_coff_relocate_section) PARAMS ((
|
||||
bfd *output_bfd,
|
||||
struct bfd_link_info *info,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
bfd_byte *contents,
|
||||
struct internal_reloc *relocs,
|
||||
struct internal_syment *syms,
|
||||
asection **sections));
|
||||
reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
struct internal_reloc *rel,
|
||||
struct coff_link_hash_entry *h,
|
||||
struct internal_syment *sym,
|
||||
bfd_vma *addendp));
|
||||
boolean (*_bfd_coff_adjust_symndx) PARAMS ((
|
||||
bfd *obfd,
|
||||
struct bfd_link_info *info,
|
||||
bfd *ibfd,
|
||||
asection *sec,
|
||||
struct internal_reloc *reloc,
|
||||
boolean *adjustedp));
|
||||
boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
|
||||
struct bfd_link_info *info,
|
||||
bfd *abfd,
|
||||
const char *name,
|
||||
flagword flags,
|
||||
asection *section,
|
||||
bfd_vma value,
|
||||
const char *string,
|
||||
boolean copy,
|
||||
boolean collect,
|
||||
struct bfd_link_hash_entry **hashp));
|
||||
|
||||
boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
|
||||
bfd * abfd,
|
||||
struct coff_final_link_info * pfinfo));
|
||||
boolean (*_bfd_coff_final_link_postscript) PARAMS ((
|
||||
bfd * abfd,
|
||||
struct coff_final_link_info * pfinfo));
|
||||
|
||||
} bfd_coff_backend_data;
|
||||
|
||||
#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
|
||||
|
||||
#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
|
||||
|
||||
#define bfd_coff_swap_sym_in(a,e,i) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
|
||||
|
||||
#define bfd_coff_swap_lineno_in(a,e,i) \
|
||||
((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
|
||||
|
||||
#define bfd_coff_swap_reloc_out(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_lineno_out(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
|
||||
|
||||
#define bfd_coff_swap_sym_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_filehdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
|
||||
#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
|
||||
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
||||
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
||||
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
||||
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||
#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
|
||||
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
||||
#define bfd_coff_long_section_names(abfd) \
|
||||
(coff_backend_info (abfd)->_bfd_coff_long_section_names)
|
||||
#define bfd_coff_default_section_alignment_power(abfd) \
|
||||
(coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
|
||||
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_reloc_in(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
||||
|
||||
#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
|
||||
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
|
||||
|
||||
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
|
||||
((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
|
||||
(abfd, scnhdr, name, section))
|
||||
|
||||
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
|
||||
((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
|
||||
|
||||
#define bfd_coff_slurp_symbol_table(abfd)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
|
||||
|
||||
#define bfd_coff_symname_in_debug(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
|
||||
|
||||
#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_print_aux)\
|
||||
(abfd, file, base, symbol, aux, indaux))
|
||||
|
||||
#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
|
||||
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
|
||||
|
||||
#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||
(abfd, section, reloc, shrink, link_info))
|
||||
|
||||
#define bfd_coff_classify_symbol(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
|
||||
(abfd, sym))
|
||||
|
||||
#define bfd_coff_compute_section_file_positions(abfd)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
|
||||
(abfd))
|
||||
|
||||
#define bfd_coff_start_final_link(obfd, info)\
|
||||
((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
|
||||
(obfd, info))
|
||||
#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
|
||||
((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
|
||||
(obfd, info, ibfd, o, con, rel, isyms, secs))
|
||||
#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
|
||||
(abfd, sec, rel, h, sym, addendp))
|
||||
#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
|
||||
(obfd, info, ibfd, sec, rel, adjustedp))
|
||||
#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
|
||||
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
|
||||
|
||||
#define bfd_coff_link_output_has_begun(a,p) \
|
||||
((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
|
||||
#define bfd_coff_final_link_postscript(a,p) \
|
||||
((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
|
||||
|
||||
Writing relocations
|
||||
...................
|
||||
|
||||
To write relocations, the back end steps though the canonical
|
||||
relocation table and create an `internal_reloc'. The symbol index to
|
||||
use is removed from the `offset' field in the symbol table supplied.
|
||||
The address comes directly from the sum of the section base address and
|
||||
the relocation offset; the type is dug directly from the howto field.
|
||||
Then the `internal_reloc' is swapped into the shape of an
|
||||
`external_reloc' and written out to disk.
|
||||
|
||||
Reading linenumbers
|
||||
...................
|
||||
|
||||
Creating the linenumber table is done by reading in the entire coff
|
||||
linenumber table, and creating another table for internal use.
|
||||
|
||||
A coff linenumber table is structured so that each function is
|
||||
marked as having a line number of 0. Each line within the function is
|
||||
an offset from the first line in the function. The base of the line
|
||||
number information for the table is stored in the symbol associated
|
||||
with the function.
|
||||
|
||||
Note: The PE format uses line number 0 for a flag indicating a new
|
||||
source file.
|
||||
|
||||
The information is copied from the external to the internal table,
|
||||
and each symbol which marks a function is marked by pointing its...
|
||||
|
||||
How does this work ?
|
||||
|
||||
Reading relocations
|
||||
...................
|
||||
|
||||
Coff relocations are easily transformed into the internal BFD form
|
||||
(`arelent').
|
||||
|
||||
Reading a coff relocation table is done in the following stages:
|
||||
|
||||
* Read the entire coff relocation table into memory.
|
||||
|
||||
* Process each relocation in turn; first swap it from the external
|
||||
to the internal form.
|
||||
|
||||
* Turn the symbol referenced in the relocation's symbol index into a
|
||||
pointer into the canonical symbol table. This table is the same
|
||||
as the one returned by a call to `bfd_canonicalize_symtab'. The
|
||||
back end will call that routine and save the result if a
|
||||
canonicalization hasn't been done.
|
||||
|
||||
* The reloc index is turned into a pointer to a howto structure, in
|
||||
a back end specific way. For instance, the 386 and 960 use the
|
||||
`r_type' to directly produce an index into a howto table vector;
|
||||
the 88k subtracts a number from the `r_type' field and creates an
|
||||
addend field.
|
||||
|
||||
|
||||
File: bfd.info, Node: elf, Prev: coff, Up: BFD back ends
|
||||
|
||||
ELF backends
|
||||
============
|
||||
|
||||
BFD support for ELF formats is being worked on. Currently, the best
|
||||
supported back ends are for sparc and i386 (running svr4 or Solaris 2).
|
||||
|
||||
Documentation of the internals of the support code still needs to be
|
||||
written. The code is changing quickly enough that we haven't bothered
|
||||
yet.
|
||||
|
||||
`bfd_elf_find_section'
|
||||
......................
|
||||
|
||||
*Synopsis*
|
||||
struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
|
||||
*Description*
|
||||
Helper functions for GDB to locate the string tables. Since BFD hides
|
||||
string tables from callers, GDB needs to use an internal hook to find
|
||||
them. Sun's .stabstr, in particular, isn't even pointed to by the
|
||||
.stab section, so ordinary mechanisms wouldn't work to find it, even if
|
||||
we had some.
|
||||
|
||||
491
bfd/doc/bfd.info-7
Normal file
491
bfd/doc/bfd.info-7
Normal file
@@ -0,0 +1,491 @@
|
||||
This is bfd.info, produced by makeinfo version 4.0 from bfd.texinfo.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* Bfd: (bfd). The Binary File Descriptor library.
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
This file documents the BFD library.
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, subject to the
|
||||
terms of the GNU General Public License, which includes the provision
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions.
|
||||
|
||||
|
||||
File: bfd.info, Node: Index, Prev: BFD back ends, Up: Top
|
||||
|
||||
Index
|
||||
*****
|
||||
|
||||
* Menu:
|
||||
|
||||
* _bfd_final_link_relocate: Relocating the section contents.
|
||||
* _bfd_generic_link_add_archive_symbols: Adding symbols from an archive.
|
||||
* _bfd_generic_link_add_one_symbol: Adding symbols from an object file.
|
||||
* _bfd_link_add_symbols in target vector: Adding Symbols to the Hash Table.
|
||||
* _bfd_link_final_link in target vector: Performing the Final Link.
|
||||
* _bfd_link_hash_table_create in target vector: Creating a Linker Hash Table.
|
||||
* _bfd_relocate_contents: Relocating the section contents.
|
||||
* _bfd_strip_section_from_output: section prototypes.
|
||||
* aout_SIZE_machine_type: aout.
|
||||
* aout_SIZE_mkobject: aout.
|
||||
* aout_SIZE_new_section_hook: aout.
|
||||
* aout_SIZE_set_arch_mach: aout.
|
||||
* aout_SIZE_some_aout_object_p: aout.
|
||||
* aout_SIZE_swap_exec_header_in: aout.
|
||||
* aout_SIZE_swap_exec_header_out: aout.
|
||||
* arelent_chain: typedef arelent.
|
||||
* BFD: Overview.
|
||||
* BFD canonical format: Canonical format.
|
||||
* bfd_alloc: Opening and Closing.
|
||||
* bfd_arch_bits_per_address: Architectures.
|
||||
* bfd_arch_bits_per_byte: Architectures.
|
||||
* bfd_arch_get_compatible: Architectures.
|
||||
* bfd_arch_list: Architectures.
|
||||
* bfd_arch_mach_octets_per_byte: Architectures.
|
||||
* bfd_cache_close: File Caching.
|
||||
* bfd_cache_init: File Caching.
|
||||
* bfd_cache_lookup: File Caching.
|
||||
* bfd_cache_lookup_worker: File Caching.
|
||||
* BFD_CACHE_MAX_OPEN macro: File Caching.
|
||||
* bfd_canonicalize_reloc: BFD front end.
|
||||
* bfd_canonicalize_symtab: symbol handling functions.
|
||||
* bfd_check_format: Formats.
|
||||
* bfd_check_format_matches: Formats.
|
||||
* bfd_check_overflow: typedef arelent.
|
||||
* bfd_close: Opening and Closing.
|
||||
* bfd_close_all_done: Opening and Closing.
|
||||
* bfd_coff_backend_data: coff.
|
||||
* bfd_copy_private_bfd_data: BFD front end.
|
||||
* bfd_copy_private_section_data: section prototypes.
|
||||
* bfd_copy_private_symbol_data: symbol handling functions.
|
||||
* bfd_core_file_failing_command: Core Files.
|
||||
* bfd_core_file_failing_signal: Core Files.
|
||||
* bfd_create: Opening and Closing.
|
||||
* bfd_decode_symclass: symbol handling functions.
|
||||
* bfd_default_arch_struct: Architectures.
|
||||
* bfd_default_compatible: Architectures.
|
||||
* bfd_default_reloc_type_lookup: howto manager.
|
||||
* bfd_default_scan: Architectures.
|
||||
* bfd_default_set_arch_mach: Architectures.
|
||||
* bfd_elf_find_section: elf.
|
||||
* bfd_errmsg: BFD front end.
|
||||
* bfd_fdopenr: Opening and Closing.
|
||||
* bfd_find_target: bfd_target.
|
||||
* bfd_format_string: Formats.
|
||||
* bfd_generic_gc_sections: howto manager.
|
||||
* bfd_generic_get_relocated_section_contents: howto manager.
|
||||
* bfd_generic_relax_section: howto manager.
|
||||
* bfd_get_arch: Architectures.
|
||||
* bfd_get_arch_info: Architectures.
|
||||
* bfd_get_error: BFD front end.
|
||||
* bfd_get_error_handler: BFD front end.
|
||||
* bfd_get_gp_size: BFD front end.
|
||||
* bfd_get_mach: Architectures.
|
||||
* bfd_get_mtime: BFD front end.
|
||||
* bfd_get_next_mapent: Archives.
|
||||
* bfd_get_reloc_code_name: howto manager.
|
||||
* bfd_get_reloc_size: typedef arelent.
|
||||
* bfd_get_reloc_upper_bound: BFD front end.
|
||||
* bfd_get_section_by_name: section prototypes.
|
||||
* bfd_get_section_contents: section prototypes.
|
||||
* bfd_get_size <1>: Internal.
|
||||
* bfd_get_size: BFD front end.
|
||||
* bfd_get_symtab_upper_bound: symbol handling functions.
|
||||
* bfd_h_put_size: Internal.
|
||||
* bfd_hash_allocate: Creating and Freeing a Hash Table.
|
||||
* bfd_hash_lookup: Looking Up or Entering a String.
|
||||
* bfd_hash_newfunc: Creating and Freeing a Hash Table.
|
||||
* bfd_hash_table_free: Creating and Freeing a Hash Table.
|
||||
* bfd_hash_table_init: Creating and Freeing a Hash Table.
|
||||
* bfd_hash_table_init_n: Creating and Freeing a Hash Table.
|
||||
* bfd_hash_traverse: Traversing a Hash Table.
|
||||
* bfd_init: Initialization.
|
||||
* bfd_install_relocation: typedef arelent.
|
||||
* bfd_is_local_label: symbol handling functions.
|
||||
* bfd_is_local_label_name: symbol handling functions.
|
||||
* bfd_is_undefined_symclass: symbol handling functions.
|
||||
* bfd_last_cache: File Caching.
|
||||
* bfd_link_split_section: Writing the symbol table.
|
||||
* bfd_log2: Internal.
|
||||
* bfd_lookup_arch: Architectures.
|
||||
* bfd_make_debug_symbol: symbol handling functions.
|
||||
* bfd_make_empty_symbol: symbol handling functions.
|
||||
* bfd_make_readable: Opening and Closing.
|
||||
* bfd_make_section: section prototypes.
|
||||
* bfd_make_section_anyway: section prototypes.
|
||||
* bfd_make_section_old_way: section prototypes.
|
||||
* bfd_make_writable: Opening and Closing.
|
||||
* bfd_map_over_sections: section prototypes.
|
||||
* bfd_merge_private_bfd_data: BFD front end.
|
||||
* bfd_octets_per_byte: Architectures.
|
||||
* bfd_open_file: File Caching.
|
||||
* bfd_openr: Opening and Closing.
|
||||
* bfd_openr_next_archived_file: Archives.
|
||||
* bfd_openstreamr: Opening and Closing.
|
||||
* bfd_openw: Opening and Closing.
|
||||
* bfd_perform_relocation: typedef arelent.
|
||||
* bfd_perror: BFD front end.
|
||||
* bfd_print_symbol_vandf: symbol handling functions.
|
||||
* bfd_printable_arch_mach: Architectures.
|
||||
* bfd_printable_name: Architectures.
|
||||
* bfd_put_size: Internal.
|
||||
* BFD_RELOC_12_PCREL: howto manager.
|
||||
* BFD_RELOC_14: howto manager.
|
||||
* BFD_RELOC_16: howto manager.
|
||||
* BFD_RELOC_16_BASEREL: howto manager.
|
||||
* BFD_RELOC_16_GOT_PCREL: howto manager.
|
||||
* BFD_RELOC_16_GOTOFF: howto manager.
|
||||
* BFD_RELOC_16_PCREL: howto manager.
|
||||
* BFD_RELOC_16_PCREL_S2: howto manager.
|
||||
* BFD_RELOC_16_PLT_PCREL: howto manager.
|
||||
* BFD_RELOC_16_PLTOFF: howto manager.
|
||||
* BFD_RELOC_23_PCREL_S2: howto manager.
|
||||
* BFD_RELOC_24: howto manager.
|
||||
* BFD_RELOC_24_PCREL: howto manager.
|
||||
* BFD_RELOC_24_PLT_PCREL: howto manager.
|
||||
* BFD_RELOC_26: howto manager.
|
||||
* BFD_RELOC_32: howto manager.
|
||||
* BFD_RELOC_32_BASEREL: howto manager.
|
||||
* BFD_RELOC_32_GOT_PCREL: howto manager.
|
||||
* BFD_RELOC_32_GOTOFF: howto manager.
|
||||
* BFD_RELOC_32_PCREL: howto manager.
|
||||
* BFD_RELOC_32_PCREL_S2: howto manager.
|
||||
* BFD_RELOC_32_PLT_PCREL: howto manager.
|
||||
* BFD_RELOC_32_PLTOFF: howto manager.
|
||||
* BFD_RELOC_386_COPY: howto manager.
|
||||
* BFD_RELOC_386_GLOB_DAT: howto manager.
|
||||
* BFD_RELOC_386_GOT32: howto manager.
|
||||
* BFD_RELOC_386_GOTOFF: howto manager.
|
||||
* BFD_RELOC_386_GOTPC: howto manager.
|
||||
* BFD_RELOC_386_JUMP_SLOT: howto manager.
|
||||
* BFD_RELOC_386_PLT32: howto manager.
|
||||
* BFD_RELOC_386_RELATIVE: howto manager.
|
||||
* BFD_RELOC_64: howto manager.
|
||||
* BFD_RELOC_64_PCREL: howto manager.
|
||||
* BFD_RELOC_68K_GLOB_DAT: howto manager.
|
||||
* BFD_RELOC_68K_JMP_SLOT: howto manager.
|
||||
* BFD_RELOC_68K_RELATIVE: howto manager.
|
||||
* BFD_RELOC_8: howto manager.
|
||||
* BFD_RELOC_8_BASEREL: howto manager.
|
||||
* BFD_RELOC_8_FFnn: howto manager.
|
||||
* BFD_RELOC_8_GOT_PCREL: howto manager.
|
||||
* BFD_RELOC_8_GOTOFF: howto manager.
|
||||
* BFD_RELOC_8_PCREL: howto manager.
|
||||
* BFD_RELOC_8_PLT_PCREL: howto manager.
|
||||
* BFD_RELOC_8_PLTOFF: howto manager.
|
||||
* BFD_RELOC_ALPHA_CODEADDR: howto manager.
|
||||
* BFD_RELOC_ALPHA_ELF_LITERAL: howto manager.
|
||||
* BFD_RELOC_ALPHA_GPDISP: howto manager.
|
||||
* BFD_RELOC_ALPHA_GPDISP_HI16: howto manager.
|
||||
* BFD_RELOC_ALPHA_GPDISP_LO16: howto manager.
|
||||
* BFD_RELOC_ALPHA_HINT: howto manager.
|
||||
* BFD_RELOC_ALPHA_LINKAGE: howto manager.
|
||||
* BFD_RELOC_ALPHA_LITERAL: howto manager.
|
||||
* BFD_RELOC_ALPHA_LITUSE: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_GPDISP: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_GPRELHIGH: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_GPRELLOW: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_LITERAL: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_LITUSE_BASE: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF: howto manager.
|
||||
* BFD_RELOC_ALPHA_USER_LITUSE_JSR: howto manager.
|
||||
* BFD_RELOC_ARC_B22_PCREL: howto manager.
|
||||
* BFD_RELOC_ARC_B26: howto manager.
|
||||
* BFD_RELOC_ARM_ADR_IMM: howto manager.
|
||||
* BFD_RELOC_ARM_ADRL_IMMEDIATE: howto manager.
|
||||
* BFD_RELOC_ARM_COPY: howto manager.
|
||||
* BFD_RELOC_ARM_CP_OFF_IMM: howto manager.
|
||||
* BFD_RELOC_ARM_GLOB_DAT: howto manager.
|
||||
* BFD_RELOC_ARM_GOT12: howto manager.
|
||||
* BFD_RELOC_ARM_GOT32: howto manager.
|
||||
* BFD_RELOC_ARM_GOTOFF: howto manager.
|
||||
* BFD_RELOC_ARM_GOTPC: howto manager.
|
||||
* BFD_RELOC_ARM_HWLITERAL: howto manager.
|
||||
* BFD_RELOC_ARM_IMMEDIATE: howto manager.
|
||||
* BFD_RELOC_ARM_IN_POOL: howto manager.
|
||||
* BFD_RELOC_ARM_JUMP_SLOT: howto manager.
|
||||
* BFD_RELOC_ARM_LDR_IMM: howto manager.
|
||||
* BFD_RELOC_ARM_LITERAL: howto manager.
|
||||
* BFD_RELOC_ARM_MULTI: howto manager.
|
||||
* BFD_RELOC_ARM_OFFSET_IMM: howto manager.
|
||||
* BFD_RELOC_ARM_OFFSET_IMM8: howto manager.
|
||||
* BFD_RELOC_ARM_PCREL_BRANCH: howto manager.
|
||||
* BFD_RELOC_ARM_PLT32: howto manager.
|
||||
* BFD_RELOC_ARM_RELATIVE: howto manager.
|
||||
* BFD_RELOC_ARM_SHIFT_IMM: howto manager.
|
||||
* BFD_RELOC_ARM_SWI: howto manager.
|
||||
* BFD_RELOC_ARM_THUMB_ADD: howto manager.
|
||||
* BFD_RELOC_ARM_THUMB_IMM: howto manager.
|
||||
* BFD_RELOC_ARM_THUMB_OFFSET: howto manager.
|
||||
* BFD_RELOC_ARM_THUMB_SHIFT: howto manager.
|
||||
* BFD_RELOC_AVR_13_PCREL: howto manager.
|
||||
* BFD_RELOC_AVR_16_PM: howto manager.
|
||||
* BFD_RELOC_AVR_7_PCREL: howto manager.
|
||||
* BFD_RELOC_AVR_CALL: howto manager.
|
||||
* BFD_RELOC_AVR_HH8_LDI: howto manager.
|
||||
* BFD_RELOC_AVR_HH8_LDI_NEG: howto manager.
|
||||
* BFD_RELOC_AVR_HH8_LDI_PM: howto manager.
|
||||
* BFD_RELOC_AVR_HH8_LDI_PM_NEG: howto manager.
|
||||
* BFD_RELOC_AVR_HI8_LDI: howto manager.
|
||||
* BFD_RELOC_AVR_HI8_LDI_NEG: howto manager.
|
||||
* BFD_RELOC_AVR_HI8_LDI_PM: howto manager.
|
||||
* BFD_RELOC_AVR_HI8_LDI_PM_NEG: howto manager.
|
||||
* BFD_RELOC_AVR_LO8_LDI: howto manager.
|
||||
* BFD_RELOC_AVR_LO8_LDI_NEG: howto manager.
|
||||
* BFD_RELOC_AVR_LO8_LDI_PM: howto manager.
|
||||
* BFD_RELOC_AVR_LO8_LDI_PM_NEG: howto manager.
|
||||
* bfd_reloc_code_type: howto manager.
|
||||
* BFD_RELOC_CTOR: howto manager.
|
||||
* BFD_RELOC_D10V_10_PCREL_L: howto manager.
|
||||
* BFD_RELOC_D10V_10_PCREL_R: howto manager.
|
||||
* BFD_RELOC_D10V_18: howto manager.
|
||||
* BFD_RELOC_D10V_18_PCREL: howto manager.
|
||||
* BFD_RELOC_D30V_15: howto manager.
|
||||
* BFD_RELOC_D30V_15_PCREL: howto manager.
|
||||
* BFD_RELOC_D30V_15_PCREL_R: howto manager.
|
||||
* BFD_RELOC_D30V_21: howto manager.
|
||||
* BFD_RELOC_D30V_21_PCREL: howto manager.
|
||||
* BFD_RELOC_D30V_21_PCREL_R: howto manager.
|
||||
* BFD_RELOC_D30V_32: howto manager.
|
||||
* BFD_RELOC_D30V_32_PCREL: howto manager.
|
||||
* BFD_RELOC_D30V_6: howto manager.
|
||||
* BFD_RELOC_D30V_9_PCREL: howto manager.
|
||||
* BFD_RELOC_D30V_9_PCREL_R: howto manager.
|
||||
* BFD_RELOC_FR30_10_IN_8: howto manager.
|
||||
* BFD_RELOC_FR30_12_PCREL: howto manager.
|
||||
* BFD_RELOC_FR30_20: howto manager.
|
||||
* BFD_RELOC_FR30_48: howto manager.
|
||||
* BFD_RELOC_FR30_6_IN_4: howto manager.
|
||||
* BFD_RELOC_FR30_8_IN_8: howto manager.
|
||||
* BFD_RELOC_FR30_9_IN_8: howto manager.
|
||||
* BFD_RELOC_FR30_9_PCREL: howto manager.
|
||||
* BFD_RELOC_GPREL16: howto manager.
|
||||
* BFD_RELOC_GPREL32: howto manager.
|
||||
* BFD_RELOC_HI16: howto manager.
|
||||
* BFD_RELOC_HI16_BASEREL: howto manager.
|
||||
* BFD_RELOC_HI16_GOTOFF: howto manager.
|
||||
* BFD_RELOC_HI16_PLTOFF: howto manager.
|
||||
* BFD_RELOC_HI16_S: howto manager.
|
||||
* BFD_RELOC_HI16_S_BASEREL: howto manager.
|
||||
* BFD_RELOC_HI16_S_GOTOFF: howto manager.
|
||||
* BFD_RELOC_HI16_S_PLTOFF: howto manager.
|
||||
* BFD_RELOC_HI22: howto manager.
|
||||
* BFD_RELOC_I370_D12: howto manager.
|
||||
* BFD_RELOC_I960_CALLJ: howto manager.
|
||||
* BFD_RELOC_LO10: howto manager.
|
||||
* BFD_RELOC_LO16: howto manager.
|
||||
* BFD_RELOC_LO16_BASEREL: howto manager.
|
||||
* BFD_RELOC_LO16_GOTOFF: howto manager.
|
||||
* BFD_RELOC_LO16_PLTOFF: howto manager.
|
||||
* BFD_RELOC_M32R_10_PCREL: howto manager.
|
||||
* BFD_RELOC_M32R_18_PCREL: howto manager.
|
||||
* BFD_RELOC_M32R_24: howto manager.
|
||||
* BFD_RELOC_M32R_26_PCREL: howto manager.
|
||||
* BFD_RELOC_M32R_HI16_SLO: howto manager.
|
||||
* BFD_RELOC_M32R_HI16_ULO: howto manager.
|
||||
* BFD_RELOC_M32R_LO16: howto manager.
|
||||
* BFD_RELOC_M32R_SDA16: howto manager.
|
||||
* BFD_RELOC_MCORE_PCREL_32: howto manager.
|
||||
* BFD_RELOC_MCORE_PCREL_IMM11BY2: howto manager.
|
||||
* BFD_RELOC_MCORE_PCREL_IMM4BY2: howto manager.
|
||||
* BFD_RELOC_MCORE_PCREL_IMM8BY4: howto manager.
|
||||
* BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2: howto manager.
|
||||
* BFD_RELOC_MCORE_RVA: howto manager.
|
||||
* BFD_RELOC_MIPS16_GPREL: howto manager.
|
||||
* BFD_RELOC_MIPS16_JMP: howto manager.
|
||||
* BFD_RELOC_MIPS_CALL16: howto manager.
|
||||
* BFD_RELOC_MIPS_CALL_HI16: howto manager.
|
||||
* BFD_RELOC_MIPS_CALL_LO16: howto manager.
|
||||
* BFD_RELOC_MIPS_GOT16: howto manager.
|
||||
* BFD_RELOC_MIPS_GOT_DISP: howto manager.
|
||||
* BFD_RELOC_MIPS_GOT_HI16: howto manager.
|
||||
* BFD_RELOC_MIPS_GOT_LO16: howto manager.
|
||||
* BFD_RELOC_MIPS_GOT_OFST: howto manager.
|
||||
* BFD_RELOC_MIPS_GOT_PAGE: howto manager.
|
||||
* BFD_RELOC_MIPS_GPREL: howto manager.
|
||||
* BFD_RELOC_MIPS_GPREL32: howto manager.
|
||||
* BFD_RELOC_MIPS_JMP: howto manager.
|
||||
* BFD_RELOC_MIPS_LITERAL: howto manager.
|
||||
* BFD_RELOC_MIPS_SUB: howto manager.
|
||||
* BFD_RELOC_MN10300_16_PCREL: howto manager.
|
||||
* BFD_RELOC_MN10300_32_PCREL: howto manager.
|
||||
* BFD_RELOC_NONE: howto manager.
|
||||
* BFD_RELOC_NS32K_DISP_16: howto manager.
|
||||
* BFD_RELOC_NS32K_DISP_16_PCREL: howto manager.
|
||||
* BFD_RELOC_NS32K_DISP_32: howto manager.
|
||||
* BFD_RELOC_NS32K_DISP_32_PCREL: howto manager.
|
||||
* BFD_RELOC_NS32K_DISP_8: howto manager.
|
||||
* BFD_RELOC_NS32K_DISP_8_PCREL: howto manager.
|
||||
* BFD_RELOC_NS32K_IMM_16: howto manager.
|
||||
* BFD_RELOC_NS32K_IMM_16_PCREL: howto manager.
|
||||
* BFD_RELOC_NS32K_IMM_32: howto manager.
|
||||
* BFD_RELOC_NS32K_IMM_32_PCREL: howto manager.
|
||||
* BFD_RELOC_NS32K_IMM_8: howto manager.
|
||||
* BFD_RELOC_NS32K_IMM_8_PCREL: howto manager.
|
||||
* BFD_RELOC_PCREL_HI16_S: howto manager.
|
||||
* BFD_RELOC_PCREL_LO16: howto manager.
|
||||
* BFD_RELOC_PJ_CODE_DIR16: howto manager.
|
||||
* BFD_RELOC_PJ_CODE_DIR32: howto manager.
|
||||
* BFD_RELOC_PJ_CODE_HI16: howto manager.
|
||||
* BFD_RELOC_PJ_CODE_LO16: howto manager.
|
||||
* BFD_RELOC_PJ_CODE_REL16: howto manager.
|
||||
* BFD_RELOC_PJ_CODE_REL32: howto manager.
|
||||
* BFD_RELOC_PPC_B16: howto manager.
|
||||
* BFD_RELOC_PPC_B16_BRNTAKEN: howto manager.
|
||||
* BFD_RELOC_PPC_B16_BRTAKEN: howto manager.
|
||||
* BFD_RELOC_PPC_B26: howto manager.
|
||||
* BFD_RELOC_PPC_BA16: howto manager.
|
||||
* BFD_RELOC_PPC_BA16_BRNTAKEN: howto manager.
|
||||
* BFD_RELOC_PPC_BA16_BRTAKEN: howto manager.
|
||||
* BFD_RELOC_PPC_BA26: howto manager.
|
||||
* BFD_RELOC_PPC_COPY: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_BIT_FLD: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_MRKREF: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_NADDR16: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_NADDR16_HA: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_NADDR16_HI: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_NADDR16_LO: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_NADDR32: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_RELSDA: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_RELSEC16: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_RELST_HA: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_RELST_HI: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_RELST_LO: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_SDA21: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_SDA2I16: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_SDA2REL: howto manager.
|
||||
* BFD_RELOC_PPC_EMB_SDAI16: howto manager.
|
||||
* BFD_RELOC_PPC_GLOB_DAT: howto manager.
|
||||
* BFD_RELOC_PPC_JMP_SLOT: howto manager.
|
||||
* BFD_RELOC_PPC_LOCAL24PC: howto manager.
|
||||
* BFD_RELOC_PPC_RELATIVE: howto manager.
|
||||
* BFD_RELOC_PPC_TOC16: howto manager.
|
||||
* BFD_RELOC_RVA: howto manager.
|
||||
* BFD_RELOC_SH_ALIGN: howto manager.
|
||||
* BFD_RELOC_SH_CODE: howto manager.
|
||||
* BFD_RELOC_SH_COUNT: howto manager.
|
||||
* BFD_RELOC_SH_DATA: howto manager.
|
||||
* BFD_RELOC_SH_IMM4: howto manager.
|
||||
* BFD_RELOC_SH_IMM4BY2: howto manager.
|
||||
* BFD_RELOC_SH_IMM4BY4: howto manager.
|
||||
* BFD_RELOC_SH_IMM8: howto manager.
|
||||
* BFD_RELOC_SH_IMM8BY2: howto manager.
|
||||
* BFD_RELOC_SH_IMM8BY4: howto manager.
|
||||
* BFD_RELOC_SH_LABEL: howto manager.
|
||||
* BFD_RELOC_SH_PCDISP12BY2: howto manager.
|
||||
* BFD_RELOC_SH_PCDISP8BY2: howto manager.
|
||||
* BFD_RELOC_SH_PCRELIMM8BY2: howto manager.
|
||||
* BFD_RELOC_SH_PCRELIMM8BY4: howto manager.
|
||||
* BFD_RELOC_SH_SWITCH16: howto manager.
|
||||
* BFD_RELOC_SH_SWITCH32: howto manager.
|
||||
* BFD_RELOC_SH_USES: howto manager.
|
||||
* BFD_RELOC_SPARC13: howto manager.
|
||||
* BFD_RELOC_SPARC22: howto manager.
|
||||
* BFD_RELOC_SPARC_10: howto manager.
|
||||
* BFD_RELOC_SPARC_11: howto manager.
|
||||
* BFD_RELOC_SPARC_5: howto manager.
|
||||
* BFD_RELOC_SPARC_6: howto manager.
|
||||
* BFD_RELOC_SPARC_64: howto manager.
|
||||
* BFD_RELOC_SPARC_7: howto manager.
|
||||
* BFD_RELOC_SPARC_BASE13: howto manager.
|
||||
* BFD_RELOC_SPARC_BASE22: howto manager.
|
||||
* BFD_RELOC_SPARC_COPY: howto manager.
|
||||
* BFD_RELOC_SPARC_DISP64: howto manager.
|
||||
* BFD_RELOC_SPARC_GLOB_DAT: howto manager.
|
||||
* BFD_RELOC_SPARC_GOT10: howto manager.
|
||||
* BFD_RELOC_SPARC_GOT13: howto manager.
|
||||
* BFD_RELOC_SPARC_GOT22: howto manager.
|
||||
* BFD_RELOC_SPARC_H44: howto manager.
|
||||
* BFD_RELOC_SPARC_HH22: howto manager.
|
||||
* BFD_RELOC_SPARC_HIX22: howto manager.
|
||||
* BFD_RELOC_SPARC_HM10: howto manager.
|
||||
* BFD_RELOC_SPARC_JMP_SLOT: howto manager.
|
||||
* BFD_RELOC_SPARC_L44: howto manager.
|
||||
* BFD_RELOC_SPARC_LM22: howto manager.
|
||||
* BFD_RELOC_SPARC_LOX10: howto manager.
|
||||
* BFD_RELOC_SPARC_M44: howto manager.
|
||||
* BFD_RELOC_SPARC_OLO10: howto manager.
|
||||
* BFD_RELOC_SPARC_PC10: howto manager.
|
||||
* BFD_RELOC_SPARC_PC22: howto manager.
|
||||
* BFD_RELOC_SPARC_PC_HH22: howto manager.
|
||||
* BFD_RELOC_SPARC_PC_HM10: howto manager.
|
||||
* BFD_RELOC_SPARC_PC_LM22: howto manager.
|
||||
* BFD_RELOC_SPARC_PLT64: howto manager.
|
||||
* BFD_RELOC_SPARC_REGISTER: howto manager.
|
||||
* BFD_RELOC_SPARC_RELATIVE: howto manager.
|
||||
* BFD_RELOC_SPARC_REV32: howto manager.
|
||||
* BFD_RELOC_SPARC_UA32: howto manager.
|
||||
* BFD_RELOC_SPARC_WDISP16: howto manager.
|
||||
* BFD_RELOC_SPARC_WDISP19: howto manager.
|
||||
* BFD_RELOC_SPARC_WDISP22: howto manager.
|
||||
* BFD_RELOC_SPARC_WPLT30: howto manager.
|
||||
* BFD_RELOC_THUMB_PCREL_BRANCH12: howto manager.
|
||||
* BFD_RELOC_THUMB_PCREL_BRANCH23: howto manager.
|
||||
* BFD_RELOC_THUMB_PCREL_BRANCH9: howto manager.
|
||||
* BFD_RELOC_TIC30_LDP: howto manager.
|
||||
* bfd_reloc_type_lookup: howto manager.
|
||||
* BFD_RELOC_V850_22_PCREL: howto manager.
|
||||
* BFD_RELOC_V850_9_PCREL: howto manager.
|
||||
* BFD_RELOC_V850_CALLT_16_16_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_CALLT_6_7_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_SDA_15_16_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_SDA_16_16_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_TDA_16_16_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_TDA_4_4_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_TDA_4_5_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_TDA_6_8_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_TDA_7_7_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_TDA_7_8_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_ZDA_15_16_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_ZDA_16_16_OFFSET: howto manager.
|
||||
* BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET: howto manager.
|
||||
* BFD_RELOC_VTABLE_ENTRY: howto manager.
|
||||
* BFD_RELOC_VTABLE_INHERIT: howto manager.
|
||||
* bfd_scan_arch: Architectures.
|
||||
* bfd_scan_vma: BFD front end.
|
||||
* bfd_seach_for_target: bfd_target.
|
||||
* bfd_set_arch_info: Architectures.
|
||||
* bfd_set_archive_head: Archives.
|
||||
* bfd_set_default_target: bfd_target.
|
||||
* bfd_set_error: BFD front end.
|
||||
* bfd_set_error_handler: BFD front end.
|
||||
* bfd_set_error_program_name: BFD front end.
|
||||
* bfd_set_file_flags: BFD front end.
|
||||
* bfd_set_format: Formats.
|
||||
* bfd_set_gp_size: BFD front end.
|
||||
* bfd_set_private_flags: BFD front end.
|
||||
* bfd_set_reloc: BFD front end.
|
||||
* bfd_set_section_contents: section prototypes.
|
||||
* bfd_set_section_flags: section prototypes.
|
||||
* bfd_set_section_size: section prototypes.
|
||||
* bfd_set_start_address: BFD front end.
|
||||
* bfd_set_symtab: symbol handling functions.
|
||||
* bfd_symbol_info: symbol handling functions.
|
||||
* bfd_target_list: bfd_target.
|
||||
* bfd_write_bigendian_4byte_int: Internal.
|
||||
* coff_symbol_type: coff.
|
||||
* core_file_matches_executable_p: Core Files.
|
||||
* Hash tables: Hash Tables.
|
||||
* internal object-file format: Canonical format.
|
||||
* Linker: Linker Functions.
|
||||
* stuff: BFD front end.
|
||||
* target vector (_bfd_final_link): Performing the Final Link.
|
||||
* target vector (_bfd_link_add_symbols): Adding Symbols to the Hash Table.
|
||||
* target vector (_bfd_link_hash_table_create): Creating a Linker Hash Table.
|
||||
* The HOWTO Macro: typedef arelent.
|
||||
* what is it?: Overview.
|
||||
|
||||
|
||||
601
bfd/doc/bfdt.texi
Normal file
601
bfd/doc/bfdt.texi
Normal file
@@ -0,0 +1,601 @@
|
||||
@section @code{typedef bfd}
|
||||
A BFD has type @code{bfd}; objects of this type are the
|
||||
cornerstone of any application using BFD. Using BFD
|
||||
consists of making references though the BFD and to data in the BFD.
|
||||
|
||||
Here is the structure that defines the type @code{bfd}. It
|
||||
contains the major data about the file and pointers
|
||||
to the rest of the data.
|
||||
|
||||
|
||||
@example
|
||||
|
||||
struct _bfd
|
||||
@{
|
||||
/* The filename the application opened the BFD with. */
|
||||
CONST char *filename;
|
||||
|
||||
/* A pointer to the target jump table. */
|
||||
const struct bfd_target *xvec;
|
||||
|
||||
/* To avoid dragging too many header files into every file that
|
||||
includes `@code{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. However, if the
|
||||
BFD_IN_MEMORY flag is set, then iostream is actually a pointer
|
||||
to a bfd_in_memory struct. */
|
||||
PTR iostream;
|
||||
|
||||
/* Is the file descriptor being cached? That is, can it be closed as
|
||||
needed, and re-opened when accessed later? */
|
||||
|
||||
boolean cacheable;
|
||||
|
||||
/* Marks whether there was a default target specified when the
|
||||
BFD was opened. This is used to select which matching algorithm
|
||||
to use to choose the back end. */
|
||||
|
||||
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
|
||||
state information on the file here: */
|
||||
|
||||
file_ptr where;
|
||||
|
||||
/* and here: (``once'' means at least once) */
|
||||
|
||||
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;
|
||||
|
||||
/* The format which belongs to the BFD. (object, core, etc.) */
|
||||
|
||||
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
|
||||
from happening. */
|
||||
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;
|
||||
|
||||
/* Symbol table for output BFD (with symcount entries) */
|
||||
struct symbol_cache_entry **outsymbols;
|
||||
|
||||
/* Pointer to structure which contains architecture information*/
|
||||
const struct bfd_arch_info *arch_info;
|
||||
|
||||
/* Stuff only useful for archives:*/
|
||||
PTR arelt_data;
|
||||
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. */
|
||||
boolean has_armap;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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 pe_tdata *pe_obj_data;
|
||||
struct xcoff_tdata *xcoff_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 ihex_data_struct *ihex_data;
|
||||
struct tekhex_data_struct *tekhex_data;
|
||||
struct elf_obj_tdata *elf_obj_data;
|
||||
struct nlm_obj_tdata *nlm_obj_data;
|
||||
struct bout_data_struct *bout_data;
|
||||
struct sun_core_struct *sun_core_data;
|
||||
struct sco5_core_struct *sco5_core_data;
|
||||
struct trad_core_struct *trad_core_data;
|
||||
struct som_data_struct *som_data;
|
||||
struct hpux_core_struct *hpux_core_data;
|
||||
struct hppabsd_core_struct *hppabsd_core_data;
|
||||
struct sgi_core_struct *sgi_core_data;
|
||||
struct lynx_core_struct *lynx_core_data;
|
||||
struct osf_core_struct *osf_core_data;
|
||||
struct cisco_core_struct *cisco_core_data;
|
||||
struct versados_data_struct *versados_data;
|
||||
struct netbsd_core_struct *netbsd_core_data;
|
||||
PTR any;
|
||||
@} tdata;
|
||||
|
||||
/* Used by the application to hold private data*/
|
||||
PTR usrdata;
|
||||
|
||||
/* Where all the allocated stuff under this BFD goes. This is a
|
||||
struct objalloc *, but we use PTR to avoid requiring the inclusion of
|
||||
objalloc.h. */
|
||||
PTR memory;
|
||||
@};
|
||||
|
||||
@end example
|
||||
@section Error reporting
|
||||
Most BFD functions return nonzero on success (check their
|
||||
individual documentation for precise semantics). On an error,
|
||||
they call @code{bfd_set_error} to set an error condition that callers
|
||||
can check by calling @code{bfd_get_error}.
|
||||
If that returns @code{bfd_error_system_call}, then check
|
||||
@code{errno}.
|
||||
|
||||
The easiest way to report a BFD error to the user is to
|
||||
use @code{bfd_perror}.
|
||||
|
||||
@subsection Type @code{bfd_error_type}
|
||||
The values returned by @code{bfd_get_error} are defined by the
|
||||
enumerated type @code{bfd_error_type}.
|
||||
|
||||
|
||||
@example
|
||||
|
||||
typedef enum bfd_error
|
||||
@{
|
||||
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_armap,
|
||||
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,
|
||||
bfd_error_file_too_big,
|
||||
bfd_error_invalid_error_code
|
||||
@} bfd_error_type;
|
||||
|
||||
@end example
|
||||
@findex bfd_get_error
|
||||
@subsubsection @code{bfd_get_error}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_error_type bfd_get_error (void);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the current BFD error condition.
|
||||
|
||||
@findex bfd_set_error
|
||||
@subsubsection @code{bfd_set_error}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_error (bfd_error_type error_tag);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the BFD error condition to be @var{error_tag}.
|
||||
|
||||
@findex bfd_errmsg
|
||||
@subsubsection @code{bfd_errmsg}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
CONST char *bfd_errmsg (bfd_error_type error_tag);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a string describing the error @var{error_tag}, or
|
||||
the system error if @var{error_tag} is @code{bfd_error_system_call}.
|
||||
|
||||
@findex bfd_perror
|
||||
@subsubsection @code{bfd_perror}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_perror (CONST char *message);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Print to the standard error stream a string describing the
|
||||
last BFD error that occurred, or the last system error if
|
||||
the last BFD error was a system call failure. If @var{message}
|
||||
is non-NULL and non-empty, the error string printed is preceded
|
||||
by @var{message}, a colon, and a space. It is followed by a newline.
|
||||
|
||||
@subsection BFD error handler
|
||||
Some BFD functions want to print messages describing the
|
||||
problem. They call a BFD error handler function. This
|
||||
function may be overriden by the program.
|
||||
|
||||
The BFD error handler acts like printf.
|
||||
|
||||
|
||||
@example
|
||||
|
||||
typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
|
||||
|
||||
@end example
|
||||
@findex bfd_set_error_handler
|
||||
@subsubsection @code{bfd_set_error_handler}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the BFD error handler function. Returns the previous
|
||||
function.
|
||||
|
||||
@findex bfd_set_error_program_name
|
||||
@subsubsection @code{bfd_set_error_program_name}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_error_program_name (const char *);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the program name to use when printing a BFD error. This
|
||||
is printed before the error message followed by a colon and
|
||||
space. The string must not be changed after it is passed to
|
||||
this function.
|
||||
|
||||
@findex bfd_get_error_handler
|
||||
@subsubsection @code{bfd_get_error_handler}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_error_handler_type bfd_get_error_handler (void);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the BFD error handler function.
|
||||
|
||||
@section Symbols
|
||||
|
||||
|
||||
@findex bfd_get_reloc_upper_bound
|
||||
@subsubsection @code{bfd_get_reloc_upper_bound}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_get_reloc_upper_bound(bfd *abfd, asection *sect);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the number of bytes required to store the
|
||||
relocation information associated with section @var{sect}
|
||||
attached to bfd @var{abfd}. If an error occurs, return -1.
|
||||
|
||||
@findex bfd_canonicalize_reloc
|
||||
@subsubsection @code{bfd_canonicalize_reloc}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_canonicalize_reloc
|
||||
(bfd *abfd,
|
||||
asection *sec,
|
||||
arelent **loc,
|
||||
asymbol **syms);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Call the back end associated with the open BFD
|
||||
@var{abfd} and translate the external form of the relocation
|
||||
information attached to @var{sec} into the internal canonical
|
||||
form. Place the table into memory at @var{loc}, which has
|
||||
been preallocated, usually by a call to
|
||||
@code{bfd_get_reloc_upper_bound}. Returns the number of relocs, or
|
||||
-1 on error.
|
||||
|
||||
The @var{syms} table is also needed for horrible internal magic
|
||||
reasons.
|
||||
|
||||
@findex bfd_set_reloc
|
||||
@subsubsection @code{bfd_set_reloc}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_reloc
|
||||
(bfd *abfd, asection *sec, arelent **rel, unsigned int count)
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the relocation pointer and count within
|
||||
section @var{sec} to the values @var{rel} and @var{count}.
|
||||
The argument @var{abfd} is ignored.
|
||||
|
||||
@findex bfd_set_file_flags
|
||||
@subsubsection @code{bfd_set_file_flags}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_file_flags(bfd *abfd, flagword flags);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the flag word in the BFD @var{abfd} to the value @var{flags}.
|
||||
|
||||
Possible errors are:
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_wrong_format} - The target bfd was not of object format.
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} - The target bfd was open for reading.
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} -
|
||||
The flag word contained a bit which was not applicable to the
|
||||
type of file. E.g., an attempt was made to set the @code{D_PAGED} bit
|
||||
on a BFD format which does not support demand paging.
|
||||
@end itemize
|
||||
|
||||
@findex bfd_set_start_address
|
||||
@subsubsection @code{bfd_set_start_address}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_start_address(bfd *abfd, bfd_vma vma);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Make @var{vma} the entry point of output BFD @var{abfd}.
|
||||
|
||||
@strong{Returns}@*
|
||||
Returns @code{true} on success, @code{false} otherwise.
|
||||
|
||||
@findex bfd_get_mtime
|
||||
@subsubsection @code{bfd_get_mtime}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_get_mtime(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the file modification time (as read from the file system, or
|
||||
from the archive header for archive members).
|
||||
|
||||
@findex bfd_get_size
|
||||
@subsubsection @code{bfd_get_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
long bfd_get_size(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the file size (as read from file system) for the file
|
||||
associated with BFD @var{abfd}.
|
||||
|
||||
The initial motivation for, and use of, this routine is not
|
||||
so we can get the exact size of the object the BFD applies to, since
|
||||
that might not be generally possible (archive members for example).
|
||||
It would be ideal if someone could eventually modify
|
||||
it so that such results were guaranteed.
|
||||
|
||||
Instead, we want to ask questions like "is this NNN byte sized
|
||||
object I'm about to try read from file offset YYY reasonable?"
|
||||
As as example of where we might do this, some object formats
|
||||
use string tables for which the first @code{sizeof(long)} bytes of the
|
||||
table contain the size of the table itself, including the size bytes.
|
||||
If an application tries to read what it thinks is one of these
|
||||
string tables, without some way to validate the size, and for
|
||||
some reason the size is wrong (byte swapping error, wrong location
|
||||
for the string table, etc.), the only clue is likely to be a read
|
||||
error when it tries to read the table, or a "virtual memory
|
||||
exhausted" error when it tries to allocate 15 bazillon bytes
|
||||
of space for the 15 bazillon byte table it is about to read.
|
||||
This function at least allows us to answer the quesion, "is the
|
||||
size reasonable?".
|
||||
|
||||
@findex bfd_get_gp_size
|
||||
@subsubsection @code{bfd_get_gp_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
int bfd_get_gp_size(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the maximum size of objects to be optimized using the GP
|
||||
register under MIPS ECOFF. This is typically set by the @code{-G}
|
||||
argument to the compiler, assembler or linker.
|
||||
|
||||
@findex bfd_set_gp_size
|
||||
@subsubsection @code{bfd_set_gp_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_set_gp_size(bfd *abfd, int i);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the maximum size of objects to be optimized using the GP
|
||||
register under ECOFF or MIPS ELF. This is typically set by
|
||||
the @code{-G} argument to the compiler, assembler or linker.
|
||||
|
||||
@findex bfd_scan_vma
|
||||
@subsubsection @code{bfd_scan_vma}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd_vma bfd_scan_vma(CONST char *string, CONST char **end, int base);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Convert, like @code{strtoul}, a numerical expression
|
||||
@var{string} into a @code{bfd_vma} integer, and return that integer.
|
||||
(Though without as many bells and whistles as @code{strtoul}.)
|
||||
The expression is assumed to be unsigned (i.e., positive).
|
||||
If given a @var{base}, it is used as the base for conversion.
|
||||
A base of 0 causes the function to interpret the string
|
||||
in hex if a leading "0x" or "0X" is found, otherwise
|
||||
in octal if a leading zero is found, otherwise in decimal.
|
||||
|
||||
Overflow is not detected.
|
||||
|
||||
@findex bfd_copy_private_bfd_data
|
||||
@subsubsection @code{bfd_copy_private_bfd_data}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_copy_private_bfd_data(bfd *ibfd, bfd *obfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Copy private BFD information from the BFD @var{ibfd} to the
|
||||
the BFD @var{obfd}. Return @code{true} on success, @code{false} on error.
|
||||
Possible error returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_copy_private_bfd_data(ibfd, obfd) \
|
||||
BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
|
||||
(ibfd, obfd))
|
||||
@end example
|
||||
|
||||
@findex bfd_merge_private_bfd_data
|
||||
@subsubsection @code{bfd_merge_private_bfd_data}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_merge_private_bfd_data(bfd *ibfd, bfd *obfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Merge private BFD information from the BFD @var{ibfd} to the
|
||||
the output file BFD @var{obfd} when linking. Return @code{true}
|
||||
on success, @code{false} on error. Possible error returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_merge_private_bfd_data(ibfd, obfd) \
|
||||
BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
|
||||
(ibfd, obfd))
|
||||
@end example
|
||||
|
||||
@findex bfd_set_private_flags
|
||||
@subsubsection @code{bfd_set_private_flags}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_private_flags(bfd *abfd, flagword flags);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set private BFD flag information in the BFD @var{abfd}.
|
||||
Return @code{true} on success, @code{false} on error. Possible error
|
||||
returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{obfd}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_set_private_flags(abfd, flags) \
|
||||
BFD_SEND (abfd, _bfd_set_private_flags, \
|
||||
(abfd, flags))
|
||||
@end example
|
||||
|
||||
@findex stuff
|
||||
@subsubsection @code{stuff}
|
||||
@strong{Description}@*
|
||||
Stuff which should be documented:
|
||||
@example
|
||||
#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))
|
||||
|
||||
#define bfd_update_armap_timestamp(abfd) \
|
||||
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
|
||||
|
||||
#define bfd_set_arch_mach(abfd, arch, mach)\
|
||||
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
|
||||
|
||||
#define bfd_relax_section(abfd, section, link_info, again) \
|
||||
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
||||
|
||||
#define bfd_gc_sections(abfd, link_info) \
|
||||
BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
|
||||
|
||||
#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))
|
||||
|
||||
#define bfd_free_cached_info(abfd) \
|
||||
BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
|
||||
|
||||
#define bfd_get_dynamic_symtab_upper_bound(abfd) \
|
||||
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
|
||||
|
||||
#define bfd_print_private_bfd_data(abfd, file)\
|
||||
BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
|
||||
|
||||
#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))
|
||||
|
||||
extern bfd_byte *bfd_get_relocated_section_contents
|
||||
PARAMS ((bfd *, struct bfd_link_info *,
|
||||
struct bfd_link_order *, bfd_byte *,
|
||||
boolean, asymbol **));
|
||||
|
||||
@end example
|
||||
|
||||
95
bfd/doc/cache.texi
Normal file
95
bfd/doc/cache.texi
Normal file
@@ -0,0 +1,95 @@
|
||||
@section File caching
|
||||
The file caching mechanism is embedded within BFD and allows
|
||||
the application to open as many BFDs as it wants without
|
||||
regard to the underlying operating system's file descriptor
|
||||
limit (often as low as 20 open files). The module in
|
||||
@code{cache.c} maintains a least recently used list of
|
||||
@code{BFD_CACHE_MAX_OPEN} files, and exports the name
|
||||
@code{bfd_cache_lookup}, which runs around and makes sure that
|
||||
the required BFD is open. If not, then it chooses a file to
|
||||
close, closes it and opens the one wanted, returning its file
|
||||
handle.
|
||||
|
||||
@findex BFD_CACHE_MAX_OPEN macro
|
||||
@subsubsection @code{BFD_CACHE_MAX_OPEN macro}
|
||||
@strong{Description}@*
|
||||
The maximum number of files which the cache will keep open at
|
||||
one time.
|
||||
@example
|
||||
#define BFD_CACHE_MAX_OPEN 10
|
||||
@end example
|
||||
|
||||
@findex bfd_last_cache
|
||||
@subsubsection @code{bfd_last_cache}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
extern bfd *bfd_last_cache;
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Zero, or a pointer to the topmost BFD on the chain. This is
|
||||
used by the @code{bfd_cache_lookup} macro in @file{libbfd.h} to
|
||||
determine when it can avoid a function call.
|
||||
|
||||
@findex bfd_cache_lookup
|
||||
@subsubsection @code{bfd_cache_lookup}
|
||||
@strong{Description}@*
|
||||
Check to see if the required BFD is the same as the last one
|
||||
looked up. If so, then it can use the stream in the BFD with
|
||||
impunity, since it can't have changed since the last lookup;
|
||||
otherwise, it has to perform the complicated lookup function.
|
||||
@example
|
||||
#define bfd_cache_lookup(x) \
|
||||
((x)==bfd_last_cache? \
|
||||
(FILE*)(bfd_last_cache->iostream): \
|
||||
bfd_cache_lookup_worker(x))
|
||||
@end example
|
||||
|
||||
@findex bfd_cache_init
|
||||
@subsubsection @code{bfd_cache_init}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_cache_init (bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Add a newly opened BFD to the cache.
|
||||
|
||||
@findex bfd_cache_close
|
||||
@subsubsection @code{bfd_cache_close}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_cache_close (bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Remove the BFD @var{abfd} from the cache. If the attached file is open,
|
||||
then close it too.
|
||||
|
||||
@strong{Returns}@*
|
||||
@code{false} is returned if closing the file fails, @code{true} is
|
||||
returned if all is well.
|
||||
|
||||
@findex bfd_open_file
|
||||
@subsubsection @code{bfd_open_file}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
FILE* bfd_open_file(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Call the OS to open a file for @var{abfd}. Return the @code{FILE *}
|
||||
(possibly @code{NULL}) that results from this operation. Set up the
|
||||
BFD so that future accesses know the file is open. If the @code{FILE *}
|
||||
returned is @code{NULL}, then it won't have been put in the
|
||||
cache, so it won't have to be removed from it.
|
||||
|
||||
@findex bfd_cache_lookup_worker
|
||||
@subsubsection @code{bfd_cache_lookup_worker}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
FILE *bfd_cache_lookup_worker(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Called when the macro @code{bfd_cache_lookup} fails to find a
|
||||
quick answer. Find a file descriptor for @var{abfd}. If
|
||||
necessary, it open it. If there are already more than
|
||||
@code{BFD_CACHE_MAX_OPEN} files open, it tries to close one first, to
|
||||
avoid running out of file descriptors.
|
||||
|
||||
666
bfd/doc/coffcode.texi
Normal file
666
bfd/doc/coffcode.texi
Normal file
@@ -0,0 +1,666 @@
|
||||
@section coff backends
|
||||
BFD supports a number of different flavours of coff format.
|
||||
The major differences between formats are the sizes and
|
||||
alignments of fields in structures on disk, and the occasional
|
||||
extra field.
|
||||
|
||||
Coff in all its varieties is implemented with a few common
|
||||
files and a number of implementation specific files. For
|
||||
example, The 88k bcs coff format is implemented in the file
|
||||
@file{coff-m88k.c}. This file @code{#include}s
|
||||
@file{coff/m88k.h} which defines the external structure of the
|
||||
coff format for the 88k, and @file{coff/internal.h} which
|
||||
defines the internal structure. @file{coff-m88k.c} also
|
||||
defines the relocations used by the 88k format
|
||||
@xref{Relocations}.
|
||||
|
||||
The Intel i960 processor version of coff is implemented in
|
||||
@file{coff-i960.c}. This file has the same structure as
|
||||
@file{coff-m88k.c}, except that it includes @file{coff/i960.h}
|
||||
rather than @file{coff-m88k.h}.
|
||||
|
||||
@subsection Porting to a new version of coff
|
||||
The recommended method is to select from the existing
|
||||
implementations the version of coff which is most like the one
|
||||
you want to use. For example, we'll say that i386 coff is
|
||||
the one you select, and that your coff flavour is called foo.
|
||||
Copy @file{i386coff.c} to @file{foocoff.c}, copy
|
||||
@file{../include/coff/i386.h} to @file{../include/coff/foo.h},
|
||||
and add the lines to @file{targets.c} and @file{Makefile.in}
|
||||
so that your new back end is used. Alter the shapes of the
|
||||
structures in @file{../include/coff/foo.h} so that they match
|
||||
what you need. You will probably also have to add
|
||||
@code{#ifdef}s to the code in @file{coff/internal.h} and
|
||||
@file{coffcode.h} if your version of coff is too wild.
|
||||
|
||||
You can verify that your new BFD backend works quite simply by
|
||||
building @file{objdump} from the @file{binutils} directory,
|
||||
and making sure that its version of what's going on and your
|
||||
host system's idea (assuming it has the pretty standard coff
|
||||
dump utility, usually called @code{att-dump} or just
|
||||
@code{dump}) are the same. Then clean up your code, and send
|
||||
what you've done to Cygnus. Then your stuff will be in the
|
||||
next release, and you won't have to keep integrating it.
|
||||
|
||||
@subsection How the coff backend works
|
||||
|
||||
|
||||
@subsubsection File layout
|
||||
The Coff backend is split into generic routines that are
|
||||
applicable to any Coff target and routines that are specific
|
||||
to a particular target. The target-specific routines are
|
||||
further split into ones which are basically the same for all
|
||||
Coff targets except that they use the external symbol format
|
||||
or use different values for certain constants.
|
||||
|
||||
The generic routines are in @file{coffgen.c}. These routines
|
||||
work for any Coff target. They use some hooks into the target
|
||||
specific code; the hooks are in a @code{bfd_coff_backend_data}
|
||||
structure, one of which exists for each target.
|
||||
|
||||
The essentially similar target-specific routines are in
|
||||
@file{coffcode.h}. This header file includes executable C code.
|
||||
The various Coff targets first include the appropriate Coff
|
||||
header file, make any special defines that are needed, and
|
||||
then include @file{coffcode.h}.
|
||||
|
||||
Some of the Coff targets then also have additional routines in
|
||||
the target source file itself.
|
||||
|
||||
For example, @file{coff-i960.c} includes
|
||||
@file{coff/internal.h} and @file{coff/i960.h}. It then
|
||||
defines a few constants, such as @code{I960}, and includes
|
||||
@file{coffcode.h}. Since the i960 has complex relocation
|
||||
types, @file{coff-i960.c} also includes some code to
|
||||
manipulate the i960 relocs. This code is not in
|
||||
@file{coffcode.h} because it would not be used by any other
|
||||
target.
|
||||
|
||||
@subsubsection Bit twiddling
|
||||
Each flavour of coff supported in BFD has its own header file
|
||||
describing the external layout of the structures. There is also
|
||||
an internal description of the coff layout, in
|
||||
@file{coff/internal.h}. A major function of the
|
||||
coff backend is swapping the bytes and twiddling the bits to
|
||||
translate the external form of the structures into the normal
|
||||
internal form. This is all performed in the
|
||||
@code{bfd_swap}_@i{thing}_@i{direction} routines. Some
|
||||
elements are different sizes between different versions of
|
||||
coff; it is the duty of the coff version specific include file
|
||||
to override the definitions of various packing routines in
|
||||
@file{coffcode.h}. E.g., the size of line number entry in coff is
|
||||
sometimes 16 bits, and sometimes 32 bits. @code{#define}ing
|
||||
@code{PUT_LNSZ_LNNO} and @code{GET_LNSZ_LNNO} will select the
|
||||
correct one. No doubt, some day someone will find a version of
|
||||
coff which has a varying field size not catered to at the
|
||||
moment. To port BFD, that person will have to add more @code{#defines}.
|
||||
Three of the bit twiddling routines are exported to
|
||||
@code{gdb}; @code{coff_swap_aux_in}, @code{coff_swap_sym_in}
|
||||
and @code{coff_swap_lineno_in}. @code{GDB} reads the symbol
|
||||
table on its own, but uses BFD to fix things up. More of the
|
||||
bit twiddlers are exported for @code{gas};
|
||||
@code{coff_swap_aux_out}, @code{coff_swap_sym_out},
|
||||
@code{coff_swap_lineno_out}, @code{coff_swap_reloc_out},
|
||||
@code{coff_swap_filehdr_out}, @code{coff_swap_aouthdr_out},
|
||||
@code{coff_swap_scnhdr_out}. @code{Gas} currently keeps track
|
||||
of all the symbol table and reloc drudgery itself, thereby
|
||||
saving the internal BFD overhead, but uses BFD to swap things
|
||||
on the way out, making cross ports much safer. Doing so also
|
||||
allows BFD (and thus the linker) to use the same header files
|
||||
as @code{gas}, which makes one avenue to disaster disappear.
|
||||
|
||||
@subsubsection Symbol reading
|
||||
The simple canonical form for symbols used by BFD is not rich
|
||||
enough to keep all the information available in a coff symbol
|
||||
table. The back end gets around this problem by keeping the original
|
||||
symbol table around, "behind the scenes".
|
||||
|
||||
When a symbol table is requested (through a call to
|
||||
@code{bfd_canonicalize_symtab}), a request gets through to
|
||||
@code{coff_get_normalized_symtab}. This reads the symbol table from
|
||||
the coff file and swaps all the structures inside into the
|
||||
internal form. It also fixes up all the pointers in the table
|
||||
(represented in the file by offsets from the first symbol in
|
||||
the table) into physical pointers to elements in the new
|
||||
internal table. This involves some work since the meanings of
|
||||
fields change depending upon context: a field that is a
|
||||
pointer to another structure in the symbol table at one moment
|
||||
may be the size in bytes of a structure at the next. Another
|
||||
pass is made over the table. All symbols which mark file names
|
||||
(@code{C_FILE} symbols) are modified so that the internal
|
||||
string points to the value in the auxent (the real filename)
|
||||
rather than the normal text associated with the symbol
|
||||
(@code{".file"}).
|
||||
|
||||
At this time the symbol names are moved around. Coff stores
|
||||
all symbols less than nine characters long physically
|
||||
within the symbol table; longer strings are kept at the end of
|
||||
the file in the string table. This pass moves all strings
|
||||
into memory and replaces them with pointers to the strings.
|
||||
|
||||
The symbol table is massaged once again, this time to create
|
||||
the canonical table used by the BFD application. Each symbol
|
||||
is inspected in turn, and a decision made (using the
|
||||
@code{sclass} field) about the various flags to set in the
|
||||
@code{asymbol}. @xref{Symbols}. The generated canonical table
|
||||
shares strings with the hidden internal symbol table.
|
||||
|
||||
Any linenumbers are read from the coff file too, and attached
|
||||
to the symbols which own the functions the linenumbers belong to.
|
||||
|
||||
@subsubsection Symbol writing
|
||||
Writing a symbol to a coff file which didn't come from a coff
|
||||
file will lose any debugging information. The @code{asymbol}
|
||||
structure remembers the BFD from which the symbol was taken, and on
|
||||
output the back end makes sure that the same destination target as
|
||||
source target is present.
|
||||
|
||||
When the symbols have come from a coff file then all the
|
||||
debugging information is preserved.
|
||||
|
||||
Symbol tables are provided for writing to the back end in a
|
||||
vector of pointers to pointers. This allows applications like
|
||||
the linker to accumulate and output large symbol tables
|
||||
without having to do too much byte copying.
|
||||
|
||||
This function runs through the provided symbol table and
|
||||
patches each symbol marked as a file place holder
|
||||
(@code{C_FILE}) to point to the next file place holder in the
|
||||
list. It also marks each @code{offset} field in the list with
|
||||
the offset from the first symbol of the current symbol.
|
||||
|
||||
Another function of this procedure is to turn the canonical
|
||||
value form of BFD into the form used by coff. Internally, BFD
|
||||
expects symbol values to be offsets from a section base; so a
|
||||
symbol physically at 0x120, but in a section starting at
|
||||
0x100, would have the value 0x20. Coff expects symbols to
|
||||
contain their final value, so symbols have their values
|
||||
changed at this point to reflect their sum with their owning
|
||||
section. This transformation uses the
|
||||
@code{output_section} field of the @code{asymbol}'s
|
||||
@code{asection} @xref{Sections}.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{coff_mangle_symbols}
|
||||
@end itemize
|
||||
This routine runs though the provided symbol table and uses
|
||||
the offsets generated by the previous pass and the pointers
|
||||
generated when the symbol table was read in to create the
|
||||
structured hierachy required by coff. It changes each pointer
|
||||
to a symbol into the index into the symbol table of the asymbol.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{coff_write_symbols}
|
||||
@end itemize
|
||||
This routine runs through the symbol table and patches up the
|
||||
symbols from their internal form into the coff way, calls the
|
||||
bit twiddlers, and writes out the table to the file.
|
||||
|
||||
@findex coff_symbol_type
|
||||
@subsubsection @code{coff_symbol_type}
|
||||
@strong{Description}@*
|
||||
The hidden information for an @code{asymbol} is described in a
|
||||
@code{combined_entry_type}:
|
||||
|
||||
|
||||
@example
|
||||
|
||||
typedef struct coff_ptr_struct
|
||||
@{
|
||||
|
||||
/* Remembers the offset from the first symbol in the file for
|
||||
this symbol. Generated by coff_renumber_symbols. */
|
||||
unsigned int offset;
|
||||
|
||||
/* Should the value of this symbol be renumbered. Used for
|
||||
XCOFF C_BSTAT symbols. Set by coff_slurp_symbol_table. */
|
||||
unsigned int fix_value : 1;
|
||||
|
||||
/* Should the tag field of this symbol be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_tag : 1;
|
||||
|
||||
/* Should the endidx field of this symbol be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_end : 1;
|
||||
|
||||
/* Should the x_csect.x_scnlen field be renumbered.
|
||||
Created by coff_pointerize_aux. */
|
||||
unsigned int fix_scnlen : 1;
|
||||
|
||||
/* Fix up an XCOFF C_BINCL/C_EINCL symbol. The value is the
|
||||
index into the line number entries. Set by
|
||||
coff_slurp_symbol_table. */
|
||||
unsigned int fix_line : 1;
|
||||
|
||||
/* The container for the symbol structure as read and translated
|
||||
from the file. */
|
||||
|
||||
union @{
|
||||
union internal_auxent auxent;
|
||||
struct internal_syment syment;
|
||||
@} u;
|
||||
@} combined_entry_type;
|
||||
|
||||
|
||||
/* Each canonical asymbol really looks like this: */
|
||||
|
||||
typedef struct coff_symbol_struct
|
||||
@{
|
||||
/* The actual symbol which the rest of BFD works with */
|
||||
asymbol symbol;
|
||||
|
||||
/* A pointer to the hidden information for this symbol */
|
||||
combined_entry_type *native;
|
||||
|
||||
/* A pointer to the linenumber information for this symbol */
|
||||
struct lineno_cache_entry *lineno;
|
||||
|
||||
/* Have the line numbers been relocated yet ? */
|
||||
boolean done_lineno;
|
||||
@} coff_symbol_type;
|
||||
@end example
|
||||
@findex bfd_coff_backend_data
|
||||
@subsubsection @code{bfd_coff_backend_data}
|
||||
|
||||
@example
|
||||
/* COFF symbol classifications. */
|
||||
|
||||
enum coff_symbol_classification
|
||||
@{
|
||||
/* Global symbol. */
|
||||
COFF_SYMBOL_GLOBAL,
|
||||
/* Common symbol. */
|
||||
COFF_SYMBOL_COMMON,
|
||||
/* Undefined symbol. */
|
||||
COFF_SYMBOL_UNDEFINED,
|
||||
/* Local symbol. */
|
||||
COFF_SYMBOL_LOCAL,
|
||||
/* PE section symbol. */
|
||||
COFF_SYMBOL_PE_SECTION
|
||||
@};
|
||||
|
||||
@end example
|
||||
Special entry points for gdb to swap in coff symbol table parts:
|
||||
@example
|
||||
typedef struct
|
||||
@{
|
||||
void (*_bfd_coff_swap_aux_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
int type,
|
||||
int class,
|
||||
int indaux,
|
||||
int numaux,
|
||||
PTR in));
|
||||
|
||||
void (*_bfd_coff_swap_sym_in) PARAMS ((
|
||||
bfd *abfd ,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
|
||||
void (*_bfd_coff_swap_lineno_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
|
||||
@end example
|
||||
Special entry points for gas to swap out coff parts:
|
||||
@example
|
||||
unsigned int (*_bfd_coff_swap_aux_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
int type,
|
||||
int class,
|
||||
int indaux,
|
||||
int numaux,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_sym_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_lineno_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR ext));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_reloc_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR src,
|
||||
PTR dst));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_filehdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_aouthdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
unsigned int (*_bfd_coff_swap_scnhdr_out) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR in,
|
||||
PTR out));
|
||||
|
||||
@end example
|
||||
Special entry points for generic COFF routines to call target
|
||||
dependent COFF routines:
|
||||
@example
|
||||
unsigned int _bfd_filhsz;
|
||||
unsigned int _bfd_aoutsz;
|
||||
unsigned int _bfd_scnhsz;
|
||||
unsigned int _bfd_symesz;
|
||||
unsigned int _bfd_auxesz;
|
||||
unsigned int _bfd_relsz;
|
||||
unsigned int _bfd_linesz;
|
||||
unsigned int _bfd_filnmlen;
|
||||
boolean _bfd_coff_long_filenames;
|
||||
boolean _bfd_coff_long_section_names;
|
||||
unsigned int _bfd_coff_default_section_alignment_power;
|
||||
void (*_bfd_coff_swap_filehdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_aouthdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_scnhdr_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
void (*_bfd_coff_swap_reloc_in) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR ext,
|
||||
PTR in));
|
||||
boolean (*_bfd_coff_bad_format_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr));
|
||||
boolean (*_bfd_coff_set_arch_mach_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr));
|
||||
PTR (*_bfd_coff_mkobject_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_filehdr,
|
||||
PTR internal_aouthdr));
|
||||
flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_scnhdr,
|
||||
const char *name,
|
||||
asection *section));
|
||||
void (*_bfd_set_alignment_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
PTR internal_scnhdr));
|
||||
boolean (*_bfd_coff_slurp_symbol_table) PARAMS ((
|
||||
bfd *abfd));
|
||||
boolean (*_bfd_coff_symname_in_debug) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *sym));
|
||||
boolean (*_bfd_coff_pointerize_aux_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
combined_entry_type *table_base,
|
||||
combined_entry_type *symbol,
|
||||
unsigned int indaux,
|
||||
combined_entry_type *aux));
|
||||
boolean (*_bfd_coff_print_aux) PARAMS ((
|
||||
bfd *abfd,
|
||||
FILE *file,
|
||||
combined_entry_type *table_base,
|
||||
combined_entry_type *symbol,
|
||||
combined_entry_type *aux,
|
||||
unsigned int indaux));
|
||||
void (*_bfd_coff_reloc16_extra_cases) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct bfd_link_info *link_info,
|
||||
struct bfd_link_order *link_order,
|
||||
arelent *reloc,
|
||||
bfd_byte *data,
|
||||
unsigned int *src_ptr,
|
||||
unsigned int *dst_ptr));
|
||||
int (*_bfd_coff_reloc16_estimate) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *input_section,
|
||||
arelent *r,
|
||||
unsigned int shrink,
|
||||
struct bfd_link_info *link_info));
|
||||
enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *));
|
||||
boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||
bfd *abfd));
|
||||
boolean (*_bfd_coff_start_final_link) PARAMS ((
|
||||
bfd *output_bfd,
|
||||
struct bfd_link_info *info));
|
||||
boolean (*_bfd_coff_relocate_section) PARAMS ((
|
||||
bfd *output_bfd,
|
||||
struct bfd_link_info *info,
|
||||
bfd *input_bfd,
|
||||
asection *input_section,
|
||||
bfd_byte *contents,
|
||||
struct internal_reloc *relocs,
|
||||
struct internal_syment *syms,
|
||||
asection **sections));
|
||||
reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
struct internal_reloc *rel,
|
||||
struct coff_link_hash_entry *h,
|
||||
struct internal_syment *sym,
|
||||
bfd_vma *addendp));
|
||||
boolean (*_bfd_coff_adjust_symndx) PARAMS ((
|
||||
bfd *obfd,
|
||||
struct bfd_link_info *info,
|
||||
bfd *ibfd,
|
||||
asection *sec,
|
||||
struct internal_reloc *reloc,
|
||||
boolean *adjustedp));
|
||||
boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((
|
||||
struct bfd_link_info *info,
|
||||
bfd *abfd,
|
||||
const char *name,
|
||||
flagword flags,
|
||||
asection *section,
|
||||
bfd_vma value,
|
||||
const char *string,
|
||||
boolean copy,
|
||||
boolean collect,
|
||||
struct bfd_link_hash_entry **hashp));
|
||||
|
||||
boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
|
||||
bfd * abfd,
|
||||
struct coff_final_link_info * pfinfo));
|
||||
boolean (*_bfd_coff_final_link_postscript) PARAMS ((
|
||||
bfd * abfd,
|
||||
struct coff_final_link_info * pfinfo));
|
||||
|
||||
@} bfd_coff_backend_data;
|
||||
|
||||
#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)
|
||||
|
||||
#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))
|
||||
|
||||
#define bfd_coff_swap_sym_in(a,e,i) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))
|
||||
|
||||
#define bfd_coff_swap_lineno_in(a,e,i) \
|
||||
((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))
|
||||
|
||||
#define bfd_coff_swap_reloc_out(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_lineno_out(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \
|
||||
((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))
|
||||
|
||||
#define bfd_coff_swap_sym_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_scnhdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_filehdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aouthdr_out(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz)
|
||||
#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz)
|
||||
#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz)
|
||||
#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz)
|
||||
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
||||
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||
#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
|
||||
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
||||
#define bfd_coff_long_section_names(abfd) \
|
||||
(coff_backend_info (abfd)->_bfd_coff_long_section_names)
|
||||
#define bfd_coff_default_section_alignment_power(abfd) \
|
||||
(coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power)
|
||||
#define bfd_coff_swap_filehdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_aouthdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_scnhdr_in(abfd, i,o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_swap_reloc_in(abfd, i, o) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))
|
||||
|
||||
#define bfd_coff_bad_format_hook(abfd, filehdr) \
|
||||
((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))
|
||||
|
||||
#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
|
||||
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
|
||||
|
||||
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
|
||||
((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
|
||||
(abfd, scnhdr, name, section))
|
||||
|
||||
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
|
||||
((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
|
||||
|
||||
#define bfd_coff_slurp_symbol_table(abfd)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))
|
||||
|
||||
#define bfd_coff_symname_in_debug(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))
|
||||
|
||||
#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_print_aux)\
|
||||
(abfd, file, base, symbol, aux, indaux))
|
||||
|
||||
#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
|
||||
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
|
||||
|
||||
#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||
(abfd, section, reloc, shrink, link_info))
|
||||
|
||||
#define bfd_coff_classify_symbol(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
|
||||
(abfd, sym))
|
||||
|
||||
#define bfd_coff_compute_section_file_positions(abfd)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\
|
||||
(abfd))
|
||||
|
||||
#define bfd_coff_start_final_link(obfd, info)\
|
||||
((coff_backend_info (obfd)->_bfd_coff_start_final_link)\
|
||||
(obfd, info))
|
||||
#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\
|
||||
((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\
|
||||
(obfd, info, ibfd, o, con, rel, isyms, secs))
|
||||
#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\
|
||||
(abfd, sec, rel, h, sym, addendp))
|
||||
#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
|
||||
(obfd, info, ibfd, sec, rel, adjustedp))
|
||||
#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
|
||||
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
|
||||
|
||||
#define bfd_coff_link_output_has_begun(a,p) \
|
||||
((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
|
||||
#define bfd_coff_final_link_postscript(a,p) \
|
||||
((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
|
||||
|
||||
@end example
|
||||
@subsubsection Writing relocations
|
||||
To write relocations, the back end steps though the
|
||||
canonical relocation table and create an
|
||||
@code{internal_reloc}. The symbol index to use is removed from
|
||||
the @code{offset} field in the symbol table supplied. The
|
||||
address comes directly from the sum of the section base
|
||||
address and the relocation offset; the type is dug directly
|
||||
from the howto field. Then the @code{internal_reloc} is
|
||||
swapped into the shape of an @code{external_reloc} and written
|
||||
out to disk.
|
||||
|
||||
@subsubsection Reading linenumbers
|
||||
Creating the linenumber table is done by reading in the entire
|
||||
coff linenumber table, and creating another table for internal use.
|
||||
|
||||
A coff linenumber table is structured so that each function
|
||||
is marked as having a line number of 0. Each line within the
|
||||
function is an offset from the first line in the function. The
|
||||
base of the line number information for the table is stored in
|
||||
the symbol associated with the function.
|
||||
|
||||
Note: The PE format uses line number 0 for a flag indicating a
|
||||
new source file.
|
||||
|
||||
The information is copied from the external to the internal
|
||||
table, and each symbol which marks a function is marked by
|
||||
pointing its...
|
||||
|
||||
How does this work ?
|
||||
|
||||
@subsubsection Reading relocations
|
||||
Coff relocations are easily transformed into the internal BFD form
|
||||
(@code{arelent}).
|
||||
|
||||
Reading a coff relocation table is done in the following stages:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Read the entire coff relocation table into memory.
|
||||
|
||||
@item
|
||||
Process each relocation in turn; first swap it from the
|
||||
external to the internal form.
|
||||
|
||||
@item
|
||||
Turn the symbol referenced in the relocation's symbol index
|
||||
into a pointer into the canonical symbol table.
|
||||
This table is the same as the one returned by a call to
|
||||
@code{bfd_canonicalize_symtab}. The back end will call that
|
||||
routine and save the result if a canonicalization hasn't been done.
|
||||
|
||||
@item
|
||||
The reloc index is turned into a pointer to a howto
|
||||
structure, in a back end specific way. For instance, the 386
|
||||
and 960 use the @code{r_type} to directly produce an index
|
||||
into a howto table vector; the 88k subtracts a number from the
|
||||
@code{r_type} field and creates an addend field.
|
||||
@end itemize
|
||||
|
||||
38
bfd/doc/core.texi
Normal file
38
bfd/doc/core.texi
Normal file
@@ -0,0 +1,38 @@
|
||||
@section Core files
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
These are functions pertaining to core files.
|
||||
|
||||
@findex bfd_core_file_failing_command
|
||||
@subsubsection @code{bfd_core_file_failing_command}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
CONST char *bfd_core_file_failing_command(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a read-only string explaining which program was running
|
||||
when it failed and produced the core file @var{abfd}.
|
||||
|
||||
@findex bfd_core_file_failing_signal
|
||||
@subsubsection @code{bfd_core_file_failing_signal}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
int bfd_core_file_failing_signal(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Returns the signal number which caused the core dump which
|
||||
generated the file the BFD @var{abfd} is attached to.
|
||||
|
||||
@findex core_file_matches_executable_p
|
||||
@subsubsection @code{core_file_matches_executable_p}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean core_file_matches_executable_p
|
||||
(bfd *core_bfd, bfd *exec_bfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return @code{true} if the core file attached to @var{core_bfd}
|
||||
was generated by a run of the executable file attached to
|
||||
@var{exec_bfd}, @code{false} otherwise.
|
||||
|
||||
22
bfd/doc/elf.texi
Normal file
22
bfd/doc/elf.texi
Normal file
@@ -0,0 +1,22 @@
|
||||
@section ELF backends
|
||||
BFD support for ELF formats is being worked on.
|
||||
Currently, the best supported back ends are for sparc and i386
|
||||
(running svr4 or Solaris 2).
|
||||
|
||||
Documentation of the internals of the support code still needs
|
||||
to be written. The code is changing quickly enough that we
|
||||
haven't bothered yet.
|
||||
|
||||
@findex bfd_elf_find_section
|
||||
@subsubsection @code{bfd_elf_find_section}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
struct elf_internal_shdr *bfd_elf_find_section (bfd *abfd, char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Helper functions for GDB to locate the string tables.
|
||||
Since BFD hides string tables from callers, GDB needs to use an
|
||||
internal hook to find them. Sun's .stabstr, in particular,
|
||||
isn't even pointed to by the .stab section, so ordinary
|
||||
mechanisms wouldn't work to find it, even if we had some.
|
||||
|
||||
108
bfd/doc/format.texi
Normal file
108
bfd/doc/format.texi
Normal file
@@ -0,0 +1,108 @@
|
||||
@section File formats
|
||||
A format is a BFD concept of high level file contents type. The
|
||||
formats supported by BFD are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_object}
|
||||
@end itemize
|
||||
The BFD may contain data, symbols, relocations and debug info.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_archive}
|
||||
@end itemize
|
||||
The BFD contains other BFDs and an optional index.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_core}
|
||||
@end itemize
|
||||
The BFD contains the result of an executable core dump.
|
||||
|
||||
@findex bfd_check_format
|
||||
@subsubsection @code{bfd_check_format}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_check_format(bfd *abfd, bfd_format format);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Verify if the file attached to the BFD @var{abfd} is compatible
|
||||
with the format @var{format} (i.e., one of @code{bfd_object},
|
||||
@code{bfd_archive} or @code{bfd_core}).
|
||||
|
||||
If the BFD has been set to a specific target before the
|
||||
call, only the named target and format combination is
|
||||
checked. If the target has not been set, or has been set to
|
||||
@code{default}, then all the known target backends is
|
||||
interrogated to determine a match. If the default target
|
||||
matches, it is used. If not, exactly one target must recognize
|
||||
the file, or an error results.
|
||||
|
||||
The function returns @code{true} on success, otherwise @code{false}
|
||||
with one of the following error codes:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} -
|
||||
if @code{format} is not one of @code{bfd_object}, @code{bfd_archive} or
|
||||
@code{bfd_core}.
|
||||
|
||||
@item
|
||||
@code{bfd_error_system_call} -
|
||||
if an error occured during a read - even some file mismatches
|
||||
can cause bfd_error_system_calls.
|
||||
|
||||
@item
|
||||
@code{file_not_recognised} -
|
||||
none of the backends recognised the file format.
|
||||
|
||||
@item
|
||||
@code{bfd_error_file_ambiguously_recognized} -
|
||||
more than one backend recognised the file format.
|
||||
@end itemize
|
||||
|
||||
@findex bfd_check_format_matches
|
||||
@subsubsection @code{bfd_check_format_matches}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_check_format_matches(bfd *abfd, bfd_format format, char ***matching);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Like @code{bfd_check_format}, except when it returns false with
|
||||
@code{bfd_errno} set to @code{bfd_error_file_ambiguously_recognized}. In that
|
||||
case, if @var{matching} is not NULL, it will be filled in with
|
||||
a NULL-terminated list of the names of the formats that matched,
|
||||
allocated with @code{malloc}.
|
||||
Then the user may choose a format and try again.
|
||||
|
||||
When done with the list that @var{matching} points to, the caller
|
||||
should free it.
|
||||
|
||||
@findex bfd_set_format
|
||||
@subsubsection @code{bfd_set_format}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_format(bfd *abfd, bfd_format format);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
This function sets the file format of the BFD @var{abfd} to the
|
||||
format @var{format}. If the target set in the BFD does not
|
||||
support the format requested, the format is invalid, or the BFD
|
||||
is not open for writing, then an error occurs.
|
||||
|
||||
@findex bfd_format_string
|
||||
@subsubsection @code{bfd_format_string}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
CONST char *bfd_format_string(bfd_format format);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a pointer to a const string
|
||||
@code{invalid}, @code{object}, @code{archive}, @code{core}, or @code{unknown},
|
||||
depending upon the value of @var{format}.
|
||||
|
||||
245
bfd/doc/hash.texi
Normal file
245
bfd/doc/hash.texi
Normal file
@@ -0,0 +1,245 @@
|
||||
@section Hash Tables
|
||||
@cindex Hash tables
|
||||
BFD provides a simple set of hash table functions. Routines
|
||||
are provided to initialize a hash table, to free a hash table,
|
||||
to look up a string in a hash table and optionally create an
|
||||
entry for it, and to traverse a hash table. There is
|
||||
currently no routine to delete an string from a hash table.
|
||||
|
||||
The basic hash table does not permit any data to be stored
|
||||
with a string. However, a hash table is designed to present a
|
||||
base class from which other types of hash tables may be
|
||||
derived. These derived types may store additional information
|
||||
with the string. Hash tables were implemented in this way,
|
||||
rather than simply providing a data pointer in a hash table
|
||||
entry, because they were designed for use by the linker back
|
||||
ends. The linker may create thousands of hash table entries,
|
||||
and the overhead of allocating private data and storing and
|
||||
following pointers becomes noticeable.
|
||||
|
||||
The basic hash table code is in @code{hash.c}.
|
||||
|
||||
@menu
|
||||
* Creating and Freeing a Hash Table::
|
||||
* Looking Up or Entering a String::
|
||||
* Traversing a Hash Table::
|
||||
* Deriving a New Hash Table Type::
|
||||
@end menu
|
||||
|
||||
@node Creating and Freeing a Hash Table, Looking Up or Entering a String, Hash Tables, Hash Tables
|
||||
@subsection Creating and freeing a hash table
|
||||
@findex bfd_hash_table_init
|
||||
@findex bfd_hash_table_init_n
|
||||
To create a hash table, create an instance of a @code{struct
|
||||
bfd_hash_table} (defined in @code{bfd.h}) and call
|
||||
@code{bfd_hash_table_init} (if you know approximately how many
|
||||
entries you will need, the function @code{bfd_hash_table_init_n},
|
||||
which takes a @var{size} argument, may be used).
|
||||
@code{bfd_hash_table_init} returns @code{false} if some sort of
|
||||
error occurs.
|
||||
|
||||
@findex bfd_hash_newfunc
|
||||
The function @code{bfd_hash_table_init} take as an argument a
|
||||
function to use to create new entries. For a basic hash
|
||||
table, use the function @code{bfd_hash_newfunc}. @xref{Deriving
|
||||
a New Hash Table Type}, for why you would want to use a
|
||||
different value for this argument.
|
||||
|
||||
@findex bfd_hash_allocate
|
||||
@code{bfd_hash_table_init} will create an objalloc which will be
|
||||
used to allocate new entries. You may allocate memory on this
|
||||
objalloc using @code{bfd_hash_allocate}.
|
||||
|
||||
@findex bfd_hash_table_free
|
||||
Use @code{bfd_hash_table_free} to free up all the memory that has
|
||||
been allocated for a hash table. This will not free up the
|
||||
@code{struct bfd_hash_table} itself, which you must provide.
|
||||
|
||||
@node Looking Up or Entering a String, Traversing a Hash Table, Creating and Freeing a Hash Table, Hash Tables
|
||||
@subsection Looking up or entering a string
|
||||
@findex bfd_hash_lookup
|
||||
The function @code{bfd_hash_lookup} is used both to look up a
|
||||
string in the hash table and to create a new entry.
|
||||
|
||||
If the @var{create} argument is @code{false}, @code{bfd_hash_lookup}
|
||||
will look up a string. If the string is found, it will
|
||||
returns a pointer to a @code{struct bfd_hash_entry}. If the
|
||||
string is not found in the table @code{bfd_hash_lookup} will
|
||||
return @code{NULL}. You should not modify any of the fields in
|
||||
the returns @code{struct bfd_hash_entry}.
|
||||
|
||||
If the @var{create} argument is @code{true}, the string will be
|
||||
entered into the hash table if it is not already there.
|
||||
Either way a pointer to a @code{struct bfd_hash_entry} will be
|
||||
returned, either to the existing structure or to a newly
|
||||
created one. In this case, a @code{NULL} return means that an
|
||||
error occurred.
|
||||
|
||||
If the @var{create} argument is @code{true}, and a new entry is
|
||||
created, the @var{copy} argument is used to decide whether to
|
||||
copy the string onto the hash table objalloc or not. If
|
||||
@var{copy} is passed as @code{false}, you must be careful not to
|
||||
deallocate or modify the string as long as the hash table
|
||||
exists.
|
||||
|
||||
@node Traversing a Hash Table, Deriving a New Hash Table Type, Looking Up or Entering a String, Hash Tables
|
||||
@subsection Traversing a hash table
|
||||
@findex bfd_hash_traverse
|
||||
The function @code{bfd_hash_traverse} may be used to traverse a
|
||||
hash table, calling a function on each element. The traversal
|
||||
is done in a random order.
|
||||
|
||||
@code{bfd_hash_traverse} takes as arguments a function and a
|
||||
generic @code{void *} pointer. The function is called with a
|
||||
hash table entry (a @code{struct bfd_hash_entry *}) and the
|
||||
generic pointer passed to @code{bfd_hash_traverse}. The function
|
||||
must return a @code{boolean} value, which indicates whether to
|
||||
continue traversing the hash table. If the function returns
|
||||
@code{false}, @code{bfd_hash_traverse} will stop the traversal and
|
||||
return immediately.
|
||||
|
||||
@node Deriving a New Hash Table Type, , Traversing a Hash Table, Hash Tables
|
||||
@subsection Deriving a new hash table type
|
||||
Many uses of hash tables want to store additional information
|
||||
which each entry in the hash table. Some also find it
|
||||
convenient to store additional information with the hash table
|
||||
itself. This may be done using a derived hash table.
|
||||
|
||||
Since C is not an object oriented language, creating a derived
|
||||
hash table requires sticking together some boilerplate
|
||||
routines with a few differences specific to the type of hash
|
||||
table you want to create.
|
||||
|
||||
An example of a derived hash table is the linker hash table.
|
||||
The structures for this are defined in @code{bfdlink.h}. The
|
||||
functions are in @code{linker.c}.
|
||||
|
||||
You may also derive a hash table from an already derived hash
|
||||
table. For example, the a.out linker backend code uses a hash
|
||||
table derived from the linker hash table.
|
||||
|
||||
@menu
|
||||
* Define the Derived Structures::
|
||||
* Write the Derived Creation Routine::
|
||||
* Write Other Derived Routines::
|
||||
@end menu
|
||||
|
||||
@node Define the Derived Structures, Write the Derived Creation Routine, Deriving a New Hash Table Type, Deriving a New Hash Table Type
|
||||
@subsubsection Define the derived structures
|
||||
You must define a structure for an entry in the hash table,
|
||||
and a structure for the hash table itself.
|
||||
|
||||
The first field in the structure for an entry in the hash
|
||||
table must be of the type used for an entry in the hash table
|
||||
you are deriving from. If you are deriving from a basic hash
|
||||
table this is @code{struct bfd_hash_entry}, which is defined in
|
||||
@code{bfd.h}. The first field in the structure for the hash
|
||||
table itself must be of the type of the hash table you are
|
||||
deriving from itself. If you are deriving from a basic hash
|
||||
table, this is @code{struct bfd_hash_table}.
|
||||
|
||||
For example, the linker hash table defines @code{struct
|
||||
bfd_link_hash_entry} (in @code{bfdlink.h}). The first field,
|
||||
@code{root}, is of type @code{struct bfd_hash_entry}. Similarly,
|
||||
the first field in @code{struct bfd_link_hash_table}, @code{table},
|
||||
is of type @code{struct bfd_hash_table}.
|
||||
|
||||
@node Write the Derived Creation Routine, Write Other Derived Routines, Define the Derived Structures, Deriving a New Hash Table Type
|
||||
@subsubsection Write the derived creation routine
|
||||
You must write a routine which will create and initialize an
|
||||
entry in the hash table. This routine is passed as the
|
||||
function argument to @code{bfd_hash_table_init}.
|
||||
|
||||
In order to permit other hash tables to be derived from the
|
||||
hash table you are creating, this routine must be written in a
|
||||
standard way.
|
||||
|
||||
The first argument to the creation routine is a pointer to a
|
||||
hash table entry. This may be @code{NULL}, in which case the
|
||||
routine should allocate the right amount of space. Otherwise
|
||||
the space has already been allocated by a hash table type
|
||||
derived from this one.
|
||||
|
||||
After allocating space, the creation routine must call the
|
||||
creation routine of the hash table type it is derived from,
|
||||
passing in a pointer to the space it just allocated. This
|
||||
will initialize any fields used by the base hash table.
|
||||
|
||||
Finally the creation routine must initialize any local fields
|
||||
for the new hash table type.
|
||||
|
||||
Here is a boilerplate example of a creation routine.
|
||||
@var{function_name} is the name of the routine.
|
||||
@var{entry_type} is the type of an entry in the hash table you
|
||||
are creating. @var{base_newfunc} is the name of the creation
|
||||
routine of the hash table type your hash table is derived
|
||||
from.
|
||||
|
||||
|
||||
@example
|
||||
struct bfd_hash_entry *
|
||||
@var{function_name} (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
@{
|
||||
struct @var{entry_type} *ret = (@var{entry_type} *) entry;
|
||||
|
||||
/* Allocate the structure if it has not already been allocated by a
|
||||
derived class. */
|
||||
if (ret == (@var{entry_type} *) NULL)
|
||||
@{
|
||||
ret = ((@var{entry_type} *)
|
||||
bfd_hash_allocate (table, sizeof (@var{entry_type})));
|
||||
if (ret == (@var{entry_type} *) NULL)
|
||||
return NULL;
|
||||
@}
|
||||
|
||||
/* Call the allocation method of the base class. */
|
||||
ret = ((@var{entry_type} *)
|
||||
@var{base_newfunc} ((struct bfd_hash_entry *) ret, table, string));
|
||||
|
||||
/* Initialize the local fields here. */
|
||||
|
||||
return (struct bfd_hash_entry *) ret;
|
||||
@}
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
The creation routine for the linker hash table, which is in
|
||||
@code{linker.c}, looks just like this example.
|
||||
@var{function_name} is @code{_bfd_link_hash_newfunc}.
|
||||
@var{entry_type} is @code{struct bfd_link_hash_entry}.
|
||||
@var{base_newfunc} is @code{bfd_hash_newfunc}, the creation
|
||||
routine for a basic hash table.
|
||||
|
||||
@code{_bfd_link_hash_newfunc} also initializes the local fields
|
||||
in a linker hash table entry: @code{type}, @code{written} and
|
||||
@code{next}.
|
||||
|
||||
@node Write Other Derived Routines, , Write the Derived Creation Routine, Deriving a New Hash Table Type
|
||||
@subsubsection Write other derived routines
|
||||
You will want to write other routines for your new hash table,
|
||||
as well.
|
||||
|
||||
You will want an initialization routine which calls the
|
||||
initialization routine of the hash table you are deriving from
|
||||
and initializes any other local fields. For the linker hash
|
||||
table, this is @code{_bfd_link_hash_table_init} in @code{linker.c}.
|
||||
|
||||
You will want a lookup routine which calls the lookup routine
|
||||
of the hash table you are deriving from and casts the result.
|
||||
The linker hash table uses @code{bfd_link_hash_lookup} in
|
||||
@code{linker.c} (this actually takes an additional argument which
|
||||
it uses to decide how to return the looked up value).
|
||||
|
||||
You may want a traversal routine. This should just call the
|
||||
traversal routine of the hash table you are deriving from with
|
||||
appropriate casts. The linker hash table uses
|
||||
@code{bfd_link_hash_traverse} in @code{linker.c}.
|
||||
|
||||
These routines may simply be defined as macros. For example,
|
||||
the a.out backend linker hash table, which is derived from the
|
||||
linker hash table, uses macros for the lookup and traversal
|
||||
routines. These are @code{aout_link_hash_lookup} and
|
||||
@code{aout_link_hash_traverse} in aoutx.h.
|
||||
|
||||
13
bfd/doc/init.texi
Normal file
13
bfd/doc/init.texi
Normal file
@@ -0,0 +1,13 @@
|
||||
@section Initialization
|
||||
These are the functions that handle initializing a BFD.
|
||||
|
||||
@findex bfd_init
|
||||
@subsubsection @code{bfd_init}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_init(void);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
This routine must be called before any other BFD function to
|
||||
initialize magical internal data structures.
|
||||
|
||||
156
bfd/doc/libbfd.texi
Normal file
156
bfd/doc/libbfd.texi
Normal file
@@ -0,0 +1,156 @@
|
||||
@section Internal functions
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
These routines are used within BFD.
|
||||
They are not intended for export, but are documented here for
|
||||
completeness.
|
||||
|
||||
@findex bfd_write_bigendian_4byte_int
|
||||
@subsubsection @code{bfd_write_bigendian_4byte_int}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_write_bigendian_4byte_int(bfd *abfd, int i);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
|
||||
endian order regardless of what else is going on. This is useful in
|
||||
archives.
|
||||
|
||||
@findex bfd_put_size
|
||||
@subsubsection @code{bfd_put_size}
|
||||
@findex bfd_get_size
|
||||
@subsubsection @code{bfd_get_size}
|
||||
@strong{Description}@*
|
||||
These macros as used for reading and writing raw data in
|
||||
sections; each access (except for bytes) is vectored through
|
||||
the target format of the BFD and mangled accordingly. The
|
||||
mangling performs any necessary endian translations and
|
||||
removes alignment restrictions. Note that types accepted and
|
||||
returned by these macros are identical so they can be swapped
|
||||
around in macros---for example, @file{libaout.h} defines @code{GET_WORD}
|
||||
to either @code{bfd_get_32} or @code{bfd_get_64}.
|
||||
|
||||
In the put routines, @var{val} must be a @code{bfd_vma}. If we are on a
|
||||
system without prototypes, the caller is responsible for making
|
||||
sure that is true, with a cast if necessary. We don't cast
|
||||
them in the macro definitions because that would prevent @code{lint}
|
||||
or @code{gcc -Wall} from detecting sins such as passing a pointer.
|
||||
To detect calling these with less than a @code{bfd_vma}, use
|
||||
@code{gcc -Wconversion} on a host with 64 bit @code{bfd_vma}'s.
|
||||
@example
|
||||
|
||||
/* Byte swapping macros for user section data. */
|
||||
|
||||
#define bfd_put_8(abfd, val, ptr) \
|
||||
((void) (*((unsigned char *)(ptr)) = (unsigned char)(val)))
|
||||
#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))
|
||||
|
||||
#define bfd_get(bits, abfd, ptr) \
|
||||
((bits) == 8 ? bfd_get_8 (abfd, ptr) \
|
||||
: (bits) == 16 ? bfd_get_16 (abfd, ptr) \
|
||||
: (bits) == 32 ? bfd_get_32 (abfd, ptr) \
|
||||
: (bits) == 64 ? bfd_get_64 (abfd, ptr) \
|
||||
: (abort (), (bfd_vma) - 1))
|
||||
|
||||
#define bfd_put(bits, abfd, val, ptr) \
|
||||
((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
|
||||
: (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
|
||||
: (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
|
||||
: (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
|
||||
: (abort (), (void) 0))
|
||||
|
||||
@end example
|
||||
|
||||
@findex bfd_h_put_size
|
||||
@subsubsection @code{bfd_h_put_size}
|
||||
@strong{Description}@*
|
||||
These macros have the same function as their @code{bfd_get_x}
|
||||
bretheren, except that they are used for removing information
|
||||
for the header records of object files. Believe it or not,
|
||||
some object files keep their header records in big endian
|
||||
order and their data in little endian order.
|
||||
@example
|
||||
|
||||
/* 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))
|
||||
|
||||
@end example
|
||||
|
||||
@findex bfd_log2
|
||||
@subsubsection @code{bfd_log2}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
unsigned int bfd_log2(bfd_vma x);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return the log base 2 of the value supplied, rounded up. E.g., an
|
||||
@var{x} of 1025 returns 11.
|
||||
|
||||
365
bfd/doc/linker.texi
Normal file
365
bfd/doc/linker.texi
Normal file
@@ -0,0 +1,365 @@
|
||||
@section Linker Functions
|
||||
@cindex Linker
|
||||
The linker uses three special entry points in the BFD target
|
||||
vector. It is not necessary to write special routines for
|
||||
these entry points when creating a new BFD back end, since
|
||||
generic versions are provided. However, writing them can
|
||||
speed up linking and make it use significantly less runtime
|
||||
memory.
|
||||
|
||||
The first routine creates a hash table used by the other
|
||||
routines. The second routine adds the symbols from an object
|
||||
file to the hash table. The third routine takes all the
|
||||
object files and links them together to create the output
|
||||
file. These routines are designed so that the linker proper
|
||||
does not need to know anything about the symbols in the object
|
||||
files that it is linking. The linker merely arranges the
|
||||
sections as directed by the linker script and lets BFD handle
|
||||
the details of symbols and relocs.
|
||||
|
||||
The second routine and third routines are passed a pointer to
|
||||
a @code{struct bfd_link_info} structure (defined in
|
||||
@code{bfdlink.h}) which holds information relevant to the link,
|
||||
including the linker hash table (which was created by the
|
||||
first routine) and a set of callback functions to the linker
|
||||
proper.
|
||||
|
||||
The generic linker routines are in @code{linker.c}, and use the
|
||||
header file @code{genlink.h}. As of this writing, the only back
|
||||
ends which have implemented versions of these routines are
|
||||
a.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}). The a.out
|
||||
routines are used as examples throughout this section.
|
||||
|
||||
@menu
|
||||
* Creating a Linker Hash Table::
|
||||
* Adding Symbols to the Hash Table::
|
||||
* Performing the Final Link::
|
||||
@end menu
|
||||
|
||||
@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions
|
||||
@subsection Creating a linker hash table
|
||||
@cindex _bfd_link_hash_table_create in target vector
|
||||
@cindex target vector (_bfd_link_hash_table_create)
|
||||
The linker routines must create a hash table, which must be
|
||||
derived from @code{struct bfd_link_hash_table} described in
|
||||
@code{bfdlink.c}. @xref{Hash Tables}, for information on how to
|
||||
create a derived hash table. This entry point is called using
|
||||
the target vector of the linker output file.
|
||||
|
||||
The @code{_bfd_link_hash_table_create} entry point must allocate
|
||||
and initialize an instance of the desired hash table. If the
|
||||
back end does not require any additional information to be
|
||||
stored with the entries in the hash table, the entry point may
|
||||
simply create a @code{struct bfd_link_hash_table}. Most likely,
|
||||
however, some additional information will be needed.
|
||||
|
||||
For example, with each entry in the hash table the a.out
|
||||
linker keeps the index the symbol has in the final output file
|
||||
(this index number is used so that when doing a relocateable
|
||||
link the symbol index used in the output file can be quickly
|
||||
filled in when copying over a reloc). The a.out linker code
|
||||
defines the required structures and functions for a hash table
|
||||
derived from @code{struct bfd_link_hash_table}. The a.out linker
|
||||
hash table is created by the function
|
||||
@code{NAME(aout,link_hash_table_create)}; it simply allocates
|
||||
space for the hash table, initializes it, and returns a
|
||||
pointer to it.
|
||||
|
||||
When writing the linker routines for a new back end, you will
|
||||
generally not know exactly which fields will be required until
|
||||
you have finished. You should simply create a new hash table
|
||||
which defines no additional fields, and then simply add fields
|
||||
as they become necessary.
|
||||
|
||||
@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions
|
||||
@subsection Adding symbols to the hash table
|
||||
@cindex _bfd_link_add_symbols in target vector
|
||||
@cindex target vector (_bfd_link_add_symbols)
|
||||
The linker proper will call the @code{_bfd_link_add_symbols}
|
||||
entry point for each object file or archive which is to be
|
||||
linked (typically these are the files named on the command
|
||||
line, but some may also come from the linker script). The
|
||||
entry point is responsible for examining the file. For an
|
||||
object file, BFD must add any relevant symbol information to
|
||||
the hash table. For an archive, BFD must determine which
|
||||
elements of the archive should be used and adding them to the
|
||||
link.
|
||||
|
||||
The a.out version of this entry point is
|
||||
@code{NAME(aout,link_add_symbols)}.
|
||||
|
||||
@menu
|
||||
* Differing file formats::
|
||||
* Adding symbols from an object file::
|
||||
* Adding symbols from an archive::
|
||||
@end menu
|
||||
|
||||
@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table
|
||||
@subsubsection Differing file formats
|
||||
Normally all the files involved in a link will be of the same
|
||||
format, but it is also possible to link together different
|
||||
format object files, and the back end must support that. The
|
||||
@code{_bfd_link_add_symbols} entry point is called via the target
|
||||
vector of the file to be added. This has an important
|
||||
consequence: the function may not assume that the hash table
|
||||
is the type created by the corresponding
|
||||
@code{_bfd_link_hash_table_create} vector. All the
|
||||
@code{_bfd_link_add_symbols} function can assume about the hash
|
||||
table is that it is derived from @code{struct
|
||||
bfd_link_hash_table}.
|
||||
|
||||
Sometimes the @code{_bfd_link_add_symbols} function must store
|
||||
some information in the hash table entry to be used by the
|
||||
@code{_bfd_final_link} function. In such a case the @code{creator}
|
||||
field of the hash table must be checked to make sure that the
|
||||
hash table was created by an object file of the same format.
|
||||
|
||||
The @code{_bfd_final_link} routine must be prepared to handle a
|
||||
hash entry without any extra information added by the
|
||||
@code{_bfd_link_add_symbols} function. A hash entry without
|
||||
extra information will also occur when the linker script
|
||||
directs the linker to create a symbol. Note that, regardless
|
||||
of how a hash table entry is added, all the fields will be
|
||||
initialized to some sort of null value by the hash table entry
|
||||
initialization function.
|
||||
|
||||
See @code{ecoff_link_add_externals} for an example of how to
|
||||
check the @code{creator} field before saving information (in this
|
||||
case, the ECOFF external symbol debugging information) in a
|
||||
hash table entry.
|
||||
|
||||
@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table
|
||||
@subsubsection Adding symbols from an object file
|
||||
When the @code{_bfd_link_add_symbols} routine is passed an object
|
||||
file, it must add all externally visible symbols in that
|
||||
object file to the hash table. The actual work of adding the
|
||||
symbol to the hash table is normally handled by the function
|
||||
@code{_bfd_generic_link_add_one_symbol}. The
|
||||
@code{_bfd_link_add_symbols} routine is responsible for reading
|
||||
all the symbols from the object file and passing the correct
|
||||
information to @code{_bfd_generic_link_add_one_symbol}.
|
||||
|
||||
The @code{_bfd_link_add_symbols} routine should not use
|
||||
@code{bfd_canonicalize_symtab} to read the symbols. The point of
|
||||
providing this routine is to avoid the overhead of converting
|
||||
the symbols into generic @code{asymbol} structures.
|
||||
|
||||
@findex _bfd_generic_link_add_one_symbol
|
||||
@code{_bfd_generic_link_add_one_symbol} handles the details of
|
||||
combining common symbols, warning about multiple definitions,
|
||||
and so forth. It takes arguments which describe the symbol to
|
||||
add, notably symbol flags, a section, and an offset. The
|
||||
symbol flags include such things as @code{BSF_WEAK} or
|
||||
@code{BSF_INDIRECT}. The section is a section in the object
|
||||
file, or something like @code{bfd_und_section_ptr} for an undefined
|
||||
symbol or @code{bfd_com_section_ptr} for a common symbol.
|
||||
|
||||
If the @code{_bfd_final_link} routine is also going to need to
|
||||
read the symbol information, the @code{_bfd_link_add_symbols}
|
||||
routine should save it somewhere attached to the object file
|
||||
BFD. However, the information should only be saved if the
|
||||
@code{keep_memory} field of the @code{info} argument is true, so
|
||||
that the @code{-no-keep-memory} linker switch is effective.
|
||||
|
||||
The a.out function which adds symbols from an object file is
|
||||
@code{aout_link_add_object_symbols}, and most of the interesting
|
||||
work is in @code{aout_link_add_symbols}. The latter saves
|
||||
pointers to the hash tables entries created by
|
||||
@code{_bfd_generic_link_add_one_symbol} indexed by symbol number,
|
||||
so that the @code{_bfd_final_link} routine does not have to call
|
||||
the hash table lookup routine to locate the entry.
|
||||
|
||||
@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table
|
||||
@subsubsection Adding symbols from an archive
|
||||
When the @code{_bfd_link_add_symbols} routine is passed an
|
||||
archive, it must look through the symbols defined by the
|
||||
archive and decide which elements of the archive should be
|
||||
included in the link. For each such element it must call the
|
||||
@code{add_archive_element} linker callback, and it must add the
|
||||
symbols from the object file to the linker hash table.
|
||||
|
||||
@findex _bfd_generic_link_add_archive_symbols
|
||||
In most cases the work of looking through the symbols in the
|
||||
archive should be done by the
|
||||
@code{_bfd_generic_link_add_archive_symbols} function. This
|
||||
function builds a hash table from the archive symbol table and
|
||||
looks through the list of undefined symbols to see which
|
||||
elements should be included.
|
||||
@code{_bfd_generic_link_add_archive_symbols} is passed a function
|
||||
to call to make the final decision about adding an archive
|
||||
element to the link and to do the actual work of adding the
|
||||
symbols to the linker hash table.
|
||||
|
||||
The function passed to
|
||||
@code{_bfd_generic_link_add_archive_symbols} must read the
|
||||
symbols of the archive element and decide whether the archive
|
||||
element should be included in the link. If the element is to
|
||||
be included, the @code{add_archive_element} linker callback
|
||||
routine must be called with the element as an argument, and
|
||||
the elements symbols must be added to the linker hash table
|
||||
just as though the element had itself been passed to the
|
||||
@code{_bfd_link_add_symbols} function.
|
||||
|
||||
When the a.out @code{_bfd_link_add_symbols} function receives an
|
||||
archive, it calls @code{_bfd_generic_link_add_archive_symbols}
|
||||
passing @code{aout_link_check_archive_element} as the function
|
||||
argument. @code{aout_link_check_archive_element} calls
|
||||
@code{aout_link_check_ar_symbols}. If the latter decides to add
|
||||
the element (an element is only added if it provides a real,
|
||||
non-common, definition for a previously undefined or common
|
||||
symbol) it calls the @code{add_archive_element} callback and then
|
||||
@code{aout_link_check_archive_element} calls
|
||||
@code{aout_link_add_symbols} to actually add the symbols to the
|
||||
linker hash table.
|
||||
|
||||
The ECOFF back end is unusual in that it does not normally
|
||||
call @code{_bfd_generic_link_add_archive_symbols}, because ECOFF
|
||||
archives already contain a hash table of symbols. The ECOFF
|
||||
back end searches the archive itself to avoid the overhead of
|
||||
creating a new hash table.
|
||||
|
||||
@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions
|
||||
@subsection Performing the final link
|
||||
@cindex _bfd_link_final_link in target vector
|
||||
@cindex target vector (_bfd_final_link)
|
||||
When all the input files have been processed, the linker calls
|
||||
the @code{_bfd_final_link} entry point of the output BFD. This
|
||||
routine is responsible for producing the final output file,
|
||||
which has several aspects. It must relocate the contents of
|
||||
the input sections and copy the data into the output sections.
|
||||
It must build an output symbol table including any local
|
||||
symbols from the input files and the global symbols from the
|
||||
hash table. When producing relocateable output, it must
|
||||
modify the input relocs and write them into the output file.
|
||||
There may also be object format dependent work to be done.
|
||||
|
||||
The linker will also call the @code{write_object_contents} entry
|
||||
point when the BFD is closed. The two entry points must work
|
||||
together in order to produce the correct output file.
|
||||
|
||||
The details of how this works are inevitably dependent upon
|
||||
the specific object file format. The a.out
|
||||
@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}.
|
||||
|
||||
@menu
|
||||
* Information provided by the linker::
|
||||
* Relocating the section contents::
|
||||
* Writing the symbol table::
|
||||
@end menu
|
||||
|
||||
@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link
|
||||
@subsubsection Information provided by the linker
|
||||
Before the linker calls the @code{_bfd_final_link} entry point,
|
||||
it sets up some data structures for the function to use.
|
||||
|
||||
The @code{input_bfds} field of the @code{bfd_link_info} structure
|
||||
will point to a list of all the input files included in the
|
||||
link. These files are linked through the @code{link_next} field
|
||||
of the @code{bfd} structure.
|
||||
|
||||
Each section in the output file will have a list of
|
||||
@code{link_order} structures attached to the @code{link_order_head}
|
||||
field (the @code{link_order} structure is defined in
|
||||
@code{bfdlink.h}). These structures describe how to create the
|
||||
contents of the output section in terms of the contents of
|
||||
various input sections, fill constants, and, eventually, other
|
||||
types of information. They also describe relocs that must be
|
||||
created by the BFD backend, but do not correspond to any input
|
||||
file; this is used to support -Ur, which builds constructors
|
||||
while generating a relocateable object file.
|
||||
|
||||
@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
|
||||
@subsubsection Relocating the section contents
|
||||
The @code{_bfd_final_link} function should look through the
|
||||
@code{link_order} structures attached to each section of the
|
||||
output file. Each @code{link_order} structure should either be
|
||||
handled specially, or it should be passed to the function
|
||||
@code{_bfd_default_link_order} which will do the right thing
|
||||
(@code{_bfd_default_link_order} is defined in @code{linker.c}).
|
||||
|
||||
For efficiency, a @code{link_order} of type
|
||||
@code{bfd_indirect_link_order} whose associated section belongs
|
||||
to a BFD of the same format as the output BFD must be handled
|
||||
specially. This type of @code{link_order} describes part of an
|
||||
output section in terms of a section belonging to one of the
|
||||
input files. The @code{_bfd_final_link} function should read the
|
||||
contents of the section and any associated relocs, apply the
|
||||
relocs to the section contents, and write out the modified
|
||||
section contents. If performing a relocateable link, the
|
||||
relocs themselves must also be modified and written out.
|
||||
|
||||
@findex _bfd_relocate_contents
|
||||
@findex _bfd_final_link_relocate
|
||||
The functions @code{_bfd_relocate_contents} and
|
||||
@code{_bfd_final_link_relocate} provide some general support for
|
||||
performing the actual relocations, notably overflow checking.
|
||||
Their arguments include information about the symbol the
|
||||
relocation is against and a @code{reloc_howto_type} argument
|
||||
which describes the relocation to perform. These functions
|
||||
are defined in @code{reloc.c}.
|
||||
|
||||
The a.out function which handles reading, relocating, and
|
||||
writing section contents is @code{aout_link_input_section}. The
|
||||
actual relocation is done in @code{aout_link_input_section_std}
|
||||
and @code{aout_link_input_section_ext}.
|
||||
|
||||
@node Writing the symbol table, , Relocating the section contents, Performing the Final Link
|
||||
@subsubsection Writing the symbol table
|
||||
The @code{_bfd_final_link} function must gather all the symbols
|
||||
in the input files and write them out. It must also write out
|
||||
all the symbols in the global hash table. This must be
|
||||
controlled by the @code{strip} and @code{discard} fields of the
|
||||
@code{bfd_link_info} structure.
|
||||
|
||||
The local symbols of the input files will not have been
|
||||
entered into the linker hash table. The @code{_bfd_final_link}
|
||||
routine must consider each input file and include the symbols
|
||||
in the output file. It may be convenient to do this when
|
||||
looking through the @code{link_order} structures, or it may be
|
||||
done by stepping through the @code{input_bfds} list.
|
||||
|
||||
The @code{_bfd_final_link} routine must also traverse the global
|
||||
hash table to gather all the externally visible symbols. It
|
||||
is possible that most of the externally visible symbols may be
|
||||
written out when considering the symbols of each input file,
|
||||
but it is still necessary to traverse the hash table since the
|
||||
linker script may have defined some symbols that are not in
|
||||
any of the input files.
|
||||
|
||||
The @code{strip} field of the @code{bfd_link_info} structure
|
||||
controls which symbols are written out. The possible values
|
||||
are listed in @code{bfdlink.h}. If the value is @code{strip_some},
|
||||
then the @code{keep_hash} field of the @code{bfd_link_info}
|
||||
structure is a hash table of symbols to keep; each symbol
|
||||
should be looked up in this hash table, and only symbols which
|
||||
are present should be included in the output file.
|
||||
|
||||
If the @code{strip} field of the @code{bfd_link_info} structure
|
||||
permits local symbols to be written out, the @code{discard} field
|
||||
is used to further controls which local symbols are included
|
||||
in the output file. If the value is @code{discard_l}, then all
|
||||
local symbols which begin with a certain prefix are discarded;
|
||||
this is controlled by the @code{bfd_is_local_label_name} entry point.
|
||||
|
||||
The a.out backend handles symbols by calling
|
||||
@code{aout_link_write_symbols} on each input BFD and then
|
||||
traversing the global hash table with the function
|
||||
@code{aout_link_write_other_symbol}. It builds a string table
|
||||
while writing out the symbols, which is written to the output
|
||||
file at the end of @code{NAME(aout,final_link)}.
|
||||
|
||||
@findex bfd_link_split_section
|
||||
@subsubsection @code{bfd_link_split_section}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_link_split_section(bfd *abfd, asection *sec);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return nonzero if @var{sec} should be split during a
|
||||
reloceatable or final link.
|
||||
@example
|
||||
#define bfd_link_split_section(abfd, sec) \
|
||||
BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
|
||||
|
||||
@end example
|
||||
|
||||
159
bfd/doc/opncls.texi
Normal file
159
bfd/doc/opncls.texi
Normal file
@@ -0,0 +1,159 @@
|
||||
@section Opening and closing BFDs
|
||||
|
||||
|
||||
@findex bfd_openr
|
||||
@subsubsection @code{bfd_openr}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd *bfd_openr(CONST char *filename, CONST char *target);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Open the file @var{filename} (using @code{fopen}) with the target
|
||||
@var{target}. Return a pointer to the created BFD.
|
||||
|
||||
Calls @code{bfd_find_target}, so @var{target} is interpreted as by
|
||||
that function.
|
||||
|
||||
If @code{NULL} is returned then an error has occured. Possible errors
|
||||
are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} or @code{system_call} error.
|
||||
|
||||
@findex bfd_fdopenr
|
||||
@subsubsection @code{bfd_fdopenr}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
@code{bfd_fdopenr} is to @code{bfd_fopenr} much like @code{fdopen} is to @code{fopen}.
|
||||
It opens a BFD on a file already described by the @var{fd}
|
||||
supplied.
|
||||
|
||||
When the file is later @code{bfd_close}d, the file descriptor will be closed.
|
||||
|
||||
If the caller desires that this file descriptor be cached by BFD
|
||||
(opened as needed, closed as needed to free descriptors for
|
||||
other opens), with the supplied @var{fd} used as an initial
|
||||
file descriptor (but subject to closure at any time), call
|
||||
bfd_set_cacheable(bfd, 1) on the returned BFD. The default is to
|
||||
assume no cacheing; the file descriptor will remain open until
|
||||
@code{bfd_close}, and will not be affected by BFD operations on other
|
||||
files.
|
||||
|
||||
Possible errors are @code{bfd_error_no_memory}, @code{bfd_error_invalid_target} and @code{bfd_error_system_call}.
|
||||
|
||||
@findex bfd_openstreamr
|
||||
@subsubsection @code{bfd_openstreamr}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd *bfd_openstreamr(const char *, const char *, PTR);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Open a BFD for read access on an existing stdio stream. When
|
||||
the BFD is passed to @code{bfd_close}, the stream will be closed.
|
||||
|
||||
@findex bfd_openw
|
||||
@subsubsection @code{bfd_openw}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd *bfd_openw(CONST char *filename, CONST char *target);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Create a BFD, associated with file @var{filename}, using the
|
||||
file format @var{target}, and return a pointer to it.
|
||||
|
||||
Possible errors are @code{bfd_error_system_call}, @code{bfd_error_no_memory},
|
||||
@code{bfd_error_invalid_target}.
|
||||
|
||||
@findex bfd_close
|
||||
@subsubsection @code{bfd_close}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_close(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Close a BFD. If the BFD was open for writing,
|
||||
then pending operations are completed and the file written out
|
||||
and closed. If the created file is executable, then
|
||||
@code{chmod} is called to mark it as such.
|
||||
|
||||
All memory attached to the BFD is released.
|
||||
|
||||
The file descriptor associated with the BFD is closed (even
|
||||
if it was passed in to BFD by @code{bfd_fdopenr}).
|
||||
|
||||
@strong{Returns}@*
|
||||
@code{true} is returned if all is ok, otherwise @code{false}.
|
||||
|
||||
@findex bfd_close_all_done
|
||||
@subsubsection @code{bfd_close_all_done}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_close_all_done(bfd *);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Close a BFD. Differs from @code{bfd_close}
|
||||
since it does not complete any pending operations. This
|
||||
routine would be used if the application had just used BFD for
|
||||
swapping and didn't want to use any of the writing code.
|
||||
|
||||
If the created file is executable, then @code{chmod} is called
|
||||
to mark it as such.
|
||||
|
||||
All memory attached to the BFD is released.
|
||||
|
||||
@strong{Returns}@*
|
||||
@code{true} is returned if all is ok, otherwise @code{false}.
|
||||
|
||||
@findex bfd_create
|
||||
@subsubsection @code{bfd_create}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
bfd *bfd_create(CONST char *filename, bfd *templ);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Create a new BFD in the manner of
|
||||
@code{bfd_openw}, but without opening a file. The new BFD
|
||||
takes the target from the target used by @var{template}. The
|
||||
format is always set to @code{bfd_object}.
|
||||
|
||||
@findex bfd_make_writable
|
||||
@subsubsection @code{bfd_make_writable}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_make_writable(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Takes a BFD as created by @code{bfd_create} and converts it
|
||||
into one like as returned by @code{bfd_openw}. It does this
|
||||
by converting the BFD to BFD_IN_MEMORY. It's assumed that
|
||||
you will call @code{bfd_make_readable} on this bfd later.
|
||||
|
||||
@strong{Returns}@*
|
||||
@code{true} is returned if all is ok, otherwise @code{false}.
|
||||
|
||||
@findex bfd_make_readable
|
||||
@subsubsection @code{bfd_make_readable}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_make_readable(bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Takes a BFD as created by @code{bfd_create} and
|
||||
@code{bfd_make_writable} and converts it into one like as
|
||||
returned by @code{bfd_openr}. It does this by writing the
|
||||
contents out to the memory buffer, then reversing the
|
||||
direction.
|
||||
|
||||
@strong{Returns}@*
|
||||
@code{true} is returned if all is ok, otherwise @code{false}.
|
||||
|
||||
@findex bfd_alloc
|
||||
@subsubsection @code{bfd_alloc}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
PTR bfd_alloc (bfd *abfd, size_t wanted);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Allocate a block of @var{wanted} bytes of memory attached to
|
||||
@code{abfd} and return a pointer to it.
|
||||
|
||||
1267
bfd/doc/reloc.texi
Normal file
1267
bfd/doc/reloc.texi
Normal file
File diff suppressed because it is too large
Load Diff
707
bfd/doc/section.texi
Normal file
707
bfd/doc/section.texi
Normal file
@@ -0,0 +1,707 @@
|
||||
@section Sections
|
||||
The raw data contained within a BFD is maintained through the
|
||||
section abstraction. A single BFD may have any number of
|
||||
sections. It keeps hold of them by pointing to the first;
|
||||
each one points to the next in the list.
|
||||
|
||||
Sections are supported in BFD in @code{section.c}.
|
||||
|
||||
@menu
|
||||
* Section Input::
|
||||
* Section Output::
|
||||
* typedef asection::
|
||||
* section prototypes::
|
||||
@end menu
|
||||
|
||||
@node Section Input, Section Output, Sections, Sections
|
||||
@subsection Section input
|
||||
When a BFD is opened for reading, the section structures are
|
||||
created and attached to the BFD.
|
||||
|
||||
Each section has a name which describes the section in the
|
||||
outside world---for example, @code{a.out} would contain at least
|
||||
three sections, called @code{.text}, @code{.data} and @code{.bss}.
|
||||
|
||||
Names need not be unique; for example a COFF file may have several
|
||||
sections named @code{.data}.
|
||||
|
||||
Sometimes a BFD will contain more than the ``natural'' number of
|
||||
sections. A back end may attach other sections containing
|
||||
constructor data, or an application may add a section (using
|
||||
@code{bfd_make_section}) to the sections attached to an already open
|
||||
BFD. For example, the linker creates an extra section
|
||||
@code{COMMON} for each input file's BFD to hold information about
|
||||
common storage.
|
||||
|
||||
The raw data is not necessarily read in when
|
||||
the section descriptor is created. Some targets may leave the
|
||||
data in place until a @code{bfd_get_section_contents} call is
|
||||
made. Other back ends may read in all the data at once. For
|
||||
example, an S-record file has to be read once to determine the
|
||||
size of the data. An IEEE-695 file doesn't contain raw data in
|
||||
sections, but data and relocation expressions intermixed, so
|
||||
the data area has to be parsed to get out the data and
|
||||
relocations.
|
||||
|
||||
@node Section Output, typedef asection, Section Input, Sections
|
||||
@subsection Section output
|
||||
To write a new object style BFD, the various sections to be
|
||||
written have to be created. They are attached to the BFD in
|
||||
the same way as input sections; data is written to the
|
||||
sections using @code{bfd_set_section_contents}.
|
||||
|
||||
Any program that creates or combines sections (e.g., the assembler
|
||||
and linker) must use the @code{asection} fields @code{output_section} and
|
||||
@code{output_offset} to indicate the file sections to which each
|
||||
section must be written. (If the section is being created from
|
||||
scratch, @code{output_section} should probably point to the section
|
||||
itself and @code{output_offset} should probably be zero.)
|
||||
|
||||
The data to be written comes from input sections attached
|
||||
(via @code{output_section} pointers) to
|
||||
the output sections. The output section structure can be
|
||||
considered a filter for the input section: the output section
|
||||
determines the vma of the output data and the name, but the
|
||||
input section determines the offset into the output section of
|
||||
the data to be written.
|
||||
|
||||
E.g., to create a section "O", starting at 0x100, 0x123 long,
|
||||
containing two subsections, "A" at offset 0x0 (i.e., at vma
|
||||
0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection}
|
||||
structures would look like:
|
||||
|
||||
@example
|
||||
section name "A"
|
||||
output_offset 0x00
|
||||
size 0x20
|
||||
output_section -----------> section name "O"
|
||||
| vma 0x100
|
||||
section name "B" | size 0x123
|
||||
output_offset 0x20 |
|
||||
size 0x103 |
|
||||
output_section --------|
|
||||
@end example
|
||||
|
||||
@subsection Link orders
|
||||
The data within a section is stored in a @dfn{link_order}.
|
||||
These are much like the fixups in @code{gas}. The link_order
|
||||
abstraction allows a section to grow and shrink within itself.
|
||||
|
||||
A link_order knows how big it is, and which is the next
|
||||
link_order and where the raw data for it is; it also points to
|
||||
a list of relocations which apply to it.
|
||||
|
||||
The link_order is used by the linker to perform relaxing on
|
||||
final code. The compiler creates code which is as big as
|
||||
necessary to make it work without relaxing, and the user can
|
||||
select whether to relax. Sometimes relaxing takes a lot of
|
||||
time. The linker runs around the relocations to see if any
|
||||
are attached to data which can be shrunk, if so it does it on
|
||||
a link_order by link_order basis.
|
||||
|
||||
|
||||
@node typedef asection, section prototypes, Section Output, Sections
|
||||
@subsection typedef asection
|
||||
Here is the section structure:
|
||||
|
||||
|
||||
@example
|
||||
|
||||
/* This structure is used for a comdat section, as in PE. A comdat
|
||||
section is associated with a particular symbol. When the linker
|
||||
sees a comdat section, it keeps only one of the sections with a
|
||||
given name and associated with a given symbol. */
|
||||
|
||||
struct bfd_comdat_info
|
||||
@{
|
||||
/* The name of the symbol associated with a comdat section. */
|
||||
const char *name;
|
||||
|
||||
/* The local symbol table index of the symbol associated with a
|
||||
comdat section. This is only meaningful to the object file format
|
||||
specific code; it is not an index into the list returned by
|
||||
bfd_canonicalize_symtab. */
|
||||
long symbol;
|
||||
|
||||
/* If this section is being discarded, the linker uses this field
|
||||
to point to the input section which is being kept. */
|
||||
struct sec *sec;
|
||||
@};
|
||||
|
||||
typedef struct sec
|
||||
@{
|
||||
/* The name of the section; the name isn't a copy, the pointer is
|
||||
the same as that passed to bfd_make_section. */
|
||||
|
||||
CONST char *name;
|
||||
|
||||
/* Which section is it; 0..nth. */
|
||||
|
||||
int index;
|
||||
|
||||
/* The next section in the list belonging to the BFD, or NULL. */
|
||||
|
||||
struct sec *next;
|
||||
|
||||
/* The field flags contains attributes of the section. Some
|
||||
flags are read in from the object file, and some are
|
||||
synthesized from other information. */
|
||||
|
||||
flagword flags;
|
||||
|
||||
#define SEC_NO_FLAGS 0x000
|
||||
|
||||
/* Tells the OS to allocate space for this section when loading.
|
||||
This is clear for a section containing debug information
|
||||
only. */
|
||||
#define SEC_ALLOC 0x001
|
||||
|
||||
/* Tells the OS to load the section from the file when loading.
|
||||
This is clear for a .bss section. */
|
||||
#define SEC_LOAD 0x002
|
||||
|
||||
/* The section contains data still to be relocated, so there is
|
||||
some relocation information too. */
|
||||
#define SEC_RELOC 0x004
|
||||
|
||||
#if 0 /* Obsolete ? */
|
||||
#define SEC_BALIGN 0x008
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
#define SEC_DATA 0x040
|
||||
|
||||
/* 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 @code{g++}. When a back end sees a symbol
|
||||
which should be used in a constructor list, it creates a new
|
||||
section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
|
||||
the symbol to it, and builds a relocation. To build the lists
|
||||
of constructors, all the linker has to do is catenate all the
|
||||
sections called @code{__CTOR_LIST__} and relocate the data
|
||||
contained within - exactly the operations it would peform on
|
||||
standard data. */
|
||||
#define SEC_CONSTRUCTOR 0x100
|
||||
|
||||
/* The section is a constructor, and should be placed at the
|
||||
end of the text, data, or bss section(?). */
|
||||
#define SEC_CONSTRUCTOR_TEXT 0x1100
|
||||
#define SEC_CONSTRUCTOR_DATA 0x2100
|
||||
#define SEC_CONSTRUCTOR_BSS 0x3100
|
||||
|
||||
/* The section has contents - a data section could be
|
||||
@code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
|
||||
@code{SEC_HAS_CONTENTS} */
|
||||
#define SEC_HAS_CONTENTS 0x200
|
||||
|
||||
/* An instruction to the linker to not output the section
|
||||
even if it has information which would normally be written. */
|
||||
#define SEC_NEVER_LOAD 0x400
|
||||
|
||||
/* 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
|
||||
|
||||
/* The section contains common symbols (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
|
||||
used). Most targets have exactly one of these (which we
|
||||
translate to bfd_com_section_ptr), but ECOFF has two. */
|
||||
#define SEC_IS_COMMON 0x8000
|
||||
|
||||
/* 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
|
||||
|
||||
/* 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
|
||||
|
||||
/* The contents of this section are to be excluded by the
|
||||
linker for executable and shared objects unless those
|
||||
objects are to be further relocated. */
|
||||
#define SEC_EXCLUDE 0x40000
|
||||
|
||||
/* The contents of this section are to be sorted by the
|
||||
based on the address specified in the associated symbol
|
||||
table. */
|
||||
#define SEC_SORT_ENTRIES 0x80000
|
||||
|
||||
/* When linking, duplicate sections of the same name should be
|
||||
discarded, rather than being combined into a single section as
|
||||
is usually done. This is similar to how common symbols are
|
||||
handled. See SEC_LINK_DUPLICATES below. */
|
||||
#define SEC_LINK_ONCE 0x100000
|
||||
|
||||
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker
|
||||
should handle duplicate sections. */
|
||||
#define SEC_LINK_DUPLICATES 0x600000
|
||||
|
||||
/* This value for SEC_LINK_DUPLICATES means that duplicate
|
||||
sections with the same name should simply be discarded. */
|
||||
#define SEC_LINK_DUPLICATES_DISCARD 0x0
|
||||
|
||||
/* This value for SEC_LINK_DUPLICATES means that the linker
|
||||
should warn if there are any duplicate sections, although
|
||||
it should still only link one copy. */
|
||||
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
|
||||
|
||||
/* This value for SEC_LINK_DUPLICATES means that the linker
|
||||
should warn if any duplicate sections are a different size. */
|
||||
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
|
||||
|
||||
/* This value for SEC_LINK_DUPLICATES means that the linker
|
||||
should warn if any duplicate sections contain different
|
||||
contents. */
|
||||
#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
|
||||
|
||||
/* This section was created by the linker as part of dynamic
|
||||
relocation or other arcane processing. It is skipped when
|
||||
going through the first-pass output, trusting that someone
|
||||
else up the line will take care of it later. */
|
||||
#define SEC_LINKER_CREATED 0x800000
|
||||
|
||||
/* This section should not be subject to garbage collection. */
|
||||
#define SEC_KEEP 0x1000000
|
||||
|
||||
/* This section contains "short" data, and should be placed
|
||||
"near" the GP. */
|
||||
#define SEC_SMALL_DATA 0x2000000
|
||||
|
||||
/* This section contains data which may be shared with other
|
||||
executables or shared objects. */
|
||||
#define SEC_SHARED 0x4000000
|
||||
|
||||
/* End of section flags. */
|
||||
|
||||
/* Some internal packed boolean fields. */
|
||||
|
||||
/* See the vma field. */
|
||||
unsigned int user_set_vma : 1;
|
||||
|
||||
/* Whether relocations have been processed. */
|
||||
unsigned int reloc_done : 1;
|
||||
|
||||
/* A mark flag used by some of the linker backends. */
|
||||
unsigned int linker_mark : 1;
|
||||
|
||||
/* A mark flag used by some linker backends for garbage collection. */
|
||||
unsigned int gc_mark : 1;
|
||||
|
||||
/* End of internal packed boolean fields. */
|
||||
|
||||
/* The virtual memory address of the section - where it will be
|
||||
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 @code{a.out}, where
|
||||
the default address for @code{.data} is dependent on the specific
|
||||
target and various flags). */
|
||||
|
||||
bfd_vma vma;
|
||||
|
||||
/* The load address of the section - where it would be in a
|
||||
rom image; really only used for writing section header
|
||||
information. */
|
||||
|
||||
bfd_vma lma;
|
||||
|
||||
/* The size of the section in octets, as it will be output.
|
||||
Contains a value even if the section has no contents (e.g., the
|
||||
size of @code{.bss}). This will be filled in after relocation. */
|
||||
|
||||
bfd_size_type _cooked_size;
|
||||
|
||||
/* The original size on disk of the section, in octets. Normally this
|
||||
value is the same as the size, but if some relaxing has
|
||||
been done, then this value will be bigger. */
|
||||
|
||||
bfd_size_type _raw_size;
|
||||
|
||||
/* If this section is going to be output, then this value is the
|
||||
offset in *bytes* into the output section of the first byte in the
|
||||
input section (byte ==> smallest addressable unit on the
|
||||
target). In most cases, if this was going to start at the
|
||||
100th octet (8-bit quantity) in the output section, this value
|
||||
would be 100. However, if the target byte size is 16 bits
|
||||
(bfd_octets_per_byte is "2"), this value would be 50. */
|
||||
|
||||
bfd_vma output_offset;
|
||||
|
||||
/* The output section through which to map on output. */
|
||||
|
||||
struct sec *output_section;
|
||||
|
||||
/* The alignment requirement of the section, as an exponent of 2 -
|
||||
e.g., 3 aligns to 2^3 (or 8). */
|
||||
|
||||
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
|
||||
or updated. */
|
||||
|
||||
/* File position of section data */
|
||||
|
||||
file_ptr filepos;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* If the SEC_IN_MEMORY flag is set, this points to the actual
|
||||
contents. */
|
||||
unsigned char *contents;
|
||||
|
||||
/* Attached line number information */
|
||||
|
||||
alent *lineno;
|
||||
|
||||
/* Number of line number records */
|
||||
|
||||
unsigned int lineno_count;
|
||||
|
||||
/* Optional information about a COMDAT entry; NULL if not COMDAT */
|
||||
|
||||
struct bfd_comdat_info *comdat;
|
||||
|
||||
/* When a section is being output, this value changes as more
|
||||
linenumbers are written out */
|
||||
|
||||
file_ptr moving_line_filepos;
|
||||
|
||||
/* What the section number is in the target world */
|
||||
|
||||
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;
|
||||
|
||||
/* A symbol which points at this section only */
|
||||
struct symbol_cache_entry *symbol;
|
||||
struct symbol_cache_entry **symbol_ptr_ptr;
|
||||
|
||||
struct bfd_link_order *link_order_head;
|
||||
struct bfd_link_order *link_order_tail;
|
||||
@} asection ;
|
||||
|
||||
/* These sections are global, and are managed by BFD. The application
|
||||
and target back end are not permitted to change the values in
|
||||
these sections. New code should use the section_ptr macros rather
|
||||
than referring directly to the const sections. The const sections
|
||||
may eventually vanish. */
|
||||
#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 */
|
||||
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)
|
||||
/* Pointer to the undefined section */
|
||||
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)
|
||||
/* Pointer to the common section */
|
||||
extern const asection bfd_com_section;
|
||||
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
|
||||
/* Pointer to the indirect section */
|
||||
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;
|
||||
#define bfd_get_section_size_before_reloc(section) \
|
||||
((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
|
||||
: (section)->_raw_size)
|
||||
#define bfd_get_section_size_after_reloc(section) \
|
||||
((section)->reloc_done ? (section)->_cooked_size \
|
||||
: (abort (), (bfd_size_type) 1))
|
||||
@end example
|
||||
|
||||
@node section prototypes, , typedef asection, Sections
|
||||
@subsection Section prototypes
|
||||
These are the functions exported by the section handling part of BFD.
|
||||
|
||||
@findex bfd_get_section_by_name
|
||||
@subsubsection @code{bfd_get_section_by_name}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
asection *bfd_get_section_by_name(bfd *abfd, CONST char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Run through @var{abfd} and return the one of the
|
||||
@code{asection}s whose name matches @var{name}, otherwise @code{NULL}.
|
||||
@xref{Sections}, for more information.
|
||||
|
||||
This should only be used in special cases; the normal way to process
|
||||
all sections of a given name is to use @code{bfd_map_over_sections} and
|
||||
@code{strcmp} on the name (or better yet, base it on the section flags
|
||||
or something else) for each section.
|
||||
|
||||
@findex bfd_make_section_old_way
|
||||
@subsubsection @code{bfd_make_section_old_way}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
asection *bfd_make_section_old_way(bfd *abfd, CONST char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Create a new empty section called @var{name}
|
||||
and attach it to the end of the chain of sections for the
|
||||
BFD @var{abfd}. An attempt to create a section with a name which
|
||||
is already in use returns its pointer without changing the
|
||||
section chain.
|
||||
|
||||
It has the funny name since this is the way it used to be
|
||||
before it was rewritten....
|
||||
|
||||
Possible errors are:
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} -
|
||||
If output has already started for this BFD.
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
If memory allocation fails.
|
||||
@end itemize
|
||||
|
||||
@findex bfd_make_section_anyway
|
||||
@subsubsection @code{bfd_make_section_anyway}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
asection *bfd_make_section_anyway(bfd *abfd, CONST char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Create a new empty section called @var{name} and attach it to the end of
|
||||
the chain of sections for @var{abfd}. Create a new section even if there
|
||||
is already a section with that name.
|
||||
|
||||
Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
|
||||
@item
|
||||
@code{bfd_error_no_memory} - If memory allocation fails.
|
||||
@end itemize
|
||||
|
||||
@findex bfd_make_section
|
||||
@subsubsection @code{bfd_make_section}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
asection *bfd_make_section(bfd *, CONST char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
|
||||
bfd_set_error ()) without changing the section chain if there is already a
|
||||
section named @var{name}. If there is an error, return @code{NULL} and set
|
||||
@code{bfd_error}.
|
||||
|
||||
@findex bfd_set_section_flags
|
||||
@subsubsection @code{bfd_set_section_flags}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the attributes of the section @var{sec} in the BFD
|
||||
@var{abfd} to the value @var{flags}. Return @code{true} on success,
|
||||
@code{false} on error. Possible error returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} -
|
||||
The section cannot have one or more of the attributes
|
||||
requested. For example, a .bss section in @code{a.out} may not
|
||||
have the @code{SEC_HAS_CONTENTS} field set.
|
||||
@end itemize
|
||||
|
||||
@findex bfd_map_over_sections
|
||||
@subsubsection @code{bfd_map_over_sections}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_map_over_sections(bfd *abfd,
|
||||
void (*func)(bfd *abfd,
|
||||
asection *sect,
|
||||
PTR obj),
|
||||
PTR obj);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Call the provided function @var{func} for each section
|
||||
attached to the BFD @var{abfd}, passing @var{obj} as an
|
||||
argument. The function will be called as if by
|
||||
|
||||
@example
|
||||
func(abfd, the_section, obj);
|
||||
@end example
|
||||
|
||||
This is the prefered method for iterating over sections; an
|
||||
alternative would be to use a loop:
|
||||
|
||||
@example
|
||||
section *p;
|
||||
for (p = abfd->sections; p != NULL; p = p->next)
|
||||
func(abfd, p, ...)
|
||||
@end example
|
||||
|
||||
@findex bfd_set_section_size
|
||||
@subsubsection @code{bfd_set_section_size}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set @var{sec} to the size @var{val}. If the operation is
|
||||
ok, then @code{true} is returned, else @code{false}.
|
||||
|
||||
Possible error returns:
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_invalid_operation} -
|
||||
Writing has started to the BFD, so setting the size is invalid.
|
||||
@end itemize
|
||||
|
||||
@findex bfd_set_section_contents
|
||||
@subsubsection @code{bfd_set_section_contents}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_section_contents
|
||||
(bfd *abfd,
|
||||
asection *section,
|
||||
PTR data,
|
||||
file_ptr offset,
|
||||
bfd_size_type count);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Sets the contents of the section @var{section} in BFD
|
||||
@var{abfd} to the data starting in memory at @var{data}. The
|
||||
data is written to the output section starting at offset
|
||||
@var{offset} for @var{count} octets.
|
||||
|
||||
Normally @code{true} is returned, else @code{false}. Possible error
|
||||
returns are:
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_contents} -
|
||||
The output section does not have the @code{SEC_HAS_CONTENTS}
|
||||
attribute, so nothing can be written to it.
|
||||
@item
|
||||
and some more too
|
||||
@end itemize
|
||||
This routine is front end to the back end function
|
||||
@code{_bfd_set_section_contents}.
|
||||
|
||||
@findex bfd_get_section_contents
|
||||
@subsubsection @code{bfd_get_section_contents}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_get_section_contents
|
||||
(bfd *abfd, asection *section, PTR location,
|
||||
file_ptr offset, bfd_size_type count);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Read data from @var{section} in BFD @var{abfd}
|
||||
into memory starting at @var{location}. The data is read at an
|
||||
offset of @var{offset} from the start of the input section,
|
||||
and is read for @var{count} bytes.
|
||||
|
||||
If the contents of a constructor with the @code{SEC_CONSTRUCTOR}
|
||||
flag set are requested or if the section does not have the
|
||||
@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled
|
||||
with zeroes. If no errors occur, @code{true} is returned, else
|
||||
@code{false}.
|
||||
|
||||
@findex bfd_copy_private_section_data
|
||||
@subsubsection @code{bfd_copy_private_section_data}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Copy private section information from @var{isec} in the BFD
|
||||
@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
|
||||
Return @code{true} on success, @code{false} on error. Possible error
|
||||
returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{osec}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
|
||||
BFD_SEND (obfd, _bfd_copy_private_section_data, \
|
||||
(ibfd, isection, obfd, osection))
|
||||
@end example
|
||||
|
||||
@findex _bfd_strip_section_from_output
|
||||
@subsubsection @code{_bfd_strip_section_from_output}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void _bfd_strip_section_from_output
|
||||
(struct bfd_link_info *info, asection *section);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Remove @var{section} from the output. If the output section
|
||||
becomes empty, remove it from the output bfd. @var{info} may
|
||||
be NULL; if it is not, it is used to decide whether the output
|
||||
section is empty.
|
||||
|
||||
424
bfd/doc/syms.texi
Normal file
424
bfd/doc/syms.texi
Normal file
@@ -0,0 +1,424 @@
|
||||
@section Symbols
|
||||
BFD tries to maintain as much symbol information as it can when
|
||||
it moves information from file to file. BFD passes information
|
||||
to applications though the @code{asymbol} structure. When the
|
||||
application requests the symbol table, BFD reads the table in
|
||||
the native form and translates parts of it into the internal
|
||||
format. To maintain more than the information passed to
|
||||
applications, some targets keep some information ``behind the
|
||||
scenes'' in a structure only the particular back end knows
|
||||
about. For example, the coff back end keeps the original
|
||||
symbol table structure as well as the canonical structure when
|
||||
a BFD is read in. On output, the coff back end can reconstruct
|
||||
the output symbol table so that no information is lost, even
|
||||
information unique to coff which BFD doesn't know or
|
||||
understand. If a coff symbol table were read, but were written
|
||||
through an a.out back end, all the coff specific information
|
||||
would be lost. The symbol table of a BFD
|
||||
is not necessarily read in until a canonicalize request is
|
||||
made. Then the BFD back end fills in a table provided by the
|
||||
application with pointers to the canonical information. To
|
||||
output symbols, the application provides BFD with a table of
|
||||
pointers to pointers to @code{asymbol}s. This allows applications
|
||||
like the linker to output a symbol as it was read, since the ``behind
|
||||
the scenes'' information will be still available.
|
||||
@menu
|
||||
* Reading Symbols::
|
||||
* Writing Symbols::
|
||||
* Mini Symbols::
|
||||
* typedef asymbol::
|
||||
* symbol handling functions::
|
||||
@end menu
|
||||
|
||||
@node Reading Symbols, Writing Symbols, Symbols, Symbols
|
||||
@subsection Reading symbols
|
||||
There are two stages to reading a symbol table from a BFD:
|
||||
allocating storage, and the actual reading process. This is an
|
||||
excerpt from an application which reads the symbol table:
|
||||
|
||||
@example
|
||||
long storage_needed;
|
||||
asymbol **symbol_table;
|
||||
long number_of_symbols;
|
||||
long i;
|
||||
|
||||
storage_needed = bfd_get_symtab_upper_bound (abfd);
|
||||
|
||||
if (storage_needed < 0)
|
||||
FAIL
|
||||
|
||||
if (storage_needed == 0) @{
|
||||
return ;
|
||||
@}
|
||||
symbol_table = (asymbol **) xmalloc (storage_needed);
|
||||
...
|
||||
number_of_symbols =
|
||||
bfd_canonicalize_symtab (abfd, symbol_table);
|
||||
|
||||
if (number_of_symbols < 0)
|
||||
FAIL
|
||||
|
||||
for (i = 0; i < number_of_symbols; i++) @{
|
||||
process_symbol (symbol_table[i]);
|
||||
@}
|
||||
@end example
|
||||
|
||||
All storage for the symbols themselves is in an objalloc
|
||||
connected to the BFD; it is freed when the BFD is closed.
|
||||
|
||||
@node Writing Symbols, Mini Symbols, Reading Symbols, Symbols
|
||||
@subsection Writing symbols
|
||||
Writing of a symbol table is automatic when a BFD open for
|
||||
writing is closed. The application attaches a vector of
|
||||
pointers to pointers to symbols to the BFD being written, and
|
||||
fills in the symbol count. The close and cleanup code reads
|
||||
through the table provided and performs all the necessary
|
||||
operations. The BFD output code must always be provided with an
|
||||
``owned'' symbol: one which has come from another BFD, or one
|
||||
which has been created using @code{bfd_make_empty_symbol}. Here is an
|
||||
example showing the creation of a symbol table with only one element:
|
||||
|
||||
@example
|
||||
#include "bfd.h"
|
||||
main()
|
||||
@{
|
||||
bfd *abfd;
|
||||
asymbol *ptrs[2];
|
||||
asymbol *new;
|
||||
|
||||
abfd = bfd_openw("foo","a.out-sunos-big");
|
||||
bfd_set_format(abfd, bfd_object);
|
||||
new = bfd_make_empty_symbol(abfd);
|
||||
new->name = "dummy_symbol";
|
||||
new->section = bfd_make_section_old_way(abfd, ".text");
|
||||
new->flags = BSF_GLOBAL;
|
||||
new->value = 0x12345;
|
||||
|
||||
ptrs[0] = new;
|
||||
ptrs[1] = (asymbol *)0;
|
||||
|
||||
bfd_set_symtab(abfd, ptrs, 1);
|
||||
bfd_close(abfd);
|
||||
@}
|
||||
|
||||
./makesym
|
||||
nm foo
|
||||
00012345 A dummy_symbol
|
||||
@end example
|
||||
|
||||
Many formats cannot represent arbitary symbol information; for
|
||||
instance, the @code{a.out} object format does not allow an
|
||||
arbitary number of sections. A symbol pointing to a section
|
||||
which is not one of @code{.text}, @code{.data} or @code{.bss} cannot
|
||||
be described.
|
||||
|
||||
@node Mini Symbols, typedef asymbol, Writing Symbols, Symbols
|
||||
@subsection Mini Symbols
|
||||
Mini symbols provide read-only access to the symbol table.
|
||||
They use less memory space, but require more time to access.
|
||||
They can be useful for tools like nm or objdump, which may
|
||||
have to handle symbol tables of extremely large executables.
|
||||
|
||||
The @code{bfd_read_minisymbols} function will read the symbols
|
||||
into memory in an internal form. It will return a @code{void *}
|
||||
pointer to a block of memory, a symbol count, and the size of
|
||||
each symbol. The pointer is allocated using @code{malloc}, and
|
||||
should be freed by the caller when it is no longer needed.
|
||||
|
||||
The function @code{bfd_minisymbol_to_symbol} will take a pointer
|
||||
to a minisymbol, and a pointer to a structure returned by
|
||||
@code{bfd_make_empty_symbol}, and return a @code{asymbol} structure.
|
||||
The return value may or may not be the same as the value from
|
||||
@code{bfd_make_empty_symbol} which was passed in.
|
||||
|
||||
|
||||
@node typedef asymbol, symbol handling functions, Mini Symbols, Symbols
|
||||
@subsection typedef asymbol
|
||||
An @code{asymbol} has the form:
|
||||
|
||||
|
||||
@example
|
||||
|
||||
typedef struct symbol_cache_entry
|
||||
@{
|
||||
/* 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. */
|
||||
|
||||
/* The text of the symbol. The name is left alone, and not copied; the
|
||||
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; @code{static} in @code{C}. The value
|
||||
is the offset into the section of the data. */
|
||||
#define BSF_LOCAL 0x01
|
||||
|
||||
/* The symbol has global scope; initialized data in @code{C}. The
|
||||
value is the offset into the section of the data. */
|
||||
#define BSF_GLOBAL 0x02
|
||||
|
||||
/* The symbol has global scope and is exported. The value is
|
||||
the offset into the section of the data. */
|
||||
#define BSF_EXPORT BSF_GLOBAL /* no real difference */
|
||||
|
||||
/* A normal C symbol would be one of:
|
||||
@code{BSF_LOCAL}, @code{BSF_FORT_COMM}, @code{BSF_UNDEFINED} or
|
||||
@code{BSF_GLOBAL} */
|
||||
|
||||
/* The symbol is a debugging record. The value has an arbitary
|
||||
meaning, unless BSF_DEBUGGING_RELOC is also set. */
|
||||
#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
|
||||
|
||||
/* A weak global symbol, overridable without warnings by
|
||||
a regular global symbol of the same name. */
|
||||
#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 @code{ISFCN} symbol
|
||||
which is also @code{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. The name is a
|
||||
warning. The name of the next symbol is the one to warn about;
|
||||
if a reference is made to a symbol with the same name as the next
|
||||
symbol, a warning is issued by the linker. */
|
||||
#define BSF_WARNING 0x1000
|
||||
|
||||
/* Signal that the symbol is indirect. This symbol is an indirect
|
||||
pointer to the symbol with the same name as the next symbol. */
|
||||
#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
|
||||
|
||||
/* Symbol is from dynamic linking information. */
|
||||
#define BSF_DYNAMIC 0x8000
|
||||
|
||||
/* The symbol denotes a data object. Used in ELF, and perhaps
|
||||
others someday. */
|
||||
#define BSF_OBJECT 0x10000
|
||||
|
||||
/* This symbol is a debugging symbol. The value is the offset
|
||||
into the section of the data. BSF_DEBUGGING should be set
|
||||
as well. */
|
||||
#define BSF_DEBUGGING_RELOC 0x20000
|
||||
|
||||
flagword flags;
|
||||
|
||||
/* A pointer to the section to which this symbol is
|
||||
relative. This will always be non NULL, there are special
|
||||
sections for undefined and absolute symbols. */
|
||||
struct sec *section;
|
||||
|
||||
/* Back end special data. */
|
||||
union
|
||||
@{
|
||||
PTR p;
|
||||
bfd_vma i;
|
||||
@} udata;
|
||||
|
||||
@} asymbol;
|
||||
@end example
|
||||
|
||||
@node symbol handling functions, , typedef asymbol, Symbols
|
||||
@subsection Symbol handling functions
|
||||
|
||||
|
||||
@findex bfd_get_symtab_upper_bound
|
||||
@subsubsection @code{bfd_get_symtab_upper_bound}
|
||||
@strong{Description}@*
|
||||
Return the number of bytes required to store a vector of pointers
|
||||
to @code{asymbols} for all the symbols in the BFD @var{abfd},
|
||||
including a terminal NULL pointer. If there are no symbols in
|
||||
the BFD, then return 0. If an error occurs, return -1.
|
||||
@example
|
||||
#define bfd_get_symtab_upper_bound(abfd) \
|
||||
BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
|
||||
@end example
|
||||
|
||||
@findex bfd_is_local_label
|
||||
@subsubsection @code{bfd_is_local_label}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_is_local_label(bfd *abfd, asymbol *sym);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return true if the given symbol @var{sym} in the BFD @var{abfd} is
|
||||
a compiler generated local label, else return false.
|
||||
|
||||
@findex bfd_is_local_label_name
|
||||
@subsubsection @code{bfd_is_local_label_name}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_is_local_label_name(bfd *abfd, const char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return true if a symbol with the name @var{name} in the BFD
|
||||
@var{abfd} is a compiler generated local label, else return
|
||||
false. This just checks whether the name has the form of a
|
||||
local label.
|
||||
@example
|
||||
#define bfd_is_local_label_name(abfd, name) \
|
||||
BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
|
||||
@end example
|
||||
|
||||
@findex bfd_canonicalize_symtab
|
||||
@subsubsection @code{bfd_canonicalize_symtab}
|
||||
@strong{Description}@*
|
||||
Read the symbols from the BFD @var{abfd}, and fills in
|
||||
the vector @var{location} with pointers to the symbols and
|
||||
a trailing NULL.
|
||||
Return the actual number of symbol pointers, not
|
||||
including the NULL.
|
||||
@example
|
||||
#define bfd_canonicalize_symtab(abfd, location) \
|
||||
BFD_SEND (abfd, _bfd_canonicalize_symtab,\
|
||||
(abfd, location))
|
||||
@end example
|
||||
|
||||
@findex bfd_set_symtab
|
||||
@subsubsection @code{bfd_set_symtab}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int count);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Arrange that when the output BFD @var{abfd} is closed,
|
||||
the table @var{location} of @var{count} pointers to symbols
|
||||
will be written.
|
||||
|
||||
@findex bfd_print_symbol_vandf
|
||||
@subsubsection @code{bfd_print_symbol_vandf}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_print_symbol_vandf(PTR file, asymbol *symbol);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Print the value and flags of the @var{symbol} supplied to the
|
||||
stream @var{file}.
|
||||
|
||||
@findex bfd_make_empty_symbol
|
||||
@subsubsection @code{bfd_make_empty_symbol}
|
||||
@strong{Description}@*
|
||||
Create a new @code{asymbol} structure for the BFD @var{abfd}
|
||||
and return a pointer to it.
|
||||
|
||||
This routine is necessary because each back end has private
|
||||
information surrounding the @code{asymbol}. Building your own
|
||||
@code{asymbol} and pointing to it will not create the private
|
||||
information, and will cause problems later on.
|
||||
@example
|
||||
#define bfd_make_empty_symbol(abfd) \
|
||||
BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
|
||||
@end example
|
||||
|
||||
@findex bfd_make_debug_symbol
|
||||
@subsubsection @code{bfd_make_debug_symbol}
|
||||
@strong{Description}@*
|
||||
Create a new @code{asymbol} structure for the BFD @var{abfd},
|
||||
to be used as a debugging symbol. Further details of its use have
|
||||
yet to be worked out.
|
||||
@example
|
||||
#define bfd_make_debug_symbol(abfd,ptr,size) \
|
||||
BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
|
||||
@end example
|
||||
|
||||
@findex bfd_decode_symclass
|
||||
@subsubsection @code{bfd_decode_symclass}
|
||||
@strong{Description}@*
|
||||
Return a character corresponding to the symbol
|
||||
class of @var{symbol}, or '?' for an unknown class.
|
||||
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
int bfd_decode_symclass(asymbol *symbol);
|
||||
@end example
|
||||
@findex bfd_is_undefined_symclass
|
||||
@subsubsection @code{bfd_is_undefined_symclass }
|
||||
@strong{Description}@*
|
||||
Returns non-zero if the class symbol returned by
|
||||
bfd_decode_symclass represents an undefined symbol.
|
||||
Returns zero otherwise.
|
||||
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_is_undefined_symclass (int symclass);
|
||||
@end example
|
||||
@findex bfd_symbol_info
|
||||
@subsubsection @code{bfd_symbol_info}
|
||||
@strong{Description}@*
|
||||
Fill in the basic info about symbol that nm needs.
|
||||
Additional info may be added by the back-ends after
|
||||
calling this function.
|
||||
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
void bfd_symbol_info(asymbol *symbol, symbol_info *ret);
|
||||
@end example
|
||||
@findex bfd_copy_private_symbol_data
|
||||
@subsubsection @code{bfd_copy_private_symbol_data}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_copy_private_symbol_data(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Copy private symbol information from @var{isym} in the BFD
|
||||
@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
|
||||
Return @code{true} on success, @code{false} on error. Possible error
|
||||
returns are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
@code{bfd_error_no_memory} -
|
||||
Not enough memory exists to create private data for @var{osec}.
|
||||
@end itemize
|
||||
@example
|
||||
#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
|
||||
BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
|
||||
(ibfd, isymbol, obfd, osymbol))
|
||||
@end example
|
||||
|
||||
508
bfd/doc/targets.texi
Normal file
508
bfd/doc/targets.texi
Normal file
@@ -0,0 +1,508 @@
|
||||
@section Targets
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
Each port of BFD to a different machine requries the creation
|
||||
of a target back end. All the back end provides to the root
|
||||
part of BFD is a structure containing pointers to functions
|
||||
which perform certain low level operations on files. BFD
|
||||
translates the applications's requests through a pointer into
|
||||
calls to the back end routines.
|
||||
|
||||
When a file is opened with @code{bfd_openr}, its format and
|
||||
target are unknown. BFD uses various mechanisms to determine
|
||||
how to interpret the file. The operations performed are:
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
Create a BFD by calling the internal routine
|
||||
@code{_bfd_new_bfd}, then call @code{bfd_find_target} with the
|
||||
target string supplied to @code{bfd_openr} and the new BFD pointer.
|
||||
|
||||
@item
|
||||
If a null target string was provided to @code{bfd_find_target},
|
||||
look up the environment variable @code{GNUTARGET} and use
|
||||
that as the target string.
|
||||
|
||||
@item
|
||||
If the target string is still @code{NULL}, or the target string is
|
||||
@code{default}, then use the first item in the target vector
|
||||
as the target type, and set @code{target_defaulted} in the BFD to
|
||||
cause @code{bfd_check_format} to loop through all the targets.
|
||||
@xref{bfd_target}. @xref{Formats}.
|
||||
|
||||
@item
|
||||
Otherwise, inspect the elements in the target vector
|
||||
one by one, until a match on target name is found. When found,
|
||||
use it.
|
||||
|
||||
@item
|
||||
Otherwise return the error @code{bfd_error_invalid_target} to
|
||||
@code{bfd_openr}.
|
||||
|
||||
@item
|
||||
@code{bfd_openr} attempts to open the file using
|
||||
@code{bfd_open_file}, and returns the BFD.
|
||||
@end itemize
|
||||
Once the BFD has been opened and the target selected, the file
|
||||
format may be determined. This is done by calling
|
||||
@code{bfd_check_format} on the BFD with a suggested format.
|
||||
If @code{target_defaulted} has been set, each possible target
|
||||
type is tried to see if it recognizes the specified format.
|
||||
@code{bfd_check_format} returns @code{true} when the caller guesses right.
|
||||
@menu
|
||||
* bfd_target::
|
||||
@end menu
|
||||
|
||||
@node bfd_target, , Targets, Targets
|
||||
|
||||
@subsection bfd_target
|
||||
|
||||
|
||||
@strong{Description}@*
|
||||
This structure contains everything that BFD knows about a
|
||||
target. It includes things like its byte order, name, and which
|
||||
routines to call to do various operations.
|
||||
|
||||
Every BFD points to a target structure with its @code{xvec}
|
||||
member.
|
||||
|
||||
The macros below are used to dispatch to functions through the
|
||||
@code{bfd_target} vector. They are used in a number of macros further
|
||||
down in @file{bfd.h}, and are also used when calling various
|
||||
routines by hand inside the BFD implementation. The @var{arglist}
|
||||
argument must be parenthesized; it contains all the arguments
|
||||
to the called function.
|
||||
|
||||
They make the documentation (more) unpleasant to read, so if
|
||||
someone wants to fix this and not break the above, please do.
|
||||
@example
|
||||
#define BFD_SEND(bfd, message, arglist) \
|
||||
((*((bfd)->xvec->message)) arglist)
|
||||
|
||||
#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
|
||||
@end example
|
||||
For operations which index on the BFD format:
|
||||
@example
|
||||
#define BFD_SEND_FMT(bfd, message, arglist) \
|
||||
(((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
|
||||
|
||||
#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
|
||||
@end example
|
||||
This is the structure which defines the type of BFD this is. The
|
||||
@code{xvec} member of the struct @code{bfd} itself points here. Each
|
||||
module that implements access to a different target under BFD,
|
||||
defines one of these.
|
||||
|
||||
FIXME, these names should be rationalised with the names of
|
||||
the entry points which call them. Too bad we can't have one
|
||||
macro to define them both!
|
||||
@example
|
||||
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,
|
||||
bfd_target_ihex_flavour,
|
||||
bfd_target_som_flavour,
|
||||
bfd_target_os9k_flavour,
|
||||
bfd_target_versados_flavour,
|
||||
bfd_target_msdos_flavour,
|
||||
bfd_target_ovax_flavour,
|
||||
bfd_target_evax_flavour
|
||||
@};
|
||||
|
||||
enum bfd_endian @{ BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN @};
|
||||
|
||||
/* Forward declaration. */
|
||||
typedef struct bfd_link_info _bfd_link_info;
|
||||
|
||||
typedef struct bfd_target
|
||||
@{
|
||||
@end example
|
||||
Identifies the kind of target, e.g., SunOS4, Ultrix, etc.
|
||||
@example
|
||||
char *name;
|
||||
@end example
|
||||
The "flavour" of a back end is a general indication about the contents
|
||||
of a file.
|
||||
@example
|
||||
enum bfd_flavour flavour;
|
||||
@end example
|
||||
The order of bytes within the data area of a file.
|
||||
@example
|
||||
enum bfd_endian byteorder;
|
||||
@end example
|
||||
The order of bytes within the header parts of a file.
|
||||
@example
|
||||
enum bfd_endian header_byteorder;
|
||||
@end example
|
||||
A mask of all the flags which an executable may have set -
|
||||
from the set @code{BFD_NO_FLAGS}, @code{HAS_RELOC}, ...@code{D_PAGED}.
|
||||
@example
|
||||
flagword object_flags;
|
||||
@end example
|
||||
A mask of all the flags which a section may have set - from
|
||||
the set @code{SEC_NO_FLAGS}, @code{SEC_ALLOC}, ...@code{SET_NEVER_LOAD}.
|
||||
@example
|
||||
flagword section_flags;
|
||||
@end example
|
||||
The character normally found at the front of a symbol
|
||||
(if any), perhaps `_'.
|
||||
@example
|
||||
char symbol_leading_char;
|
||||
@end example
|
||||
The pad character for file names within an archive header.
|
||||
@example
|
||||
char ar_pad_char;
|
||||
@end example
|
||||
The maximum number of characters in an archive header.
|
||||
@example
|
||||
unsigned short ar_max_namelen;
|
||||
@end example
|
||||
Entries for byte swapping for data. These are different from the other
|
||||
entry points, since they don't take a BFD asthe first argument.
|
||||
Certain other handlers could do the same.
|
||||
@example
|
||||
bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));
|
||||
bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
|
||||
void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
||||
bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));
|
||||
bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));
|
||||
void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
||||
bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));
|
||||
bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));
|
||||
void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
||||
@end example
|
||||
Byte swapping for the headers
|
||||
@example
|
||||
bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));
|
||||
bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));
|
||||
void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));
|
||||
bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));
|
||||
bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));
|
||||
void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));
|
||||
bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
|
||||
bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
|
||||
void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
|
||||
@end example
|
||||
Format dependent routines: these are vectors of entry points
|
||||
within the target vector structure, one for each format to check.
|
||||
|
||||
Check the format of a file being read. Return a @code{bfd_target *} or zero.
|
||||
@example
|
||||
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
|
||||
@end example
|
||||
Set the format of a file being written.
|
||||
@example
|
||||
boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
|
||||
@end example
|
||||
Write cached information into a file being written, at @code{bfd_close}.
|
||||
@example
|
||||
boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
|
||||
@end example
|
||||
The general target vector. These vectors are initialized using the
|
||||
BFD_JUMP_TABLE macros.
|
||||
@example
|
||||
|
||||
/* 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),\
|
||||
CAT(NAME,_get_section_contents_in_window)
|
||||
|
||||
/* 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));
|
||||
boolean (*_bfd_get_section_contents_in_window)
|
||||
PARAMS ((bfd *, sec_ptr, bfd_window *,
|
||||
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_merge_private_bfd_data),\
|
||||
CAT(NAME,_bfd_copy_private_section_data),\
|
||||
CAT(NAME,_bfd_copy_private_symbol_data),\
|
||||
CAT(NAME,_bfd_set_private_flags),\
|
||||
CAT(NAME,_bfd_print_private_bfd_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 merge BFD general private data from one object file
|
||||
to a common output file when linking. */
|
||||
boolean (*_bfd_merge_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));
|
||||
/* Called to copy BFD private symbol data from one symbol
|
||||
to another. */
|
||||
boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
|
||||
bfd *, asymbol *));
|
||||
/* Called to set private backend flags */
|
||||
boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
|
||||
|
||||
/* Called to print private BFD data */
|
||||
boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, 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)
|
||||
char * (*_core_file_failing_command) PARAMS ((bfd *));
|
||||
int (*_core_file_failing_signal) PARAMS ((bfd *));
|
||||
boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));
|
||||
|
||||
/* Archive entry points. */
|
||||
#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
|
||||
CAT(NAME,_slurp_armap),\
|
||||
CAT(NAME,_slurp_extended_name_table),\
|
||||
CAT(NAME,_construct_extended_name_table),\
|
||||
CAT(NAME,_truncate_arname),\
|
||||
CAT(NAME,_write_armap),\
|
||||
CAT(NAME,_read_ar_hdr),\
|
||||
CAT(NAME,_openr_next_archived_file),\
|
||||
CAT(NAME,_get_elt_at_index),\
|
||||
CAT(NAME,_generic_stat_arch_elt),\
|
||||
CAT(NAME,_update_armap_timestamp)
|
||||
boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
|
||||
boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
|
||||
boolean (*_bfd_construct_extended_name_table)
|
||||
PARAMS ((bfd *, char **, bfd_size_type *, const char **));
|
||||
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));
|
||||
PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
|
||||
bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
|
||||
#define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))
|
||||
bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));
|
||||
int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
|
||||
boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
|
||||
|
||||
/* 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_name),\
|
||||
CAT(NAME,_get_lineno),\
|
||||
CAT(NAME,_find_nearest_line),\
|
||||
CAT(NAME,_bfd_make_debug_symbol),\
|
||||
CAT(NAME,_read_minisymbols),\
|
||||
CAT(NAME,_minisymbol_to_symbol)
|
||||
long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));
|
||||
long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,
|
||||
struct symbol_cache_entry **));
|
||||
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))
|
||||
boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));
|
||||
|
||||
alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));
|
||||
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));
|
||||
/* 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));
|
||||
#define bfd_read_minisymbols(b, d, m, s) \
|
||||
BFD_SEND (b, _read_minisymbols, (b, d, m, s))
|
||||
long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,
|
||||
unsigned int *));
|
||||
#define bfd_minisymbol_to_symbol(b, d, m, f) \
|
||||
BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
|
||||
asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,
|
||||
asymbol *));
|
||||
|
||||
/* 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. */
|
||||
reloc_howto_type *
|
||||
(*reloc_type_lookup) PARAMS ((bfd *abfd,
|
||||
bfd_reloc_code_real_type code));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* 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),\
|
||||
CAT(NAME,_bfd_link_split_section),\
|
||||
CAT(NAME,_bfd_gc_sections)
|
||||
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
|
||||
bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
|
||||
struct bfd_link_info *, struct bfd_link_order *,
|
||||
bfd_byte *data, boolean relocateable,
|
||||
struct symbol_cache_entry **));
|
||||
|
||||
boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,
|
||||
struct bfd_link_info *, boolean *again));
|
||||
|
||||
/* 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 *));
|
||||
|
||||
/* Should this section be split up into smaller pieces during linking. */
|
||||
boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
|
||||
|
||||
/* Remove sections that are not referenced from the output. */
|
||||
boolean (*_bfd_gc_sections) 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 **));
|
||||
|
||||
@end example
|
||||
A pointer to an alternative bfd_target in case the current one is not
|
||||
satisfactory. This can happen when the target cpu supports both big
|
||||
and little endian code, and target chosen by the linker has the wrong
|
||||
endianness. The function open_output() in ld/ldlang.c uses this field
|
||||
to find an alternative output format that is suitable.
|
||||
@example
|
||||
/* Opposite endian version of this target. */
|
||||
const struct bfd_target * alternative_target;
|
||||
|
||||
@end example
|
||||
Data for use by back-end routines, which isn't generic enough to belong
|
||||
in this structure.
|
||||
@example
|
||||
PTR backend_data;
|
||||
|
||||
@} bfd_target;
|
||||
@end example
|
||||
|
||||
@findex bfd_set_default_target
|
||||
@subsubsection @code{bfd_set_default_target}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
boolean bfd_set_default_target (const char *name);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Set the default target vector to use when recognizing a BFD.
|
||||
This takes the name of the target, which may be a BFD target
|
||||
name or a configuration triplet.
|
||||
|
||||
@findex bfd_find_target
|
||||
@subsubsection @code{bfd_find_target}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a pointer to the transfer vector for the object target
|
||||
named @var{target_name}. If @var{target_name} is @code{NULL}, choose the
|
||||
one in the environment variable @code{GNUTARGET}; if that is null or not
|
||||
defined, then choose the first entry in the target list.
|
||||
Passing in the string "default" or setting the environment
|
||||
variable to "default" will cause the first entry in the target
|
||||
list to be returned, and "target_defaulted" will be set in the
|
||||
BFD. This causes @code{bfd_check_format} to loop over all the
|
||||
targets to find the one that matches the file being read.
|
||||
|
||||
@findex bfd_target_list
|
||||
@subsubsection @code{bfd_target_list}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const char **bfd_target_list(void);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a freshly malloced NULL-terminated
|
||||
vector of the names of all the valid BFD targets. Do not
|
||||
modify the names.
|
||||
|
||||
@findex bfd_seach_for_target
|
||||
@subsubsection @code{bfd_seach_for_target}
|
||||
@strong{Synopsis}
|
||||
@example
|
||||
const bfd_target * bfd_search_for_target (int (* search_func)(const bfd_target *, void *), void *);
|
||||
@end example
|
||||
@strong{Description}@*
|
||||
Return a pointer to the first transfer vector in the list of
|
||||
transfer vectors maintained by BFD that produces a non-zero
|
||||
result when passed to the function @var{search_func}. The
|
||||
parameter @var{data} is passed, unexamined, to the search
|
||||
function.
|
||||
|
||||
36
bfd/efi-app-ia32.c
Normal file
36
bfd/efi-app-ia32.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* BFD back-end for Intel IA-32 EFI application files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2009 Free Software Foundation, Inc.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_app_ia32_vec
|
||||
#define TARGET_NAME "efi-app-ia32"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-i386.c"
|
||||
37
bfd/efi-app-ia64.c
Normal file
37
bfd/efi-app-ia64.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* BFD back-end for HP/Intel IA-64 EFI application files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2009 Free Software Foundation, Inc.
|
||||
Contributed by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_app_ia64_vec
|
||||
#define TARGET_NAME "efi-app-ia64"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_WITH_pep
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-ia64.c"
|
||||
36
bfd/efi-app-x86_64.c
Normal file
36
bfd/efi-app-x86_64.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/* BFD back-end for Intel64 UEFI application files.
|
||||
Copyright 2007, 2009 Free Software Foundation, Inc.
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_app_x86_64_vec
|
||||
#define TARGET_NAME "efi-app-x86_64"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_WITH_pep
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-x86_64.c"
|
||||
37
bfd/efi-bsdrv-ia32.c
Normal file
37
bfd/efi-bsdrv-ia32.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* BFD back-end for Intel IA-32 EFI Boot Service driver files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Peter Jones <pjones@redhat.com>
|
||||
Based on efi-app-ia32.c by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_bsdrv_ia32_vec
|
||||
#define TARGET_NAME "efi-bsdrv-ia32"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-i386.c"
|
||||
38
bfd/efi-bsdrv-ia64.c
Normal file
38
bfd/efi-bsdrv-ia64.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* BFD back-end for HP/Intel IA-64 EFI Boot Service driver files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Peter Jones <pjones@redhat.com>
|
||||
Based on efi-app-ia64.c by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_bsdrv_ia64_vec
|
||||
#define TARGET_NAME "efi-bsdrv-ia64"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_WITH_pep
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-ia64.c"
|
||||
38
bfd/efi-bsdrv-x86_64.c
Normal file
38
bfd/efi-bsdrv-x86_64.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* BFD back-end for Intel64 UEFI Boot Service driver files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Peter Jones <pjones@redhat.com>
|
||||
Based on efi-app-x86_64.c by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_bsdrv_x86_64_vec
|
||||
#define TARGET_NAME "efi-bsdrv-x86_64"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_WITH_pep
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-x86_64.c"
|
||||
37
bfd/efi-rtdrv-ia32.c
Normal file
37
bfd/efi-rtdrv-ia32.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/* BFD back-end for Intel IA-32 EFI runtime driver files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Peter Jones <pjones@redhat.com>
|
||||
Based on efi-app-ia32.c by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_rtdrv_ia32_vec
|
||||
#define TARGET_NAME "efi-rtdrv-ia32"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-i386.c"
|
||||
38
bfd/efi-rtdrv-ia64.c
Normal file
38
bfd/efi-rtdrv-ia64.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* BFD back-end for HP/Intel IA-64 EFI runtime driver files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Peter Jones <pjones@redhat.com>
|
||||
Based on efi-app-ia64.c by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_rtdrv_ia64_vec
|
||||
#define TARGET_NAME "efi-rtdrv-ia64"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_WITH_pep
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-ia64.c"
|
||||
38
bfd/efi-rtdrv-x86_64.c
Normal file
38
bfd/efi-rtdrv-x86_64.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/* BFD back-end for Intel64 UEFI runtime driver files.
|
||||
Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
Contributed by Peter Jones <pjones@redhat.com>
|
||||
Based on efi-app-x86_64.c by David Mosberger <davidm@hpl.hp.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#define TARGET_SYM bfd_efi_rtdrv_x86_64_vec
|
||||
#define TARGET_NAME "efi-rtdrv-x86_64"
|
||||
#define COFF_IMAGE_WITH_PE
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_WITH_pep
|
||||
#define PCRELOFFSET TRUE
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
/* Long section names not allowed in executable images, only object files. */
|
||||
#define COFF_LONG_SECTION_NAMES 0
|
||||
#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
|
||||
#define PEI_FORCE_MINIMUM_ALIGNMENT
|
||||
|
||||
#include "coff-x86_64.c"
|
||||
4557
bfd/elf32-arm.h
Normal file
4557
bfd/elf32-arm.h
Normal file
File diff suppressed because it is too large
Load Diff
56
bfd/elf32-i386-fbsd.c
Normal file
56
bfd/elf32-i386-fbsd.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Intel IA-32 specific support for 32-bit ELF on FreeBSD.
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-i386-freebsd"
|
||||
#define ELF_ARCH bfd_arch_i386
|
||||
#define ELF_MACHINE_CODE EM_386
|
||||
#define ELF_MAXPAGESIZE 0x1000
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
/* The kernel recognizes executables as valid only if they carry a
|
||||
"FreeBSD" label in the ELF header. So we put this label on all
|
||||
executables and (for simplicity) also all other object files. */
|
||||
|
||||
static void elf_i386_post_process_headers
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
static void
|
||||
elf_i386_post_process_headers (abfd, link_info)
|
||||
bfd * abfd;
|
||||
struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
|
||||
{
|
||||
Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
|
||||
|
||||
i_ehdrp = elf_elfheader (abfd);
|
||||
|
||||
/* Put an ABI label supported by FreeBSD >= 4.1. */
|
||||
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
|
||||
#ifdef OLD_FREEBSD_ABI_LABEL
|
||||
/* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
|
||||
memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define elf_backend_post_process_headers elf_i386_post_process_headers
|
||||
|
||||
#include "elf32-i386.c"
|
||||
30
bfd/elf32-i386qnx.c
Normal file
30
bfd/elf32-i386qnx.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Intel 80386/80486 QNX specific support for 32-bit ELF
|
||||
Copyright 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ELF32_I386_C_INCLUDED
|
||||
#include "elf32-i386.c"
|
||||
|
||||
#include "elf32-qnx.h"
|
||||
|
||||
#undef TARGET_LITTLE_SYM
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_i386qnx_vec
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
||||
655
bfd/elf32-ms1.c
Normal file
655
bfd/elf32-ms1.c
Normal file
@@ -0,0 +1,655 @@
|
||||
/* Morpho Technologies MS1 specific support for 32-bit ELF
|
||||
Copyright 2001, 2002, 2003, 2004, 2005
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "elf/ms1.h"
|
||||
|
||||
/* Prototypes. */
|
||||
static reloc_howto_type * ms1_reloc_type_lookup
|
||||
(bfd *, bfd_reloc_code_real_type);
|
||||
|
||||
static void ms1_info_to_howto_rela
|
||||
(bfd *, arelent *, Elf_Internal_Rela *);
|
||||
|
||||
static bfd_reloc_status_type ms1_elf_relocate_hi16
|
||||
(bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma);
|
||||
|
||||
static bfd_reloc_status_type ms1_final_link_relocate
|
||||
(reloc_howto_type *, bfd *, asection *, bfd_byte *,
|
||||
Elf_Internal_Rela *, bfd_vma);
|
||||
|
||||
static bfd_boolean ms1_elf_relocate_section
|
||||
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
|
||||
|
||||
/* Relocation tables. */
|
||||
static reloc_howto_type ms1_elf_howto_table [] =
|
||||
{
|
||||
/* This reloc does nothing. */
|
||||
HOWTO (R_MS1_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_NONE", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0 , /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* A 16 bit absolute relocation. */
|
||||
HOWTO (R_MS1_16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_16", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0 , /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* A 32 bit absolute relocation. */
|
||||
HOWTO (R_MS1_32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_32", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0 , /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* A 32 bit pc-relative relocation. */
|
||||
HOWTO (R_MS1_32_PCREL, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_32_PCREL", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0 , /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* A 16 bit pc-relative relocation. */
|
||||
HOWTO (R_MS1_PC16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_PC16", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* high 16 bits of symbol value. */
|
||||
HOWTO (R_MS1_HI16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_HI16", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0xffff0000, /* src_mask */
|
||||
0xffff0000, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* Low 16 bits of symbol value. */
|
||||
HOWTO (R_MS1_LO16, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MS1_LO16", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Map BFD reloc types to MS1 ELF reloc types. */
|
||||
|
||||
static reloc_howto_type *
|
||||
ms1_reloc_type_lookup
|
||||
(bfd * abfd ATTRIBUTE_UNUSED,
|
||||
bfd_reloc_code_real_type code)
|
||||
{
|
||||
/* Note that the ms1_elf_howto_table is indxed by the R_
|
||||
constants. Thus, the order that the howto records appear in the
|
||||
table *must* match the order of the relocation types defined in
|
||||
include/elf/ms1.h. */
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_NONE:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_NONE];
|
||||
case BFD_RELOC_16:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_16];
|
||||
case BFD_RELOC_32:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_32];
|
||||
case BFD_RELOC_32_PCREL:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_32_PCREL];
|
||||
case BFD_RELOC_16_PCREL:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_PC16];
|
||||
case BFD_RELOC_HI16:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_HI16];
|
||||
case BFD_RELOC_LO16:
|
||||
return &ms1_elf_howto_table[ (int) R_MS1_LO16];
|
||||
|
||||
default:
|
||||
/* Pacify gcc -Wall. */
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bfd_reloc_status_type
|
||||
ms1_elf_relocate_hi16
|
||||
(bfd * input_bfd,
|
||||
Elf_Internal_Rela * relhi,
|
||||
bfd_byte * contents,
|
||||
bfd_vma value)
|
||||
{
|
||||
bfd_vma insn;
|
||||
|
||||
insn = bfd_get_32 (input_bfd, contents + relhi->r_offset);
|
||||
|
||||
value += relhi->r_addend;
|
||||
value >>= 16;
|
||||
insn = ((insn & ~0xFFFF) | value);
|
||||
|
||||
bfd_put_32 (input_bfd, insn, contents + relhi->r_offset);
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
/* XXX: The following code is the result of a cut&paste. This unfortunate
|
||||
practice is very widespread in the various target back-end files. */
|
||||
|
||||
/* Set the howto pointer for a MS1 ELF reloc. */
|
||||
|
||||
static void
|
||||
ms1_info_to_howto_rela
|
||||
(bfd * abfd ATTRIBUTE_UNUSED,
|
||||
arelent * cache_ptr,
|
||||
Elf_Internal_Rela * dst)
|
||||
{
|
||||
unsigned int r_type;
|
||||
|
||||
r_type = ELF32_R_TYPE (dst->r_info);
|
||||
cache_ptr->howto = & ms1_elf_howto_table [r_type];
|
||||
}
|
||||
|
||||
/* Perform a single relocation. By default we use the standard BFD
|
||||
routines. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
ms1_final_link_relocate
|
||||
(reloc_howto_type * howto,
|
||||
bfd * input_bfd,
|
||||
asection * input_section,
|
||||
bfd_byte * contents,
|
||||
Elf_Internal_Rela * rel,
|
||||
bfd_vma relocation)
|
||||
{
|
||||
return _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents, rel->r_offset,
|
||||
relocation, rel->r_addend);
|
||||
}
|
||||
|
||||
/* Relocate a MS1 ELF section.
|
||||
There is some attempt to make this function usable for many architectures,
|
||||
both USE_REL and USE_RELA ['twould be nice if such a critter existed],
|
||||
if only to serve as a learning tool.
|
||||
|
||||
The RELOCATE_SECTION function is called by the new ELF backend linker
|
||||
to handle the relocations for a section.
|
||||
|
||||
The relocs are always passed as Rela structures; if the section
|
||||
actually uses Rel structures, the r_addend field will always be
|
||||
zero.
|
||||
|
||||
This function is responsible for adjusting the section contents as
|
||||
necessary, and (if using Rela relocs and generating a relocatable
|
||||
output file) adjusting the reloc addend as necessary.
|
||||
|
||||
This function does not have to worry about setting the reloc
|
||||
address or the reloc symbol index.
|
||||
|
||||
LOCAL_SYMS is a pointer to the swapped in local symbols.
|
||||
|
||||
LOCAL_SECTIONS is an array giving the section in the input file
|
||||
corresponding to the st_shndx field of each local symbol.
|
||||
|
||||
The global hash table entry for the global symbols can be found
|
||||
via elf_sym_hashes (input_bfd).
|
||||
|
||||
When generating relocatable output, this function must handle
|
||||
STB_LOCAL/STT_SECTION symbols specially. The output symbol is
|
||||
going to be the section symbol corresponding to the output
|
||||
section, which means that the addend must be adjusted
|
||||
accordingly. */
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_relocate_section
|
||||
(bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
struct bfd_link_info * info,
|
||||
bfd * input_bfd,
|
||||
asection * input_section,
|
||||
bfd_byte * contents,
|
||||
Elf_Internal_Rela * relocs,
|
||||
Elf_Internal_Sym * local_syms,
|
||||
asection ** local_sections)
|
||||
{
|
||||
Elf_Internal_Shdr * symtab_hdr;
|
||||
struct elf_link_hash_entry ** sym_hashes;
|
||||
Elf_Internal_Rela * rel;
|
||||
Elf_Internal_Rela * relend;
|
||||
|
||||
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
|
||||
sym_hashes = elf_sym_hashes (input_bfd);
|
||||
relend = relocs + input_section->reloc_count;
|
||||
|
||||
for (rel = relocs; rel < relend; rel ++)
|
||||
{
|
||||
reloc_howto_type * howto;
|
||||
unsigned long r_symndx;
|
||||
Elf_Internal_Sym * sym;
|
||||
asection * sec;
|
||||
struct elf_link_hash_entry * h;
|
||||
bfd_vma relocation;
|
||||
bfd_reloc_status_type r;
|
||||
const char * name = NULL;
|
||||
int r_type;
|
||||
|
||||
r_type = ELF32_R_TYPE (rel->r_info);
|
||||
|
||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||
|
||||
/* This is a final link. */
|
||||
howto = ms1_elf_howto_table + ELF32_R_TYPE (rel->r_info);
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
sec = NULL;
|
||||
|
||||
if (r_symndx < symtab_hdr->sh_info)
|
||||
{
|
||||
sym = local_syms + r_symndx;
|
||||
sec = local_sections [r_symndx];
|
||||
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
|
||||
|
||||
name = bfd_elf_string_from_elf_section
|
||||
(input_bfd, symtab_hdr->sh_link, sym->st_name);
|
||||
name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
|
||||
}
|
||||
else
|
||||
{
|
||||
bfd_boolean unresolved_reloc;
|
||||
bfd_boolean warned;
|
||||
|
||||
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
|
||||
r_symndx, symtab_hdr, sym_hashes,
|
||||
h, sec, relocation,
|
||||
unresolved_reloc, warned);
|
||||
|
||||
name = h->root.root.string;
|
||||
}
|
||||
|
||||
|
||||
/* Finally, the sole MS1-specific part. */
|
||||
switch (r_type)
|
||||
{
|
||||
case R_MS1_HI16:
|
||||
r = ms1_elf_relocate_hi16 (input_bfd, rel, contents, relocation);
|
||||
break;
|
||||
default:
|
||||
r = ms1_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents, rel, relocation);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
const char * msg = (const char *) NULL;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case bfd_reloc_overflow:
|
||||
r = info->callbacks->reloc_overflow
|
||||
(info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
|
||||
input_bfd, input_section, rel->r_offset);
|
||||
break;
|
||||
|
||||
case bfd_reloc_undefined:
|
||||
r = info->callbacks->undefined_symbol
|
||||
(info, name, input_bfd, input_section, rel->r_offset, TRUE);
|
||||
break;
|
||||
|
||||
case bfd_reloc_outofrange:
|
||||
msg = _("internal error: out of range error");
|
||||
break;
|
||||
|
||||
case bfd_reloc_dangerous:
|
||||
msg = _("internal error: dangerous relocation");
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = _("internal error: unknown error");
|
||||
break;
|
||||
}
|
||||
|
||||
if (msg)
|
||||
r = info->callbacks->warning
|
||||
(info, msg, name, input_bfd, input_section, rel->r_offset);
|
||||
|
||||
if (! r)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Return the section that should be marked against GC for a given
|
||||
relocation. */
|
||||
|
||||
static asection *
|
||||
ms1_elf_gc_mark_hook
|
||||
(asection * sec,
|
||||
struct bfd_link_info * info ATTRIBUTE_UNUSED,
|
||||
Elf_Internal_Rela * rel ATTRIBUTE_UNUSED,
|
||||
struct elf_link_hash_entry * h,
|
||||
Elf_Internal_Sym * sym)
|
||||
{
|
||||
if (h != NULL)
|
||||
{
|
||||
switch (h->root.type)
|
||||
{
|
||||
case bfd_link_hash_defined:
|
||||
case bfd_link_hash_defweak:
|
||||
return h->root.u.def.section;
|
||||
|
||||
case bfd_link_hash_common:
|
||||
return h->root.u.c.p->section;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(elf_bad_symtab (sec->owner)
|
||||
&& ELF_ST_BIND (sym->st_info) != STB_LOCAL)
|
||||
&& ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
|
||||
&& sym->st_shndx != SHN_COMMON))
|
||||
return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Update the got entry reference counts for the section being
|
||||
removed. */
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_gc_sweep_hook
|
||||
(bfd * abfd ATTRIBUTE_UNUSED,
|
||||
struct bfd_link_info * info ATTRIBUTE_UNUSED,
|
||||
asection * sec ATTRIBUTE_UNUSED,
|
||||
const Elf_Internal_Rela * relocs ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Look through the relocs for a section during the first phase.
|
||||
Since we don't do .gots or .plts, we just need to consider the
|
||||
virtual table relocs for gc. */
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_check_relocs
|
||||
(bfd * abfd,
|
||||
struct bfd_link_info * info,
|
||||
asection * sec,
|
||||
const Elf_Internal_Rela * relocs)
|
||||
{
|
||||
Elf_Internal_Shdr * symtab_hdr;
|
||||
struct elf_link_hash_entry ** sym_hashes;
|
||||
struct elf_link_hash_entry ** sym_hashes_end;
|
||||
const Elf_Internal_Rela * rel;
|
||||
const Elf_Internal_Rela * rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
sym_hashes = elf_sym_hashes (abfd);
|
||||
sym_hashes_end = sym_hashes + symtab_hdr->sh_size / sizeof (Elf32_External_Sym);
|
||||
if (!elf_bad_symtab (abfd))
|
||||
sym_hashes_end -= symtab_hdr->sh_info;
|
||||
|
||||
rel_end = relocs + sec->reloc_count;
|
||||
for (rel = relocs; rel < rel_end; rel++)
|
||||
{
|
||||
struct elf_link_hash_entry *h;
|
||||
unsigned long r_symndx;
|
||||
|
||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||
if (r_symndx < symtab_hdr->sh_info)
|
||||
h = NULL;
|
||||
else
|
||||
{
|
||||
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
while (h->root.type == bfd_link_hash_indirect
|
||||
|| h->root.type == bfd_link_hash_warning)
|
||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Return the MACH for an e_flags value. */
|
||||
|
||||
static int
|
||||
elf32_ms1_machine (bfd *abfd)
|
||||
{
|
||||
switch (elf_elfheader (abfd)->e_flags & EF_MS1_CPU_MASK)
|
||||
{
|
||||
case EF_MS1_CPU_MRISC: return bfd_mach_ms1;
|
||||
case EF_MS1_CPU_MRISC2: return bfd_mach_mrisc2;
|
||||
case EF_MS1_CPU_MS2: return bfd_mach_ms2;
|
||||
}
|
||||
|
||||
return bfd_mach_ms1;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_object_p (bfd * abfd)
|
||||
{
|
||||
bfd_default_set_arch_mach (abfd, bfd_arch_ms1, elf32_ms1_machine (abfd));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Function to set the ELF flag bits. */
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_set_private_flags (bfd * abfd,
|
||||
flagword flags)
|
||||
{
|
||||
elf_elfheader (abfd)->e_flags = flags;
|
||||
elf_flags_init (abfd) = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_copy_private_bfd_data (bfd * ibfd, bfd * obfd)
|
||||
{
|
||||
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|
||||
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (!elf_flags_init (obfd)
|
||||
|| elf_elfheader (obfd)->e_flags == elf_elfheader (ibfd)->e_flags);
|
||||
|
||||
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
|
||||
elf_flags_init (obfd) = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Merge backend specific data from an object file to the output
|
||||
object file when linking. */
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
|
||||
{
|
||||
flagword old_flags, new_flags;
|
||||
bfd_boolean error = FALSE;
|
||||
|
||||
/* Check if we have the same endianess. */
|
||||
if (_bfd_generic_verify_endian_match (ibfd, obfd) == FALSE)
|
||||
return FALSE;
|
||||
|
||||
/* If they're not both ms1, then merging is meaningless, so just
|
||||
don't do it. */
|
||||
if (strcmp (ibfd->arch_info->arch_name, "ms1") != 0)
|
||||
return TRUE;
|
||||
if (strcmp (obfd->arch_info->arch_name, "ms1") != 0)
|
||||
return TRUE;
|
||||
|
||||
new_flags = elf_elfheader (ibfd)->e_flags;
|
||||
old_flags = elf_elfheader (obfd)->e_flags;
|
||||
|
||||
#ifdef DEBUG
|
||||
_bfd_error_handler ("%B: old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s",
|
||||
ibfd, old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no");
|
||||
#endif
|
||||
|
||||
if (!elf_flags_init (obfd))
|
||||
{
|
||||
old_flags = new_flags;
|
||||
elf_flags_init (obfd) = TRUE;
|
||||
}
|
||||
else if ((new_flags & EF_MS1_CPU_MASK) != (old_flags & EF_MS1_CPU_MASK))
|
||||
{
|
||||
/* CPU has changed. This is invalid, because MRISC, MRISC2 and
|
||||
MS2 are not subsets of each other. */
|
||||
error = 1;
|
||||
|
||||
/* FIXME:However, until the compiler is multilibbed, preventing
|
||||
mixing breaks the build. So we allow merging and use the
|
||||
greater CPU value. This is of course unsafe. */
|
||||
error = 0;
|
||||
if ((new_flags & EF_MS1_CPU_MASK) > (old_flags & EF_MS1_CPU_MASK))
|
||||
old_flags = ((old_flags & ~EF_MS1_CPU_MASK)
|
||||
| (new_flags & EF_MS1_CPU_MASK));
|
||||
}
|
||||
if (!error)
|
||||
{
|
||||
obfd->arch_info = ibfd->arch_info;
|
||||
elf_elfheader (obfd)->e_flags = old_flags;
|
||||
}
|
||||
|
||||
return !error;
|
||||
}
|
||||
|
||||
static bfd_boolean
|
||||
ms1_elf_print_private_bfd_data (bfd * abfd, void * ptr)
|
||||
{
|
||||
FILE * file = (FILE *) ptr;
|
||||
flagword flags;
|
||||
|
||||
BFD_ASSERT (abfd != NULL && ptr != NULL);
|
||||
|
||||
/* Print normal ELF private data. */
|
||||
_bfd_elf_print_private_bfd_data (abfd, ptr);
|
||||
|
||||
flags = elf_elfheader (abfd)->e_flags;
|
||||
fprintf (file, _("private flags = 0x%lx:"), (long)flags);
|
||||
|
||||
switch (flags & EF_MS1_CPU_MASK)
|
||||
{
|
||||
default:
|
||||
case EF_MS1_CPU_MRISC: fprintf (file, " ms1-16-002"); break;
|
||||
case EF_MS1_CPU_MRISC2: fprintf (file, " ms1-16-003"); break;
|
||||
case EF_MS1_CPU_MS2: fprintf (file, " ms2"); break;
|
||||
}
|
||||
|
||||
fputc ('\n', file);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_ms1_vec
|
||||
#define TARGET_BIG_NAME "elf32-ms1"
|
||||
|
||||
#define ELF_ARCH bfd_arch_ms1
|
||||
#define ELF_MACHINE_CODE EM_MS1
|
||||
#define ELF_MAXPAGESIZE 1 /* No pages on the MS1. */
|
||||
|
||||
#define elf_info_to_howto_rel NULL
|
||||
#define elf_info_to_howto ms1_info_to_howto_rela
|
||||
|
||||
#define elf_backend_relocate_section ms1_elf_relocate_section
|
||||
|
||||
#define bfd_elf32_bfd_reloc_type_lookup ms1_reloc_type_lookup
|
||||
|
||||
#define elf_backend_gc_mark_hook ms1_elf_gc_mark_hook
|
||||
#define elf_backend_gc_sweep_hook ms1_elf_gc_sweep_hook
|
||||
#define elf_backend_check_relocs ms1_elf_check_relocs
|
||||
#define elf_backend_object_p ms1_elf_object_p
|
||||
#define elf_backend_rela_normal 1
|
||||
|
||||
#define elf_backend_can_gc_sections 1
|
||||
|
||||
#define bfd_elf32_bfd_set_private_flags ms1_elf_set_private_flags
|
||||
#define bfd_elf32_bfd_copy_private_bfd_data ms1_elf_copy_private_bfd_data
|
||||
#define bfd_elf32_bfd_merge_private_bfd_data ms1_elf_merge_private_bfd_data
|
||||
#define bfd_elf32_bfd_print_private_bfd_data ms1_elf_print_private_bfd_data
|
||||
|
||||
#include "elf32-target.h"
|
||||
32
bfd/elf32-ppcqnx.c
Normal file
32
bfd/elf32-ppcqnx.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* PowerPC QNX specific support for 32-bit ELF
|
||||
Copyright 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ELF32_PPC_C_INCLUDED
|
||||
#include "elf32-ppc.c"
|
||||
|
||||
#include "elf32-qnx.h"
|
||||
|
||||
#undef TARGET_LITTLE_SYM
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_powerpcleqnx_vec
|
||||
#undef TARGET_BIG_SYM
|
||||
#define TARGET_BIG_SYM bfd_elf32_powerpcqnx_vec
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
||||
92
bfd/elf32-qnx.c
Normal file
92
bfd/elf32-qnx.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/* QNX specific support for 32-bit ELF
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "elf32-qnx.h"
|
||||
|
||||
/* Returns the end address of the segment + 1. */
|
||||
#define SEGMENT_END(segment, start) \
|
||||
(start + (segment->p_memsz > segment->p_filesz \
|
||||
? segment->p_memsz : segment->p_filesz))
|
||||
|
||||
boolean
|
||||
elf_qnx_copy_private_bfd_data_p (ibfd, isec, obfd, osec)
|
||||
bfd *ibfd ATTRIBUTE_UNUSED;
|
||||
asection *isec;
|
||||
bfd *obfd ATTRIBUTE_UNUSED;
|
||||
asection *osec ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return isec->next == NULL;
|
||||
}
|
||||
|
||||
boolean
|
||||
elf_qnx_is_contained_by_filepos (section, segment)
|
||||
asection *section;
|
||||
Elf_Internal_Phdr *segment;
|
||||
{
|
||||
return ((bfd_vma) section->filepos >= segment->p_offset
|
||||
&& ((bfd_vma) section->filepos + section->_raw_size
|
||||
<= SEGMENT_END (segment, segment->p_offset)));
|
||||
}
|
||||
|
||||
void
|
||||
elf_qnx_set_nonloadable_filepos (abfd, phdrs)
|
||||
bfd *abfd;
|
||||
Elf_Internal_Phdr *phdrs;
|
||||
{
|
||||
struct elf_segment_map *m;
|
||||
Elf_Internal_Phdr *p;
|
||||
file_ptr off = 0;
|
||||
|
||||
for (m = elf_tdata (abfd)->segment_map, p = phdrs;
|
||||
m != NULL;
|
||||
m = m->next, p++)
|
||||
{
|
||||
unsigned int i;
|
||||
asection **secpp;
|
||||
|
||||
for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
sec = *secpp;
|
||||
|
||||
if (p->p_type == PT_LOAD)
|
||||
off = sec->filepos;
|
||||
else
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
if (sec->filepos)
|
||||
p->p_offset = sec->filepos;
|
||||
else
|
||||
p->p_offset = off;
|
||||
}
|
||||
if (!sec->filepos)
|
||||
{
|
||||
off += sec->_raw_size;
|
||||
p->p_filesz += sec->_raw_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
32
bfd/elf32-qnx.h
Normal file
32
bfd/elf32-qnx.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* QNX specific support for 32-bit ELF
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
boolean elf_qnx_copy_private_bfd_data_p
|
||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||
boolean elf_qnx_is_contained_by_filepos
|
||||
PARAMS ((asection *, Elf_Internal_Phdr *));
|
||||
void elf_qnx_set_nonloadable_filepos
|
||||
PARAMS ((bfd *, Elf_Internal_Phdr *));
|
||||
|
||||
#undef elf_backend_set_nonloadable_filepos
|
||||
#define elf_backend_set_nonloadable_filepos elf_qnx_set_nonloadable_filepos
|
||||
#undef elf_backend_is_contained_by_filepos
|
||||
#define elf_backend_is_contained_by_filepos elf_qnx_is_contained_by_filepos
|
||||
#undef elf_backend_copy_private_bfd_data_p
|
||||
#define elf_backend_copy_private_bfd_data_p elf_qnx_copy_private_bfd_data_p
|
||||
110
bfd/elf32-sh-lin.c
Normal file
110
bfd/elf32-sh-lin.c
Normal file
@@ -0,0 +1,110 @@
|
||||
/* Hitachi SH specific support for 32-bit Linux
|
||||
Copyright 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_shblin_vec
|
||||
#define TARGET_BIG_NAME "elf32-shbig-linux"
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_shlin_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-sh-linux"
|
||||
#define ELF_ARCH bfd_arch_sh
|
||||
#define ELF_MACHINE_CODE EM_SH
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
#define elf_symbol_leading_char 0
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "elf/internal.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
static boolean elf32_shlin_grok_prstatus
|
||||
PARAMS ((bfd *abfd, Elf_Internal_Note *note));
|
||||
static boolean elf32_shlin_grok_psinfo
|
||||
PARAMS ((bfd *abfd, Elf_Internal_Note *note));
|
||||
|
||||
/* Support for core dump NOTE sections */
|
||||
static boolean
|
||||
elf32_shlin_grok_prstatus (abfd, note)
|
||||
bfd *abfd;
|
||||
Elf_Internal_Note *note;
|
||||
{
|
||||
int offset;
|
||||
unsigned int raw_size;
|
||||
|
||||
switch (note->descsz)
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
|
||||
case 168: /* Linux/SH */
|
||||
/* pr_cursig */
|
||||
elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
|
||||
|
||||
/* pr_pid */
|
||||
elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
|
||||
|
||||
/* pr_reg */
|
||||
offset = 72;
|
||||
raw_size = 92;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make a ".reg/999" section. */
|
||||
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
|
||||
raw_size, note->descpos + offset);
|
||||
}
|
||||
|
||||
static boolean
|
||||
elf32_shlin_grok_psinfo (abfd, note)
|
||||
bfd *abfd;
|
||||
Elf_Internal_Note *note;
|
||||
{
|
||||
switch (note->descsz)
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
|
||||
case 124: /* Linux/SH elf_prpsinfo */
|
||||
elf_tdata (abfd)->core_program
|
||||
= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
|
||||
elf_tdata (abfd)->core_command
|
||||
= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
|
||||
}
|
||||
|
||||
/* Note that for some reason, a spurious space is tacked
|
||||
onto the end of the args in some (at least one anyway)
|
||||
implementations, so strip it off if it exists. */
|
||||
|
||||
{
|
||||
char *command = elf_tdata (abfd)->core_command;
|
||||
int n = strlen (command);
|
||||
|
||||
if (0 < n && command[n - 1] == ' ')
|
||||
command[n - 1] = '\0';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#define elf_backend_grok_prstatus elf32_shlin_grok_prstatus
|
||||
#define elf_backend_grok_psinfo elf32_shlin_grok_psinfo
|
||||
|
||||
|
||||
|
||||
#include "elf32-sh.c"
|
||||
29
bfd/elf32-sh-nbsd.c
Normal file
29
bfd/elf32-sh-nbsd.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Hitachi SH specific support for 32-bit NetBSD
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_shnbsd_vec
|
||||
#define TARGET_BIG_NAME "elf32-sh-nbsd"
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_shlnbsd_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-shl-nbsd"
|
||||
#define ELF_ARCH bfd_arch_sh
|
||||
#define ELF_MACHINE_CODE EM_SH
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
#define elf_symbol_leading_char 0
|
||||
|
||||
#include "elf32-sh.c"
|
||||
29
bfd/elf32-sh64-lin.c
Normal file
29
bfd/elf32-sh64-lin.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Hitachi SH specific support for 64-bit Linux
|
||||
Copyright 2000 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_sh64blin_vec
|
||||
#define TARGET_BIG_NAME "elf32-sh64big-linux"
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_sh64lin_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-sh64-linux"
|
||||
#define ELF_ARCH bfd_arch_sh
|
||||
#define ELF_MACHINE_CODE EM_SH
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
#define elf_symbol_leading_char 0
|
||||
|
||||
#include "elf32-sh64.c"
|
||||
29
bfd/elf32-sh64-nbsd.c
Normal file
29
bfd/elf32-sh64-nbsd.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SuperH SH64 specific support for 32-bit NetBSD
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_sh64nbsd_vec
|
||||
#define TARGET_BIG_NAME "elf32-sh64-nbsd"
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_sh64lnbsd_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-sh64l-nbsd"
|
||||
#define ELF_ARCH bfd_arch_sh
|
||||
#define ELF_MACHINE_CODE EM_SH
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
#define elf_symbol_leading_char 0
|
||||
|
||||
#include "elf32-sh64.c"
|
||||
31
bfd/elf32-shqnx.c
Normal file
31
bfd/elf32-shqnx.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Hitachi SH QNX specific support for 32-bit ELF
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ELF32_SH_C_INCLUDED
|
||||
#include "elf32-sh.c"
|
||||
|
||||
#include "elf32-qnx.h"
|
||||
|
||||
#undef TARGET_LITTLE_SYM
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_shlqnx_vec
|
||||
#undef TARGET_BIG_SYM
|
||||
#define TARGET_BIG_SYM bfd_elf32_shqnx_vec
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
||||
7113
bfd/elf64-aarch64.c
Normal file
7113
bfd/elf64-aarch64.c
Normal file
File diff suppressed because it is too large
Load Diff
56
bfd/elf64-alpha-fbsd.c
Normal file
56
bfd/elf64-alpha-fbsd.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Alpha specific support for 64-bit ELF on FreeBSD.
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf64_alpha_freebsd_vec
|
||||
#define TARGET_LITTLE_NAME "elf64-alpha-freebsd"
|
||||
#define ELF_ARCH bfd_arch_alpha
|
||||
#define ELF_MACHINE_CODE EM_ALPHA
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
/* The kernel recognizes executables as valid only if they carry a
|
||||
"FreeBSD" label in the ELF header. So we put this label on all
|
||||
executables and (for simplicity) also all other object files. */
|
||||
|
||||
static void elf_alpha_post_process_headers
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
static void
|
||||
elf_alpha_post_process_headers (abfd, link_info)
|
||||
bfd * abfd;
|
||||
struct bfd_link_info * link_info ATTRIBUTE_UNUSED;
|
||||
{
|
||||
Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */
|
||||
|
||||
i_ehdrp = elf_elfheader (abfd);
|
||||
|
||||
/* Put an ABI label supported by FreeBSD >= 4.1. */
|
||||
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
|
||||
#ifdef OLD_FREEBSD_ABI_LABEL
|
||||
/* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */
|
||||
memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define elf_backend_post_process_headers elf_alpha_post_process_headers
|
||||
|
||||
#include "elf64-alpha.c"
|
||||
4189
bfd/elf64-ia64.c
Normal file
4189
bfd/elf64-ia64.c
Normal file
File diff suppressed because it is too large
Load Diff
29
bfd/elf64-sh64-lin.c
Normal file
29
bfd/elf64-sh64-lin.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* Hitachi SH specific support for 64-bit Linux
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf64_sh64blin_vec
|
||||
#define TARGET_BIG_NAME "elf64-sh64big-linux"
|
||||
#define TARGET_LITTLE_SYM bfd_elf64_sh64lin_vec
|
||||
#define TARGET_LITTLE_NAME "elf64-sh64-linux"
|
||||
#define ELF_ARCH bfd_arch_sh
|
||||
#define ELF_MACHINE_CODE EM_SH
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
#define elf_symbol_leading_char 0
|
||||
|
||||
#include "elf64-sh64.c"
|
||||
29
bfd/elf64-sh64-nbsd.c
Normal file
29
bfd/elf64-sh64-nbsd.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* SuperH SH64 specific support for 64-bit NetBSD
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf64_sh64nbsd_vec
|
||||
#define TARGET_BIG_NAME "elf64-sh64-nbsd"
|
||||
#define TARGET_LITTLE_SYM bfd_elf64_sh64lnbsd_vec
|
||||
#define TARGET_LITTLE_NAME "elf64-sh64l-nbsd"
|
||||
#define ELF_ARCH bfd_arch_sh
|
||||
#define ELF_MACHINE_CODE EM_SH
|
||||
#define ELF_MAXPAGESIZE 0x10000
|
||||
#define elf_symbol_leading_char 0
|
||||
|
||||
#include "elf64-sh64.c"
|
||||
1103
bfd/elfarm-nabi.c
Normal file
1103
bfd/elfarm-nabi.c
Normal file
File diff suppressed because it is too large
Load Diff
426
bfd/elfarm-oabi.c
Normal file
426
bfd/elfarm-oabi.c
Normal file
@@ -0,0 +1,426 @@
|
||||
/* 32-bit ELF support for ARM old abi option.
|
||||
Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define OLD_ARM_ABI
|
||||
#define bfd_elf32_arm_allocate_interworking_sections \
|
||||
bfd_elf32_arm_oabi_allocate_interworking_sections
|
||||
#define bfd_elf32_arm_get_bfd_for_interworking \
|
||||
bfd_elf32_arm_oabi_get_bfd_for_interworking
|
||||
#define bfd_elf32_arm_process_before_allocation \
|
||||
bfd_elf32_arm_oabi_process_before_allocation
|
||||
#define bfd_elf32_arm_add_glue_sections_to_bfd \
|
||||
bfd_elf32_arm_oabi_add_glue_sections_to_bfd
|
||||
|
||||
#include "elf/arm.h"
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
#ifndef NUM_ELEM
|
||||
#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
|
||||
#endif
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_oabi_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-littlearm-oabi"
|
||||
#define TARGET_BIG_SYM bfd_elf32_bigarm_oabi_vec
|
||||
#define TARGET_BIG_NAME "elf32-bigarm-oabi"
|
||||
|
||||
#define elf_info_to_howto elf32_arm_info_to_howto
|
||||
#define elf_info_to_howto_rel 0
|
||||
|
||||
#define ARM_ELF_ABI_VERSION 0
|
||||
#define ARM_ELF_OS_ABI_VERSION 0
|
||||
|
||||
static reloc_howto_type * find_howto PARAMS ((unsigned int));
|
||||
static void elf32_arm_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
||||
static reloc_howto_type * elf32_arm_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
|
||||
static reloc_howto_type elf32_arm_howto_table[] =
|
||||
{
|
||||
/* No relocation. */
|
||||
HOWTO (R_ARM_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_NONE", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_PC24, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
24, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PC24", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x00ffffff, /* src_mask */
|
||||
0x00ffffff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* 32 bit absolute. */
|
||||
HOWTO (R_ARM_ABS32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS32", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* Standard 32bit pc-relative reloc. */
|
||||
HOWTO (R_ARM_REL32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_REL32", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* 8 bit absolute. */
|
||||
HOWTO (R_ARM_ABS8, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS8", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* 16 bit absolute. */
|
||||
HOWTO (R_ARM_ABS16, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS16", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* 12 bit absolute. */
|
||||
HOWTO (R_ARM_ABS12, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
12, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS12", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x000008ff, /* src_mask */
|
||||
0x000008ff, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_ABS5, /* type */
|
||||
6, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
5, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_ABS5", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x000007e0, /* src_mask */
|
||||
0x000007e0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_PC22, /* type */
|
||||
1, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
23, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC22", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x07ff07ff, /* src_mask */
|
||||
0x07ff07ff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_SBREL32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_SBREL32", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_AMP_VCALL9, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_AMP_VCALL9", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* 12 bit pc relative. */
|
||||
HOWTO (R_ARM_THM_PC11, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
11, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC11", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x000007ff, /* src_mask */
|
||||
0x000007ff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* 12 bit pc relative. */
|
||||
HOWTO (R_ARM_THM_PC9, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC9", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable hierarchy. */
|
||||
HOWTO (R_ARM_GNU_VTINHERIT, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"R_ARM_GNU_VTINHERIT", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable member usage. */
|
||||
HOWTO (R_ARM_GNU_VTENTRY, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
|
||||
"R_ARM_GNU_VTENTRY", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
/* XXX - gap in index numbering here. */
|
||||
|
||||
HOWTO (R_ARM_PLT32, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
26, /* bitsize */
|
||||
TRUE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PLT32", /* name */
|
||||
TRUE, /* partial_inplace */
|
||||
0x00ffffff, /* src_mask */
|
||||
0x00ffffff, /* dst_mask */
|
||||
TRUE), /* pcrel_offset */
|
||||
|
||||
/* XXX - gap in index numbering here. */
|
||||
|
||||
HOWTO (R_ARM_RREL32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RREL32", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RABS32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RABS32", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RPC24, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RPC24", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RBASE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
FALSE, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RBASE", /* name */
|
||||
FALSE, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
FALSE) /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Locate a reloc in the howto table. This function must be used
|
||||
when the entry number is is > R_ARM_GNU_VTINHERIT. */
|
||||
|
||||
static reloc_howto_type *
|
||||
find_howto (r_type)
|
||||
unsigned int r_type;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = NUM_ELEM (elf32_arm_howto_table); i--;)
|
||||
if (elf32_arm_howto_table [i].type == r_type)
|
||||
return elf32_arm_howto_table + i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *bfd_reloc;
|
||||
Elf_Internal_Rela *elf_reloc;
|
||||
{
|
||||
unsigned int r_type;
|
||||
|
||||
r_type = ELF32_R_TYPE (elf_reloc->r_info);
|
||||
|
||||
if (r_type <= R_ARM_GNU_VTINHERIT)
|
||||
bfd_reloc->howto = & elf32_arm_howto_table[r_type];
|
||||
else
|
||||
bfd_reloc->howto = find_howto (r_type);
|
||||
}
|
||||
|
||||
struct elf32_arm_reloc_map
|
||||
{
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char elf_reloc_val;
|
||||
};
|
||||
|
||||
static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
|
||||
{
|
||||
{BFD_RELOC_NONE, R_ARM_NONE },
|
||||
{BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24 },
|
||||
{BFD_RELOC_32, R_ARM_ABS32 },
|
||||
{BFD_RELOC_32_PCREL, R_ARM_REL32 },
|
||||
{BFD_RELOC_8, R_ARM_ABS8 },
|
||||
{BFD_RELOC_16, R_ARM_ABS16 },
|
||||
{BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12 },
|
||||
{BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5 },
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 },
|
||||
{BFD_RELOC_NONE, R_ARM_SBREL32 },
|
||||
{BFD_RELOC_NONE, R_ARM_AMP_VCALL9 },
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
|
||||
{BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
|
||||
{BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY }
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
elf32_arm_reloc_type_lookup (abfd, code)
|
||||
bfd * abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = NUM_ELEM (elf32_arm_reloc_map); i--;)
|
||||
if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
|
||||
return & elf32_arm_howto_table [elf32_arm_reloc_map[i].elf_reloc_val];
|
||||
|
||||
if (code == BFD_RELOC_ARM_PLT32)
|
||||
return find_howto (R_ARM_PLT32);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#include "elf32-arm.h"
|
||||
34
bfd/elfarmqnx-nabi.c
Normal file
34
bfd/elfarmqnx-nabi.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/* ARM new abi QNX specific support for 32-bit ELF
|
||||
Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define ELFARM_NABI_C_INCLUDED
|
||||
#include "elfarm-nabi.c"
|
||||
|
||||
#include "elf32-qnx.h"
|
||||
|
||||
#undef TARGET_LITTLE_SYM
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_littlearmqnx_vec
|
||||
#undef TARGET_BIG_SYM
|
||||
#define TARGET_BIG_SYM bfd_elf32_bigarmqnx_vec
|
||||
|
||||
/* QNX Neutrino for ARM has a max pagesize of 0x1000. */
|
||||
#undef ELF_MAXPAGESIZE
|
||||
#define ELF_MAXPAGESIZE 0x1000
|
||||
|
||||
#include "elf32-arm.h"
|
||||
3529
bfd/elflink.h
Normal file
3529
bfd/elflink.h
Normal file
File diff suppressed because it is too large
Load Diff
23
bfd/hppa_stubs.h
Normal file
23
bfd/hppa_stubs.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* HPPA linker stub instructions */
|
||||
|
||||
/* These are the instructions which the linker may insert into the
|
||||
code stream when building final executables to handle out-of-range
|
||||
calls and argument relocations. */
|
||||
|
||||
#define LDO_M4_R31_R31 0x37ff3ff9 /* ldo -4(%r31),%r31 */
|
||||
#define LDIL_R1 0x20200000 /* ldil XXX,%r1 */
|
||||
#define BE_SR4_R1 0xe0202000 /* be XXX(%sr4,%r1) */
|
||||
#define COPY_R31_R2 0x081f0242 /* copy %r31,%r2 */
|
||||
#define BLE_SR4_R0 0xe4002000 /* ble XXX(%sr4,%r0) */
|
||||
#define BLE_SR4_R1 0xe4202000 /* ble XXX(%sr4,%r1) */
|
||||
#define BV_N_0_R31 0xebe0c002 /* bv,n 0(%r31) */
|
||||
#define STW_R31_M8R30 0x6bdf3ff1 /* stw %r31,-8(%r30) */
|
||||
#define LDW_M8R30_R31 0x4bdf3ff1 /* ldw -8(%r30),%r31 */
|
||||
#define STW_ARG_M16R30 0x6bc03fe1 /* stw %argX,-16(%r30) */
|
||||
#define LDW_M16R30_ARG 0x4bc03fe1 /* ldw -12(%r30),%argX */
|
||||
#define STW_ARG_M12R30 0x6bc03fe9 /* stw %argX,-16(%r30) */
|
||||
#define LDW_M12R30_ARG 0x4bc03fe9 /* ldw -12(%r30),%argX */
|
||||
#define FSTW_FARG_M16R30 0x27c11200 /* fstws %fargX,-16(%r30) */
|
||||
#define FLDW_M16R30_FARG 0x27c11000 /* fldws -16(%r30),%fargX */
|
||||
#define FSTD_FARG_M16R30 0x2fc11200 /* fstds %fargX,-16(%r30) */
|
||||
#define FLDD_M16R30_FARG 0x2fc11000 /* fldds -16(%r30),%fargX */
|
||||
57
bfd/m68klynx.c
Normal file
57
bfd/m68klynx.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/* BFD back-end for m68k binaries under LynxOS.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#define N_SHARED_LIB(x) 0
|
||||
|
||||
#define TEXT_START_ADDR 0
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define DEFAULT_ARCH bfd_arch_m68k
|
||||
|
||||
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
|
||||
remove whitespace added here, and thus will fail to concatenate
|
||||
the tokens. */
|
||||
#define MY(OP) CONCAT2 (m68klynx_aout_,OP)
|
||||
#define TARGETNAME "a.out-m68k-lynx"
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include "libaout.h"
|
||||
#include "aout/aout64.h"
|
||||
|
||||
#define TARGET_IS_BIG_ENDIAN_P
|
||||
|
||||
#ifdef LYNX_CORE
|
||||
|
||||
char *lynx_core_file_failing_command();
|
||||
int lynx_core_file_failing_signal();
|
||||
bfd_boolean lynx_core_file_matches_executable_p();
|
||||
const bfd_target *lynx_core_file_p();
|
||||
|
||||
#define MY_core_file_failing_command lynx_core_file_failing_command
|
||||
#define MY_core_file_failing_signal lynx_core_file_failing_signal
|
||||
#define MY_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
||||
#define MY_core_file_p lynx_core_file_p
|
||||
|
||||
#endif /* LYNX_CORE */
|
||||
|
||||
#include "aout-target.h"
|
||||
86
bfd/mpw-config.in
Normal file
86
bfd/mpw-config.in
Normal file
@@ -0,0 +1,86 @@
|
||||
# Configuration fragment for BFD.
|
||||
|
||||
# This is almost always correct.
|
||||
|
||||
Set selarchs "&bfd_{target_cpu}_arch"
|
||||
Set defvec ""
|
||||
Set selvecs ""
|
||||
Set havevecs ""
|
||||
|
||||
If "{target_canonical}" =~ /m68k-apple-macos/
|
||||
Set BFD_BACKENDS '"{o}"coff-m68k.c.o "{o}"cofflink.c.o'
|
||||
Set defvec m68kcoff_vec
|
||||
Set selvecs '&m68kcoff_vec'
|
||||
Set havevecs '-d HAVE_m68kcoff_vec'
|
||||
|
||||
Else If "{target_canonical}" =~ /powerpc-apple-macos/
|
||||
Set BFD_BACKENDS '"{o}"coff-pmac.c.o "{o}"xcofflink.c.o'
|
||||
Set defvec pmac_xcoff_vec
|
||||
Set selvecs '&pmac_xcoff_vec'
|
||||
Set havevecs '-d HAVE_pmac_xcoff_vec'
|
||||
Set selarchs "&bfd_powerpc_arch"
|
||||
|
||||
Else If "{target_canonical}" =~ /i386-\Option-x-go32/
|
||||
Set BFD_BACKENDS '"{o}"coff-i386.c.o'
|
||||
Set defvec i386coff_vec
|
||||
Set selvecs '&i386coff_vec'
|
||||
Set havevecs '-d HAVE_i386coff_vec'
|
||||
|
||||
Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/
|
||||
Set BFD_BACKENDS '"{o}"coff-mips.c.o "{o}"ecoff.c.o "{o}"ecofflink.c.o "{o}"elf32.c.o "{o}"elf32-mips.c.o "{o}"elflink.c.o'
|
||||
Set defvec ecoff_big_vec
|
||||
Set selvecs '&ecoff_big_vec,&ecoff_little_vec,&bfd_elf32_bigmips_vec'
|
||||
Set havevecs '-d HAVE_ecoff_big_vec -d HAVE_ecoff_little_vec -d HAVE_bfd_elf32_bigmips_vec'
|
||||
|
||||
Else If "{target_canonical}" =~ /sh-\Option-x-hms/
|
||||
Set BFD_BACKENDS '"{o}"coff-sh.c.o "{o}"cofflink.c.o'
|
||||
Set defvec shcoff_vec
|
||||
Set selvecs '&shcoff_vec,&shlcoff_vec'
|
||||
Set havevecs '-d HAVE_shcoff_vec -d HAVE_shlcoff_vec'
|
||||
End If
|
||||
|
||||
Set ta `echo {selarchs} | sed -e 's/&bfd_/{o}cpu-/g' -e 's/_arch/.c.o/g'`
|
||||
|
||||
Set tdefaults "-d DEFAULT_VECTOR={defvec} -d SELECT_VECS={selvecs} -d SELECT_ARCHITECTURES={selarchs} {havevecs}"
|
||||
|
||||
Echo '# From mpw-config.in' > "{o}"mk.tmp
|
||||
Echo 'WORDSIZE = 32' >> "{o}"mk.tmp
|
||||
Echo 'BFD_MACHINES = ' {ta} >> "{o}"mk.tmp
|
||||
Echo 'BFD_BACKENDS = ' {BFD_BACKENDS} >> "{o}"mk.tmp
|
||||
Echo 'TDEFAULTS = ' {tdefaults} >> "{o}"mk.tmp
|
||||
Echo 'HDEPFILES = ' >> "{o}"mk.tmp
|
||||
Echo 'TDEPFILES = ' >> "{o}"mk.tmp
|
||||
Echo '# End from mpw-config.in' >> "{o}"mk.tmp
|
||||
|
||||
Echo '/* config.h. Generated by mpw-configure. */' > "{o}"config.new
|
||||
Echo '#include "mpw.h"' >> "{o}"config.new
|
||||
|
||||
MoveIfChange "{o}"config.new "{o}"config.h
|
||||
|
||||
# We can only handle 32-bit targets right now.
|
||||
|
||||
sed -e 's/@WORDSIZE@/32/' \Option-d
|
||||
-e 's/@wordsize@/32/' \Option-d
|
||||
-e "s/@VERSION@/`Catenate {srcdir}VERSION`/" \Option-d
|
||||
-e 's/@BFD_HOST_64_BIT_DEFINED@/0/' \Option-d
|
||||
-e 's/@BFD_HOST_64_BIT@//' \Option-d
|
||||
-e 's/@BFD_HOST_U_64_BIT@//' \Option-d
|
||||
-e 's/@BFD_HOST_64BIT_LONG@/0/' \Option-d
|
||||
"{srcdir}"bfd-in2.h >"{o}"bfd.h-new
|
||||
|
||||
MoveIfChange "{o}"bfd.h-new "{o}"bfd.h
|
||||
|
||||
sed -e 's/NN/32/g' "{srcdir}"elfxx-target.h >"{o}"elf32-target.h-new
|
||||
MoveIfChange "{o}"elf32-target.h-new "{o}"elf32-target.h
|
||||
|
||||
# Pre-expand some macros in coffswap.h, so MPW C doesn't choke.
|
||||
|
||||
sed -e 's/^ PUT_AOUTHDR_TSIZE (/ bfd_h_put_32 (/' \Option-d
|
||||
-e 's/^ PUT_AOUTHDR_DSIZE (/ bfd_h_put_32 (/' \Option-d
|
||||
-e 's/^ PUT_AOUTHDR_BSIZE (/ bfd_h_put_32 (/' \Option-d
|
||||
-e 's/^ PUT_AOUTHDR_ENTRY (/ bfd_h_put_32 (/' \Option-d
|
||||
-e 's/^ PUT_AOUTHDR_TEXT_START (/ bfd_h_put_32 (/' \Option-d
|
||||
-e 's/^ PUT_AOUTHDR_DATA_START (/ bfd_h_put_32 (/' \Option-d
|
||||
"{srcdir}"coffswap.h >"{o}"coffswap.h-new
|
||||
|
||||
MoveIfChange "{o}"coffswap.h-new "{o}"coffswap.h
|
||||
81
bfd/mpw-make.sed
Normal file
81
bfd/mpw-make.sed
Normal file
@@ -0,0 +1,81 @@
|
||||
# Sed commands to finish translating the Unix BFD Makefile into MPW syntax.
|
||||
|
||||
# Whack out unused host and target define bits.
|
||||
/HDEFINES/s/@HDEFINES@//
|
||||
/TDEFINES/s/@TDEFINES@//
|
||||
|
||||
# Fix pathnames to include directories.
|
||||
/^INCDIR = /s/^INCDIR = .*$/INCDIR = "{topsrcdir}"include/
|
||||
/^CSEARCH = /s/$/ -i "{INCDIR}":mpw: -i ::extra-include:/
|
||||
|
||||
# Comment out setting of vars, configure script will add these itself.
|
||||
/^WORDSIZE =/s/^/#/
|
||||
# /^ALL_BACKENDS/s/^/#/
|
||||
/^BFD_BACKENDS/s/^/#/
|
||||
/^BFD_MACHINES/s/^/#/
|
||||
/^TDEFAULTS/s/^/#/
|
||||
|
||||
# Remove extra, useless, "all".
|
||||
/^all \\Option-f _oldest/,/^$/d
|
||||
|
||||
# Remove the Makefile rebuild rule.
|
||||
/^Makefile /,/--recheck/d
|
||||
|
||||
# Don't do any recursive subdir stuff.
|
||||
/ subdir_do/s/{MAKE}/null-command/
|
||||
|
||||
/BFD_H/s/^{BFD_H}/#{BFD_H}/
|
||||
|
||||
# Add explicit srcdir paths to special files.
|
||||
/config.bfd/s/ config.bfd/ "{s}"config.bfd/g
|
||||
/targmatch.sed/s/ targmatch.sed/ "{s}"targmatch.sed/g
|
||||
|
||||
# Point at include files that are always in the objdir.
|
||||
/bfd/s/"{s}"bfd\.h/"{o}"bfd.h/g
|
||||
/config/s/"{s}"config\.h/"{o}"config.h/g
|
||||
/targmatch/s/"{s}"targmatch\.h/"{o}"targmatch.h/g
|
||||
/targmatch/s/^targmatch\.h/"{o}"targmatch.h/
|
||||
/elf32-target/s/"{s}"elf32-target\.h/"{o}"elf32-target.h/g
|
||||
/elf32-target/s/^elf32-target\.h/"{o}"elf32-target.h/
|
||||
/elf64-target/s/"{s}"elf64-target\.h/"{o}"elf64-target.h/g
|
||||
/elf64-target/s/^elf64-target\.h/"{o}"elf64-target.h/
|
||||
|
||||
/"{s}"{INCDIR}/s/"{s}"{INCDIR}/"{INCDIR}"/g
|
||||
|
||||
/dep/s/\.dep/__dep/g
|
||||
|
||||
# Removing duplicates is cool but presently unnecessary,
|
||||
# so whack this out.
|
||||
/^ofiles \\Option-f/,/^$/d
|
||||
/ofiles/s/{OFILES} ofiles/{OFILES}/
|
||||
/echo ofiles = /d
|
||||
/cat ofiles/s/`cat ofiles`/{OFILES}/
|
||||
|
||||
# No corefile support.
|
||||
/COREFILE/s/@COREFILE@//
|
||||
/COREFLAG/s/@COREFLAG@//
|
||||
|
||||
# No PIC foolery in this environment.
|
||||
/@ALLLIBS@/s/@ALLLIBS@/{TARGETLIB}/
|
||||
/@PICLIST@/s/@PICLIST@//
|
||||
/@PICFLAG@/s/@PICFLAG@//
|
||||
/^{OFILES} \\Option-f stamp-picdir/,/^$/d
|
||||
|
||||
# Remove the pic trickery from the default build rule.
|
||||
/^\.c\.o \\Option-f /,/End If/c\
|
||||
.c.o \\Option-f .c
|
||||
|
||||
# MPW Make doesn't know about $<.
|
||||
/"{o}"targets.c.o \\Option-f "{s}"targets.c Makefile/,/^$/c\
|
||||
"{o}"targets.c.o \\Option-f "{s}"targets.c Makefile\
|
||||
{CC} @DASH_C_FLAG@ {ALL_CFLAGS} {TDEFAULTS} "{s}"targets.c -o "{o}"targets.c.o
|
||||
|
||||
/"{o}"archures.c.o \\Option-f "{s}"archures.c Makefile/,/^$/c\
|
||||
"{o}"archures.c.o \\Option-f "{s}"archures.c Makefile\
|
||||
{CC} @DASH_C_FLAG@ {ALL_CFLAGS} {TDEFAULTS} "{s}"archures.c -o "{o}"archures.c.o
|
||||
|
||||
# Remove the .h rebuilding rules, we don't currently have a doc subdir,
|
||||
# or a way to build the prototype-hacking tool that's in it.
|
||||
/^"{srcdir}"bfd-in2.h \\Option-f /,/^$/d
|
||||
/^"{srcdir}"libbfd.h \\Option-f /,/^$/d
|
||||
/^"{srcdir}"libcoff.h \\Option-f /,/^$/d
|
||||
2027
bfd/peigen.c
Normal file
2027
bfd/peigen.c
Normal file
File diff suppressed because it is too large
Load Diff
259
bfd/po/POTFILES.in
Normal file
259
bfd/po/POTFILES.in
Normal file
@@ -0,0 +1,259 @@
|
||||
aix386-core.c
|
||||
aout0.c
|
||||
aout32.c
|
||||
aout64.c
|
||||
aout-adobe.c
|
||||
aout-arm.c
|
||||
aout-cris.c
|
||||
aoutf1.h
|
||||
aout-ns32k.c
|
||||
aout-sparcle.c
|
||||
aout-target.h
|
||||
aout-tic30.c
|
||||
aoutx.h
|
||||
archive.c
|
||||
archures.c
|
||||
armnetbsd.c
|
||||
bfd.c
|
||||
binary.c
|
||||
bout.c
|
||||
cache.c
|
||||
cf-i386lynx.c
|
||||
cf-m68klynx.c
|
||||
cf-sparclynx.c
|
||||
cisco-core.c
|
||||
coff64-rs6000.c
|
||||
coff-a29k.c
|
||||
coff-alpha.c
|
||||
coff-apollo.c
|
||||
coff-arm.c
|
||||
coff-aux.c
|
||||
coffcode.h
|
||||
coffgen.c
|
||||
coff-go32.c
|
||||
coff-h8300.c
|
||||
coff-h8500.c
|
||||
coff-i386.c
|
||||
coff-i860.c
|
||||
coff-i960.c
|
||||
cofflink.c
|
||||
coff-m68k.c
|
||||
coff-m88k.c
|
||||
coff-mips.c
|
||||
coff-pmac.c
|
||||
coff-rs6000.c
|
||||
coff-sh.c
|
||||
coff-sparc.c
|
||||
coff-stgo32.c
|
||||
coff-svm68k.c
|
||||
coffswap.h
|
||||
coff-tic30.c
|
||||
coff-tic54x.c
|
||||
coff-tic80.c
|
||||
coff-u68k.c
|
||||
coff-w65.c
|
||||
coff-we32k.c
|
||||
coff-z8k.c
|
||||
corefile.c
|
||||
cpu-a29k.c
|
||||
cpu-alpha.c
|
||||
cpu-arc.c
|
||||
cpu-arm.c
|
||||
cpu-avr.c
|
||||
cpu-cris.c
|
||||
cpu-d10v.c
|
||||
cpu-d30v.c
|
||||
cpu-fr30.c
|
||||
cpu-h8300.c
|
||||
cpu-h8500.c
|
||||
cpu-hppa.c
|
||||
cpu-i370.c
|
||||
cpu-i386.c
|
||||
cpu-i860.c
|
||||
cpu-i960.c
|
||||
cpu-ia64.c
|
||||
cpu-m10200.c
|
||||
cpu-m10300.c
|
||||
cpu-m32r.c
|
||||
cpu-m68hc11.c
|
||||
cpu-m68hc12.c
|
||||
cpu-m68k.c
|
||||
cpu-m88k.c
|
||||
cpu-mcore.c
|
||||
cpu-mips.c
|
||||
cpu-ns32k.c
|
||||
cpu-pdp11.c
|
||||
cpu-pj.c
|
||||
cpu-powerpc.c
|
||||
cpu-rs6000.c
|
||||
cpu-s390.c
|
||||
cpu-sh.c
|
||||
cpu-sparc.c
|
||||
cpu-tic30.c
|
||||
cpu-tic54x.c
|
||||
cpu-tic80.c
|
||||
cpu-v850.c
|
||||
cpu-vax.c
|
||||
cpu-w65.c
|
||||
cpu-we32k.c
|
||||
cpu-z8k.c
|
||||
demo64.c
|
||||
dwarf1.c
|
||||
dwarf2.c
|
||||
ecoff.c
|
||||
ecofflink.c
|
||||
ecoffswap.h
|
||||
efi-app-ia32.c
|
||||
efi-app-ia64.c
|
||||
elf32-arc.c
|
||||
elf32-arm.h
|
||||
elf32-avr.c
|
||||
elf32.c
|
||||
elf32-cris.c
|
||||
elf32-d10v.c
|
||||
elf32-d30v.c
|
||||
elf32-fr30.c
|
||||
elf32-gen.c
|
||||
elf32-hppa.c
|
||||
elf32-hppa.h
|
||||
elf32-i370.c
|
||||
elf32-i386.c
|
||||
elf32-i860.c
|
||||
elf32-i960.c
|
||||
elf32-m32r.c
|
||||
elf32-m68hc11.c
|
||||
elf32-m68hc12.c
|
||||
elf32-m68k.c
|
||||
elf32-m88k.c
|
||||
elf32-mcore.c
|
||||
elf32-mips.c
|
||||
elf32-pj.c
|
||||
elf32-ppc.c
|
||||
elf32-s390.c
|
||||
elf32-sh.c
|
||||
elf32-sh-lin.c
|
||||
elf32-sparc.c
|
||||
elf32-v850.c
|
||||
elf64-alpha.c
|
||||
elf64.c
|
||||
elf64-gen.c
|
||||
elf64-hppa.c
|
||||
elf64-hppa.h
|
||||
elf64-mips.c
|
||||
elf64-s390.c
|
||||
elf64-sparc.c
|
||||
elf64-x86-64.c
|
||||
elfarm-nabi.c
|
||||
elfarm-oabi.c
|
||||
elf-bfd.h
|
||||
elf.c
|
||||
elfcode.h
|
||||
elfcore.h
|
||||
elf-hppa.h
|
||||
elflink.c
|
||||
elflink.h
|
||||
elf-m10200.c
|
||||
elf-m10300.c
|
||||
epoc-pe-arm.c
|
||||
epoc-pei-arm.c
|
||||
format.c
|
||||
freebsd.h
|
||||
genlink.h
|
||||
go32stub.h
|
||||
hash.c
|
||||
hp300bsd.c
|
||||
hp300hpux.c
|
||||
hpux-core.c
|
||||
i386aout.c
|
||||
i386bsd.c
|
||||
i386dynix.c
|
||||
i386freebsd.c
|
||||
i386linux.c
|
||||
i386lynx.c
|
||||
i386mach3.c
|
||||
i386msdos.c
|
||||
i386netbsd.c
|
||||
i386os9k.c
|
||||
ieee.c
|
||||
ihex.c
|
||||
init.c
|
||||
irix-core.c
|
||||
libaout.h
|
||||
libbfd.c
|
||||
libbfd.h
|
||||
libcoff.h
|
||||
libecoff.h
|
||||
libhppa.h
|
||||
libieee.h
|
||||
libnlm.h
|
||||
liboasys.h
|
||||
libpei.h
|
||||
linker.c
|
||||
lynx-core.c
|
||||
m68k4knetbsd.c
|
||||
m68klinux.c
|
||||
m68klynx.c
|
||||
m68knetbsd.c
|
||||
m88kmach3.c
|
||||
mipsbsd.c
|
||||
netbsd.h
|
||||
newsos3.c
|
||||
nlm32-alpha.c
|
||||
nlm32.c
|
||||
nlm32-i386.c
|
||||
nlm32-ppc.c
|
||||
nlm32-sparc.c
|
||||
nlm64.c
|
||||
nlm.c
|
||||
nlmcode.h
|
||||
nlmswap.h
|
||||
nlm-target.h
|
||||
ns32k.h
|
||||
ns32knetbsd.c
|
||||
oasys.c
|
||||
opncls.c
|
||||
osf-core.c
|
||||
pc532-mach.c
|
||||
pdp11.c
|
||||
pe-arm.c
|
||||
pe-i386.c
|
||||
pei-arm.c
|
||||
peicode.h
|
||||
pei-i386.c
|
||||
pei-mcore.c
|
||||
pei-mips.c
|
||||
pei-ppc.c
|
||||
pei-sh.c
|
||||
pe-mcore.c
|
||||
pe-mips.c
|
||||
pe-ppc.c
|
||||
pe-sh.c
|
||||
ppcboot.c
|
||||
reloc16.c
|
||||
reloc.c
|
||||
riscix.c
|
||||
sco5-core.c
|
||||
section.c
|
||||
som.c
|
||||
som.h
|
||||
sparclinux.c
|
||||
sparclynx.c
|
||||
sparcnetbsd.c
|
||||
srec.c
|
||||
stabs.c
|
||||
stab-syms.c
|
||||
sunos.c
|
||||
syms.c
|
||||
targets.c
|
||||
tekhex.c
|
||||
trad-core.c
|
||||
vaxnetbsd.c
|
||||
versados.c
|
||||
vms.c
|
||||
vms-gsd.c
|
||||
vms.h
|
||||
vms-hdr.c
|
||||
vms-misc.c
|
||||
vms-tir.c
|
||||
xcofflink.c
|
||||
xcoff-target.h
|
||||
1082
bfd/vms-gsd.c
Normal file
1082
bfd/vms-gsd.c
Normal file
File diff suppressed because it is too large
Load Diff
1382
bfd/vms-hdr.c
Normal file
1382
bfd/vms-hdr.c
Normal file
File diff suppressed because it is too large
Load Diff
2808
bfd/vms-tir.c
Normal file
2808
bfd/vms-tir.c
Normal file
File diff suppressed because it is too large
Load Diff
305
bfd/vmsutil.c
Normal file
305
bfd/vmsutil.c
Normal file
@@ -0,0 +1,305 @@
|
||||
/* vmsutil.c -- Utilities for VMS.
|
||||
Copyright 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by Douglas B Rupp <rupp@gnat.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include "vmsutil.h"
|
||||
|
||||
/* The purspose of the two alternate versions below is to have one that
|
||||
works for native VMS and one that works on an NFS mounted filesystem
|
||||
(Unix Server/VMS client). The main issue being to generate the special
|
||||
VMS file timestamps for the debug info. */
|
||||
|
||||
#ifdef VMS
|
||||
#define __NEW_STARLET 1
|
||||
#include <vms/starlet.h>
|
||||
#include <vms/rms.h>
|
||||
#include <vms/atrdef.h>
|
||||
#include <vms/fibdef.h>
|
||||
#include <vms/stsdef.h>
|
||||
#include <vms/iodef.h>
|
||||
#include <vms/fatdef.h>
|
||||
#include <errno.h>
|
||||
#include <vms/descrip.h>
|
||||
#include <string.h>
|
||||
#include <unixlib.h>
|
||||
|
||||
#define MAXPATH 256
|
||||
|
||||
/* Descrip.h doesn't have everything... */
|
||||
typedef struct fibdef * __fibdef_ptr32 __attribute__ (( mode (SI) ));
|
||||
|
||||
struct dsc$descriptor_fib
|
||||
{
|
||||
unsigned int fib$l_len;
|
||||
__fibdef_ptr32 fib$l_addr;
|
||||
};
|
||||
|
||||
/* I/O Status Block. */
|
||||
struct IOSB
|
||||
{
|
||||
unsigned short status, count;
|
||||
unsigned int devdep;
|
||||
};
|
||||
|
||||
static char *tryfile;
|
||||
|
||||
/* Variable length string. */
|
||||
struct vstring
|
||||
{
|
||||
short length;
|
||||
char string[NAM$C_MAXRSS+1];
|
||||
};
|
||||
|
||||
static char filename_buff [MAXPATH];
|
||||
static char vms_filespec [MAXPATH];
|
||||
|
||||
/* Callback function for filespec style conversion. */
|
||||
|
||||
static int
|
||||
translate_unix (char *name, int type ATTRIBUTE_UNUSED)
|
||||
{
|
||||
strncpy (filename_buff, name, MAXPATH);
|
||||
filename_buff [MAXPATH - 1] = (char) 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Wrapper for DECC function that converts a Unix filespec
|
||||
to VMS style filespec. */
|
||||
|
||||
static char *
|
||||
to_vms_file_spec (char *filespec)
|
||||
{
|
||||
strncpy (vms_filespec, "", MAXPATH);
|
||||
decc$to_vms (filespec, translate_unix, 1, 1);
|
||||
strncpy (vms_filespec, filename_buff, MAXPATH);
|
||||
|
||||
vms_filespec [MAXPATH - 1] = (char) 0;
|
||||
|
||||
return vms_filespec;
|
||||
}
|
||||
|
||||
#else /* not VMS */
|
||||
|
||||
#define _BSD_SOURCE 1
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#define VMS_EPOCH_OFFSET 35067168000000000LL
|
||||
#define VMS_GRANULARITY_FACTOR 10000000
|
||||
|
||||
#endif /* VMS */
|
||||
|
||||
/* Return VMS file date, size, format, version given a name. */
|
||||
|
||||
int
|
||||
vms_file_stats_name (const char *filename,
|
||||
long long *cdt,
|
||||
long *siz,
|
||||
char *rfo,
|
||||
int *ver)
|
||||
{
|
||||
#ifdef VMS
|
||||
struct FAB fab;
|
||||
struct NAM nam;
|
||||
|
||||
unsigned long long create;
|
||||
FAT recattr;
|
||||
char ascnamebuff [256];
|
||||
|
||||
ATRDEF atrlst[]
|
||||
= {
|
||||
{ ATR$S_CREDATE, ATR$C_CREDATE, &create },
|
||||
{ ATR$S_RECATTR, ATR$C_RECATTR, &recattr },
|
||||
{ ATR$S_ASCNAME, ATR$C_ASCNAME, &ascnamebuff },
|
||||
{ 0, 0, 0}
|
||||
};
|
||||
|
||||
FIBDEF fib;
|
||||
struct dsc$descriptor_fib fibdsc = {sizeof (fib), (void *) &fib};
|
||||
|
||||
struct IOSB iosb;
|
||||
|
||||
long status;
|
||||
unsigned short chan;
|
||||
|
||||
struct vstring file;
|
||||
struct dsc$descriptor_s filedsc
|
||||
= {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) file.string};
|
||||
struct vstring device;
|
||||
struct dsc$descriptor_s devicedsc
|
||||
= {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) device.string};
|
||||
struct vstring result;
|
||||
struct dsc$descriptor_s resultdsc
|
||||
= {NAM$C_MAXRSS, DSC$K_DTYPE_VT, DSC$K_CLASS_VS, (void *) result.string};
|
||||
|
||||
if (strcmp (filename, "<internal>") == 0
|
||||
|| strcmp (filename, "<built-in>") == 0)
|
||||
{
|
||||
if (cdt)
|
||||
*cdt = 0;
|
||||
|
||||
if (siz)
|
||||
*siz = 0;
|
||||
|
||||
if (rfo)
|
||||
*rfo = 0;
|
||||
|
||||
if (ver)
|
||||
*ver = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
tryfile = to_vms_file_spec ((char *) filename);
|
||||
|
||||
/* Allocate and initialize a FAB and NAM structures. */
|
||||
fab = cc$rms_fab;
|
||||
nam = cc$rms_nam;
|
||||
|
||||
nam.nam$l_esa = file.string;
|
||||
nam.nam$b_ess = NAM$C_MAXRSS;
|
||||
nam.nam$l_rsa = result.string;
|
||||
nam.nam$b_rss = NAM$C_MAXRSS;
|
||||
fab.fab$l_fna = tryfile;
|
||||
fab.fab$b_fns = strlen (tryfile);
|
||||
fab.fab$l_nam = &nam;
|
||||
|
||||
/* Validate filespec syntax and device existence. */
|
||||
status = SYS$PARSE (&fab, 0, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
|
||||
file.string[nam.nam$b_esl] = 0;
|
||||
|
||||
/* Find matching filespec. */
|
||||
status = SYS$SEARCH (&fab, 0, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
|
||||
file.string[nam.nam$b_esl] = 0;
|
||||
result.string[result.length=nam.nam$b_rsl] = 0;
|
||||
|
||||
/* Get the device name and assign an IO channel. */
|
||||
strncpy (device.string, nam.nam$l_dev, nam.nam$b_dev);
|
||||
devicedsc.dsc$w_length = nam.nam$b_dev;
|
||||
chan = 0;
|
||||
status = SYS$ASSIGN (&devicedsc, &chan, 0, 0, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
|
||||
/* Initialize the FIB and fill in the directory id field. */
|
||||
memset (&fib, 0, sizeof (fib));
|
||||
fib.fib$w_did[0] = nam.nam$w_did[0];
|
||||
fib.fib$w_did[1] = nam.nam$w_did[1];
|
||||
fib.fib$w_did[2] = nam.nam$w_did[2];
|
||||
fib.fib$l_acctl = 0;
|
||||
fib.fib$l_wcc = 0;
|
||||
strcpy (file.string, (strrchr (result.string, ']') + 1));
|
||||
filedsc.dsc$w_length = strlen (file.string);
|
||||
result.string[result.length = 0] = 0;
|
||||
|
||||
/* Open and close the file to fill in the attributes. */
|
||||
status
|
||||
= SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0,
|
||||
&fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
if ((iosb.status & 1) != 1)
|
||||
return 1;
|
||||
|
||||
result.string[result.length] = 0;
|
||||
status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, &fibdsc, 0, 0, 0,
|
||||
&atrlst, 0);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
if ((iosb.status & 1) != 1)
|
||||
return 1;
|
||||
|
||||
/* Deassign the channel and exit. */
|
||||
status = SYS$DASSGN (chan);
|
||||
if ((status & 1) != 1)
|
||||
return 1;
|
||||
|
||||
if (cdt) *cdt = create;
|
||||
if (siz) *siz = (512 * 65536 * recattr.fat$w_efblkh) +
|
||||
(512 * (recattr.fat$w_efblkl - 1)) +
|
||||
recattr.fat$w_ffbyte;
|
||||
if (rfo) *rfo = recattr.fat$v_rtype;
|
||||
if (ver) *ver = strtol (strrchr (ascnamebuff, ';') + 1, 0, 10);
|
||||
#else /* not VMS */
|
||||
|
||||
struct stat buff;
|
||||
struct tm *ts;
|
||||
long long gmtoff, secs, nsecs;
|
||||
|
||||
if ((stat (filename, &buff)) != 0)
|
||||
return 1;
|
||||
|
||||
if (cdt)
|
||||
{
|
||||
ts = localtime (& buff.st_mtime);
|
||||
|
||||
#ifdef HAVE_TM_GMTOFF
|
||||
gmtoff = ts->tm_gmtoff;
|
||||
#else
|
||||
{
|
||||
extern long timezone;
|
||||
|
||||
if (ts->tm_isdst == 1)
|
||||
gmtoff = - (timezone - 3600);
|
||||
else
|
||||
gmtoff = - timezone;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ST_MTIM_TV_SEC
|
||||
secs = buff.st_mtim.tv_sec;
|
||||
#else
|
||||
secs = buff.st_mtime;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ST_MTIM_TV_NSEC
|
||||
nsecs = buff.st_mtim.tv_nsec;
|
||||
#else
|
||||
nsecs = 0;
|
||||
#endif
|
||||
|
||||
/* VMS timestamps are stored in local time to 100 nsec accuracy, but by
|
||||
experiment I found timestamps truncated to (at least) microseconds
|
||||
on an NFS mounted filesystem, hence the adjustment below. DBR. */
|
||||
*cdt = ((secs + gmtoff) * VMS_GRANULARITY_FACTOR)
|
||||
+ (nsecs / 1000 * 10) + VMS_EPOCH_OFFSET;
|
||||
}
|
||||
|
||||
if (siz)
|
||||
*siz = buff.st_size;
|
||||
|
||||
if (rfo)
|
||||
*rfo = 2; /* Stream LF format. */
|
||||
|
||||
/* Returning a file version of 0 is never correct for debug info, version 1
|
||||
will be correct if file editing is done only on the Unix side. If editing
|
||||
is done on the VMS side, then its TBD. */
|
||||
if (ver)
|
||||
*ver = 1;
|
||||
#endif /* VMS */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
20
bfd/vmsutil.h
Normal file
20
bfd/vmsutil.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* vmsutil.h -- Header file for utilities for VMS.
|
||||
Copyright 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by Douglas B Rupp <rupp@gnat.com>
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
extern int vms_file_stats_name (const char *, long long *, long *, char *, int *);
|
||||
194
bfd/xcoff-target.h
Normal file
194
bfd/xcoff-target.h
Normal file
@@ -0,0 +1,194 @@
|
||||
/* Common definitions for backends based on IBM RS/6000 "XCOFF64" files.
|
||||
Copyright 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2009
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
|
||||
/* Internalcoff.h and coffcode.h modify themselves based on this flag. */
|
||||
#define RS6000COFF_C 1
|
||||
|
||||
#define SELECT_RELOC(internal, howto) \
|
||||
{ \
|
||||
internal.r_type = howto->type; \
|
||||
internal.r_size = \
|
||||
((howto->complain_on_overflow == complain_overflow_signed \
|
||||
? 0x80 \
|
||||
: 0) \
|
||||
| (howto->bitsize - 1)); \
|
||||
}
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 3
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#define NO_COFF_SYMBOLS
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) _bfd_xcoff_rtype2howto (cache_ptr, dst)
|
||||
|
||||
#define coff_mkobject _bfd_xcoff_mkobject
|
||||
#define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data
|
||||
#define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name
|
||||
#define coff_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
|
||||
#define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup
|
||||
#define coff_relocate_section _bfd_ppc_xcoff_relocate_section
|
||||
#define coff_core_file_failing_command _bfd_nocore_core_file_failing_command
|
||||
#define coff_core_file_failing_signal _bfd_nocore_core_file_failing_signal
|
||||
#define coff_core_file_matches_executable_p _bfd_nocore_core_file_matches_executable_p
|
||||
#define coff_core_file_pid _bfd_nocore_core_file_pid
|
||||
#define _bfd_xcoff_bfd_get_relocated_section_contents coff_bfd_get_relocated_section_contents
|
||||
#define _bfd_xcoff_bfd_relax_section coff_bfd_relax_section
|
||||
#define _bfd_xcoff_bfd_gc_sections coff_bfd_gc_sections
|
||||
#define _bfd_xcoff_bfd_merge_sections coff_bfd_merge_sections
|
||||
#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
|
||||
#define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked
|
||||
#define _bfd_xcoff_bfd_define_common_symbol _bfd_xcoff_define_common_symbol
|
||||
#define _bfd_xcoff_bfd_link_split_section coff_bfd_link_split_section
|
||||
|
||||
#define CORE_FILE_P _bfd_dummy_target
|
||||
|
||||
#ifdef AIX_CORE
|
||||
|
||||
#undef CORE_FILE_P
|
||||
#define CORE_FILE_P rs6000coff_core_p
|
||||
extern const bfd_target * rs6000coff_core_p (bfd *);
|
||||
extern bfd_boolean rs6000coff_core_file_matches_executable_p (bfd *, bfd*);
|
||||
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p \
|
||||
rs6000coff_core_file_matches_executable_p
|
||||
|
||||
extern char *rs6000coff_core_file_failing_command (bfd *);
|
||||
#undef coff_core_file_failing_command
|
||||
#define coff_core_file_failing_command rs6000coff_core_file_failing_command
|
||||
|
||||
extern int rs6000coff_core_file_failing_signal (bfd *);
|
||||
#undef coff_core_file_failing_signal
|
||||
#define coff_core_file_failing_signal rs6000coff_core_file_failing_signal
|
||||
#endif /* AIX_CORE */
|
||||
|
||||
#ifdef LYNX_CORE
|
||||
|
||||
#undef CORE_FILE_P
|
||||
#define CORE_FILE_P lynx_core_file_p
|
||||
extern const bfd_target *lynx_core_file_p (bfd *);
|
||||
|
||||
extern bfd_boolean lynx_core_file_matches_executable_p (bfd *, bfd *);
|
||||
#undef coff_core_file_matches_executable_p
|
||||
#define coff_core_file_matches_executable_p lynx_core_file_matches_executable_p
|
||||
|
||||
extern char *lynx_core_file_failing_command (bfd *);
|
||||
#undef coff_core_file_failing_command
|
||||
#define coff_core_file_failing_command lynx_core_file_failing_command
|
||||
|
||||
extern int lynx_core_file_failing_signal (bfd *);
|
||||
#undef coff_core_file_failing_signal
|
||||
#define coff_core_file_failing_signal lynx_core_file_failing_signal
|
||||
|
||||
#endif /* LYNX_CORE */
|
||||
|
||||
/* XCOFF archives do not have anything which corresponds to an
|
||||
extended name table. */
|
||||
|
||||
#define _bfd_xcoff_slurp_extended_name_table bfd_false
|
||||
#define _bfd_xcoff_construct_extended_name_table \
|
||||
((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false)
|
||||
#define _bfd_xcoff_truncate_arname bfd_dont_truncate_arname
|
||||
|
||||
/* We can use the standard get_elt_at_index routine. */
|
||||
|
||||
#define _bfd_xcoff_get_elt_at_index _bfd_generic_get_elt_at_index
|
||||
|
||||
/* XCOFF archives do not have a timestamp. */
|
||||
|
||||
#define _bfd_xcoff_update_armap_timestamp bfd_true
|
||||
|
||||
extern bfd_boolean _bfd_xcoff_mkobject (bfd *);
|
||||
extern bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *);
|
||||
extern bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *);
|
||||
extern void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *);
|
||||
extern bfd_boolean _bfd_xcoff_slurp_armap (bfd *);
|
||||
extern void * _bfd_xcoff_read_ar_hdr (bfd *);
|
||||
extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *);
|
||||
extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *);
|
||||
extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int);
|
||||
extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *);
|
||||
extern int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *);
|
||||
extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *);
|
||||
extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *);
|
||||
extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *);
|
||||
extern unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *);
|
||||
extern reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type);
|
||||
extern const bfd_target * _bfd_xcoff_archive_p (bfd *);
|
||||
|
||||
#ifndef coff_SWAP_sym_in
|
||||
#define coff_SWAP_sym_in _bfd_xcoff_swap_sym_in
|
||||
#define coff_SWAP_sym_out _bfd_xcoff_swap_sym_out
|
||||
#define coff_SWAP_aux_in _bfd_xcoff_swap_aux_in
|
||||
#define coff_SWAP_aux_out _bfd_xcoff_swap_aux_out
|
||||
#endif
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
/* The transfer vector that leads the outside world to all of the above. */
|
||||
|
||||
const bfd_target TARGET_SYM =
|
||||
{
|
||||
TARGET_NAME,
|
||||
bfd_target_xcoff_flavour,
|
||||
BFD_ENDIAN_BIG, /* Data byte order is big. */
|
||||
BFD_ENDIAN_BIG, /* Header byte order is big. */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* Object flags. */
|
||||
HAS_LINENO | HAS_DEBUG | DYNAMIC |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */
|
||||
0, /* Leading char. */
|
||||
'/', /* AR_pad_char. */
|
||||
15, /* AR_max_namelen??? FIXME. */
|
||||
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Data. */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16,/* Headers. */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format. */
|
||||
_bfd_xcoff_archive_p, CORE_FILE_P},
|
||||
{bfd_false, coff_mkobject, /* bfd_set_format. */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents. */
|
||||
_bfd_xcoff_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (coff),
|
||||
BFD_JUMP_TABLE_COPY (coff),
|
||||
BFD_JUMP_TABLE_CORE (coff),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_xcoff),
|
||||
BFD_JUMP_TABLE_SYMBOLS (coff),
|
||||
BFD_JUMP_TABLE_RELOCS (coff),
|
||||
BFD_JUMP_TABLE_WRITE (coff),
|
||||
BFD_JUMP_TABLE_LINK (_bfd_xcoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
|
||||
|
||||
NULL,
|
||||
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
9
binutils/acinclude.m4
Normal file
9
binutils/acinclude.m4
Normal file
@@ -0,0 +1,9 @@
|
||||
sinclude(../bfd/acinclude.m4)
|
||||
sinclude([../config/lib-ld.m4])
|
||||
sinclude([../config/lib-link.m4])
|
||||
sinclude([../config/lib-prefix.m4])
|
||||
sinclude([../config/iconv.m4])
|
||||
sinclude([../ltsugar.m4])
|
||||
sinclude([../ltoptions.m4])
|
||||
sinclude([../ltversion.m4])
|
||||
|
||||
229
binutils/addr2line.1
Normal file
229
binutils/addr2line.1
Normal file
@@ -0,0 +1,229 @@
|
||||
.\" Automatically generated by Pod::Man version 1.02
|
||||
.\" Wed May 30 12:24:26 2001
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ======================================================================
|
||||
.de Sh \" Subsection heading
|
||||
.br
|
||||
.if t .Sp
|
||||
.ne 5
|
||||
.PP
|
||||
\fB\\$1\fR
|
||||
.PP
|
||||
..
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Ip \" List item
|
||||
.br
|
||||
.ie \\n(.$>=3 .ne \\$3
|
||||
.el .ne 3
|
||||
.IP "\\$1" \\$2
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
|
||||
.\" to do unbreakable dashes and therefore won't be available. \*(C` and
|
||||
.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
|
||||
.tr \(*W-|\(bv\*(Tr
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` `
|
||||
. ds C' '
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
'br\}
|
||||
.\"
|
||||
.\" If the F register is turned on, we'll generate index entries on stderr
|
||||
.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
|
||||
.\" index entries marked with X<> in POD. Of course, you'll have to process
|
||||
.\" the output yourself in some meaningful fashion.
|
||||
.if \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
. .
|
||||
. nr % 0
|
||||
. rr F
|
||||
.\}
|
||||
.\"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it
|
||||
.\" makes way too many mistakes in technical documents.
|
||||
.hy 0
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
.bd B 3
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ======================================================================
|
||||
.\"
|
||||
.IX Title "ADDR2LINE.1 1"
|
||||
.TH ADDR2LINE.1 1 "binutils-2.11.90" "2001-05-30" "GNU"
|
||||
.UC
|
||||
.SH "NAME"
|
||||
addr2line \- convert addresses into file names and line numbers.
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
addr2line [ \-b \fIbfdname\fR | \-\-target=\fIbfdname\fR ]
|
||||
[ \-C | \-\-demangle[=\fIstyle\fR ]
|
||||
[ \-e \fIfilename\fR | \-\-exe=\fIfilename\fR ]
|
||||
[ \-f | \-\-functions ] [ \-s | \-\-basename ]
|
||||
[ \-H | \-\-help ] [ \-V | \-\-version ]
|
||||
[ addr addr ... ]
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
\&\f(CW\*(C`addr2line\*(C'\fR translates program addresses into file names and line
|
||||
numbers. Given an address and an executable, it uses the debugging
|
||||
information in the executable to figure out which file name and line
|
||||
number are associated with a given address.
|
||||
.PP
|
||||
The executable to use is specified with the \f(CW\*(C`\-e\*(C'\fR option. The
|
||||
default is the file \fIa.out\fR.
|
||||
.PP
|
||||
\&\f(CW\*(C`addr2line\*(C'\fR has two modes of operation.
|
||||
.PP
|
||||
In the first, hexadecimal addresses are specified on the command line,
|
||||
and \f(CW\*(C`addr2line\*(C'\fR displays the file name and line number for each
|
||||
address.
|
||||
.PP
|
||||
In the second, \f(CW\*(C`addr2line\*(C'\fR reads hexadecimal addresses from
|
||||
standard input, and prints the file name and line number for each
|
||||
address on standard output. In this mode, \f(CW\*(C`addr2line\*(C'\fR may be used
|
||||
in a pipe to convert dynamically chosen addresses.
|
||||
.PP
|
||||
The format of the output is \fB\s-1FILENAME:LINENO\s0\fR. The file name and
|
||||
line number for each address is printed on a separate line. If the
|
||||
\&\f(CW\*(C`\-f\*(C'\fR option is used, then each \fB\s-1FILENAME:LINENO\s0\fR line is
|
||||
preceded by a \fB\s-1FUNCTIONNAME\s0\fR line which is the name of the function
|
||||
containing the address.
|
||||
.PP
|
||||
If the file name or function name can not be determined,
|
||||
\&\f(CW\*(C`addr2line\*(C'\fR will print two question marks in their place. If the
|
||||
line number can not be determined, \f(CW\*(C`addr2line\*(C'\fR will print 0.
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
The long and short forms of options, shown here as alternatives, are
|
||||
equivalent.
|
||||
.Ip "\f(CW\*(C`\-b \f(CIbfdname\f(CW\*(C'\fR" 4
|
||||
.IX Item "-b bfdname"
|
||||
.Ip "\f(CW\*(C`\-\-target=\f(CIbfdname\f(CW\*(C'\fR" 4
|
||||
.IX Item "--target=bfdname"
|
||||
Specify that the object-code format for the object files is
|
||||
\&\fIbfdname\fR.
|
||||
.Ip "\f(CW\*(C`\-C\*(C'\fR" 4
|
||||
.IX Item "-C"
|
||||
.Ip "\f(CW\*(C`\-\-demangle[=\f(CIstyle\f(CW]\*(C'\fR" 4
|
||||
.IX Item "--demangle[=style]"
|
||||
Decode (\fIdemangle\fR) low-level symbol names into user-level names.
|
||||
Besides removing any initial underscore prepended by the system, this
|
||||
makes \*(C+ function names readable. Different compilers have different
|
||||
mangling styles. The optional demangling style argument can be used to
|
||||
choose an appropriate demangling style for your compiler.
|
||||
.Ip "\f(CW\*(C`\-e \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "-e filename"
|
||||
.Ip "\f(CW\*(C`\-\-exe=\f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "--exe=filename"
|
||||
Specify the name of the executable for which addresses should be
|
||||
translated. The default file is \fIa.out\fR.
|
||||
.Ip "\f(CW\*(C`\-f\*(C'\fR" 4
|
||||
.IX Item "-f"
|
||||
.Ip "\f(CW\*(C`\-\-functions\*(C'\fR" 4
|
||||
.IX Item "--functions"
|
||||
Display function names as well as file and line number information.
|
||||
.Ip "\f(CW\*(C`\-s\*(C'\fR" 4
|
||||
.IX Item "-s"
|
||||
.Ip "\f(CW\*(C`\-\-basenames\*(C'\fR" 4
|
||||
.IX Item "--basenames"
|
||||
Display only the base of each file name.
|
||||
.SH "SEE ALSO"
|
||||
.IX Header "SEE ALSO"
|
||||
Info entries for \fIbinutils\fR.
|
||||
.SH "COPYRIGHT"
|
||||
.IX Header "COPYRIGHT"
|
||||
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
|
||||
386
binutils/ar.1
Normal file
386
binutils/ar.1
Normal file
@@ -0,0 +1,386 @@
|
||||
.\" Automatically generated by Pod::Man version 1.02
|
||||
.\" Wed May 30 12:24:26 2001
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ======================================================================
|
||||
.de Sh \" Subsection heading
|
||||
.br
|
||||
.if t .Sp
|
||||
.ne 5
|
||||
.PP
|
||||
\fB\\$1\fR
|
||||
.PP
|
||||
..
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Ip \" List item
|
||||
.br
|
||||
.ie \\n(.$>=3 .ne \\$3
|
||||
.el .ne 3
|
||||
.IP "\\$1" \\$2
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
|
||||
.\" to do unbreakable dashes and therefore won't be available. \*(C` and
|
||||
.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
|
||||
.tr \(*W-|\(bv\*(Tr
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` `
|
||||
. ds C' '
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
'br\}
|
||||
.\"
|
||||
.\" If the F register is turned on, we'll generate index entries on stderr
|
||||
.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
|
||||
.\" index entries marked with X<> in POD. Of course, you'll have to process
|
||||
.\" the output yourself in some meaningful fashion.
|
||||
.if \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
. .
|
||||
. nr % 0
|
||||
. rr F
|
||||
.\}
|
||||
.\"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it
|
||||
.\" makes way too many mistakes in technical documents.
|
||||
.hy 0
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
.bd B 3
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ======================================================================
|
||||
.\"
|
||||
.IX Title "AR.1 1"
|
||||
.TH AR.1 1 "binutils-2.11.90" "2001-05-30" "GNU"
|
||||
.UC
|
||||
.SH "NAME"
|
||||
ar \- create, modify, and extract from archives
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
ar [\-X32_64] [\-]\fIp\fR[\fImod\fR [\fIrelpos\fR] [\fIcount\fR]] \fIarchive\fR [\fImember\fR...]
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
The \s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR program creates, modifies, and extracts from
|
||||
archives. An \fIarchive\fR is a single file holding a collection of
|
||||
other files in a structure that makes it possible to retrieve
|
||||
the original individual files (called \fImembers\fR of the archive).
|
||||
.PP
|
||||
The original files' contents, mode (permissions), timestamp, owner, and
|
||||
group are preserved in the archive, and can be restored on
|
||||
extraction.
|
||||
.PP
|
||||
\&\s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR can maintain archives whose members have names of any
|
||||
length; however, depending on how \f(CW\*(C`ar\*(C'\fR is configured on your
|
||||
system, a limit on member-name length may be imposed for compatibility
|
||||
with archive formats maintained with other tools. If it exists, the
|
||||
limit is often 15 characters (typical of formats related to a.out) or 16
|
||||
characters (typical of formats related to coff).
|
||||
.PP
|
||||
\&\f(CW\*(C`ar\*(C'\fR is considered a binary utility because archives of this sort
|
||||
are most often used as \fIlibraries\fR holding commonly needed
|
||||
subroutines.
|
||||
.PP
|
||||
\&\f(CW\*(C`ar\*(C'\fR creates an index to the symbols defined in relocatable
|
||||
object modules in the archive when you specify the modifier \fBs\fR.
|
||||
Once created, this index is updated in the archive whenever \f(CW\*(C`ar\*(C'\fR
|
||||
makes a change to its contents (save for the \fBq\fR update operation).
|
||||
An archive with such an index speeds up linking to the library, and
|
||||
allows routines in the library to call each other without regard to
|
||||
their placement in the archive.
|
||||
.PP
|
||||
You may use \fBnm \-s\fR or \fBnm \-\-print-armap\fR to list this index
|
||||
table. If an archive lacks the table, another form of \f(CW\*(C`ar\*(C'\fR called
|
||||
\&\f(CW\*(C`ranlib\*(C'\fR can be used to add just the table.
|
||||
.PP
|
||||
\&\s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR is designed to be compatible with two different
|
||||
facilities. You can control its activity using command-line options,
|
||||
like the different varieties of \f(CW\*(C`ar\*(C'\fR on Unix systems; or, if you
|
||||
specify the single command-line option \fB\-M\fR, you can control it
|
||||
with a script supplied via standard input, like the \s-1MRI\s0 ``librarian''
|
||||
program.
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
\&\s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR allows you to mix the operation code \fIp\fR and modifier
|
||||
flags \fImod\fR in any order, within the first command-line argument.
|
||||
.PP
|
||||
If you wish, you may begin the first command-line argument with a
|
||||
dash.
|
||||
.PP
|
||||
The \fIp\fR keyletter specifies what operation to execute; it may be
|
||||
any of the following, but you must specify only one of them:
|
||||
.Ip "\f(CW\*(C`d\*(C'\fR" 4
|
||||
.IX Item "d"
|
||||
\&\fIDelete\fR modules from the archive. Specify the names of modules to
|
||||
be deleted as \fImember\fR...; the archive is untouched if you
|
||||
specify no files to delete.
|
||||
.Sp
|
||||
If you specify the \fBv\fR modifier, \f(CW\*(C`ar\*(C'\fR lists each module
|
||||
as it is deleted.
|
||||
.Ip "\f(CW\*(C`m\*(C'\fR" 4
|
||||
.IX Item "m"
|
||||
Use this operation to \fImove\fR members in an archive.
|
||||
.Sp
|
||||
The ordering of members in an archive can make a difference in how
|
||||
programs are linked using the library, if a symbol is defined in more
|
||||
than one member.
|
||||
.Sp
|
||||
If no modifiers are used with \f(CW\*(C`m\*(C'\fR, any members you name in the
|
||||
\&\fImember\fR arguments are moved to the \fIend\fR of the archive;
|
||||
you can use the \fBa\fR, \fBb\fR, or \fBi\fR modifiers to move them to a
|
||||
specified place instead.
|
||||
.Ip "\f(CW\*(C`p\*(C'\fR" 4
|
||||
.IX Item "p"
|
||||
\&\fIPrint\fR the specified members of the archive, to the standard
|
||||
output file. If the \fBv\fR modifier is specified, show the member
|
||||
name before copying its contents to standard output.
|
||||
.Sp
|
||||
If you specify no \fImember\fR arguments, all the files in the archive are
|
||||
printed.
|
||||
.Ip "\f(CW\*(C`q\*(C'\fR" 4
|
||||
.IX Item "q"
|
||||
\&\fIQuick append\fR; Historically, add the files \fImember\fR... to the end of
|
||||
\&\fIarchive\fR, without checking for replacement.
|
||||
.Sp
|
||||
The modifiers \fBa\fR, \fBb\fR, and \fBi\fR do \fInot\fR affect this
|
||||
operation; new members are always placed at the end of the archive.
|
||||
.Sp
|
||||
The modifier \fBv\fR makes \f(CW\*(C`ar\*(C'\fR list each file as it is appended.
|
||||
.Sp
|
||||
Since the point of this operation is speed, the archive's symbol table
|
||||
index is not updated, even if it already existed; you can use \fBar s\fR or
|
||||
\&\f(CW\*(C`ranlib\*(C'\fR explicitly to update the symbol table index.
|
||||
.Sp
|
||||
However, too many different systems assume quick append rebuilds the
|
||||
index, so \s-1GNU\s0 ar implements \f(CW\*(C`q\*(C'\fR as a synonym for \f(CW\*(C`r\*(C'\fR.
|
||||
.Ip "\f(CW\*(C`r\*(C'\fR" 4
|
||||
.IX Item "r"
|
||||
Insert the files \fImember\fR... into \fIarchive\fR (with
|
||||
\&\fIreplacement\fR). This operation differs from \fBq\fR in that any
|
||||
previously existing members are deleted if their names match those being
|
||||
added.
|
||||
.Sp
|
||||
If one of the files named in \fImember\fR... does not exist, \f(CW\*(C`ar\*(C'\fR
|
||||
displays an error message, and leaves undisturbed any existing members
|
||||
of the archive matching that name.
|
||||
.Sp
|
||||
By default, new members are added at the end of the file; but you may
|
||||
use one of the modifiers \fBa\fR, \fBb\fR, or \fBi\fR to request
|
||||
placement relative to some existing member.
|
||||
.Sp
|
||||
The modifier \fBv\fR used with this operation elicits a line of
|
||||
output for each file inserted, along with one of the letters \fBa\fR or
|
||||
\&\fBr\fR to indicate whether the file was appended (no old member
|
||||
deleted) or replaced.
|
||||
.Ip "\f(CW\*(C`t\*(C'\fR" 4
|
||||
.IX Item "t"
|
||||
Display a \fItable\fR listing the contents of \fIarchive\fR, or those
|
||||
of the files listed in \fImember\fR... that are present in the
|
||||
archive. Normally only the member name is shown; if you also want to
|
||||
see the modes (permissions), timestamp, owner, group, and size, you can
|
||||
request that by also specifying the \fBv\fR modifier.
|
||||
.Sp
|
||||
If you do not specify a \fImember\fR, all files in the archive
|
||||
are listed.
|
||||
.Sp
|
||||
If there is more than one file with the same name (say, \fBfie\fR) in
|
||||
an archive (say \fBb.a\fR), \fBar t b.a fie\fR lists only the
|
||||
first instance; to see them all, you must ask for a complete
|
||||
listing\-\-\-in our example, \fBar t b.a\fR.
|
||||
.Ip "\f(CW\*(C`x\*(C'\fR" 4
|
||||
.IX Item "x"
|
||||
\&\fIExtract\fR members (named \fImember\fR) from the archive. You can
|
||||
use the \fBv\fR modifier with this operation, to request that
|
||||
\&\f(CW\*(C`ar\*(C'\fR list each name as it extracts it.
|
||||
.Sp
|
||||
If you do not specify a \fImember\fR, all files in the archive
|
||||
are extracted.
|
||||
.PP
|
||||
A number of modifiers (\fImod\fR) may immediately follow the \fIp\fR
|
||||
keyletter, to specify variations on an operation's behavior:
|
||||
.Ip "\f(CW\*(C`a\*(C'\fR" 4
|
||||
.IX Item "a"
|
||||
Add new files \fIafter\fR an existing member of the
|
||||
archive. If you use the modifier \fBa\fR, the name of an existing archive
|
||||
member must be present as the \fIrelpos\fR argument, before the
|
||||
\&\fIarchive\fR specification.
|
||||
.Ip "\f(CW\*(C`b\*(C'\fR" 4
|
||||
.IX Item "b"
|
||||
Add new files \fIbefore\fR an existing member of the
|
||||
archive. If you use the modifier \fBb\fR, the name of an existing archive
|
||||
member must be present as the \fIrelpos\fR argument, before the
|
||||
\&\fIarchive\fR specification. (same as \fBi\fR).
|
||||
.Ip "\f(CW\*(C`c\*(C'\fR" 4
|
||||
.IX Item "c"
|
||||
\&\fICreate\fR the archive. The specified \fIarchive\fR is always
|
||||
created if it did not exist, when you request an update. But a warning is
|
||||
issued unless you specify in advance that you expect to create it, by
|
||||
using this modifier.
|
||||
.Ip "\f(CW\*(C`f\*(C'\fR" 4
|
||||
.IX Item "f"
|
||||
Truncate names in the archive. \s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR will normally permit file
|
||||
names of any length. This will cause it to create archives which are
|
||||
not compatible with the native \f(CW\*(C`ar\*(C'\fR program on some systems. If
|
||||
this is a concern, the \fBf\fR modifier may be used to truncate file
|
||||
names when putting them in the archive.
|
||||
.Ip "\f(CW\*(C`i\*(C'\fR" 4
|
||||
.IX Item "i"
|
||||
Insert new files \fIbefore\fR an existing member of the
|
||||
archive. If you use the modifier \fBi\fR, the name of an existing archive
|
||||
member must be present as the \fIrelpos\fR argument, before the
|
||||
\&\fIarchive\fR specification. (same as \fBb\fR).
|
||||
.Ip "\f(CW\*(C`l\*(C'\fR" 4
|
||||
.IX Item "l"
|
||||
This modifier is accepted but not used.
|
||||
.Ip "\f(CW\*(C`N\*(C'\fR" 4
|
||||
.IX Item "N"
|
||||
Uses the \fIcount\fR parameter. This is used if there are multiple
|
||||
entries in the archive with the same name. Extract or delete instance
|
||||
\&\fIcount\fR of the given name from the archive.
|
||||
.Ip "\f(CW\*(C`o\*(C'\fR" 4
|
||||
.IX Item "o"
|
||||
Preserve the \fIoriginal\fR dates of members when extracting them. If
|
||||
you do not specify this modifier, files extracted from the archive
|
||||
are stamped with the time of extraction.
|
||||
.Ip "\f(CW\*(C`P\*(C'\fR" 4
|
||||
.IX Item "P"
|
||||
Use the full path name when matching names in the archive. \s-1GNU\s0
|
||||
\&\f(CW\*(C`ar\*(C'\fR can not create an archive with a full path name (such archives
|
||||
are not \s-1POSIX\s0 complaint), but other archive creators can. This option
|
||||
will cause \s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR to match file names using a complete path
|
||||
name, which can be convenient when extracting a single file from an
|
||||
archive created by another tool.
|
||||
.Ip "\f(CW\*(C`s\*(C'\fR" 4
|
||||
.IX Item "s"
|
||||
Write an object-file index into the archive, or update an existing one,
|
||||
even if no other change is made to the archive. You may use this modifier
|
||||
flag either with any operation, or alone. Running \fBar s\fR on an
|
||||
archive is equivalent to running \fBranlib\fR on it.
|
||||
.Ip "\f(CW\*(C`S\*(C'\fR" 4
|
||||
.IX Item "S"
|
||||
Do not generate an archive symbol table. This can speed up building a
|
||||
large library in several steps. The resulting archive can not be used
|
||||
with the linker. In order to build a symbol table, you must omit the
|
||||
\&\fBS\fR modifier on the last execution of \fBar\fR, or you must run
|
||||
\&\fBranlib\fR on the archive.
|
||||
.Ip "\f(CW\*(C`u\*(C'\fR" 4
|
||||
.IX Item "u"
|
||||
Normally, \fBar r\fR... inserts all files
|
||||
listed into the archive. If you would like to insert \fIonly\fR those
|
||||
of the files you list that are newer than existing members of the same
|
||||
names, use this modifier. The \fBu\fR modifier is allowed only for the
|
||||
operation \fBr\fR (replace). In particular, the combination \fBqu\fR is
|
||||
not allowed, since checking the timestamps would lose any speed
|
||||
advantage from the operation \fBq\fR.
|
||||
.Ip "\f(CW\*(C`v\*(C'\fR" 4
|
||||
.IX Item "v"
|
||||
This modifier requests the \fIverbose\fR version of an operation. Many
|
||||
operations display additional information, such as filenames processed,
|
||||
when the modifier \fBv\fR is appended.
|
||||
.Ip "\f(CW\*(C`V\*(C'\fR" 4
|
||||
.IX Item "V"
|
||||
This modifier shows the version number of \f(CW\*(C`ar\*(C'\fR.
|
||||
.PP
|
||||
\&\f(CW\*(C`ar\*(C'\fR ignores an initial option spelt \f(CW\*(C`\-X32_64\*(C'\fR, for
|
||||
compatibility with \s-1AIX\s0. The behaviour produced by this option is the
|
||||
default for \s-1GNU\s0 \f(CW\*(C`ar\*(C'\fR. \f(CW\*(C`ar\*(C'\fR does not support any of the other
|
||||
\&\f(CW\*(C`\-X\*(C'\fR options; in particular, it does not support \f(CW\*(C`\-X32\*(C'\fR
|
||||
which is the default for \s-1AIX\s0 \f(CW\*(C`ar\*(C'\fR.
|
||||
.SH "SEE ALSO"
|
||||
.IX Header "SEE ALSO"
|
||||
\&\fInm\fR\|(1), \fIranlib\fR\|(1), and the Info entries for \fIbinutils\fR.
|
||||
.SH "COPYRIGHT"
|
||||
.IX Header "COPYRIGHT"
|
||||
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
|
||||
1835
binutils/arlex.c
Normal file
1835
binutils/arlex.c
Normal file
File diff suppressed because it is too large
Load Diff
1090
binutils/arparse.c
Normal file
1090
binutils/arparse.c
Normal file
File diff suppressed because it is too large
Load Diff
26
binutils/arparse.h
Normal file
26
binutils/arparse.h
Normal file
@@ -0,0 +1,26 @@
|
||||
typedef union {
|
||||
char *name;
|
||||
struct list *list ;
|
||||
|
||||
} YYSTYPE;
|
||||
#define NEWLINE 257
|
||||
#define VERBOSE 258
|
||||
#define FILENAME 259
|
||||
#define ADDLIB 260
|
||||
#define LIST 261
|
||||
#define ADDMOD 262
|
||||
#define CLEAR 263
|
||||
#define CREATE 264
|
||||
#define DELETE 265
|
||||
#define DIRECTORY 266
|
||||
#define END 267
|
||||
#define EXTRACT 268
|
||||
#define FULLDIR 269
|
||||
#define HELP 270
|
||||
#define QUIT 271
|
||||
#define REPLACE 272
|
||||
#define SAVE 273
|
||||
#define OPEN 274
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
74
binutils/binutils.info
Normal file
74
binutils/binutils.info
Normal file
@@ -0,0 +1,74 @@
|
||||
This is binutils.info, produced by makeinfo version 4.0 from
|
||||
binutils.texi.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* Binutils: (binutils). The GNU binary utilities.
|
||||
* ar: (binutils)ar. Create, modify, and extract from archives
|
||||
* nm: (binutils)nm. List symbols from object files
|
||||
* objcopy: (binutils)objcopy. Copy and translate object files
|
||||
* objdump: (binutils)objdump. Display information from object files
|
||||
* ranlib: (binutils)ranlib. Generate index to archive contents
|
||||
* readelf: (binutils)readelf. Display the contents of ELF format files.
|
||||
* size: (binutils)size. List section sizes and total size
|
||||
* strings: (binutils)strings. List printable strings from files
|
||||
* strip: (binutils)strip. Discard symbols
|
||||
* c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols
|
||||
* cxxfilt: (binutils)c++filt. MS-DOS name for c++filt
|
||||
* addr2line: (binutils)addr2line. Convert addresses to file and line
|
||||
* nlmconv: (binutils)nlmconv. Converts object code into an NLM
|
||||
* windres: (binutils)windres. Manipulate Windows resources
|
||||
* dlltool: (binutils)dlltool. Create files needed to build and use DLLs
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, provided also
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions.
|
||||
|
||||
|
||||
Indirect:
|
||||
binutils.info-1: 1845
|
||||
binutils.info-2: 49760
|
||||
binutils.info-3: 96951
|
||||
|
||||
Tag Table:
|
||||
(Indirect)
|
||||
Node: Top1845
|
||||
Node: ar3094
|
||||
Node: ar cmdline5268
|
||||
Node: ar scripts13107
|
||||
Node: nm18786
|
||||
Node: objcopy25756
|
||||
Node: objdump38583
|
||||
Node: ranlib49011
|
||||
Node: size49760
|
||||
Node: strings52491
|
||||
Node: strip54316
|
||||
Node: c++filt57281
|
||||
Ref: c++filt-Footnote-160138
|
||||
Node: addr2line60244
|
||||
Node: nlmconv62650
|
||||
Node: windres65254
|
||||
Node: dlltool70306
|
||||
Node: readelf79647
|
||||
Node: Selecting The Target System82798
|
||||
Node: Target Selection83815
|
||||
Node: Architecture Selection86516
|
||||
Node: Linker Emulation Selection87747
|
||||
Node: Reporting Bugs88625
|
||||
Node: Bug Criteria89376
|
||||
Node: Bug Reporting89922
|
||||
Node: Index96951
|
||||
|
||||
End Tag Table
|
||||
1277
binutils/binutils.info-1
Normal file
1277
binutils/binutils.info-1
Normal file
File diff suppressed because it is too large
Load Diff
1404
binutils/binutils.info-2
Normal file
1404
binutils/binutils.info-2
Normal file
File diff suppressed because it is too large
Load Diff
182
binutils/binutils.info-3
Normal file
182
binutils/binutils.info-3
Normal file
@@ -0,0 +1,182 @@
|
||||
This is binutils.info, produced by makeinfo version 4.0 from
|
||||
binutils.texi.
|
||||
|
||||
START-INFO-DIR-ENTRY
|
||||
* Binutils: (binutils). The GNU binary utilities.
|
||||
* ar: (binutils)ar. Create, modify, and extract from archives
|
||||
* nm: (binutils)nm. List symbols from object files
|
||||
* objcopy: (binutils)objcopy. Copy and translate object files
|
||||
* objdump: (binutils)objdump. Display information from object files
|
||||
* ranlib: (binutils)ranlib. Generate index to archive contents
|
||||
* readelf: (binutils)readelf. Display the contents of ELF format files.
|
||||
* size: (binutils)size. List section sizes and total size
|
||||
* strings: (binutils)strings. List printable strings from files
|
||||
* strip: (binutils)strip. Discard symbols
|
||||
* c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols
|
||||
* cxxfilt: (binutils)c++filt. MS-DOS name for c++filt
|
||||
* addr2line: (binutils)addr2line. Convert addresses to file and line
|
||||
* nlmconv: (binutils)nlmconv. Converts object code into an NLM
|
||||
* windres: (binutils)windres. Manipulate Windows resources
|
||||
* dlltool: (binutils)dlltool. Create files needed to build and use DLLs
|
||||
END-INFO-DIR-ENTRY
|
||||
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
Permission is granted to make and distribute verbatim copies of this
|
||||
manual provided the copyright notice and this permission notice are
|
||||
preserved on all copies.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of
|
||||
this manual under the conditions for verbatim copying, provided also
|
||||
that the entire resulting derived work is distributed under the terms
|
||||
of a permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this
|
||||
manual into another language, under the above conditions for modified
|
||||
versions.
|
||||
|
||||
|
||||
File: binutils.info, Node: Index, Prev: Reporting Bugs, Up: Top
|
||||
|
||||
Index
|
||||
*****
|
||||
|
||||
* Menu:
|
||||
|
||||
* .stab: objdump.
|
||||
* addr2line: addr2line.
|
||||
* address to file name and line number: addr2line.
|
||||
* all header information, object file: objdump.
|
||||
* ar: ar.
|
||||
* ar compatibility: ar.
|
||||
* architecture: objdump.
|
||||
* architectures available: objdump.
|
||||
* archive contents: ranlib.
|
||||
* archive headers: objdump.
|
||||
* archives: ar.
|
||||
* base files: dlltool.
|
||||
* bug criteria: Bug Criteria.
|
||||
* bug reports: Bug Reporting.
|
||||
* bugs: Reporting Bugs.
|
||||
* bugs, reporting: Bug Reporting.
|
||||
* c++filt: c++filt.
|
||||
* changing object addresses: objcopy.
|
||||
* changing section address: objcopy.
|
||||
* changing section LMA: objcopy.
|
||||
* changing section VMA: objcopy.
|
||||
* changing start address: objcopy.
|
||||
* collections of files: ar.
|
||||
* compatibility, ar: ar.
|
||||
* contents of archive: ar cmdline.
|
||||
* crash: Bug Criteria.
|
||||
* creating archives: ar cmdline.
|
||||
* cxxfilt: c++filt.
|
||||
* dates in archive: ar cmdline.
|
||||
* debug symbols: objdump.
|
||||
* debugging symbols: nm.
|
||||
* deleting from archive: ar cmdline.
|
||||
* demangling C++ symbols: c++filt.
|
||||
* demangling in nm: nm.
|
||||
* demangling in objdump <1>: addr2line.
|
||||
* demangling in objdump: objdump.
|
||||
* disassembling object code: objdump.
|
||||
* disassembly architecture: objdump.
|
||||
* disassembly endianness: objdump.
|
||||
* disassembly, with source: objdump.
|
||||
* discarding symbols: strip.
|
||||
* DLL: dlltool.
|
||||
* dlltool: dlltool.
|
||||
* dynamic relocation entries, in object file: objdump.
|
||||
* dynamic symbol table entries, printing: objdump.
|
||||
* dynamic symbols: nm.
|
||||
* ELF core notes: readelf.
|
||||
* ELF dynamic section information: readelf.
|
||||
* ELF file header information: readelf.
|
||||
* ELF file information: readelf.
|
||||
* ELF object file format: objdump.
|
||||
* ELF program header information: readelf.
|
||||
* ELF reloc information: readelf.
|
||||
* ELF section information: readelf.
|
||||
* ELF segment information: readelf.
|
||||
* ELF symbol table information: readelf.
|
||||
* ELF version sections informations: readelf.
|
||||
* endianness: objdump.
|
||||
* error on valid input: Bug Criteria.
|
||||
* external symbols: nm.
|
||||
* extract from archive: ar cmdline.
|
||||
* fatal signal: Bug Criteria.
|
||||
* file name: nm.
|
||||
* header information, all: objdump.
|
||||
* input .def file: dlltool.
|
||||
* input file name: nm.
|
||||
* libraries: ar.
|
||||
* listings strings: strings.
|
||||
* machine instructions: objdump.
|
||||
* moving in archive: ar cmdline.
|
||||
* MRI compatibility, ar: ar scripts.
|
||||
* name duplication in archive: ar cmdline.
|
||||
* name length: ar.
|
||||
* nm: nm.
|
||||
* nm compatibility: nm.
|
||||
* nm format: nm.
|
||||
* not writing archive index: ar cmdline.
|
||||
* objdump: objdump.
|
||||
* object code format <1>: addr2line.
|
||||
* object code format <2>: strings.
|
||||
* object code format <3>: size.
|
||||
* object code format <4>: objdump.
|
||||
* object code format: nm.
|
||||
* object file header: objdump.
|
||||
* object file information: objdump.
|
||||
* object file sections: objdump.
|
||||
* object formats available: objdump.
|
||||
* operations on archive: ar cmdline.
|
||||
* printing from archive: ar cmdline.
|
||||
* printing strings: strings.
|
||||
* quick append to archive: ar cmdline.
|
||||
* radix for section sizes: size.
|
||||
* ranlib: ranlib.
|
||||
* readelf: readelf.
|
||||
* relative placement in archive: ar cmdline.
|
||||
* relocation entries, in object file: objdump.
|
||||
* removing symbols: strip.
|
||||
* repeated names in archive: ar cmdline.
|
||||
* replacement in archive: ar cmdline.
|
||||
* reporting bugs: Reporting Bugs.
|
||||
* scripts, ar: ar scripts.
|
||||
* section addresses in objdump: objdump.
|
||||
* section headers: objdump.
|
||||
* section information: objdump.
|
||||
* section sizes: size.
|
||||
* sections, full contents: objdump.
|
||||
* size: size.
|
||||
* size display format: size.
|
||||
* size number format: size.
|
||||
* sorting symbols: nm.
|
||||
* source code context: objdump.
|
||||
* source disassembly: objdump.
|
||||
* source file name: nm.
|
||||
* source filenames for object files: objdump.
|
||||
* stab: objdump.
|
||||
* start-address: objdump.
|
||||
* stop-address: objdump.
|
||||
* strings: strings.
|
||||
* strings, printing: strings.
|
||||
* strip: strip.
|
||||
* symbol index <1>: ranlib.
|
||||
* symbol index: ar.
|
||||
* symbol index, listing: nm.
|
||||
* symbol line numbers: nm.
|
||||
* symbol table entries, printing: objdump.
|
||||
* symbols: nm.
|
||||
* symbols, discarding: strip.
|
||||
* undefined symbols: nm.
|
||||
* Unix compatibility, ar: ar cmdline.
|
||||
* updating an archive: ar cmdline.
|
||||
* version: Top.
|
||||
* VMA in objdump: objdump.
|
||||
* wide output, printing: objdump.
|
||||
* writing archive index: ar cmdline.
|
||||
|
||||
|
||||
3749
binutils/binutils.texi
Normal file
3749
binutils/binutils.texi
Normal file
File diff suppressed because it is too large
Load Diff
100
binutils/budemang.c
Normal file
100
binutils/budemang.c
Normal file
@@ -0,0 +1,100 @@
|
||||
/* demangle.c -- A wrapper calling libiberty cplus_demangle
|
||||
Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Binutils.
|
||||
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#endif
|
||||
#include "bfd.h"
|
||||
#include "libiberty.h"
|
||||
#include "demangle.h"
|
||||
#include "budemang.h"
|
||||
|
||||
/* Wrapper around cplus_demangle. Strips leading underscores and
|
||||
other such chars that would otherwise confuse the demangler. */
|
||||
|
||||
char *
|
||||
demangle (bfd *abfd, const char *name)
|
||||
{
|
||||
char *res, *alloc;
|
||||
const char *pre, *suf;
|
||||
size_t pre_len;
|
||||
|
||||
if (abfd != NULL && bfd_get_symbol_leading_char (abfd) == name[0])
|
||||
++name;
|
||||
|
||||
/* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
|
||||
or the MS PE format. These formats have a number of leading '.'s
|
||||
on at least some symbols, so we remove all dots to avoid
|
||||
confusing the demangler. */
|
||||
pre = name;
|
||||
while (*name == '.')
|
||||
++name;
|
||||
pre_len = name - pre;
|
||||
|
||||
alloc = NULL;
|
||||
suf = strchr (name, '@');
|
||||
if (suf != NULL)
|
||||
{
|
||||
alloc = xmalloc (suf - name + 1);
|
||||
memcpy (alloc, name, suf - name);
|
||||
alloc[suf - name] = '\0';
|
||||
name = alloc;
|
||||
}
|
||||
|
||||
res = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS);
|
||||
if (res != NULL)
|
||||
{
|
||||
/* Now put back any suffix, or stripped dots. */
|
||||
if (pre_len != 0 || suf != NULL)
|
||||
{
|
||||
size_t len;
|
||||
size_t suf_len;
|
||||
char *final;
|
||||
|
||||
if (alloc != NULL)
|
||||
free (alloc);
|
||||
|
||||
len = strlen (res);
|
||||
if (suf == NULL)
|
||||
suf = res + len;
|
||||
suf_len = strlen (suf) + 1;
|
||||
final = xmalloc (pre_len + len + suf_len);
|
||||
|
||||
memcpy (final, pre, pre_len);
|
||||
memcpy (final + pre_len, res, len);
|
||||
memcpy (final + pre_len + len, suf, suf_len);
|
||||
free (res);
|
||||
res = final;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
if (alloc != NULL)
|
||||
free (alloc);
|
||||
|
||||
return xstrdup (pre);
|
||||
}
|
||||
25
binutils/budemang.h
Normal file
25
binutils/budemang.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* demangle.h -- A wrapper calling libiberty cplus_demangle
|
||||
Copyright 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Binutils.
|
||||
|
||||
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., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
02110-1301, USA. */
|
||||
#ifndef BUDEMANG_H
|
||||
#define BUDEMANG_H
|
||||
|
||||
char *demangle (bfd *, const char *);
|
||||
|
||||
#endif
|
||||
1
binutils/config.texi
Normal file
1
binutils/config.texi
Normal file
@@ -0,0 +1 @@
|
||||
@set VERSION 2.10
|
||||
249
binutils/cxxfilt.man
Normal file
249
binutils/cxxfilt.man
Normal file
@@ -0,0 +1,249 @@
|
||||
.\" Automatically generated by Pod::Man version 1.02
|
||||
.\" Wed May 30 12:24:30 2001
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ======================================================================
|
||||
.de Sh \" Subsection heading
|
||||
.br
|
||||
.if t .Sp
|
||||
.ne 5
|
||||
.PP
|
||||
\fB\\$1\fR
|
||||
.PP
|
||||
..
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Ip \" List item
|
||||
.br
|
||||
.ie \\n(.$>=3 .ne \\$3
|
||||
.el .ne 3
|
||||
.IP "\\$1" \\$2
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
|
||||
.\" to do unbreakable dashes and therefore won't be available. \*(C` and
|
||||
.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
|
||||
.tr \(*W-|\(bv\*(Tr
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` `
|
||||
. ds C' '
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
'br\}
|
||||
.\"
|
||||
.\" If the F register is turned on, we'll generate index entries on stderr
|
||||
.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
|
||||
.\" index entries marked with X<> in POD. Of course, you'll have to process
|
||||
.\" the output yourself in some meaningful fashion.
|
||||
.if \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
. .
|
||||
. nr % 0
|
||||
. rr F
|
||||
.\}
|
||||
.\"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it
|
||||
.\" makes way too many mistakes in technical documents.
|
||||
.hy 0
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
.bd B 3
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ======================================================================
|
||||
.\"
|
||||
.IX Title "CXXFILT.MAN 1"
|
||||
.TH CXXFILT.MAN 1 "binutils-2.11.90" "2001-05-30" "GNU"
|
||||
.UC
|
||||
.SH "NAME"
|
||||
cxxfilt \- Demangle \*(C+ and Java symbols.
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
c++filt [ \-_ | \-\-strip-underscores ]
|
||||
[ \-j | \-\-java ]
|
||||
[ \-n | \-\-no-strip-underscores ]
|
||||
[ \-s \fIformat\fR | \-\-format=\fIformat\fR ]
|
||||
[ \-\-help ] [ \-\-version ] [ \fIsymbol\fR... ]
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
The \*(C+ and Java languages provides function overloading, which means
|
||||
that you can write many functions with the same name (providing each
|
||||
takes parameters of different types). All \*(C+ and Java function names
|
||||
are encoded into a low-level assembly label (this process is known as
|
||||
\&\fImangling\fR). The \f(CW\*(C`c++filt\*(C'\fR
|
||||
[1]
|
||||
program does the inverse mapping: it decodes (\fIdemangles\fR) low-level
|
||||
names into user-level names so that the linker can keep these overloaded
|
||||
functions from clashing.
|
||||
.PP
|
||||
Every alphanumeric word (consisting of letters, digits, underscores,
|
||||
dollars, or periods) seen in the input is a potential label. If the
|
||||
label decodes into a \*(C+ name, the \*(C+ name replaces the low-level
|
||||
name in the output.
|
||||
.PP
|
||||
You can use \f(CW\*(C`c++filt\*(C'\fR to decipher individual symbols:
|
||||
.PP
|
||||
.Vb 1
|
||||
\& c++filt I<symbol>
|
||||
.Ve
|
||||
If no \fIsymbol\fR arguments are given, \f(CW\*(C`c++filt\*(C'\fR reads symbol
|
||||
names from the standard input and writes the demangled names to the
|
||||
standard output. All results are printed on the standard output.
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
.Ip "\f(CW\*(C`\-_\*(C'\fR" 4
|
||||
.IX Item "-_"
|
||||
.Ip "\f(CW\*(C`\-\-strip\-underscores\*(C'\fR" 4
|
||||
.IX Item "--strip-underscores"
|
||||
On some systems, both the C and \*(C+ compilers put an underscore in front
|
||||
of every name. For example, the C name \f(CW\*(C`foo\*(C'\fR gets the low-level
|
||||
name \f(CW\*(C`_foo\*(C'\fR. This option removes the initial underscore. Whether
|
||||
\&\f(CW\*(C`c++filt\*(C'\fR removes the underscore by default is target dependent.
|
||||
.Ip "\f(CW\*(C`\-j\*(C'\fR" 4
|
||||
.IX Item "-j"
|
||||
.Ip "\f(CW\*(C`\-\-java\*(C'\fR" 4
|
||||
.IX Item "--java"
|
||||
Prints demangled names using Java syntax. The default is to use \*(C+
|
||||
syntax.
|
||||
.Ip "\f(CW\*(C`\-n\*(C'\fR" 4
|
||||
.IX Item "-n"
|
||||
.Ip "\f(CW\*(C`\-\-no\-strip\-underscores\*(C'\fR" 4
|
||||
.IX Item "--no-strip-underscores"
|
||||
Do not remove the initial underscore.
|
||||
.Ip "\f(CW\*(C`\-s \f(CIformat\f(CW\*(C'\fR" 4
|
||||
.IX Item "-s format"
|
||||
.Ip "\f(CW\*(C`\-\-format=\f(CIformat\f(CW\*(C'\fR" 4
|
||||
.IX Item "--format=format"
|
||||
\&\s-1GNU\s0 \f(CW\*(C`nm\*(C'\fR can decode three different methods of mangling, used by
|
||||
different \*(C+ compilers. The argument to this option selects which
|
||||
method it uses:
|
||||
.RS 4
|
||||
.Ip "\f(CW\*(C`gnu\*(C'\fR" 4
|
||||
.IX Item "gnu"
|
||||
the one used by the \s-1GNU\s0 compiler (the default method)
|
||||
.Ip "\f(CW\*(C`lucid\*(C'\fR" 4
|
||||
.IX Item "lucid"
|
||||
the one used by the Lucid compiler
|
||||
.Ip "\f(CW\*(C`arm\*(C'\fR" 4
|
||||
.IX Item "arm"
|
||||
the one specified by the \*(C+ Annotated Reference Manual
|
||||
.Ip "\f(CW\*(C`hp\*(C'\fR" 4
|
||||
.IX Item "hp"
|
||||
the one used by the \s-1HP\s0 compiler
|
||||
.Ip "\f(CW\*(C`edg\*(C'\fR" 4
|
||||
.IX Item "edg"
|
||||
the one used by the \s-1EDG\s0 compiler
|
||||
.Ip "\f(CW\*(C`gnu\-new\-abi\*(C'\fR" 4
|
||||
.IX Item "gnu-new-abi"
|
||||
the one used by the \s-1GNU\s0 compiler with the new \s-1ABI\s0.
|
||||
.RE
|
||||
.RS 4
|
||||
.RE
|
||||
.Ip "\f(CW\*(C`\-\-help\*(C'\fR" 4
|
||||
.IX Item "--help"
|
||||
Print a summary of the options to \f(CW\*(C`c++filt\*(C'\fR and exit.
|
||||
.Ip "\f(CW\*(C`\-\-version\*(C'\fR" 4
|
||||
.IX Item "--version"
|
||||
Print the version number of \f(CW\*(C`c++filt\*(C'\fR and exit.
|
||||
.SH "FOOTNOTES"
|
||||
.IX Header "FOOTNOTES"
|
||||
.Ip "1." 4
|
||||
\&\s-1MS-DOS\s0 does not allow \f(CW\*(C`+\*(C'\fR characters in file names, so on
|
||||
\&\s-1MS-DOS\s0 this program is named \f(CW\*(C`cxxfilt\*(C'\fR.
|
||||
.SH "SEE ALSO"
|
||||
.IX Header "SEE ALSO"
|
||||
the Info entries for \fIbinutils\fR.
|
||||
.SH "COPYRIGHT"
|
||||
.IX Header "COPYRIGHT"
|
||||
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
|
||||
1844
binutils/deflex.c
Normal file
1844
binutils/deflex.c
Normal file
File diff suppressed because it is too large
Load Diff
1202
binutils/defparse.c
Normal file
1202
binutils/defparse.c
Normal file
File diff suppressed because it is too large
Load Diff
34
binutils/defparse.h
Normal file
34
binutils/defparse.h
Normal file
@@ -0,0 +1,34 @@
|
||||
typedef union {
|
||||
char *id;
|
||||
int number;
|
||||
} YYSTYPE;
|
||||
#define NAME 257
|
||||
#define LIBRARY 258
|
||||
#define DESCRIPTION 259
|
||||
#define STACKSIZE 260
|
||||
#define HEAPSIZE 261
|
||||
#define CODE 262
|
||||
#define DATA 263
|
||||
#define SECTIONS 264
|
||||
#define EXPORTS 265
|
||||
#define IMPORTS 266
|
||||
#define VERSIONK 267
|
||||
#define BASE 268
|
||||
#define CONSTANT 269
|
||||
#define READ 270
|
||||
#define WRITE 271
|
||||
#define EXECUTE 272
|
||||
#define SHARED 273
|
||||
#define NONSHARED 274
|
||||
#define NONAME 275
|
||||
#define SINGLE 276
|
||||
#define MULTIPLE 277
|
||||
#define INITINSTANCE 278
|
||||
#define INITGLOBAL 279
|
||||
#define TERMINSTANCE 280
|
||||
#define TERMGLOBAL 281
|
||||
#define ID 282
|
||||
#define NUMBER 283
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
402
binutils/dlltool.1
Normal file
402
binutils/dlltool.1
Normal file
@@ -0,0 +1,402 @@
|
||||
.\" Automatically generated by Pod::Man version 1.02
|
||||
.\" Wed May 30 12:24:27 2001
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ======================================================================
|
||||
.de Sh \" Subsection heading
|
||||
.br
|
||||
.if t .Sp
|
||||
.ne 5
|
||||
.PP
|
||||
\fB\\$1\fR
|
||||
.PP
|
||||
..
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Ip \" List item
|
||||
.br
|
||||
.ie \\n(.$>=3 .ne \\$3
|
||||
.el .ne 3
|
||||
.IP "\\$1" \\$2
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. | will give a
|
||||
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
|
||||
.\" to do unbreakable dashes and therefore won't be available. \*(C` and
|
||||
.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
|
||||
.tr \(*W-|\(bv\*(Tr
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` `
|
||||
. ds C' '
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
'br\}
|
||||
.\"
|
||||
.\" If the F register is turned on, we'll generate index entries on stderr
|
||||
.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
|
||||
.\" index entries marked with X<> in POD. Of course, you'll have to process
|
||||
.\" the output yourself in some meaningful fashion.
|
||||
.if \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
. .
|
||||
. nr % 0
|
||||
. rr F
|
||||
.\}
|
||||
.\"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it
|
||||
.\" makes way too many mistakes in technical documents.
|
||||
.hy 0
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
.bd B 3
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ======================================================================
|
||||
.\"
|
||||
.IX Title "DLLTOOL.1 1"
|
||||
.TH DLLTOOL.1 1 "binutils-2.11.90" "2001-05-30" "GNU"
|
||||
.UC
|
||||
.SH "NAME"
|
||||
dlltool \- Create files needed to build and use DLLs.
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
dlltool [\-d|\-\-input-def \fIdef-file-name\fR]
|
||||
[\-b|\-\-base-file \fIbase-file-name\fR]
|
||||
[\-e|\-\-output-exp \fIexports-file-name\fR]
|
||||
[\-z|\-\-output-def \fIdef-file-name\fR]
|
||||
[\-l|\-\-output-lib \fIlibrary-file-name\fR]
|
||||
[\-\-export-all-symbols] [\-\-no-export-all-symbols]
|
||||
[\-\-exclude-symbols \fIlist\fR]
|
||||
[\-\-no-default-excludes]
|
||||
[\-S|\-\-as \fIpath-to-assembler\fR] [\-f|\-\-as-flags \fIoptions\fR]
|
||||
[\-D|\-\-dllname \fIname\fR] [\-m|\-\-machine \fImachine\fR]
|
||||
[\-a|\-\-add-indirect] [\-U|\-\-add-underscore] [\-k|\-\-kill-at]
|
||||
[\-A|\-\-add-stdcall-alias]
|
||||
[\-x|\-\-no-idata4] [\-c|\-\-no-idata5] [\-i|\-\-interwork]
|
||||
[\-n|\-\-nodelete] [\-v|\-\-verbose] [\-h|\-\-help] [\-V|\-\-version]
|
||||
[object-file ...]
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
\&\f(CW\*(C`dlltool\*(C'\fR reads its inputs, which can come from the \fB\-d\fR and
|
||||
\&\fB\-b\fR options as well as object files specified on the command
|
||||
line. It then processes these inputs and if the \fB\-e\fR option has
|
||||
been specified it creates a exports file. If the \fB\-l\fR option
|
||||
has been specified it creates a library file and if the \fB\-z\fR option
|
||||
has been specified it creates a def file. Any or all of the \-e, \-l
|
||||
and \-z options can be present in one invocation of dlltool.
|
||||
.PP
|
||||
When creating a \s-1DLL\s0, along with the source for the \s-1DLL\s0, it is necessary
|
||||
to have three other files. \f(CW\*(C`dlltool\*(C'\fR can help with the creation of
|
||||
these files.
|
||||
.PP
|
||||
The first file is a \fB.def\fR file which specifies which functions are
|
||||
exported from the \s-1DLL\s0, which functions the \s-1DLL\s0 imports, and so on. This
|
||||
is a text file and can be created by hand, or \f(CW\*(C`dlltool\*(C'\fR can be used
|
||||
to create it using the \fB\-z\fR option. In this case \f(CW\*(C`dlltool\*(C'\fR
|
||||
will scan the object files specified on its command line looking for
|
||||
those functions which have been specially marked as being exported and
|
||||
put entries for them in the .def file it creates.
|
||||
.PP
|
||||
In order to mark a function as being exported from a \s-1DLL\s0, it needs to
|
||||
have an \fB\-export:<name_of_function>\fR entry in the \fB.drectve\fR
|
||||
section of the object file. This can be done in C by using the
|
||||
\&\fIasm()\fR operator:
|
||||
.PP
|
||||
.Vb 2
|
||||
\& asm (".section .drectve");
|
||||
\& asm (".ascii \e"-export:my_func\e"");
|
||||
.Ve
|
||||
.Vb 1
|
||||
\& int my_func (void) { ... }
|
||||
.Ve
|
||||
The second file needed for \s-1DLL\s0 creation is an exports file. This file
|
||||
is linked with the object files that make up the body of the \s-1DLL\s0 and it
|
||||
handles the interface between the \s-1DLL\s0 and the outside world. This is a
|
||||
binary file and it can be created by giving the \fB\-e\fR option to
|
||||
\&\f(CW\*(C`dlltool\*(C'\fR when it is creating or reading in a .def file.
|
||||
.PP
|
||||
The third file needed for \s-1DLL\s0 creation is the library file that programs
|
||||
will link with in order to access the functions in the \s-1DLL\s0. This file
|
||||
can be created by giving the \fB\-l\fR option to dlltool when it
|
||||
is creating or reading in a .def file.
|
||||
.PP
|
||||
\&\f(CW\*(C`dlltool\*(C'\fR builds the library file by hand, but it builds the
|
||||
exports file by creating temporary files containing assembler statements
|
||||
and then assembling these. The \fB\-S\fR command line option can be
|
||||
used to specify the path to the assembler that dlltool will use,
|
||||
and the \fB\-f\fR option can be used to pass specific flags to that
|
||||
assembler. The \fB\-n\fR can be used to prevent dlltool from deleting
|
||||
these temporary assembler files when it is done, and if \fB\-n\fR is
|
||||
specified twice then this will prevent dlltool from deleting the
|
||||
temporary object files it used to build the library.
|
||||
.PP
|
||||
Here is an example of creating a \s-1DLL\s0 from a source file \fBdll.c\fR and
|
||||
also creating a program (from an object file called \fBprogram.o\fR)
|
||||
that uses that \s-1DLL:\s0
|
||||
.PP
|
||||
.Vb 4
|
||||
\& gcc -c dll.c
|
||||
\& dlltool -e exports.o -l dll.lib dll.o
|
||||
\& gcc dll.o exports.o -o dll.dll
|
||||
\& gcc program.o dll.lib -o program
|
||||
.Ve
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
The command line options have the following meanings:
|
||||
.Ip "\f(CW\*(C`\-d \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "-d filename"
|
||||
.Ip "\f(CW\*(C`\-\-input\-def \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "--input-def filename"
|
||||
Specifies the name of a .def file to be read in and processed.
|
||||
.Ip "\f(CW\*(C`\-b \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "-b filename"
|
||||
.Ip "\f(CW\*(C`\-\-base\-file \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "--base-file filename"
|
||||
Specifies the name of a base file to be read in and processed. The
|
||||
contents of this file will be added to the relocation section in the
|
||||
exports file generated by dlltool.
|
||||
.Ip "\f(CW\*(C`\-e \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "-e filename"
|
||||
.Ip "\f(CW\*(C`\-\-output\-exp \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "--output-exp filename"
|
||||
Specifies the name of the export file to be created by dlltool.
|
||||
.Ip "\f(CW\*(C`\-z \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "-z filename"
|
||||
.Ip "\f(CW\*(C`\-\-output\-def \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "--output-def filename"
|
||||
Specifies the name of the .def file to be created by dlltool.
|
||||
.Ip "\f(CW\*(C`\-l \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "-l filename"
|
||||
.Ip "\f(CW\*(C`\-\-output\-lib \f(CIfilename\f(CW\*(C'\fR" 4
|
||||
.IX Item "--output-lib filename"
|
||||
Specifies the name of the library file to be created by dlltool.
|
||||
.Ip "\f(CW\*(C`\-\-export\-all\-symbols\*(C'\fR" 4
|
||||
.IX Item "--export-all-symbols"
|
||||
Treat all global and weak defined symbols found in the input object
|
||||
files as symbols to be exported. There is a small list of symbols which
|
||||
are not exported by default; see the \f(CW\*(C`\-\-no\-default\-excludes\*(C'\fR
|
||||
option. You may add to the list of symbols to not export by using the
|
||||
\&\f(CW\*(C`\-\-exclude\-symbols\*(C'\fR option.
|
||||
.Ip "\f(CW\*(C`\-\-no\-export\-all\-symbols\*(C'\fR" 4
|
||||
.IX Item "--no-export-all-symbols"
|
||||
Only export symbols explicitly listed in an input .def file or in
|
||||
\&\fB.drectve\fR sections in the input object files. This is the default
|
||||
behaviour. The \fB.drectve\fR sections are created by \fBdllexport\fR
|
||||
attributes in the source code.
|
||||
.Ip "\f(CW\*(C`\-\-exclude\-symbols \f(CIlist\f(CW\*(C'\fR" 4
|
||||
.IX Item "--exclude-symbols list"
|
||||
Do not export the symbols in \fIlist\fR. This is a list of symbol names
|
||||
separated by comma or colon characters. The symbol names should not
|
||||
contain a leading underscore. This is only meaningful when
|
||||
\&\f(CW\*(C`\-\-export\-all\-symbols\*(C'\fR is used.
|
||||
.Ip "\f(CW\*(C`\-\-no\-default\-excludes\*(C'\fR" 4
|
||||
.IX Item "--no-default-excludes"
|
||||
When \f(CW\*(C`\-\-export\-all\-symbols\*(C'\fR is used, it will by default avoid
|
||||
exporting certain special symbols. The current list of symbols to avoid
|
||||
exporting is \fBDllMain@12\fR, \fBDllEntryPoint@0\fR,
|
||||
\&\fBimpure_ptr\fR. You may use the \f(CW\*(C`\-\-no\-default\-excludes\*(C'\fR option
|
||||
to go ahead and export these special symbols. This is only meaningful
|
||||
when \f(CW\*(C`\-\-export\-all\-symbols\*(C'\fR is used.
|
||||
.Ip "\f(CW\*(C`\-S \f(CIpath\f(CW\*(C'\fR" 4
|
||||
.IX Item "-S path"
|
||||
.Ip "\f(CW\*(C`\-\-as \f(CIpath\f(CW\*(C'\fR" 4
|
||||
.IX Item "--as path"
|
||||
Specifies the path, including the filename, of the assembler to be used
|
||||
to create the exports file.
|
||||
.Ip "\f(CW\*(C`\-f \f(CIswitches\f(CW\*(C'\fR" 4
|
||||
.IX Item "-f switches"
|
||||
.Ip "\f(CW\*(C`\-\-as\-flags \f(CIswitches\f(CW\*(C'\fR" 4
|
||||
.IX Item "--as-flags switches"
|
||||
Specifies any specific command line switches to be passed to the
|
||||
assembler when building the exports file. This option will work even if
|
||||
the \fB\-S\fR option is not used. This option only takes one argument,
|
||||
and if it occurs more than once on the command line, then later
|
||||
occurrences will override earlier occurrences. So if it is necessary to
|
||||
pass multiple switches to the assembler they should be enclosed in
|
||||
double quotes.
|
||||
.Ip "\f(CW\*(C`\-D \f(CIname\f(CW\*(C'\fR" 4
|
||||
.IX Item "-D name"
|
||||
.Ip "\f(CW\*(C`\-\-dll\-name \f(CIname\f(CW\*(C'\fR" 4
|
||||
.IX Item "--dll-name name"
|
||||
Specifies the name to be stored in the .def file as the name of the \s-1DLL\s0
|
||||
when the \fB\-e\fR option is used. If this option is not present, then
|
||||
the filename given to the \fB\-e\fR option will be used as the name of
|
||||
the \s-1DLL\s0.
|
||||
.Ip "\f(CW\*(C`\-m \f(CImachine\f(CW\*(C'\fR" 4
|
||||
.IX Item "-m machine"
|
||||
.Ip "\f(CW\*(C`\-machine \f(CImachine\f(CW\*(C'\fR" 4
|
||||
.IX Item "-machine machine"
|
||||
Specifies the type of machine for which the library file should be
|
||||
built. \f(CW\*(C`dlltool\*(C'\fR has a built in default type, depending upon how
|
||||
it was created, but this option can be used to override that. This is
|
||||
normally only useful when creating DLLs for an \s-1ARM\s0 processor, when the
|
||||
contents of the \s-1DLL\s0 are actually encode using \s-1THUMB\s0 instructions.
|
||||
.Ip "\f(CW\*(C`\-a\*(C'\fR" 4
|
||||
.IX Item "-a"
|
||||
.Ip "\f(CW\*(C`\-\-add\-indirect\*(C'\fR" 4
|
||||
.IX Item "--add-indirect"
|
||||
Specifies that when \f(CW\*(C`dlltool\*(C'\fR is creating the exports file it
|
||||
should add a section which allows the exported functions to be
|
||||
referenced without using the import library. Whatever the hell that
|
||||
means!
|
||||
.Ip "\f(CW\*(C`\-U\*(C'\fR" 4
|
||||
.IX Item "-U"
|
||||
.Ip "\f(CW\*(C`\-\-add\-underscore\*(C'\fR" 4
|
||||
.IX Item "--add-underscore"
|
||||
Specifies that when \f(CW\*(C`dlltool\*(C'\fR is creating the exports file it
|
||||
should prepend an underscore to the names of the exported functions.
|
||||
.Ip "\f(CW\*(C`\-k\*(C'\fR" 4
|
||||
.IX Item "-k"
|
||||
.Ip "\f(CW\*(C`\-\-kill\-at\*(C'\fR" 4
|
||||
.IX Item "--kill-at"
|
||||
Specifies that when \f(CW\*(C`dlltool\*(C'\fR is creating the exports file it
|
||||
should not append the string \fB@ <number>\fR. These numbers are
|
||||
called ordinal numbers and they represent another way of accessing the
|
||||
function in a \s-1DLL\s0, other than by name.
|
||||
.Ip "\f(CW\*(C`\-A\*(C'\fR" 4
|
||||
.IX Item "-A"
|
||||
.Ip "\f(CW\*(C`\-\-add\-stdcall\-alias\*(C'\fR" 4
|
||||
.IX Item "--add-stdcall-alias"
|
||||
Specifies that when \f(CW\*(C`dlltool\*(C'\fR is creating the exports file it
|
||||
should add aliases for stdcall symbols without \fB@ <number>\fR
|
||||
in addition to the symbols with \fB@ <number>\fR.
|
||||
.Ip "\f(CW\*(C`\-x\*(C'\fR" 4
|
||||
.IX Item "-x"
|
||||
.Ip "\f(CW\*(C`\-\-no\-idata4\*(C'\fR" 4
|
||||
.IX Item "--no-idata4"
|
||||
Specifies that when \f(CW\*(C`dlltool\*(C'\fR is creating the exports and library
|
||||
files it should omit the .idata4 section. This is for compatibility
|
||||
with certain operating systems.
|
||||
.Ip "\f(CW\*(C`\-c\*(C'\fR" 4
|
||||
.IX Item "-c"
|
||||
.Ip "\f(CW\*(C`\-\-no\-idata5\*(C'\fR" 4
|
||||
.IX Item "--no-idata5"
|
||||
Specifies that when \f(CW\*(C`dlltool\*(C'\fR is creating the exports and library
|
||||
files it should omit the .idata5 section. This is for compatibility
|
||||
with certain operating systems.
|
||||
.Ip "\f(CW\*(C`\-i\*(C'\fR" 4
|
||||
.IX Item "-i"
|
||||
.Ip "\f(CW\*(C`\-\-interwork\*(C'\fR" 4
|
||||
.IX Item "--interwork"
|
||||
Specifies that \f(CW\*(C`dlltool\*(C'\fR should mark the objects in the library
|
||||
file and exports file that it produces as supporting interworking
|
||||
between \s-1ARM\s0 and \s-1THUMB\s0 code.
|
||||
.Ip "\f(CW\*(C`\-n\*(C'\fR" 4
|
||||
.IX Item "-n"
|
||||
.Ip "\f(CW\*(C`\-\-nodelete\*(C'\fR" 4
|
||||
.IX Item "--nodelete"
|
||||
Makes \f(CW\*(C`dlltool\*(C'\fR preserve the temporary assembler files it used to
|
||||
create the exports file. If this option is repeated then dlltool will
|
||||
also preserve the temporary object files it uses to create the library
|
||||
file.
|
||||
.Ip "\f(CW\*(C`\-v\*(C'\fR" 4
|
||||
.IX Item "-v"
|
||||
.Ip "\f(CW\*(C`\-\-verbose\*(C'\fR" 4
|
||||
.IX Item "--verbose"
|
||||
Make dlltool describe what it is doing.
|
||||
.Ip "\f(CW\*(C`\-h\*(C'\fR" 4
|
||||
.IX Item "-h"
|
||||
.Ip "\f(CW\*(C`\-\-help\*(C'\fR" 4
|
||||
.IX Item "--help"
|
||||
Displays a list of command line options and then exits.
|
||||
.Ip "\f(CW\*(C`\-V\*(C'\fR" 4
|
||||
.IX Item "-V"
|
||||
.Ip "\f(CW\*(C`\-\-version\*(C'\fR" 4
|
||||
.IX Item "--version"
|
||||
Displays dlltool's version number and then exits.
|
||||
.SH "SEE ALSO"
|
||||
.IX Header "SEE ALSO"
|
||||
the Info entries for \fIbinutils\fR.
|
||||
.SH "COPYRIGHT"
|
||||
.IX Header "COPYRIGHT"
|
||||
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
|
||||
.PP
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, with no Front-Cover Texts, and with no
|
||||
Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user