| 1 |
205 |
julius |
/* ld-emul.h - Linker emulation header file
|
| 2 |
|
|
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
|
| 3 |
|
|
2002, 2003, 2004, 2005, 2007, 2008
|
| 4 |
|
|
Free Software Foundation, Inc.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of the GNU Binutils.
|
| 7 |
|
|
|
| 8 |
|
|
This program is free software; you can redistribute it and/or modify
|
| 9 |
|
|
it under the terms of the GNU General Public License as published by
|
| 10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
| 11 |
|
|
(at your option) any later version.
|
| 12 |
|
|
|
| 13 |
|
|
This program is distributed in the hope that it will be useful,
|
| 14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 16 |
|
|
GNU General Public License for more details.
|
| 17 |
|
|
|
| 18 |
|
|
You should have received a copy of the GNU General Public License
|
| 19 |
|
|
along with this program; if not, write to the Free Software
|
| 20 |
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
| 21 |
|
|
MA 02110-1301, USA. */
|
| 22 |
|
|
|
| 23 |
|
|
#ifndef LDEMUL_H
|
| 24 |
|
|
#define LDEMUL_H
|
| 25 |
|
|
|
| 26 |
|
|
/* Forward declaration for ldemul_add_options() and others. */
|
| 27 |
|
|
struct option;
|
| 28 |
|
|
|
| 29 |
|
|
extern void ldemul_hll
|
| 30 |
|
|
(char *);
|
| 31 |
|
|
extern void ldemul_syslib
|
| 32 |
|
|
(char *);
|
| 33 |
|
|
extern void ldemul_after_parse
|
| 34 |
|
|
(void);
|
| 35 |
|
|
extern void ldemul_before_parse
|
| 36 |
|
|
(void);
|
| 37 |
|
|
extern void ldemul_after_open
|
| 38 |
|
|
(void);
|
| 39 |
|
|
extern void ldemul_after_allocation
|
| 40 |
|
|
(void);
|
| 41 |
|
|
extern void ldemul_before_allocation
|
| 42 |
|
|
(void);
|
| 43 |
|
|
extern void ldemul_set_output_arch
|
| 44 |
|
|
(void);
|
| 45 |
|
|
extern char *ldemul_choose_target
|
| 46 |
|
|
(int, char**);
|
| 47 |
|
|
extern void ldemul_choose_mode
|
| 48 |
|
|
(char *);
|
| 49 |
|
|
extern void ldemul_list_emulations
|
| 50 |
|
|
(FILE *);
|
| 51 |
|
|
extern void ldemul_list_emulation_options
|
| 52 |
|
|
(FILE *);
|
| 53 |
|
|
extern char *ldemul_get_script
|
| 54 |
|
|
(int *isfile);
|
| 55 |
|
|
extern void ldemul_finish
|
| 56 |
|
|
(void);
|
| 57 |
|
|
extern void ldemul_set_symbols
|
| 58 |
|
|
(void);
|
| 59 |
|
|
extern void ldemul_create_output_section_statements
|
| 60 |
|
|
(void);
|
| 61 |
|
|
extern lang_output_section_statement_type *ldemul_place_orphan
|
| 62 |
|
|
(asection *, const char *, int);
|
| 63 |
|
|
extern bfd_boolean ldemul_parse_args
|
| 64 |
|
|
(int, char **);
|
| 65 |
|
|
extern void ldemul_add_options
|
| 66 |
|
|
(int, char **, int, struct option **, int, struct option **);
|
| 67 |
|
|
extern bfd_boolean ldemul_handle_option
|
| 68 |
|
|
(int);
|
| 69 |
|
|
extern bfd_boolean ldemul_unrecognized_file
|
| 70 |
|
|
(struct lang_input_statement_struct *);
|
| 71 |
|
|
extern bfd_boolean ldemul_recognized_file
|
| 72 |
|
|
(struct lang_input_statement_struct *);
|
| 73 |
|
|
extern bfd_boolean ldemul_open_dynamic_archive
|
| 74 |
|
|
(const char *, struct search_dirs *, struct lang_input_statement_struct *);
|
| 75 |
|
|
extern char *ldemul_default_target
|
| 76 |
|
|
(int, char**);
|
| 77 |
|
|
extern void after_parse_default
|
| 78 |
|
|
(void);
|
| 79 |
|
|
extern void after_open_default
|
| 80 |
|
|
(void);
|
| 81 |
|
|
extern void after_allocation_default
|
| 82 |
|
|
(void);
|
| 83 |
|
|
extern void before_allocation_default
|
| 84 |
|
|
(void);
|
| 85 |
|
|
extern void finish_default
|
| 86 |
|
|
(void);
|
| 87 |
|
|
extern void finish_default
|
| 88 |
|
|
(void);
|
| 89 |
|
|
extern void set_output_arch_default
|
| 90 |
|
|
(void);
|
| 91 |
|
|
extern void syslib_default
|
| 92 |
|
|
(char*);
|
| 93 |
|
|
extern void hll_default
|
| 94 |
|
|
(char*);
|
| 95 |
|
|
extern int ldemul_find_potential_libraries
|
| 96 |
|
|
(char *, struct lang_input_statement_struct *);
|
| 97 |
|
|
extern struct bfd_elf_version_expr *ldemul_new_vers_pattern
|
| 98 |
|
|
(struct bfd_elf_version_expr *);
|
| 99 |
|
|
|
| 100 |
|
|
typedef struct ld_emulation_xfer_struct {
|
| 101 |
|
|
/* Run before parsing the command line and script file.
|
| 102 |
|
|
Set the architecture, maybe other things. */
|
| 103 |
|
|
void (*before_parse) (void);
|
| 104 |
|
|
|
| 105 |
|
|
/* Handle the SYSLIB (low level library) script command. */
|
| 106 |
|
|
void (*syslib) (char *);
|
| 107 |
|
|
|
| 108 |
|
|
/* Handle the HLL (high level library) script command. */
|
| 109 |
|
|
void (*hll) (char *);
|
| 110 |
|
|
|
| 111 |
|
|
/* Run after parsing the command line and script file. */
|
| 112 |
|
|
void (*after_parse) (void);
|
| 113 |
|
|
|
| 114 |
|
|
/* Run after opening all input files, and loading the symbols. */
|
| 115 |
|
|
void (*after_open) (void);
|
| 116 |
|
|
|
| 117 |
|
|
/* Run after allocating output sections. */
|
| 118 |
|
|
void (*after_allocation) (void);
|
| 119 |
|
|
|
| 120 |
|
|
/* Set the output architecture and machine if possible. */
|
| 121 |
|
|
void (*set_output_arch) (void);
|
| 122 |
|
|
|
| 123 |
|
|
/* Decide which target name to use. */
|
| 124 |
|
|
char * (*choose_target) (int, char**);
|
| 125 |
|
|
|
| 126 |
|
|
/* Run before allocating output sections. */
|
| 127 |
|
|
void (*before_allocation) (void);
|
| 128 |
|
|
|
| 129 |
|
|
/* Return the appropriate linker script. */
|
| 130 |
|
|
char * (*get_script) (int *isfile);
|
| 131 |
|
|
|
| 132 |
|
|
/* The name of this emulation. */
|
| 133 |
|
|
char *emulation_name;
|
| 134 |
|
|
|
| 135 |
|
|
/* The output format. */
|
| 136 |
|
|
char *target_name;
|
| 137 |
|
|
|
| 138 |
|
|
/* Run after assigning values from the script. */
|
| 139 |
|
|
void (*finish) (void);
|
| 140 |
|
|
|
| 141 |
|
|
/* Create any output sections needed by the target. */
|
| 142 |
|
|
void (*create_output_section_statements) (void);
|
| 143 |
|
|
|
| 144 |
|
|
/* Try to open a dynamic library. ARCH is an architecture name, and
|
| 145 |
|
|
is normally the empty string. ENTRY is the lang_input_statement
|
| 146 |
|
|
that should be opened. */
|
| 147 |
|
|
bfd_boolean (*open_dynamic_archive)
|
| 148 |
|
|
(const char *arch, struct search_dirs *,
|
| 149 |
|
|
struct lang_input_statement_struct *entry);
|
| 150 |
|
|
|
| 151 |
|
|
/* Place an orphan section. Return TRUE if it was placed, FALSE if
|
| 152 |
|
|
the default action should be taken. This field may be NULL, in
|
| 153 |
|
|
which case the default action will always be taken. */
|
| 154 |
|
|
lang_output_section_statement_type *(*place_orphan)
|
| 155 |
|
|
(asection *, const char *, int);
|
| 156 |
|
|
|
| 157 |
|
|
/* Run after assigning parsing with the args, but before
|
| 158 |
|
|
reading the script. Used to initialize symbols used in the script. */
|
| 159 |
|
|
void (*set_symbols) (void);
|
| 160 |
|
|
|
| 161 |
|
|
/* Parse args which the base linker doesn't understand.
|
| 162 |
|
|
Return TRUE if the arg needs no further processing. */
|
| 163 |
|
|
bfd_boolean (*parse_args) (int, char **);
|
| 164 |
|
|
|
| 165 |
|
|
/* Hook to add options to parameters passed by the base linker to
|
| 166 |
|
|
getopt_long and getopt_long_only calls. */
|
| 167 |
|
|
void (*add_options)
|
| 168 |
|
|
(int, char **, int, struct option **, int, struct option **);
|
| 169 |
|
|
|
| 170 |
|
|
/* Companion to the above to handle an option. Returns TRUE if it is
|
| 171 |
|
|
one of our options. */
|
| 172 |
|
|
bfd_boolean (*handle_option) (int);
|
| 173 |
|
|
|
| 174 |
|
|
/* Run to handle files which are not recognized as object files or
|
| 175 |
|
|
archives. Return TRUE if the file was handled. */
|
| 176 |
|
|
bfd_boolean (*unrecognized_file)
|
| 177 |
|
|
(struct lang_input_statement_struct *);
|
| 178 |
|
|
|
| 179 |
|
|
/* Run to list the command line options which parse_args handles. */
|
| 180 |
|
|
void (* list_options) (FILE *);
|
| 181 |
|
|
|
| 182 |
|
|
/* Run to specially handle files which *are* recognized as object
|
| 183 |
|
|
files or archives. Return TRUE if the file was handled. */
|
| 184 |
|
|
bfd_boolean (*recognized_file)
|
| 185 |
|
|
(struct lang_input_statement_struct *);
|
| 186 |
|
|
|
| 187 |
|
|
/* Called when looking for libraries in a directory specified
|
| 188 |
|
|
via a linker command line option or linker script option.
|
| 189 |
|
|
Files that match the pattern "lib*.a" have already been scanned.
|
| 190 |
|
|
(For VMS files matching ":lib*.a" have also been scanned). */
|
| 191 |
|
|
int (* find_potential_libraries)
|
| 192 |
|
|
(char *, struct lang_input_statement_struct *);
|
| 193 |
|
|
|
| 194 |
|
|
/* Called when adding a new version pattern. PowerPC64-ELF uses
|
| 195 |
|
|
this hook to add a pattern matching ".foo" for every "foo". */
|
| 196 |
|
|
struct bfd_elf_version_expr * (*new_vers_pattern)
|
| 197 |
|
|
(struct bfd_elf_version_expr *);
|
| 198 |
|
|
|
| 199 |
|
|
} ld_emulation_xfer_type;
|
| 200 |
|
|
|
| 201 |
|
|
typedef enum {
|
| 202 |
|
|
intel_ic960_ld_mode_enum,
|
| 203 |
|
|
default_mode_enum,
|
| 204 |
|
|
intel_gld960_ld_mode_enum
|
| 205 |
|
|
} lang_emulation_mode_enum_type;
|
| 206 |
|
|
|
| 207 |
|
|
extern ld_emulation_xfer_type *ld_emulations[];
|
| 208 |
|
|
|
| 209 |
|
|
#endif
|