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