Line 1... |
Line 1... |
/* bfd back-end for HP PA-RISC SOM objects.
|
/* bfd back-end for HP PA-RISC SOM objects.
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
|
|
Contributed by the Center for Software Science at the
|
Contributed by the Center for Software Science at the
|
University of Utah.
|
University of Utah.
|
|
|
Line 21... |
Line 21... |
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
02110-1301, USA. */
|
02110-1301, USA. */
|
|
|
|
#include "alloca-conf.h"
|
#include "sysdep.h"
|
#include "sysdep.h"
|
#include "bfd.h"
|
#include "bfd.h"
|
|
|
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX)
|
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined(HOST_HPPAMPEIX)
|
|
|
Line 35... |
Line 36... |
#include <sys/param.h>
|
#include <sys/param.h>
|
#include <signal.h>
|
#include <signal.h>
|
#include <machine/reg.h>
|
#include <machine/reg.h>
|
#include <sys/file.h>
|
#include <sys/file.h>
|
|
|
/* This is the code recommended in the autoconf documentation, almost
|
|
verbatim. */
|
|
|
|
#ifndef __GNUC__
|
|
# if HAVE_ALLOCA_H
|
|
# include <alloca.h>
|
|
# else
|
|
# ifdef _AIX
|
|
/* Indented so that pre-ansi C compilers will ignore it, rather than
|
|
choke on it. Some versions of AIX require this to be the first
|
|
thing in the file. */
|
|
#pragma alloca
|
|
# else
|
|
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
|
# if !defined (__STDC__) && !defined (__hpux)
|
|
extern char *alloca ();
|
|
# else
|
|
extern void *alloca ();
|
|
# endif /* __STDC__, __hpux */
|
|
# endif /* alloca */
|
|
# endif /* _AIX */
|
|
# endif /* HAVE_ALLOCA_H */
|
|
#else
|
|
extern void *alloca (size_t);
|
|
#endif /* __GNUC__ */
|
|
|
|
static bfd_reloc_status_type hppa_som_reloc
|
static bfd_reloc_status_type hppa_som_reloc
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
|
static bfd_boolean som_mkobject (bfd *);
|
static bfd_boolean som_mkobject (bfd *);
|
static bfd_boolean som_is_space (asection *);
|
static bfd_boolean som_is_space (asection *);
|
static bfd_boolean som_is_subspace (asection *);
|
static bfd_boolean som_is_subspace (asection *);
|
Line 351... |
Line 326... |
/* R_RELOCATION. */
|
/* R_RELOCATION. */
|
{ 0, "L4=" }, /* 0x24 */
|
{ 0, "L4=" }, /* 0x24 */
|
/* R_DATA_ONE_SYMBOL. */
|
/* R_DATA_ONE_SYMBOL. */
|
{ 0, "L4=Sb=" }, /* 0x25 */
|
{ 0, "L4=Sb=" }, /* 0x25 */
|
{ 1, "L4=Sd=" }, /* 0x26 */
|
{ 1, "L4=Sd=" }, /* 0x26 */
|
/* R_DATA_PLEBEL. */
|
/* R_DATA_PLABEL. */
|
{ 0, "L4=Sb=" }, /* 0x27 */
|
{ 0, "L4=Sb=" }, /* 0x27 */
|
{ 1, "L4=Sd=" }, /* 0x28 */
|
{ 1, "L4=Sd=" }, /* 0x28 */
|
/* R_SPACE_REF. */
|
/* R_SPACE_REF. */
|
{ 0, "L4=" }, /* 0x29 */
|
{ 0, "L4=" }, /* 0x29 */
|
/* R_REPEATED_INIT. */
|
/* R_REPEATED_INIT. */
|
Line 435... |
Line 410... |
{ 29, "L4=SD=" }, /* 0x6d */
|
{ 29, "L4=SD=" }, /* 0x6d */
|
{ 30, "L4=SD=" }, /* 0x6e */
|
{ 30, "L4=SD=" }, /* 0x6e */
|
{ 31, "L4=SD=" }, /* 0x6f */
|
{ 31, "L4=SD=" }, /* 0x6f */
|
{ 32, "L4=Sb=" }, /* 0x70 */
|
{ 32, "L4=Sb=" }, /* 0x70 */
|
{ 33, "L4=Sd=" }, /* 0x71 */
|
{ 33, "L4=Sd=" }, /* 0x71 */
|
|
/* R_DATA_GPREL. */
|
|
{ 0, "L4=Sd=" }, /* 0x72 */
|
/* R_RESERVED. */
|
/* R_RESERVED. */
|
{ 0, "" }, /* 0x72 */
|
|
{ 0, "" }, /* 0x73 */
|
{ 0, "" }, /* 0x73 */
|
{ 0, "" }, /* 0x74 */
|
{ 0, "" }, /* 0x74 */
|
{ 0, "" }, /* 0x75 */
|
{ 0, "" }, /* 0x75 */
|
{ 0, "" }, /* 0x76 */
|
{ 0, "" }, /* 0x76 */
|
{ 0, "" }, /* 0x77 */
|
{ 0, "" }, /* 0x77 */
|
Line 823... |
Line 799... |
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DP_RELATIVE, "R_DP_RELATIVE"),
|
SOM_HOWTO (R_DATA_GPREL, "R_DATA_GPREL"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
SOM_HOWTO (R_RESERVED, "R_RESERVED"),
|
Line 1569... |
Line 1545... |
/* More PLABEL special cases. */
|
/* More PLABEL special cases. */
|
if (field == e_psel
|
if (field == e_psel
|
|| field == e_lpsel
|
|| field == e_lpsel
|
|| field == e_rpsel)
|
|| field == e_rpsel)
|
*final_type = R_DATA_PLABEL;
|
*final_type = R_DATA_PLABEL;
|
|
else if (field == e_fsel && format == 32)
|
|
*final_type = R_DATA_GPREL;
|
break;
|
break;
|
|
|
case R_HPPA_COMPLEX:
|
case R_HPPA_COMPLEX:
|
/* The difference of two symbols needs *very* special handling. */
|
/* The difference of two symbols needs *very* special handling. */
|
if (sym_diff)
|
if (sym_diff)
|
Line 2797... |
Line 2775... |
}
|
}
|
else
|
else
|
abort ();
|
abort ();
|
break;
|
break;
|
|
|
|
case R_DATA_GPREL:
|
|
/* Account for any addend. */
|
|
if (bfd_reloc->addend)
|
|
p = som_reloc_addend (abfd, bfd_reloc->addend, p,
|
|
&subspace_reloc_size, reloc_queue);
|
|
|
|
if (sym_num < 0x10000000)
|
|
{
|
|
bfd_put_8 (abfd, bfd_reloc->howto->type, p);
|
|
bfd_put_8 (abfd, sym_num >> 16, p + 1);
|
|
bfd_put_16 (abfd, (bfd_vma) sym_num, p + 2);
|
|
p = try_prev_fixup (abfd, &subspace_reloc_size,
|
|
p, 4, reloc_queue);
|
|
}
|
|
else
|
|
abort ();
|
|
break;
|
|
|
case R_DATA_ONE_SYMBOL:
|
case R_DATA_ONE_SYMBOL:
|
case R_DATA_PLABEL:
|
case R_DATA_PLABEL:
|
case R_CODE_PLABEL:
|
case R_CODE_PLABEL:
|
case R_DLT_REL:
|
case R_DLT_REL:
|
/* Account for any addend using R_DATA_OVERRIDE. */
|
/* Account for any addend using R_DATA_OVERRIDE. */
|
Line 3992... |
Line 3988... |
|
|
/* For unknown symbols set the symbol's type based on the symbol's
|
/* For unknown symbols set the symbol's type based on the symbol's
|
section (ST_DATA for DATA sections, ST_CODE for CODE sections). */
|
section (ST_DATA for DATA sections, ST_CODE for CODE sections). */
|
else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN)
|
else if (som_symbol_data (sym)->som_type == SYMBOL_TYPE_UNKNOWN)
|
{
|
{
|
if (sym->section->flags & SEC_CODE)
|
if (bfd_is_abs_section (sym->section))
|
|
info->symbol_type = ST_ABSOLUTE;
|
|
else if (sym->section->flags & SEC_CODE)
|
info->symbol_type = ST_CODE;
|
info->symbol_type = ST_CODE;
|
else
|
else
|
info->symbol_type = ST_DATA;
|
info->symbol_type = ST_DATA;
|
}
|
}
|
|
|
Line 4472... |
Line 4470... |
|
|
static asymbol *
|
static asymbol *
|
som_make_empty_symbol (bfd *abfd)
|
som_make_empty_symbol (bfd *abfd)
|
{
|
{
|
bfd_size_type amt = sizeof (som_symbol_type);
|
bfd_size_type amt = sizeof (som_symbol_type);
|
som_symbol_type *new = bfd_zalloc (abfd, amt);
|
som_symbol_type *new_symbol_type = bfd_zalloc (abfd, amt);
|
|
|
if (new == NULL)
|
if (new_symbol_type == NULL)
|
return NULL;
|
return NULL;
|
new->symbol.the_bfd = abfd;
|
new_symbol_type->symbol.the_bfd = abfd;
|
|
|
return &new->symbol;
|
return &new_symbol_type->symbol;
|
}
|
}
|
|
|
/* Print symbol information. */
|
/* Print symbol information. */
|
|
|
static void
|
static void
|
Line 6349... |
Line 6347... |
#define som_bfd_gc_sections bfd_generic_gc_sections
|
#define som_bfd_gc_sections bfd_generic_gc_sections
|
#define som_bfd_merge_sections bfd_generic_merge_sections
|
#define som_bfd_merge_sections bfd_generic_merge_sections
|
#define som_bfd_is_group_section bfd_generic_is_group_section
|
#define som_bfd_is_group_section bfd_generic_is_group_section
|
#define som_bfd_discard_group bfd_generic_discard_group
|
#define som_bfd_discard_group bfd_generic_discard_group
|
#define som_section_already_linked _bfd_generic_section_already_linked
|
#define som_section_already_linked _bfd_generic_section_already_linked
|
|
#define som_bfd_define_common_symbol bfd_generic_define_common_symbol
|
#define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
|
#define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
|
#define som_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
|
#define som_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
|
#define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
|
#define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
|
#define som_find_inliner_info _bfd_nosymbols_find_inliner_info
|
#define som_find_inliner_info _bfd_nosymbols_find_inliner_info
|
|
|