Back to index

cell-binutils  2.17cvs20070401
ldemul.h
Go to the documentation of this file.
00001 /* ld-emul.h - Linker emulation header file
00002    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
00003    2002, 2003, 2004, 2005
00004    Free Software Foundation, Inc.
00005 
00006    This file is part of GLD, the Gnu Linker.
00007 
00008    GLD is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 1, or (at your option)
00011    any later version.
00012 
00013    GLD is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.  */
00017 
00018 #ifndef LDEMUL_H
00019 #define LDEMUL_H
00020 
00021 /* Forward declaration for ldemul_add_options() and others.  */
00022 struct option;
00023 
00024 extern void ldemul_hll
00025   (char *);
00026 extern void ldemul_syslib
00027   (char *);
00028 extern void ldemul_after_parse
00029   (void);
00030 extern void ldemul_before_parse
00031   (void);
00032 extern void ldemul_after_open
00033   (void);
00034 extern void ldemul_after_allocation
00035   (void);
00036 extern void ldemul_before_allocation
00037   (void);
00038 extern void ldemul_set_output_arch
00039   (void);
00040 extern char *ldemul_choose_target
00041   (int, char**);
00042 extern void ldemul_choose_mode
00043   (char *);
00044 extern void ldemul_list_emulations
00045   (FILE *);
00046 extern void ldemul_list_emulation_options
00047   (FILE *);
00048 extern char *ldemul_get_script
00049   (int *isfile);
00050 extern void ldemul_finish
00051   (void);
00052 extern void ldemul_set_symbols
00053   (void);
00054 extern void ldemul_create_output_section_statements
00055   (void);
00056 extern bfd_boolean ldemul_place_orphan
00057   (asection *);
00058 extern bfd_boolean ldemul_parse_args
00059   (int, char **);
00060 extern void ldemul_add_options
00061   (int, char **, int, struct option **, int, struct option **);
00062 extern bfd_boolean ldemul_handle_option
00063   (int);
00064 extern bfd_boolean ldemul_unrecognized_file
00065   (struct lang_input_statement_struct *);
00066 extern bfd_boolean ldemul_recognized_file
00067   (struct lang_input_statement_struct *);
00068 extern bfd_boolean ldemul_open_dynamic_archive
00069   (const char *, struct search_dirs *, struct lang_input_statement_struct *);
00070 extern char *ldemul_default_target
00071   (int, char**);
00072 extern void after_parse_default
00073   (void);
00074 extern void after_open_default
00075   (void);
00076 extern void after_allocation_default
00077   (void);
00078 extern void before_allocation_default
00079   (void);
00080 extern void finish_default
00081   (void);
00082 extern void finish_default
00083   (void);
00084 extern void set_output_arch_default
00085   (void);
00086 extern void syslib_default
00087   (char*);
00088 extern void hll_default
00089   (char*);
00090 extern int  ldemul_find_potential_libraries
00091   (char *, struct lang_input_statement_struct *);
00092 extern struct bfd_elf_version_expr *ldemul_new_vers_pattern
00093   (struct bfd_elf_version_expr *);
00094 
00095 typedef struct ld_emulation_xfer_struct {
00096   /* Run before parsing the command line and script file.
00097      Set the architecture, maybe other things.  */
00098   void   (*before_parse) (void);
00099 
00100   /* Handle the SYSLIB (low level library) script command.  */
00101   void   (*syslib) (char *);
00102 
00103   /* Handle the HLL (high level library) script command.  */
00104   void   (*hll) (char *);
00105 
00106   /* Run after parsing the command line and script file.  */
00107   void   (*after_parse) (void);
00108 
00109   /* Run after opening all input files, and loading the symbols.  */
00110   void   (*after_open) (void);
00111 
00112   /* Run after allocating output sections.  */
00113   void   (*after_allocation)  (void);
00114 
00115   /* Set the output architecture and machine if possible.  */
00116   void   (*set_output_arch) (void);
00117 
00118   /* Decide which target name to use.  */
00119   char * (*choose_target) (int, char**);
00120 
00121   /* Run before allocating output sections.  */
00122   void   (*before_allocation) (void);
00123 
00124   /* Return the appropriate linker script.  */
00125   char * (*get_script) (int *isfile);
00126 
00127   /* The name of this emulation.  */
00128   char *emulation_name;
00129 
00130   /* The output format.  */
00131   char *target_name;
00132 
00133   /* Run after assigning values from the script.  */
00134   void (*finish) (void);
00135 
00136   /* Create any output sections needed by the target.  */
00137   void (*create_output_section_statements) (void);
00138 
00139   /* Try to open a dynamic library.  ARCH is an architecture name, and
00140      is normally the empty string.  ENTRY is the lang_input_statement
00141      that should be opened.  */
00142   bfd_boolean (*open_dynamic_archive)
00143     (const char *arch, struct search_dirs *,
00144      struct lang_input_statement_struct *entry);
00145 
00146   /* Place an orphan section.  Return TRUE if it was placed, FALSE if
00147      the default action should be taken.  This field may be NULL, in
00148      which case the default action will always be taken.  */
00149   bfd_boolean (*place_orphan)
00150     (asection *);
00151 
00152   /* Run after assigning parsing with the args, but before
00153      reading the script.  Used to initialize symbols used in the script.  */
00154   void (*set_symbols) (void);
00155 
00156   /* Parse args which the base linker doesn't understand.
00157      Return TRUE if the arg needs no further processing.  */
00158   bfd_boolean (*parse_args) (int, char **);
00159 
00160   /* Hook to add options to parameters passed by the base linker to
00161      getopt_long and getopt_long_only calls.  */
00162   void (*add_options)
00163     (int, char **, int, struct option **, int, struct option **);
00164 
00165   /* Companion to the above to handle an option.  Returns TRUE if it is
00166      one of our options.  */
00167   bfd_boolean (*handle_option) (int);
00168 
00169   /* Run to handle files which are not recognized as object files or
00170      archives.  Return TRUE if the file was handled.  */
00171   bfd_boolean (*unrecognized_file)
00172     (struct lang_input_statement_struct *);
00173 
00174   /* Run to list the command line options which parse_args handles.  */
00175   void (* list_options) (FILE *);
00176 
00177   /* Run to specially handle files which *are* recognized as object
00178      files or archives.  Return TRUE if the file was handled.  */
00179   bfd_boolean (*recognized_file)
00180     (struct lang_input_statement_struct *);
00181 
00182   /* Called when looking for libraries in a directory specified
00183      via a linker command line option or linker script option.
00184      Files that match the pattern "lib*.a" have already been scanned.
00185      (For VMS files matching ":lib*.a" have also been scanned).  */
00186   int (* find_potential_libraries)
00187     (char *, struct lang_input_statement_struct *);
00188 
00189   /* Called when adding a new version pattern.  PowerPC64-ELF uses
00190      this hook to add a pattern matching ".foo" for every "foo".  */
00191   struct bfd_elf_version_expr * (*new_vers_pattern)
00192     (struct bfd_elf_version_expr *);
00193 
00194 } ld_emulation_xfer_type;
00195 
00196 typedef enum {
00197   intel_ic960_ld_mode_enum,
00198   default_mode_enum,
00199   intel_gld960_ld_mode_enum
00200 } lang_emulation_mode_enum_type;
00201 
00202 extern ld_emulation_xfer_type *ld_emulations[];
00203 
00204 #endif