Add bfd_get_bits() and bfd_put_bits().
[deliverable/binutils-gdb.git] / bfd / bfd-in2.h
index 45167f9759eed9f4b8947bab0bfab7519d2f86db..5fe2b47ae9bf795253c5706fd47c9d84dfa9348c 100644 (file)
@@ -84,7 +84,7 @@ typedef struct _bfd bfd;
 /* General rules: functions which are boolean return true on success
    and false on failure (unless they're a predicate).   -- bfd.doc */
 /* I'm sure this is going to break something and someone is going to
-   force me to change it. */
+   force me to change it.  */
 /* typedef enum boolean {false, true} boolean; */
 /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
 /* It gets worse if the host also defines a true/false enum... -sts */
@@ -93,7 +93,7 @@ typedef struct _bfd bfd;
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif
 #ifdef MPW
-/* Pre-emptive strike - get the file with the enum. */
+/* Pre-emptive strike - get the file with the enum.  */
 #include <Types.h>
 #define TRUE_FALSE_ALREADY_DEFINED
 #endif /* MPW */
@@ -177,8 +177,8 @@ typedef unsigned long symvalue;
 typedef unsigned long bfd_size_type;
 
 /* Print a bfd_vma x on stream s.  */
-#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
-#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
+#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
+#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
 
 #endif /* not BFD64  */
 
@@ -284,7 +284,6 @@ typedef struct carsym {
   file_ptr file_offset;                /* look here to find the file */
 } carsym;                      /* to make these you call a carsymogen */
 
-
 /* Used in generating armaps (archive tables of contents).
    Perhaps just a forward definition would do? */
 struct orl {                   /* output ranlib */
@@ -344,7 +343,7 @@ typedef struct _symbol_info
   char type;
   CONST char *name;            /* Symbol name.  */
   unsigned char stab_type;     /* Stab type.  */
-  char stab_other;             /* Stab other. */
+  char stab_other;             /* Stab other.  */
   short stab_desc;             /* Stab desc.  */
   CONST char *stab_name;       /* String for stab type.  */
 } symbol_info;
@@ -481,7 +480,6 @@ extern long bfd_tell PARAMS ((bfd *abfd));
 extern int bfd_flush PARAMS ((bfd *abfd));
 extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
 
-
 /* Cast from const char * to char * so that caller can assign to
    a char * without a warning.  */
 #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
@@ -514,7 +512,7 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
 
 #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
 
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean) (bool)), true)
 
 extern boolean bfd_record_phdr
   PARAMS ((bfd *, unsigned long, boolean, flagword, boolean, bfd_vma,
@@ -540,6 +538,11 @@ void               bfd_putb32         PARAMS ((bfd_vma, unsigned char *));
 void           bfd_putl32         PARAMS ((bfd_vma, unsigned char *));
 void           bfd_putb16         PARAMS ((bfd_vma, unsigned char *));
 void           bfd_putl16         PARAMS ((bfd_vma, unsigned char *));
+
+/* Byte swapping routines which take size and endiannes as arguments.  */
+
+bfd_vma         bfd_get_bits       PARAMS ((bfd_byte *, int, boolean));
+void            bfd_put_bits       PARAMS ((bfd_vma, bfd_byte *, int, boolean));
 \f
 /* Externally visible ECOFF routines.  */
 
@@ -629,6 +632,8 @@ extern boolean bfd_elf64_size_dynamic_sections
 extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
 extern void bfd_elf_set_dt_needed_soname PARAMS ((bfd *, const char *));
 extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
+extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
+  PARAMS ((bfd *, struct bfd_link_info *));
 
 /* Return an upper bound on the number of bytes required to store a
    copy of ABFD's program header table entries.  Return -1 if an error
@@ -647,9 +652,13 @@ extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
 /* Return the arch_size field of an elf bfd, or -1 if not elf.  */
 extern int bfd_get_arch_size PARAMS ((bfd *));
 
-/* Return true if address "naturally" sign extends, or -1 if not elf. */
+/* Return true if address "naturally" sign extends, or -1 if not elf.  */
 extern int bfd_get_sign_extend_vma PARAMS ((bfd *));
 
+extern boolean bfd_m68k_elf32_create_embedded_relocs
+  PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+          char **));
+
 /* SunOS shared library support routines for the linker.  */
 
 extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
