When examining weak symbols, follow indirect links.
[binutils.git] / ld / ldemul.h
blob3e275002ac50bc22461d3a32dbc650ebc0724275
1 /* ld-emul.h - Linker emulation header file
2 Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000
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 PARAMS ((char *));
21 extern void ldemul_syslib PARAMS ((char *));
22 extern void ldemul_after_parse PARAMS ((void));
23 extern void ldemul_before_parse PARAMS ((void));
24 extern void ldemul_after_open PARAMS ((void));
25 extern void ldemul_after_allocation PARAMS ((void));
26 extern void ldemul_before_allocation PARAMS ((void));
27 extern void ldemul_set_output_arch PARAMS ((void));
28 extern char *ldemul_choose_target PARAMS ((int, char**));
29 extern void ldemul_choose_mode PARAMS ((char *));
30 extern void ldemul_list_emulations PARAMS ((FILE *));
31 extern void ldemul_list_emulation_options PARAMS ((FILE *));
32 extern char *ldemul_get_script PARAMS ((int *isfile));
33 extern void ldemul_finish PARAMS ((void));
34 extern void ldemul_set_symbols PARAMS ((void));
35 extern void ldemul_create_output_section_statements PARAMS ((void));
36 extern boolean ldemul_place_orphan
37 PARAMS ((struct lang_input_statement_struct *, asection *));
38 extern int ldemul_parse_args PARAMS ((int, char **));
39 extern boolean ldemul_unrecognized_file
40 PARAMS ((struct lang_input_statement_struct *));
41 extern boolean ldemul_recognized_file
42 PARAMS ((struct lang_input_statement_struct *));
43 extern boolean ldemul_open_dynamic_archive
44 PARAMS ((const char *, struct search_dirs *,
45 struct lang_input_statement_struct *));
46 extern char *ldemul_default_target PARAMS ((int, char**));
47 extern void after_parse_default PARAMS ((void));
48 extern void after_open_default PARAMS ((void));
49 extern void after_allocation_default PARAMS ((void));
50 extern void before_allocation_default PARAMS ((void));
51 extern void set_output_arch_default PARAMS ((void));
52 extern void syslib_default PARAMS ((char*));
53 extern void hll_default PARAMS ((char*));
54 extern int ldemul_find_potential_libraries
55 PARAMS ((char *, struct lang_input_statement_struct *));
56 extern struct bfd_elf_version_expr *ldemul_new_vers_pattern
57 PARAMS ((struct bfd_elf_version_expr *));
59 typedef struct ld_emulation_xfer_struct {
60 /* Run before parsing the command line and script file.
61 Set the architecture, maybe other things. */
62 void (*before_parse) PARAMS ((void));
64 /* Handle the SYSLIB (low level library) script command. */
65 void (*syslib) PARAMS ((char *));
67 /* Handle the HLL (high level library) script command. */
68 void (*hll) PARAMS ((char *));
70 /* Run after parsing the command line and script file. */
71 void (*after_parse) PARAMS ((void));
73 /* Run after opening all input files, and loading the symbols. */
74 void (*after_open) PARAMS ((void));
76 /* Run after allocating output sections. */
77 void (*after_allocation) PARAMS ( (void));
79 /* Set the output architecture and machine if possible. */
80 void (*set_output_arch) PARAMS ((void));
82 /* Decide which target name to use. */
83 char * (*choose_target) PARAMS ((int, char**));
85 /* Run before allocating output sections. */
86 void (*before_allocation) PARAMS ((void));
88 /* Return the appropriate linker script. */
89 char * (*get_script) PARAMS ((int *isfile));
91 /* The name of this emulation. */
92 char *emulation_name;
94 /* The output format. */
95 char *target_name;
97 /* Run after assigning values from the script. */
98 void (*finish) PARAMS ((void));
100 /* Create any output sections needed by the target. */
101 void (*create_output_section_statements) PARAMS ((void));
103 /* Try to open a dynamic library. ARCH is an architecture name, and
104 is normally the empty string. ENTRY is the lang_input_statement
105 that should be opened. */
106 boolean (*open_dynamic_archive)
107 PARAMS ((const char *arch, struct search_dirs *,
108 struct lang_input_statement_struct *entry));
110 /* Place an orphan section. Return true if it was placed, false if
111 the default action should be taken. This field may be NULL, in
112 which case the default action will always be taken. */
113 boolean (*place_orphan)
114 PARAMS ((struct lang_input_statement_struct *, asection *));
116 /* Run after assigning parsing with the args, but before
117 reading the script. Used to initialize symbols used in the script. */
118 void (*set_symbols) PARAMS ((void));
120 /* Run to parse args which the base linker doesn't
121 understand. Return non zero on sucess. */
122 int (*parse_args) PARAMS ((int, char **));
124 /* Run to handle files which are not recognized as object files or
125 archives. Return true if the file was handled. */
126 boolean (*unrecognized_file)
127 PARAMS ((struct lang_input_statement_struct *));
129 /* Run to list the command line options which parse_args handles. */
130 void (* list_options) PARAMS ((FILE *));
132 /* Run to specially handle files which *are* recognized as object
133 files or archives. Return true if the file was handled. */
134 boolean (*recognized_file)
135 PARAMS ((struct lang_input_statement_struct *));
137 /* Called when looking for libraries in a directory specified
138 via a linker command line option or linker script option.
139 Files that match the pattern "lib*.a" have already been scanned.
140 (For VMS files matching ":lib*.a" have also been scanned). */
141 int (* find_potential_libraries)
142 PARAMS ((char *, struct lang_input_statement_struct *));
144 /* Called when adding a new version pattern. PowerPC64-ELF uses
145 this hook to add a pattern matching ".foo" for every "foo". */
146 struct bfd_elf_version_expr * (*new_vers_pattern)
147 PARAMS ((struct bfd_elf_version_expr *));
149 } ld_emulation_xfer_type;
151 typedef enum {
152 intel_ic960_ld_mode_enum,
153 default_mode_enum,
154 intel_gld960_ld_mode_enum
155 } lang_emulation_mode_enum_type;
157 extern ld_emulation_xfer_type *ld_emulations[];
159 #endif