Rev 5222 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5222 | Rev 6324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* dw2gencfi.c - Support for generating Dwarf2 CFI information. |
1 | /* dw2gencfi.c - Support for generating Dwarf2 CFI information. |
2 | Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
- | |
3 | Free Software Foundation, Inc. |
2 | Copyright (C) 2003-2015 Free Software Foundation, Inc. |
4 | Contributed by Michal Ludvig |
3 | Contributed by Michal Ludvig |
Line 5... | Line 4... | ||
5 | 4 | ||
Line 6... | Line 5... | ||
6 | This file is part of GAS, the GNU Assembler. |
5 | This file is part of GAS, the GNU Assembler. |
Line 74... | Line 73... | ||
74 | 73 | ||
75 | #ifndef tc_cfi_endproc |
74 | #ifndef tc_cfi_endproc |
76 | # define tc_cfi_endproc(fde) ((void) (fde)) |
75 | # define tc_cfi_endproc(fde) ((void) (fde)) |
Line -... | Line 76... | ||
- | 76 | #endif |
|
- | 77 | ||
77 | #endif |
78 | #define EH_FRAME_LINKONCE (SUPPORT_FRAME_LINKONCE || compact_eh) |
78 | 79 | ||
79 | #ifndef DWARF2_FORMAT |
80 | #ifndef DWARF2_FORMAT |
Line 80... | Line 81... | ||
80 | #define DWARF2_FORMAT(SEC) dwarf2_format_32bit |
81 | #define DWARF2_FORMAT(SEC) dwarf2_format_32bit |
81 | #endif |
82 | #endif |
82 | 83 | ||
Line 83... | Line 84... | ||
83 | #ifndef DWARF2_ADDR_SIZE |
84 | #ifndef DWARF2_ADDR_SIZE |
84 | #define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8) |
85 | #define DWARF2_ADDR_SIZE(bfd) (bfd_arch_bits_per_address (bfd) / 8) |
85 | #endif |
86 | #endif |
86 | 87 | ||
87 | #if SUPPORT_FRAME_LINKONCE |
88 | #if MULTIPLE_FRAME_SECTIONS |
88 | #define CUR_SEG(structp) structp->cur_seg |
89 | #define CUR_SEG(structp) structp->cur_seg |
Line 94... | Line 95... | ||
94 | #define SET_CUR_SEG(structp, seg) (void) (0 && seg) |
95 | #define SET_CUR_SEG(structp, seg) (void) (0 && seg) |
95 | #define HANDLED(structp) 0 |
96 | #define HANDLED(structp) 0 |
96 | #define SET_HANDLED(structp, val) (void) (0 && val) |
97 | #define SET_HANDLED(structp, val) (void) (0 && val) |
97 | #endif |
98 | #endif |
Line -... | Line 99... | ||
- | 99 | ||
- | 100 | #ifndef tc_cfi_reloc_for_encoding |
|
- | 101 | #define tc_cfi_reloc_for_encoding(e) BFD_RELOC_NONE |
|
- | 102 | #endif |
|
98 | 103 | ||
99 | /* Private segment collection list. */ |
104 | /* Private segment collection list. */ |
100 | struct dwcfi_seg_list |
105 | struct dwcfi_seg_list |
101 | { |
106 | { |
102 | segT seg; |
107 | segT seg; |
103 | int subseg; |
108 | int subseg; |
104 | char * seg_name; |
109 | char * seg_name; |
Line -... | Line 110... | ||
- | 110 | }; |
|
- | 111 | ||
- | 112 | #ifdef SUPPORT_COMPACT_EH |
|
105 | }; |
113 | static bfd_boolean compact_eh; |
- | 114 | #else |
|
Line 106... | Line 115... | ||
106 | 115 | #define compact_eh 0 |
|
Line -... | Line 116... | ||
- | 116 | #endif |
|
- | 117 | ||
- | 118 | static struct hash_control *dwcfi_hash; |
|
- | 119 | ||
- | 120 | /* Emit a single byte into the current segment. */ |
|
- | 121 | ||
- | 122 | static inline void |
|
- | 123 | out_one (int byte) |
|
- | 124 | { |
|
- | 125 | FRAG_APPEND_1_CHAR (byte); |
|
- | 126 | } |
|
- | 127 | ||
- | 128 | /* Emit a two-byte word into the current segment. */ |
|
- | 129 | ||
- | 130 | static inline void |
|
- | 131 | out_two (int data) |
|
- | 132 | { |
|
- | 133 | md_number_to_chars (frag_more (2), data, 2); |
|
- | 134 | } |
|
- | 135 | ||
- | 136 | /* Emit a four byte word into the current segment. */ |
|
- | 137 | ||
- | 138 | static inline void |
|
- | 139 | out_four (int data) |
|
- | 140 | { |
|
- | 141 | md_number_to_chars (frag_more (4), data, 4); |
|
- | 142 | } |
|
- | 143 | ||
- | 144 | /* Emit an unsigned "little-endian base 128" number. */ |
|
- | 145 | ||
- | 146 | static void |
|
- | 147 | out_uleb128 (addressT value) |
|
- | 148 | { |
|
- | 149 | output_leb128 (frag_more (sizeof_leb128 (value, 0)), value, 0); |
|
- | 150 | } |
|
- | 151 | ||
- | 152 | /* Emit an unsigned "little-endian base 128" number. */ |
|
- | 153 | ||
- | 154 | static void |
|
- | 155 | out_sleb128 (offsetT value) |
|
- | 156 | { |
|
- | 157 | output_leb128 (frag_more (sizeof_leb128 (value, 1)), value, 1); |
|
- | 158 | } |
|
- | 159 | ||
- | 160 | static offsetT |
|
- | 161 | encoding_size (unsigned char encoding) |
|
- | 162 | { |
|
- | 163 | if (encoding == DW_EH_PE_omit) |
|
- | 164 | return 0; |
|
- | 165 | switch (encoding & 0x7) |
|
- | 166 | { |
|
- | 167 | case 0: |
|
- | 168 | return bfd_get_arch_size (stdoutput) == 64 ? 8 : 4; |
|
- | 169 | case DW_EH_PE_udata2: |
|
- | 170 | return 2; |
|
- | 171 | case DW_EH_PE_udata4: |
|
- | 172 | return 4; |
|
- | 173 | case DW_EH_PE_udata8: |
|
- | 174 | return 8; |
|
- | 175 | default: |
|
- | 176 | abort (); |
|
- | 177 | } |
|
- | 178 | } |
|
- | 179 | ||
- | 180 | /* Emit expression EXP in ENCODING. If EMIT_ENCODING is true, first |
|
- | 181 | emit a byte containing ENCODING. */ |
|
- | 182 | ||
- | 183 | static void |
|
- | 184 | emit_expr_encoded (expressionS *exp, int encoding, bfd_boolean emit_encoding) |
|
- | 185 | { |
|
- | 186 | offsetT size = encoding_size (encoding); |
|
- | 187 | bfd_reloc_code_real_type code; |
|
- | 188 | ||
- | 189 | if (encoding == DW_EH_PE_omit) |
|
- | 190 | return; |
|
- | 191 | ||
- | 192 | if (emit_encoding) |
|
- | 193 | out_one (encoding); |
|
- | 194 | ||
- | 195 | code = tc_cfi_reloc_for_encoding (encoding); |
|
- | 196 | if (code != BFD_RELOC_NONE) |
|
- | 197 | { |
|
- | 198 | reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code); |
|
- | 199 | char *p = frag_more (size); |
|
- | 200 | md_number_to_chars (p, 0, size); |
|
- | 201 | fix_new (frag_now, p - frag_now->fr_literal, size, exp->X_add_symbol, |
|
- | 202 | exp->X_add_number, howto->pc_relative, code); |
|
- | 203 | } |
|
- | 204 | else if ((encoding & 0x70) == DW_EH_PE_pcrel) |
|
- | 205 | { |
|
- | 206 | #if CFI_DIFF_EXPR_OK |
|
- | 207 | expressionS tmp = *exp; |
|
- | 208 | tmp.X_op = O_subtract; |
|
- | 209 | tmp.X_op_symbol = symbol_temp_new_now (); |
|
- | 210 | emit_expr (&tmp, size); |
|
- | 211 | #elif defined (tc_cfi_emit_pcrel_expr) |
|
- | 212 | tc_cfi_emit_pcrel_expr (exp, size); |
|
- | 213 | #else |
|
- | 214 | abort (); |
|
- | 215 | #endif |
|
- | 216 | } |
|
107 | #define FRAME_NAME ".eh_frame" |
217 | else |
108 | 218 | emit_expr (exp, size); |
|
Line 109... | Line 219... | ||
109 | static struct hash_control *dwcfi_hash; |
219 | } |
110 | 220 | ||
Line 127... | Line 237... | ||
127 | 237 | ||
128 | dollar = strchr (name, '$'); |
238 | dollar = strchr (name, '$'); |
Line 129... | Line 239... | ||
129 | dot = strchr (name + 1, '.'); |
239 | dot = strchr (name + 1, '.'); |
- | 240 | ||
- | 241 | if (!dollar && !dot) |
|
- | 242 | { |
|
- | 243 | if (!strcmp (base_name, ".eh_frame_entry") |
|
- | 244 | && strcmp (name, ".text") != 0) |
|
130 | 245 | return concat (base_name, ".", name, NULL); |
|
- | 246 | ||
131 | if (!dollar && !dot) |
247 | name = ""; |
132 | name = ""; |
248 | } |
133 | else if (!dollar) |
249 | else if (!dollar) |
134 | name = dot; |
250 | name = dot; |
135 | else if (!dot) |
251 | else if (!dot) |
Line 159... | Line 275... | ||
159 | } |
275 | } |
Line 160... | Line 276... | ||
160 | 276 | ||
161 | static segT |
277 | static segT |
162 | is_now_linkonce_segment (void) |
278 | is_now_linkonce_segment (void) |
- | 279 | { |
|
- | 280 | if (compact_eh) |
|
- | 281 | return now_seg; |
|
163 | { |
282 | |
164 | if ((bfd_get_section_flags (stdoutput, now_seg) |
283 | if ((bfd_get_section_flags (stdoutput, now_seg) |
165 | & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD |
284 | & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD |
166 | | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE |
285 | | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE |
167 | | SEC_LINK_DUPLICATES_SAME_CONTENTS)) != 0) |
286 | | SEC_LINK_DUPLICATES_SAME_CONTENTS)) != 0) |
Line 271... | Line 390... | ||
271 | }; |
390 | }; |
Line 272... | Line 391... | ||
272 | 391 | ||
273 | struct cie_entry |
392 | struct cie_entry |
274 | { |
393 | { |
275 | struct cie_entry *next; |
394 | struct cie_entry *next; |
276 | #if SUPPORT_FRAME_LINKONCE |
395 | #if MULTIPLE_FRAME_SECTIONS |
277 | segT cur_seg; |
396 | segT cur_seg; |
278 | #endif |
397 | #endif |
279 | symbolS *start_address; |
398 | symbolS *start_address; |
280 | unsigned int return_column; |
399 | unsigned int return_column; |
- | 400 | unsigned int signal_frame; |
|
281 | unsigned int signal_frame; |
401 | unsigned char fde_encoding; |
282 | unsigned char per_encoding; |
402 | unsigned char per_encoding; |
283 | unsigned char lsda_encoding; |
403 | unsigned char lsda_encoding; |
284 | expressionS personality; |
404 | expressionS personality; |
285 | struct cfi_insn_data *first, *last; |
405 | struct cfi_insn_data *first, *last; |
Line 326... | Line 446... | ||
326 | SET_HANDLED (fde, 0); |
446 | SET_HANDLED (fde, 0); |
327 | fde->last = &fde->data; |
447 | fde->last = &fde->data; |
328 | fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN; |
448 | fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN; |
329 | fde->per_encoding = DW_EH_PE_omit; |
449 | fde->per_encoding = DW_EH_PE_omit; |
330 | fde->lsda_encoding = DW_EH_PE_omit; |
450 | fde->lsda_encoding = DW_EH_PE_omit; |
- | 451 | fde->eh_header_type = EH_COMPACT_UNKNOWN; |
|
Line 331... | Line 452... | ||
331 | 452 | ||
332 | return fde; |
453 | return fde; |
Line 333... | Line 454... | ||
333 | } |
454 | } |
334 | 455 | ||
Line 335... | Line 456... | ||
335 | /* The following functions are available for a backend to construct its |
456 | /* The following functions are available for a backend to construct its |
336 | own unwind information, usually from legacy unwind directives. */ |
457 | own unwind information, usually from legacy unwind directives. */ |
Line -... | Line 458... | ||
- | 458 | ||
- | 459 | /* Construct a new INSN structure and add it to the end of the insn list |
|
- | 460 | for the currently active FDE. */ |
|
- | 461 | ||
- | 462 | static bfd_boolean cfi_sections_set = FALSE; |
|
337 | 463 | static int cfi_sections = CFI_EMIT_eh_frame; |
|
338 | /* Construct a new INSN structure and add it to the end of the insn list |
464 | int all_cfi_sections = 0; |
339 | for the currently active FDE. */ |
465 | static struct fde_entry *last_fde; |
340 | 466 | ||
341 | static struct cfi_insn_data * |
467 | static struct cfi_insn_data * |
Line 377... | Line 503... | ||
377 | cfi_set_return_column (unsigned regno) |
503 | cfi_set_return_column (unsigned regno) |
378 | { |
504 | { |
379 | frchain_now->frch_cfi_data->cur_fde_data->return_column = regno; |
505 | frchain_now->frch_cfi_data->cur_fde_data->return_column = regno; |
380 | } |
506 | } |
Line -... | Line 507... | ||
- | 507 | ||
- | 508 | void |
|
- | 509 | cfi_set_sections (void) |
|
- | 510 | { |
|
- | 511 | frchain_now->frch_cfi_data->cur_fde_data->sections = all_cfi_sections; |
|
- | 512 | } |
|
381 | 513 | ||
Line 382... | Line 514... | ||
382 | /* Universal functions to store new instructions. */ |
514 | /* Universal functions to store new instructions. */ |
383 | 515 | ||
384 | static void |
516 | static void |
Line 439... | Line 571... | ||
439 | insn->u.ll.lab2 = label; |
571 | insn->u.ll.lab2 = label; |
Line 440... | Line 572... | ||
440 | 572 | ||
441 | frchain_now->frch_cfi_data->last_address = label; |
573 | frchain_now->frch_cfi_data->last_address = label; |
Line -... | Line 574... | ||
- | 574 | } |
|
- | 575 | ||
- | 576 | /* Add a CFI insn to label the current position in the CFI segment. */ |
|
- | 577 | ||
- | 578 | void |
|
- | 579 | cfi_add_label (const char *name) |
|
- | 580 | { |
|
- | 581 | unsigned int len = strlen (name) + 1; |
|
- | 582 | struct cfi_insn_data *insn = alloc_cfi_insn_data (); |
|
- | 583 | ||
- | 584 | insn->insn = CFI_label; |
|
- | 585 | obstack_grow (¬es, name, len); |
|
- | 586 | insn->u.sym_name = (char *) obstack_finish (¬es); |
|
442 | } |
587 | } |
Line 443... | Line 588... | ||
443 | 588 | ||
444 | /* Add a DW_CFA_offset record to the CFI data. */ |
589 | /* Add a DW_CFA_offset record to the CFI data. */ |
445 | 590 | ||
Line 546... | Line 691... | ||
546 | static void dot_cfi (int); |
691 | static void dot_cfi (int); |
547 | static void dot_cfi_escape (int); |
692 | static void dot_cfi_escape (int); |
548 | static void dot_cfi_sections (int); |
693 | static void dot_cfi_sections (int); |
549 | static void dot_cfi_startproc (int); |
694 | static void dot_cfi_startproc (int); |
550 | static void dot_cfi_endproc (int); |
695 | static void dot_cfi_endproc (int); |
- | 696 | static void dot_cfi_fde_data (int); |
|
551 | static void dot_cfi_personality (int); |
697 | static void dot_cfi_personality (int); |
- | 698 | static void dot_cfi_personality_id (int); |
|
552 | static void dot_cfi_lsda (int); |
699 | static void dot_cfi_lsda (int); |
553 | static void dot_cfi_val_encoded_addr (int); |
700 | static void dot_cfi_val_encoded_addr (int); |
- | 701 | static void dot_cfi_inline_lsda (int); |
|
- | 702 | static void dot_cfi_label (int); |
|
Line 554... | Line 703... | ||
554 | 703 | ||
555 | const pseudo_typeS cfi_pseudo_table[] = |
704 | const pseudo_typeS cfi_pseudo_table[] = |
556 | { |
705 | { |
557 | { "cfi_sections", dot_cfi_sections, 0 }, |
706 | { "cfi_sections", dot_cfi_sections, 0 }, |
558 | { "cfi_startproc", dot_cfi_startproc, 0 }, |
707 | { "cfi_startproc", dot_cfi_startproc, 0 }, |
- | 708 | { "cfi_endproc", dot_cfi_endproc, 0 }, |
|
559 | { "cfi_endproc", dot_cfi_endproc, 0 }, |
709 | { "cfi_fde_data", dot_cfi_fde_data, 0 }, |
560 | { "cfi_def_cfa", dot_cfi, DW_CFA_def_cfa }, |
710 | { "cfi_def_cfa", dot_cfi, DW_CFA_def_cfa }, |
561 | { "cfi_def_cfa_register", dot_cfi, DW_CFA_def_cfa_register }, |
711 | { "cfi_def_cfa_register", dot_cfi, DW_CFA_def_cfa_register }, |
562 | { "cfi_def_cfa_offset", dot_cfi, DW_CFA_def_cfa_offset }, |
712 | { "cfi_def_cfa_offset", dot_cfi, DW_CFA_def_cfa_offset }, |
563 | { "cfi_adjust_cfa_offset", dot_cfi, CFI_adjust_cfa_offset }, |
713 | { "cfi_adjust_cfa_offset", dot_cfi, CFI_adjust_cfa_offset }, |
Line 572... | Line 722... | ||
572 | { "cfi_restore_state", dot_cfi, DW_CFA_restore_state }, |
722 | { "cfi_restore_state", dot_cfi, DW_CFA_restore_state }, |
573 | { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save }, |
723 | { "cfi_window_save", dot_cfi, DW_CFA_GNU_window_save }, |
574 | { "cfi_escape", dot_cfi_escape, 0 }, |
724 | { "cfi_escape", dot_cfi_escape, 0 }, |
575 | { "cfi_signal_frame", dot_cfi, CFI_signal_frame }, |
725 | { "cfi_signal_frame", dot_cfi, CFI_signal_frame }, |
576 | { "cfi_personality", dot_cfi_personality, 0 }, |
726 | { "cfi_personality", dot_cfi_personality, 0 }, |
- | 727 | { "cfi_personality_id", dot_cfi_personality_id, 0 }, |
|
577 | { "cfi_lsda", dot_cfi_lsda, 0 }, |
728 | { "cfi_lsda", dot_cfi_lsda, 0 }, |
578 | { "cfi_val_encoded_addr", dot_cfi_val_encoded_addr, 0 }, |
729 | { "cfi_val_encoded_addr", dot_cfi_val_encoded_addr, 0 }, |
- | 730 | { "cfi_inline_lsda", dot_cfi_inline_lsda, 0 }, |
|
- | 731 | { "cfi_label", dot_cfi_label, 0 }, |
|
579 | { NULL, NULL, 0 } |
732 | { NULL, NULL, 0 } |
580 | }; |
733 | }; |
Line 581... | Line 734... | ||
581 | 734 | ||
582 | static void |
735 | static void |
Line 599... | Line 752... | ||
599 | || (*input_line_pointer == '%' |
752 | || (*input_line_pointer == '%' |
600 | && is_name_beginner (*++input_line_pointer))) |
753 | && is_name_beginner (*++input_line_pointer))) |
601 | { |
754 | { |
602 | char *name, c; |
755 | char *name, c; |
Line 603... | Line -... | ||
603 | - | ||
604 | name = input_line_pointer; |
756 | |
Line 605... | Line 757... | ||
605 | c = get_symbol_end (); |
757 | c = get_symbol_name (& name); |
606 | 758 | ||
Line 607... | Line 759... | ||
607 | exp->X_op = O_constant; |
759 | exp->X_op = O_constant; |
608 | exp->X_add_number = tc_regname_to_dw2regnum (name); |
760 | exp->X_add_number = tc_regname_to_dw2regnum (name); |
609 | 761 | ||
610 | *input_line_pointer = c; |
762 | restore_line_pointer (c); |
611 | } |
763 | } |
612 | else |
764 | else |
Line 831... | Line 983... | ||
831 | fde->per_encoding = encoding; |
983 | fde->per_encoding = encoding; |
832 | return; |
984 | return; |
833 | } |
985 | } |
Line 834... | Line 986... | ||
834 | 986 | ||
835 | if ((encoding & 0xff) != encoding |
987 | if ((encoding & 0xff) != encoding |
836 | || ((encoding & 0x70) != 0 |
988 | || ((((encoding & 0x70) != 0 |
837 | #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr |
989 | #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr |
838 | && (encoding & 0x70) != DW_EH_PE_pcrel |
990 | && (encoding & 0x70) != DW_EH_PE_pcrel |
839 | #endif |
991 | #endif |
840 | ) |
992 | ) |
841 | /* leb128 can be handled, but does something actually need it? */ |
993 | /* leb128 can be handled, but does something actually need it? */ |
842 | || (encoding & 7) == DW_EH_PE_uleb128 |
994 | || (encoding & 7) == DW_EH_PE_uleb128 |
- | 995 | || (encoding & 7) > DW_EH_PE_udata8) |
|
843 | || (encoding & 7) > DW_EH_PE_udata8) |
996 | && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE)) |
844 | { |
997 | { |
845 | as_bad (_("invalid or unsupported encoding in .cfi_personality")); |
998 | as_bad (_("invalid or unsupported encoding in .cfi_personality")); |
846 | ignore_rest_of_line (); |
999 | ignore_rest_of_line (); |
847 | return; |
1000 | return; |
Line 901... | Line 1054... | ||
901 | fde->lsda_encoding = encoding; |
1054 | fde->lsda_encoding = encoding; |
902 | return; |
1055 | return; |
903 | } |
1056 | } |
Line 904... | Line 1057... | ||
904 | 1057 | ||
905 | if ((encoding & 0xff) != encoding |
1058 | if ((encoding & 0xff) != encoding |
906 | || ((encoding & 0x70) != 0 |
1059 | || ((((encoding & 0x70) != 0 |
907 | #if CFI_DIFF_LSDA_OK || defined tc_cfi_emit_pcrel_expr |
1060 | #if CFI_DIFF_LSDA_OK || defined tc_cfi_emit_pcrel_expr |
908 | && (encoding & 0x70) != DW_EH_PE_pcrel |
1061 | && (encoding & 0x70) != DW_EH_PE_pcrel |
909 | #endif |
1062 | #endif |
910 | ) |
1063 | ) |
911 | /* leb128 can be handled, but does something actually need it? */ |
1064 | /* leb128 can be handled, but does something actually need it? */ |
912 | || (encoding & 7) == DW_EH_PE_uleb128 |
1065 | || (encoding & 7) == DW_EH_PE_uleb128 |
- | 1066 | || (encoding & 7) > DW_EH_PE_udata8) |
|
913 | || (encoding & 7) > DW_EH_PE_udata8) |
1067 | && tc_cfi_reloc_for_encoding (encoding) == BFD_RELOC_NONE)) |
914 | { |
1068 | { |
915 | as_bad (_("invalid or unsupported encoding in .cfi_lsda")); |
1069 | as_bad (_("invalid or unsupported encoding in .cfi_lsda")); |
916 | ignore_rest_of_line (); |
1070 | ignore_rest_of_line (); |
917 | return; |
1071 | return; |
Line 1015... | Line 1169... | ||
1015 | } |
1169 | } |
Line 1016... | Line 1170... | ||
1016 | 1170 | ||
1017 | demand_empty_rest_of_line (); |
1171 | demand_empty_rest_of_line (); |
Line -... | Line 1172... | ||
- | 1172 | } |
|
1018 | } |
1173 | |
- | 1174 | static void |
|
1019 | 1175 | dot_cfi_label (int ignored ATTRIBUTE_UNUSED) |
|
- | 1176 | { |
|
- | 1177 | char *name = read_symbol_name (); |
|
- | 1178 | ||
- | 1179 | if (name == NULL) |
|
- | 1180 | return; |
|
- | 1181 | ||
- | 1182 | /* If the last address was not at the current PC, advance to current. */ |
|
- | 1183 | if (symbol_get_frag (frchain_now->frch_cfi_data->last_address) != frag_now |
|
1020 | /* By default emit .eh_frame only, not .debug_frame. */ |
1184 | || S_GET_VALUE (frchain_now->frch_cfi_data->last_address) |
- | 1185 | != frag_now_fix ()) |
|
1021 | #define CFI_EMIT_eh_frame (1 << 0) |
1186 | cfi_add_advance_loc (symbol_temp_new_now ()); |
- | 1187 | ||
1022 | #define CFI_EMIT_debug_frame (1 << 1) |
1188 | cfi_add_label (name); |
- | 1189 | ||
Line 1023... | Line 1190... | ||
1023 | #define CFI_EMIT_target (1 << 2) |
1190 | demand_empty_rest_of_line (); |
1024 | static int cfi_sections = CFI_EMIT_eh_frame; |
1191 | } |
1025 | 1192 | ||
1026 | static void |
1193 | static void |
Line 1027... | Line 1194... | ||
1027 | dot_cfi_sections (int ignored ATTRIBUTE_UNUSED) |
1194 | dot_cfi_sections (int ignored ATTRIBUTE_UNUSED) |
1028 | { |
1195 | { |
1029 | int sections = 0; |
1196 | int sections = 0; |
1030 | 1197 | ||
- | 1198 | SKIP_WHITESPACE (); |
|
1031 | SKIP_WHITESPACE (); |
1199 | if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"') |
Line 1032... | Line 1200... | ||
1032 | if (is_name_beginner (*input_line_pointer)) |
1200 | while (1) |
1033 | while (1) |
1201 | { |
Line 1034... | Line 1202... | ||
1034 | { |
1202 | char * saved_ilp; |
1035 | char *name, c; |
1203 | char *name, c; |
1036 | 1204 | ||
1037 | name = input_line_pointer; |
1205 | saved_ilp = input_line_pointer; |
1038 | c = get_symbol_end (); |
1206 | c = get_symbol_name (& name); |
- | 1207 | ||
- | 1208 | if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0 |
|
- | 1209 | && name[9] != '_') |
|
- | 1210 | sections |= CFI_EMIT_eh_frame; |
|
- | 1211 | else if (strncmp (name, ".debug_frame", sizeof ".debug_frame") == 0) |
|
- | 1212 | sections |= CFI_EMIT_debug_frame; |
|
- | 1213 | #if SUPPORT_COMPACT_EH |
|
1039 | 1214 | else if (strncmp (name, ".eh_frame_entry", sizeof ".eh_frame_entry") == 0) |
|
1040 | if (strncmp (name, ".eh_frame", sizeof ".eh_frame") == 0 |
1215 | { |
1041 | && name[9] != '_') |
1216 | compact_eh = TRUE; |
1042 | sections |= CFI_EMIT_eh_frame; |
1217 | sections |= CFI_EMIT_eh_frame_compact; |
1043 | else if (strncmp (name, ".debug_frame", sizeof ".debug_frame") == 0) |
1218 | } |
1044 | sections |= CFI_EMIT_debug_frame; |
1219 | #endif |
1045 | #ifdef tc_cfi_section_name |
1220 | #ifdef tc_cfi_section_name |
1046 | else if (strcmp (name, tc_cfi_section_name) == 0) |
1221 | else if (strcmp (name, tc_cfi_section_name) == 0) |
1047 | sections |= CFI_EMIT_target; |
1222 | sections |= CFI_EMIT_target; |
1048 | #endif |
1223 | #endif |
Line 1049... | Line 1224... | ||
1049 | else |
1224 | else |
1050 | { |
1225 | { |
1051 | *input_line_pointer = c; |
1226 | *input_line_pointer = c; |
1052 | input_line_pointer = name; |
1227 | input_line_pointer = saved_ilp; |
1053 | break; |
1228 | break; |
1054 | } |
1229 | } |
1055 | 1230 | ||
1056 | *input_line_pointer = c; |
1231 | *input_line_pointer = c; |
1057 | SKIP_WHITESPACE (); |
1232 | SKIP_WHITESPACE_AFTER_NAME (); |
1058 | if (*input_line_pointer == ',') |
1233 | if (*input_line_pointer == ',') |
1059 | { |
1234 | { |
1060 | name = input_line_pointer++; |
1235 | name = input_line_pointer++; |
1061 | SKIP_WHITESPACE (); |
1236 | SKIP_WHITESPACE (); |
1062 | if (!is_name_beginner (*input_line_pointer)) |
1237 | if (!is_name_beginner (*input_line_pointer) && *input_line_pointer != '"') |
1063 | { |
1238 | { |
Line 1064... | Line 1239... | ||
1064 | input_line_pointer = name; |
1239 | input_line_pointer = name; |
- | 1240 | break; |
|
- | 1241 | } |
|
- | 1242 | } |
|
1065 | break; |
1243 | else if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"') |
1066 | } |
1244 | break; |
Line 1067... | Line 1245... | ||
1067 | } |
1245 | } |
1068 | else if (is_name_beginner (*input_line_pointer)) |
1246 | |
Line 1086... | Line 1264... | ||
1086 | } |
1264 | } |
Line 1087... | Line 1265... | ||
1087 | 1265 | ||
Line 1088... | Line 1266... | ||
1088 | cfi_new_fde (symbol_temp_new_now ()); |
1266 | cfi_new_fde (symbol_temp_new_now ()); |
1089 | 1267 | ||
1090 | SKIP_WHITESPACE (); |
1268 | SKIP_WHITESPACE (); |
- | 1269 | if (is_name_beginner (*input_line_pointer) || *input_line_pointer == '"') |
|
1091 | if (is_name_beginner (*input_line_pointer)) |
1270 | { |
Line 1092... | Line -... | ||
1092 | { |
- | |
1093 | char *name, c; |
1271 | char * saved_ilp = input_line_pointer; |
Line 1094... | Line 1272... | ||
1094 | 1272 | char *name, c; |
|
1095 | name = input_line_pointer; |
1273 | |
1096 | c = get_symbol_end (); |
1274 | c = get_symbol_name (& name); |
1097 | 1275 | ||
1098 | if (strcmp (name, "simple") == 0) |
1276 | if (strcmp (name, "simple") == 0) |
1099 | { |
1277 | { |
1100 | simple = 1; |
1278 | simple = 1; |
1101 | *input_line_pointer = c; |
1279 | restore_line_pointer (c); |
1102 | } |
1280 | } |
Line -... | Line 1281... | ||
- | 1281 | else |
|
- | 1282 | input_line_pointer = saved_ilp; |
|
1103 | else |
1283 | } |
1104 | input_line_pointer = name; |
1284 | demand_empty_rest_of_line (); |
1105 | } |
1285 | |
Line 1106... | Line 1286... | ||
1106 | demand_empty_rest_of_line (); |
1286 | all_cfi_sections |= cfi_sections; |
Line 1114... | Line 1294... | ||
1114 | } |
1294 | } |
Line 1115... | Line 1295... | ||
1115 | 1295 | ||
1116 | static void |
1296 | static void |
1117 | dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) |
1297 | dot_cfi_endproc (int ignored ATTRIBUTE_UNUSED) |
1118 | { |
- | |
1119 | struct fde_entry *fde; |
- | |
1120 | 1298 | { |
|
1121 | if (frchain_now->frch_cfi_data == NULL) |
1299 | if (frchain_now->frch_cfi_data == NULL) |
1122 | { |
1300 | { |
1123 | as_bad (_(".cfi_endproc without corresponding .cfi_startproc")); |
1301 | as_bad (_(".cfi_endproc without corresponding .cfi_startproc")); |
1124 | ignore_rest_of_line (); |
1302 | ignore_rest_of_line (); |
1125 | return; |
1303 | return; |
Line 1126... | Line 1304... | ||
1126 | } |
1304 | } |
Line 1127... | Line 1305... | ||
1127 | 1305 | ||
Line 1128... | Line 1306... | ||
1128 | fde = frchain_now->frch_cfi_data->cur_fde_data; |
1306 | last_fde = frchain_now->frch_cfi_data->cur_fde_data; |
Line 1129... | Line 1307... | ||
1129 | 1307 | ||
1130 | cfi_end_fde (symbol_temp_new_now ()); |
1308 | cfi_end_fde (symbol_temp_new_now ()); |
1131 | 1309 | ||
Line -... | Line 1310... | ||
- | 1310 | demand_empty_rest_of_line (); |
|
- | 1311 | ||
- | 1312 | if ((cfi_sections & CFI_EMIT_target) != 0) |
|
- | 1313 | tc_cfi_endproc (last_fde); |
|
- | 1314 | } |
|
- | 1315 | ||
- | 1316 | static segT |
|
1132 | demand_empty_rest_of_line (); |
1317 | get_cfi_seg (segT cseg, const char *base, flagword flags, int align) |
1133 | 1318 | { |
|
Line 1134... | Line 1319... | ||
1134 | if ((cfi_sections & CFI_EMIT_target) != 0) |
1319 | /* Exclude .debug_frame sections for Compact EH. */ |
1135 | tc_cfi_endproc (fde); |
1320 | if (SUPPORT_FRAME_LINKONCE || ((flags & SEC_DEBUGGING) == 0 && compact_eh)) |
- | 1321 | { |
|
- | 1322 | struct dwcfi_seg_list *l; |
|
1136 | } |
1323 | |
1137 | 1324 | l = dwcfi_hash_find_or_make (cseg, base, flags); |
|
- | 1325 | ||
- | 1326 | cseg = l->seg; |
|
- | 1327 | subseg_set (cseg, l->subseg); |
|
- | 1328 | } |
|
1138 | 1329 | else |
|
Line -... | Line 1330... | ||
- | 1330 | { |
|
- | 1331 | cseg = subseg_new (base, 0); |
|
1139 | /* Emit a single byte into the current segment. */ |
1332 | bfd_set_section_flags (stdoutput, cseg, flags); |
- | 1333 | } |
|
- | 1334 | record_alignment (cseg, align); |
|
Line 1140... | Line -... | ||
1140 | - | ||
1141 | static inline void |
1335 | return cseg; |
1142 | out_one (int byte) |
1336 | } |
- | 1337 | ||
1143 | { |
1338 | #if SUPPORT_COMPACT_EH |
- | 1339 | static void |
|
1144 | FRAG_APPEND_1_CHAR (byte); |
1340 | dot_cfi_personality_id (int ignored ATTRIBUTE_UNUSED) |
Line -... | Line 1341... | ||
- | 1341 | { |
|
1145 | } |
1342 | struct fde_entry *fde; |
- | 1343 | ||
Line 1146... | Line -... | ||
1146 | - | ||
1147 | /* Emit a two-byte word into the current segment. */ |
1344 | if (frchain_now->frch_cfi_data == NULL) |
1148 | 1345 | { |
|
1149 | static inline void |
1346 | as_bad (_("CFI instruction used without previous .cfi_startproc")); |
- | 1347 | ignore_rest_of_line (); |
|
- | 1348 | return; |
|
1150 | out_two (int data) |
1349 | } |
Line -... | Line 1350... | ||
- | 1350 | ||
- | 1351 | fde = frchain_now->frch_cfi_data->cur_fde_data; |
|
- | 1352 | fde->personality_id = cfi_parse_const (); |
|
- | 1353 | demand_empty_rest_of_line (); |
|
- | 1354 | ||
- | 1355 | if (fde->personality_id == 0 || fde->personality_id > 3) |
|
- | 1356 | { |
|
- | 1357 | as_bad (_("wrong argument to .cfi_personality_id")); |
|
- | 1358 | return; |
|
- | 1359 | } |
|
- | 1360 | } |
|
- | 1361 | ||
- | 1362 | static void |
|
- | 1363 | dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) |
|
- | 1364 | { |
|
- | 1365 | if (frchain_now->frch_cfi_data == NULL) |
|
- | 1366 | { |
|
- | 1367 | as_bad (_(".cfi_fde_data without corresponding .cfi_startproc")); |
|
- | 1368 | ignore_rest_of_line (); |
|
- | 1369 | return; |
|
- | 1370 | } |
|
- | 1371 | ||
- | 1372 | last_fde = frchain_now->frch_cfi_data->cur_fde_data; |
|
- | 1373 | ||
- | 1374 | if ((cfi_sections & CFI_EMIT_target) != 0 |
|
- | 1375 | || (cfi_sections & CFI_EMIT_eh_frame_compact) != 0) |
|
- | 1376 | { |
|
- | 1377 | struct cfi_escape_data *head, **tail, *e; |
|
- | 1378 | int num_ops = 0; |
|
- | 1379 | ||
- | 1380 | tail = &head; |
|
- | 1381 | if (!is_it_end_of_statement ()) |
|
- | 1382 | { |
|
- | 1383 | num_ops = 0; |
|
- | 1384 | do |
|
- | 1385 | { |
|
- | 1386 | e = (struct cfi_escape_data *) xmalloc (sizeof (*e)); |
|
- | 1387 | do_parse_cons_expression (&e->exp, 1); |
|
- | 1388 | *tail = e; |
|
- | 1389 | tail = &e->next; |
|
- | 1390 | num_ops++; |
|
- | 1391 | } |
|
- | 1392 | while (*input_line_pointer++ == ','); |
|
- | 1393 | --input_line_pointer; |
|
- | 1394 | } |
|
- | 1395 | *tail = NULL; |
|
- | 1396 | ||
- | 1397 | if (last_fde->lsda_encoding != DW_EH_PE_omit) |
|
- | 1398 | last_fde->eh_header_type = EH_COMPACT_HAS_LSDA; |
|
- | 1399 | else if (num_ops <= 3 && last_fde->per_encoding == DW_EH_PE_omit) |
|
- | 1400 | last_fde->eh_header_type = EH_COMPACT_INLINE; |
|
- | 1401 | else |
|
- | 1402 | last_fde->eh_header_type = EH_COMPACT_OUTLINE; |
|
- | 1403 | ||
- | 1404 | if (last_fde->eh_header_type == EH_COMPACT_INLINE) |
|
- | 1405 | num_ops = 3; |
|
- | 1406 | ||
- | 1407 | last_fde->eh_data_size = num_ops; |
|
- | 1408 | last_fde->eh_data = (bfd_byte *) xmalloc (num_ops); |
|
- | 1409 | num_ops = 0; |
|
- | 1410 | while (head) |
|
- | 1411 | { |
|
- | 1412 | e = head; |
|
1151 | { |
1413 | head = e->next; |
- | 1414 | last_fde->eh_data[num_ops++] = e->exp.X_add_number; |
|
- | 1415 | free (e); |
|
Line 1152... | Line 1416... | ||
1152 | md_number_to_chars (frag_more (2), data, 2); |
1416 | } |
1153 | } |
1417 | if (last_fde->eh_header_type == EH_COMPACT_INLINE) |
1154 | 1418 | while (num_ops < 3) |
|
- | 1419 | last_fde->eh_data[num_ops++] = tc_compact_eh_opcode_stop; |
|
- | 1420 | } |
|
- | 1421 | ||
- | 1422 | demand_empty_rest_of_line (); |
|
- | 1423 | } |
|
- | 1424 | ||
- | 1425 | /* Function to emit the compact unwinding opcodes stored in the |
|
- | 1426 | fde's eh_data field. The end of the opcode data will be |
|
- | 1427 | padded to the value in align. */ |
|
- | 1428 | ||
- | 1429 | static void |
|
- | 1430 | output_compact_unwind_data (struct fde_entry *fde, int align) |
|
- | 1431 | { |
|
- | 1432 | int data_size = fde->eh_data_size + 2; |
|
- | 1433 | int align_padding; |
|
- | 1434 | int amask; |
|
- | 1435 | char *p; |
|
- | 1436 | ||
- | 1437 | fde->eh_loc = symbol_temp_new_now (); |
|
- | 1438 | ||
- | 1439 | p = frag_more (1); |
|
- | 1440 | if (fde->personality_id != 0) |
|
1155 | /* Emit a four byte word into the current segment. */ |
1441 | *p = fde->personality_id; |
- | 1442 | else if (fde->per_encoding != DW_EH_PE_omit) |
|
- | 1443 | { |
|
- | 1444 | *p = 0; |
|
- | 1445 | emit_expr_encoded (&fde->personality, fde->per_encoding, FALSE); |
|
- | 1446 | data_size += encoding_size (fde->per_encoding); |
|
- | 1447 | } |
|
- | 1448 | else |
|
- | 1449 | *p = 1; |
|
1156 | 1450 | ||
Line 1157... | Line 1451... | ||
1157 | static inline void |
1451 | amask = (1 << align) - 1; |
- | 1452 | align_padding = ((data_size + amask) & ~amask) - data_size; |
|
- | 1453 | ||
- | 1454 | p = frag_more (fde->eh_data_size + 1 + align_padding); |
|
- | 1455 | memcpy (p, fde->eh_data, fde->eh_data_size); |
|
- | 1456 | p += fde->eh_data_size; |
|
- | 1457 | ||
- | 1458 | while (align_padding-- > 0) |
|
- | 1459 | *(p++) = tc_compact_eh_opcode_pad; |
|
- | 1460 | ||
- | 1461 | *(p++) = tc_compact_eh_opcode_stop; |
|
- | 1462 | fde->eh_header_type = EH_COMPACT_OUTLINE_DONE; |
|
- | 1463 | } |
|
- | 1464 | ||
- | 1465 | /* Handle the .cfi_inline_lsda directive. */ |
|
- | 1466 | static void |
|
- | 1467 | dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED) |
|
- | 1468 | { |
|
- | 1469 | segT ccseg; |
|
- | 1470 | int align; |
|
- | 1471 | long max_alignment = 28; |
|
- | 1472 | ||
- | 1473 | if (!last_fde) |
|
- | 1474 | { |
|
- | 1475 | as_bad (_("unexpected .cfi_inline_lsda")); |
|
- | 1476 | ignore_rest_of_line (); |
|
- | 1477 | return; |
|
- | 1478 | } |
|
- | 1479 | ||
- | 1480 | if ((last_fde->sections & CFI_EMIT_eh_frame_compact) == 0) |
|
- | 1481 | { |
|
- | 1482 | as_bad (_(".cfi_inline_lsda not valid for this frame")); |
|
- | 1483 | ignore_rest_of_line (); |
|
- | 1484 | return; |
|
- | 1485 | } |
|
- | 1486 | ||
- | 1487 | if (last_fde->eh_header_type != EH_COMPACT_UNKNOWN |
|
- | 1488 | && last_fde->eh_header_type != EH_COMPACT_HAS_LSDA) |
|
- | 1489 | { |
|
- | 1490 | as_bad (_(".cfi_inline_lsda seen for frame without .cfi_lsda")); |
|
- | 1491 | ignore_rest_of_line (); |
|
- | 1492 | return; |
|
- | 1493 | } |
|
- | 1494 | ||
- | 1495 | #ifdef md_flush_pending_output |
|
- | 1496 | md_flush_pending_output (); |
|
- | 1497 | #endif |
|
- | 1498 | ||
- | 1499 | align = get_absolute_expression (); |
|
- | 1500 | if (align > max_alignment) |
|
- | 1501 | { |
|
- | 1502 | align = max_alignment; |
|
- | 1503 | as_bad (_("Alignment too large: %d. assumed."), align); |
|
- | 1504 | } |
|
- | 1505 | else if (align < 0) |
|
- | 1506 | { |
|
- | 1507 | as_warn (_("Alignment negative: 0 assumed.")); |
|
- | 1508 | align = 0; |
|
- | 1509 | } |
|
- | 1510 | ||
- | 1511 | demand_empty_rest_of_line (); |
|
- | 1512 | ccseg = CUR_SEG (last_fde); |
|
- | 1513 | ||
- | 1514 | /* Open .gnu_extab section. */ |
|
- | 1515 | get_cfi_seg (ccseg, ".gnu_extab", |
|
- | 1516 | (SEC_ALLOC | SEC_LOAD | SEC_DATA |
|
- | 1517 | | DWARF2_EH_FRAME_READ_ONLY), |
|
- | 1518 | 1); |
|
- | 1519 | ||
- | 1520 | frag_align (align, 0, 0); |
|
- | 1521 | record_alignment (now_seg, align); |
|
Line 1158... | Line 1522... | ||
1158 | out_four (int data) |
1522 | if (last_fde->eh_header_type == EH_COMPACT_HAS_LSDA) |
1159 | { |
1523 | output_compact_unwind_data (last_fde, align); |
1160 | md_number_to_chars (frag_more (4), data, 4); |
1524 | |
1161 | } |
1525 | last_fde = NULL; |
- | 1526 | ||
- | 1527 | return; |
|
- | 1528 | } |
|
- | 1529 | #else /* !SUPPORT_COMPACT_EH */ |
|
- | 1530 | static void |
|
- | 1531 | dot_cfi_inline_lsda (int ignored ATTRIBUTE_UNUSED) |
|
- | 1532 | { |
|
- | 1533 | as_bad (_(".cfi_inline_lsda is not supported for this target")); |
|
1162 | 1534 | ignore_rest_of_line (); |
|
- | 1535 | } |
|
Line 1163... | Line 1536... | ||
1163 | /* Emit an unsigned "little-endian base 128" number. */ |
1536 | |
1164 | 1537 | static void |
|
1165 | static void |
1538 | dot_cfi_fde_data (int ignored ATTRIBUTE_UNUSED) |
1166 | out_uleb128 (addressT value) |
1539 | { |
Line 1330... | Line 1703... | ||
1330 | } |
1703 | } |
Line 1331... | Line 1704... | ||
1331 | 1704 | ||
1332 | case CFI_val_encoded_addr: |
1705 | case CFI_val_encoded_addr: |
1333 | { |
1706 | { |
1334 | unsigned encoding = insn->u.ea.encoding; |
1707 | unsigned encoding = insn->u.ea.encoding; |
Line 1335... | Line 1708... | ||
1335 | offsetT encoding_size; |
1708 | offsetT enc_size; |
1336 | 1709 | ||
1337 | if (encoding == DW_EH_PE_omit) |
1710 | if (encoding == DW_EH_PE_omit) |
1338 | break; |
1711 | break; |
Line 1339... | Line 1712... | ||
1339 | out_one (DW_CFA_val_expression); |
1712 | out_one (DW_CFA_val_expression); |
1340 | out_uleb128 (insn->u.ea.reg); |
1713 | out_uleb128 (insn->u.ea.reg); |
1341 | 1714 | ||
1342 | switch (encoding & 0x7) |
1715 | switch (encoding & 0x7) |
1343 | { |
1716 | { |
1344 | case DW_EH_PE_absptr: |
1717 | case DW_EH_PE_absptr: |
1345 | encoding_size = DWARF2_ADDR_SIZE (stdoutput); |
1718 | enc_size = DWARF2_ADDR_SIZE (stdoutput); |
1346 | break; |
1719 | break; |
1347 | case DW_EH_PE_udata2: |
1720 | case DW_EH_PE_udata2: |
1348 | encoding_size = 2; |
1721 | enc_size = 2; |
1349 | break; |
1722 | break; |
1350 | case DW_EH_PE_udata4: |
1723 | case DW_EH_PE_udata4: |
1351 | encoding_size = 4; |
1724 | enc_size = 4; |
1352 | break; |
1725 | break; |
1353 | case DW_EH_PE_udata8: |
1726 | case DW_EH_PE_udata8: |
1354 | encoding_size = 8; |
1727 | enc_size = 8; |
1355 | break; |
1728 | break; |
Line 1356... | Line 1729... | ||
1356 | default: |
1729 | default: |
1357 | abort (); |
1730 | abort (); |
1358 | } |
1731 | } |
1359 | 1732 | ||
1360 | /* If the user has requested absolute encoding, |
1733 | /* If the user has requested absolute encoding, |
1361 | then use the smaller DW_OP_addr encoding. */ |
1734 | then use the smaller DW_OP_addr encoding. */ |
1362 | if (insn->u.ea.encoding == DW_EH_PE_absptr) |
1735 | if (insn->u.ea.encoding == DW_EH_PE_absptr) |
1363 | { |
1736 | { |
1364 | out_uleb128 (1 + encoding_size); |
1737 | out_uleb128 (1 + enc_size); |
1365 | out_one (DW_OP_addr); |
1738 | out_one (DW_OP_addr); |
1366 | } |
1739 | } |
1367 | else |
1740 | else |
Line 1368... | Line 1741... | ||
1368 | { |
1741 | { |
1369 | out_uleb128 (1 + 1 + encoding_size); |
1742 | out_uleb128 (1 + 1 + enc_size); |
1370 | out_one (DW_OP_GNU_encoded_addr); |
1743 | out_one (DW_OP_GNU_encoded_addr); |
1371 | out_one (encoding); |
1744 | out_one (encoding); |
1372 | 1745 | ||
1373 | if ((encoding & 0x70) == DW_EH_PE_pcrel) |
1746 | if ((encoding & 0x70) == DW_EH_PE_pcrel) |
1374 | { |
1747 | { |
1375 | #if CFI_DIFF_EXPR_OK |
1748 | #if CFI_DIFF_EXPR_OK |
1376 | insn->u.ea.exp.X_op = O_subtract; |
1749 | insn->u.ea.exp.X_op = O_subtract; |
1377 | insn->u.ea.exp.X_op_symbol = symbol_temp_new_now (); |
1750 | insn->u.ea.exp.X_op_symbol = symbol_temp_new_now (); |
1378 | #elif defined (tc_cfi_emit_pcrel_expr) |
1751 | #elif defined (tc_cfi_emit_pcrel_expr) |
1379 | tc_cfi_emit_pcrel_expr (&insn->u.ea.exp, encoding_size); |
1752 | tc_cfi_emit_pcrel_expr (&insn->u.ea.exp, enc_size); |
1380 | break; |
1753 | break; |
1381 | #else |
1754 | #else |
1382 | abort (); |
1755 | abort (); |
1383 | #endif |
1756 | #endif |
Line 1384... | Line 1757... | ||
1384 | } |
1757 | } |
1385 | } |
1758 | } |
1386 | emit_expr (&insn->u.ea.exp, encoding_size); |
1759 | emit_expr (&insn->u.ea.exp, enc_size); |
1387 | } |
- | |
Line 1388... | Line -... | ||
1388 | break; |
- | |
1389 | - | ||
1390 | default: |
- | |
1391 | abort (); |
- | |
1392 | } |
- | |
1393 | } |
- | |
1394 | - | ||
1395 | static offsetT |
- | |
1396 | encoding_size (unsigned char encoding) |
- | |
1397 | { |
- | |
1398 | if (encoding == DW_EH_PE_omit) |
- | |
1399 | return 0; |
- | |
1400 | switch (encoding & 0x7) |
- | |
1401 | { |
- | |
1402 | case 0: |
- | |
1403 | return bfd_get_arch_size (stdoutput) == 64 ? 8 : 4; |
1760 | } |
1404 | case DW_EH_PE_udata2: |
1761 | break; |
1405 | return 2; |
1762 | |
1406 | case DW_EH_PE_udata4: |
1763 | case CFI_label: |
Line 1472... | Line 1829... | ||
1472 | augmentation_size = 1 + (cie->lsda_encoding != DW_EH_PE_omit); |
1829 | augmentation_size = 1 + (cie->lsda_encoding != DW_EH_PE_omit); |
1473 | if (cie->per_encoding != DW_EH_PE_omit) |
1830 | if (cie->per_encoding != DW_EH_PE_omit) |
1474 | augmentation_size += 1 + encoding_size (cie->per_encoding); |
1831 | augmentation_size += 1 + encoding_size (cie->per_encoding); |
1475 | out_uleb128 (augmentation_size); /* Augmentation size. */ |
1832 | out_uleb128 (augmentation_size); /* Augmentation size. */ |
Line 1476... | Line -... | ||
1476 | - | ||
1477 | if (cie->per_encoding != DW_EH_PE_omit) |
- | |
1478 | { |
1833 | |
1479 | offsetT size = encoding_size (cie->per_encoding); |
- | |
1480 | out_one (cie->per_encoding); |
- | |
1481 | exp = cie->personality; |
- | |
1482 | if ((cie->per_encoding & 0x70) == DW_EH_PE_pcrel) |
- | |
1483 | { |
- | |
1484 | #if CFI_DIFF_EXPR_OK |
- | |
1485 | exp.X_op = O_subtract; |
- | |
1486 | exp.X_op_symbol = symbol_temp_new_now (); |
- | |
1487 | emit_expr (&exp, size); |
- | |
1488 | #elif defined (tc_cfi_emit_pcrel_expr) |
- | |
1489 | tc_cfi_emit_pcrel_expr (&exp, size); |
- | |
1490 | #else |
- | |
1491 | abort (); |
- | |
1492 | #endif |
- | |
1493 | } |
- | |
1494 | else |
- | |
1495 | emit_expr (&exp, size); |
- | |
Line 1496... | Line 1834... | ||
1496 | } |
1834 | emit_expr_encoded (&cie->personality, cie->per_encoding, TRUE); |
1497 | 1835 | ||
1498 | if (cie->lsda_encoding != DW_EH_PE_omit) |
1836 | if (cie->lsda_encoding != DW_EH_PE_omit) |
Line 1514... | Line 1852... | ||
1514 | abort (); |
1852 | abort (); |
1515 | } |
1853 | } |
1516 | #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr |
1854 | #if CFI_DIFF_EXPR_OK || defined tc_cfi_emit_pcrel_expr |
1517 | enc |= DW_EH_PE_pcrel; |
1855 | enc |= DW_EH_PE_pcrel; |
1518 | #endif |
1856 | #endif |
- | 1857 | #ifdef DWARF2_FDE_RELOC_ENCODING |
|
- | 1858 | /* Allow target to override encoding. */ |
|
- | 1859 | enc = DWARF2_FDE_RELOC_ENCODING (enc); |
|
- | 1860 | #endif |
|
- | 1861 | cie->fde_encoding = enc; |
|
1519 | if (eh_frame) |
1862 | if (eh_frame) |
1520 | out_one (enc); |
1863 | out_one (enc); |
Line 1521... | Line 1864... | ||
1521 | 1864 | ||
1522 | if (cie->first) |
1865 | if (cie->first) |
Line 1574... | Line 1917... | ||
1574 | else |
1917 | else |
1575 | { |
1918 | { |
1576 | TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size); |
1919 | TC_DWARF2_EMIT_OFFSET (cie->start_address, offset_size); |
1577 | } |
1920 | } |
Line -... | Line 1921... | ||
- | 1921 | ||
1578 | 1922 | exp.X_op = O_symbol; |
|
1579 | if (eh_frame) |
1923 | if (eh_frame) |
- | 1924 | { |
|
- | 1925 | bfd_reloc_code_real_type code |
|
- | 1926 | = tc_cfi_reloc_for_encoding (cie->fde_encoding); |
|
- | 1927 | if (code != BFD_RELOC_NONE) |
|
- | 1928 | { |
|
- | 1929 | reloc_howto_type *howto = bfd_reloc_type_lookup (stdoutput, code); |
|
- | 1930 | char *p = frag_more (4); |
|
- | 1931 | md_number_to_chars (p, 0, 4); |
|
- | 1932 | fix_new (frag_now, p - frag_now->fr_literal, 4, fde->start_address, |
|
- | 1933 | 0, howto->pc_relative, code); |
|
- | 1934 | } |
|
- | 1935 | else |
|
1580 | { |
1936 | { |
1581 | exp.X_op = O_subtract; |
1937 | exp.X_op = O_subtract; |
1582 | exp.X_add_number = 0; |
1938 | exp.X_add_number = 0; |
1583 | #if CFI_DIFF_EXPR_OK |
1939 | #if CFI_DIFF_EXPR_OK |
1584 | exp.X_add_symbol = fde->start_address; |
1940 | exp.X_add_symbol = fde->start_address; |
1585 | exp.X_op_symbol = symbol_temp_new_now (); |
1941 | exp.X_op_symbol = symbol_temp_new_now (); |
1586 | emit_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ |
1942 | emit_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ |
1587 | #else |
1943 | #else |
1588 | exp.X_op = O_symbol; |
1944 | exp.X_op = O_symbol; |
- | 1945 | exp.X_add_symbol = fde->start_address; |
|
1589 | exp.X_add_symbol = fde->start_address; |
1946 | |
1590 | #ifdef tc_cfi_emit_pcrel_expr |
1947 | #if defined(tc_cfi_emit_pcrel_expr) |
1591 | tc_cfi_emit_pcrel_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ |
1948 | tc_cfi_emit_pcrel_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ |
1592 | #else |
1949 | #else |
1593 | emit_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ |
1950 | emit_expr (&exp, DWARF2_FDE_RELOC_SIZE); /* Code offset. */ |
1594 | #endif |
1951 | #endif |
- | 1952 | #endif |
|
1595 | #endif |
1953 | } |
1596 | addr_size = DWARF2_FDE_RELOC_SIZE; |
1954 | addr_size = DWARF2_FDE_RELOC_SIZE; |
1597 | } |
1955 | } |
1598 | else |
1956 | else |
1599 | { |
- | |
1600 | exp.X_op = O_symbol; |
- | |
1601 | exp.X_add_symbol = fde->start_address; |
1957 | { |
- | 1958 | exp.X_add_number = 0; |
|
1602 | exp.X_add_number = 0; |
1959 | exp.X_add_symbol = fde->start_address; |
1603 | addr_size = DWARF2_ADDR_SIZE (stdoutput); |
1960 | addr_size = DWARF2_ADDR_SIZE (stdoutput); |
1604 | emit_expr (&exp, addr_size); |
1961 | emit_expr (&exp, addr_size); |
Line 1605... | Line 1962... | ||
1605 | } |
1962 | } |
Line 1612... | Line 1969... | ||
1612 | 1969 | ||
1613 | augmentation_size = encoding_size (fde->lsda_encoding); |
1970 | augmentation_size = encoding_size (fde->lsda_encoding); |
1614 | if (eh_frame) |
1971 | if (eh_frame) |
Line 1615... | Line -... | ||
1615 | out_uleb128 (augmentation_size); /* Augmentation size. */ |
- | |
1616 | - | ||
1617 | if (fde->lsda_encoding != DW_EH_PE_omit) |
- | |
1618 | { |
- | |
1619 | exp = fde->lsda; |
- | |
1620 | if ((fde->lsda_encoding & 0x70) == DW_EH_PE_pcrel) |
- | |
1621 | { |
- | |
1622 | #if CFI_DIFF_LSDA_OK |
- | |
1623 | exp.X_op = O_subtract; |
1972 | out_uleb128 (augmentation_size); /* Augmentation size. */ |
1624 | exp.X_op_symbol = symbol_temp_new_now (); |
- | |
1625 | emit_expr (&exp, augmentation_size); |
- | |
1626 | #elif defined (tc_cfi_emit_pcrel_expr) |
- | |
1627 | tc_cfi_emit_pcrel_expr (&exp, augmentation_size); |
- | |
1628 | #else |
- | |
1629 | abort (); |
- | |
1630 | #endif |
- | |
1631 | } |
- | |
1632 | else |
- | |
Line 1633... | Line 1973... | ||
1633 | emit_expr (&exp, augmentation_size); |
1973 | |
1634 | } |
1974 | emit_expr_encoded (&fde->lsda, cie->lsda_encoding, FALSE); |
1635 | 1975 | ||
Line 1720... | Line 2060... | ||
1720 | goto fail; |
2060 | goto fail; |
1721 | break; |
2061 | break; |
Line 1722... | Line 2062... | ||
1722 | 2062 | ||
1723 | case CFI_escape: |
2063 | case CFI_escape: |
- | 2064 | case CFI_val_encoded_addr: |
|
1724 | case CFI_val_encoded_addr: |
2065 | case CFI_label: |
1725 | /* Don't bother matching these for now. */ |
2066 | /* Don't bother matching these for now. */ |
Line 1726... | Line 2067... | ||
1726 | goto fail; |
2067 | goto fail; |
1727 | 2068 | ||
Line 1736... | Line 2077... | ||
1736 | if (i == cie->last |
2077 | if (i == cie->last |
1737 | && (!j |
2078 | && (!j |
1738 | || j->insn == DW_CFA_advance_loc |
2079 | || j->insn == DW_CFA_advance_loc |
1739 | || j->insn == DW_CFA_remember_state |
2080 | || j->insn == DW_CFA_remember_state |
1740 | || j->insn == CFI_escape |
2081 | || j->insn == CFI_escape |
1741 | || j->insn == CFI_val_encoded_addr)) |
2082 | || j->insn == CFI_val_encoded_addr |
- | 2083 | || j->insn == CFI_label)) |
|
1742 | { |
2084 | { |
1743 | *pfirst = j; |
2085 | *pfirst = j; |
1744 | return cie; |
2086 | return cie; |
1745 | } |
2087 | } |
Line 1760... | Line 2102... | ||
1760 | 2102 | ||
1761 | for (i = cie->first; i ; i = i->next) |
2103 | for (i = cie->first; i ; i = i->next) |
1762 | if (i->insn == DW_CFA_advance_loc |
2104 | if (i->insn == DW_CFA_advance_loc |
1763 | || i->insn == DW_CFA_remember_state |
2105 | || i->insn == DW_CFA_remember_state |
1764 | || i->insn == CFI_escape |
2106 | || i->insn == CFI_escape |
- | 2107 | || i->insn == CFI_val_encoded_addr |
|
1765 | || i->insn == CFI_val_encoded_addr) |
2108 | || i->insn == CFI_label) |
Line 1766... | Line 2109... | ||
1766 | break; |
2109 | break; |
1767 | 2110 | ||
Line 1787... | Line 2130... | ||
1787 | case DW_CFA_def_cfa_offset: |
2130 | case DW_CFA_def_cfa_offset: |
1788 | case DW_CFA_remember_state: |
2131 | case DW_CFA_remember_state: |
1789 | case DW_CFA_restore_state: |
2132 | case DW_CFA_restore_state: |
1790 | case DW_CFA_GNU_window_save: |
2133 | case DW_CFA_GNU_window_save: |
1791 | case CFI_escape: |
2134 | case CFI_escape: |
- | 2135 | case CFI_label: |
|
1792 | break; |
2136 | break; |
Line 1793... | Line 2137... | ||
1793 | 2137 | ||
1794 | case DW_CFA_def_cfa: |
2138 | case DW_CFA_def_cfa: |
1795 | case DW_CFA_offset: |
2139 | case DW_CFA_offset: |
Line 1819... | Line 2163... | ||
1819 | } |
2163 | } |
1820 | #else |
2164 | #else |
1821 | #define cfi_change_reg_numbers(insn, cseg) do { } while (0) |
2165 | #define cfi_change_reg_numbers(insn, cseg) do { } while (0) |
1822 | #endif |
2166 | #endif |
Line -... | Line 2167... | ||
- | 2167 | ||
1823 | 2168 | #if SUPPORT_COMPACT_EH |
|
1824 | static segT |
2169 | static void |
1825 | get_cfi_seg (segT cseg, const char *base, flagword flags, int align) |
2170 | cfi_emit_eh_header (symbolS *sym, bfd_vma addend) |
- | 2171 | { |
|
- | 2172 | expressionS exp; |
|
1826 | { |
2173 | |
- | 2174 | exp.X_add_number = addend; |
|
- | 2175 | exp.X_add_symbol = sym; |
|
- | 2176 | emit_expr_encoded (&exp, DW_EH_PE_sdata4 | DW_EH_PE_pcrel, FALSE); |
|
- | 2177 | } |
|
- | 2178 | ||
- | 2179 | static void |
|
1827 | if (SUPPORT_FRAME_LINKONCE) |
2180 | output_eh_header (struct fde_entry *fde) |
- | 2181 | { |
|
1828 | { |
2182 | char *p; |
Line 1829... | Line 2183... | ||
1829 | struct dwcfi_seg_list *l; |
2183 | bfd_vma addend; |
- | 2184 | ||
- | 2185 | if (fde->eh_header_type == EH_COMPACT_INLINE) |
|
- | 2186 | addend = 0; |
|
Line -... | Line 2187... | ||
- | 2187 | else |
|
- | 2188 | addend = 1; |
|
- | 2189 | ||
- | 2190 | cfi_emit_eh_header (fde->start_address, addend); |
|
- | 2191 | ||
- | 2192 | if (fde->eh_header_type == EH_COMPACT_INLINE) |
|
1830 | 2193 | { |
|
1831 | l = dwcfi_hash_find_or_make (cseg, base, flags); |
2194 | p = frag_more (4); |
1832 | 2195 | /* Inline entries always use PR1. */ |
|
1833 | cseg = l->seg; |
2196 | *(p++) = 1; |
1834 | subseg_set (cseg, l->subseg); |
2197 | memcpy(p, fde->eh_data, 3); |
- | 2198 | } |
|
- | 2199 | else |
|
1835 | } |
2200 | { |
- | 2201 | if (fde->eh_header_type == EH_COMPACT_LEGACY) |
|
- | 2202 | addend = 1; |
|
- | 2203 | else if (fde->eh_header_type == EH_COMPACT_OUTLINE |
|
- | 2204 | || fde->eh_header_type == EH_COMPACT_OUTLINE_DONE) |
|
1836 | else |
2205 | addend = 0; |
1837 | { |
2206 | else |
1838 | cseg = subseg_new (base, 0); |
- | |
1839 | bfd_set_section_flags (stdoutput, cseg, flags); |
- | |
1840 | } |
2207 | abort (); |
- | 2208 | cfi_emit_eh_header (fde->eh_loc, addend); |
|
Line 1841... | Line 2209... | ||
1841 | record_alignment (cseg, align); |
2209 | } |
1842 | return cseg; |
2210 | } |
1843 | } |
2211 | #endif |
1844 | 2212 | ||
Line 1852... | Line 2220... | ||
1852 | int save_flag_traditional_format, seek_next_seg; |
2220 | int save_flag_traditional_format, seek_next_seg; |
Line 1853... | Line 2221... | ||
1853 | 2221 | ||
1854 | if (all_fde_data == 0) |
2222 | if (all_fde_data == 0) |
Line 1855... | Line 2223... | ||
1855 | return; |
2223 | return; |
- | 2224 | ||
1856 | 2225 | if ((all_cfi_sections & CFI_EMIT_eh_frame) != 0 |
|
1857 | if ((cfi_sections & CFI_EMIT_eh_frame) != 0) |
2226 | || (all_cfi_sections & CFI_EMIT_eh_frame_compact) != 0) |
1858 | { |
2227 | { |
1859 | /* Make sure check_eh_frame doesn't do anything with our output. */ |
2228 | /* Make sure check_eh_frame doesn't do anything with our output. */ |
Line 1860... | Line 2229... | ||
1860 | save_flag_traditional_format = flag_traditional_format; |
2229 | save_flag_traditional_format = flag_traditional_format; |
1861 | flag_traditional_format = 1; |
2230 | flag_traditional_format = 1; |
1862 | 2231 | ||
1863 | if (!SUPPORT_FRAME_LINKONCE) |
2232 | if (!EH_FRAME_LINKONCE) |
1864 | { |
2233 | { |
1865 | /* Open .eh_frame section. */ |
2234 | /* Open .eh_frame section. */ |
Line 1886... | Line 2255... | ||
1886 | } |
2255 | } |
1887 | cie_root = NULL; |
2256 | cie_root = NULL; |
Line 1888... | Line 2257... | ||
1888 | 2257 | ||
1889 | for (fde = all_fde_data; fde ; fde = fde->next) |
2258 | for (fde = all_fde_data; fde ; fde = fde->next) |
- | 2259 | { |
|
- | 2260 | if ((fde->sections & CFI_EMIT_eh_frame) == 0 |
|
- | 2261 | && (fde->sections & CFI_EMIT_eh_frame_compact) == 0) |
|
- | 2262 | continue; |
|
- | 2263 | ||
- | 2264 | #if SUPPORT_COMPACT_EH |
|
- | 2265 | /* Emit a LEGACY format header if we have processed all |
|
- | 2266 | of the .cfi directives without encountering either inline or |
|
- | 2267 | out-of-line compact unwinding opcodes. */ |
|
- | 2268 | if (fde->eh_header_type == EH_COMPACT_HAS_LSDA |
|
- | 2269 | || fde->eh_header_type == EH_COMPACT_UNKNOWN) |
|
- | 2270 | fde->eh_header_type = EH_COMPACT_LEGACY; |
|
- | 2271 | ||
- | 2272 | if (fde->eh_header_type != EH_COMPACT_LEGACY) |
|
- | 2273 | continue; |
|
1890 | { |
2274 | #endif |
1891 | if (SUPPORT_FRAME_LINKONCE) |
2275 | if (EH_FRAME_LINKONCE) |
1892 | { |
2276 | { |
1893 | if (HANDLED (fde)) |
2277 | if (HANDLED (fde)) |
1894 | continue; |
2278 | continue; |
1895 | if (seek_next_seg && CUR_SEG (fde) != ccseg) |
2279 | if (seek_next_seg && CUR_SEG (fde) != ccseg) |
Line 1920... | Line 2304... | ||
1920 | as_bad (_("open CFI at the end of file; missing .cfi_endproc directive")); |
2304 | as_bad (_("open CFI at the end of file; missing .cfi_endproc directive")); |
1921 | fde->end_address = fde->start_address; |
2305 | fde->end_address = fde->start_address; |
1922 | } |
2306 | } |
Line 1923... | Line 2307... | ||
1923 | 2307 | ||
- | 2308 | cie = select_cie_for_fde (fde, TRUE, &first, 2); |
|
1924 | cie = select_cie_for_fde (fde, TRUE, &first, 2); |
2309 | fde->eh_loc = symbol_temp_new_now (); |
1925 | output_fde (fde, cie, TRUE, first, |
2310 | output_fde (fde, cie, TRUE, first, |
1926 | fde->next == NULL ? EH_FRAME_ALIGNMENT : 2); |
2311 | fde->next == NULL ? EH_FRAME_ALIGNMENT : 2); |
1927 | } |
2312 | } |
1928 | } |
2313 | } |
- | 2314 | while (EH_FRAME_LINKONCE && seek_next_seg == 2); |
|
- | 2315 | ||
- | 2316 | if (EH_FRAME_LINKONCE) |
|
- | 2317 | for (fde = all_fde_data; fde ; fde = fde->next) |
|
- | 2318 | SET_HANDLED (fde, 0); |
|
- | 2319 | ||
- | 2320 | #if SUPPORT_COMPACT_EH |
|
- | 2321 | if (compact_eh) |
|
- | 2322 | { |
|
- | 2323 | /* Create remaining out of line table entries. */ |
|
- | 2324 | do |
|
- | 2325 | { |
|
- | 2326 | ccseg = NULL; |
|
- | 2327 | seek_next_seg = 0; |
|
- | 2328 | ||
- | 2329 | for (fde = all_fde_data; fde ; fde = fde->next) |
|
- | 2330 | { |
|
- | 2331 | if ((fde->sections & CFI_EMIT_eh_frame) == 0 |
|
- | 2332 | && (fde->sections & CFI_EMIT_eh_frame_compact) == 0) |
|
- | 2333 | continue; |
|
- | 2334 | ||
- | 2335 | if (fde->eh_header_type != EH_COMPACT_OUTLINE) |
|
- | 2336 | continue; |
|
- | 2337 | if (HANDLED (fde)) |
|
- | 2338 | continue; |
|
- | 2339 | if (seek_next_seg && CUR_SEG (fde) != ccseg) |
|
- | 2340 | { |
|
- | 2341 | seek_next_seg = 2; |
|
- | 2342 | continue; |
|
- | 2343 | } |
|
- | 2344 | if (!seek_next_seg) |
|
- | 2345 | { |
|
- | 2346 | ccseg = CUR_SEG (fde); |
|
- | 2347 | /* Open .gnu_extab section. */ |
|
- | 2348 | get_cfi_seg (ccseg, ".gnu_extab", |
|
- | 2349 | (SEC_ALLOC | SEC_LOAD | SEC_DATA |
|
- | 2350 | | DWARF2_EH_FRAME_READ_ONLY), |
|
- | 2351 | 1); |
|
- | 2352 | seek_next_seg = 1; |
|
- | 2353 | } |
|
- | 2354 | SET_HANDLED (fde, 1); |
|
- | 2355 | ||
- | 2356 | frag_align (1, 0, 0); |
|
- | 2357 | record_alignment (now_seg, 1); |
|
- | 2358 | output_compact_unwind_data (fde, 1); |
|
- | 2359 | } |
|
- | 2360 | } |
|
- | 2361 | while (EH_FRAME_LINKONCE && seek_next_seg == 2); |
|
- | 2362 | ||
- | 2363 | for (fde = all_fde_data; fde ; fde = fde->next) |
|
- | 2364 | SET_HANDLED (fde, 0); |
|
- | 2365 | ||
- | 2366 | /* Create index table fragments. */ |
|
- | 2367 | do |
|
- | 2368 | { |
|
- | 2369 | ccseg = NULL; |
|
- | 2370 | seek_next_seg = 0; |
|
- | 2371 | ||
- | 2372 | for (fde = all_fde_data; fde ; fde = fde->next) |
|
- | 2373 | { |
|
- | 2374 | if ((fde->sections & CFI_EMIT_eh_frame) == 0 |
|
- | 2375 | && (fde->sections & CFI_EMIT_eh_frame_compact) == 0) |
|
- | 2376 | continue; |
|
- | 2377 | ||
- | 2378 | if (HANDLED (fde)) |
|
- | 2379 | continue; |
|
- | 2380 | if (seek_next_seg && CUR_SEG (fde) != ccseg) |
|
- | 2381 | { |
|
- | 2382 | seek_next_seg = 2; |
|
- | 2383 | continue; |
|
- | 2384 | } |
|
- | 2385 | if (!seek_next_seg) |
|
- | 2386 | { |
|
- | 2387 | ccseg = CUR_SEG (fde); |
|
- | 2388 | /* Open .eh_frame_entry section. */ |
|
- | 2389 | cfi_seg = get_cfi_seg (ccseg, ".eh_frame_entry", |
|
- | 2390 | (SEC_ALLOC | SEC_LOAD | SEC_DATA |
|
- | 2391 | | DWARF2_EH_FRAME_READ_ONLY), |
|
- | 2392 | 2); |
|
- | 2393 | seek_next_seg = 1; |
|
- | 2394 | } |
|
- | 2395 | SET_HANDLED (fde, 1); |
|
- | 2396 | ||
- | 2397 | output_eh_header (fde); |
|
- | 2398 | } |
|
- | 2399 | } |
|
Line 1929... | Line -... | ||
1929 | while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2); |
- | |
1930 | 2400 | while (seek_next_seg == 2); |
|
1931 | if (SUPPORT_FRAME_LINKONCE) |
2401 | |
- | 2402 | for (fde = all_fde_data; fde ; fde = fde->next) |
|
- | 2403 | SET_HANDLED (fde, 0); |
|
Line 1932... | Line 2404... | ||
1932 | for (fde = all_fde_data; fde ; fde = fde->next) |
2404 | } |
1933 | SET_HANDLED (fde, 0); |
2405 | #endif /* SUPPORT_COMPACT_EH */ |
Line 1934... | Line 2406... | ||
1934 | 2406 | ||
1935 | flag_traditional_format = save_flag_traditional_format; |
2407 | flag_traditional_format = save_flag_traditional_format; |
1936 | } |
2408 | } |
Line 1937... | Line 2409... | ||
1937 | 2409 | ||
1938 | if ((cfi_sections & CFI_EMIT_debug_frame) != 0) |
2410 | if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0) |
Line 1956... | Line 2428... | ||
1956 | } |
2428 | } |
1957 | cie_root = NULL; |
2429 | cie_root = NULL; |
Line 1958... | Line 2430... | ||
1958 | 2430 | ||
1959 | for (fde = all_fde_data; fde ; fde = fde->next) |
2431 | for (fde = all_fde_data; fde ; fde = fde->next) |
- | 2432 | { |
|
- | 2433 | if ((fde->sections & CFI_EMIT_debug_frame) == 0) |
|
- | 2434 | continue; |
|
1960 | { |
2435 | |
1961 | if (SUPPORT_FRAME_LINKONCE) |
2436 | if (SUPPORT_FRAME_LINKONCE) |
1962 | { |
2437 | { |
1963 | if (HANDLED (fde)) |
2438 | if (HANDLED (fde)) |
1964 | continue; |
2439 | continue; |
Line 2013... | Line 2488... | ||
2013 | const pseudo_typeS cfi_pseudo_table[] = |
2488 | const pseudo_typeS cfi_pseudo_table[] = |
2014 | { |
2489 | { |
2015 | { "cfi_sections", dot_cfi_dummy, 0 }, |
2490 | { "cfi_sections", dot_cfi_dummy, 0 }, |
2016 | { "cfi_startproc", dot_cfi_dummy, 0 }, |
2491 | { "cfi_startproc", dot_cfi_dummy, 0 }, |
2017 | { "cfi_endproc", dot_cfi_dummy, 0 }, |
2492 | { "cfi_endproc", dot_cfi_dummy, 0 }, |
- | 2493 | { "cfi_fde_data", dot_cfi_dummy, 0 }, |
|
2018 | { "cfi_def_cfa", dot_cfi_dummy, 0 }, |
2494 | { "cfi_def_cfa", dot_cfi_dummy, 0 }, |
2019 | { "cfi_def_cfa_register", dot_cfi_dummy, 0 }, |
2495 | { "cfi_def_cfa_register", dot_cfi_dummy, 0 }, |
2020 | { "cfi_def_cfa_offset", dot_cfi_dummy, 0 }, |
2496 | { "cfi_def_cfa_offset", dot_cfi_dummy, 0 }, |
2021 | { "cfi_adjust_cfa_offset", dot_cfi_dummy, 0 }, |
2497 | { "cfi_adjust_cfa_offset", dot_cfi_dummy, 0 }, |
2022 | { "cfi_offset", dot_cfi_dummy, 0 }, |
2498 | { "cfi_offset", dot_cfi_dummy, 0 }, |
Line 2030... | Line 2506... | ||
2030 | { "cfi_restore_state", dot_cfi_dummy, 0 }, |
2506 | { "cfi_restore_state", dot_cfi_dummy, 0 }, |
2031 | { "cfi_window_save", dot_cfi_dummy, 0 }, |
2507 | { "cfi_window_save", dot_cfi_dummy, 0 }, |
2032 | { "cfi_escape", dot_cfi_dummy, 0 }, |
2508 | { "cfi_escape", dot_cfi_dummy, 0 }, |
2033 | { "cfi_signal_frame", dot_cfi_dummy, 0 }, |
2509 | { "cfi_signal_frame", dot_cfi_dummy, 0 }, |
2034 | { "cfi_personality", dot_cfi_dummy, 0 }, |
2510 | { "cfi_personality", dot_cfi_dummy, 0 }, |
- | 2511 | { "cfi_personality_id", dot_cfi_dummy, 0 }, |
|
2035 | { "cfi_lsda", dot_cfi_dummy, 0 }, |
2512 | { "cfi_lsda", dot_cfi_dummy, 0 }, |
2036 | { "cfi_val_encoded_addr", dot_cfi_dummy, 0 }, |
2513 | { "cfi_val_encoded_addr", dot_cfi_dummy, 0 }, |
- | 2514 | { "cfi_label", dot_cfi_dummy, 0 }, |
|
- | 2515 | { "cfi_inline_lsda", dot_cfi_dummy, 0 }, |
|
2037 | { NULL, NULL, 0 } |
2516 | { NULL, NULL, 0 } |
2038 | }; |
2517 | }; |
Line 2039... | Line 2518... | ||
2039 | 2518 | ||
2040 | void |
2519 | void |