@@ -762,7 +771,7 @@ extern boolean bfd_elf32_arm_process_before_allocation
 extern boolean bfd_elf32_arm_get_bfd_for_interworking
   PARAMS ((bfd *, struct bfd_link_info *));
 
-/* TI COFF load page support. */
+/* TI COFF load page support.  */
 extern void bfd_ticoff_set_section_load_page
   PARAMS ((struct sec *, int));
 
@@ -907,10 +916,6 @@ struct bfd_comdat_info
      specific code; it is not an index into the list returned by
      bfd_canonicalize_symtab.  */
   long symbol;
-
-  /* If this section is being discarded, the linker uses this field
-     to point to the input section which is being kept.  */
-  struct sec *sec;
 };
 
 typedef struct sec
@@ -1006,6 +1011,14 @@ typedef struct sec
      sections.  */
 #define SEC_COFF_SHARED_LIBRARY 0x800
 
+  /* The section has GOT references.  This flag is only for the
+     linker, and is currently only used by the elf32-hppa back end.
+     It will be set if global offset table references were detected
+     in this section, which indicate to the linker that the section
+     contains PIC code, and must be handled specially when doing a
+     static link.  */
+#define SEC_HAS_GOT_REF 0x4000
+
   /* The section contains common symbols (symbols may be defined
      multiple times, the value of a symbol is the amount of
      space it requires, and the largest symbol value is the one
@@ -1105,6 +1118,9 @@ typedef struct sec
   /* A mark flag used by some linker backends for garbage collection.  */
   unsigned int gc_mark : 1;
 
+  /* Used by the ELF code to mark sections which have been allocated to segments.  */
+  unsigned int segment_mark : 1;
+
   /* End of internal packed boolean fields.  */
 
   /*  The virtual memory address of the section - where it will be
@@ -1202,6 +1218,10 @@ typedef struct sec
 
   struct bfd_comdat_info *comdat;
 
+  /* Points to the kept section if this section is a link-once section,
+     and is discarded.  */
+  struct sec *kept_section;
+
   /* When a section is being output, this value changes as more
      linenumbers are written out.  */
 
@@ -1269,6 +1289,11 @@ extern const struct symbol_cache_entry * const bfd_ind_symbol;
 asection *
 bfd_get_section_by_name PARAMS ((bfd *abfd, const char *name));
 
+char *
+bfd_get_unique_section_name PARAMS ((bfd *abfd,
+    const char *templat,
+    int *count));
+
 asection *
 bfd_make_section_old_way PARAMS ((bfd *abfd, const char *name));
 
