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