#endif
#if SUPPORT_FRAME_LINKONCE
+#define CUR_SEG(structp) structp->cur_seg
+#define SET_CUR_SEG(structp, seg) structp->cur_seg = seg
+#define HANDLED(structp) structp->handled
+#define SET_HANDLED(structp, val) structp->handled = val
+#else
+#define CUR_SEG(structp) NULL
+#define SET_CUR_SEG(structp, seg) (void) (0 && seg)
+#define HANDLED(structp) 0
+#define SET_HANDLED(structp, val) (void) (0 && val)
+#endif
+
/* Private segment collection list. */
struct dwcfi_seg_list
{
return item;
}
-#endif
/* ??? Share this with dwarf2cfg.c. */
#ifndef TC_DWARF2_EMIT_OFFSET
{
struct fde_entry *next;
#if SUPPORT_FRAME_LINKONCE
- segT cseg;
+ segT cur_seg;
#endif
symbolS *start_address;
symbolS *end_address;
frchain_now->frch_cfi_data->cur_fde_data = fde;
*last_fde_data = fde;
last_fde_data = &fde->next;
-#if SUPPORT_FRAME_LINKONCE
- fde->cseg = is_now_linkonce_segment ();
- fde->handled = 0;
-#endif
+ SET_CUR_SEG (fde, is_now_linkonce_segment ());
+ SET_HANDLED (fde, 0);
fde->last = &fde->data;
fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN;
fde->per_encoding = DW_EH_PE_omit;
*cur_fde_data->last = insn;
cur_fde_data->last = &insn->next;
-#if SUPPORT_FRAME_LINKONCE
- insn->cur_seg = is_now_linkonce_segment ();
-#endif
+ SET_CUR_SEG (insn, is_now_linkonce_segment ());
return insn;
}
{
for (i = cie->first; i != cie->last; i = i->next)
{
-#if SUPPORT_FRAME_LINKONCE
- if (i->cur_seg != cie->cur_seg)
+ if (CUR_SEG (i) != CUR_SEG (cie))
continue;
-#endif
output_cfi_insn (i);
}
}
}
for (; first; first = first->next)
-#if SUPPORT_FRAME_LINKONCE
- if (first->cur_seg == fde->cseg)
-#endif
+ if (CUR_SEG (first) == CUR_SEG (fde))
output_cfi_insn (first);
frag_align (align, DW_CFA_nop, 0);
for (cie = cie_root; cie; cie = cie->next)
{
-#if SUPPORT_FRAME_LINKONCE
- if (cie->cur_seg != fde->cseg)
+ if (CUR_SEG (cie) != CUR_SEG (fde))
continue;
-#endif
if (cie->return_column != fde->return_column
|| cie->signal_frame != fde->signal_frame
|| cie->per_encoding != fde->per_encoding
cie = (struct cie_entry *) xmalloc (sizeof (struct cie_entry));
cie->next = cie_root;
cie_root = cie;
-#if SUPPORT_FRAME_LINKONCE
- cie->cur_seg = fde->cseg;
-#endif
+ SET_CUR_SEG (cie, CUR_SEG (fde));
cie->return_column = fde->return_column;
cie->signal_frame = fde->signal_frame;
cie->per_encoding = fde->per_encoding;
#ifdef md_reg_eh_frame_to_debug_frame
static void
-cfi_change_reg_numbers (struct cfi_insn_data *insn, segT ccseg ATTRIBUTE_UNUSED)
+cfi_change_reg_numbers (struct cfi_insn_data *insn, segT ccseg)
{
for (; insn; insn = insn->next)
{
-#if SUPPORT_FRAME_LINKONCE
- if (insn->cur_seg != ccseg)
+ if (CUR_SEG (insn) != ccseg)
continue;
-#endif
switch (insn->insn)
{
case DW_CFA_advance_loc:
#endif
static segT
-get_cfi_seg (segT cseg ATTRIBUTE_UNUSED,
- const char *base, flagword flags, int align)
+get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
{
-#if SUPPORT_FRAME_LINKONCE
- struct dwcfi_seg_list *l;
+ if (SUPPORT_FRAME_LINKONCE)
+ {
+ struct dwcfi_seg_list *l;
- l = dwcfi_hash_find_or_make (cseg, base, flags);
+ l = dwcfi_hash_find_or_make (cseg, base, flags);
- cseg = l->seg;
- subseg_set (cseg, l->subseg);
-#else
- cseg = subseg_new (base, 0);
- bfd_set_section_flags (stdoutput, cseg, flags);
-#endif
+ cseg = l->seg;
+ subseg_set (cseg, l->subseg);
+ }
+ else
+ {
+ cseg = subseg_new (base, 0);
+ bfd_set_section_flags (stdoutput, cseg, flags);
+ }
record_alignment (cseg, align);
return cseg;
}
save_flag_traditional_format = flag_traditional_format;
flag_traditional_format = 1;
-#if !SUPPORT_FRAME_LINKONCE
- /* Open .eh_frame section. */
- cfi_seg = get_cfi_seg (NULL, ".eh_frame",
- SEC_ALLOC | SEC_LOAD | SEC_DATA
- | DWARF2_EH_FRAME_READ_ONLY,
- EH_FRAME_ALIGNMENT);
+ if (!SUPPORT_FRAME_LINKONCE)
+ {
+ /* Open .eh_frame section. */
+ cfi_seg = get_cfi_seg (NULL, ".eh_frame",
+ (SEC_ALLOC | SEC_LOAD | SEC_DATA
+ | DWARF2_EH_FRAME_READ_ONLY),
+ EH_FRAME_ALIGNMENT);
#ifdef md_fix_up_eh_frame
- md_fix_up_eh_frame (cfi_seg);
+ md_fix_up_eh_frame (cfi_seg);
#else
- (void) cfi_seg;
-#endif
+ (void) cfi_seg;
#endif
+ }
do
{
for (fde = all_fde_data; fde ; fde = fde->next)
{
-#if SUPPORT_FRAME_LINKONCE
- if (fde->handled != 0)
- continue;
- if (seek_next_seg && fde->cseg != ccseg)
- {
- seek_next_seg = 2;
- continue;
- }
- if (!seek_next_seg)
- {
- ccseg = fde->cseg;
- /* Open .eh_frame section. */
- cfi_seg = get_cfi_seg (ccseg, ".eh_frame",
- SEC_ALLOC | SEC_LOAD | SEC_DATA
- | DWARF2_EH_FRAME_READ_ONLY,
- EH_FRAME_ALIGNMENT);
+ if (SUPPORT_FRAME_LINKONCE)
+ {
+ if (HANDLED (fde))
+ continue;
+ if (seek_next_seg && CUR_SEG (fde) != ccseg)
+ {
+ seek_next_seg = 2;
+ continue;
+ }
+ if (!seek_next_seg)
+ {
+ ccseg = CUR_SEG (fde);
+ /* Open .eh_frame section. */
+ cfi_seg = get_cfi_seg (ccseg, ".eh_frame",
+ (SEC_ALLOC | SEC_LOAD | SEC_DATA
+ | DWARF2_EH_FRAME_READ_ONLY),
+ EH_FRAME_ALIGNMENT);
#ifdef md_fix_up_eh_frame
- md_fix_up_eh_frame (cfi_seg);
+ md_fix_up_eh_frame (cfi_seg);
#else
- (void) cfi_seg;
+ (void) cfi_seg;
#endif
- seek_next_seg = 1;
+ seek_next_seg = 1;
+ }
+ SET_HANDLED (fde, 1);
}
- fde->handled = 1;
-#endif
if (fde->end_address == NULL)
{
}
while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
-#if SUPPORT_FRAME_LINKONCE
- for (fde = all_fde_data; fde ; fde = fde->next)
- fde->handled = 0;
-#endif
+ if (SUPPORT_FRAME_LINKONCE)
+ for (fde = all_fde_data; fde ; fde = fde->next)
+ SET_HANDLED (fde, 0);
flag_traditional_format = save_flag_traditional_format;
}
{
int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1;
-#if !SUPPORT_FRAME_LINKONCE
- get_cfi_seg (NULL, ".debug_frame",
- SEC_READONLY | SEC_DEBUGGING,
- alignment);
-#endif
+ if (!SUPPORT_FRAME_LINKONCE)
+ get_cfi_seg (NULL, ".debug_frame",
+ SEC_READONLY | SEC_DEBUGGING,
+ alignment);
+
do
{
ccseg = NULL;
for (fde = all_fde_data; fde ; fde = fde->next)
{
-#if SUPPORT_FRAME_LINKONCE
- if (fde->handled != 0)
- continue;
- if (seek_next_seg && fde->cseg != ccseg)
- {
- seek_next_seg = 2;
- continue;
- }
- if (!seek_next_seg)
- {
- ccseg = fde->cseg;
- /* Open .debug_frame section. */
- get_cfi_seg (ccseg, ".debug_frame",
- SEC_READONLY | SEC_DEBUGGING,
- alignment);
- seek_next_seg = 1;
+ if (SUPPORT_FRAME_LINKONCE)
+ {
+ if (HANDLED (fde))
+ continue;
+ if (seek_next_seg && CUR_SEG (fde) != ccseg)
+ {
+ seek_next_seg = 2;
+ continue;
+ }
+ if (!seek_next_seg)
+ {
+ ccseg = CUR_SEG (fde);
+ /* Open .debug_frame section. */
+ get_cfi_seg (ccseg, ".debug_frame",
+ SEC_READONLY | SEC_DEBUGGING,
+ alignment);
+ seek_next_seg = 1;
+ }
+ SET_HANDLED (fde, 1);
}
- fde->handled = 1;
-#endif
if (fde->end_address == NULL)
{
as_bad (_("open CFI at the end of file; missing .cfi_endproc directive"));
}
while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
-#if SUPPORT_FRAME_LINKONCE
- for (fde = all_fde_data; fde ; fde = fde->next)
- fde->handled = 0;
-#endif
+ if (SUPPORT_FRAME_LINKONCE)
+ for (fde = all_fde_data; fde ; fde = fde->next)
+ SET_HANDLED (fde, 0);
}
}