1 /* ld-emul.h - Linker emulation header file
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002
3 Free Software Foundation, Inc.
5 This file is part of GLD, the Gnu Linker.
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)
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. */
20 extern void ldemul_hll
22 extern void ldemul_syslib
24 extern void ldemul_after_parse
26 extern void ldemul_before_parse
28 extern void ldemul_after_open
30 extern void ldemul_after_allocation
32 extern void ldemul_before_allocation
34 extern void ldemul_set_output_arch
36 extern char *ldemul_choose_target
37 PARAMS ((int, char**));
38 extern void ldemul_choose_mode
40 extern void ldemul_list_emulations
42 extern void ldemul_list_emulation_options
44 extern char *ldemul_get_script
45 PARAMS ((int *isfile
));
46 extern void ldemul_finish
48 extern void ldemul_set_symbols
50 extern void ldemul_create_output_section_statements
52 extern bfd_boolean ldemul_place_orphan
53 PARAMS ((struct lang_input_statement_struct
*, asection
*));
54 extern bfd_boolean ldemul_parse_args
55 PARAMS ((int, char **));
56 extern void ldemul_add_options
57 PARAMS ((int, char **, int, struct option
**, int, struct option
**));
58 extern bfd_boolean ldemul_handle_option
60 extern bfd_boolean ldemul_unrecognized_file
61 PARAMS ((struct lang_input_statement_struct
*));
62 extern bfd_boolean ldemul_recognized_file
63 PARAMS ((struct lang_input_statement_struct
*));
64 extern bfd_boolean ldemul_open_dynamic_archive
65 PARAMS ((const char *, struct search_dirs
*,
66 struct lang_input_statement_struct
*));
67 extern char *ldemul_default_target
68 PARAMS ((int, char**));
69 extern void after_parse_default
71 extern void after_open_default
73 extern void after_allocation_default
75 extern void before_allocation_default
77 extern void set_output_arch_default
79 extern void syslib_default
81 extern void hll_default
83 extern int ldemul_find_potential_libraries
84 PARAMS ((char *, struct lang_input_statement_struct
*));
85 extern struct bfd_elf_version_expr
*ldemul_new_vers_pattern
86 PARAMS ((struct bfd_elf_version_expr
*));
88 typedef struct ld_emulation_xfer_struct
{
89 /* Run before parsing the command line and script file.
90 Set the architecture, maybe other things. */
91 void (*before_parse
) PARAMS ((void));
93 /* Handle the SYSLIB (low level library) script command. */
94 void (*syslib
) PARAMS ((char *));
96 /* Handle the HLL (high level library) script command. */
97 void (*hll
) PARAMS ((char *));
99 /* Run after parsing the command line and script file. */
100 void (*after_parse
) PARAMS ((void));
102 /* Run after opening all input files, and loading the symbols. */
103 void (*after_open
) PARAMS ((void));
105 /* Run after allocating output sections. */
106 void (*after_allocation
) PARAMS ( (void));
108 /* Set the output architecture and machine if possible. */
109 void (*set_output_arch
) PARAMS ((void));
111 /* Decide which target name to use. */
112 char * (*choose_target
) PARAMS ((int, char**));
114 /* Run before allocating output sections. */
115 void (*before_allocation
) PARAMS ((void));
117 /* Return the appropriate linker script. */
118 char * (*get_script
) PARAMS ((int *isfile
));
120 /* The name of this emulation. */
121 char *emulation_name
;
123 /* The output format. */
126 /* Run after assigning values from the script. */
127 void (*finish
) PARAMS ((void));
129 /* Create any output sections needed by the target. */
130 void (*create_output_section_statements
) PARAMS ((void));
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. */
135 bfd_boolean (*open_dynamic_archive
)
136 PARAMS ((const char *arch
, struct search_dirs
*,
137 struct lang_input_statement_struct
*entry
));
139 /* Place an orphan section. Return TRUE if it was placed, FALSE if
140 the default action should be taken. This field may be NULL, in
141 which case the default action will always be taken. */
142 bfd_boolean (*place_orphan
)
143 PARAMS ((struct lang_input_statement_struct
*, asection
*));
145 /* Run after assigning parsing with the args, but before
146 reading the script. Used to initialize symbols used in the script. */
147 void (*set_symbols
) PARAMS ((void));
149 /* Parse args which the base linker doesn't understand.
150 Return TRUE if the arg needs no further processing. */
151 bfd_boolean (*parse_args
) PARAMS ((int, char **));
153 /* Hook to add options to parameters passed by the base linker to
154 getopt_long and getopt_long_only calls. */
156 PARAMS ((int, char **, int, struct option
**, int, struct option
**));
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));
162 /* Run to handle files which are not recognized as object files or
163 archives. Return TRUE if the file was handled. */
164 bfd_boolean (*unrecognized_file
)
165 PARAMS ((struct lang_input_statement_struct
*));
167 /* Run to list the command line options which parse_args handles. */
168 void (* list_options
) PARAMS ((FILE *));
170 /* Run to specially handle files which *are* recognized as object
171 files or archives. Return TRUE if the file was handled. */
172 bfd_boolean (*recognized_file
)
173 PARAMS ((struct lang_input_statement_struct
*));
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
*));
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
*));
187 } ld_emulation_xfer_type
;
190 intel_ic960_ld_mode_enum
,
192 intel_gld960_ld_mode_enum
193 } lang_emulation_mode_enum_type
;
195 extern ld_emulation_xfer_type
*ld_emulations
[];