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 int ldemul_parse_args
55 PARAMS ((int, char **));
56 extern bfd_boolean ldemul_unrecognized_file
57 PARAMS ((struct lang_input_statement_struct
*));
58 extern bfd_boolean ldemul_recognized_file
59 PARAMS ((struct lang_input_statement_struct
*));
60 extern bfd_boolean ldemul_open_dynamic_archive
61 PARAMS ((const char *, struct search_dirs
*,
62 struct lang_input_statement_struct
*));
63 extern char *ldemul_default_target
64 PARAMS ((int, char**));
65 extern void after_parse_default
67 extern void after_open_default
69 extern void after_allocation_default
71 extern void before_allocation_default
73 extern void set_output_arch_default
75 extern void syslib_default
77 extern void hll_default
79 extern int ldemul_find_potential_libraries
80 PARAMS ((char *, struct lang_input_statement_struct
*));
81 extern struct bfd_elf_version_expr
*ldemul_new_vers_pattern
82 PARAMS ((struct bfd_elf_version_expr
*));
84 typedef struct ld_emulation_xfer_struct
{
85 /* Run before parsing the command line and script file.
86 Set the architecture, maybe other things. */
87 void (*before_parse
) PARAMS ((void));
89 /* Handle the SYSLIB (low level library) script command. */
90 void (*syslib
) PARAMS ((char *));
92 /* Handle the HLL (high level library) script command. */
93 void (*hll
) PARAMS ((char *));
95 /* Run after parsing the command line and script file. */
96 void (*after_parse
) PARAMS ((void));
98 /* Run after opening all input files, and loading the symbols. */
99 void (*after_open
) PARAMS ((void));
101 /* Run after allocating output sections. */
102 void (*after_allocation
) PARAMS ( (void));
104 /* Set the output architecture and machine if possible. */
105 void (*set_output_arch
) PARAMS ((void));
107 /* Decide which target name to use. */
108 char * (*choose_target
) PARAMS ((int, char**));
110 /* Run before allocating output sections. */
111 void (*before_allocation
) PARAMS ((void));
113 /* Return the appropriate linker script. */
114 char * (*get_script
) PARAMS ((int *isfile
));
116 /* The name of this emulation. */
117 char *emulation_name
;
119 /* The output format. */
122 /* Run after assigning values from the script. */
123 void (*finish
) PARAMS ((void));
125 /* Create any output sections needed by the target. */
126 void (*create_output_section_statements
) PARAMS ((void));
128 /* Try to open a dynamic library. ARCH is an architecture name, and
129 is normally the empty string. ENTRY is the lang_input_statement
130 that should be opened. */
131 bfd_boolean (*open_dynamic_archive
)
132 PARAMS ((const char *arch
, struct search_dirs
*,
133 struct lang_input_statement_struct
*entry
));
135 /* Place an orphan section. Return TRUE if it was placed, FALSE if
136 the default action should be taken. This field may be NULL, in
137 which case the default action will always be taken. */
138 bfd_boolean (*place_orphan
)
139 PARAMS ((struct lang_input_statement_struct
*, asection
*));
141 /* Run after assigning parsing with the args, but before
142 reading the script. Used to initialize symbols used in the script. */
143 void (*set_symbols
) PARAMS ((void));
145 /* Run to parse args which the base linker doesn't
146 understand. Return non zero on sucess. */
147 int (*parse_args
) PARAMS ((int, char **));
149 /* Run to handle files which are not recognized as object files or
150 archives. Return TRUE if the file was handled. */
151 bfd_boolean (*unrecognized_file
)
152 PARAMS ((struct lang_input_statement_struct
*));
154 /* Run to list the command line options which parse_args handles. */
155 void (* list_options
) PARAMS ((FILE *));
157 /* Run to specially handle files which *are* recognized as object
158 files or archives. Return TRUE if the file was handled. */
159 bfd_boolean (*recognized_file
)
160 PARAMS ((struct lang_input_statement_struct
*));
162 /* Called when looking for libraries in a directory specified
163 via a linker command line option or linker script option.
164 Files that match the pattern "lib*.a" have already been scanned.
165 (For VMS files matching ":lib*.a" have also been scanned). */
166 int (* find_potential_libraries
)
167 PARAMS ((char *, struct lang_input_statement_struct
*));
169 /* Called when adding a new version pattern. PowerPC64-ELF uses
170 this hook to add a pattern matching ".foo" for every "foo". */
171 struct bfd_elf_version_expr
* (*new_vers_pattern
)
172 PARAMS ((struct bfd_elf_version_expr
*));
174 } ld_emulation_xfer_type
;
177 intel_ic960_ld_mode_enum
,
179 intel_gld960_ld_mode_enum
180 } lang_emulation_mode_enum_type
;
182 extern ld_emulation_xfer_type
*ld_emulations
[];