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