1 /* ld-emul.h - Linker emulation header file
2 Copyright 1991, 92, 93, 94, 95, 96, 97, 1998, 2000 Free Software Foundation, Inc.
4 This file is part of GLD, the Gnu Linker.
6 GLD is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 1, or (at your option)
11 GLD is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. */
20 struct lang_input_statement_struct;
24 extern void ldemul_hll PARAMS ((char *));
25 extern void ldemul_syslib PARAMS ((char *));
26 extern void ldemul_after_parse PARAMS ((void));
27 extern void ldemul_before_parse PARAMS ((void));
28 extern void ldemul_after_open PARAMS ((void));
29 extern void ldemul_after_allocation PARAMS ((void));
30 extern void ldemul_before_allocation PARAMS ((void));
31 extern void ldemul_set_output_arch PARAMS ((void));
32 extern char *ldemul_choose_target PARAMS ((void));
33 extern void ldemul_choose_mode PARAMS ((char *));
34 extern void ldemul_list_emulations PARAMS ((FILE *));
35 extern void ldemul_list_emulation_options PARAMS ((FILE *));
36 extern char *ldemul_get_script PARAMS ((int *isfile));
37 extern void ldemul_finish PARAMS ((void));
38 extern void ldemul_set_symbols PARAMS ((void));
39 extern void ldemul_create_output_section_statements PARAMS ((void));
40 extern boolean ldemul_place_orphan
41 PARAMS ((struct lang_input_statement_struct *, asection *));
42 extern int ldemul_parse_args PARAMS ((int, char **));
43 extern boolean ldemul_unrecognized_file
44 PARAMS ((struct lang_input_statement_struct *));
45 extern boolean ldemul_recognized_file
46 PARAMS ((struct lang_input_statement_struct *));
47 extern boolean ldemul_open_dynamic_archive
48 PARAMS ((const char *, struct search_dirs *,
49 struct lang_input_statement_struct *));
50 extern char *ldemul_default_target PARAMS ((void));
51 extern void after_parse_default PARAMS ((void));
52 extern void after_open_default PARAMS ((void));
53 extern void after_allocation_default PARAMS ((void));
54 extern void before_allocation_default PARAMS ((void));
55 extern void set_output_arch_default PARAMS ((void));
56 extern void syslib_default PARAMS ((char*));
57 extern void hll_default PARAMS ((char*));
58 extern int ldemul_find_potential_libraries
59 PARAMS ((char *, struct lang_input_statement_struct *));
61 typedef struct ld_emulation_xfer_struct
63 /* Run before parsing the command line and script file.
64 Set the architecture, maybe other things. */
65 void (*before_parse) PARAMS ((void));
67 /* Handle the SYSLIB (low level library) script command. */
68 void (*syslib) PARAMS ((char *));
70 /* Handle the HLL (high level library) script command. */
71 void (*hll) PARAMS ((char *));
73 /* Run after parsing the command line and script file. */
74 void (*after_parse) PARAMS ((void));
76 /* Run after opening all input files, and loading the symbols. */
77 void (*after_open) PARAMS ((void));
79 /* Run after allocating output sections. */
80 void (*after_allocation) PARAMS ( (void));
82 /* Set the output architecture and machine if possible. */
83 void (*set_output_arch) PARAMS ((void));
85 /* Decide which target name to use. */
86 char * (*choose_target) PARAMS ((void));
88 /* Run before allocating output sections. */
89 void (*before_allocation) PARAMS ((void));
91 /* Return the appropriate linker script. */
92 char * (*get_script) PARAMS ((int *isfile));
94 /* The name of this emulation. */
97 /* The output format. */
100 /* Run after assigning values from the script. */
101 void (*finish) PARAMS ((void));
103 /* Create any output sections needed by the target. */
104 void (*create_output_section_statements) PARAMS ((void));
106 /* Try to open a dynamic library. ARCH is an architecture name, and
107 is normally the empty string. ENTRY is the lang_input_statement
108 that should be opened. */
109 boolean (*open_dynamic_archive)
110 PARAMS ((const char *arch, struct search_dirs *,
111 struct lang_input_statement_struct *entry));
113 /* Place an orphan section. Return true if it was placed, false if
114 the default action should be taken. This field may be NULL, in
115 which case the default action will always be taken. */
116 boolean (*place_orphan)
117 PARAMS ((struct lang_input_statement_struct *, asection *));
119 /* Run after assigning parsing with the args, but before
120 reading the script. Used to initialize symbols used in the script. */
121 void (*set_symbols) PARAMS ((void));
123 /* Run to parse args which the base linker doesn't
124 understand. Return non zero on sucess. */
125 int (*parse_args) PARAMS ((int, char **));
127 /* Run to handle files which are not recognized as object files or
128 archives. Return true if the file was handled. */
129 boolean (*unrecognized_file)
130 PARAMS ((struct lang_input_statement_struct *));
132 /* Run to list the command line options which parse_args handles. */
133 void (* list_options) PARAMS ((FILE *));
135 /* Run to specially handle files which *are* recognized as object
136 files or archives. Return true if the file was handled. */
137 boolean (*recognized_file)
138 PARAMS ((struct lang_input_statement_struct *));
140 /* Called when looking for libraries in a directory specified
141 via a linker command line option or linker script option.
142 Files that match the pattern "lib*.a" have already been scanned.
143 (For VMS files matching ":lib*.a" have also been scanned). */
144 int (* find_potential_libraries)
145 PARAMS ((char *, struct lang_input_statement_struct *));
147 } ld_emulation_xfer_type;
151 intel_ic960_ld_mode_enum,
153 intel_gld960_ld_mode_enum
154 } lang_emulation_mode_enum_type;
156 extern ld_emulation_xfer_type *ld_emulations[];