Changeset 609 for branches/GNU/src/binutils/bfd/doc/bfd.info-4
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/doc/bfd.info-4
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r608 r609 1 This is bfd.info, produced by makeinfo version 4. 0from bfd.texinfo.1 This is bfd.info, produced by makeinfo version 4. from bfd.texinfo. 2 2 3 3 START-INFO-DIR-ENTRY … … 7 7 This file documents the BFD library. 8 8 9 Copyright (C) 1991, 2000 Free Software Foundation, Inc.9 Copyright (C) 1991, 2000 Free Software Foundation, Inc. 10 10 11 11 Permission is granted to copy, distribute and/or modify this document … … 17 17 18 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 19 1556 File: bfd.info, Node: Targets, Next: Architectures, Prev: Core Files, Up: BFD front end 20 1557 … … 59 1596 the BFD with a suggested format. If `target_defaulted' has been set, 60 1597 each possible target type is tried to see if it recognizes the 61 specified format. `bfd_check_format' returns ` true' when the caller1598 specified format. `bfd_check_format' returns `' when the caller 62 1599 guesses right. 63 1600 … … 66 1603 * bfd_target:: 67 1604 68 69 File: bfd.info, Node: bfd_target, Prev: Targets, Up: Targets70 71 bfd_target72 ----------73 74 *Description*75 This structure contains everything that BFD knows about a target. It76 includes things like its byte order, name, and which routines to call77 to do various operations.78 79 Every BFD points to a target structure with its `xvec' member.80 81 The macros below are used to dispatch to functions through the82 `bfd_target' vector. They are used in a number of macros further down83 in `bfd.h', and are also used when calling various routines by hand84 inside the BFD implementation. The ARGLIST argument must be85 parenthesized; it contains all the arguments to the called function.86 87 They make the documentation (more) unpleasant to read, so if someone88 wants to fix this and not break the above, please do.89 #define BFD_SEND(bfd, message, arglist) \90 ((*((bfd)->xvec->message)) arglist)91 92 #ifdef DEBUG_BFD_SEND93 #undef BFD_SEND94 #define BFD_SEND(bfd, message, arglist) \95 (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \96 ((*((bfd)->xvec->message)) arglist) : \97 (bfd_assert (__FILE__,__LINE__), NULL))98 #endif99 For operations which index on the BFD format:100 #define BFD_SEND_FMT(bfd, message, arglist) \101 (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)102 103 #ifdef DEBUG_BFD_SEND104 #undef BFD_SEND_FMT105 #define BFD_SEND_FMT(bfd, message, arglist) \106 (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \107 (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \108 (bfd_assert (__FILE__,__LINE__), NULL))109 #endif110 This is the structure which defines the type of BFD this is. The111 `xvec' member of the struct `bfd' itself points here. Each module that112 implements access to a different target under BFD, defines one of these.113 114 FIXME, these names should be rationalised with the names of the115 entry points which call them. Too bad we can't have one macro to define116 them both!117 enum bfd_flavour {118 bfd_target_unknown_flavour,119 bfd_target_aout_flavour,120 bfd_target_coff_flavour,121 bfd_target_ecoff_flavour,122 bfd_target_xcoff_flavour,123 bfd_target_elf_flavour,124 bfd_target_ieee_flavour,125 bfd_target_nlm_flavour,126 bfd_target_oasys_flavour,127 bfd_target_tekhex_flavour,128 bfd_target_srec_flavour,129 bfd_target_ihex_flavour,130 bfd_target_som_flavour,131 bfd_target_os9k_flavour,132 bfd_target_versados_flavour,133 bfd_target_msdos_flavour,134 bfd_target_ovax_flavour,135 bfd_target_evax_flavour136 };137 138 enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };139 140 /* Forward declaration. */141 typedef struct bfd_link_info _bfd_link_info;142 143 typedef struct bfd_target144 {145 Identifies the kind of target, e.g., SunOS4, Ultrix, etc.146 char *name;147 The "flavour" of a back end is a general indication about the148 contents of a file.149 enum bfd_flavour flavour;150 The order of bytes within the data area of a file.151 enum bfd_endian byteorder;152 The order of bytes within the header parts of a file.153 enum bfd_endian header_byteorder;154 A mask of all the flags which an executable may have set - from the155 set `BFD_NO_FLAGS', `HAS_RELOC', ...`D_PAGED'.156 flagword object_flags;157 A mask of all the flags which a section may have set - from the set158 `SEC_NO_FLAGS', `SEC_ALLOC', ...`SET_NEVER_LOAD'.159 flagword section_flags;160 The character normally found at the front of a symbol (if any),161 perhaps `_'.162 char symbol_leading_char;163 The pad character for file names within an archive header.164 char ar_pad_char;165 The maximum number of characters in an archive header.166 unsigned short ar_max_namelen;167 Entries for byte swapping for data. These are different from the168 other entry points, since they don't take a BFD asthe first argument.169 Certain other handlers could do the same.170 bfd_vma (*bfd_getx64) PARAMS ((const bfd_byte *));171 bfd_signed_vma (*bfd_getx_signed_64) PARAMS ((const bfd_byte *));172 void (*bfd_putx64) PARAMS ((bfd_vma, bfd_byte *));173 bfd_vma (*bfd_getx32) PARAMS ((const bfd_byte *));174 bfd_signed_vma (*bfd_getx_signed_32) PARAMS ((const bfd_byte *));175 void (*bfd_putx32) PARAMS ((bfd_vma, bfd_byte *));176 bfd_vma (*bfd_getx16) PARAMS ((const bfd_byte *));177 bfd_signed_vma (*bfd_getx_signed_16) PARAMS ((const bfd_byte *));178 void (*bfd_putx16) PARAMS ((bfd_vma, bfd_byte *));179 Byte swapping for the headers180 bfd_vma (*bfd_h_getx64) PARAMS ((const bfd_byte *));181 bfd_signed_vma (*bfd_h_getx_signed_64) PARAMS ((const bfd_byte *));182 void (*bfd_h_putx64) PARAMS ((bfd_vma, bfd_byte *));183 bfd_vma (*bfd_h_getx32) PARAMS ((const bfd_byte *));184 bfd_signed_vma (*bfd_h_getx_signed_32) PARAMS ((const bfd_byte *));185 void (*bfd_h_putx32) PARAMS ((bfd_vma, bfd_byte *));186 bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));187 bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));188 void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));189 Format dependent routines: these are vectors of entry points within190 the target vector structure, one for each format to check.191 192 Check the format of a file being read. Return a `bfd_target *' or193 zero.194 const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));195 Set the format of a file being written.196 boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));197 Write cached information into a file being written, at `bfd_close'.198 boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));199 The general target vector. These vectors are initialized using the200 BFD_JUMP_TABLE macros.201 202 /* Generic entry points. */203 #define BFD_JUMP_TABLE_GENERIC(NAME)\204 CAT(NAME,_close_and_cleanup),\205 CAT(NAME,_bfd_free_cached_info),\206 CAT(NAME,_new_section_hook),\207 CAT(NAME,_get_section_contents),\208 CAT(NAME,_get_section_contents_in_window)209 210 /* Called when the BFD is being closed to do any necessary cleanup. */211 boolean (*_close_and_cleanup) PARAMS ((bfd *));212 /* Ask the BFD to free all cached information. */213 boolean (*_bfd_free_cached_info) PARAMS ((bfd *));214 /* Called when a new section is created. */215 boolean (*_new_section_hook) PARAMS ((bfd *, sec_ptr));216 /* Read the contents of a section. */217 boolean (*_bfd_get_section_contents) PARAMS ((bfd *, sec_ptr, PTR,218 file_ptr, bfd_size_type));219 boolean (*_bfd_get_section_contents_in_window)220 PARAMS ((bfd *, sec_ptr, bfd_window *,221 file_ptr, bfd_size_type));222 223 /* Entry points to copy private data. */224 #define BFD_JUMP_TABLE_COPY(NAME)\225 CAT(NAME,_bfd_copy_private_bfd_data),\226 CAT(NAME,_bfd_merge_private_bfd_data),\227 CAT(NAME,_bfd_copy_private_section_data),\228 CAT(NAME,_bfd_copy_private_symbol_data),\229 CAT(NAME,_bfd_set_private_flags),\230 CAT(NAME,_bfd_print_private_bfd_data)\231 /* Called to copy BFD general private data from one object file232 to another. */233 boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));234 /* Called to merge BFD general private data from one object file235 to a common output file when linking. */236 boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));237 /* Called to copy BFD private section data from one object file238 to another. */239 boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,240 bfd *, sec_ptr));241 /* Called to copy BFD private symbol data from one symbol242 to another. */243 boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,244 bfd *, asymbol *));245 /* Called to set private backend flags */246 boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));247 248 /* Called to print private BFD data */249 boolean (*_bfd_print_private_bfd_data) PARAMS ((bfd *, PTR));250 251 /* Core file entry points. */252 #define BFD_JUMP_TABLE_CORE(NAME)\253 CAT(NAME,_core_file_failing_command),\254 CAT(NAME,_core_file_failing_signal),\255 CAT(NAME,_core_file_matches_executable_p)256 char * (*_core_file_failing_command) PARAMS ((bfd *));257 int (*_core_file_failing_signal) PARAMS ((bfd *));258 boolean (*_core_file_matches_executable_p) PARAMS ((bfd *, bfd *));259 260 /* Archive entry points. */261 #define BFD_JUMP_TABLE_ARCHIVE(NAME)\262 CAT(NAME,_slurp_armap),\263 CAT(NAME,_slurp_extended_name_table),\264 CAT(NAME,_construct_extended_name_table),\265 CAT(NAME,_truncate_arname),\266 CAT(NAME,_write_armap),\267 CAT(NAME,_read_ar_hdr),\268 CAT(NAME,_openr_next_archived_file),\269 CAT(NAME,_get_elt_at_index),\270 CAT(NAME,_generic_stat_arch_elt),\271 CAT(NAME,_update_armap_timestamp)272 boolean (*_bfd_slurp_armap) PARAMS ((bfd *));273 boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));274 boolean (*_bfd_construct_extended_name_table)275 PARAMS ((bfd *, char **, bfd_size_type *, const char **));276 void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));277 boolean (*write_armap) PARAMS ((bfd *arch,278 unsigned int elength,279 struct orl *map,280 unsigned int orl_count,281 int stridx));282 PTR (*_bfd_read_ar_hdr_fn) PARAMS ((bfd *));283 bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));284 #define bfd_get_elt_at_index(b,i) BFD_SEND(b, _bfd_get_elt_at_index, (b,i))285 bfd * (*_bfd_get_elt_at_index) PARAMS ((bfd *, symindex));286 int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));287 boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));288 289 /* Entry points used for symbols. */290 #define BFD_JUMP_TABLE_SYMBOLS(NAME)\291 CAT(NAME,_get_symtab_upper_bound),\292 CAT(NAME,_get_symtab),\293 CAT(NAME,_make_empty_symbol),\294 CAT(NAME,_print_symbol),\295 CAT(NAME,_get_symbol_info),\296 CAT(NAME,_bfd_is_local_label_name),\297 CAT(NAME,_get_lineno),\298 CAT(NAME,_find_nearest_line),\299 CAT(NAME,_bfd_make_debug_symbol),\300 CAT(NAME,_read_minisymbols),\301 CAT(NAME,_minisymbol_to_symbol)302 long (*_bfd_get_symtab_upper_bound) PARAMS ((bfd *));303 long (*_bfd_canonicalize_symtab) PARAMS ((bfd *,304 struct symbol_cache_entry **));305 struct symbol_cache_entry *306 (*_bfd_make_empty_symbol) PARAMS ((bfd *));307 void (*_bfd_print_symbol) PARAMS ((bfd *, PTR,308 struct symbol_cache_entry *,309 bfd_print_symbol_type));310 #define bfd_print_symbol(b,p,s,e) BFD_SEND(b, _bfd_print_symbol, (b,p,s,e))311 void (*_bfd_get_symbol_info) PARAMS ((bfd *,312 struct symbol_cache_entry *,313 symbol_info *));314 #define bfd_get_symbol_info(b,p,e) BFD_SEND(b, _bfd_get_symbol_info, (b,p,e))315 boolean (*_bfd_is_local_label_name) PARAMS ((bfd *, const char *));316 317 alent * (*_get_lineno) PARAMS ((bfd *, struct symbol_cache_entry *));318 boolean (*_bfd_find_nearest_line) PARAMS ((bfd *abfd,319 struct sec *section, struct symbol_cache_entry **symbols,320 bfd_vma offset, CONST char **file, CONST char **func,321 unsigned int *line));322 /* Back-door to allow format-aware applications to create debug symbols323 while using BFD for everything else. Currently used by the assembler324 when creating COFF files. */325 asymbol * (*_bfd_make_debug_symbol) PARAMS ((326 bfd *abfd,327 void *ptr,328 unsigned long size));329 #define bfd_read_minisymbols(b, d, m, s) \330 BFD_SEND (b, _read_minisymbols, (b, d, m, s))331 long (*_read_minisymbols) PARAMS ((bfd *, boolean, PTR *,332 unsigned int *));333 #define bfd_minisymbol_to_symbol(b, d, m, f) \334 BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))335 asymbol *(*_minisymbol_to_symbol) PARAMS ((bfd *, boolean, const PTR,336 asymbol *));337 338 /* Routines for relocs. */339 #define BFD_JUMP_TABLE_RELOCS(NAME)\340 CAT(NAME,_get_reloc_upper_bound),\341 CAT(NAME,_canonicalize_reloc),\342 CAT(NAME,_bfd_reloc_type_lookup)343 long (*_get_reloc_upper_bound) PARAMS ((bfd *, sec_ptr));344 long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,345 struct symbol_cache_entry **));346 /* See documentation on reloc types. */347 reloc_howto_type *348 (*reloc_type_lookup) PARAMS ((bfd *abfd,349 bfd_reloc_code_real_type code));350 351 /* Routines used when writing an object file. */352 #define BFD_JUMP_TABLE_WRITE(NAME)\353 CAT(NAME,_set_arch_mach),\354 CAT(NAME,_set_section_contents)355 boolean (*_bfd_set_arch_mach) PARAMS ((bfd *, enum bfd_architecture,356 unsigned long));357 boolean (*_bfd_set_section_contents) PARAMS ((bfd *, sec_ptr, PTR,358 file_ptr, bfd_size_type));359 360 /* Routines used by the linker. */361 #define BFD_JUMP_TABLE_LINK(NAME)\362 CAT(NAME,_sizeof_headers),\363 CAT(NAME,_bfd_get_relocated_section_contents),\364 CAT(NAME,_bfd_relax_section),\365 CAT(NAME,_bfd_link_hash_table_create),\366 CAT(NAME,_bfd_link_add_symbols),\367 CAT(NAME,_bfd_final_link),\368 CAT(NAME,_bfd_link_split_section),\369 CAT(NAME,_bfd_gc_sections)370 int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));371 bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,372 struct bfd_link_info *, struct bfd_link_order *,373 bfd_byte *data, boolean relocateable,374 struct symbol_cache_entry **));375 376 boolean (*_bfd_relax_section) PARAMS ((bfd *, struct sec *,377 struct bfd_link_info *, boolean *again));378 379 /* Create a hash table for the linker. Different backends store380 different information in this table. */381 struct bfd_link_hash_table *(*_bfd_link_hash_table_create) PARAMS ((bfd *));382 383 /* Add symbols from this object file into the hash table. */384 boolean (*_bfd_link_add_symbols) PARAMS ((bfd *, struct bfd_link_info *));385 386 /* Do a link based on the link_order structures attached to each387 section of the BFD. */388 boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));389 390 /* Should this section be split up into smaller pieces during linking. */391 boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));392 393 /* Remove sections that are not referenced from the output. */394 boolean (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));395 396 /* Routines to handle dynamic symbols and relocs. */397 #define BFD_JUMP_TABLE_DYNAMIC(NAME)\398 CAT(NAME,_get_dynamic_symtab_upper_bound),\399 CAT(NAME,_canonicalize_dynamic_symtab),\400 CAT(NAME,_get_dynamic_reloc_upper_bound),\401 CAT(NAME,_canonicalize_dynamic_reloc)402 /* Get the amount of memory required to hold the dynamic symbols. */403 long (*_bfd_get_dynamic_symtab_upper_bound) PARAMS ((bfd *));404 /* Read in the dynamic symbols. */405 long (*_bfd_canonicalize_dynamic_symtab)406 PARAMS ((bfd *, struct symbol_cache_entry **));407 /* Get the amount of memory required to hold the dynamic relocs. */408 long (*_bfd_get_dynamic_reloc_upper_bound) PARAMS ((bfd *));409 /* Read in the dynamic relocs. */410 long (*_bfd_canonicalize_dynamic_reloc)411 PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));412 A pointer to an alternative bfd_target in case the current one is not413 satisfactory. This can happen when the target cpu supports both big414 and little endian code, and target chosen by the linker has the wrong415 endianness. The function open_output() in ld/ldlang.c uses this field416 to find an alternative output format that is suitable.417 /* Opposite endian version of this target. */418 const struct bfd_target * alternative_target;419 Data for use by back-end routines, which isn't generic enough to420 belong in this structure.421 PTR backend_data;422 423 } bfd_target;424 425 `bfd_set_default_target'426 ........................427 428 *Synopsis*429 boolean bfd_set_default_target (const char *name);430 *Description*431 Set the default target vector to use when recognizing a BFD. This432 takes the name of the target, which may be a BFD target name or a433 configuration triplet.434 435 `bfd_find_target'436 .................437 438 *Synopsis*439 const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);440 *Description*441 Return a pointer to the transfer vector for the object target named442 TARGET_NAME. If TARGET_NAME is `NULL', choose the one in the443 environment variable `GNUTARGET'; if that is null or not defined, then444 choose the first entry in the target list. Passing in the string445 "default" or setting the environment variable to "default" will cause446 the first entry in the target list to be returned, and447 "target_defaulted" will be set in the BFD. This causes448 `bfd_check_format' to loop over all the targets to find the one that449 matches the file being read.450 451 `bfd_target_list'452 .................453 454 *Synopsis*455 const char **bfd_target_list(void);456 *Description*457 Return a freshly malloced NULL-terminated vector of the names of all458 the valid BFD targets. Do not modify the names.459 460 `bfd_seach_for_target'461 ......................462 463 *Synopsis*464 const bfd_target * bfd_search_for_target (int (* search_func) (const bfd_target *, void *), void *);465 *Description*466 Return a pointer to the first transfer vector in the list of transfer467 vectors maintained by BFD that produces a non-zero result when passed468 to the function SEARCH_FUNC. The parameter DATA is passed, unexamined,469 to the search function.470 471 472 File: bfd.info, Node: Architectures, Next: Opening and Closing, Prev: Targets, Up: BFD front end473 474 Architectures475 =============476 477 BFD keeps one atom in a BFD describing the architecture of the data478 attached to the BFD: a pointer to a `bfd_arch_info_type'.479 480 Pointers to structures can be requested independently of a BFD so481 that an architecture's information can be interrogated without access482 to an open BFD.483 484 The architecture information is provided by each architecture485 package. The set of default architectures is selected by the macro486 `SELECT_ARCHITECTURES'. This is normally set up in the487 `config/TARGET.mt' file of your choice. If the name is not defined,488 then all the architectures supported are included.489 490 When BFD starts up, all the architectures are called with an491 initialize method. It is up to the architecture back end to insert as492 many items into the list of architectures as it wants to; generally493 this would be one for each machine and one for the default case (an494 item with a machine field of 0).495 496 BFD's idea of an architecture is implemented in `archures.c'.497 498 bfd_architecture499 ----------------500 501 *Description*502 This enum gives the object file's CPU architecture, in a global503 sense--i.e., what processor family does it belong to? Another field504 indicates which processor within the family is in use. The machine505 gives a number which distinguishes different versions of the506 architecture, containing, for example, 2 and 3 for Intel i960 KA and507 i960 KB, and 68020 and 68030 for Motorola 68020 and 68030.508 enum bfd_architecture509 {510 bfd_arch_unknown, /* File arch not known */511 bfd_arch_obscure, /* Arch known, not one of these */512 bfd_arch_m68k, /* Motorola 68xxx */513 #define bfd_mach_m68000 1514 #define bfd_mach_m68008 2515 #define bfd_mach_m68010 3516 #define bfd_mach_m68020 4517 #define bfd_mach_m68030 5518 #define bfd_mach_m68040 6519 #define bfd_mach_m68060 7520 #define bfd_mach_cpu32 8521 #define bfd_mach_mcf5200 9522 #define bfd_mach_mcf5206e 10523 #define bfd_mach_mcf5307 11524 #define bfd_mach_mcf5407 12525 bfd_arch_vax, /* DEC Vax */526 bfd_arch_i960, /* Intel 960 */527 /* The order of the following is important.528 lower number indicates a machine type that529 only accepts a subset of the instructions530 available to machines with higher numbers.531 The exception is the "ca", which is532 incompatible with all other machines except533 "core". */534 535 #define bfd_mach_i960_core 1536 #define bfd_mach_i960_ka_sa 2537 #define bfd_mach_i960_kb_sb 3538 #define bfd_mach_i960_mc 4539 #define bfd_mach_i960_xa 5540 #define bfd_mach_i960_ca 6541 #define bfd_mach_i960_jx 7542 #define bfd_mach_i960_hx 8543 544 bfd_arch_a29k, /* AMD 29000 */545 bfd_arch_sparc, /* SPARC */546 #define bfd_mach_sparc 1547 /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */548 #define bfd_mach_sparc_sparclet 2549 #define bfd_mach_sparc_sparclite 3550 #define bfd_mach_sparc_v8plus 4551 #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns */552 #define bfd_mach_sparc_sparclite_le 6553 #define bfd_mach_sparc_v9 7554 #define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns */555 #define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns */556 #define bfd_mach_sparc_v9b 10 /* with cheetah add'ns */557 /* Nonzero if MACH has the v9 instruction set. */558 #define bfd_mach_sparc_v9_p(mach) \559 ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \560 && (mach) != bfd_mach_sparc_sparclite_le)561 bfd_arch_mips, /* MIPS Rxxxx */562 #define bfd_mach_mips3000 3000563 #define bfd_mach_mips3900 3900564 #define bfd_mach_mips4000 4000565 #define bfd_mach_mips4010 4010566 #define bfd_mach_mips4100 4100567 #define bfd_mach_mips4111 4111568 #define bfd_mach_mips4300 4300569 #define bfd_mach_mips4400 4400570 #define bfd_mach_mips4600 4600571 #define bfd_mach_mips4650 4650572 #define bfd_mach_mips5000 5000573 #define bfd_mach_mips6000 6000574 #define bfd_mach_mips8000 8000575 #define bfd_mach_mips10000 10000576 #define bfd_mach_mips12000 12000577 #define bfd_mach_mips16 16578 #define bfd_mach_mips32 32579 #define bfd_mach_mips32_4k 3204113 /* 32, 04, octal 'K' */580 #define bfd_mach_mips5 5581 #define bfd_mach_mips64 64582 #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */583 bfd_arch_i386, /* Intel 386 */584 #define bfd_mach_i386_i386 0585 #define bfd_mach_i386_i8086 1586 #define bfd_mach_i386_i386_intel_syntax 2587 #define bfd_mach_x86_64 3588 #define bfd_mach_x86_64_intel_syntax 4589 bfd_arch_we32k, /* AT&T WE32xxx */590 bfd_arch_tahoe, /* CCI/Harris Tahoe */591 bfd_arch_i860, /* Intel 860 */592 bfd_arch_i370, /* IBM 360/370 Mainframes */593 bfd_arch_romp, /* IBM ROMP PC/RT */594 bfd_arch_alliant, /* Alliant */595 bfd_arch_convex, /* Convex */596 bfd_arch_m88k, /* Motorola 88xxx */597 bfd_arch_pyramid, /* Pyramid Technology */598 bfd_arch_h8300, /* Hitachi H8/300 */599 #define bfd_mach_h8300 1600 #define bfd_mach_h8300h 2601 #define bfd_mach_h8300s 3602 bfd_arch_powerpc, /* PowerPC */603 #define bfd_mach_ppc 0604 #define bfd_mach_ppc_403 403605 #define bfd_mach_ppc_403gc 4030606 #define bfd_mach_ppc_505 505607 #define bfd_mach_ppc_601 601608 #define bfd_mach_ppc_602 602609 #define bfd_mach_ppc_603 603610 #define bfd_mach_ppc_ec603e 6031611 #define bfd_mach_ppc_604 604612 #define bfd_mach_ppc_620 620613 #define bfd_mach_ppc_630 630614 #define bfd_mach_ppc_750 750615 #define bfd_mach_ppc_860 860616 #define bfd_mach_ppc_a35 35617 #define bfd_mach_ppc_rs64ii 642618 #define bfd_mach_ppc_rs64iii 643619 #define bfd_mach_ppc_7400 7400620 bfd_arch_rs6000, /* IBM RS/6000 */621 #define bfd_mach_rs6k 0622 #define bfd_mach_rs6k_rs1 6001623 #define bfd_mach_rs6k_rsc 6003624 #define bfd_mach_rs6k_rs2 6002625 bfd_arch_hppa, /* HP PA RISC */626 bfd_arch_d10v, /* Mitsubishi D10V */627 #define bfd_mach_d10v 0628 #define bfd_mach_d10v_ts2 2629 #define bfd_mach_d10v_ts3 3630 bfd_arch_d30v, /* Mitsubishi D30V */631 bfd_arch_m68hc11, /* Motorola 68HC11 */632 bfd_arch_m68hc12, /* Motorola 68HC12 */633 bfd_arch_z8k, /* Zilog Z8000 */634 #define bfd_mach_z8001 1635 #define bfd_mach_z8002 2636 bfd_arch_h8500, /* Hitachi H8/500 */637 bfd_arch_sh, /* Hitachi SH */638 #define bfd_mach_sh 0639 #define bfd_mach_sh2 0x20640 #define bfd_mach_sh_dsp 0x2d641 #define bfd_mach_sh3 0x30642 #define bfd_mach_sh3_dsp 0x3d643 #define bfd_mach_sh3e 0x3e644 #define bfd_mach_sh4 0x40645 bfd_arch_alpha, /* Dec Alpha */646 #define bfd_mach_alpha_ev4 0x10647 #define bfd_mach_alpha_ev5 0x20648 #define bfd_mach_alpha_ev6 0x30649 bfd_arch_arm, /* Advanced Risc Machines ARM */650 #define bfd_mach_arm_2 1651 #define bfd_mach_arm_2a 2652 #define bfd_mach_arm_3 3653 #define bfd_mach_arm_3M 4654 #define bfd_mach_arm_4 5655 #define bfd_mach_arm_4T 6656 #define bfd_mach_arm_5 7657 #define bfd_mach_arm_5T 8658 #define bfd_mach_arm_5TE 9659 #define bfd_mach_arm_XScale 10660 bfd_arch_ns32k, /* National Semiconductors ns32000 */661 bfd_arch_w65, /* WDC 65816 */662 bfd_arch_tic30, /* Texas Instruments TMS320C30 */663 bfd_arch_tic54x, /* Texas Instruments TMS320C54X */664 bfd_arch_tic80, /* TI TMS320c80 (MVP) */665 bfd_arch_v850, /* NEC V850 */666 #define bfd_mach_v850 0667 #define bfd_mach_v850e 'E'668 #define bfd_mach_v850ea 'A'669 bfd_arch_arc, /* ARC Cores */670 #define bfd_mach_arc_5 0671 #define bfd_mach_arc_6 1672 #define bfd_mach_arc_7 2673 #define bfd_mach_arc_8 3674 bfd_arch_m32r, /* Mitsubishi M32R/D */675 #define bfd_mach_m32r 0 /* backwards compatibility */676 #define bfd_mach_m32rx 'x'677 bfd_arch_mn10200, /* Matsushita MN10200 */678 bfd_arch_mn10300, /* Matsushita MN10300 */679 #define bfd_mach_mn10300 300680 #define bfd_mach_am33 330681 bfd_arch_fr30,682 #define bfd_mach_fr30 0x46523330683 bfd_arch_mcore,684 bfd_arch_ia64, /* HP/Intel ia64 */685 #define bfd_mach_ia64_elf64 0686 #define bfd_mach_ia64_elf32 1687 bfd_arch_pj,688 bfd_arch_avr, /* Atmel AVR microcontrollers */689 #define bfd_mach_avr1 1690 #define bfd_mach_avr2 2691 #define bfd_mach_avr3 3692 #define bfd_mach_avr4 4693 #define bfd_mach_avr5 5694 bfd_arch_cris, /* Axis CRIS */695 bfd_arch_last696 };697 698 bfd_arch_info699 -------------700 701 *Description*702 This structure contains information on architectures for use within BFD.703 704 typedef struct bfd_arch_info705 {706 int bits_per_word;707 int bits_per_address;708 int bits_per_byte;709 enum bfd_architecture arch;710 unsigned long mach;711 const char *arch_name;712 const char *printable_name;713 unsigned int section_align_power;714 /* True if this is the default machine for the architecture. */715 boolean the_default;716 const struct bfd_arch_info * (*compatible)717 PARAMS ((const struct bfd_arch_info *a,718 const struct bfd_arch_info *b));719 720 boolean (*scan) PARAMS ((const struct bfd_arch_info *, const char *));721 722 const struct bfd_arch_info *next;723 } bfd_arch_info_type;724 725 `bfd_printable_name'726 ....................727 728 *Synopsis*729 const char *bfd_printable_name(bfd *abfd);730 *Description*731 Return a printable string representing the architecture and machine732 from the pointer to the architecture info structure.733 734 `bfd_scan_arch'735 ...............736 737 *Synopsis*738 const bfd_arch_info_type *bfd_scan_arch(const char *string);739 *Description*740 Figure out if BFD supports any cpu which could be described with the741 name STRING. Return a pointer to an `arch_info' structure if a machine742 is found, otherwise NULL.743 744 `bfd_arch_list'745 ...............746 747 *Synopsis*748 const char **bfd_arch_list(void);749 *Description*750 Return a freshly malloced NULL-terminated vector of the names of all751 the valid BFD architectures. Do not modify the names.752 753 `bfd_arch_get_compatible'754 .........................755 756 *Synopsis*757 const bfd_arch_info_type *bfd_arch_get_compatible(758 const bfd *abfd,759 const bfd *bbfd);760 *Description*761 Determine whether two BFDs' architectures and machine types are762 compatible. Calculates the lowest common denominator between the two763 architectures and machine types implied by the BFDs and returns a764 pointer to an `arch_info' structure describing the compatible machine.765 766 `bfd_default_arch_struct'767 .........................768 769 *Description*770 The `bfd_default_arch_struct' is an item of `bfd_arch_info_type' which771 has been initialized to a fairly generic state. A BFD starts life by772 pointing to this structure, until the correct back end has determined773 the real architecture of the file.774 extern const bfd_arch_info_type bfd_default_arch_struct;775 776 `bfd_set_arch_info'777 ...................778 779 *Synopsis*780 void bfd_set_arch_info(bfd *abfd, const bfd_arch_info_type *arg);781 *Description*782 Set the architecture info of ABFD to ARG.783 784 `bfd_default_set_arch_mach'785 ...........................786 787 *Synopsis*788 boolean bfd_default_set_arch_mach(bfd *abfd,789 enum bfd_architecture arch,790 unsigned long mach);791 *Description*792 Set the architecture and machine type in BFD ABFD to ARCH and MACH.793 Find the correct pointer to a structure and insert it into the794 `arch_info' pointer.795 796 `bfd_get_arch'797 ..............798 799 *Synopsis*800 enum bfd_architecture bfd_get_arch(bfd *abfd);801 *Description*802 Return the enumerated type which describes the BFD ABFD's architecture.803 804 `bfd_get_mach'805 ..............806 807 *Synopsis*808 unsigned long bfd_get_mach(bfd *abfd);809 *Description*810 Return the long type which describes the BFD ABFD's machine.811 812 `bfd_arch_bits_per_byte'813 ........................814 815 *Synopsis*816 unsigned int bfd_arch_bits_per_byte(bfd *abfd);817 *Description*818 Return the number of bits in one of the BFD ABFD's architecture's bytes.819 820 `bfd_arch_bits_per_address'821 ...........................822 823 *Synopsis*824 unsigned int bfd_arch_bits_per_address(bfd *abfd);825 *Description*826 Return the number of bits in one of the BFD ABFD's architecture's827 addresses.828 829 `bfd_default_compatible'830 ........................831 832 *Synopsis*833 const bfd_arch_info_type *bfd_default_compatible834 (const bfd_arch_info_type *a,835 const bfd_arch_info_type *b);836 *Description*837 The default function for testing for compatibility.838 839 `bfd_default_scan'840 ..................841 842 *Synopsis*843 boolean bfd_default_scan(const struct bfd_arch_info *info, const char *string);844 *Description*845 The default function for working out whether this is an architecture846 hit and a machine hit.847 848 `bfd_get_arch_info'849 ...................850 851 *Synopsis*852 const bfd_arch_info_type * bfd_get_arch_info(bfd *abfd);853 *Description*854 Return the architecture info struct in ABFD.855 856 `bfd_lookup_arch'857 .................858 859 *Synopsis*860 const bfd_arch_info_type *bfd_lookup_arch861 (enum bfd_architecture862 arch,863 unsigned long machine);864 *Description*865 Look for the architecure info structure which matches the arguments866 ARCH and MACHINE. A machine of 0 matches the machine/architecture867 structure which marks itself as the default.868 869 `bfd_printable_arch_mach'870 .........................871 872 *Synopsis*873 const char *bfd_printable_arch_mach874 (enum bfd_architecture arch, unsigned long machine);875 *Description*876 Return a printable string representing the architecture and machine877 type.878 879 This routine is depreciated.880 881 `bfd_octets_per_byte'882 .....................883 884 *Synopsis*885 unsigned int bfd_octets_per_byte(bfd *abfd);886 *Description*887 Return the number of octets (8-bit quantities) per target byte (minimum888 addressable unit). In most cases, this will be one, but some DSP889 targets have 16, 32, or even 48 bits per byte.890 891 `bfd_arch_mach_octets_per_byte'892 ...............................893 894 *Synopsis*895 unsigned int bfd_arch_mach_octets_per_byte(enum bfd_architecture arch,896 unsigned long machine);897 *Description*898 See bfd_octets_per_byte.899 900 This routine is provided for those cases where a bfd * is not901 available902 903 904 File: bfd.info, Node: Opening and Closing, Next: Internal, Prev: Architectures, Up: BFD front end905 906 Opening and closing BFDs907 ========================908 909 `bfd_openr'910 ...........911 912 *Synopsis*913 bfd *bfd_openr(CONST char *filename, CONST char *target);914 *Description*915 Open the file FILENAME (using `fopen') with the target TARGET. Return916 a pointer to the created BFD.917 918 Calls `bfd_find_target', so TARGET is interpreted as by that919 function.920 921 If `NULL' is returned then an error has occured. Possible errors922 are `bfd_error_no_memory', `bfd_error_invalid_target' or `system_call'923 error.924 925 `bfd_fdopenr'926 .............927 928 *Synopsis*929 bfd *bfd_fdopenr(CONST char *filename, CONST char *target, int fd);930 *Description*931 `bfd_fdopenr' is to `bfd_fopenr' much like `fdopen' is to `fopen'. It932 opens a BFD on a file already described by the FD supplied.933 934 When the file is later `bfd_close'd, the file descriptor will be935 closed.936 937 If the caller desires that this file descriptor be cached by BFD938 (opened as needed, closed as needed to free descriptors for other939 opens), with the supplied FD used as an initial file descriptor (but940 subject to closure at any time), call bfd_set_cacheable(bfd, 1) on the941 returned BFD. The default is to assume no cacheing; the file942 descriptor will remain open until `bfd_close', and will not be affected943 by BFD operations on other files.944 945 Possible errors are `bfd_error_no_memory',946 `bfd_error_invalid_target' and `bfd_error_system_call'.947 948 `bfd_openstreamr'949 .................950 951 *Synopsis*952 bfd *bfd_openstreamr(const char *, const char *, PTR);953 *Description*954 Open a BFD for read access on an existing stdio stream. When the BFD955 is passed to `bfd_close', the stream will be closed.956 957 `bfd_openw'958 ...........959 960 *Synopsis*961 bfd *bfd_openw(CONST char *filename, CONST char *target);962 *Description*963 Create a BFD, associated with file FILENAME, using the file format964 TARGET, and return a pointer to it.965 966 Possible errors are `bfd_error_system_call', `bfd_error_no_memory',967 `bfd_error_invalid_target'.968 969 `bfd_close'970 ...........971 972 *Synopsis*973 boolean bfd_close(bfd *abfd);974 *Description*975 Close a BFD. If the BFD was open for writing, then pending operations976 are completed and the file written out and closed. If the created file977 is executable, then `chmod' is called to mark it as such.978 979 All memory attached to the BFD is released.980 981 The file descriptor associated with the BFD is closed (even if it982 was passed in to BFD by `bfd_fdopenr').983 984 *Returns*985 `true' is returned if all is ok, otherwise `false'.986 987 `bfd_close_all_done'988 ....................989 990 *Synopsis*991 boolean bfd_close_all_done(bfd *);992 *Description*993 Close a BFD. Differs from `bfd_close' since it does not complete any994 pending operations. This routine would be used if the application had995 just used BFD for swapping and didn't want to use any of the writing996 code.997 998 If the created file is executable, then `chmod' is called to mark it999 as such.1000 1001 All memory attached to the BFD is released.1002 1003 *Returns*1004 `true' is returned if all is ok, otherwise `false'.1005 1006 `bfd_create'1007 ............1008 1009 *Synopsis*1010 bfd *bfd_create(CONST char *filename, bfd *templ);1011 *Description*1012 Create a new BFD in the manner of `bfd_openw', but without opening a1013 file. The new BFD takes the target from the target used by TEMPLATE. The1014 format is always set to `bfd_object'.1015 1016 `bfd_make_writable'1017 ...................1018 1019 *Synopsis*1020 boolean bfd_make_writable(bfd *abfd);1021 *Description*1022 Takes a BFD as created by `bfd_create' and converts it into one like as1023 returned by `bfd_openw'. It does this by converting the BFD to1024 BFD_IN_MEMORY. It's assumed that you will call `bfd_make_readable' on1025 this bfd later.1026 1027 *Returns*1028 `true' is returned if all is ok, otherwise `false'.1029 1030 `bfd_make_readable'1031 ...................1032 1033 *Synopsis*1034 boolean bfd_make_readable(bfd *abfd);1035 *Description*1036 Takes a BFD as created by `bfd_create' and `bfd_make_writable' and1037 converts it into one like as returned by `bfd_openr'. It does this by1038 writing the contents out to the memory buffer, then reversing the1039 direction.1040 1041 *Returns*1042 `true' is returned if all is ok, otherwise `false'.1043 1044 `bfd_alloc'1045 ...........1046 1047 *Synopsis*1048 PTR bfd_alloc (bfd *abfd, size_t wanted);1049 *Description*1050 Allocate a block of WANTED bytes of memory attached to `abfd' and1051 return a pointer to it.1052 1053 1054 File: bfd.info, Node: Internal, Next: File Caching, Prev: Opening and Closing, Up: BFD front end1055 1056 Internal functions1057 ==================1058 1059 *Description*1060 These routines are used within BFD. They are not intended for export,1061 but are documented here for completeness.1062 1063 `bfd_write_bigendian_4byte_int'1064 ...............................1065 1066 *Synopsis*1067 void bfd_write_bigendian_4byte_int(bfd *abfd, int i);1068 *Description*1069 Write a 4 byte integer I to the output BFD ABFD, in big endian order1070 regardless of what else is going on. This is useful in archives.1071 1072 `bfd_put_size'1073 ..............1074 1075 `bfd_get_size'1076 ..............1077 1078 *Description*1079 These macros as used for reading and writing raw data in sections; each1080 access (except for bytes) is vectored through the target format of the1081 BFD and mangled accordingly. The mangling performs any necessary endian1082 translations and removes alignment restrictions. Note that types1083 accepted and returned by these macros are identical so they can be1084 swapped around in macros--for example, `libaout.h' defines `GET_WORD'1085 to either `bfd_get_32' or `bfd_get_64'.1086 1087 In the put routines, VAL must be a `bfd_vma'. If we are on a system1088 without prototypes, the caller is responsible for making sure that is1089 true, with a cast if necessary. We don't cast them in the macro1090 definitions because that would prevent `lint' or `gcc -Wall' from1091 detecting sins such as passing a pointer. To detect calling these with1092 less than a `bfd_vma', use `gcc -Wconversion' on a host with 64 bit1093 `bfd_vma''s.1094 1095 /* Byte swapping macros for user section data. */1096 1097 #define bfd_put_8(abfd, val, ptr) \1098 ((void) (*((unsigned char *) (ptr)) = (unsigned char) (val)))1099 #define bfd_put_signed_8 \1100 bfd_put_81101 #define bfd_get_8(abfd, ptr) \1102 (*(unsigned char *) (ptr))1103 #define bfd_get_signed_8(abfd, ptr) \1104 ((*(unsigned char *) (ptr) ^ 0x80) - 0x80)1105 1106 #define bfd_put_16(abfd, val, ptr) \1107 BFD_SEND(abfd, bfd_putx16, ((val),(ptr)))1108 #define bfd_put_signed_16 \1109 bfd_put_161110 #define bfd_get_16(abfd, ptr) \1111 BFD_SEND(abfd, bfd_getx16, (ptr))1112 #define bfd_get_signed_16(abfd, ptr) \1113 BFD_SEND (abfd, bfd_getx_signed_16, (ptr))1114 1115 #define bfd_put_32(abfd, val, ptr) \1116 BFD_SEND(abfd, bfd_putx32, ((val),(ptr)))1117 #define bfd_put_signed_32 \1118 bfd_put_321119 #define bfd_get_32(abfd, ptr) \1120 BFD_SEND(abfd, bfd_getx32, (ptr))1121 #define bfd_get_signed_32(abfd, ptr) \1122 BFD_SEND(abfd, bfd_getx_signed_32, (ptr))1123 1124 #define bfd_put_64(abfd, val, ptr) \1125 BFD_SEND(abfd, bfd_putx64, ((val), (ptr)))1126 #define bfd_put_signed_64 \1127 bfd_put_641128 #define bfd_get_64(abfd, ptr) \1129 BFD_SEND(abfd, bfd_getx64, (ptr))1130 #define bfd_get_signed_64(abfd, ptr) \1131 BFD_SEND(abfd, bfd_getx_signed_64, (ptr))1132 1133 #define bfd_get(bits, abfd, ptr) \1134 ((bits) == 8 ? bfd_get_8 (abfd, ptr) \1135 : (bits) == 16 ? bfd_get_16 (abfd, ptr) \1136 : (bits) == 32 ? bfd_get_32 (abfd, ptr) \1137 : (bits) == 64 ? bfd_get_64 (abfd, ptr) \1138 : (abort (), (bfd_vma) - 1))1139 1140 #define bfd_put(bits, abfd, val, ptr) \1141 ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \1142 : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \1143 : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \1144 : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \1145 : (abort (), (void) 0))1146 1147 `bfd_h_put_size'1148 ................1149 1150 *Description*1151 These macros have the same function as their `bfd_get_x' bretheren,1152 except that they are used for removing information for the header1153 records of object files. Believe it or not, some object files keep1154 their header records in big endian order and their data in little1155 endian order.1156 1157 /* Byte swapping macros for file header data. */1158 1159 #define bfd_h_put_8(abfd, val, ptr) \1160 bfd_put_8 (abfd, val, ptr)1161 #define bfd_h_put_signed_8(abfd, val, ptr) \1162 bfd_put_8 (abfd, val, ptr)1163 #define bfd_h_get_8(abfd, ptr) \1164 bfd_get_8 (abfd, ptr)1165 #define bfd_h_get_signed_8(abfd, ptr) \1166 bfd_get_signed_8 (abfd, ptr)1167 1168 #define bfd_h_put_16(abfd, val, ptr) \1169 BFD_SEND(abfd, bfd_h_putx16,(val,ptr))1170 #define bfd_h_put_signed_16 \1171 bfd_h_put_161172 #define bfd_h_get_16(abfd, ptr) \1173 BFD_SEND(abfd, bfd_h_getx16,(ptr))1174 #define bfd_h_get_signed_16(abfd, ptr) \1175 BFD_SEND(abfd, bfd_h_getx_signed_16, (ptr))1176 1177 #define bfd_h_put_32(abfd, val, ptr) \1178 BFD_SEND(abfd, bfd_h_putx32,(val,ptr))1179 #define bfd_h_put_signed_32 \1180 bfd_h_put_321181 #define bfd_h_get_32(abfd, ptr) \1182 BFD_SEND(abfd, bfd_h_getx32,(ptr))1183 #define bfd_h_get_signed_32(abfd, ptr) \1184 BFD_SEND(abfd, bfd_h_getx_signed_32, (ptr))1185 1186 #define bfd_h_put_64(abfd, val, ptr) \1187 BFD_SEND(abfd, bfd_h_putx64,(val, ptr))1188 #define bfd_h_put_signed_64 \1189 bfd_h_put_641190 #define bfd_h_get_64(abfd, ptr) \1191 BFD_SEND(abfd, bfd_h_getx64,(ptr))1192 #define bfd_h_get_signed_64(abfd, ptr) \1193 BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))1194 1195 `bfd_log2'1196 ..........1197 1198 *Synopsis*1199 unsigned int bfd_log2(bfd_vma x);1200 *Description*1201 Return the log base 2 of the value supplied, rounded up. E.g., an X of1202 1025 returns 11.1203 1204 1205 File: bfd.info, Node: File Caching, Next: Linker Functions, Prev: Internal, Up: BFD front end1206 1207 File caching1208 ============1209 1210 The file caching mechanism is embedded within BFD and allows the1211 application to open as many BFDs as it wants without regard to the1212 underlying operating system's file descriptor limit (often as low as 201213 open files). The module in `cache.c' maintains a least recently used1214 list of `BFD_CACHE_MAX_OPEN' files, and exports the name1215 `bfd_cache_lookup', which runs around and makes sure that the required1216 BFD is open. If not, then it chooses a file to close, closes it and1217 opens the one wanted, returning its file handle.1218 1219 `BFD_CACHE_MAX_OPEN macro'1220 ..........................1221 1222 *Description*1223 The maximum number of files which the cache will keep open at one time.1224 #define BFD_CACHE_MAX_OPEN 101225 1226 `bfd_last_cache'1227 ................1228 1229 *Synopsis*1230 extern bfd *bfd_last_cache;1231 *Description*1232 Zero, or a pointer to the topmost BFD on the chain. This is used by1233 the `bfd_cache_lookup' macro in `libbfd.h' to determine when it can1234 avoid a function call.1235 1236 `bfd_cache_lookup'1237 ..................1238 1239 *Description*1240 Check to see if the required BFD is the same as the last one looked up.1241 If so, then it can use the stream in the BFD with impunity, since it1242 can't have changed since the last lookup; otherwise, it has to perform1243 the complicated lookup function.1244 #define bfd_cache_lookup(x) \1245 ((x)==bfd_last_cache? \1246 (FILE*) (bfd_last_cache->iostream): \1247 bfd_cache_lookup_worker(x))1248 1249 `bfd_cache_init'1250 ................1251 1252 *Synopsis*1253 boolean bfd_cache_init (bfd *abfd);1254 *Description*1255 Add a newly opened BFD to the cache.1256 1257 `bfd_cache_close'1258 .................1259 1260 *Synopsis*1261 boolean bfd_cache_close (bfd *abfd);1262 *Description*1263 Remove the BFD ABFD from the cache. If the attached file is open, then1264 close it too.1265 1266 *Returns*1267 `false' is returned if closing the file fails, `true' is returned if1268 all is well.1269 1270 `bfd_open_file'1271 ...............1272 1273 *Synopsis*1274 FILE* bfd_open_file(bfd *abfd);1275 *Description*1276 Call the OS to open a file for ABFD. Return the `FILE *' (possibly1277 `NULL') that results from this operation. Set up the BFD so that1278 future accesses know the file is open. If the `FILE *' returned is1279 `NULL', then it won't have been put in the cache, so it won't have to1280 be removed from it.1281 1282 `bfd_cache_lookup_worker'1283 .........................1284 1285 *Synopsis*1286 FILE *bfd_cache_lookup_worker(bfd *abfd);1287 *Description*1288 Called when the macro `bfd_cache_lookup' fails to find a quick answer.1289 Find a file descriptor for ABFD. If necessary, it open it. If there1290 are already more than `BFD_CACHE_MAX_OPEN' files open, it tries to1291 close one first, to avoid running out of file descriptors.1292 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
