include/opcode/
[binutils.git] / ld / ldemul.h
bloba048b72ddc8e258781c53b8bcc97a69823fccf94
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)
10 any later version.
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. */
17 #ifndef LDEMUL_H
18 #define LDEMUL_H
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
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
66 PARAMS ((void));
67 extern void after_open_default
68 PARAMS ((void));
69 extern void after_allocation_default
70 PARAMS ((void));
71 extern void before_allocation_default
72 PARAMS ((void));
73 extern void set_output_arch_default
74 PARAMS ((void));
75 extern void syslib_default
76 PARAMS ((char*));
77 extern void hll_default
78 PARAMS ((char*));
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. */
120 char *target_name;
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;
176 typedef enum {
177 intel_ic960_ld_mode_enum,
178 default_mode_enum,
179 intel_gld960_ld_mode_enum
180 } lang_emulation_mode_enum_type;
182 extern ld_emulation_xfer_type *ld_emulations[];
184 #endif