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