@@ -1283,7 +1308,7 @@ bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
 
 void 
 bfd_map_over_sections PARAMS ((bfd *abfd,
-    void (*func)(bfd *abfd,
+    void (*func) (bfd *abfd,
     asection *sect,
     PTR obj),
     PTR obj));
@@ -1314,7 +1339,7 @@ void
 _bfd_strip_section_from_output
  PARAMS ((struct bfd_link_info *info, asection *section));
 
-enum bfd_architecture 
+enum bfd_architecture
 {
   bfd_arch_unknown,   /* File arch not known */
   bfd_arch_obscure,   /* Arch known, not one of these */
@@ -1327,14 +1352,14 @@ enum bfd_architecture
 #define bfd_mach_m68040 6
 #define bfd_mach_m68060 7
 #define bfd_mach_cpu32  8
-  bfd_arch_vax,       /* DEC Vax */   
+  bfd_arch_vax,       /* DEC Vax */
   bfd_arch_i960,      /* Intel 960 */
     /* The order of the following is important.
-       lower number indicates a machine type that 
+       lower number indicates a machine type that
        only accepts a subset of the instructions
        available to machines with higher numbers.
        The exception is the "ca", which is
-       incompatible with all other machines except 
+       incompatible with all other machines except
        "core". */
 
 #define bfd_mach_i960_core      1
@@ -1357,9 +1382,12 @@ enum bfd_architecture
 #define bfd_mach_sparc_sparclite_le    6
 #define bfd_mach_sparc_v9              7
 #define bfd_mach_sparc_v9a             8 /* with ultrasparc add'ns */
+#define bfd_mach_sparc_v8plusb         9 /* with cheetah add'ns */
+#define bfd_mach_sparc_v9b             10 /* with cheetah add'ns */
 /* Nonzero if MACH has the v9 instruction set.  */
 #define bfd_mach_sparc_v9_p(mach) \
-  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
+  ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
+   && (mach) != bfd_mach_sparc_sparclite_le)
   bfd_arch_mips,      /* MIPS Rxxxx */
 #define bfd_mach_mips3000              3000
 #define bfd_mach_mips3900              3900
@@ -1376,10 +1404,17 @@ enum bfd_architecture
 #define bfd_mach_mips8000              8000
 #define bfd_mach_mips10000             10000
 #define bfd_mach_mips16                16
+#define bfd_mach_mips32                32
+#define bfd_mach_mips32_4k             3204113 /* 32, 04, octal 'K' */
+#define bfd_mach_mips5                 5
+#define bfd_mach_mips64                64
+#define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
   bfd_arch_i386,      /* Intel 386 */
 #define bfd_mach_i386_i386 0
 #define bfd_mach_i386_i8086 1
 #define bfd_mach_i386_i386_intel_syntax 2
+#define bfd_mach_x86_64 3
+#define bfd_mach_x86_64_intel_syntax 4
   bfd_arch_we32k,     /* AT&T WE32xxx */
   bfd_arch_tahoe,     /* CCI/Harris Tahoe */
   bfd_arch_i860,      /* Intel 860 */
@@ -1449,6 +1484,8 @@ enum bfd_architecture
 #define bfd_mach_arm_4T        6
 #define bfd_mach_arm_5         7
 #define bfd_mach_arm_5T        8
+#define bfd_mach_arm_5TE       9
+#define bfd_mach_arm_XScale    10
   bfd_arch_ns32k,     /* National Semiconductors ns32000 */
   bfd_arch_w65,       /* WDC 65816 */
   bfd_arch_tic30,     /* Texas Instruments TMS320C30 */
@@ -1471,6 +1508,8 @@ enum bfd_architecture
 #define bfd_mach_fr30          0x46523330
   bfd_arch_mcore,
   bfd_arch_ia64,      /* HP/Intel ia64 */
+#define bfd_mach_ia64_elf64    0
+#define bfd_mach_ia64_elf32    1
   bfd_arch_pj,
   bfd_arch_avr,       /* Atmel AVR microcontrollers */
 #define bfd_mach_avr1          1
@@ -1482,7 +1521,7 @@ enum bfd_architecture
   bfd_arch_last
   };
 
