| 1 | /* ld-emul.h - Linker emulation header file |
| 2 | Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GLD, the Gnu Linker. |
| 5 | |
| 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) |
| 9 | any later version. |
| 10 | |
| 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. */ |
| 15 | |
| 16 | #ifndef LDEMUL_H |
| 17 | #define LDEMUL_H |
| 18 | |
| 19 | #if ANSI_PROTOTYPES |
| 20 | struct lang_input_statement_struct; |
| 21 | struct search_dirs; |
| 22 | #endif |
| 23 | |
| 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_open_dynamic_archive |
| 46 | PARAMS ((const char *, struct search_dirs *, |
| 47 | struct lang_input_statement_struct *)); |
| 48 | extern char *ldemul_default_target PARAMS ((void)); |
| 49 | extern void after_parse_default PARAMS ((void)); |
| 50 | extern void after_open_default PARAMS ((void)); |
| 51 | extern void after_allocation_default PARAMS ((void)); |
| 52 | extern void before_allocation_default PARAMS ((void)); |
| 53 | extern void set_output_arch_default PARAMS ((void)); |
| 54 | extern void syslib_default PARAMS ((char*)); |
| 55 | extern void hll_default PARAMS ((char*)); |
| 56 | |
| 57 | typedef struct ld_emulation_xfer_struct |
| 58 | { |
| 59 | /* Run before parsing the command line and script file. |
| 60 | Set the architecture, maybe other things. */ |
| 61 | void (*before_parse) PARAMS ((void)); |
| 62 | |
| 63 | /* Handle the SYSLIB (low level library) script command. */ |
| 64 | void (*syslib) PARAMS ((char *)); |
| 65 | |
| 66 | /* Handle the HLL (high level library) script command. */ |
| 67 | void (*hll) PARAMS ((char *)); |
| 68 | |
| 69 | /* Run after parsing the command line and script file. */ |
| 70 | void (*after_parse) PARAMS ((void)); |
| 71 | |
| 72 | /* Run after opening all input files, and loading the symbols. */ |
| 73 | void (*after_open) PARAMS ((void)); |
| 74 | |
| 75 | /* Run after allocating output sections. */ |
| 76 | void (*after_allocation) PARAMS ( (void)); |
| 77 | |
| 78 | /* Set the output architecture and machine if possible. */ |
| 79 | void (*set_output_arch) PARAMS ((void)); |
| 80 | |
| 81 | /* Decide which target name to use. */ |
| 82 | char * (*choose_target) PARAMS ((void)); |
| 83 | |
| 84 | /* Run before allocating output sections. */ |
| 85 | void (*before_allocation) PARAMS ((void)); |
| 86 | |
| 87 | /* Return the appropriate linker script. */ |
| 88 | char * (*get_script) PARAMS ((int *isfile)); |
| 89 | |
| 90 | /* The name of this emulation. */ |
| 91 | char *emulation_name; |
| 92 | |
| 93 | /* The output format. */ |
| 94 | char *target_name; |
| 95 | |
| 96 | /* Run after assigning values from the script. */ |
| 97 | void (*finish) PARAMS ((void)); |
| 98 | |
| 99 | /* Create any output sections needed by the target. */ |
| 100 | void (*create_output_section_statements) PARAMS ((void)); |
| 101 | |
| 102 | /* Try to open a dynamic library. ARCH is an architecture name, and |
| 103 | is normally the empty string. ENTRY is the lang_input_statement |
| 104 | that should be opened. */ |
| 105 | boolean (*open_dynamic_archive) |
| 106 | PARAMS ((const char *arch, struct search_dirs *, |
| 107 | struct lang_input_statement_struct *entry)); |
| 108 | |
| 109 | /* Place an orphan section. Return true if it was placed, false if |
| 110 | the default action should be taken. This field may be NULL, in |
| 111 | which case the default action will always be taken. */ |
| 112 | boolean (*place_orphan) |
| 113 | PARAMS ((struct lang_input_statement_struct *, asection *)); |
| 114 | |
| 115 | /* Run after assigning parsing with the args, but before |
| 116 | reading the script. Used to initialize symbols used in the script. */ |
| 117 | void (*set_symbols) PARAMS ((void)); |
| 118 | |
| 119 | /* Run to parse args which the base linker doesn't |
| 120 | understand. Return non zero on sucess. */ |
| 121 | int (*parse_args) PARAMS ((int, char **)); |
| 122 | |
| 123 | /* Run to handle files which are not recognized as object files or |
| 124 | archives. Return true if the file was handled. */ |
| 125 | boolean (*unrecognized_file) |
| 126 | PARAMS ((struct lang_input_statement_struct *)); |
| 127 | |
| 128 | /* Run to list the command line options which parse_args handles. */ |
| 129 | void (* list_options) PARAMS ((FILE *)); |
| 130 | |
| 131 | /* Run to specially handle files which *are* recognized as object |
| 132 | files or archives. Return true if the file was handled. */ |
| 133 | boolean (*recognized_file) |
| 134 | PARAMS ((struct lang_input_statement_struct *)); |
| 135 | |
| 136 | } ld_emulation_xfer_type; |
| 137 | |
| 138 | typedef enum |
| 139 | { |
| 140 | intel_ic960_ld_mode_enum, |
| 141 | default_mode_enum , |
| 142 | intel_gld960_ld_mode_enum |
| 143 | } lang_emulation_mode_enum_type; |
| 144 | |
| 145 | extern ld_emulation_xfer_type *ld_emulations[]; |
| 146 | |
| 147 | #endif |