PR 868
[deliverable/binutils-gdb.git] / ld / ldemul.h
CommitLineData
252b5132 1/* ld-emul.h - Linker emulation header file
aef6203b 2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
f96b4a7b 3 2002, 2003, 2004, 2005, 2007
5cc18311 4 Free Software Foundation, Inc.
252b5132 5
f96b4a7b 6 This file is part of the GNU Binutils.
252b5132 7
f96b4a7b 8 This program is free software; you can redistribute it and/or modify
252b5132 9 it under the terms of the GNU General Public License as published by
f96b4a7b
NC
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
252b5132 12
f96b4a7b 13 This program is distributed in the hope that it will be useful,
252b5132
RH
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f96b4a7b
NC
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. */
252b5132
RH
22
23#ifndef LDEMUL_H
24#define LDEMUL_H
25
cb9faf63
BE
26/* Forward declaration for ldemul_add_options() and others. */
27struct option;
28
b34976b6 29extern void ldemul_hll
1579bae1 30 (char *);
b34976b6 31extern void ldemul_syslib
1579bae1 32 (char *);
b34976b6 33extern void ldemul_after_parse
1579bae1 34 (void);
b34976b6 35extern void ldemul_before_parse
1579bae1 36 (void);
b34976b6 37extern void ldemul_after_open
1579bae1 38 (void);
b34976b6 39extern void ldemul_after_allocation
1579bae1 40 (void);
b34976b6 41extern void ldemul_before_allocation
1579bae1 42 (void);
b34976b6 43extern void ldemul_set_output_arch
1579bae1 44 (void);
b34976b6 45extern char *ldemul_choose_target
1579bae1 46 (int, char**);
b34976b6 47extern void ldemul_choose_mode
1579bae1 48 (char *);
b34976b6 49extern void ldemul_list_emulations
1579bae1 50 (FILE *);
b34976b6 51extern void ldemul_list_emulation_options
1579bae1 52 (FILE *);
b34976b6 53extern char *ldemul_get_script
1579bae1 54 (int *isfile);
b34976b6 55extern void ldemul_finish
1579bae1 56 (void);
b34976b6 57extern void ldemul_set_symbols
1579bae1 58 (void);
b34976b6 59extern void ldemul_create_output_section_statements
1579bae1 60 (void);
b34976b6 61extern bfd_boolean ldemul_place_orphan
7b986e99 62 (asection *);
3bcf5557 63extern bfd_boolean ldemul_parse_args
1579bae1 64 (int, char **);
3bcf5557 65extern void ldemul_add_options
1579bae1 66 (int, char **, int, struct option **, int, struct option **);
3bcf5557 67extern bfd_boolean ldemul_handle_option
1579bae1 68 (int);
b34976b6 69extern bfd_boolean ldemul_unrecognized_file
1579bae1 70 (struct lang_input_statement_struct *);
b34976b6 71extern bfd_boolean ldemul_recognized_file
1579bae1 72 (struct lang_input_statement_struct *);
b34976b6 73extern bfd_boolean ldemul_open_dynamic_archive
1579bae1 74 (const char *, struct search_dirs *, struct lang_input_statement_struct *);
b34976b6 75extern char *ldemul_default_target
1579bae1 76 (int, char**);
b34976b6 77extern void after_parse_default
1579bae1 78 (void);
b34976b6 79extern void after_open_default
1579bae1 80 (void);
b34976b6 81extern void after_allocation_default
1579bae1 82 (void);
b34976b6 83extern void before_allocation_default
1579bae1 84 (void);
046183de 85extern void finish_default
5e797c2c 86 (void);
1e035701
AM
87extern void finish_default
88 (void);
b34976b6 89extern void set_output_arch_default
1579bae1 90 (void);
b34976b6 91extern void syslib_default
1579bae1 92 (char*);
b34976b6 93extern void hll_default
1579bae1 94 (char*);
344a211f 95extern int ldemul_find_potential_libraries
1579bae1 96 (char *, struct lang_input_statement_struct *);
fac1652d 97extern struct bfd_elf_version_expr *ldemul_new_vers_pattern
1579bae1 98 (struct bfd_elf_version_expr *);
252b5132 99
89cdebba 100typedef struct ld_emulation_xfer_struct {
252b5132
RH
101 /* Run before parsing the command line and script file.
102 Set the architecture, maybe other things. */
1579bae1 103 void (*before_parse) (void);
252b5132
RH
104
105 /* Handle the SYSLIB (low level library) script command. */
1579bae1 106 void (*syslib) (char *);
252b5132
RH
107
108 /* Handle the HLL (high level library) script command. */
1579bae1 109 void (*hll) (char *);
252b5132
RH
110
111 /* Run after parsing the command line and script file. */
1579bae1 112 void (*after_parse) (void);
252b5132
RH
113
114 /* Run after opening all input files, and loading the symbols. */
1579bae1 115 void (*after_open) (void);
252b5132
RH
116
117 /* Run after allocating output sections. */
1579bae1 118 void (*after_allocation) (void);
252b5132
RH
119
120 /* Set the output architecture and machine if possible. */
1579bae1 121 void (*set_output_arch) (void);
252b5132
RH
122
123 /* Decide which target name to use. */
1579bae1 124 char * (*choose_target) (int, char**);
252b5132
RH
125
126 /* Run before allocating output sections. */
1579bae1 127 void (*before_allocation) (void);
252b5132
RH
128
129 /* Return the appropriate linker script. */
1579bae1 130 char * (*get_script) (int *isfile);
252b5132
RH
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. */
1579bae1 139 void (*finish) (void);
252b5132
RH
140
141 /* Create any output sections needed by the target. */
1579bae1 142 void (*create_output_section_statements) (void);
252b5132
RH
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. */
b34976b6 147 bfd_boolean (*open_dynamic_archive)
1579bae1
AM
148 (const char *arch, struct search_dirs *,
149 struct lang_input_statement_struct *entry);
252b5132 150
b34976b6 151 /* Place an orphan section. Return TRUE if it was placed, FALSE if
252b5132
RH
152 the default action should be taken. This field may be NULL, in
153 which case the default action will always be taken. */
b34976b6 154 bfd_boolean (*place_orphan)
7b986e99 155 (asection *);
252b5132 156
5cc18311
KH
157 /* Run after assigning parsing with the args, but before
158 reading the script. Used to initialize symbols used in the script. */
1579bae1 159 void (*set_symbols) (void);
252b5132 160
3bcf5557 161 /* Parse args which the base linker doesn't understand.
3aa97c58 162 Return TRUE if the arg needs no further processing. */
1579bae1 163 bfd_boolean (*parse_args) (int, char **);
3bcf5557
AM
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)
1579bae1 168 (int, char **, int, struct option **, int, struct option **);
3bcf5557
AM
169
170 /* Companion to the above to handle an option. Returns TRUE if it is
171 one of our options. */
1579bae1 172 bfd_boolean (*handle_option) (int);
252b5132
RH
173
174 /* Run to handle files which are not recognized as object files or
b34976b6
AM
175 archives. Return TRUE if the file was handled. */
176 bfd_boolean (*unrecognized_file)
1579bae1 177 (struct lang_input_statement_struct *);
252b5132
RH
178
179 /* Run to list the command line options which parse_args handles. */
1579bae1 180 void (* list_options) (FILE *);
252b5132
RH
181
182 /* Run to specially handle files which *are* recognized as object
b34976b6
AM
183 files or archives. Return TRUE if the file was handled. */
184 bfd_boolean (*recognized_file)
1579bae1 185 (struct lang_input_statement_struct *);
252b5132 186
344a211f
NC
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)
1579bae1 192 (char *, struct lang_input_statement_struct *);
5cc18311 193
fac1652d
AM
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)
1579bae1 197 (struct bfd_elf_version_expr *);
fac1652d 198
252b5132
RH
199} ld_emulation_xfer_type;
200
89cdebba 201typedef enum {
252b5132 202 intel_ic960_ld_mode_enum,
89cdebba 203 default_mode_enum,
252b5132
RH
204 intel_gld960_ld_mode_enum
205} lang_emulation_mode_enum_type;
206
207extern ld_emulation_xfer_type *ld_emulations[];
208
209#endif
This page took 0.37867 seconds and 4 git commands to generate.