-typedef struct bfd_arch_info 
+typedef struct bfd_arch_info
 {
   int bits_per_word;
   int bits_per_address;
@@ -1493,7 +1532,7 @@ typedef struct bfd_arch_info
   const char *printable_name;
   unsigned int section_align_power;
   /* True if this is the default machine for the architecture.  */
-  boolean the_default; 
+  boolean the_default;
   const struct bfd_arch_info * (*compatible)
        PARAMS ((const struct bfd_arch_info *a,
                 const struct bfd_arch_info *b));
@@ -2031,6 +2070,16 @@ to compensate for the borrow when the low bits are added. */
   BFD_RELOC_386_GOTOFF,
   BFD_RELOC_386_GOTPC,
 
+/* x86-64/elf relocations */
+  BFD_RELOC_X86_64_GOT32,
+  BFD_RELOC_X86_64_PLT32,
+  BFD_RELOC_X86_64_COPY,
+  BFD_RELOC_X86_64_GLOB_DAT,
+  BFD_RELOC_X86_64_JUMP_SLOT,
+  BFD_RELOC_X86_64_RELATIVE,
+  BFD_RELOC_X86_64_GOTPCREL,
+  BFD_RELOC_X86_64_32S,
+
 /* ns32k relocations */
   BFD_RELOC_NS32K_IMM_8,
   BFD_RELOC_NS32K_IMM_16,
@@ -2157,6 +2206,11 @@ field in the instruction. */
   BFD_RELOC_SH_LABEL,
   BFD_RELOC_SH_LOOP_START,
   BFD_RELOC_SH_LOOP_END,
+  BFD_RELOC_SH_COPY,
+  BFD_RELOC_SH_GLOB_DAT,
+  BFD_RELOC_SH_JMP_SLOT,
+  BFD_RELOC_SH_RELATIVE,
+  BFD_RELOC_SH_GOTPC,
 
 /* Thumb 23-, 12- and 9-bit pc-relative branches.  The lowest bit must
 be zero and is not stored in the instruction. */
@@ -2530,7 +2584,6 @@ this offset in the reloc's section offset. */
   BFD_RELOC_IA64_LTOFF_FPTR64I,
   BFD_RELOC_IA64_LTOFF_FPTR64MSB,
   BFD_RELOC_IA64_LTOFF_FPTR64LSB,
-  BFD_RELOC_IA64_SEGBASE,
   BFD_RELOC_IA64_SEGREL32MSB,
   BFD_RELOC_IA64_SEGREL32LSB,
   BFD_RELOC_IA64_SEGREL64MSB,
@@ -2549,8 +2602,6 @@ this offset in the reloc's section offset. */
   BFD_RELOC_IA64_LTV64LSB,
   BFD_RELOC_IA64_IPLTMSB,
   BFD_RELOC_IA64_IPLTLSB,
-  BFD_RELOC_IA64_EPLTMSB,
-  BFD_RELOC_IA64_EPLTLSB,
   BFD_RELOC_IA64_COPY,
   BFD_RELOC_IA64_TPREL22,
   BFD_RELOC_IA64_TPREL64MSB,
@@ -2782,10 +2833,10 @@ bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymb
 #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
      BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
                (ibfd, isymbol, obfd, osymbol))
-struct _bfd 
+struct _bfd
 {
     /* The filename the application opened the BFD with.  */
-    CONST char *filename;                
+    CONST char *filename;
 
     /* A pointer to the target jump table.             */
     const struct bfd_target *xvec;
@@ -2818,7 +2869,7 @@ struct _bfd
     /* When a file is closed by the caching routines, BFD retains
        state information on the file here: */
 
-    file_ptr where;              
+    file_ptr where;
 
     /* and here: (``once'' means at least once) */
 
@@ -2831,7 +2882,7 @@ struct _bfd
 
     /* File modified time, if mtime_set is true: */
 
-    long mtime;          
+    long mtime;
 
     /* Reserved for an unimplemented file locking extension.*/
 
@@ -2850,13 +2901,13 @@ struct _bfd
 
     /* Format_specific flags*/
 
-    flagword flags;              
+    flagword flags;
 
     /* Currently my_archive is tested before adding origin to
        anything. I believe that this can become always an add of
        origin, with origin set to 0 for non archive files.   */
 
-    file_ptr origin;             
+    file_ptr origin;
 
     /* Remember when output has begun, to stop strange things
        from happening. */
@@ -2868,7 +2919,7 @@ struct _bfd
     /* The number of sections */
     unsigned int section_count;
 
-    /* Stuff only useful for object files: 
+    /* Stuff only useful for object files:
        The start address. */
     bfd_vma start_address;
 
@@ -2876,17 +2927,17 @@ struct _bfd
     unsigned int symcount;
 
     /* Symbol table for output BFD (with symcount entries) */
-    struct symbol_cache_entry  **outsymbols;             
+    struct symbol_cache_entry  **outsymbols;
 
     /* Pointer to structure which contains architecture information*/
     const struct bfd_arch_info *arch_info;
 
     /* Stuff only useful for archives:*/
-    PTR arelt_data;              
+    PTR arelt_data;
     struct _bfd *my_archive;     /* The containing archive BFD.  */
     struct _bfd *next;           /* The next BFD in the archive.  */
     struct _bfd *archive_head;   /* The first BFD in the archive.  */
-    boolean has_armap;           
+    boolean has_armap;
 
     /* A chain of BFD structures involved in a link.  */
     struct _bfd *link_next;
@@ -2897,7 +2948,7 @@ struct _bfd
 
     /* Used by the back end to hold private data. */
 
-    union 
+    union
       {
       struct aout_data_struct *aout_data;
       struct artdata *aout_ar_data;
@@ -2929,7 +2980,7 @@ struct _bfd
       struct netbsd_core_struct *netbsd_core_data;
       PTR any;
       } tdata;
-  
+
     /* Used by the application to hold private data*/
     PTR usrdata;
 
@@ -3140,13 +3191,13 @@ core_file_matches_executable_p
     (bfd_assert (__FILE__,__LINE__), NULL))
 #endif
 #define BFD_SEND_FMT(bfd, message, arglist) \
