1 /* ld-emul.h - Linker emulation header file
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
4 Free Software Foundation, Inc.
6 This file is part of GLD, the Gnu Linker.
8 GLD 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 1, or (at your option)
13 GLD 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. */
21 /* Forward declaration for ldemul_add_options() and others. */
24 extern void ldemul_hll
26 extern void ldemul_syslib
28 extern void ldemul_after_parse
30 extern void ldemul_before_parse
32 extern void ldemul_after_open
34 extern void ldemul_after_allocation
36 extern void ldemul_before_allocation
38 extern void ldemul_set_output_arch
40 extern char *ldemul_choose_target
42 extern void ldemul_choose_mode
44 extern void ldemul_list_emulations
46 extern void ldemul_list_emulation_options
48 extern char *ldemul_get_script
50 extern void ldemul_finish
52 extern void ldemul_set_symbols
54 extern void ldemul_create_output_section_statements
56 extern bfd_boolean ldemul_place_orphan
57 (struct lang_input_statement_struct
*, asection
*);
58 extern bfd_boolean ldemul_parse_args
60 extern void ldemul_add_options
61 (int, char **, int, struct option
**, int, struct option
**);
62 extern bfd_boolean ldemul_handle_option
64 extern bfd_boolean ldemul_unrecognized_file
65 (struct lang_input_statement_struct
*);
66 extern bfd_boolean ldemul_recognized_file
67 (struct lang_input_statement_struct
*);
68 extern bfd_boolean ldemul_open_dynamic_archive
69 (const char *, struct search_dirs
*, struct lang_input_statement_struct
*);
70 extern char *ldemul_default_target
72 extern void after_parse_default
74 extern void after_open_default
76 extern void after_allocation_default
78 extern void before_allocation_default
80 extern void set_output_arch_default
82 extern void syslib_default
84 extern void hll_default
86 extern int ldemul_find_potential_libraries
87 (char *, struct lang_input_statement_struct
*);
88 extern struct bfd_elf_version_expr
*ldemul_new_vers_pattern
89 (struct bfd_elf_version_expr
*);
91 typedef struct ld_emulation_xfer_struct
{
92 /* Run before parsing the command line and script file.
93 Set the architecture, maybe other things. */
94 void (*before_parse
) (void);
96 /* Handle the SYSLIB (low level library) script command. */
97 void (*syslib
) (char *);
99 /* Handle the HLL (high level library) script command. */
100 void (*hll
) (char *);
102 /* Run after parsing the command line and script file. */
103 void (*after_parse
) (void);
105 /* Run after opening all input files, and loading the symbols. */
106 void (*after_open
) (void);
108 /* Run after allocating output sections. */
109 void (*after_allocation
) (void);
111 /* Set the output architecture and machine if possible. */
112 void (*set_output_arch
) (void);
114 /* Decide which target name to use. */
115 char * (*choose_target
) (int, char**);
117 /* Run before allocating output sections. */
118 void (*before_allocation
) (void);
120 /* Return the appropriate linker script. */
121 char * (*get_script
) (int *isfile
);
123 /* The name of this emulation. */
124 char *emulation_name
;
126 /* The output format. */
129 /* Run after assigning values from the script. */
130 void (*finish
) (void);
132 /* Create any output sections needed by the target. */
133 void (*create_output_section_statements
) (void);
135 /* Try to open a dynamic library. ARCH is an architecture name, and
136 is normally the empty string. ENTRY is the lang_input_statement
137 that should be opened. */
138 bfd_boolean (*open_dynamic_archive
)
139 (const char *arch
, struct search_dirs
*,
140 struct lang_input_statement_struct
*entry
);
142 /* Place an orphan section. Return TRUE if it was placed, FALSE if
143 the default action should be taken. This field may be NULL, in
144 which case the default action will always be taken. */
145 bfd_boolean (*place_orphan
)
146 (struct lang_input_statement_struct
*, asection
*);
148 /* Run after assigning parsing with the args, but before
149 reading the script. Used to initialize symbols used in the script. */
150 void (*set_symbols
) (void);
152 /* Parse args which the base linker doesn't understand.
153 Return TRUE if the arg needs no further processing. */
154 bfd_boolean (*parse_args
) (int, char **);
156 /* Hook to add options to parameters passed by the base linker to
157 getopt_long and getopt_long_only calls. */
159 (int, char **, int, struct option
**, int, struct option
**);
161 /* Companion to the above to handle an option. Returns TRUE if it is
162 one of our options. */
163 bfd_boolean (*handle_option
) (int);
165 /* Run to handle files which are not recognized as object files or
166 archives. Return TRUE if the file was handled. */
167 bfd_boolean (*unrecognized_file
)
168 (struct lang_input_statement_struct
*);
170 /* Run to list the command line options which parse_args handles. */
171 void (* list_options
) (FILE *);
173 /* Run to specially handle files which *are* recognized as object
174 files or archives. Return TRUE if the file was handled. */
175 bfd_boolean (*recognized_file
)
176 (struct lang_input_statement_struct
*);
178 /* Called when looking for libraries in a directory specified
179 via a linker command line option or linker script option.
180 Files that match the pattern "lib*.a" have already been scanned.
181 (For VMS files matching ":lib*.a" have also been scanned). */
182 int (* find_potential_libraries
)
183 (char *, struct lang_input_statement_struct
*);
185 /* Called when adding a new version pattern. PowerPC64-ELF uses
186 this hook to add a pattern matching ".foo" for every "foo". */
187 struct bfd_elf_version_expr
* (*new_vers_pattern
)
188 (struct bfd_elf_version_expr
*);
190 } ld_emulation_xfer_type
;
193 intel_ic960_ld_mode_enum
,
195 intel_gld960_ld_mode_enum
196 } lang_emulation_mode_enum_type
;
198 extern ld_emulation_xfer_type
*ld_emulations
[];