xref: /dragonfly/contrib/gdb-7/bfd/bfd-in.h (revision ef5ccd6c)
15796c8dcSSimon Schubert /* Main header file for the bfd library -- portable access to object files.
25796c8dcSSimon Schubert 
3a45ae5f8SJohn Marino    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4*ef5ccd6cSJohn Marino    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
5*ef5ccd6cSJohn Marino    2012 Free Software Foundation, Inc.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    Contributed by Cygnus Support.
85796c8dcSSimon Schubert 
95796c8dcSSimon Schubert    This file is part of BFD, the Binary File Descriptor library.
105796c8dcSSimon Schubert 
115796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
125796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
135796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
145796c8dcSSimon Schubert    (at your option) any later version.
155796c8dcSSimon Schubert 
165796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
175796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
185796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
195796c8dcSSimon Schubert    GNU General Public License for more details.
205796c8dcSSimon Schubert 
215796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
225796c8dcSSimon Schubert    along with this program; if not, write to the Free Software
235796c8dcSSimon Schubert    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
245796c8dcSSimon Schubert 
255796c8dcSSimon Schubert #ifndef __BFD_H_SEEN__
265796c8dcSSimon Schubert #define __BFD_H_SEEN__
275796c8dcSSimon Schubert 
28*ef5ccd6cSJohn Marino /* PR 14072: Ensure that config.h is included first.  */
29*ef5ccd6cSJohn Marino #if !defined PACKAGE && !defined PACKAGE_VERSION
30*ef5ccd6cSJohn Marino #error config.h must be included before this header
31*ef5ccd6cSJohn Marino #endif
32*ef5ccd6cSJohn Marino 
335796c8dcSSimon Schubert #ifdef __cplusplus
345796c8dcSSimon Schubert extern "C" {
355796c8dcSSimon Schubert #endif
365796c8dcSSimon Schubert 
375796c8dcSSimon Schubert #include "ansidecl.h"
385796c8dcSSimon Schubert #include "symcat.h"
39a45ae5f8SJohn Marino #include <sys/stat.h>
40a45ae5f8SJohn Marino 
415796c8dcSSimon Schubert #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
425796c8dcSSimon Schubert #ifndef SABER
435796c8dcSSimon Schubert /* This hack is to avoid a problem with some strict ANSI C preprocessors.
445796c8dcSSimon Schubert    The problem is, "32_" is not a valid preprocessing token, and we don't
455796c8dcSSimon Schubert    want extra underscores (e.g., "nlm_32_").  The XCONCAT2 macro will
465796c8dcSSimon Schubert    cause the inner CONCAT2 macros to be evaluated first, producing
475796c8dcSSimon Schubert    still-valid pp-tokens.  Then the final concatenation can be done.  */
485796c8dcSSimon Schubert #undef CONCAT4
495796c8dcSSimon Schubert #define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
505796c8dcSSimon Schubert #endif
515796c8dcSSimon Schubert #endif
525796c8dcSSimon Schubert 
535796c8dcSSimon Schubert /* This is a utility macro to handle the situation where the code
545796c8dcSSimon Schubert    wants to place a constant string into the code, followed by a
555796c8dcSSimon Schubert    comma and then the length of the string.  Doing this by hand
565796c8dcSSimon Schubert    is error prone, so using this macro is safer.  */
575796c8dcSSimon Schubert #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
585796c8dcSSimon Schubert /* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
595796c8dcSSimon Schubert    to create the arguments to another macro, since the preprocessor
605796c8dcSSimon Schubert    will mis-count the number of arguments to the outer macro (by not
615796c8dcSSimon Schubert    evaluating STRING_COMMA_LEN and so missing the comma).  This is a
625796c8dcSSimon Schubert    problem for example when trying to use STRING_COMMA_LEN to build
635796c8dcSSimon Schubert    the arguments to the strncmp() macro.  Hence this alternative
645796c8dcSSimon Schubert    definition of strncmp is provided here.
655796c8dcSSimon Schubert 
665796c8dcSSimon Schubert    Note - these macros do NOT work if STR2 is not a constant string.  */
675796c8dcSSimon Schubert #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
685796c8dcSSimon Schubert   /* strcpy() can have a similar problem, but since we know we are
695796c8dcSSimon Schubert      copying a constant string, we can use memcpy which will be faster
705796c8dcSSimon Schubert      since there is no need to check for a NUL byte inside STR.  We
715796c8dcSSimon Schubert      can also save time if we do not need to copy the terminating NUL.  */
725796c8dcSSimon Schubert #define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
735796c8dcSSimon Schubert #define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
745796c8dcSSimon Schubert 
755796c8dcSSimon Schubert 
765796c8dcSSimon Schubert #define BFD_SUPPORTS_PLUGINS @supports_plugins@
775796c8dcSSimon Schubert 
785796c8dcSSimon Schubert /* The word size used by BFD on the host.  This may be 64 with a 32
795796c8dcSSimon Schubert    bit target if the host is 64 bit, or if other 64 bit targets have
805796c8dcSSimon Schubert    been selected with --enable-targets, or if --enable-64-bit-bfd.  */
815796c8dcSSimon Schubert #define BFD_ARCH_SIZE @wordsize@
825796c8dcSSimon Schubert 
835796c8dcSSimon Schubert /* The word size of the default bfd target.  */
845796c8dcSSimon Schubert #define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
855796c8dcSSimon Schubert 
865796c8dcSSimon Schubert #define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
875796c8dcSSimon Schubert #define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@
885796c8dcSSimon Schubert #if @BFD_HOST_64_BIT_DEFINED@
895796c8dcSSimon Schubert #define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
905796c8dcSSimon Schubert #define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
915796c8dcSSimon Schubert typedef BFD_HOST_64_BIT bfd_int64_t;
925796c8dcSSimon Schubert typedef BFD_HOST_U_64_BIT bfd_uint64_t;
935796c8dcSSimon Schubert #endif
945796c8dcSSimon Schubert 
955796c8dcSSimon Schubert #if BFD_ARCH_SIZE >= 64
965796c8dcSSimon Schubert #define BFD64
975796c8dcSSimon Schubert #endif
985796c8dcSSimon Schubert 
995796c8dcSSimon Schubert #ifndef INLINE
1005796c8dcSSimon Schubert #if __GNUC__ >= 2
1015796c8dcSSimon Schubert #define INLINE __inline__
1025796c8dcSSimon Schubert #else
1035796c8dcSSimon Schubert #define INLINE
1045796c8dcSSimon Schubert #endif
1055796c8dcSSimon Schubert #endif
1065796c8dcSSimon Schubert 
1075796c8dcSSimon Schubert /* Declaring a type wide enough to hold a host long and a host pointer.  */
1085796c8dcSSimon Schubert #define BFD_HOSTPTR_T	@BFD_HOSTPTR_T@
1095796c8dcSSimon Schubert typedef BFD_HOSTPTR_T bfd_hostptr_t;
1105796c8dcSSimon Schubert 
1115796c8dcSSimon Schubert /* Forward declaration.  */
1125796c8dcSSimon Schubert typedef struct bfd bfd;
1135796c8dcSSimon Schubert 
1145796c8dcSSimon Schubert /* Boolean type used in bfd.  Too many systems define their own
1155796c8dcSSimon Schubert    versions of "boolean" for us to safely typedef a "boolean" of
1165796c8dcSSimon Schubert    our own.  Using an enum for "bfd_boolean" has its own set of
1175796c8dcSSimon Schubert    problems, with strange looking casts required to avoid warnings
1185796c8dcSSimon Schubert    on some older compilers.  Thus we just use an int.
1195796c8dcSSimon Schubert 
1205796c8dcSSimon Schubert    General rule: Functions which are bfd_boolean return TRUE on
1215796c8dcSSimon Schubert    success and FALSE on failure (unless they're a predicate).  */
1225796c8dcSSimon Schubert 
1235796c8dcSSimon Schubert typedef int bfd_boolean;
1245796c8dcSSimon Schubert #undef FALSE
1255796c8dcSSimon Schubert #undef TRUE
1265796c8dcSSimon Schubert #define FALSE 0
1275796c8dcSSimon Schubert #define TRUE 1
1285796c8dcSSimon Schubert 
1295796c8dcSSimon Schubert #ifdef BFD64
1305796c8dcSSimon Schubert 
1315796c8dcSSimon Schubert #ifndef BFD_HOST_64_BIT
1325796c8dcSSimon Schubert  #error No 64 bit integer type available
1335796c8dcSSimon Schubert #endif /* ! defined (BFD_HOST_64_BIT) */
1345796c8dcSSimon Schubert 
1355796c8dcSSimon Schubert typedef BFD_HOST_U_64_BIT bfd_vma;
1365796c8dcSSimon Schubert typedef BFD_HOST_64_BIT bfd_signed_vma;
1375796c8dcSSimon Schubert typedef BFD_HOST_U_64_BIT bfd_size_type;
1385796c8dcSSimon Schubert typedef BFD_HOST_U_64_BIT symvalue;
1395796c8dcSSimon Schubert 
1405796c8dcSSimon Schubert #if BFD_HOST_64BIT_LONG
1415796c8dcSSimon Schubert #define BFD_VMA_FMT "l"
1425796c8dcSSimon Schubert #elif defined (__MSVCRT__)
1435796c8dcSSimon Schubert #define BFD_VMA_FMT "I64"
1445796c8dcSSimon Schubert #else
1455796c8dcSSimon Schubert #define BFD_VMA_FMT "ll"
1465796c8dcSSimon Schubert #endif
1475796c8dcSSimon Schubert 
1485796c8dcSSimon Schubert #ifndef fprintf_vma
1495796c8dcSSimon Schubert #define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
1505796c8dcSSimon Schubert #define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
1515796c8dcSSimon Schubert #endif
1525796c8dcSSimon Schubert 
1535796c8dcSSimon Schubert #else /* not BFD64  */
1545796c8dcSSimon Schubert 
1555796c8dcSSimon Schubert /* Represent a target address.  Also used as a generic unsigned type
1565796c8dcSSimon Schubert    which is guaranteed to be big enough to hold any arithmetic types
1575796c8dcSSimon Schubert    we need to deal with.  */
1585796c8dcSSimon Schubert typedef unsigned long bfd_vma;
1595796c8dcSSimon Schubert 
1605796c8dcSSimon Schubert /* A generic signed type which is guaranteed to be big enough to hold any
1615796c8dcSSimon Schubert    arithmetic types we need to deal with.  Can be assumed to be compatible
1625796c8dcSSimon Schubert    with bfd_vma in the same way that signed and unsigned ints are compatible
1635796c8dcSSimon Schubert    (as parameters, in assignment, etc).  */
1645796c8dcSSimon Schubert typedef long bfd_signed_vma;
1655796c8dcSSimon Schubert 
1665796c8dcSSimon Schubert typedef unsigned long symvalue;
1675796c8dcSSimon Schubert typedef unsigned long bfd_size_type;
1685796c8dcSSimon Schubert 
1695796c8dcSSimon Schubert /* Print a bfd_vma x on stream s.  */
1705796c8dcSSimon Schubert #define BFD_VMA_FMT "l"
1715796c8dcSSimon Schubert #define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
1725796c8dcSSimon Schubert #define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
1735796c8dcSSimon Schubert 
1745796c8dcSSimon Schubert #endif /* not BFD64  */
1755796c8dcSSimon Schubert 
1765796c8dcSSimon Schubert #define HALF_BFD_SIZE_TYPE \
1775796c8dcSSimon Schubert   (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
1785796c8dcSSimon Schubert 
1795796c8dcSSimon Schubert #ifndef BFD_HOST_64_BIT
1805796c8dcSSimon Schubert /* Fall back on a 32 bit type.  The idea is to make these types always
1815796c8dcSSimon Schubert    available for function return types, but in the case that
1825796c8dcSSimon Schubert    BFD_HOST_64_BIT is undefined such a function should abort or
1835796c8dcSSimon Schubert    otherwise signal an error.  */
1845796c8dcSSimon Schubert typedef bfd_signed_vma bfd_int64_t;
1855796c8dcSSimon Schubert typedef bfd_vma bfd_uint64_t;
1865796c8dcSSimon Schubert #endif
1875796c8dcSSimon Schubert 
1885796c8dcSSimon Schubert /* An offset into a file.  BFD always uses the largest possible offset
1895796c8dcSSimon Schubert    based on the build time availability of fseek, fseeko, or fseeko64.  */
1905796c8dcSSimon Schubert typedef @bfd_file_ptr@ file_ptr;
1915796c8dcSSimon Schubert typedef unsigned @bfd_file_ptr@ ufile_ptr;
1925796c8dcSSimon Schubert 
1935796c8dcSSimon Schubert extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
1945796c8dcSSimon Schubert extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
1955796c8dcSSimon Schubert 
1965796c8dcSSimon Schubert #define printf_vma(x) fprintf_vma(stdout,x)
1975796c8dcSSimon Schubert #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
1985796c8dcSSimon Schubert 
1995796c8dcSSimon Schubert typedef unsigned int flagword;	/* 32 bits of flags */
2005796c8dcSSimon Schubert typedef unsigned char bfd_byte;
2015796c8dcSSimon Schubert 
2025796c8dcSSimon Schubert /* File formats.  */
2035796c8dcSSimon Schubert 
2045796c8dcSSimon Schubert typedef enum bfd_format
2055796c8dcSSimon Schubert {
2065796c8dcSSimon Schubert   bfd_unknown = 0,	/* File format is unknown.  */
2075796c8dcSSimon Schubert   bfd_object,		/* Linker/assembler/compiler output.  */
2085796c8dcSSimon Schubert   bfd_archive,		/* Object archive file.  */
2095796c8dcSSimon Schubert   bfd_core,		/* Core dump.  */
2105796c8dcSSimon Schubert   bfd_type_end		/* Marks the end; don't use it!  */
2115796c8dcSSimon Schubert }
2125796c8dcSSimon Schubert bfd_format;
2135796c8dcSSimon Schubert 
2145796c8dcSSimon Schubert /* Symbols and relocation.  */
2155796c8dcSSimon Schubert 
2165796c8dcSSimon Schubert /* A count of carsyms (canonical archive symbols).  */
2175796c8dcSSimon Schubert typedef unsigned long symindex;
2185796c8dcSSimon Schubert 
2195796c8dcSSimon Schubert /* How to perform a relocation.  */
2205796c8dcSSimon Schubert typedef const struct reloc_howto_struct reloc_howto_type;
2215796c8dcSSimon Schubert 
2225796c8dcSSimon Schubert #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
2235796c8dcSSimon Schubert 
2245796c8dcSSimon Schubert /* General purpose part of a symbol X;
2255796c8dcSSimon Schubert    target specific parts are in libcoff.h, libaout.h, etc.  */
2265796c8dcSSimon Schubert 
2275796c8dcSSimon Schubert #define bfd_get_section(x) ((x)->section)
2285796c8dcSSimon Schubert #define bfd_get_output_section(x) ((x)->section->output_section)
2295796c8dcSSimon Schubert #define bfd_set_section(x,y) ((x)->section) = (y)
2305796c8dcSSimon Schubert #define bfd_asymbol_base(x) ((x)->section->vma)
2315796c8dcSSimon Schubert #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
2325796c8dcSSimon Schubert #define bfd_asymbol_name(x) ((x)->name)
2335796c8dcSSimon Schubert /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
2345796c8dcSSimon Schubert #define bfd_asymbol_bfd(x) ((x)->the_bfd)
2355796c8dcSSimon Schubert #define bfd_asymbol_flavour(x)			\
2365796c8dcSSimon Schubert   (((x)->flags & BSF_SYNTHETIC) != 0		\
2375796c8dcSSimon Schubert    ? bfd_target_unknown_flavour			\
2385796c8dcSSimon Schubert    : bfd_asymbol_bfd (x)->xvec->flavour)
2395796c8dcSSimon Schubert 
2405796c8dcSSimon Schubert /* A canonical archive symbol.  */
2415796c8dcSSimon Schubert /* This is a type pun with struct ranlib on purpose!  */
2425796c8dcSSimon Schubert typedef struct carsym
2435796c8dcSSimon Schubert {
2445796c8dcSSimon Schubert   char *name;
2455796c8dcSSimon Schubert   file_ptr file_offset;	/* Look here to find the file.  */
2465796c8dcSSimon Schubert }
2475796c8dcSSimon Schubert carsym;			/* To make these you call a carsymogen.  */
2485796c8dcSSimon Schubert 
2495796c8dcSSimon Schubert /* Used in generating armaps (archive tables of contents).
2505796c8dcSSimon Schubert    Perhaps just a forward definition would do?  */
2515796c8dcSSimon Schubert struct orl 			/* Output ranlib.  */
2525796c8dcSSimon Schubert {
2535796c8dcSSimon Schubert   char **name;		/* Symbol name.  */
2545796c8dcSSimon Schubert   union
2555796c8dcSSimon Schubert   {
2565796c8dcSSimon Schubert     file_ptr pos;
2575796c8dcSSimon Schubert     bfd *abfd;
2585796c8dcSSimon Schubert   } u;			/* bfd* or file position.  */
2595796c8dcSSimon Schubert   int namidx;		/* Index into string table.  */
2605796c8dcSSimon Schubert };
2615796c8dcSSimon Schubert 
2625796c8dcSSimon Schubert /* Linenumber stuff.  */
2635796c8dcSSimon Schubert typedef struct lineno_cache_entry
2645796c8dcSSimon Schubert {
2655796c8dcSSimon Schubert   unsigned int line_number;	/* Linenumber from start of function.  */
2665796c8dcSSimon Schubert   union
2675796c8dcSSimon Schubert   {
2685796c8dcSSimon Schubert     struct bfd_symbol *sym;	/* Function name.  */
2695796c8dcSSimon Schubert     bfd_vma offset;	    		/* Offset into section.  */
2705796c8dcSSimon Schubert   } u;
2715796c8dcSSimon Schubert }
2725796c8dcSSimon Schubert alent;
2735796c8dcSSimon Schubert 
2745796c8dcSSimon Schubert /* Object and core file sections.  */
2755796c8dcSSimon Schubert 
2765796c8dcSSimon Schubert #define	align_power(addr, align)	\
2775796c8dcSSimon Schubert   (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
2785796c8dcSSimon Schubert 
2795796c8dcSSimon Schubert typedef struct bfd_section *sec_ptr;
2805796c8dcSSimon Schubert 
281*ef5ccd6cSJohn Marino #define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name)
282*ef5ccd6cSJohn Marino #define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma)
283*ef5ccd6cSJohn Marino #define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma)
284*ef5ccd6cSJohn Marino #define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \
285*ef5ccd6cSJohn Marino 					     (ptr)->alignment_power)
2865796c8dcSSimon Schubert #define bfd_section_name(bfd, ptr) ((ptr)->name)
2875796c8dcSSimon Schubert #define bfd_section_size(bfd, ptr) ((ptr)->size)
2885796c8dcSSimon Schubert #define bfd_get_section_size(ptr) ((ptr)->size)
2895796c8dcSSimon Schubert #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
2905796c8dcSSimon Schubert #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
2915796c8dcSSimon Schubert #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
292*ef5ccd6cSJohn Marino #define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags)
293*ef5ccd6cSJohn Marino #define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata)
2945796c8dcSSimon Schubert 
2955796c8dcSSimon Schubert #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
2965796c8dcSSimon Schubert 
2975796c8dcSSimon Schubert #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
2985796c8dcSSimon Schubert #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
2995796c8dcSSimon Schubert #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
3005796c8dcSSimon Schubert /* Find the address one past the end of SEC.  */
3015796c8dcSSimon Schubert #define bfd_get_section_limit(bfd, sec) \
302a45ae5f8SJohn Marino   (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
303a45ae5f8SJohn Marino     ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd))
3045796c8dcSSimon Schubert 
305cf7f2e2dSJohn Marino /* Return TRUE if input section SEC has been discarded.  */
306*ef5ccd6cSJohn Marino #define discarded_section(sec)				\
3075796c8dcSSimon Schubert   (!bfd_is_abs_section (sec)					\
3085796c8dcSSimon Schubert    && bfd_is_abs_section ((sec)->output_section)		\
309*ef5ccd6cSJohn Marino    && (sec)->sec_info_type != SEC_INFO_TYPE_MERGE		\
310*ef5ccd6cSJohn Marino    && (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS)
3115796c8dcSSimon Schubert 
3125796c8dcSSimon Schubert typedef enum bfd_print_symbol
3135796c8dcSSimon Schubert {
3145796c8dcSSimon Schubert   bfd_print_symbol_name,
3155796c8dcSSimon Schubert   bfd_print_symbol_more,
3165796c8dcSSimon Schubert   bfd_print_symbol_all
3175796c8dcSSimon Schubert } bfd_print_symbol_type;
3185796c8dcSSimon Schubert 
3195796c8dcSSimon Schubert /* Information about a symbol that nm needs.  */
3205796c8dcSSimon Schubert 
3215796c8dcSSimon Schubert typedef struct _symbol_info
3225796c8dcSSimon Schubert {
3235796c8dcSSimon Schubert   symvalue value;
3245796c8dcSSimon Schubert   char type;
3255796c8dcSSimon Schubert   const char *name;            /* Symbol name.  */
3265796c8dcSSimon Schubert   unsigned char stab_type;     /* Stab type.  */
3275796c8dcSSimon Schubert   char stab_other;             /* Stab other.  */
3285796c8dcSSimon Schubert   short stab_desc;             /* Stab desc.  */
3295796c8dcSSimon Schubert   const char *stab_name;       /* String for stab type.  */
3305796c8dcSSimon Schubert } symbol_info;
3315796c8dcSSimon Schubert 
3325796c8dcSSimon Schubert /* Get the name of a stabs type code.  */
3335796c8dcSSimon Schubert 
3345796c8dcSSimon Schubert extern const char *bfd_get_stab_name (int);
3355796c8dcSSimon Schubert 
3365796c8dcSSimon Schubert /* Hash table routines.  There is no way to free up a hash table.  */
3375796c8dcSSimon Schubert 
3385796c8dcSSimon Schubert /* An element in the hash table.  Most uses will actually use a larger
3395796c8dcSSimon Schubert    structure, and an instance of this will be the first field.  */
3405796c8dcSSimon Schubert 
3415796c8dcSSimon Schubert struct bfd_hash_entry
3425796c8dcSSimon Schubert {
3435796c8dcSSimon Schubert   /* Next entry for this hash code.  */
3445796c8dcSSimon Schubert   struct bfd_hash_entry *next;
3455796c8dcSSimon Schubert   /* String being hashed.  */
3465796c8dcSSimon Schubert   const char *string;
3475796c8dcSSimon Schubert   /* Hash code.  This is the full hash code, not the index into the
3485796c8dcSSimon Schubert      table.  */
3495796c8dcSSimon Schubert   unsigned long hash;
3505796c8dcSSimon Schubert };
3515796c8dcSSimon Schubert 
3525796c8dcSSimon Schubert /* A hash table.  */
3535796c8dcSSimon Schubert 
3545796c8dcSSimon Schubert struct bfd_hash_table
3555796c8dcSSimon Schubert {
3565796c8dcSSimon Schubert   /* The hash array.  */
3575796c8dcSSimon Schubert   struct bfd_hash_entry **table;
3585796c8dcSSimon Schubert   /* A function used to create new elements in the hash table.  The
3595796c8dcSSimon Schubert      first entry is itself a pointer to an element.  When this
3605796c8dcSSimon Schubert      function is first invoked, this pointer will be NULL.  However,
3615796c8dcSSimon Schubert      having the pointer permits a hierarchy of method functions to be
3625796c8dcSSimon Schubert      built each of which calls the function in the superclass.  Thus
3635796c8dcSSimon Schubert      each function should be written to allocate a new block of memory
3645796c8dcSSimon Schubert      only if the argument is NULL.  */
3655796c8dcSSimon Schubert   struct bfd_hash_entry *(*newfunc)
3665796c8dcSSimon Schubert     (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
3675796c8dcSSimon Schubert    /* An objalloc for this hash table.  This is a struct objalloc *,
3685796c8dcSSimon Schubert      but we use void * to avoid requiring the inclusion of objalloc.h.  */
3695796c8dcSSimon Schubert   void *memory;
3705796c8dcSSimon Schubert   /* The number of slots in the hash table.  */
3715796c8dcSSimon Schubert   unsigned int size;
3725796c8dcSSimon Schubert   /* The number of entries in the hash table.  */
3735796c8dcSSimon Schubert   unsigned int count;
3745796c8dcSSimon Schubert   /* The size of elements.  */
3755796c8dcSSimon Schubert   unsigned int entsize;
3765796c8dcSSimon Schubert   /* If non-zero, don't grow the hash table.  */
3775796c8dcSSimon Schubert   unsigned int frozen:1;
3785796c8dcSSimon Schubert };
3795796c8dcSSimon Schubert 
3805796c8dcSSimon Schubert /* Initialize a hash table.  */
3815796c8dcSSimon Schubert extern bfd_boolean bfd_hash_table_init
3825796c8dcSSimon Schubert   (struct bfd_hash_table *,
3835796c8dcSSimon Schubert    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
3845796c8dcSSimon Schubert 			       struct bfd_hash_table *,
3855796c8dcSSimon Schubert 			       const char *),
3865796c8dcSSimon Schubert    unsigned int);
3875796c8dcSSimon Schubert 
3885796c8dcSSimon Schubert /* Initialize a hash table specifying a size.  */
3895796c8dcSSimon Schubert extern bfd_boolean bfd_hash_table_init_n
3905796c8dcSSimon Schubert   (struct bfd_hash_table *,
3915796c8dcSSimon Schubert    struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
3925796c8dcSSimon Schubert 			       struct bfd_hash_table *,
3935796c8dcSSimon Schubert 			       const char *),
3945796c8dcSSimon Schubert    unsigned int, unsigned int);
3955796c8dcSSimon Schubert 
3965796c8dcSSimon Schubert /* Free up a hash table.  */
3975796c8dcSSimon Schubert extern void bfd_hash_table_free
3985796c8dcSSimon Schubert   (struct bfd_hash_table *);
3995796c8dcSSimon Schubert 
4005796c8dcSSimon Schubert /* Look up a string in a hash table.  If CREATE is TRUE, a new entry
4015796c8dcSSimon Schubert    will be created for this string if one does not already exist.  The
4025796c8dcSSimon Schubert    COPY argument must be TRUE if this routine should copy the string
4035796c8dcSSimon Schubert    into newly allocated memory when adding an entry.  */
4045796c8dcSSimon Schubert extern struct bfd_hash_entry *bfd_hash_lookup
4055796c8dcSSimon Schubert   (struct bfd_hash_table *, const char *, bfd_boolean create,
4065796c8dcSSimon Schubert    bfd_boolean copy);
4075796c8dcSSimon Schubert 
4085796c8dcSSimon Schubert /* Insert an entry in a hash table.  */
4095796c8dcSSimon Schubert extern struct bfd_hash_entry *bfd_hash_insert
4105796c8dcSSimon Schubert   (struct bfd_hash_table *, const char *, unsigned long);
4115796c8dcSSimon Schubert 
412c50c785cSJohn Marino /* Rename an entry in a hash table.  */
413c50c785cSJohn Marino extern void bfd_hash_rename
414c50c785cSJohn Marino   (struct bfd_hash_table *, const char *, struct bfd_hash_entry *);
415c50c785cSJohn Marino 
4165796c8dcSSimon Schubert /* Replace an entry in a hash table.  */
4175796c8dcSSimon Schubert extern void bfd_hash_replace
4185796c8dcSSimon Schubert   (struct bfd_hash_table *, struct bfd_hash_entry *old,
4195796c8dcSSimon Schubert    struct bfd_hash_entry *nw);
4205796c8dcSSimon Schubert 
4215796c8dcSSimon Schubert /* Base method for creating a hash table entry.  */
4225796c8dcSSimon Schubert extern struct bfd_hash_entry *bfd_hash_newfunc
4235796c8dcSSimon Schubert   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
4245796c8dcSSimon Schubert 
4255796c8dcSSimon Schubert /* Grab some space for a hash table entry.  */
4265796c8dcSSimon Schubert extern void *bfd_hash_allocate
4275796c8dcSSimon Schubert   (struct bfd_hash_table *, unsigned int);
4285796c8dcSSimon Schubert 
4295796c8dcSSimon Schubert /* Traverse a hash table in a random order, calling a function on each
4305796c8dcSSimon Schubert    element.  If the function returns FALSE, the traversal stops.  The
4315796c8dcSSimon Schubert    INFO argument is passed to the function.  */
4325796c8dcSSimon Schubert extern void bfd_hash_traverse
4335796c8dcSSimon Schubert   (struct bfd_hash_table *,
4345796c8dcSSimon Schubert    bfd_boolean (*) (struct bfd_hash_entry *, void *),
4355796c8dcSSimon Schubert    void *info);
4365796c8dcSSimon Schubert 
4375796c8dcSSimon Schubert /* Allows the default size of a hash table to be configured. New hash
4385796c8dcSSimon Schubert    tables allocated using bfd_hash_table_init will be created with
4395796c8dcSSimon Schubert    this size.  */
440a45ae5f8SJohn Marino extern unsigned long bfd_hash_set_default_size (unsigned long);
4415796c8dcSSimon Schubert 
4425796c8dcSSimon Schubert /* This structure is used to keep track of stabs in sections
4435796c8dcSSimon Schubert    information while linking.  */
4445796c8dcSSimon Schubert 
4455796c8dcSSimon Schubert struct stab_info
4465796c8dcSSimon Schubert {
4475796c8dcSSimon Schubert   /* A hash table used to hold stabs strings.  */
4485796c8dcSSimon Schubert   struct bfd_strtab_hash *strings;
4495796c8dcSSimon Schubert   /* The header file hash table.  */
4505796c8dcSSimon Schubert   struct bfd_hash_table includes;
4515796c8dcSSimon Schubert   /* The first .stabstr section.  */
4525796c8dcSSimon Schubert   struct bfd_section *stabstr;
4535796c8dcSSimon Schubert };
4545796c8dcSSimon Schubert 
4555796c8dcSSimon Schubert #define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
4565796c8dcSSimon Schubert 
4575796c8dcSSimon Schubert /* User program access to BFD facilities.  */
4585796c8dcSSimon Schubert 
4595796c8dcSSimon Schubert /* Direct I/O routines, for programs which know more about the object
4605796c8dcSSimon Schubert    file than BFD does.  Use higher level routines if possible.  */
4615796c8dcSSimon Schubert 
4625796c8dcSSimon Schubert extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
4635796c8dcSSimon Schubert extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
4645796c8dcSSimon Schubert extern int bfd_seek (bfd *, file_ptr, int);
4655796c8dcSSimon Schubert extern file_ptr bfd_tell (bfd *);
4665796c8dcSSimon Schubert extern int bfd_flush (bfd *);
4675796c8dcSSimon Schubert extern int bfd_stat (bfd *, struct stat *);
4685796c8dcSSimon Schubert 
4695796c8dcSSimon Schubert /* Deprecated old routines.  */
4705796c8dcSSimon Schubert #if __GNUC__
4715796c8dcSSimon Schubert #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)				\
4725796c8dcSSimon Schubert   (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__),	\
4735796c8dcSSimon Schubert    bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
4745796c8dcSSimon Schubert #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)				\
4755796c8dcSSimon Schubert   (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__),	\
4765796c8dcSSimon Schubert    bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
4775796c8dcSSimon Schubert #else
4785796c8dcSSimon Schubert #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD)				\
4795796c8dcSSimon Schubert   (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
4805796c8dcSSimon Schubert    bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
4815796c8dcSSimon Schubert #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD)				\
4825796c8dcSSimon Schubert   (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
4835796c8dcSSimon Schubert    bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
4845796c8dcSSimon Schubert #endif
4855796c8dcSSimon Schubert extern void warn_deprecated (const char *, const char *, int, const char *);
4865796c8dcSSimon Schubert 
4875796c8dcSSimon Schubert /* Cast from const char * to char * so that caller can assign to
4885796c8dcSSimon Schubert    a char * without a warning.  */
4895796c8dcSSimon Schubert #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
4905796c8dcSSimon Schubert #define bfd_get_cacheable(abfd) ((abfd)->cacheable)
4915796c8dcSSimon Schubert #define bfd_get_format(abfd) ((abfd)->format)
4925796c8dcSSimon Schubert #define bfd_get_target(abfd) ((abfd)->xvec->name)
4935796c8dcSSimon Schubert #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
4945796c8dcSSimon Schubert #define bfd_family_coff(abfd) \
4955796c8dcSSimon Schubert   (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
4965796c8dcSSimon Schubert    bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
4975796c8dcSSimon Schubert #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
4985796c8dcSSimon Schubert #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
4995796c8dcSSimon Schubert #define bfd_header_big_endian(abfd) \
5005796c8dcSSimon Schubert   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
5015796c8dcSSimon Schubert #define bfd_header_little_endian(abfd) \
5025796c8dcSSimon Schubert   ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
5035796c8dcSSimon Schubert #define bfd_get_file_flags(abfd) ((abfd)->flags)
5045796c8dcSSimon Schubert #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
5055796c8dcSSimon Schubert #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
5065796c8dcSSimon Schubert #define bfd_my_archive(abfd) ((abfd)->my_archive)
5075796c8dcSSimon Schubert #define bfd_has_map(abfd) ((abfd)->has_armap)
5085796c8dcSSimon Schubert #define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive)
5095796c8dcSSimon Schubert 
5105796c8dcSSimon Schubert #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
5115796c8dcSSimon Schubert #define bfd_usrdata(abfd) ((abfd)->usrdata)
5125796c8dcSSimon Schubert 
5135796c8dcSSimon Schubert #define bfd_get_start_address(abfd) ((abfd)->start_address)
5145796c8dcSSimon Schubert #define bfd_get_symcount(abfd) ((abfd)->symcount)
5155796c8dcSSimon Schubert #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
5165796c8dcSSimon Schubert #define bfd_count_sections(abfd) ((abfd)->section_count)
5175796c8dcSSimon Schubert 
5185796c8dcSSimon Schubert #define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
5195796c8dcSSimon Schubert 
5205796c8dcSSimon Schubert #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
5215796c8dcSSimon Schubert 
5225796c8dcSSimon Schubert #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
5235796c8dcSSimon Schubert 
5245796c8dcSSimon Schubert extern bfd_boolean bfd_cache_close
5255796c8dcSSimon Schubert   (bfd *abfd);
5265796c8dcSSimon Schubert /* NB: This declaration should match the autogenerated one in libbfd.h.  */
5275796c8dcSSimon Schubert 
5285796c8dcSSimon Schubert extern bfd_boolean bfd_cache_close_all (void);
5295796c8dcSSimon Schubert 
5305796c8dcSSimon Schubert extern bfd_boolean bfd_record_phdr
5315796c8dcSSimon Schubert   (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
5325796c8dcSSimon Schubert    bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
5335796c8dcSSimon Schubert 
5345796c8dcSSimon Schubert /* Byte swapping routines.  */
5355796c8dcSSimon Schubert 
5365796c8dcSSimon Schubert bfd_uint64_t bfd_getb64 (const void *);
5375796c8dcSSimon Schubert bfd_uint64_t bfd_getl64 (const void *);
5385796c8dcSSimon Schubert bfd_int64_t bfd_getb_signed_64 (const void *);
5395796c8dcSSimon Schubert bfd_int64_t bfd_getl_signed_64 (const void *);
5405796c8dcSSimon Schubert bfd_vma bfd_getb32 (const void *);
5415796c8dcSSimon Schubert bfd_vma bfd_getl32 (const void *);
5425796c8dcSSimon Schubert bfd_signed_vma bfd_getb_signed_32 (const void *);
5435796c8dcSSimon Schubert bfd_signed_vma bfd_getl_signed_32 (const void *);
5445796c8dcSSimon Schubert bfd_vma bfd_getb16 (const void *);
5455796c8dcSSimon Schubert bfd_vma bfd_getl16 (const void *);
5465796c8dcSSimon Schubert bfd_signed_vma bfd_getb_signed_16 (const void *);
5475796c8dcSSimon Schubert bfd_signed_vma bfd_getl_signed_16 (const void *);
5485796c8dcSSimon Schubert void bfd_putb64 (bfd_uint64_t, void *);
5495796c8dcSSimon Schubert void bfd_putl64 (bfd_uint64_t, void *);
5505796c8dcSSimon Schubert void bfd_putb32 (bfd_vma, void *);
5515796c8dcSSimon Schubert void bfd_putl32 (bfd_vma, void *);
5525796c8dcSSimon Schubert void bfd_putb16 (bfd_vma, void *);
5535796c8dcSSimon Schubert void bfd_putl16 (bfd_vma, void *);
5545796c8dcSSimon Schubert 
5555796c8dcSSimon Schubert /* Byte swapping routines which take size and endiannes as arguments.  */
5565796c8dcSSimon Schubert 
5575796c8dcSSimon Schubert bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
5585796c8dcSSimon Schubert void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
5595796c8dcSSimon Schubert 
5605796c8dcSSimon Schubert #if defined(__STDC__) || defined(ALMOST_STDC)
5615796c8dcSSimon Schubert struct ecoff_debug_info;
5625796c8dcSSimon Schubert struct ecoff_debug_swap;
5635796c8dcSSimon Schubert struct ecoff_extr;
5645796c8dcSSimon Schubert struct bfd_symbol;
5655796c8dcSSimon Schubert struct bfd_link_info;
5665796c8dcSSimon Schubert struct bfd_link_hash_entry;
567a45ae5f8SJohn Marino struct bfd_section_already_linked;
5685796c8dcSSimon Schubert struct bfd_elf_version_tree;
5695796c8dcSSimon Schubert #endif
570a45ae5f8SJohn Marino 
571a45ae5f8SJohn Marino extern bfd_boolean bfd_section_already_linked_table_init (void);
572a45ae5f8SJohn Marino extern void bfd_section_already_linked_table_free (void);
573a45ae5f8SJohn Marino extern bfd_boolean _bfd_handle_already_linked
574a45ae5f8SJohn Marino   (struct bfd_section *, struct bfd_section_already_linked *,
575a45ae5f8SJohn Marino    struct bfd_link_info *);
576a45ae5f8SJohn Marino 
577a45ae5f8SJohn Marino /* Externally visible ECOFF routines.  */
578a45ae5f8SJohn Marino 
5795796c8dcSSimon Schubert extern bfd_vma bfd_ecoff_get_gp_value
5805796c8dcSSimon Schubert   (bfd * abfd);
5815796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_set_gp_value
5825796c8dcSSimon Schubert   (bfd *abfd, bfd_vma gp_value);
5835796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_set_regmasks
5845796c8dcSSimon Schubert   (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
5855796c8dcSSimon Schubert    unsigned long *cprmask);
5865796c8dcSSimon Schubert extern void *bfd_ecoff_debug_init
5875796c8dcSSimon Schubert   (bfd *output_bfd, struct ecoff_debug_info *output_debug,
5885796c8dcSSimon Schubert    const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
5895796c8dcSSimon Schubert extern void bfd_ecoff_debug_free
5905796c8dcSSimon Schubert   (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
5915796c8dcSSimon Schubert    const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
5925796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_debug_accumulate
5935796c8dcSSimon Schubert   (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
5945796c8dcSSimon Schubert    const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
5955796c8dcSSimon Schubert    struct ecoff_debug_info *input_debug,
5965796c8dcSSimon Schubert    const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
5975796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_debug_accumulate_other
5985796c8dcSSimon Schubert   (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
5995796c8dcSSimon Schubert    const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
6005796c8dcSSimon Schubert    struct bfd_link_info *);
6015796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_debug_externals
6025796c8dcSSimon Schubert   (bfd *abfd, struct ecoff_debug_info *debug,
6035796c8dcSSimon Schubert    const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
6045796c8dcSSimon Schubert    bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
6055796c8dcSSimon Schubert    void (*set_index) (struct bfd_symbol *, bfd_size_type));
6065796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_debug_one_external
6075796c8dcSSimon Schubert   (bfd *abfd, struct ecoff_debug_info *debug,
6085796c8dcSSimon Schubert    const struct ecoff_debug_swap *swap, const char *name,
6095796c8dcSSimon Schubert    struct ecoff_extr *esym);
6105796c8dcSSimon Schubert extern bfd_size_type bfd_ecoff_debug_size
6115796c8dcSSimon Schubert   (bfd *abfd, struct ecoff_debug_info *debug,
6125796c8dcSSimon Schubert    const struct ecoff_debug_swap *swap);
6135796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_write_debug
6145796c8dcSSimon Schubert   (bfd *abfd, struct ecoff_debug_info *debug,
6155796c8dcSSimon Schubert    const struct ecoff_debug_swap *swap, file_ptr where);
6165796c8dcSSimon Schubert extern bfd_boolean bfd_ecoff_write_accumulated_debug
6175796c8dcSSimon Schubert   (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
6185796c8dcSSimon Schubert    const struct ecoff_debug_swap *swap,
6195796c8dcSSimon Schubert    struct bfd_link_info *info, file_ptr where);
6205796c8dcSSimon Schubert 
6215796c8dcSSimon Schubert /* Externally visible ELF routines.  */
6225796c8dcSSimon Schubert 
6235796c8dcSSimon Schubert struct bfd_link_needed_list
6245796c8dcSSimon Schubert {
6255796c8dcSSimon Schubert   struct bfd_link_needed_list *next;
6265796c8dcSSimon Schubert   bfd *by;
6275796c8dcSSimon Schubert   const char *name;
6285796c8dcSSimon Schubert };
6295796c8dcSSimon Schubert 
6305796c8dcSSimon Schubert enum dynamic_lib_link_class {
6315796c8dcSSimon Schubert   DYN_NORMAL = 0,
6325796c8dcSSimon Schubert   DYN_AS_NEEDED = 1,
6335796c8dcSSimon Schubert   DYN_DT_NEEDED = 2,
6345796c8dcSSimon Schubert   DYN_NO_ADD_NEEDED = 4,
6355796c8dcSSimon Schubert   DYN_NO_NEEDED = 8
6365796c8dcSSimon Schubert };
6375796c8dcSSimon Schubert 
6385796c8dcSSimon Schubert enum notice_asneeded_action {
6395796c8dcSSimon Schubert   notice_as_needed,
6405796c8dcSSimon Schubert   notice_not_needed,
6415796c8dcSSimon Schubert   notice_needed
6425796c8dcSSimon Schubert };
6435796c8dcSSimon Schubert 
6445796c8dcSSimon Schubert extern bfd_boolean bfd_elf_record_link_assignment
6455796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
6465796c8dcSSimon Schubert    bfd_boolean);
6475796c8dcSSimon Schubert extern struct bfd_link_needed_list *bfd_elf_get_needed_list
6485796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
6495796c8dcSSimon Schubert extern bfd_boolean bfd_elf_get_bfd_needed_list
6505796c8dcSSimon Schubert   (bfd *, struct bfd_link_needed_list **);
651*ef5ccd6cSJohn Marino extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
652*ef5ccd6cSJohn Marino 					       const char *, bfd_vma);
6535796c8dcSSimon Schubert extern bfd_boolean bfd_elf_size_dynamic_sections
654cf7f2e2dSJohn Marino   (bfd *, const char *, const char *, const char *, const char *, const char *,
655a45ae5f8SJohn Marino    const char * const *, struct bfd_link_info *, struct bfd_section **);
6565796c8dcSSimon Schubert extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
6575796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
6585796c8dcSSimon Schubert extern void bfd_elf_set_dt_needed_name
6595796c8dcSSimon Schubert   (bfd *, const char *);
6605796c8dcSSimon Schubert extern const char *bfd_elf_get_dt_soname
6615796c8dcSSimon Schubert   (bfd *);
6625796c8dcSSimon Schubert extern void bfd_elf_set_dyn_lib_class
6635796c8dcSSimon Schubert   (bfd *, enum dynamic_lib_link_class);
6645796c8dcSSimon Schubert extern int bfd_elf_get_dyn_lib_class
6655796c8dcSSimon Schubert   (bfd *);
6665796c8dcSSimon Schubert extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
6675796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
6685796c8dcSSimon Schubert extern bfd_boolean bfd_elf_discard_info
6695796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
6705796c8dcSSimon Schubert extern unsigned int _bfd_elf_default_action_discarded
6715796c8dcSSimon Schubert   (struct bfd_section *);
6725796c8dcSSimon Schubert 
6735796c8dcSSimon Schubert /* Return an upper bound on the number of bytes required to store a
6745796c8dcSSimon Schubert    copy of ABFD's program header table entries.  Return -1 if an error
6755796c8dcSSimon Schubert    occurs; bfd_get_error will return an appropriate code.  */
6765796c8dcSSimon Schubert extern long bfd_get_elf_phdr_upper_bound
6775796c8dcSSimon Schubert   (bfd *abfd);
6785796c8dcSSimon Schubert 
6795796c8dcSSimon Schubert /* Copy ABFD's program header table entries to *PHDRS.  The entries
6805796c8dcSSimon Schubert    will be stored as an array of Elf_Internal_Phdr structures, as
6815796c8dcSSimon Schubert    defined in include/elf/internal.h.  To find out how large the
6825796c8dcSSimon Schubert    buffer needs to be, call bfd_get_elf_phdr_upper_bound.
6835796c8dcSSimon Schubert 
6845796c8dcSSimon Schubert    Return the number of program header table entries read, or -1 if an
6855796c8dcSSimon Schubert    error occurs; bfd_get_error will return an appropriate code.  */
6865796c8dcSSimon Schubert extern int bfd_get_elf_phdrs
6875796c8dcSSimon Schubert   (bfd *abfd, void *phdrs);
6885796c8dcSSimon Schubert 
6895796c8dcSSimon Schubert /* Create a new BFD as if by bfd_openr.  Rather than opening a file,
6905796c8dcSSimon Schubert    reconstruct an ELF file by reading the segments out of remote memory
6915796c8dcSSimon Schubert    based on the ELF file header at EHDR_VMA and the ELF program headers it
6925796c8dcSSimon Schubert    points to.  If not null, *LOADBASEP is filled in with the difference
6935796c8dcSSimon Schubert    between the VMAs from which the segments were read, and the VMAs the
6945796c8dcSSimon Schubert    file headers (and hence BFD's idea of each section's VMA) put them at.
6955796c8dcSSimon Schubert 
6965796c8dcSSimon Schubert    The function TARGET_READ_MEMORY is called to copy LEN bytes from the
6975796c8dcSSimon Schubert    remote memory at target address VMA into the local buffer at MYADDR; it
6985796c8dcSSimon Schubert    should return zero on success or an `errno' code on failure.  TEMPL must
6995796c8dcSSimon Schubert    be a BFD for an ELF target with the word size and byte order found in
7005796c8dcSSimon Schubert    the remote memory.  */
7015796c8dcSSimon Schubert extern bfd *bfd_elf_bfd_from_remote_memory
7025796c8dcSSimon Schubert   (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
703*ef5ccd6cSJohn Marino    int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
704*ef5ccd6cSJohn Marino 			      bfd_size_type len));
7055796c8dcSSimon Schubert 
7065796c8dcSSimon Schubert extern struct bfd_section *_bfd_elf_tls_setup
7075796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
7085796c8dcSSimon Schubert 
709*ef5ccd6cSJohn Marino extern struct bfd_section *
710*ef5ccd6cSJohn Marino _bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
711*ef5ccd6cSJohn Marino 
7125796c8dcSSimon Schubert extern void _bfd_fix_excluded_sec_syms
7135796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
7145796c8dcSSimon Schubert 
7155796c8dcSSimon Schubert extern unsigned bfd_m68k_mach_to_features (int);
7165796c8dcSSimon Schubert 
7175796c8dcSSimon Schubert extern int bfd_m68k_features_to_mach (unsigned);
7185796c8dcSSimon Schubert 
7195796c8dcSSimon Schubert extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
7205796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
7215796c8dcSSimon Schubert    char **);
7225796c8dcSSimon Schubert 
7235796c8dcSSimon Schubert extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int);
7245796c8dcSSimon Schubert 
7255796c8dcSSimon Schubert extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
7265796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
7275796c8dcSSimon Schubert    char **);
7285796c8dcSSimon Schubert 
7295796c8dcSSimon Schubert extern bfd_boolean bfd_cr16_elf32_create_embedded_relocs
7305796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
7315796c8dcSSimon Schubert    char **);
7325796c8dcSSimon Schubert 
7335796c8dcSSimon Schubert /* SunOS shared library support routines for the linker.  */
7345796c8dcSSimon Schubert 
7355796c8dcSSimon Schubert extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
7365796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
7375796c8dcSSimon Schubert extern bfd_boolean bfd_sunos_record_link_assignment
7385796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, const char *);
7395796c8dcSSimon Schubert extern bfd_boolean bfd_sunos_size_dynamic_sections
7405796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_section **,
7415796c8dcSSimon Schubert    struct bfd_section **, struct bfd_section **);
7425796c8dcSSimon Schubert 
7435796c8dcSSimon Schubert /* Linux shared library support routines for the linker.  */
7445796c8dcSSimon Schubert 
7455796c8dcSSimon Schubert extern bfd_boolean bfd_i386linux_size_dynamic_sections
7465796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
7475796c8dcSSimon Schubert extern bfd_boolean bfd_m68klinux_size_dynamic_sections
7485796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
7495796c8dcSSimon Schubert extern bfd_boolean bfd_sparclinux_size_dynamic_sections
7505796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
7515796c8dcSSimon Schubert 
7525796c8dcSSimon Schubert /* mmap hacks */
7535796c8dcSSimon Schubert 
7545796c8dcSSimon Schubert struct _bfd_window_internal;
7555796c8dcSSimon Schubert typedef struct _bfd_window_internal bfd_window_internal;
7565796c8dcSSimon Schubert 
7575796c8dcSSimon Schubert typedef struct _bfd_window
7585796c8dcSSimon Schubert {
7595796c8dcSSimon Schubert   /* What the user asked for.  */
7605796c8dcSSimon Schubert   void *data;
7615796c8dcSSimon Schubert   bfd_size_type size;
7625796c8dcSSimon Schubert   /* The actual window used by BFD.  Small user-requested read-only
7635796c8dcSSimon Schubert      regions sharing a page may share a single window into the object
7645796c8dcSSimon Schubert      file.  Read-write versions shouldn't until I've fixed things to
7655796c8dcSSimon Schubert      keep track of which portions have been claimed by the
7665796c8dcSSimon Schubert      application; don't want to give the same region back when the
7675796c8dcSSimon Schubert      application wants two writable copies!  */
7685796c8dcSSimon Schubert   struct _bfd_window_internal *i;
7695796c8dcSSimon Schubert }
7705796c8dcSSimon Schubert bfd_window;
7715796c8dcSSimon Schubert 
7725796c8dcSSimon Schubert extern void bfd_init_window
7735796c8dcSSimon Schubert   (bfd_window *);
7745796c8dcSSimon Schubert extern void bfd_free_window
7755796c8dcSSimon Schubert   (bfd_window *);
7765796c8dcSSimon Schubert extern bfd_boolean bfd_get_file_window
7775796c8dcSSimon Schubert   (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
7785796c8dcSSimon Schubert 
7795796c8dcSSimon Schubert /* XCOFF support routines for the linker.  */
7805796c8dcSSimon Schubert 
7815796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_split_import_path
7825796c8dcSSimon Schubert   (bfd *, const char *, const char **, const char **);
7835796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_set_archive_import_path
7845796c8dcSSimon Schubert   (struct bfd_link_info *, bfd *, const char *);
7855796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_link_record_set
7865796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
7875796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_import_symbol
7885796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
7895796c8dcSSimon Schubert    const char *, const char *, const char *, unsigned int);
7905796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_export_symbol
7915796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
7925796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_link_count_reloc
7935796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, const char *);
7945796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_record_link_assignment
7955796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, const char *);
7965796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_size_dynamic_sections
7975796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, const char *, const char *,
7985796c8dcSSimon Schubert    unsigned long, unsigned long, unsigned long, bfd_boolean,
7995796c8dcSSimon Schubert    int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean);
8005796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_link_generate_rtinit
8015796c8dcSSimon Schubert   (bfd *, const char *, const char *, bfd_boolean);
8025796c8dcSSimon Schubert 
8035796c8dcSSimon Schubert /* XCOFF support routines for ar.  */
8045796c8dcSSimon Schubert extern bfd_boolean bfd_xcoff_ar_archive_set_magic
8055796c8dcSSimon Schubert   (bfd *, char *);
8065796c8dcSSimon Schubert 
8075796c8dcSSimon Schubert /* Externally visible COFF routines.  */
8085796c8dcSSimon Schubert 
8095796c8dcSSimon Schubert #if defined(__STDC__) || defined(ALMOST_STDC)
8105796c8dcSSimon Schubert struct internal_syment;
8115796c8dcSSimon Schubert union internal_auxent;
8125796c8dcSSimon Schubert #endif
8135796c8dcSSimon Schubert 
8145796c8dcSSimon Schubert extern bfd_boolean bfd_coff_get_syment
8155796c8dcSSimon Schubert   (bfd *, struct bfd_symbol *, struct internal_syment *);
8165796c8dcSSimon Schubert 
8175796c8dcSSimon Schubert extern bfd_boolean bfd_coff_get_auxent
8185796c8dcSSimon Schubert   (bfd *, struct bfd_symbol *, int, union internal_auxent *);
8195796c8dcSSimon Schubert 
8205796c8dcSSimon Schubert extern bfd_boolean bfd_coff_set_symbol_class
8215796c8dcSSimon Schubert   (bfd *, struct bfd_symbol *, unsigned int);
8225796c8dcSSimon Schubert 
8235796c8dcSSimon Schubert extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
8245796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
8255796c8dcSSimon Schubert 
8265796c8dcSSimon Schubert /* ARM VFP11 erratum workaround support.  */
8275796c8dcSSimon Schubert typedef enum
8285796c8dcSSimon Schubert {
8295796c8dcSSimon Schubert   BFD_ARM_VFP11_FIX_DEFAULT,
8305796c8dcSSimon Schubert   BFD_ARM_VFP11_FIX_NONE,
8315796c8dcSSimon Schubert   BFD_ARM_VFP11_FIX_SCALAR,
8325796c8dcSSimon Schubert   BFD_ARM_VFP11_FIX_VECTOR
8335796c8dcSSimon Schubert } bfd_arm_vfp11_fix;
8345796c8dcSSimon Schubert 
8355796c8dcSSimon Schubert extern void bfd_elf32_arm_init_maps
8365796c8dcSSimon Schubert   (bfd *);
8375796c8dcSSimon Schubert 
8385796c8dcSSimon Schubert extern void bfd_elf32_arm_set_vfp11_fix
8395796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8405796c8dcSSimon Schubert 
8415796c8dcSSimon Schubert extern void bfd_elf32_arm_set_cortex_a8_fix
8425796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8435796c8dcSSimon Schubert 
8445796c8dcSSimon Schubert extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
8455796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8465796c8dcSSimon Schubert 
8475796c8dcSSimon Schubert extern void bfd_elf32_arm_vfp11_fix_veneer_locations
8485796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8495796c8dcSSimon Schubert 
8505796c8dcSSimon Schubert /* ARM Interworking support.  Called from linker.  */
8515796c8dcSSimon Schubert extern bfd_boolean bfd_arm_allocate_interworking_sections
8525796c8dcSSimon Schubert   (struct bfd_link_info *);
8535796c8dcSSimon Schubert 
8545796c8dcSSimon Schubert extern bfd_boolean bfd_arm_process_before_allocation
8555796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, int);
8565796c8dcSSimon Schubert 
8575796c8dcSSimon Schubert extern bfd_boolean bfd_arm_get_bfd_for_interworking
8585796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8595796c8dcSSimon Schubert 
8605796c8dcSSimon Schubert /* PE ARM Interworking support.  Called from linker.  */
8615796c8dcSSimon Schubert extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
8625796c8dcSSimon Schubert   (struct bfd_link_info *);
8635796c8dcSSimon Schubert 
8645796c8dcSSimon Schubert extern bfd_boolean bfd_arm_pe_process_before_allocation
8655796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, int);
8665796c8dcSSimon Schubert 
8675796c8dcSSimon Schubert extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
8685796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8695796c8dcSSimon Schubert 
8705796c8dcSSimon Schubert /* ELF ARM Interworking support.  Called from linker.  */
8715796c8dcSSimon Schubert extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
8725796c8dcSSimon Schubert   (struct bfd_link_info *);
8735796c8dcSSimon Schubert 
8745796c8dcSSimon Schubert extern bfd_boolean bfd_elf32_arm_process_before_allocation
8755796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8765796c8dcSSimon Schubert 
8775796c8dcSSimon Schubert void bfd_elf32_arm_set_target_relocs
8785796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix,
879a45ae5f8SJohn Marino    int, int, int, int, int);
8805796c8dcSSimon Schubert 
8815796c8dcSSimon Schubert extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
8825796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8835796c8dcSSimon Schubert 
8845796c8dcSSimon Schubert extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
8855796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
8865796c8dcSSimon Schubert 
8875796c8dcSSimon Schubert /* ELF ARM mapping symbol support */
8885796c8dcSSimon Schubert #define BFD_ARM_SPECIAL_SYM_TYPE_MAP	(1 << 0)
8895796c8dcSSimon Schubert #define BFD_ARM_SPECIAL_SYM_TYPE_TAG	(1 << 1)
8905796c8dcSSimon Schubert #define BFD_ARM_SPECIAL_SYM_TYPE_OTHER  (1 << 2)
8915796c8dcSSimon Schubert #define BFD_ARM_SPECIAL_SYM_TYPE_ANY	(~0)
8925796c8dcSSimon Schubert extern bfd_boolean bfd_is_arm_special_symbol_name
8935796c8dcSSimon Schubert   (const char * name, int type);
8945796c8dcSSimon Schubert 
8955796c8dcSSimon Schubert extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
8965796c8dcSSimon Schubert 
8975796c8dcSSimon Schubert /* ARM Note section processing.  */
8985796c8dcSSimon Schubert extern bfd_boolean bfd_arm_merge_machines
8995796c8dcSSimon Schubert   (bfd *, bfd *);
9005796c8dcSSimon Schubert 
9015796c8dcSSimon Schubert extern bfd_boolean bfd_arm_update_notes
9025796c8dcSSimon Schubert   (bfd *, const char *);
9035796c8dcSSimon Schubert 
9045796c8dcSSimon Schubert extern unsigned int bfd_arm_get_mach_from_notes
9055796c8dcSSimon Schubert   (bfd *, const char *);
9065796c8dcSSimon Schubert 
9075796c8dcSSimon Schubert /* ARM stub generation support.  Called from the linker.  */
9085796c8dcSSimon Schubert extern int elf32_arm_setup_section_lists
9095796c8dcSSimon Schubert   (bfd *, struct bfd_link_info *);
9105796c8dcSSimon Schubert extern void elf32_arm_next_input_section
9115796c8dcSSimon Schubert   (struct bfd_link_info *, struct bfd_section *);
9125796c8dcSSimon Schubert extern bfd_boolean elf32_arm_size_stubs
9135796c8dcSSimon Schubert   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
9145796c8dcSSimon Schubert    struct bfd_section * (*) (const char *, struct bfd_section *), void (*) (void));
9155796c8dcSSimon Schubert extern bfd_boolean elf32_arm_build_stubs
9165796c8dcSSimon Schubert   (struct bfd_link_info *);
9175796c8dcSSimon Schubert 
9185796c8dcSSimon Schubert /* ARM unwind section editing support.  */
9195796c8dcSSimon Schubert extern bfd_boolean elf32_arm_fix_exidx_coverage
920cf7f2e2dSJohn Marino (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
921cf7f2e2dSJohn Marino 
922a45ae5f8SJohn Marino /* C6x unwind section editing support.  */
923a45ae5f8SJohn Marino extern bfd_boolean elf32_tic6x_fix_exidx_coverage
924a45ae5f8SJohn Marino (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
925a45ae5f8SJohn Marino 
926cf7f2e2dSJohn Marino /* PowerPC @tls opcode transform/validate.  */
927cf7f2e2dSJohn Marino extern unsigned int _bfd_elf_ppc_at_tls_transform
928cf7f2e2dSJohn Marino   (unsigned int, unsigned int);
929cf7f2e2dSJohn Marino /* PowerPC @tprel opcode transform/validate.  */
930cf7f2e2dSJohn Marino extern unsigned int _bfd_elf_ppc_at_tprel_transform
931cf7f2e2dSJohn Marino   (unsigned int, unsigned int);
9325796c8dcSSimon Schubert 
933*ef5ccd6cSJohn Marino extern void bfd_elf64_aarch64_init_maps
934*ef5ccd6cSJohn Marino   (bfd *);
935*ef5ccd6cSJohn Marino 
936*ef5ccd6cSJohn Marino void bfd_elf64_aarch64_set_options
937*ef5ccd6cSJohn Marino   (bfd *, struct bfd_link_info *, int, int, int);
938*ef5ccd6cSJohn Marino 
939*ef5ccd6cSJohn Marino /* ELF AArch64 mapping symbol support.  */
940*ef5ccd6cSJohn Marino #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP	(1 << 0)
941*ef5ccd6cSJohn Marino #define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG	(1 << 1)
942*ef5ccd6cSJohn Marino #define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER	(1 << 2)
943*ef5ccd6cSJohn Marino #define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY	(~0)
944*ef5ccd6cSJohn Marino extern bfd_boolean bfd_is_aarch64_special_symbol_name
945*ef5ccd6cSJohn Marino   (const char * name, int type);
946*ef5ccd6cSJohn Marino 
947*ef5ccd6cSJohn Marino /* AArch64 stub generation support.  Called from the linker.  */
948*ef5ccd6cSJohn Marino extern int elf64_aarch64_setup_section_lists
949*ef5ccd6cSJohn Marino   (bfd *, struct bfd_link_info *);
950*ef5ccd6cSJohn Marino extern void elf64_aarch64_next_input_section
951*ef5ccd6cSJohn Marino   (struct bfd_link_info *, struct bfd_section *);
952*ef5ccd6cSJohn Marino extern bfd_boolean elf64_aarch64_size_stubs
953*ef5ccd6cSJohn Marino   (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
954*ef5ccd6cSJohn Marino    struct bfd_section * (*) (const char *, struct bfd_section *),
955*ef5ccd6cSJohn Marino    void (*) (void));
956*ef5ccd6cSJohn Marino extern bfd_boolean elf64_aarch64_build_stubs
957*ef5ccd6cSJohn Marino   (struct bfd_link_info *);
958*ef5ccd6cSJohn Marino 
9595796c8dcSSimon Schubert /* TI COFF load page support.  */
9605796c8dcSSimon Schubert extern void bfd_ticoff_set_section_load_page
9615796c8dcSSimon Schubert   (struct bfd_section *, int);
9625796c8dcSSimon Schubert 
9635796c8dcSSimon Schubert extern int bfd_ticoff_get_section_load_page
9645796c8dcSSimon Schubert   (struct bfd_section *);
9655796c8dcSSimon Schubert 
9665796c8dcSSimon Schubert /* H8/300 functions.  */
9675796c8dcSSimon Schubert extern bfd_vma bfd_h8300_pad_address
9685796c8dcSSimon Schubert   (bfd *, bfd_vma);
9695796c8dcSSimon Schubert 
9705796c8dcSSimon Schubert /* IA64 Itanium code generation.  Called from linker.  */
9715796c8dcSSimon Schubert extern void bfd_elf32_ia64_after_parse
9725796c8dcSSimon Schubert   (int);
9735796c8dcSSimon Schubert 
9745796c8dcSSimon Schubert extern void bfd_elf64_ia64_after_parse
9755796c8dcSSimon Schubert   (int);
9765796c8dcSSimon Schubert 
9775796c8dcSSimon Schubert /* This structure is used for a comdat section, as in PE.  A comdat
9785796c8dcSSimon Schubert    section is associated with a particular symbol.  When the linker
9795796c8dcSSimon Schubert    sees a comdat section, it keeps only one of the sections with a
9805796c8dcSSimon Schubert    given name and associated with a given symbol.  */
9815796c8dcSSimon Schubert 
9825796c8dcSSimon Schubert struct coff_comdat_info
9835796c8dcSSimon Schubert {
9845796c8dcSSimon Schubert   /* The name of the symbol associated with a comdat section.  */
9855796c8dcSSimon Schubert   const char *name;
9865796c8dcSSimon Schubert 
9875796c8dcSSimon Schubert   /* The local symbol table index of the symbol associated with a
9885796c8dcSSimon Schubert      comdat section.  This is only meaningful to the object file format
9895796c8dcSSimon Schubert      specific code; it is not an index into the list returned by
9905796c8dcSSimon Schubert      bfd_canonicalize_symtab.  */
9915796c8dcSSimon Schubert   long symbol;
9925796c8dcSSimon Schubert };
9935796c8dcSSimon Schubert 
9945796c8dcSSimon Schubert extern struct coff_comdat_info *bfd_coff_get_comdat_section
9955796c8dcSSimon Schubert   (bfd *, struct bfd_section *);
9965796c8dcSSimon Schubert 
997