-            (((bfd)->xvec->message[(int)((bfd)->format)]) arglist)
+            (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
 
 #ifdef DEBUG_BFD_SEND
 #undef BFD_SEND_FMT
 #define BFD_SEND_FMT(bfd, message, arglist) \
   (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
-   (((bfd)->xvec->message[(int)((bfd)->format)]) arglist) : \
+   (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
    (bfd_assert (__FILE__,__LINE__), NULL))
 #endif
 enum bfd_flavour {
@@ -3181,10 +3232,10 @@ typedef struct bfd_target
   enum bfd_flavour flavour;
   enum bfd_endian byteorder;
   enum bfd_endian header_byteorder;
-  flagword object_flags;       
+  flagword object_flags;
   flagword section_flags;
   char symbol_leading_char;
-  char ar_pad_char;            
+  char ar_pad_char;
   unsigned short ar_max_namelen;
   bfd_vma      (*bfd_getx64) PARAMS ((const bfd_byte *));
   bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));
@@ -3223,7 +3274,7 @@ CAT(NAME,_get_section_contents_in_window)
   /* Called when a new section is created.  */
   boolean       (*_new_section_hook) PARAMS ((bfd *, sec_ptr));
   /* Read the contents of a section.  */
-  boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR, 
+  boolean       (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,
                                             file_ptr, bfd_size_type));
   boolean       (*_bfd_get_section_contents_in_window)
                           PARAMS ((bfd *, sec_ptr, bfd_window *,
@@ -3247,7 +3298,7 @@ CAT(NAME,_bfd_print_private_bfd_data)\
      to another.  */
   boolean       (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
                                                        bfd *, sec_ptr));
-  /* Called to copy BFD private symbol data from one symbol 
+  /* Called to copy BFD private symbol data from one symbol
      to another.  */
   boolean       (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
                                                           bfd *, asymbol *));
@@ -3283,10 +3334,10 @@ CAT(NAME,_update_armap_timestamp)
   boolean  (*_bfd_construct_extended_name_table)
              PARAMS ((bfd *, char **, bfd_size_type *, const char **));
   void     (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
-  boolean  (*write_armap) PARAMS ((bfd *arch, 
+  boolean  (*write_armap) PARAMS ((bfd *arch,
                               unsigned int elength,
                               struct orl *map,
-                              unsigned int orl_count, 
+                              unsigned int orl_count,
                               int stridx));
   PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));
   bfd *    (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
@@ -3419,11 +3470,11 @@ CAT(NAME,_canonicalize_dynamic_reloc)
   long  (*_bfd_canonicalize_dynamic_reloc)
     PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
 
- /* Opposite endian version of this target.  */  
+ /* Opposite endian version of this target.  */
  const struct bfd_target * alternative_target;
+
  PTR backend_data;
+
 } bfd_target;
 boolean 
 bfd_set_default_target  PARAMS ((const char *name));
@@ -3435,7 +3486,7 @@ const char **
 bfd_target_list PARAMS ((void));
 
 const bfd_target * 
-bfd_search_for_target  PARAMS ((int (* search_func)(const bfd_target *, void *), void *));
+bfd_search_for_target  PARAMS ((int (* search_func) (const bfd_target *, void *), void *));
 
 boolean 
 bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
This page took 0.03749 seconds and 4 git commands to generate.