00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _LIBELF_H_
00027 #define _LIBELF_H_ 1
00028
00029 #include "elf/common.h"
00030 #include "elf/internal.h"
00031 #include "elf/external.h"
00032 #include "bfdlink.h"
00033
00034
00035
00036
00037 #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)
00038
00039
00040 #ifndef NAME
00041 #if ARCH_SIZE == 64
00042 #define NAME(x, y) x ## 64 ## _ ## y
00043 #endif
00044 #if ARCH_SIZE == 32
00045 #define NAME(x, y) x ## 32 ## _ ## y
00046 #endif
00047 #endif
00048
00049 #ifndef NAME
00050 #define NAME(x, y) x ## NOSIZE ## _ ## y
00051 #endif
00052
00053 #define ElfNAME(X) NAME(Elf,X)
00054 #define elfNAME(X) NAME(elf,X)
00055
00056
00057
00058
00059
00060
00061 typedef struct
00062 {
00063
00064 asymbol symbol;
00065
00066 Elf_Internal_Sym internal_elf_sym;
00067
00068 union
00069 {
00070 unsigned int hppa_arg_reloc;
00071 void *mips_extr;
00072 void *any;
00073 }
00074 tc_data;
00075
00076
00077
00078
00079 unsigned short version;
00080
00081 } elf_symbol_type;
00082
00083 struct elf_strtab_hash;
00084 struct got_entry;
00085 struct plt_entry;
00086
00087
00088
00089 struct elf_link_hash_entry
00090 {
00091 struct bfd_link_hash_entry root;
00092
00093
00094
00095 long indx;
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 long dynindx;
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 union gotplt_union
00121 {
00122 bfd_signed_vma refcount;
00123 bfd_vma offset;
00124 struct got_entry *glist;
00125 struct plt_entry *plist;
00126 } got;
00127
00128
00129 union gotplt_union plt;
00130
00131
00132 bfd_size_type size;
00133
00134
00135 unsigned int type : 8;
00136
00137
00138 unsigned int other : 8;
00139
00140
00141 unsigned int ref_regular : 1;
00142
00143 unsigned int def_regular : 1;
00144
00145 unsigned int ref_dynamic : 1;
00146
00147 unsigned int def_dynamic : 1;
00148
00149 unsigned int ref_regular_nonweak : 1;
00150
00151 unsigned int dynamic_adjusted : 1;
00152
00153 unsigned int needs_copy : 1;
00154
00155 unsigned int needs_plt : 1;
00156
00157 unsigned int non_elf : 1;
00158
00159 unsigned int hidden : 1;
00160
00161 unsigned int forced_local : 1;
00162
00163 unsigned int mark : 1;
00164
00165
00166 unsigned int non_got_ref : 1;
00167
00168
00169
00170 unsigned int dynamic_def : 1;
00171
00172 unsigned int dynamic_weak : 1;
00173
00174
00175 unsigned int pointer_equality_needed : 1;
00176
00177
00178 unsigned long dynstr_index;
00179
00180 union
00181 {
00182
00183
00184
00185 struct elf_link_hash_entry *weakdef;
00186
00187
00188
00189
00190 unsigned long elf_hash_value;
00191 } u;
00192
00193
00194 union
00195 {
00196
00197
00198
00199 Elf_Internal_Verdef *verdef;
00200
00201
00202
00203 struct bfd_elf_version_tree *vertree;
00204 } verinfo;
00205
00206 struct
00207 {
00208
00209
00210
00211
00212 size_t size;
00213 bfd_boolean *used;
00214
00215
00216 struct elf_link_hash_entry *parent;
00217 } *vtable;
00218
00219 #ifdef IPA_LINK
00220
00221 long ipa_indx;
00222 #endif
00223 };
00224
00225
00226
00227
00228
00229
00230
00231 #define SYMBOL_REFERENCES_LOCAL(INFO, H) \
00232 _bfd_elf_symbol_refs_local_p (H, INFO, 0)
00233
00234
00235 #define SYMBOL_CALLS_LOCAL(INFO, H) \
00236 _bfd_elf_symbol_refs_local_p (H, INFO, 1)
00237
00238
00239
00240 #define ELF_COMMON_DEF_P(H) \
00241 (!(H)->def_regular \
00242 && !(H)->def_dynamic \
00243 && (H)->root.type == bfd_link_hash_defined)
00244
00245
00246
00247 struct elf_link_local_dynamic_entry
00248 {
00249 struct elf_link_local_dynamic_entry *next;
00250
00251
00252 bfd *input_bfd;
00253
00254
00255 long input_indx;
00256
00257
00258 long dynindx;
00259
00260
00261 Elf_Internal_Sym isym;
00262 };
00263
00264 struct elf_link_loaded_list
00265 {
00266 struct elf_link_loaded_list *next;
00267 bfd *abfd;
00268 };
00269
00270
00271 struct cie_header
00272 {
00273 unsigned int length;
00274 unsigned int id;
00275 };
00276
00277 struct cie
00278 {
00279 struct cie_header hdr;
00280 unsigned char version;
00281 char augmentation[20];
00282 bfd_vma code_align;
00283 bfd_signed_vma data_align;
00284 bfd_vma ra_column;
00285 bfd_vma augmentation_size;
00286 struct elf_link_hash_entry *personality;
00287 unsigned char per_encoding;
00288 unsigned char lsda_encoding;
00289 unsigned char fde_encoding;
00290 unsigned char initial_insn_length;
00291 unsigned char make_relative;
00292 unsigned char make_lsda_relative;
00293 unsigned char initial_instructions[50];
00294 };
00295
00296 struct eh_cie_fde
00297 {
00298
00299 struct eh_cie_fde *cie_inf;
00300 unsigned int size;
00301 unsigned int offset;
00302 unsigned int new_offset;
00303 unsigned char fde_encoding;
00304 unsigned char lsda_encoding;
00305 unsigned char lsda_offset;
00306 unsigned int cie : 1;
00307 unsigned int removed : 1;
00308 unsigned int add_augmentation_size : 1;
00309 unsigned int add_fde_encoding : 1;
00310 unsigned int make_relative : 1;
00311 unsigned int make_lsda_relative : 1;
00312 unsigned int need_lsda_relative : 1;
00313 unsigned int per_encoding_relative : 1;
00314 };
00315
00316 struct eh_frame_sec_info
00317 {
00318 unsigned int count;
00319 unsigned int alloced;
00320 struct eh_cie_fde entry[1];
00321 };
00322
00323 struct eh_frame_array_ent
00324 {
00325 bfd_vma initial_loc;
00326 bfd_vma fde;
00327 };
00328
00329 struct eh_frame_hdr_info
00330 {
00331 struct cie last_cie;
00332 asection *last_cie_sec;
00333 struct eh_cie_fde *last_cie_inf;
00334 asection *hdr_sec;
00335 unsigned int fde_count, array_count;
00336 struct eh_frame_array_ent *array;
00337
00338
00339
00340 bfd_boolean table;
00341 bfd_boolean offsets_adjusted;
00342 };
00343
00344
00345
00346 struct elf_link_hash_table
00347 {
00348 struct bfd_link_hash_table root;
00349
00350
00351
00352 bfd_boolean dynamic_sections_created;
00353
00354
00355
00356
00357 bfd *dynobj;
00358
00359
00360
00361
00362
00363 union gotplt_union init_refcount;
00364
00365
00366
00367 union gotplt_union init_offset;
00368
00369
00370
00371 bfd_size_type dynsymcount;
00372
00373
00374
00375 struct elf_strtab_hash *dynstr;
00376
00377
00378
00379 bfd_size_type bucketcount;
00380
00381
00382
00383 struct bfd_link_needed_list *needed;
00384
00385
00386 struct elf_link_hash_entry *hgot;
00387
00388
00389 void *merge_info;
00390
00391
00392 struct stab_info stab_info;
00393
00394
00395 struct eh_frame_hdr_info eh_info;
00396
00397
00398 struct elf_link_local_dynamic_entry *dynlocal;
00399
00400
00401
00402 struct bfd_link_needed_list *runpath;
00403
00404
00405 asection *tls_sec;
00406 bfd_size_type tls_size;
00407
00408
00409 struct elf_link_loaded_list *loaded;
00410
00411
00412
00413 bfd_boolean is_relocatable_executable;
00414 };
00415
00416
00417
00418 #define elf_link_hash_lookup(table, string, create, copy, follow) \
00419 ((struct elf_link_hash_entry *) \
00420 bfd_link_hash_lookup (&(table)->root, (string), (create), \
00421 (copy), (follow)))
00422
00423
00424
00425 #define elf_link_hash_traverse(table, func, info) \
00426 (bfd_link_hash_traverse \
00427 (&(table)->root, \
00428 (bfd_boolean (*) (struct bfd_link_hash_entry *, void *)) (func), \
00429 (info)))
00430
00431
00432
00433 #define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
00434
00435
00436 #define is_elf_hash_table(htab) \
00437 (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
00438
00439
00440
00441 #define LOCAL_SYM_CACHE_SIZE 32
00442 struct sym_sec_cache
00443 {
00444 bfd *abfd;
00445 unsigned long indx[LOCAL_SYM_CACHE_SIZE];
00446 asection *sec[LOCAL_SYM_CACHE_SIZE];
00447 };
00448
00449
00450
00451 struct elf_size_info {
00452 unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
00453 unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
00454
00455
00456 unsigned char sizeof_hash_entry;
00457
00458
00459
00460 unsigned char int_rels_per_ext_rel;
00461
00462
00463 #define MAX_INT_RELS_PER_EXT_REL 3
00464
00465 unsigned char arch_size, log_file_align;
00466 unsigned char elfclass, ev_current;
00467 int (*write_out_phdrs)
00468 (bfd *, const Elf_Internal_Phdr *, unsigned int);
00469 bfd_boolean
00470 (*write_shdrs_and_ehdr) (bfd *);
00471 void (*write_relocs)
00472 (bfd *, asection *, void *);
00473 void (*swap_symbol_in)
00474 (bfd *, const void *, const void *, Elf_Internal_Sym *);
00475 void (*swap_symbol_out)
00476 (bfd *, const Elf_Internal_Sym *, void *, void *);
00477 bfd_boolean (*slurp_reloc_table)
00478 (bfd *, asection *, asymbol **, bfd_boolean);
00479 long (*slurp_symbol_table)
00480 (bfd *, asymbol **, bfd_boolean);
00481 void (*swap_dyn_in)
00482 (bfd *, const void *, Elf_Internal_Dyn *);
00483 void (*swap_dyn_out)
00484 (bfd *, const Elf_Internal_Dyn *, void *);
00485
00486
00487
00488
00489 void (*swap_reloc_in)
00490 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
00491
00492
00493 void (*swap_reloc_out)
00494 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
00495
00496
00497
00498
00499 void (*swap_reloca_in)
00500 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
00501
00502
00503 void (*swap_reloca_out)
00504 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
00505 };
00506
00507 #define elf_symbol_from(ABFD,S) \
00508 (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
00509 && (S)->the_bfd->tdata.elf_obj_data != 0) \
00510 ? (elf_symbol_type *) (S) \
00511 : 0)
00512
00513 enum elf_reloc_type_class {
00514 reloc_class_normal,
00515 reloc_class_relative,
00516 reloc_class_plt,
00517 reloc_class_copy
00518 };
00519
00520 struct elf_reloc_cookie
00521 {
00522 Elf_Internal_Rela *rels, *rel, *relend;
00523 Elf_Internal_Sym *locsyms;
00524 bfd *abfd;
00525 size_t locsymcount;
00526 size_t extsymoff;
00527 struct elf_link_hash_entry **sym_hashes;
00528 int r_sym_shift;
00529 bfd_boolean bad_symtab;
00530 };
00531
00532
00533
00534 typedef enum {
00535 ict_none,
00536 ict_irix5,
00537 ict_irix6
00538 } irix_compat_t;
00539
00540
00541 struct bfd_elf_special_section
00542 {
00543 const char *prefix;
00544 int prefix_length;
00545
00546
00547
00548
00549
00550
00551 int suffix_length;
00552 int type;
00553 int attr;
00554 };
00555
00556 struct elf_backend_data
00557 {
00558
00559 enum bfd_architecture arch;
00560
00561
00562 int elf_machine_code;
00563
00564
00565 bfd_vma maxpagesize;
00566
00567
00568
00569
00570 bfd_vma minpagesize;
00571
00572
00573 flagword dynamic_sec_flags;
00574
00575
00576
00577 void (*elf_info_to_howto)
00578 (bfd *, arelent *, Elf_Internal_Rela *);
00579
00580
00581
00582 void (*elf_info_to_howto_rel)
00583 (bfd *, arelent *, Elf_Internal_Rela *);
00584
00585
00586
00587
00588
00589
00590 bfd_boolean (*elf_backend_sym_is_global)
00591 (bfd *, asymbol *);
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602 bfd_boolean (*elf_backend_object_p)
00603 (bfd *);
00604
00605
00606
00607
00608 void (*elf_backend_symbol_processing)
00609 (bfd *, asymbol *);
00610
00611
00612
00613 bfd_boolean (*elf_backend_symbol_table_processing)
00614 (bfd *, elf_symbol_type *, unsigned int);
00615
00616
00617
00618 int (*elf_backend_get_symbol_type)
00619 (Elf_Internal_Sym *, int);
00620
00621
00622
00623 struct elf_link_hash_entry * (*elf_backend_archive_symbol_lookup)
00624 (bfd *, struct bfd_link_info *, const char *);
00625
00626
00627
00628 bfd_boolean (*elf_backend_name_local_section_symbols)
00629 (bfd *);
00630
00631
00632
00633
00634
00635 bfd_boolean (*elf_backend_section_processing)
00636 (bfd *, Elf_Internal_Shdr *);
00637
00638
00639
00640 bfd_boolean (*elf_backend_section_from_shdr)
00641 (bfd *, Elf_Internal_Shdr *, const char *);
00642
00643
00644
00645 bfd_boolean (*elf_backend_section_flags)
00646 (flagword *, const Elf_Internal_Shdr *);
00647
00648
00649
00650 bfd_boolean (*elf_backend_section_from_phdr)
00651 (bfd *, Elf_Internal_Phdr *, int, const char *);
00652
00653
00654
00655
00656 bfd_boolean (*elf_backend_fake_sections)
00657 (bfd *, Elf_Internal_Shdr *, asection *);
00658
00659
00660
00661
00662
00663 bfd_boolean (*elf_backend_section_from_bfd_section)
00664 (bfd *, asection *, int *retval);
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674 bfd_boolean (*elf_add_symbol_hook)
00675 (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *,
00676 const char **name, flagword *flags, asection **sec, bfd_vma *value);
00677
00678
00679
00680 bfd_boolean (*elf_backend_link_output_symbol_hook)
00681 (struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
00682 asection *, struct elf_link_hash_entry *);
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692 bfd_boolean (*elf_backend_create_dynamic_sections)
00693 (bfd *abfd, struct bfd_link_info *info);
00694
00695
00696
00697 bfd_boolean (*elf_backend_omit_section_dynsym)
00698 (bfd *output_bfd, struct bfd_link_info *info, asection *osec);
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710 bfd_boolean (*check_relocs)
00711 (bfd *abfd, struct bfd_link_info *info, asection *o,
00712 const Elf_Internal_Rela *relocs);
00713
00714
00715
00716
00717
00718 bfd_boolean (*check_directives)
00719 (bfd *abfd, struct bfd_link_info *info);
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733 bfd_boolean (*elf_backend_adjust_dynamic_symbol)
00734 (struct bfd_link_info *info, struct elf_link_hash_entry *h);
00735
00736
00737
00738
00739
00740 bfd_boolean (*elf_backend_always_size_sections)
00741 (bfd *output_bfd, struct bfd_link_info *info);
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753 bfd_boolean (*elf_backend_size_dynamic_sections)
00754 (bfd *output_bfd, struct bfd_link_info *info);
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784 bfd_boolean (*elf_backend_relocate_section)
00785 (bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
00786 asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs,
00787 Elf_Internal_Sym *local_syms, asection **local_sections);
00788
00789
00790
00791
00792
00793
00794
00795
00796 bfd_boolean (*elf_backend_finish_dynamic_symbol)
00797 (bfd *output_bfd, struct bfd_link_info *info,
00798 struct elf_link_hash_entry *h, Elf_Internal_Sym *sym);
00799
00800
00801
00802
00803
00804 bfd_boolean (*elf_backend_finish_dynamic_sections)
00805 (bfd *output_bfd, struct bfd_link_info *info);
00806
00807
00808
00809 void (*elf_backend_begin_write_processing)
00810 (bfd *, struct bfd_link_info *);
00811
00812
00813
00814
00815 void (*elf_backend_final_write_processing)
00816 (bfd *, bfd_boolean linker);
00817
00818
00819
00820
00821 int (*elf_backend_additional_program_headers)
00822 (bfd *);
00823
00824
00825
00826 bfd_boolean (*elf_backend_modify_segment_map)
00827 (bfd *, struct bfd_link_info *);
00828
00829
00830
00831 asection * (*gc_mark_hook)
00832 (asection *sec, struct bfd_link_info *, Elf_Internal_Rela *,
00833 struct elf_link_hash_entry *h, Elf_Internal_Sym *);
00834
00835
00836
00837
00838 bfd_boolean (*gc_sweep_hook)
00839 (bfd *abfd, struct bfd_link_info *info, asection *o,
00840 const Elf_Internal_Rela *relocs);
00841
00842
00843
00844
00845 void (*elf_backend_post_process_headers)
00846 (bfd *, struct bfd_link_info *);
00847
00848
00849
00850
00851 const char *(*elf_backend_print_symbol_all)
00852 (bfd *, void *, asymbol *);
00853
00854
00855
00856
00857
00858 bfd_boolean (*elf_backend_output_arch_syms)
00859 (bfd *, struct bfd_link_info *, void *,
00860 bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
00861 struct elf_link_hash_entry *));
00862
00863
00864
00865
00866
00867
00868 void (*elf_backend_copy_indirect_symbol)
00869 (const struct elf_backend_data *, struct elf_link_hash_entry *,
00870 struct elf_link_hash_entry *);
00871
00872
00873
00874 void (*elf_backend_hide_symbol)
00875 (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
00876
00877
00878 void (*elf_backend_merge_symbol_attribute)
00879 (struct elf_link_hash_entry *, const Elf_Internal_Sym *, bfd_boolean,
00880 bfd_boolean);
00881
00882
00883
00884 bfd_boolean (*elf_backend_emit_relocs)
00885 (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
00886
00887
00888
00889 unsigned int (*elf_backend_count_relocs)
00890 (asection *, Elf_Internal_Rela *);
00891
00892
00893
00894 bfd_boolean (*elf_backend_grok_prstatus)
00895 (bfd *, Elf_Internal_Note *);
00896
00897
00898
00899 bfd_boolean (*elf_backend_grok_psinfo)
00900 (bfd *, Elf_Internal_Note *);
00901
00902
00903 void (* elf_backend_sprintf_vma)
00904 (bfd *, char *, bfd_vma);
00905 void (* elf_backend_fprintf_vma)
00906 (bfd *, void *, bfd_vma);
00907
00908
00909 enum elf_reloc_type_class (*elf_backend_reloc_type_class)
00910 (const Elf_Internal_Rela *);
00911
00912
00913
00914 bfd_boolean (*elf_backend_discard_info)
00915 (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
00916
00917
00918
00919 bfd_boolean (*elf_backend_ignore_discarded_relocs)
00920 (asection *);
00921
00922
00923
00924
00925 unsigned int (*elf_backend_eh_frame_address_size)
00926 (bfd *, asection *);
00927
00928
00929
00930
00931 bfd_boolean (*elf_backend_can_make_relative_eh_frame)
00932 (bfd *, struct bfd_link_info *, asection *);
00933 bfd_boolean (*elf_backend_can_make_lsda_relative_eh_frame)
00934 (bfd *, struct bfd_link_info *, asection *);
00935
00936
00937
00938
00939
00940 bfd_byte (*elf_backend_encode_eh_address)
00941 (bfd *abfd, struct bfd_link_info *info,
00942 asection *osec, bfd_vma offset,
00943 asection *loc_sec, bfd_vma loc_offset,
00944 bfd_vma *encoded);
00945
00946
00947
00948 bfd_boolean (*elf_backend_write_section)
00949 (bfd *, asection *, bfd_byte *);
00950
00951
00952
00953 irix_compat_t (*elf_backend_mips_irix_compat)
00954 (bfd *);
00955
00956 reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
00957 (unsigned int, bfd_boolean);
00958
00959
00960
00961 const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
00962
00963
00964
00965 bfd *(*elf_backend_bfd_from_remote_memory)
00966 (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
00967 int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
00968
00969
00970
00971 bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
00972
00973
00974 bfd_error_handler_type link_order_error_handler;
00975
00976
00977 const char *relplt_name;
00978
00979
00980 int elf_machine_alt1;
00981 int elf_machine_alt2;
00982
00983 const struct elf_size_info *s;
00984
00985
00986 const struct bfd_elf_special_section *special_sections;
00987
00988
00989
00990 bfd_vma got_symbol_offset;
00991
00992
00993
00994 bfd_vma got_header_size;
00995
00996
00997
00998
00999
01000 unsigned collect : 1;
01001
01002
01003
01004
01005
01006 unsigned type_change_ok : 1;
01007
01008
01009
01010
01011 unsigned may_use_rel_p : 1;
01012
01013
01014
01015
01016 unsigned may_use_rela_p : 1;
01017
01018
01019
01020
01021
01022
01023 unsigned default_use_rela_p : 1;
01024
01025
01026
01027
01028 unsigned rela_normal : 1;
01029
01030
01031
01032 unsigned sign_extend_vma : 1;
01033
01034 unsigned want_got_plt : 1;
01035 unsigned plt_readonly : 1;
01036 unsigned want_plt_sym : 1;
01037 unsigned plt_not_loaded : 1;
01038 unsigned plt_alignment : 4;
01039 unsigned can_gc_sections : 1;
01040 unsigned can_refcount : 1;
01041 unsigned want_got_sym : 1;
01042 unsigned want_dynbss : 1;
01043
01044
01045
01046 unsigned want_p_paddr_set_to_zero : 1;
01047 };
01048
01049
01050
01051
01052 struct bfd_elf_section_data
01053 {
01054
01055 Elf_Internal_Shdr this_hdr;
01056
01057
01058
01059 Elf_Internal_Shdr rel_hdr;
01060
01061
01062
01063 Elf_Internal_Shdr *rel_hdr2;
01064
01065
01066 unsigned int rel_count;
01067
01068
01069 unsigned int rel_count2;
01070
01071
01072
01073 int this_idx;
01074
01075
01076
01077 int rel_idx;
01078
01079
01080
01081 int rel_idx2;
01082
01083
01084
01085
01086
01087 int dynindx;
01088
01089
01090 asection *linked_to;
01091
01092
01093
01094 struct elf_link_hash_entry **rel_hashes;
01095
01096
01097
01098
01099 Elf_Internal_Rela *relocs;
01100
01101
01102
01103 void *local_dynrel;
01104
01105
01106 asection *sreloc;
01107
01108 union {
01109
01110 const char *name;
01111
01112
01113 struct bfd_symbol *id;
01114 } group;
01115
01116
01117
01118 asection *sec_group;
01119
01120
01121
01122 asection *next_in_group;
01123
01124
01125 void *sec_info;
01126 };
01127
01128 #define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
01129 #define elf_linked_to_section(sec) (elf_section_data(sec)->linked_to)
01130 #define elf_section_type(sec) (elf_section_data(sec)->this_hdr.sh_type)
01131 #define elf_section_flags(sec) (elf_section_data(sec)->this_hdr.sh_flags)
01132 #define elf_group_name(sec) (elf_section_data(sec)->group.name)
01133 #define elf_group_id(sec) (elf_section_data(sec)->group.id)
01134 #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
01135 #define elf_sec_group(sec) (elf_section_data(sec)->sec_group)
01136
01137
01138 #define elf_discarded_section(sec) \
01139 (!bfd_is_abs_section (sec) \
01140 && bfd_is_abs_section ((sec)->output_section) \
01141 && (sec)->sec_info_type != ELF_INFO_TYPE_MERGE \
01142 && (sec)->sec_info_type != ELF_INFO_TYPE_JUST_SYMS)
01143
01144 #define get_elf_backend_data(abfd) \
01145 ((const struct elf_backend_data *) (abfd)->xvec->backend_data)
01146
01147
01148
01149
01150 struct elf_info_failed
01151 {
01152 bfd_boolean failed;
01153 struct bfd_link_info *info;
01154 struct bfd_elf_version_tree *verdefs;
01155 };
01156
01157
01158
01159
01160 struct elf_assign_sym_version_info
01161 {
01162
01163 bfd *output_bfd;
01164
01165 struct bfd_link_info *info;
01166
01167 struct bfd_elf_version_tree *verdefs;
01168
01169 bfd_boolean failed;
01170 };
01171
01172
01173
01174
01175 struct elf_find_verdep_info
01176 {
01177
01178 bfd *output_bfd;
01179
01180 struct bfd_link_info *info;
01181
01182 unsigned int vers;
01183
01184 bfd_boolean failed;
01185 };
01186
01187
01188
01189
01190 struct elf_obj_tdata
01191 {
01192 Elf_Internal_Ehdr elf_header[1];
01193 Elf_Internal_Shdr **elf_sect_ptr;
01194 Elf_Internal_Phdr *phdr;
01195 struct elf_segment_map *segment_map;
01196 struct elf_strtab_hash *strtab_ptr;
01197 int num_locals;
01198 int num_globals;
01199 unsigned int num_elf_sections;
01200 int num_section_syms;
01201 asymbol **section_syms;
01202 Elf_Internal_Shdr symtab_hdr;
01203 Elf_Internal_Shdr shstrtab_hdr;
01204 Elf_Internal_Shdr strtab_hdr;
01205 Elf_Internal_Shdr dynsymtab_hdr;
01206 Elf_Internal_Shdr dynstrtab_hdr;
01207 Elf_Internal_Shdr dynversym_hdr;
01208 Elf_Internal_Shdr dynverref_hdr;
01209 Elf_Internal_Shdr dynverdef_hdr;
01210 Elf_Internal_Shdr symtab_shndx_hdr;
01211 unsigned int symtab_section, shstrtab_section;
01212 unsigned int strtab_section, dynsymtab_section;
01213 unsigned int symtab_shndx_section;
01214 unsigned int dynversym_section, dynverdef_section, dynverref_section;
01215 file_ptr next_file_pos;
01216 bfd_vma gp;
01217 unsigned int gp_size;
01218
01219
01220 int core_signal;
01221 int core_pid;
01222 int core_lwpid;
01223 char* core_program;
01224 char* core_command;
01225
01226
01227
01228
01229 struct elf_link_hash_entry **sym_hashes;
01230
01231
01232
01233
01234 union
01235 {
01236 bfd_signed_vma *refcounts;
01237 bfd_vma *offsets;
01238 struct got_entry **ents;
01239 } local_got;
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249 const char *dt_name;
01250
01251
01252 bfd_size_type program_header_size;
01253
01254
01255 void *line_info;
01256
01257
01258
01259
01260
01261 struct mips_elf_find_line *find_line_info;
01262
01263
01264 struct dwarf1_debug *dwarf1_find_line_info;
01265
01266
01267 void *dwarf2_find_line_info;
01268
01269
01270
01271
01272 asection **local_stubs;
01273
01274
01275
01276 asection *eh_frame_hdr;
01277
01278 Elf_Internal_Shdr **group_sect_ptr;
01279 int num_group;
01280
01281
01282 unsigned int cverdefs;
01283
01284
01285 unsigned int cverrefs;
01286
01287
01288 unsigned int stack_flags;
01289
01290
01291 bfd_boolean relro;
01292
01293
01294 Elf_Internal_Verdef *verdef;
01295
01296
01297 Elf_Internal_Verneed *verref;
01298
01299
01300
01301 asymbol *elf_data_symbol;
01302 asymbol *elf_text_symbol;
01303 asection *elf_data_section;
01304 asection *elf_text_section;
01305
01306
01307
01308
01309 enum dynamic_lib_link_class dyn_lib_class;
01310
01311
01312
01313 bfd_boolean linker;
01314
01315
01316
01317
01318
01319
01320 bfd_boolean bad_symtab;
01321
01322
01323 bfd_boolean flags_init;
01324 };
01325
01326 #define elf_tdata(bfd) ((bfd) -> tdata.elf_obj_data)
01327 #define elf_elfheader(bfd) (elf_tdata(bfd) -> elf_header)
01328 #define elf_elfsections(bfd) (elf_tdata(bfd) -> elf_sect_ptr)
01329 #define elf_numsections(bfd) (elf_tdata(bfd) -> num_elf_sections)
01330 #define elf_shstrtab(bfd) (elf_tdata(bfd) -> strtab_ptr)
01331 #define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section)
01332 #define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section)
01333 #define elf_dynsymtab(bfd) (elf_tdata(bfd) -> dynsymtab_section)
01334 #define elf_dynversym(bfd) (elf_tdata(bfd) -> dynversym_section)
01335 #define elf_dynverdef(bfd) (elf_tdata(bfd) -> dynverdef_section)
01336 #define elf_dynverref(bfd) (elf_tdata(bfd) -> dynverref_section)
01337 #define elf_num_locals(bfd) (elf_tdata(bfd) -> num_locals)
01338 #define elf_num_globals(bfd) (elf_tdata(bfd) -> num_globals)
01339 #define elf_section_syms(bfd) (elf_tdata(bfd) -> section_syms)
01340 #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> num_section_syms)
01341 #define core_prpsinfo(bfd) (elf_tdata(bfd) -> prpsinfo)
01342 #define core_prstatus(bfd) (elf_tdata(bfd) -> prstatus)
01343 #define elf_gp(bfd) (elf_tdata(bfd) -> gp)
01344 #define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
01345 #define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
01346 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
01347 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
01348 #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
01349 #define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
01350 #define elf_dyn_lib_class(bfd) (elf_tdata(bfd) -> dyn_lib_class)
01351 #define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
01352 #define elf_flags_init(bfd) (elf_tdata(bfd) -> flags_init)
01353
01354 extern void _bfd_elf_swap_verdef_in
01355 (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *);
01356 extern void _bfd_elf_swap_verdef_out
01357 (bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *);
01358 extern void _bfd_elf_swap_verdaux_in
01359 (bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *);
01360 extern void _bfd_elf_swap_verdaux_out
01361 (bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *);
01362 extern void _bfd_elf_swap_verneed_in
01363 (bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *);
01364 extern void _bfd_elf_swap_verneed_out
01365 (bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *);
01366 extern void _bfd_elf_swap_vernaux_in
01367 (bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *);
01368 extern void _bfd_elf_swap_vernaux_out
01369 (bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *);
01370 extern void _bfd_elf_swap_versym_in
01371 (bfd *, const Elf_External_Versym *, Elf_Internal_Versym *);
01372 extern void _bfd_elf_swap_versym_out
01373 (bfd *, const Elf_Internal_Versym *, Elf_External_Versym *);
01374
01375 extern int _bfd_elf_section_from_bfd_section
01376 (bfd *, asection *);
01377 extern char *bfd_elf_string_from_elf_section
01378 (bfd *, unsigned, unsigned);
01379 extern char *bfd_elf_get_str_section
01380 (bfd *, unsigned);
01381 extern Elf_Internal_Sym *bfd_elf_get_elf_syms
01382 (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
01383 Elf_External_Sym_Shndx *);
01384 extern const char *bfd_elf_sym_name
01385 (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *);
01386
01387 extern bfd_boolean _bfd_elf_copy_private_bfd_data
01388 (bfd *, bfd *);
01389 extern bfd_boolean _bfd_elf_print_private_bfd_data
01390 (bfd *, void *);
01391 extern void bfd_elf_print_symbol
01392 (bfd *, void *, asymbol *, bfd_print_symbol_type);
01393
01394 extern void _bfd_elf_sprintf_vma
01395 (bfd *, char *, bfd_vma);
01396 extern void _bfd_elf_fprintf_vma
01397 (bfd *, void *, bfd_vma);
01398
01399 extern unsigned int _bfd_elf_eh_frame_address_size
01400 (bfd *, asection *);
01401 extern bfd_byte _bfd_elf_encode_eh_address
01402 (bfd *abfd, struct bfd_link_info *info, asection *osec, bfd_vma offset,
01403 asection *loc_sec, bfd_vma loc_offset, bfd_vma *encoded);
01404 extern bfd_boolean _bfd_elf_can_make_relative
01405 (bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section);
01406
01407 extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
01408 (const Elf_Internal_Rela *);
01409 extern bfd_vma _bfd_elf_rela_local_sym
01410 (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
01411 extern bfd_vma _bfd_elf_rel_local_sym
01412 (bfd *, Elf_Internal_Sym *, asection **, bfd_vma);
01413 extern bfd_vma _bfd_elf_section_offset
01414 (bfd *, struct bfd_link_info *, asection *, bfd_vma);
01415
01416 extern unsigned long bfd_elf_hash
01417 (const char *);
01418
01419 extern bfd_reloc_status_type bfd_elf_generic_reloc
01420 (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
01421 extern bfd_boolean bfd_elf_mkobject
01422 (bfd *);
01423 extern bfd_boolean bfd_elf_mkcorefile
01424 (bfd *);
01425 extern Elf_Internal_Shdr *bfd_elf_find_section
01426 (bfd *, char *);
01427 extern bfd_boolean _bfd_elf_make_section_from_shdr
01428 (bfd *, Elf_Internal_Shdr *, const char *);
01429 extern bfd_boolean _bfd_elf_make_section_from_phdr
01430 (bfd *, Elf_Internal_Phdr *, int, const char *);
01431 extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
01432 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
01433 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
01434 (bfd *);
01435 extern void _bfd_elf_link_hash_copy_indirect
01436 (const struct elf_backend_data *, struct elf_link_hash_entry *,
01437 struct elf_link_hash_entry *);
01438 extern void _bfd_elf_link_hash_hide_symbol
01439 (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
01440 extern bfd_boolean _bfd_elf_link_hash_table_init
01441 (struct elf_link_hash_table *, bfd *,
01442 struct bfd_hash_entry *(*)
01443 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
01444 extern bfd_boolean _bfd_elf_slurp_version_tables
01445 (bfd *, bfd_boolean);
01446 extern bfd_boolean _bfd_elf_merge_sections
01447 (bfd *, struct bfd_link_info *);
01448 extern bfd_boolean bfd_elf_is_group_section
01449 (bfd *, const struct bfd_section *);
01450 extern void _bfd_elf_section_already_linked
01451 (bfd *, struct bfd_section *);
01452 extern void bfd_elf_set_group_contents
01453 (bfd *, asection *, void *);
01454 extern void _bfd_elf_link_just_syms
01455 (asection *, struct bfd_link_info *);
01456 extern bfd_boolean _bfd_elf_copy_private_header_data
01457 (bfd *, bfd *);
01458 extern bfd_boolean _bfd_elf_copy_private_symbol_data
01459 (bfd *, asymbol *, bfd *, asymbol *);
01460 extern bfd_boolean _bfd_elf_copy_private_section_data
01461 (bfd *, asection *, bfd *, asection *);
01462 extern bfd_boolean _bfd_elf_write_object_contents
01463 (bfd *);
01464 extern bfd_boolean _bfd_elf_write_corefile_contents
01465 (bfd *);
01466 extern bfd_boolean _bfd_elf_set_section_contents
01467 (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
01468 extern long _bfd_elf_get_symtab_upper_bound
01469 (bfd *);
01470 extern long _bfd_elf_canonicalize_symtab
01471 (bfd *, asymbol **);
01472 extern long _bfd_elf_get_dynamic_symtab_upper_bound
01473 (bfd *);
01474 extern long _bfd_elf_canonicalize_dynamic_symtab
01475 (bfd *, asymbol **);
01476 extern long _bfd_elf_get_synthetic_symtab
01477 (bfd *, long, asymbol **, long, asymbol **, asymbol **);
01478 extern long _bfd_elf_get_reloc_upper_bound
01479 (bfd *, sec_ptr);
01480 extern long _bfd_elf_canonicalize_reloc
01481 (bfd *, sec_ptr, arelent **, asymbol **);
01482 extern long _bfd_elf_get_dynamic_reloc_upper_bound
01483 (bfd *);
01484 extern long _bfd_elf_canonicalize_dynamic_reloc
01485 (bfd *, arelent **, asymbol **);
01486 extern asymbol *_bfd_elf_make_empty_symbol
01487 (bfd *);
01488 extern void _bfd_elf_get_symbol_info
01489 (bfd *, asymbol *, symbol_info *);
01490 extern bfd_boolean _bfd_elf_is_local_label_name
01491 (bfd *, const char *);
01492 extern alent *_bfd_elf_get_lineno
01493 (bfd *, asymbol *);
01494 extern bfd_boolean _bfd_elf_set_arch_mach
01495 (bfd *, enum bfd_architecture, unsigned long);
01496 extern bfd_boolean _bfd_elf_find_nearest_line
01497 (bfd *, asection *, asymbol **, bfd_vma, const char **, const char **,
01498 unsigned int *);
01499 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
01500 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
01501 extern int _bfd_elf_sizeof_headers
01502 (bfd *, bfd_boolean);
01503 extern bfd_boolean _bfd_elf_new_section_hook
01504 (bfd *, asection *);
01505 extern bfd_boolean _bfd_elf_init_reloc_shdr
01506 (bfd *, Elf_Internal_Shdr *, asection *, bfd_boolean);
01507 extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
01508 (bfd *, const char *);
01509
01510
01511 extern void _bfd_elf_no_info_to_howto
01512 (bfd *, arelent *, Elf_Internal_Rela *);
01513
01514 extern bfd_boolean bfd_section_from_shdr
01515 (bfd *, unsigned int shindex);
01516 extern bfd_boolean bfd_section_from_phdr
01517 (bfd *, Elf_Internal_Phdr *, int);
01518
01519 extern int _bfd_elf_symbol_from_bfd_symbol
01520 (bfd *, asymbol **);
01521
01522 extern asection *bfd_section_from_r_symndx
01523 (bfd *, struct sym_sec_cache *, asection *, unsigned long);
01524 extern asection *bfd_section_from_elf_index
01525 (bfd *, unsigned int);
01526 extern struct bfd_strtab_hash *_bfd_elf_stringtab_init
01527 (void);
01528
01529 extern struct elf_strtab_hash * _bfd_elf_strtab_init
01530 (void);
01531 extern void _bfd_elf_strtab_free
01532 (struct elf_strtab_hash *);
01533 extern bfd_size_type _bfd_elf_strtab_add
01534 (struct elf_strtab_hash *, const char *, bfd_boolean);
01535 extern void _bfd_elf_strtab_addref
01536 (struct elf_strtab_hash *, bfd_size_type);
01537 extern void _bfd_elf_strtab_delref
01538 (struct elf_strtab_hash *, bfd_size_type);
01539 extern void _bfd_elf_strtab_clear_all_refs
01540 (struct elf_strtab_hash *);
01541 extern bfd_size_type _bfd_elf_strtab_size
01542 (struct elf_strtab_hash *);
01543 extern bfd_size_type _bfd_elf_strtab_offset
01544 (struct elf_strtab_hash *, bfd_size_type);
01545 extern bfd_boolean _bfd_elf_strtab_emit
01546 (bfd *, struct elf_strtab_hash *);
01547 extern void _bfd_elf_strtab_finalize
01548 (struct elf_strtab_hash *);
01549
01550 extern bfd_boolean _bfd_elf_discard_section_eh_frame
01551 (bfd *, struct bfd_link_info *, asection *,
01552 bfd_boolean (*) (bfd_vma, void *), struct elf_reloc_cookie *);
01553 extern bfd_boolean _bfd_elf_discard_section_eh_frame_hdr
01554 (bfd *, struct bfd_link_info *);
01555 extern bfd_vma _bfd_elf_eh_frame_section_offset
01556 (bfd *, struct bfd_link_info *, asection *, bfd_vma);
01557 extern bfd_boolean _bfd_elf_write_section_eh_frame
01558 (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
01559 extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr
01560 (bfd *, struct bfd_link_info *);
01561 extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr
01562 (struct bfd_link_info *);
01563
01564 extern bfd_boolean _bfd_elf_merge_symbol
01565 (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
01566 asection **, bfd_vma *, unsigned int *,
01567 struct elf_link_hash_entry **, bfd_boolean *,
01568 bfd_boolean *, bfd_boolean *, bfd_boolean *);
01569
01570 extern bfd_boolean _bfd_elf_add_default_symbol
01571 (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
01572 const char *, Elf_Internal_Sym *, asection **, bfd_vma *,
01573 bfd_boolean *, bfd_boolean);
01574
01575 extern bfd_boolean _bfd_elf_export_symbol
01576 (struct elf_link_hash_entry *, void *);
01577
01578 extern bfd_boolean _bfd_elf_link_find_version_dependencies
01579 (struct elf_link_hash_entry *, void *);
01580
01581 extern bfd_boolean _bfd_elf_link_assign_sym_version
01582 (struct elf_link_hash_entry *, void *);
01583
01584 extern long _bfd_elf_link_lookup_local_dynindx
01585 (struct bfd_link_info *, bfd *, long);
01586 extern bfd_boolean _bfd_elf_compute_section_file_positions
01587 (bfd *, struct bfd_link_info *);
01588 extern void _bfd_elf_assign_file_positions_for_relocs
01589 (bfd *);
01590 extern file_ptr _bfd_elf_assign_file_position_for_section
01591 (Elf_Internal_Shdr *, file_ptr, bfd_boolean);
01592
01593 extern bfd_boolean _bfd_elf_validate_reloc
01594 (bfd *, arelent *);
01595
01596 extern bfd_boolean _bfd_elf_link_create_dynamic_sections
01597 (bfd *, struct bfd_link_info *);
01598 extern bfd_boolean _bfd_elf_link_omit_section_dynsym
01599 (bfd *, struct bfd_link_info *, asection *);
01600 extern bfd_boolean _bfd_elf_create_dynamic_sections
01601 (bfd *, struct bfd_link_info *);
01602 extern bfd_boolean _bfd_elf_create_got_section
01603 (bfd *, struct bfd_link_info *);
01604 extern unsigned long _bfd_elf_link_renumber_dynsyms
01605 (bfd *, struct bfd_link_info *);
01606
01607 extern bfd_boolean _bfd_elfcore_make_pseudosection
01608 (bfd *, char *, size_t, ufile_ptr);
01609 extern char *_bfd_elfcore_strndup
01610 (bfd *, char *, size_t);
01611
01612 extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
01613 (bfd *, asection *, void *, Elf_Internal_Rela *, bfd_boolean);
01614
01615 extern bfd_boolean _bfd_elf_link_size_reloc_section
01616 (bfd *, Elf_Internal_Shdr *, asection *);
01617
01618 extern bfd_boolean _bfd_elf_link_output_relocs
01619 (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *);
01620
01621 extern bfd_boolean _bfd_elf_fix_symbol_flags
01622 (struct elf_link_hash_entry *, struct elf_info_failed *);
01623
01624 extern bfd_boolean _bfd_elf_adjust_dynamic_symbol
01625 (struct elf_link_hash_entry *, void *);
01626
01627 extern bfd_boolean _bfd_elf_link_sec_merge_syms
01628 (struct elf_link_hash_entry *, void *);
01629
01630 extern bfd_boolean _bfd_elf_dynamic_symbol_p
01631 (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
01632
01633 extern bfd_boolean _bfd_elf_symbol_refs_local_p
01634 (struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean);
01635
01636 extern bfd_boolean bfd_elf_match_symbols_in_sections
01637 (asection *sec1, asection *sec2);
01638
01639 extern bfd_boolean _bfd_elf_setup_group_pointers
01640 (bfd *);
01641
01642 extern const bfd_target *bfd_elf32_object_p
01643 (bfd *);
01644 extern const bfd_target *bfd_elf32_core_file_p
01645 (bfd *);
01646 extern char *bfd_elf32_core_file_failing_command
01647 (bfd *);
01648 extern int bfd_elf32_core_file_failing_signal
01649 (bfd *);
01650 extern bfd_boolean bfd_elf32_core_file_matches_executable_p
01651 (bfd *, bfd *);
01652
01653 extern void bfd_elf32_swap_symbol_in
01654 (bfd *, const void *, const void *, Elf_Internal_Sym *);
01655 extern void bfd_elf32_swap_symbol_out
01656 (bfd *, const Elf_Internal_Sym *, void *, void *);
01657 extern void bfd_elf32_swap_reloc_in
01658 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
01659 extern void bfd_elf32_swap_reloc_out
01660 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
01661 extern void bfd_elf32_swap_reloca_in
01662 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
01663 extern void bfd_elf32_swap_reloca_out
01664 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
01665 extern void bfd_elf32_swap_phdr_in
01666 (bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *);
01667 extern void bfd_elf32_swap_phdr_out
01668 (bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *);
01669 extern void bfd_elf32_swap_dyn_in
01670 (bfd *, const void *, Elf_Internal_Dyn *);
01671 extern void bfd_elf32_swap_dyn_out
01672 (bfd *, const Elf_Internal_Dyn *, void *);
01673 extern long bfd_elf32_slurp_symbol_table
01674 (bfd *, asymbol **, bfd_boolean);
01675 extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr
01676 (bfd *);
01677 extern int bfd_elf32_write_out_phdrs
01678 (bfd *, const Elf_Internal_Phdr *, unsigned int);
01679 extern void bfd_elf32_write_relocs
01680 (bfd *, asection *, void *);
01681 extern bfd_boolean bfd_elf32_slurp_reloc_table
01682 (bfd *, asection *, asymbol **, bfd_boolean);
01683
01684 extern const bfd_target *bfd_elf64_object_p
01685 (bfd *);
01686 extern const bfd_target *bfd_elf64_core_file_p
01687 (bfd *);
01688 extern char *bfd_elf64_core_file_failing_command
01689 (bfd *);
01690 extern int bfd_elf64_core_file_failing_signal
01691 (bfd *);
01692 extern bfd_boolean bfd_elf64_core_file_matches_executable_p
01693 (bfd *, bfd *);
01694
01695 extern void bfd_elf64_swap_symbol_in
01696 (bfd *, const void *, const void *, Elf_Internal_Sym *);
01697 extern void bfd_elf64_swap_symbol_out
01698 (bfd *, const Elf_Internal_Sym *, void *, void *);
01699 extern void bfd_elf64_swap_reloc_in
01700 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
01701 extern void bfd_elf64_swap_reloc_out
01702 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
01703 extern void bfd_elf64_swap_reloca_in
01704 (bfd *, const bfd_byte *, Elf_Internal_Rela *);
01705 extern void bfd_elf64_swap_reloca_out
01706 (bfd *, const Elf_Internal_Rela *, bfd_byte *);
01707 extern void bfd_elf64_swap_phdr_in
01708 (bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *);
01709 extern void bfd_elf64_swap_phdr_out
01710 (bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *);
01711 extern void bfd_elf64_swap_dyn_in
01712 (bfd *, const void *, Elf_Internal_Dyn *);
01713 extern void bfd_elf64_swap_dyn_out
01714 (bfd *, const Elf_Internal_Dyn *, void *);
01715 extern long bfd_elf64_slurp_symbol_table
01716 (bfd *, asymbol **, bfd_boolean);
01717 extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr
01718 (bfd *);
01719 extern int bfd_elf64_write_out_phdrs
01720 (bfd *, const Elf_Internal_Phdr *, unsigned int);
01721 extern void bfd_elf64_write_relocs
01722 (bfd *, asection *, void *);
01723 extern bfd_boolean bfd_elf64_slurp_reloc_table
01724 (bfd *, asection *, asymbol **, bfd_boolean);
01725
01726 extern struct elf_link_hash_entry *_bfd_elf_archive_symbol_lookup
01727 (bfd *, struct bfd_link_info *, const char *);
01728 extern bfd_boolean bfd_elf_link_add_symbols
01729 (bfd *, struct bfd_link_info *);
01730 extern bfd_boolean _bfd_elf_add_dynamic_entry
01731 (struct bfd_link_info *, bfd_vma, bfd_vma);
01732
01733 extern bfd_boolean bfd_elf_link_record_dynamic_symbol
01734 (struct bfd_link_info *, struct elf_link_hash_entry *);
01735
01736 extern int bfd_elf_link_record_local_dynamic_symbol
01737 (struct bfd_link_info *, bfd *, long);
01738
01739 extern bfd_boolean _bfd_elf_close_and_cleanup
01740 (bfd *);
01741 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
01742 (bfd *, arelent *, struct bfd_symbol *, void *,
01743 asection *, bfd *, char **);
01744
01745 extern bfd_boolean bfd_elf_final_link
01746 (bfd *, struct bfd_link_info *);
01747
01748 extern bfd_boolean bfd_elf_gc_sections
01749 (bfd *, struct bfd_link_info *);
01750
01751 extern bfd_boolean bfd_elf_gc_record_vtinherit
01752 (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
01753
01754 extern bfd_boolean bfd_elf_gc_record_vtentry
01755 (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
01756
01757 extern bfd_boolean _bfd_elf_gc_mark
01758 (struct bfd_link_info *, asection *,
01759 asection * (*) (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
01760 struct elf_link_hash_entry *, Elf_Internal_Sym *));
01761
01762 extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
01763 (bfd *, struct bfd_link_info *);
01764
01765 extern bfd_boolean bfd_elf_gc_common_final_link
01766 (bfd *, struct bfd_link_info *);
01767
01768 extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
01769 (bfd_vma, void *);
01770
01771 extern struct elf_segment_map *
01772 _bfd_elf_make_dynamic_segment
01773 (bfd *, asection *);
01774
01775
01776 extern char *elfcore_write_note
01777 (bfd *, char *, int *, const char *, int, const void *, int);
01778 extern char *elfcore_write_prpsinfo
01779 (bfd *, char *, int *, const char *, const char *);
01780 extern char *elfcore_write_prstatus
01781 (bfd *, char *, int *, long, int, const void *);
01782 extern char * elfcore_write_pstatus
01783 (bfd *, char *, int *, long, int, const void *);
01784 extern char *elfcore_write_prfpreg
01785 (bfd *, char *, int *, const void *, int);
01786 extern char *elfcore_write_prxfpreg
01787 (bfd *, char *, int *, const void *, int);
01788 extern char *elfcore_write_lwpstatus
01789 (bfd *, char *, int *, long, int, const void *);
01790
01791 extern bfd *_bfd_elf32_bfd_from_remote_memory
01792 (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
01793 int (*target_read_memory) (bfd_vma, bfd_byte *, int));
01794 extern bfd *_bfd_elf64_bfd_from_remote_memory
01795 (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
01796 int (*target_read_memory) (bfd_vma, bfd_byte *, int));
01797
01798
01799
01800 extern bfd_boolean _sh_elf_set_mach_from_flags
01801 (bfd *);
01802
01803
01804
01805
01806 #define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
01807 ((DYN) \
01808 && ((SHARED) || !(H)->forced_local) \
01809 && ((H)->dynindx != -1 || (H)->forced_local))
01810
01811
01812
01813 #define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, \
01814 r_symndx, symtab_hdr, sym_hashes, \
01815 h, sec, relocation, \
01816 unresolved_reloc, warned) \
01817 do \
01818 { \
01819
01820 \
01821 if (sym_hashes == NULL) \
01822 return FALSE; \
01823 \
01824 h = sym_hashes[r_symndx - symtab_hdr->sh_info]; \
01825 \
01826 while (h->root.type == bfd_link_hash_indirect \
01827 || h->root.type == bfd_link_hash_warning) \
01828 h = (struct elf_link_hash_entry *) h->root.u.i.link; \
01829 \
01830 warned = FALSE; \
01831 unresolved_reloc = FALSE; \
01832 relocation = 0; \
01833 if (h->root.type == bfd_link_hash_defined \
01834 || h->root.type == bfd_link_hash_defweak) \
01835 { \
01836 sec = h->root.u.def.section; \
01837 if (sec == NULL \
01838 || sec->output_section == NULL) \
01839
01840
01841
01842 \
01843 unresolved_reloc = TRUE; \
01844 else \
01845 relocation = (h->root.u.def.value \
01846 + sec->output_section->vma \
01847 + sec->output_offset); \
01848 } \
01849 else if (h->root.type == bfd_link_hash_undefweak) \
01850 ; \
01851 else if (info->unresolved_syms_in_objects == RM_IGNORE \
01852 && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
01853 ; \
01854 else \
01855 { \
01856 bfd_boolean err; \
01857 err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
01858 || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT); \
01859 if (!info->callbacks->undefined_symbol (info, \
01860 h->root.root.string, \
01861 input_bfd, \
01862 input_section, \
01863 rel->r_offset, err)) \
01864 return FALSE; \
01865 warned = TRUE; \
01866 } \
01867 } \
01868 while (0)
01869
01870 #endif