Rev 5197 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5197 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* Support for the generic parts of most COFF variants, for BFD. |
1 | /* Support for the generic parts of most COFF variants, for BFD. |
2 | Copyright 1990-2013 Free Software Foundation, Inc. |
2 | Copyright (C) 1990-2015 Free Software Foundation, Inc. |
3 | Written by Cygnus Support. |
3 | Written by Cygnus Support. |
Line 4... | Line 4... | ||
4 | 4 | ||
Line 5... | Line 5... | ||
5 | This file is part of BFD, the Binary File Descriptor library. |
5 | This file is part of BFD, the Binary File Descriptor library. |
Line 335... | Line 335... | ||
335 | . union |
335 | . union |
336 | . { |
336 | . { |
337 | . union internal_auxent auxent; |
337 | . union internal_auxent auxent; |
338 | . struct internal_syment syment; |
338 | . struct internal_syment syment; |
339 | . } u; |
339 | . } u; |
- | 340 | . |
|
- | 341 | . {* Selector for the union above. *} |
|
- | 342 | . bfd_boolean is_sym; |
|
340 | .} combined_entry_type; |
343 | .} combined_entry_type; |
341 | . |
344 | . |
342 | . |
345 | . |
343 | .{* Each canonical asymbol really looks like this: *} |
346 | .{* Each canonical asymbol really looks like this: *} |
344 | . |
347 | . |
Line 926... | Line 929... | ||
926 | char buf[SYMNMLEN + 1]; |
929 | char buf[SYMNMLEN + 1]; |
927 | const char *symname; |
930 | const char *symname; |
Line 928... | Line 931... | ||
928 | 931 | ||
Line 929... | Line 932... | ||
929 | bfd_coff_swap_sym_in (abfd, esym, & isym); |
932 | bfd_coff_swap_sym_in (abfd, esym, & isym); |
930 | - | ||
931 | if (sizeof (internal_s->s_name) > SYMNMLEN) |
- | |
932 | { |
- | |
933 | /* This case implies that the matching |
- | |
934 | symbol name will be in the string table. */ |
- | |
Line 935... | Line 933... | ||
935 | abort (); |
933 | |
936 | } |
934 | BFD_ASSERT (sizeof (internal_s->s_name) <= SYMNMLEN); |
937 | 935 | ||
938 | if (isym.n_scnum == section->target_index) |
936 | if (isym.n_scnum == section->target_index) |
Line 962... | Line 960... | ||
962 | follows the $) as the comdat symbol. */ |
960 | follows the $) as the comdat symbol. */ |
Line 963... | Line 961... | ||
963 | 961 | ||
964 | /* All 3 branches use this. */ |
962 | /* All 3 branches use this. */ |
Line -... | Line 963... | ||
- | 963 | symname = _bfd_coff_internal_syment_name (abfd, &isym, buf); |
|
965 | symname = _bfd_coff_internal_syment_name (abfd, &isym, buf); |
964 | |
- | 965 | /* PR 17512 file: 078-11867-0.004 */ |
|
- | 966 | if (symname == NULL) |
|
966 | 967 | { |
|
- | 968 | _bfd_error_handler (_("%B: unable to load COMDAT section name"), abfd); |
|
Line 967... | Line 969... | ||
967 | if (symname == NULL) |
969 | break; |
968 | abort (); |
970 | } |
969 | 971 | ||
970 | switch (seen_state) |
972 | switch (seen_state) |
Line 1005... | Line 1007... | ||
1005 | _bfd_error_handler (_("%B: warning: COMDAT symbol '%s' does not match section name '%s'"), |
1007 | _bfd_error_handler (_("%B: warning: COMDAT symbol '%s' does not match section name '%s'"), |
1006 | abfd, symname, name); |
1008 | abfd, symname, name); |
Line 1007... | Line 1009... | ||
1007 | 1009 | ||
Line -... | Line 1010... | ||
- | 1010 | seen_state = 1; |
|
- | 1011 | ||
- | 1012 | /* PR 17512: file: e2cfe54f. */ |
|
- | 1013 | if (esym + bfd_coff_symesz (abfd) >= esymend) |
|
- | 1014 | { |
|
- | 1015 | _bfd_error_handler (_("%B: warning: No symbol for section '%s' found"), |
|
- | 1016 | abfd, symname); |
|
1008 | seen_state = 1; |
1017 | break; |
1009 | 1018 | } |
|
1010 | /* This is the section symbol. */ |
1019 | /* This is the section symbol. */ |
1011 | bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)), |
1020 | bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)), |
Line 1158... | Line 1167... | ||
1158 | const char *name, |
1167 | const char *name, |
1159 | asection *section, |
1168 | asection *section, |
1160 | flagword *flags_ptr) |
1169 | flagword *flags_ptr) |
1161 | { |
1170 | { |
1162 | struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; |
1171 | struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; |
1163 | long styp_flags = internal_s->s_flags; |
1172 | unsigned long styp_flags = internal_s->s_flags; |
1164 | flagword sec_flags; |
1173 | flagword sec_flags; |
1165 | bfd_boolean result = TRUE; |
1174 | bfd_boolean result = TRUE; |
1166 | bfd_boolean is_dbg = FALSE; |
1175 | bfd_boolean is_dbg = FALSE; |
Line 1167... | Line 1176... | ||
1167 | 1176 | ||
Line 1181... | Line 1190... | ||
1181 | sec_flags |= SEC_COFF_NOREAD; |
1190 | sec_flags |= SEC_COFF_NOREAD; |
Line 1182... | Line 1191... | ||
1182 | 1191 | ||
1183 | /* Process each flag bit in styp_flags in turn. */ |
1192 | /* Process each flag bit in styp_flags in turn. */ |
1184 | while (styp_flags) |
1193 | while (styp_flags) |
1185 | { |
1194 | { |
1186 | long flag = styp_flags & - styp_flags; |
1195 | unsigned long flag = styp_flags & - styp_flags; |
Line 1187... | Line 1196... | ||
1187 | char * unhandled = NULL; |
1196 | char * unhandled = NULL; |
Line 1188... | Line 1197... | ||
1188 | 1197 | ||
Line 1341... | Line 1350... | ||
1341 | . COFF_SYMBOL_LOCAL, |
1350 | . COFF_SYMBOL_LOCAL, |
1342 | . {* PE section symbol. *} |
1351 | . {* PE section symbol. *} |
1343 | . COFF_SYMBOL_PE_SECTION |
1352 | . COFF_SYMBOL_PE_SECTION |
1344 | .}; |
1353 | .}; |
1345 | . |
1354 | . |
- | 1355 | .typedef asection * (*coff_gc_mark_hook_fn) |
|
- | 1356 | . (asection *, struct bfd_link_info *, struct internal_reloc *, |
|
- | 1357 | . struct coff_link_hash_entry *, struct internal_syment *); |
|
- | 1358 | . |
|
1346 | Special entry points for gdb to swap in coff symbol table parts: |
1359 | Special entry points for gdb to swap in coff symbol table parts: |
1347 | .typedef struct |
1360 | .typedef struct |
1348 | .{ |
1361 | .{ |
1349 | . void (*_bfd_coff_swap_aux_in) |
1362 | . void (*_bfd_coff_swap_aux_in) |
1350 | . (bfd *, void *, int, int, int, int, void *); |
1363 | . (bfd *, void *, int, int, int, int, void *); |
Line 1391... | Line 1404... | ||
1391 | . (bfd *, int); |
1404 | . (bfd *, int); |
1392 | . |
1405 | . |
1393 | . unsigned int _bfd_coff_default_section_alignment_power; |
1406 | . unsigned int _bfd_coff_default_section_alignment_power; |
1394 | . bfd_boolean _bfd_coff_force_symnames_in_strings; |
1407 | . bfd_boolean _bfd_coff_force_symnames_in_strings; |
1395 | . unsigned int _bfd_coff_debug_string_prefix_length; |
1408 | . unsigned int _bfd_coff_debug_string_prefix_length; |
- | 1409 | . unsigned int _bfd_coff_max_nscns; |
|
1396 | . |
1410 | . |
1397 | . void (*_bfd_coff_swap_filehdr_in) |
1411 | . void (*_bfd_coff_swap_filehdr_in) |
1398 | . (bfd *, void *, void *); |
1412 | . (bfd *, void *, void *); |
1399 | . |
1413 | . |
1400 | . void (*_bfd_coff_swap_aouthdr_in) |
1414 | . void (*_bfd_coff_swap_aouthdr_in) |
Line 1528... | Line 1542... | ||
1528 | . (coff_backend_info (abfd)->_bfd_coff_long_section_names) |
1542 | . (coff_backend_info (abfd)->_bfd_coff_long_section_names) |
1529 | .#define bfd_coff_set_long_section_names(abfd, enable) \ |
1543 | .#define bfd_coff_set_long_section_names(abfd, enable) \ |
1530 | . ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable)) |
1544 | . ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable)) |
1531 | .#define bfd_coff_default_section_alignment_power(abfd) \ |
1545 | .#define bfd_coff_default_section_alignment_power(abfd) \ |
1532 | . (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) |
1546 | . (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) |
- | 1547 | .#define bfd_coff_max_nscns(abfd) \ |
|
- | 1548 | . (coff_backend_info (abfd)->_bfd_coff_max_nscns) |
|
- | 1549 | . |
|
1533 | .#define bfd_coff_swap_filehdr_in(abfd, i,o) \ |
1550 | .#define bfd_coff_swap_filehdr_in(abfd, i,o) \ |
1534 | . ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) |
1551 | . ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) |
1535 | . |
1552 | . |
1536 | .#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ |
1553 | .#define bfd_coff_swap_aouthdr_in(abfd, i,o) \ |
1537 | . ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) |
1554 | . ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o)) |
Line 1791... | Line 1808... | ||
1791 | symbol information, since they'll be overridden by the BFD symbol |
1808 | symbol information, since they'll be overridden by the BFD symbol |
1792 | anyhow. However, we do need to set the type and storage class, |
1809 | anyhow. However, we do need to set the type and storage class, |
1793 | in case this symbol winds up getting written out. The value 0 |
1810 | in case this symbol winds up getting written out. The value 0 |
1794 | for n_numaux is already correct. */ |
1811 | for n_numaux is already correct. */ |
Line -... | Line 1812... | ||
- | 1812 | ||
1795 | 1813 | native->is_sym = TRUE; |
|
1796 | native->u.syment.n_type = T_NULL; |
1814 | native->u.syment.n_type = T_NULL; |
Line 1797... | Line 1815... | ||
1797 | native->u.syment.n_sclass = sclass; |
1815 | native->u.syment.n_sclass = sclass; |
Line 2064... | Line 2082... | ||
2064 | if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0) |
2082 | if ((internal_f->f_flags & IMAGE_FILE_DEBUG_STRIPPED) == 0) |
2065 | abfd->flags |= HAS_DEBUG; |
2083 | abfd->flags |= HAS_DEBUG; |
2066 | #endif |
2084 | #endif |
Line 2067... | Line 2085... | ||
2067 | 2085 | ||
- | 2086 | if ((internal_f->f_flags & F_GO32STUB) != 0) |
|
2068 | if ((internal_f->f_flags & F_GO32STUB) != 0) |
2087 | { |
- | 2088 | coff->go32stub = (char *) bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE); |
|
- | 2089 | if (coff->go32stub == NULL) |
|
- | 2090 | return NULL; |
|
2069 | coff->go32stub = (char *) bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE); |
2091 | } |
2070 | if (coff->go32stub != NULL) |
2092 | if (coff->go32stub != NULL) |
Line 2071... | Line 2093... | ||
2071 | memcpy (coff->go32stub, internal_f->go32stub, GO32_STUBSIZE); |
2093 | memcpy (coff->go32stub, internal_f->go32stub, GO32_STUBSIZE); |
2072 | 2094 | ||
Line 2090... | Line 2112... | ||
2090 | 2112 | ||
2091 | /* Zero selects the default machine for an arch. */ |
2113 | /* Zero selects the default machine for an arch. */ |
2092 | machine = 0; |
2114 | machine = 0; |
2093 | switch (internal_f->f_magic) |
2115 | switch (internal_f->f_magic) |
2094 | { |
- | |
2095 | #ifdef OR32_MAGIC_BIG |
- | |
2096 | case OR32_MAGIC_BIG: |
- | |
2097 | case OR32_MAGIC_LITTLE: |
- | |
2098 | arch = bfd_arch_or32; |
- | |
2099 | break; |
- | |
2100 | #endif |
2116 | { |
2101 | #ifdef PPCMAGIC |
2117 | #ifdef PPCMAGIC |
2102 | case PPCMAGIC: |
2118 | case PPCMAGIC: |
2103 | arch = bfd_arch_powerpc; |
2119 | arch = bfd_arch_powerpc; |
2104 | break; |
2120 | break; |
Line 2275... | Line 2291... | ||
2275 | bfd_byte *buf; |
2291 | bfd_byte *buf; |
2276 | struct internal_syment sym; |
2292 | struct internal_syment sym; |
2277 | bfd_size_type amt = bfd_coff_symesz (abfd); |
2293 | bfd_size_type amt = bfd_coff_symesz (abfd); |
Line 2278... | Line 2294... | ||
2278 | 2294 | ||
- | 2295 | buf = bfd_malloc (amt); |
|
- | 2296 | if (buf == NULL) |
|
2279 | buf = bfd_malloc (amt); |
2297 | return FALSE; |
2280 | if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 |
2298 | if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 |
2281 | || bfd_bread (buf, amt, abfd) != amt) |
2299 | || bfd_bread (buf, amt, abfd) != amt) |
2282 | { |
2300 | { |
2283 | free (buf); |
2301 | free (buf); |
Line 2498... | Line 2516... | ||
2498 | combined_entry_type *table_base, |
2516 | combined_entry_type *table_base, |
2499 | combined_entry_type *symbol, |
2517 | combined_entry_type *symbol, |
2500 | unsigned int indaux, |
2518 | unsigned int indaux, |
2501 | combined_entry_type *aux) |
2519 | combined_entry_type *aux) |
2502 | { |
2520 | { |
- | 2521 | BFD_ASSERT (symbol->is_sym); |
|
2503 | int n_sclass = symbol->u.syment.n_sclass; |
2522 | int n_sclass = symbol->u.syment.n_sclass; |
Line 2504... | Line 2523... | ||
2504 | 2523 | ||
2505 | if (CSECT_SYM_P (n_sclass) |
2524 | if (CSECT_SYM_P (n_sclass) |
2506 | && indaux + 1 == symbol->u.syment.n_numaux) |
2525 | && indaux + 1 == symbol->u.syment.n_numaux) |
- | 2526 | { |
|
2507 | { |
2527 | BFD_ASSERT (! aux->is_sym); |
2508 | if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD) |
2528 | if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD) |
2509 | { |
2529 | { |
2510 | aux->u.auxent.x_csect.x_scnlen.p = |
2530 | aux->u.auxent.x_csect.x_scnlen.p = |
2511 | table_base + aux->u.auxent.x_csect.x_scnlen.l; |
2531 | table_base + aux->u.auxent.x_csect.x_scnlen.l; |
Line 2535... | Line 2555... | ||
2535 | combined_entry_type *aux ATTRIBUTE_UNUSED) |
2555 | combined_entry_type *aux ATTRIBUTE_UNUSED) |
2536 | { |
2556 | { |
2537 | /* Return TRUE if we don't want to pointerize this aux entry, which |
2557 | /* Return TRUE if we don't want to pointerize this aux entry, which |
2538 | is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ |
2558 | is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ |
2539 | return (indaux == 1 |
2559 | return (indaux == 1 |
- | 2560 | && symbol->is_sym |
|
2540 | && (symbol->u.syment.n_sclass == C_LEAFPROC |
2561 | && (symbol->u.syment.n_sclass == C_LEAFPROC |
2541 | || symbol->u.syment.n_sclass == C_LEAFSTAT |
2562 | || symbol->u.syment.n_sclass == C_LEAFSTAT |
2542 | || symbol->u.syment.n_sclass == C_LEAFEXT)); |
2563 | || symbol->u.syment.n_sclass == C_LEAFEXT)); |
2543 | } |
2564 | } |
Line 2557... | Line 2578... | ||
2557 | combined_entry_type *table_base ATTRIBUTE_UNUSED, |
2578 | combined_entry_type *table_base ATTRIBUTE_UNUSED, |
2558 | combined_entry_type *symbol ATTRIBUTE_UNUSED, |
2579 | combined_entry_type *symbol ATTRIBUTE_UNUSED, |
2559 | combined_entry_type *aux ATTRIBUTE_UNUSED, |
2580 | combined_entry_type *aux ATTRIBUTE_UNUSED, |
2560 | unsigned int indaux ATTRIBUTE_UNUSED) |
2581 | unsigned int indaux ATTRIBUTE_UNUSED) |
2561 | { |
2582 | { |
- | 2583 | BFD_ASSERT (symbol->is_sym); |
|
- | 2584 | BFD_ASSERT (! aux->is_sym); |
|
2562 | #ifdef RS6000COFF_C |
2585 | #ifdef RS6000COFF_C |
2563 | if (CSECT_SYM_P (symbol->u.syment.n_sclass) |
2586 | if (CSECT_SYM_P (symbol->u.syment.n_sclass) |
2564 | && indaux + 1 == symbol->u.syment.n_numaux) |
2587 | && indaux + 1 == symbol->u.syment.n_numaux) |
2565 | { |
2588 | { |
2566 | /* This is a csect entry. */ |
2589 | /* This is a csect entry. */ |
Line 2658... | Line 2681... | ||
2658 | bfd_size_type amt; |
2681 | bfd_size_type amt; |
Line 2659... | Line 2682... | ||
2659 | 2682 | ||
2660 | amt = s->reloc_count; |
2683 | amt = s->reloc_count; |
2661 | amt *= sizeof (arelent *); |
2684 | amt *= sizeof (arelent *); |
- | 2685 | p = bfd_malloc (amt); |
|
- | 2686 | if (p == NULL) |
|
2662 | p = bfd_malloc (amt); |
2687 | { |
2663 | if (p == NULL && s->reloc_count > 0) |
2688 | if (s->reloc_count > 0) |
- | 2689 | return FALSE; |
|
- | 2690 | } |
|
- | 2691 | else |
|
2664 | return FALSE; |
2692 | { |
2665 | memcpy (p, s->orelocation, (size_t) amt); |
2693 | memcpy (p, s->orelocation, (size_t) amt); |
2666 | qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); |
2694 | qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); |
- | 2695 | } |
|
2667 | } |
2696 | } |
Line 2668... | Line 2697... | ||
2668 | #endif |
2697 | #endif |
2669 | 2698 | ||
Line 3062... | Line 3091... | ||
3062 | case bfd_arch_w65: |
3091 | case bfd_arch_w65: |
3063 | *magicp = W65MAGIC; |
3092 | *magicp = W65MAGIC; |
3064 | return TRUE; |
3093 | return TRUE; |
3065 | #endif |
3094 | #endif |
Line 3066... | Line -... | ||
3066 | - | ||
3067 | #ifdef OR32_MAGIC_BIG |
- | |
3068 | case bfd_arch_or32: |
- | |
3069 | if (bfd_big_endian (abfd)) |
- | |
3070 | * magicp = OR32_MAGIC_BIG; |
- | |
3071 | else |
- | |
3072 | * magicp = OR32_MAGIC_LITTLE; |
- | |
3073 | return TRUE; |
- | |
3074 | #endif |
- | |
3075 | 3095 | ||
3076 | default: /* Unknown architecture. */ |
3096 | default: /* Unknown architecture. */ |
3077 | /* Fall through to "return FALSE" below, to avoid |
3097 | /* Fall through to "return FALSE" below, to avoid |
3078 | "statement never reached" errors on the one below. */ |
3098 | "statement never reached" errors on the one below. */ |
3079 | break; |
3099 | break; |
Line 3134... | Line 3154... | ||
3134 | coff_compute_section_file_positions (bfd * abfd) |
3154 | coff_compute_section_file_positions (bfd * abfd) |
3135 | { |
3155 | { |
3136 | asection *current; |
3156 | asection *current; |
3137 | file_ptr sofar = bfd_coff_filhsz (abfd); |
3157 | file_ptr sofar = bfd_coff_filhsz (abfd); |
3138 | bfd_boolean align_adjust; |
3158 | bfd_boolean align_adjust; |
3139 | int target_index; |
3159 | unsigned int target_index; |
3140 | #ifdef ALIGN_SECTIONS_IN_FILE |
3160 | #ifdef ALIGN_SECTIONS_IN_FILE |
3141 | asection *previous = NULL; |
3161 | asection *previous = NULL; |
3142 | file_ptr old_sofar; |
3162 | file_ptr old_sofar; |
3143 | #endif |
3163 | #endif |
Line 3144... | Line 3164... | ||
3144 | 3164 | ||
3145 | #ifdef COFF_IMAGE_WITH_PE |
3165 | #ifdef COFF_IMAGE_WITH_PE |
Line 3146... | Line 3166... | ||
3146 | int page_size; |
3166 | int page_size; |
- | 3167 | ||
3147 | 3168 | if (coff_data (abfd)->link_info |
|
3148 | if (coff_data (abfd)->link_info) |
3169 | || (pe_data (abfd) && pe_data (abfd)->pe_opthdr.FileAlignment)) |
Line 3149... | Line 3170... | ||
3149 | { |
3170 | { |
3150 | page_size = pe_data (abfd)->pe_opthdr.FileAlignment; |
3171 | page_size = pe_data (abfd)->pe_opthdr.FileAlignment; |
3151 | 3172 | ||
3152 | /* If no file alignment has been set, default to one. |
3173 | /* If no file alignment has been set, default to one. |
- | 3174 | This repairs 'ld -r' for arm-wince-pe target. */ |
|
- | 3175 | if (page_size == 0) |
|
- | 3176 | page_size = 1; |
|
- | 3177 | ||
- | 3178 | /* PR 17512: file: 0ac816d3. */ |
|
- | 3179 | if (page_size < 0) |
|
- | 3180 | { |
|
- | 3181 | bfd_set_error (bfd_error_file_too_big); |
|
- | 3182 | (*_bfd_error_handler) |
|
3153 | This repairs 'ld -r' for arm-wince-pe target. */ |
3183 | (_("%B: page size is too large (0x%x)"), abfd, page_size); |
3154 | if (page_size == 0) |
3184 | return FALSE; |
3155 | page_size = 1; |
3185 | } |
3156 | } |
3186 | } |
3157 | else |
3187 | else |
Line 3174... | Line 3204... | ||
3174 | symcount = bfd_get_symcount (abfd); |
3204 | symcount = bfd_get_symcount (abfd); |
3175 | for (symp = abfd->outsymbols, i = 0; i < symcount; symp++, i++) |
3205 | for (symp = abfd->outsymbols, i = 0; i < symcount; symp++, i++) |
3176 | { |
3206 | { |
3177 | coff_symbol_type *cf; |
3207 | coff_symbol_type *cf; |
Line 3178... | Line 3208... | ||
3178 | 3208 | ||
3179 | cf = coff_symbol_from (abfd, *symp); |
3209 | cf = coff_symbol_from (*symp); |
3180 | if (cf != NULL |
3210 | if (cf != NULL |
- | 3211 | && cf->native != NULL |
|
3181 | && cf->native != NULL |
3212 | && cf->native->is_sym |
3182 | && SYMNAME_IN_DEBUG (&cf->native->u.syment)) |
3213 | && SYMNAME_IN_DEBUG (&cf->native->u.syment)) |
3183 | { |
3214 | { |
Line 3184... | Line 3215... | ||
3184 | size_t len; |
3215 | size_t len; |
Line 3302... | Line 3333... | ||
3302 | for (current = abfd->sections; current != NULL; current = current->next) |
3333 | for (current = abfd->sections; current != NULL; current = current->next) |
3303 | current->target_index = target_index++; |
3334 | current->target_index = target_index++; |
3304 | } |
3335 | } |
3305 | #endif /* ! COFF_IMAGE_WITH_PE */ |
3336 | #endif /* ! COFF_IMAGE_WITH_PE */ |
Line 3306... | Line 3337... | ||
3306 | 3337 | ||
3307 | if (target_index >= 32768) |
3338 | if (target_index >= bfd_coff_max_nscns (abfd)) |
3308 | { |
3339 | { |
3309 | bfd_set_error (bfd_error_file_too_big); |
3340 | bfd_set_error (bfd_error_file_too_big); |
3310 | (*_bfd_error_handler) |
3341 | (*_bfd_error_handler) |
3311 | (_("%B: too many sections (%d)"), abfd, target_index); |
3342 | (_("%B: too many sections (%d)"), abfd, target_index); |
Line 3871... | Line 3902... | ||
3871 | psymsec = psym; |
3902 | psymsec = psym; |
Line 3872... | Line 3903... | ||
3872 | 3903 | ||
3873 | /* See if this is the section symbol. */ |
3904 | /* See if this is the section symbol. */ |
3874 | if (strcmp ((*psym)->name, current->name) == 0) |
3905 | if (strcmp ((*psym)->name, current->name) == 0) |
3875 | { |
3906 | { |
3876 | csym = coff_symbol_from (abfd, *psym); |
3907 | csym = coff_symbol_from (*psym); |
3877 | if (csym == NULL |
3908 | if (csym == NULL |
- | 3909 | || csym->native == NULL |
|
3878 | || csym->native == NULL |
3910 | || ! csym->native->is_sym |
3879 | || csym->native->u.syment.n_numaux < 1 |
3911 | || csym->native->u.syment.n_numaux < 1 |
3880 | || csym->native->u.syment.n_sclass != C_STAT |
3912 | || csym->native->u.syment.n_sclass != C_STAT |
3881 | || csym->native->u.syment.n_type != T_NULL) |
3913 | || csym->native->u.syment.n_type != T_NULL) |
Line 3896... | Line 3928... | ||
3896 | 3928 | ||
3897 | /* We don't touch the x_checksum field. The |
3929 | /* We don't touch the x_checksum field. The |
Line 3898... | Line 3930... | ||
3898 | x_associated field is not currently supported. */ |
3930 | x_associated field is not currently supported. */ |
- | 3931 | ||
3899 | 3932 | aux = csym->native + 1; |
|
3900 | aux = csym->native + 1; |
3933 | BFD_ASSERT (! aux->is_sym); |
3901 | switch (current->flags & SEC_LINK_DUPLICATES) |
3934 | switch (current->flags & SEC_LINK_DUPLICATES) |
3902 | { |
3935 | { |
3903 | case SEC_LINK_DUPLICATES_DISCARD: |
3936 | case SEC_LINK_DUPLICATES_DISCARD: |
Line 4041... | Line 4074... | ||
4041 | internal_f.f_flags |= F_SHROBJ; |
4074 | internal_f.f_flags |= F_SHROBJ; |
4042 | if (bfd_get_section_by_name (abfd, _LOADER) != NULL) |
4075 | if (bfd_get_section_by_name (abfd, _LOADER) != NULL) |
4043 | internal_f.f_flags |= F_DYNLOAD; |
4076 | internal_f.f_flags |= F_DYNLOAD; |
4044 | #endif |
4077 | #endif |
Line 4045... | Line -... | ||
4045 | - | ||
4046 | memset (&internal_a, 0, sizeof internal_a); |
- | |
4047 | 4078 | ||
4048 | /* Set up architecture-dependent stuff. */ |
4079 | /* Set up architecture-dependent stuff. */ |
4049 | { |
4080 | { |
4050 | unsigned int magic = 0; |
4081 | unsigned int magic = 0; |
Line 4152... | Line 4183... | ||
4152 | #if defined(MIPS) && defined(COFF_WITH_PE) |
4183 | #if defined(MIPS) && defined(COFF_WITH_PE) |
4153 | #define __A_MAGIC_SET__ |
4184 | #define __A_MAGIC_SET__ |
4154 | internal_a.magic = MIPS_PE_MAGIC; |
4185 | internal_a.magic = MIPS_PE_MAGIC; |
4155 | #endif |
4186 | #endif |
Line 4156... | Line -... | ||
4156 | - | ||
4157 | #ifdef OR32 |
- | |
4158 | #define __A_MAGIC_SET__ |
- | |
4159 | internal_a.magic = NMAGIC; /* Assume separate i/d. */ |
- | |
4160 | #endif |
- | |
4161 | 4187 | ||
4162 | #ifndef __A_MAGIC_SET__ |
4188 | #ifndef __A_MAGIC_SET__ |
4163 | #include "Your aouthdr magic number is not being set!" |
4189 | #include "Your aouthdr magic number is not being set!" |
4164 | #else |
4190 | #else |
4165 | #undef __A_MAGIC_SET__ |
4191 | #undef __A_MAGIC_SET__ |
Line 4323... | Line 4349... | ||
4323 | internal_a.o_maxstack = xcoff_data (abfd)->maxstack; |
4349 | internal_a.o_maxstack = xcoff_data (abfd)->maxstack; |
4324 | internal_a.o_maxdata = xcoff_data (abfd)->maxdata; |
4350 | internal_a.o_maxdata = xcoff_data (abfd)->maxdata; |
4325 | } |
4351 | } |
4326 | #endif |
4352 | #endif |
Line -... | Line 4353... | ||
- | 4353 | ||
- | 4354 | #ifdef COFF_WITH_PE |
|
- | 4355 | { |
|
- | 4356 | /* After object contents are finalized so we can compute a reasonable hash, |
|
- | 4357 | but before header is written so we can update it to point to debug directory. */ |
|
- | 4358 | struct pe_tdata *pe = pe_data (abfd); |
|
- | 4359 | ||
- | 4360 | if (pe->build_id.after_write_object_contents != NULL) |
|
- | 4361 | (*pe->build_id.after_write_object_contents) (abfd); |
|
- | 4362 | } |
|
- | 4363 | #endif |
|
4327 | 4364 | ||
4328 | /* Now write them. */ |
4365 | /* Now write header. */ |
4329 | if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) |
4366 | if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) |
Line 4330... | Line 4367... | ||
4330 | return FALSE; |
4367 | return FALSE; |
4331 | 4368 | ||
Line 4458... | Line 4495... | ||
4458 | buy_and_read (bfd *abfd, file_ptr where, bfd_size_type size) |
4495 | buy_and_read (bfd *abfd, file_ptr where, bfd_size_type size) |
4459 | { |
4496 | { |
4460 | void * area = bfd_alloc (abfd, size); |
4497 | void * area = bfd_alloc (abfd, size); |
Line 4461... | Line 4498... | ||
4461 | 4498 | ||
4462 | if (!area) |
4499 | if (!area) |
4463 | return (NULL); |
4500 | return NULL; |
4464 | if (bfd_seek (abfd, where, SEEK_SET) != 0 |
4501 | if (bfd_seek (abfd, where, SEEK_SET) != 0 |
4465 | || bfd_bread (area, size, abfd) != size) |
4502 | || bfd_bread (area, size, abfd) != size) |
4466 | return (NULL); |
4503 | return NULL; |
4467 | return (area); |
4504 | return area; |
Line 4468... | Line 4505... | ||
4468 | } |
4505 | } |
4469 | 4506 | ||
4470 | /* |
4507 | /* |
Line 4496... | Line 4533... | ||
4496 | const alent *al1 = *(const alent **) arg1; |
4533 | const alent *al1 = *(const alent **) arg1; |
4497 | const alent *al2 = *(const alent **) arg2; |
4534 | const alent *al2 = *(const alent **) arg2; |
4498 | const coff_symbol_type *s1 = (const coff_symbol_type *) (al1->u.sym); |
4535 | const coff_symbol_type *s1 = (const coff_symbol_type *) (al1->u.sym); |
4499 | const coff_symbol_type *s2 = (const coff_symbol_type *) (al2->u.sym); |
4536 | const coff_symbol_type *s2 = (const coff_symbol_type *) (al2->u.sym); |
Line -... | Line 4537... | ||
- | 4537 | ||
- | 4538 | if (s1 == NULL || s2 == NULL) |
|
4500 | 4539 | return 0; |
|
4501 | if (s1->symbol.value < s2->symbol.value) |
4540 | if (s1->symbol.value < s2->symbol.value) |
4502 | return -1; |
4541 | return -1; |
4503 | else if (s1->symbol.value > s2->symbol.value) |
4542 | else if (s1->symbol.value > s2->symbol.value) |
Line 4513... | Line 4552... | ||
4513 | alent *lineno_cache; |
4552 | alent *lineno_cache; |
4514 | bfd_size_type amt; |
4553 | bfd_size_type amt; |
4515 | unsigned int counter; |
4554 | unsigned int counter; |
4516 | alent *cache_ptr; |
4555 | alent *cache_ptr; |
4517 | bfd_vma prev_offset = 0; |
4556 | bfd_vma prev_offset = 0; |
4518 | int ordered = 1; |
4557 | bfd_boolean ordered = TRUE; |
4519 | unsigned int nbr_func; |
4558 | unsigned int nbr_func; |
4520 | LINENO *src; |
4559 | LINENO *src; |
- | 4560 | bfd_boolean have_func; |
|
- | 4561 | bfd_boolean ret = TRUE; |
|
Line 4521... | Line 4562... | ||
4521 | 4562 | ||
Line 4522... | Line 4563... | ||
4522 | BFD_ASSERT (asect->lineno == NULL); |
4563 | BFD_ASSERT (asect->lineno == NULL); |
4523 | 4564 | ||
Line 4538... | Line 4579... | ||
4538 | 4579 | ||
4539 | cache_ptr = lineno_cache; |
4580 | cache_ptr = lineno_cache; |
4540 | asect->lineno = lineno_cache; |
4581 | asect->lineno = lineno_cache; |
4541 | src = native_lineno; |
4582 | src = native_lineno; |
- | 4583 | nbr_func = 0; |
|
Line 4542... | Line 4584... | ||
4542 | nbr_func = 0; |
4584 | have_func = FALSE; |
4543 | 4585 | ||
4544 | for (counter = 0; counter < asect->lineno_count; counter++) |
4586 | for (counter = 0; counter < asect->lineno_count; counter++, src++) |
Line 4545... | Line 4587... | ||
4545 | { |
4587 | { |
4546 | struct internal_lineno dst; |
4588 | struct internal_lineno dst; |
- | 4589 | ||
- | 4590 | bfd_coff_swap_lineno_in (abfd, src, &dst); |
|
- | 4591 | cache_ptr->line_number = dst.l_lnno; |
|
- | 4592 | /* Appease memory checkers that get all excited about |
|
Line 4547... | Line 4593... | ||
4547 | 4593 | uninitialised memory when copying alents if u.offset is |
|
4548 | bfd_coff_swap_lineno_in (abfd, src, &dst); |
4594 | larger than u.sym. (64-bit BFD on 32-bit host.) */ |
4549 | cache_ptr->line_number = dst.l_lnno; |
4595 | memset (&cache_ptr->u, 0, sizeof (cache_ptr->u)); |
4550 | 4596 | ||
4551 | if (cache_ptr->line_number == 0) |
4597 | if (cache_ptr->line_number == 0) |
Line 4552... | Line -... | ||
4552 | { |
- | |
4553 | bfd_boolean warned; |
4598 | { |
4554 | bfd_signed_vma symndx; |
4599 | combined_entry_type * ent; |
4555 | coff_symbol_type *sym; |
- | |
4556 | 4600 | bfd_vma symndx; |
|
4557 | nbr_func++; |
4601 | coff_symbol_type *sym; |
4558 | warned = FALSE; |
4602 | |
4559 | symndx = dst.l_addr.l_symndx; |
4603 | have_func = FALSE; |
4560 | if (symndx < 0 |
4604 | symndx = dst.l_addr.l_symndx; |
- | 4605 | if (symndx >= obj_raw_syment_count (abfd)) |
|
4561 | || (bfd_vma) symndx >= obj_raw_syment_count (abfd)) |
4606 | { |
4562 | { |
4607 | (*_bfd_error_handler) |
4563 | (*_bfd_error_handler) |
4608 | (_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), |
Line -... | Line 4609... | ||
- | 4609 | abfd, (long) symndx, counter); |
|
4564 | (_("%B: warning: illegal symbol index %ld in line numbers"), |
4610 | cache_ptr->line_number = -1; |
4565 | abfd, (long) symndx); |
4611 | ret = FALSE; |
- | 4612 | continue; |
|
- | 4613 | } |
|
4566 | symndx = 0; |
4614 | |
- | 4615 | ent = obj_raw_syments (abfd) + symndx; |
|
- | 4616 | /* FIXME: We should not be casting between ints and |
|
- | 4617 | pointers like this. */ |
|
- | 4618 | if (! ent->is_sym) |
|
- | 4619 | { |
|
- | 4620 | (*_bfd_error_handler) |
|
- | 4621 | (_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), |
|
- | 4622 | abfd, (long) symndx, counter); |
|
- | 4623 | cache_ptr->line_number = -1; |
|
4567 | warned = TRUE; |
4624 | ret = FALSE; |
- | 4625 | continue; |
|
- | 4626 | } |
|
- | 4627 | sym = (coff_symbol_type *) (ent->u.syment._n._n_n._n_zeroes); |
|
- | 4628 | ||
- | 4629 | /* PR 17512 file: 078-10659-0.004 */ |
|
4568 | } |
4630 | if (sym < obj_symbols (abfd) |
- | 4631 | || sym >= obj_symbols (abfd) + bfd_get_symcount (abfd)) |
|
- | 4632 | { |
|
- | 4633 | (*_bfd_error_handler) |
|
- | 4634 | (_("%B: warning: illegal symbol in line number entry %d"), |
|
- | 4635 | abfd, counter); |
|
- | 4636 | cache_ptr->line_number = -1; |
|
4569 | 4637 | ret = FALSE; |
|
4570 | /* FIXME: We should not be casting between ints and |
4638 | continue; |
4571 | pointers like this. */ |
4639 | } |
4572 | sym = ((coff_symbol_type *) |
4640 | |
4573 | ((symndx + obj_raw_syments (abfd)) |
4641 | have_func = TRUE; |
Line 4574... | Line 4642... | ||
4574 | ->u.syment._n._n_n._n_zeroes)); |
4642 | nbr_func++; |
4575 | cache_ptr->u.sym = (asymbol *) sym; |
4643 | cache_ptr->u.sym = (asymbol *) sym; |
4576 | if (sym->lineno != NULL && ! warned) |
4644 | if (sym->lineno != NULL) |
4577 | (*_bfd_error_handler) |
4645 | (*_bfd_error_handler) |
4578 | (_("%B: warning: duplicate line number information for `%s'"), |
4646 | (_("%B: warning: duplicate line number information for `%s'"), |
- | 4647 | abfd, bfd_asymbol_name (&sym->symbol)); |
|
- | 4648 | ||
- | 4649 | sym->lineno = cache_ptr; |
|
- | 4650 | if (sym->symbol.value < prev_offset) |
|
4579 | abfd, bfd_asymbol_name (&sym->symbol)); |
4651 | ordered = FALSE; |
4580 | 4652 | prev_offset = sym->symbol.value; |
|
4581 | sym->lineno = cache_ptr; |
4653 | } |
4582 | if (sym->symbol.value < prev_offset) |
- | |
4583 | ordered = 0; |
4654 | else if (!have_func) |
4584 | prev_offset = sym->symbol.value; |
- | |
4585 | } |
4655 | /* Drop line information that has no associated function. |
- | 4656 | PR 17521: file: 078-10659-0.004. */ |
|
- | 4657 | continue; |
|
4586 | else |
4658 | else |
4587 | cache_ptr->u.offset = dst.l_addr.l_paddr |
4659 | cache_ptr->u.offset = (dst.l_addr.l_paddr |
Line 4588... | Line 4660... | ||
4588 | - bfd_section_vma (abfd, asect); |
4660 | - bfd_section_vma (abfd, asect)); |
4589 | 4661 | cache_ptr++; |
|
4590 | cache_ptr++; |
4662 | } |
Line 4605... | Line 4677... | ||
4605 | if (func_table != NULL) |
4677 | if (func_table != NULL) |
4606 | { |
4678 | { |
4607 | alent **p = func_table; |
4679 | alent **p = func_table; |
4608 | unsigned int i; |
4680 | unsigned int i; |
Line 4609... | Line 4681... | ||
4609 | 4681 | ||
4610 | for (i = 0; i < counter; i++) |
4682 | for (i = 0; i < asect->lineno_count; i++) |
4611 | if (lineno_cache[i].line_number == 0) |
4683 | if (lineno_cache[i].line_number == 0) |
Line -... | Line 4684... | ||
- | 4684 | *p++ = &lineno_cache[i]; |
|
- | 4685 | ||
4612 | *p++ = &lineno_cache[i]; |
4686 | BFD_ASSERT ((unsigned int) (p - func_table) == nbr_func); |
4613 | 4687 | ||
Line 4614... | Line 4688... | ||
4614 | /* Sort by functions. */ |
4688 | /* Sort by functions. */ |
4615 | qsort (func_table, nbr_func, sizeof (alent *), coff_sort_func_alent); |
4689 | qsort (func_table, nbr_func, sizeof (alent *), coff_sort_func_alent); |
4616 | 4690 | ||
4617 | /* Create the new sorted table. */ |
4691 | /* Create the new sorted table. */ |
4618 | amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); |
4692 | amt = (bfd_size_type) asect->lineno_count * sizeof (alent); |
4619 | n_lineno_cache = (alent *) bfd_alloc (abfd, amt); |
4693 | n_lineno_cache = (alent *) bfd_alloc (abfd, amt); |
Line 4620... | Line 4694... | ||
4620 | if (n_lineno_cache != NULL) |
4694 | if (n_lineno_cache != NULL) |
4621 | { |
4695 | { |
4622 | alent *n_cache_ptr = n_lineno_cache; |
4696 | alent *n_cache_ptr = n_lineno_cache; |
4623 | 4697 | ||
Line 4624... | Line 4698... | ||
4624 | for (i = 0; i < nbr_func; i++) |
4698 | for (i = 0; i < nbr_func; i++) |
4625 | { |
- | |
4626 | coff_symbol_type *sym; |
4699 | { |
4627 | alent *old_ptr = func_table[i]; |
4700 | coff_symbol_type *sym; |
4628 | 4701 | alent *old_ptr = func_table[i]; |
|
4629 | /* Copy the function entry and update it. */ |
4702 | |
4630 | *n_cache_ptr = *old_ptr; |
- | |
4631 | sym = (coff_symbol_type *)n_cache_ptr->u.sym; |
4703 | /* Update the function entry. */ |
4632 | sym->lineno = n_cache_ptr; |
4704 | sym = (coff_symbol_type *) old_ptr->u.sym; |
4633 | n_cache_ptr++; |
4705 | /* PR binutils/17512: Point the lineno to where |
- | 4706 | this entry will be after the memcpy below. */ |
|
4634 | old_ptr++; |
4707 | sym->lineno = lineno_cache + (n_cache_ptr - n_lineno_cache); |
4635 | 4708 | /* Copy the function and line number entries. */ |
|
- | 4709 | do |
|
4636 | /* Copy the line number entries. */ |
4710 | *n_cache_ptr++ = *old_ptr++; |
4637 | while (old_ptr->line_number != 0) |
4711 | while (old_ptr->line_number != 0); |
- | 4712 | } |
|
- | 4713 | BFD_ASSERT ((bfd_size_type) (n_cache_ptr - n_lineno_cache) == (amt / sizeof (alent))); |
|
4638 | *n_cache_ptr++ = *old_ptr++; |
4714 | |
4639 | } |
4715 | memcpy (lineno_cache, n_lineno_cache, amt); |
- | 4716 | } |
|
- | 4717 | else |
|
4640 | n_cache_ptr->line_number = 0; |
4718 | ret = FALSE; |
Line 4641... | Line 4719... | ||
4641 | memcpy (lineno_cache, n_lineno_cache, amt); |
4719 | bfd_release (abfd, func_table); |
4642 | } |
4720 | } |
Line 4643... | Line 4721... | ||
4643 | bfd_release (abfd, func_table); |
4721 | else |
4644 | } |
4722 | ret = FALSE; |
4645 | } |
4723 | } |
Line 4657... | Line 4735... | ||
4657 | combined_entry_type *native_symbols; |
4735 | combined_entry_type *native_symbols; |
4658 | coff_symbol_type *cached_area; |
4736 | coff_symbol_type *cached_area; |
4659 | unsigned int *table_ptr; |
4737 | unsigned int *table_ptr; |
4660 | bfd_size_type amt; |
4738 | bfd_size_type amt; |
4661 | unsigned int number_of_symbols = 0; |
4739 | unsigned int number_of_symbols = 0; |
- | 4740 | bfd_boolean ret = TRUE; |
|
Line 4662... | Line 4741... | ||
4662 | 4741 | ||
4663 | if (obj_symbols (abfd)) |
4742 | if (obj_symbols (abfd)) |
Line 4664... | Line 4743... | ||
4664 | return TRUE; |
4743 | return TRUE; |
Line 4674... | Line 4753... | ||
4674 | if (cached_area == NULL) |
4753 | if (cached_area == NULL) |
4675 | return FALSE; |
4754 | return FALSE; |
Line 4676... | Line 4755... | ||
4676 | 4755 | ||
4677 | amt = obj_raw_syment_count (abfd); |
4756 | amt = obj_raw_syment_count (abfd); |
4678 | amt *= sizeof (unsigned int); |
4757 | amt *= sizeof (unsigned int); |
Line 4679... | Line 4758... | ||
4679 | table_ptr = (unsigned int *) bfd_alloc (abfd, amt); |
4758 | table_ptr = (unsigned int *) bfd_zalloc (abfd, amt); |
4680 | 4759 | ||
4681 | if (table_ptr == NULL) |
4760 | if (table_ptr == NULL) |
4682 | return FALSE; |
4761 | return FALSE; |
Line 4688... | Line 4767... | ||
4688 | 4767 | ||
4689 | while (this_index < last_native_index) |
4768 | while (this_index < last_native_index) |
4690 | { |
4769 | { |
4691 | combined_entry_type *src = native_symbols + this_index; |
4770 | combined_entry_type *src = native_symbols + this_index; |
4692 | table_ptr[this_index] = number_of_symbols; |
- | |
Line -... | Line 4771... | ||
- | 4771 | table_ptr[this_index] = number_of_symbols; |
|
- | 4772 | ||
4693 | dst->symbol.the_bfd = abfd; |
4773 | dst->symbol.the_bfd = abfd; |
4694 | 4774 | BFD_ASSERT (src->is_sym); |
|
4695 | dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset); |
4775 | dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset); |
4696 | /* We use the native name field to point to the cached field. */ |
4776 | /* We use the native name field to point to the cached field. */ |
4697 | src->u.syment._n._n_n._n_zeroes = (bfd_hostptr_t) dst; |
4777 | src->u.syment._n._n_n._n_zeroes = (bfd_hostptr_t) dst; |
4698 | dst->symbol.section = coff_section_from_bfd_index (abfd, |
4778 | dst->symbol.section = coff_section_from_bfd_index (abfd, |
- | 4779 | src->u.syment.n_scnum); |
|
- | 4780 | dst->symbol.flags = 0; |
|
4699 | src->u.syment.n_scnum); |
4781 | /* PR 17512: file: 079-7098-0.001:0.1. */ |
Line 4700... | Line 4782... | ||
4700 | dst->symbol.flags = 0; |
4782 | dst->symbol.value = 0; |
4701 | dst->done_lineno = FALSE; |
4783 | dst->done_lineno = FALSE; |
4702 | 4784 | ||
Line 4969... | Line 5051... | ||
4969 | #endif |
5051 | #endif |
4970 | /* New storage classes for TI COFF. */ |
5052 | /* New storage classes for TI COFF. */ |
4971 | #if defined(TIC80COFF) || defined(TICOFF) |
5053 | #if defined(TIC80COFF) || defined(TICOFF) |
4972 | case C_UEXT: /* Tentative external definition. */ |
5054 | case C_UEXT: /* Tentative external definition. */ |
4973 | #endif |
5055 | #endif |
4974 | case C_EXTLAB: /* External load time label. */ |
- | |
4975 | case C_HIDDEN: /* Ext symbol in dmert public lib. */ |
- | |
4976 | default: |
5056 | default: |
4977 | (*_bfd_error_handler) |
5057 | (*_bfd_error_handler) |
4978 | (_("%B: Unrecognized storage class %d for %s symbol `%s'"), |
5058 | (_("%B: Unrecognized storage class %d for %s symbol `%s'"), |
4979 | abfd, src->u.syment.n_sclass, |
5059 | abfd, src->u.syment.n_sclass, |
4980 | dst->symbol.section->name, dst->symbol.name); |
5060 | dst->symbol.section->name, dst->symbol.name); |
- | 5061 | ret = FALSE; |
|
- | 5062 | case C_EXTLAB: /* External load time label. */ |
|
- | 5063 | case C_HIDDEN: /* Ext symbol in dmert public lib. */ |
|
4981 | dst->symbol.flags = BSF_DEBUGGING; |
5064 | dst->symbol.flags = BSF_DEBUGGING; |
4982 | dst->symbol.value = (src->u.syment.n_value); |
5065 | dst->symbol.value = (src->u.syment.n_value); |
4983 | break; |
5066 | break; |
4984 | } |
5067 | } |
Line 4985... | Line 5068... | ||
4985 | 5068 | ||
4986 | dst->native = src; |
- | |
4987 | 5069 | dst->native = src; |
|
4988 | dst->symbol.udata.i = 0; |
5070 | dst->symbol.udata.i = 0; |
- | 5071 | dst->lineno = NULL; |
|
4989 | dst->lineno = NULL; |
5072 | |
4990 | this_index += (src->u.syment.n_numaux) + 1; |
5073 | this_index += (src->u.syment.n_numaux) + 1; |
4991 | dst++; |
5074 | dst++; |
4992 | number_of_symbols++; |
5075 | number_of_symbols++; |
4993 | } |
5076 | } |
Line 5003... | Line 5086... | ||
5003 | asection *p; |
5086 | asection *p; |
Line 5004... | Line 5087... | ||
5004 | 5087 | ||
5005 | p = abfd->sections; |
5088 | p = abfd->sections; |
5006 | while (p) |
5089 | while (p) |
5007 | { |
5090 | { |
- | 5091 | if (! coff_slurp_line_table (abfd, p)) |
|
5008 | coff_slurp_line_table (abfd, p); |
5092 | return FALSE; |
5009 | p = p->next; |
5093 | p = p->next; |
5010 | } |
5094 | } |
Line 5011... | Line 5095... | ||
5011 | } |
5095 | } |
5012 | 5096 | ||
Line 5013... | Line 5097... | ||
5013 | return TRUE; |
5097 | return ret; |
5014 | } |
5098 | } |
5015 | 5099 | ||
Line 5067... | Line 5151... | ||
5067 | /* This is correct for Microsoft generated objects, but it |
5151 | /* This is correct for Microsoft generated objects, but it |
5068 | breaks gas generated objects. */ |
5152 | breaks gas generated objects. */ |
5069 | if (syment->n_value == 0) |
5153 | if (syment->n_value == 0) |
5070 | { |
5154 | { |
5071 | asection *sec; |
5155 | asection *sec; |
- | 5156 | char * name; |
|
5072 | char buf[SYMNMLEN + 1]; |
5157 | char buf[SYMNMLEN + 1]; |
Line -... | Line 5158... | ||
- | 5158 | ||
5073 | 5159 | name = _bfd_coff_internal_syment_name (abfd, syment, buf) |
|
5074 | sec = coff_section_from_bfd_index (abfd, syment->n_scnum); |
5160 | sec = coff_section_from_bfd_index (abfd, syment->n_scnum); |
5075 | if (sec != NULL |
5161 | if (sec != NULL && name != NULL |
5076 | && (strcmp (bfd_get_section_name (abfd, sec), |
- | |
5077 | _bfd_coff_internal_syment_name (abfd, syment, buf)) |
- | |
5078 | == 0)) |
5162 | && (strcmp (bfd_get_section_name (abfd, sec), name) == 0)) |
5079 | return COFF_SYMBOL_PE_SECTION; |
5163 | return COFF_SYMBOL_PE_SECTION; |
5080 | } |
5164 | } |
Line 5081... | Line 5165... | ||
5081 | #endif |
5165 | #endif |
Line 5142... | Line 5226... | ||
5142 | \ |
5226 | \ |
5143 | if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ |
5227 | if (ptr && bfd_asymbol_bfd (ptr) != abfd) \ |
5144 | coffsym = (obj_symbols (abfd) \ |
5228 | coffsym = (obj_symbols (abfd) \ |
5145 | + (cache_ptr->sym_ptr_ptr - symbols)); \ |
5229 | + (cache_ptr->sym_ptr_ptr - symbols)); \ |
5146 | else if (ptr) \ |
5230 | else if (ptr) \ |
5147 | coffsym = coff_symbol_from (abfd, ptr); \ |
5231 | coffsym = coff_symbol_from (ptr); \ |
5148 | if (coffsym != NULL \ |
5232 | if (coffsym != NULL \ |
- | 5233 | && coffsym->native->is_sym \ |
|
5149 | && coffsym->native->u.syment.n_scnum == 0) \ |
5234 | && coffsym->native->u.syment.n_scnum == 0) \ |
5150 | cache_ptr->addend = 0; \ |
5235 | cache_ptr->addend = 0; \ |
5151 | else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ |
5236 | else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ |
5152 | && ptr->section != NULL) \ |
5237 | && ptr->section != NULL) \ |
5153 | cache_ptr->addend = - (ptr->section->vma + ptr->value); \ |
5238 | cache_ptr->addend = - (ptr->section->vma + ptr->value); \ |
Line 5266... | Line 5351... | ||
5266 | make sure it is reasonable if it is needed. */ |
5351 | make sure it is reasonable if it is needed. */ |
Line 5267... | Line 5352... | ||
5267 | 5352 | ||
5268 | static reloc_howto_type * |
5353 | static reloc_howto_type * |
5269 | coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, |
5354 | coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, |
5270 | asection *sec ATTRIBUTE_UNUSED, |
5355 | asection *sec ATTRIBUTE_UNUSED, |
5271 | struct internal_reloc *rel, |
5356 | struct internal_reloc *rel ATTRIBUTE_UNUSED, |
5272 | struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, |
5357 | struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, |
5273 | struct internal_syment *sym ATTRIBUTE_UNUSED, |
5358 | struct internal_syment *sym ATTRIBUTE_UNUSED, |
5274 | bfd_vma *addendp ATTRIBUTE_UNUSED) |
5359 | bfd_vma *addendp ATTRIBUTE_UNUSED) |
5275 | { |
5360 | { |
Line 5358... | Line 5443... | ||
5358 | { |
5443 | { |
5359 | abort (); |
5444 | abort (); |
5360 | } |
5445 | } |
5361 | #endif |
5446 | #endif |
Line 5362... | Line -... | ||
5362 | - | ||
5363 | #ifndef coff_bfd_link_hash_table_free |
- | |
5364 | #define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
- | |
5365 | #endif |
- | |
5366 | 5447 | ||
5367 | /* If coff_relocate_section is defined, we can use the optimized COFF |
5448 | /* If coff_relocate_section is defined, we can use the optimized COFF |
Line 5368... | Line 5449... | ||
5368 | backend linker. Otherwise we must continue to use the old linker. */ |
5449 | backend linker. Otherwise we must continue to use the old linker. */ |
Line 5495... | Line 5576... | ||
5495 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX |
5576 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX |
5496 | 4, |
5577 | 4, |
5497 | #else |
5578 | #else |
5498 | 2, |
5579 | 2, |
5499 | #endif |
5580 | #endif |
- | 5581 | 32768, |
|
5500 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
5582 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
5501 | coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, |
5583 | coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, |
5502 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5584 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5503 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
5585 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
5504 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
5586 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
Line 5535... | Line 5617... | ||
5535 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX |
5617 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX |
5536 | 4, |
5618 | 4, |
5537 | #else |
5619 | #else |
5538 | 2, |
5620 | 2, |
5539 | #endif |
5621 | #endif |
- | 5622 | 32768, |
|
5540 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
5623 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
5541 | coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, |
5624 | coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, |
5542 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5625 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5543 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
5626 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
5544 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
5627 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
Line 5576... | Line 5659... | ||
5576 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX |
5659 | #ifdef COFF_DEBUG_STRING_WIDE_PREFIX |
5577 | 4, |
5660 | 4, |
5578 | #else |
5661 | #else |
5579 | 2, |
5662 | 2, |
5580 | #endif |
5663 | #endif |
- | 5664 | 32768, |
|
5581 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
5665 | coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
5582 | coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, |
5666 | coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, |
5583 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5667 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5584 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
5668 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
5585 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
5669 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
Line 5589... | Line 5673... | ||
5589 | coff_link_output_has_begun, coff_final_link_postscript, |
5673 | coff_link_output_has_begun, coff_final_link_postscript, |
5590 | bfd_pe_print_pdata /* huh */ |
5674 | bfd_pe_print_pdata /* huh */ |
5591 | }; |
5675 | }; |
5592 | #endif |
5676 | #endif |
Line -... | Line 5677... | ||
- | 5677 | ||
- | 5678 | #ifdef COFF_WITH_PE_BIGOBJ |
|
- | 5679 | /* The UID for bigobj files. */ |
|
- | 5680 | ||
- | 5681 | static const char header_bigobj_classid[16] = |
|
- | 5682 | { |
|
- | 5683 | 0xC7, 0xA1, 0xBA, 0xD1, |
|
- | 5684 | 0xEE, 0xBA, |
|
- | 5685 | 0xa9, 0x4b, |
|
- | 5686 | 0xAF, 0x20, |
|
- | 5687 | 0xFA, 0xF6, 0x6A, 0xA4, 0xDC, 0xB8 |
|
- | 5688 | }; |
|
- | 5689 | ||
- | 5690 | /* Swap routines. */ |
|
- | 5691 | ||
- | 5692 | static void |
|
- | 5693 | coff_bigobj_swap_filehdr_in (bfd * abfd, void * src, void * dst) |
|
- | 5694 | { |
|
- | 5695 | struct external_ANON_OBJECT_HEADER_BIGOBJ *filehdr_src = |
|
- | 5696 | (struct external_ANON_OBJECT_HEADER_BIGOBJ *) src; |
|
- | 5697 | struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; |
|
- | 5698 | ||
- | 5699 | filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->Machine); |
|
- | 5700 | filehdr_dst->f_nscns = H_GET_32 (abfd, filehdr_src->NumberOfSections); |
|
- | 5701 | filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->TimeDateStamp); |
|
- | 5702 | filehdr_dst->f_symptr = |
|
- | 5703 | GET_FILEHDR_SYMPTR (abfd, filehdr_src->PointerToSymbolTable); |
|
- | 5704 | filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->NumberOfSymbols); |
|
- | 5705 | filehdr_dst->f_opthdr = 0; |
|
- | 5706 | filehdr_dst->f_flags = 0; |
|
- | 5707 | ||
- | 5708 | /* Check other magic numbers. */ |
|
- | 5709 | if (H_GET_16 (abfd, filehdr_src->Sig1) != IMAGE_FILE_MACHINE_UNKNOWN |
|
- | 5710 | || H_GET_16 (abfd, filehdr_src->Sig2) != 0xffff |
|
- | 5711 | || H_GET_16 (abfd, filehdr_src->Version) != 2 |
|
- | 5712 | || memcmp (filehdr_src->ClassID, header_bigobj_classid, 16) != 0) |
|
- | 5713 | filehdr_dst->f_opthdr = 0xffff; |
|
- | 5714 | ||
- | 5715 | /* Note that CLR metadata are ignored. */ |
|
- | 5716 | } |
|
- | 5717 | ||
- | 5718 | static unsigned int |
|
- | 5719 | coff_bigobj_swap_filehdr_out (bfd *abfd, void * in, void * out) |
|
- | 5720 | { |
|
- | 5721 | struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; |
|
- | 5722 | struct external_ANON_OBJECT_HEADER_BIGOBJ *filehdr_out = |
|
- | 5723 | (struct external_ANON_OBJECT_HEADER_BIGOBJ *) out; |
|
- | 5724 | ||
- | 5725 | memset (filehdr_out, 0, sizeof (*filehdr_out)); |
|
- | 5726 | ||
- | 5727 | H_PUT_16 (abfd, IMAGE_FILE_MACHINE_UNKNOWN, filehdr_out->Sig1); |
|
- | 5728 | H_PUT_16 (abfd, 0xffff, filehdr_out->Sig2); |
|
- | 5729 | H_PUT_16 (abfd, 2, filehdr_out->Version); |
|
- | 5730 | memcpy (filehdr_out->ClassID, header_bigobj_classid, 16); |
|
- | 5731 | H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->Machine); |
|
- | 5732 | H_PUT_32 (abfd, filehdr_in->f_nscns, filehdr_out->NumberOfSections); |
|
- | 5733 | H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->TimeDateStamp); |
|
- | 5734 | PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, |
|
- | 5735 | filehdr_out->PointerToSymbolTable); |
|
- | 5736 | H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->NumberOfSymbols); |
|
- | 5737 | ||
- | 5738 | return bfd_coff_filhsz (abfd); |
|
- | 5739 | } |
|
- | 5740 | ||
- | 5741 | static void |
|
- | 5742 | coff_bigobj_swap_sym_in (bfd * abfd, void * ext1, void * in1) |
|
- | 5743 | { |
|
- | 5744 | SYMENT_BIGOBJ *ext = (SYMENT_BIGOBJ *) ext1; |
|
- | 5745 | struct internal_syment *in = (struct internal_syment *) in1; |
|
- | 5746 | ||
- | 5747 | if (ext->e.e_name[0] == 0) |
|
- | 5748 | { |
|
- | 5749 | in->_n._n_n._n_zeroes = 0; |
|
- | 5750 | in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset); |
|
- | 5751 | } |
|
- | 5752 | else |
|
- | 5753 | { |
|
- | 5754 | #if SYMNMLEN != E_SYMNMLEN |
|
- | 5755 | #error we need to cope with truncating or extending SYMNMLEN |
|
- | 5756 | #else |
|
- | 5757 | memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN); |
|
- | 5758 | #endif |
|
- | 5759 | } |
|
- | 5760 | ||
- | 5761 | in->n_value = H_GET_32 (abfd, ext->e_value); |
|
- | 5762 | in->n_scnum = H_GET_32 (abfd, ext->e_scnum); |
|
- | 5763 | in->n_type = H_GET_16 (abfd, ext->e_type); |
|
- | 5764 | in->n_sclass = H_GET_8 (abfd, ext->e_sclass); |
|
- | 5765 | in->n_numaux = H_GET_8 (abfd, ext->e_numaux); |
|
- | 5766 | } |
|
- | 5767 | ||
- | 5768 | static unsigned int |
|
- | 5769 | coff_bigobj_swap_sym_out (bfd * abfd, void * inp, void * extp) |
|
- | 5770 | { |
|
- | 5771 | struct internal_syment *in = (struct internal_syment *) inp; |
|
- | 5772 | SYMENT_BIGOBJ *ext = (SYMENT_BIGOBJ *) extp; |
|
- | 5773 | ||
- | 5774 | if (in->_n._n_name[0] == 0) |
|
- | 5775 | { |
|
- | 5776 | H_PUT_32 (abfd, 0, ext->e.e.e_zeroes); |
|
- | 5777 | H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset); |
|
- | 5778 | } |
|
- | 5779 | else |
|
- | 5780 | { |
|
- | 5781 | #if SYMNMLEN != E_SYMNMLEN |
|
- | 5782 | #error we need to cope with truncating or extending SYMNMLEN |
|
- | 5783 | #else |
|
- | 5784 | memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN); |
|
- | 5785 | #endif |
|
- | 5786 | } |
|
- | 5787 | ||
- | 5788 | H_PUT_32 (abfd, in->n_value, ext->e_value); |
|
- | 5789 | H_PUT_32 (abfd, in->n_scnum, ext->e_scnum); |
|
- | 5790 | ||
- | 5791 | H_PUT_16 (abfd, in->n_type, ext->e_type); |
|
- | 5792 | H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); |
|
- | 5793 | H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); |
|
- | 5794 | ||
- | 5795 | return SYMESZ_BIGOBJ; |
|
- | 5796 | } |
|
- | 5797 | ||
- | 5798 | static void |
|
- | 5799 | coff_bigobj_swap_aux_in (bfd *abfd, |
|
- | 5800 | void * ext1, |
|
- | 5801 | int type, |
|
- | 5802 | int in_class, |
|
- | 5803 | int indx, |
|
- | 5804 | int numaux, |
|
- | 5805 | void * in1) |
|
- | 5806 | { |
|
- | 5807 | AUXENT_BIGOBJ *ext = (AUXENT_BIGOBJ *) ext1; |
|
- | 5808 | union internal_auxent *in = (union internal_auxent *) in1; |
|
- | 5809 | ||
- | 5810 | switch (in_class) |
|
- | 5811 | { |
|
- | 5812 | case C_FILE: |
|
- | 5813 | if (numaux > 1) |
|
- | 5814 | { |
|
- | 5815 | if (indx == 0) |
|
- | 5816 | memcpy (in->x_file.x_fname, ext->File.Name, |
|
- | 5817 | numaux * sizeof (AUXENT_BIGOBJ)); |
|
- | 5818 | } |
|
- | 5819 | else |
|
- | 5820 | memcpy (in->x_file.x_fname, ext->File.Name, sizeof (ext->File.Name)); |
|
- | 5821 | break; |
|
- | 5822 | ||
- | 5823 | case C_STAT: |
|
- | 5824 | case C_LEAFSTAT: |
|
- | 5825 | case C_HIDDEN: |
|
- | 5826 | if (type == T_NULL) |
|
- | 5827 | { |
|
- | 5828 | in->x_scn.x_scnlen = H_GET_32 (abfd, ext->Section.Length); |
|
- | 5829 | in->x_scn.x_nreloc = |
|
- | 5830 | H_GET_16 (abfd, ext->Section.NumberOfRelocations); |
|
- | 5831 | in->x_scn.x_nlinno = |
|
- | 5832 | H_GET_16 (abfd, ext->Section.NumberOfLinenumbers); |
|
- | 5833 | in->x_scn.x_checksum = H_GET_32 (abfd, ext->Section.Checksum); |
|
- | 5834 | in->x_scn.x_associated = H_GET_16 (abfd, ext->Section.Number) |
|
- | 5835 | | (H_GET_16 (abfd, ext->Section.HighNumber) << 16); |
|
- | 5836 | in->x_scn.x_comdat = H_GET_8 (abfd, ext->Section.Selection); |
|
- | 5837 | return; |
|
- | 5838 | } |
|
- | 5839 | break; |
|
- | 5840 | ||
- | 5841 | default: |
|
- | 5842 | in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->Sym.WeakDefaultSymIndex); |
|
- | 5843 | /* Characteristics is ignored. */ |
|
- | 5844 | break; |
|
- | 5845 | } |
|
- | 5846 | } |
|
- | 5847 | ||
- | 5848 | static unsigned int |
|
- | 5849 | coff_bigobj_swap_aux_out (bfd * abfd, |
|
- | 5850 | void * inp, |
|
- | 5851 | int type, |
|
- | 5852 | int in_class, |
|
- | 5853 | int indx ATTRIBUTE_UNUSED, |
|
- | 5854 | int numaux ATTRIBUTE_UNUSED, |
|
- | 5855 | void * extp) |
|
- | 5856 | { |
|
- | 5857 | union internal_auxent * in = (union internal_auxent *) inp; |
|
- | 5858 | AUXENT_BIGOBJ *ext = (AUXENT_BIGOBJ *) extp; |
|
- | 5859 | ||
- | 5860 | memset (ext, 0, AUXESZ); |
|
- | 5861 | ||
- | 5862 | switch (in_class) |
|
- | 5863 | { |
|
- | 5864 | case C_FILE: |
|
- | 5865 | memcpy (ext->File.Name, in->x_file.x_fname, sizeof (ext->File.Name)); |
|
- | 5866 | ||
- | 5867 | return AUXESZ; |
|
- | 5868 | ||
- | 5869 | case C_STAT: |
|
- | 5870 | case C_LEAFSTAT: |
|
- | 5871 | case C_HIDDEN: |
|
- | 5872 | if (type == T_NULL) |
|
- | 5873 | { |
|
- | 5874 | H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->Section.Length); |
|
- | 5875 | H_PUT_16 (abfd, in->x_scn.x_nreloc, |
|
- | 5876 | ext->Section.NumberOfRelocations); |
|
- | 5877 | H_PUT_16 (abfd, in->x_scn.x_nlinno, |
|
- | 5878 | ext->Section.NumberOfLinenumbers); |
|
- | 5879 | H_PUT_32 (abfd, in->x_scn.x_checksum, ext->Section.Checksum); |
|
- | 5880 | H_PUT_16 (abfd, in->x_scn.x_associated & 0xffff, |
|
- | 5881 | ext->Section.Number); |
|
- | 5882 | H_PUT_16 (abfd, (in->x_scn.x_associated >> 16), |
|
- | 5883 | ext->Section.HighNumber); |
|
- | 5884 | H_PUT_8 (abfd, in->x_scn.x_comdat, ext->Section.Selection); |
|
- | 5885 | return AUXESZ; |
|
- | 5886 | } |
|
- | 5887 | break; |
|
- | 5888 | } |
|
- | 5889 | ||
- | 5890 | H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->Sym.WeakDefaultSymIndex); |
|
- | 5891 | H_PUT_32 (abfd, 1, ext->Sym.WeakSearchType); |
|
- | 5892 | ||
- | 5893 | return AUXESZ; |
|
- | 5894 | } |
|
- | 5895 | ||
- | 5896 | static bfd_coff_backend_data bigobj_swap_table = |
|
- | 5897 | { |
|
- | 5898 | coff_bigobj_swap_aux_in, coff_bigobj_swap_sym_in, coff_SWAP_lineno_in, |
|
- | 5899 | coff_bigobj_swap_aux_out, coff_bigobj_swap_sym_out, |
|
- | 5900 | coff_SWAP_lineno_out, coff_SWAP_reloc_out, |
|
- | 5901 | coff_bigobj_swap_filehdr_out, coff_SWAP_aouthdr_out, |
|
- | 5902 | coff_SWAP_scnhdr_out, |
|
- | 5903 | FILHSZ_BIGOBJ, AOUTSZ, SCNHSZ, SYMESZ_BIGOBJ, AUXESZ_BIGOBJ, |
|
- | 5904 | RELSZ, LINESZ, FILNMLEN_BIGOBJ, |
|
- | 5905 | TRUE, |
|
- | 5906 | COFF_DEFAULT_LONG_SECTION_NAMES, |
|
- | 5907 | COFF_DEFAULT_SECTION_ALIGNMENT_POWER, |
|
- | 5908 | FALSE, |
|
- | 5909 | 2, |
|
- | 5910 | 1U << 31, |
|
- | 5911 | coff_bigobj_swap_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
|
- | 5912 | coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, |
|
- | 5913 | coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
|
- | 5914 | coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
|
- | 5915 | coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
|
- | 5916 | coff_classify_symbol, coff_compute_section_file_positions, |
|
- | 5917 | coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, |
|
- | 5918 | coff_adjust_symndx, coff_link_add_one_symbol, |
|
- | 5919 | coff_link_output_has_begun, coff_final_link_postscript, |
|
- | 5920 | bfd_pe_print_pdata /* huh */ |
|
- | 5921 | }; |
|
- | 5922 | ||
- | 5923 | #endif /* COFF_WITH_PE_BIGOBJ */ |
|
5593 | 5924 | ||
5594 | #ifndef coff_close_and_cleanup |
5925 | #ifndef coff_close_and_cleanup |
5595 | #define coff_close_and_cleanup _bfd_generic_close_and_cleanup |
5926 | #define coff_close_and_cleanup _bfd_generic_close_and_cleanup |
Line 5596... | Line 5927... | ||
5596 | #endif |
5927 | #endif |
Line 5664... | Line 5995... | ||
5664 | #ifndef coff_bfd_relax_section |
5995 | #ifndef coff_bfd_relax_section |
5665 | #define coff_bfd_relax_section bfd_generic_relax_section |
5996 | #define coff_bfd_relax_section bfd_generic_relax_section |
5666 | #endif |
5997 | #endif |
Line 5667... | Line 5998... | ||
5667 | 5998 | ||
5668 | #ifndef coff_bfd_gc_sections |
5999 | #ifndef coff_bfd_gc_sections |
5669 | #define coff_bfd_gc_sections bfd_generic_gc_sections |
6000 | #define coff_bfd_gc_sections bfd_coff_gc_sections |
Line 5670... | Line 6001... | ||
5670 | #endif |
6001 | #endif |
5671 | 6002 | ||
5672 | #ifndef coff_bfd_lookup_section_flags |
6003 | #ifndef coff_bfd_lookup_section_flags |