* dw2gencfi.c (CUR_SEG, SET_CUR_SEG, HANDLED, SET_HANDLED): Define.

Use throughout in place of #if SUPPORT_FRAME_LINKONCE.
	(struct fde_entry): Rename cseg to cur_seg.
	(cfi_change_reg_numbers): Remove ATTRIBUTE_UNUSED.
	(get_cfi_seg): Likewise.  Use if (SUPPORT_FRAME_LINKONCE) rather
	that #if SUPPORT_FRAME_LINKONCE.
	(cfi_finish): Likewise.
This commit is contained in:
Alan Modra
2011-05-07 05:37:54 +00:00
parent 290421cd5b
commit 6303c4aebd
2 changed files with 106 additions and 98 deletions

View File

@ -1,3 +1,13 @@
2011-05-07 Alan Modra <amodra@gmail.com>
* dw2gencfi.c (CUR_SEG, SET_CUR_SEG, HANDLED, SET_HANDLED): Define.
Use throughout in place of #if SUPPORT_FRAME_LINKONCE.
(struct fde_entry): Rename cseg to cur_seg.
(cfi_change_reg_numbers): Remove ATTRIBUTE_UNUSED.
(get_cfi_seg): Likewise. Use if (SUPPORT_FRAME_LINKONCE) rather
that #if SUPPORT_FRAME_LINKONCE.
(cfi_finish): Likewise.
2011-05-06 Tristan Gingold <gingold@adacore.com> 2011-05-06 Tristan Gingold <gingold@adacore.com>
* read.c (s_comm_internal): Remove code for OBJ_VMS. * read.c (s_comm_internal): Remove code for OBJ_VMS.
@ -20,7 +30,6 @@
2011-05-03 Paul Brook <paul@codesourcery.com> 2011-05-03 Paul Brook <paul@codesourcery.com>
* config/tc-tic6x.c (s_ehtype): New function. * config/tc-tic6x.c (s_ehtype): New function.
(md_pseudo_table): Add "ehtype". (md_pseudo_table): Add "ehtype".
(tic6x_fix_adjustable, md_apply_fix): BFD_RELOC_C6000_EHTYPE. (tic6x_fix_adjustable, md_apply_fix): BFD_RELOC_C6000_EHTYPE.

View File

@ -83,6 +83,17 @@
#endif #endif
#if SUPPORT_FRAME_LINKONCE #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. */ /* Private segment collection list. */
struct dwcfi_seg_list struct dwcfi_seg_list
{ {
@ -232,7 +243,6 @@ dwcfi_hash_find_or_make (segT cseg, const char *base_name, int flags)
return item; return item;
} }
#endif
/* ??? Share this with dwarf2cfg.c. */ /* ??? Share this with dwarf2cfg.c. */
#ifndef TC_DWARF2_EMIT_OFFSET #ifndef TC_DWARF2_EMIT_OFFSET
@ -302,7 +312,7 @@ struct fde_entry
{ {
struct fde_entry *next; struct fde_entry *next;
#if SUPPORT_FRAME_LINKONCE #if SUPPORT_FRAME_LINKONCE
segT cseg; segT cur_seg;
#endif #endif
symbolS *start_address; symbolS *start_address;
symbolS *end_address; symbolS *end_address;
@ -371,10 +381,8 @@ alloc_fde_entry (void)
frchain_now->frch_cfi_data->cur_fde_data = fde; frchain_now->frch_cfi_data->cur_fde_data = fde;
*last_fde_data = fde; *last_fde_data = fde;
last_fde_data = &fde->next; last_fde_data = &fde->next;
#if SUPPORT_FRAME_LINKONCE SET_CUR_SEG (fde, is_now_linkonce_segment ());
fde->cseg = is_now_linkonce_segment (); SET_HANDLED (fde, 0);
fde->handled = 0;
#endif
fde->last = &fde->data; fde->last = &fde->data;
fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN; fde->return_column = DWARF2_DEFAULT_RETURN_COLUMN;
fde->per_encoding = DW_EH_PE_omit; fde->per_encoding = DW_EH_PE_omit;
@ -398,9 +406,7 @@ alloc_cfi_insn_data (void)
*cur_fde_data->last = insn; *cur_fde_data->last = insn;
cur_fde_data->last = &insn->next; cur_fde_data->last = &insn->next;
#if SUPPORT_FRAME_LINKONCE SET_CUR_SEG (insn, is_now_linkonce_segment ());
insn->cur_seg = is_now_linkonce_segment ();
#endif
return insn; return insn;
} }
@ -1569,10 +1575,8 @@ output_cie (struct cie_entry *cie, bfd_boolean eh_frame, int align)
{ {
for (i = cie->first; i != cie->last; i = i->next) for (i = cie->first; i != cie->last; i = i->next)
{ {
#if SUPPORT_FRAME_LINKONCE if (CUR_SEG (i) != CUR_SEG (cie))
if (i->cur_seg != cie->cur_seg)
continue; continue;
#endif
output_cfi_insn (i); output_cfi_insn (i);
} }
} }
@ -1682,9 +1686,7 @@ output_fde (struct fde_entry *fde, struct cie_entry *cie,
} }
for (; first; first = first->next) for (; first; first = first->next)
#if SUPPORT_FRAME_LINKONCE if (CUR_SEG (first) == CUR_SEG (fde))
if (first->cur_seg == fde->cseg)
#endif
output_cfi_insn (first); output_cfi_insn (first);
frag_align (align, DW_CFA_nop, 0); frag_align (align, DW_CFA_nop, 0);
@ -1700,10 +1702,8 @@ select_cie_for_fde (struct fde_entry *fde, bfd_boolean eh_frame,
for (cie = cie_root; cie; cie = cie->next) for (cie = cie_root; cie; cie = cie->next)
{ {
#if SUPPORT_FRAME_LINKONCE if (CUR_SEG (cie) != CUR_SEG (fde))
if (cie->cur_seg != fde->cseg)
continue; continue;
#endif
if (cie->return_column != fde->return_column if (cie->return_column != fde->return_column
|| cie->signal_frame != fde->signal_frame || cie->signal_frame != fde->signal_frame
|| cie->per_encoding != fde->per_encoding || cie->per_encoding != fde->per_encoding
@ -1802,9 +1802,7 @@ select_cie_for_fde (struct fde_entry *fde, bfd_boolean eh_frame,
cie = (struct cie_entry *) xmalloc (sizeof (struct cie_entry)); cie = (struct cie_entry *) xmalloc (sizeof (struct cie_entry));
cie->next = cie_root; cie->next = cie_root;
cie_root = cie; cie_root = cie;
#if SUPPORT_FRAME_LINKONCE SET_CUR_SEG (cie, CUR_SEG (fde));
cie->cur_seg = fde->cseg;
#endif
cie->return_column = fde->return_column; cie->return_column = fde->return_column;
cie->signal_frame = fde->signal_frame; cie->signal_frame = fde->signal_frame;
cie->per_encoding = fde->per_encoding; cie->per_encoding = fde->per_encoding;
@ -1829,14 +1827,12 @@ select_cie_for_fde (struct fde_entry *fde, bfd_boolean eh_frame,
#ifdef md_reg_eh_frame_to_debug_frame #ifdef md_reg_eh_frame_to_debug_frame
static void 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) for (; insn; insn = insn->next)
{ {
#if SUPPORT_FRAME_LINKONCE if (CUR_SEG (insn) != ccseg)
if (insn->cur_seg != ccseg)
continue; continue;
#endif
switch (insn->insn) switch (insn->insn)
{ {
case DW_CFA_advance_loc: case DW_CFA_advance_loc:
@ -1878,20 +1874,22 @@ cfi_change_reg_numbers (struct cfi_insn_data *insn, segT ccseg ATTRIBUTE_UNUSED)
#endif #endif
static segT static segT
get_cfi_seg (segT cseg ATTRIBUTE_UNUSED, get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
const char *base, flagword flags, int align)
{ {
#if SUPPORT_FRAME_LINKONCE if (SUPPORT_FRAME_LINKONCE)
{
struct dwcfi_seg_list *l; 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; cseg = l->seg;
subseg_set (cseg, l->subseg); subseg_set (cseg, l->subseg);
#else }
else
{
cseg = subseg_new (base, 0); cseg = subseg_new (base, 0);
bfd_set_section_flags (stdoutput, cseg, flags); bfd_set_section_flags (stdoutput, cseg, flags);
#endif }
record_alignment (cseg, align); record_alignment (cseg, align);
return cseg; return cseg;
} }
@ -1914,18 +1912,19 @@ cfi_finish (void)
save_flag_traditional_format = flag_traditional_format; save_flag_traditional_format = flag_traditional_format;
flag_traditional_format = 1; flag_traditional_format = 1;
#if !SUPPORT_FRAME_LINKONCE if (!SUPPORT_FRAME_LINKONCE)
{
/* Open .eh_frame section. */ /* Open .eh_frame section. */
cfi_seg = get_cfi_seg (NULL, ".eh_frame", cfi_seg = get_cfi_seg (NULL, ".eh_frame",
SEC_ALLOC | SEC_LOAD | SEC_DATA (SEC_ALLOC | SEC_LOAD | SEC_DATA
| DWARF2_EH_FRAME_READ_ONLY, | DWARF2_EH_FRAME_READ_ONLY),
EH_FRAME_ALIGNMENT); EH_FRAME_ALIGNMENT);
#ifdef md_fix_up_eh_frame #ifdef md_fix_up_eh_frame
md_fix_up_eh_frame (cfi_seg); md_fix_up_eh_frame (cfi_seg);
#else #else
(void) cfi_seg; (void) cfi_seg;
#endif #endif
#endif }
do do
{ {
@ -1941,21 +1940,22 @@ cfi_finish (void)
for (fde = all_fde_data; fde ; fde = fde->next) for (fde = all_fde_data; fde ; fde = fde->next)
{ {
#if SUPPORT_FRAME_LINKONCE if (SUPPORT_FRAME_LINKONCE)
if (fde->handled != 0) {
if (HANDLED (fde))
continue; continue;
if (seek_next_seg && fde->cseg != ccseg) if (seek_next_seg && CUR_SEG (fde) != ccseg)
{ {
seek_next_seg = 2; seek_next_seg = 2;
continue; continue;
} }
if (!seek_next_seg) if (!seek_next_seg)
{ {
ccseg = fde->cseg; ccseg = CUR_SEG (fde);
/* Open .eh_frame section. */ /* Open .eh_frame section. */
cfi_seg = get_cfi_seg (ccseg, ".eh_frame", cfi_seg = get_cfi_seg (ccseg, ".eh_frame",
SEC_ALLOC | SEC_LOAD | SEC_DATA (SEC_ALLOC | SEC_LOAD | SEC_DATA
| DWARF2_EH_FRAME_READ_ONLY, | DWARF2_EH_FRAME_READ_ONLY),
EH_FRAME_ALIGNMENT); EH_FRAME_ALIGNMENT);
#ifdef md_fix_up_eh_frame #ifdef md_fix_up_eh_frame
md_fix_up_eh_frame (cfi_seg); md_fix_up_eh_frame (cfi_seg);
@ -1964,8 +1964,8 @@ cfi_finish (void)
#endif #endif
seek_next_seg = 1; seek_next_seg = 1;
} }
fde->handled = 1; SET_HANDLED (fde, 1);
#endif }
if (fde->end_address == NULL) if (fde->end_address == NULL)
{ {
@ -1980,10 +1980,9 @@ cfi_finish (void)
} }
while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2); while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
#if SUPPORT_FRAME_LINKONCE if (SUPPORT_FRAME_LINKONCE)
for (fde = all_fde_data; fde ; fde = fde->next) for (fde = all_fde_data; fde ; fde = fde->next)
fde->handled = 0; SET_HANDLED (fde, 0);
#endif
flag_traditional_format = save_flag_traditional_format; flag_traditional_format = save_flag_traditional_format;
} }
@ -1992,11 +1991,11 @@ cfi_finish (void)
{ {
int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1; int alignment = ffs (DWARF2_ADDR_SIZE (stdoutput)) - 1;
#if !SUPPORT_FRAME_LINKONCE if (!SUPPORT_FRAME_LINKONCE)
get_cfi_seg (NULL, ".debug_frame", get_cfi_seg (NULL, ".debug_frame",
SEC_READONLY | SEC_DEBUGGING, SEC_READONLY | SEC_DEBUGGING,
alignment); alignment);
#endif
do do
{ {
ccseg = NULL; ccseg = NULL;
@ -2011,25 +2010,26 @@ cfi_finish (void)
for (fde = all_fde_data; fde ; fde = fde->next) for (fde = all_fde_data; fde ; fde = fde->next)
{ {
#if SUPPORT_FRAME_LINKONCE if (SUPPORT_FRAME_LINKONCE)
if (fde->handled != 0) {
if (HANDLED (fde))
continue; continue;
if (seek_next_seg && fde->cseg != ccseg) if (seek_next_seg && CUR_SEG (fde) != ccseg)
{ {
seek_next_seg = 2; seek_next_seg = 2;
continue; continue;
} }
if (!seek_next_seg) if (!seek_next_seg)
{ {
ccseg = fde->cseg; ccseg = CUR_SEG (fde);
/* Open .debug_frame section. */ /* Open .debug_frame section. */
get_cfi_seg (ccseg, ".debug_frame", get_cfi_seg (ccseg, ".debug_frame",
SEC_READONLY | SEC_DEBUGGING, SEC_READONLY | SEC_DEBUGGING,
alignment); alignment);
seek_next_seg = 1; seek_next_seg = 1;
} }
fde->handled = 1; SET_HANDLED (fde, 1);
#endif }
if (fde->end_address == NULL) if (fde->end_address == NULL)
{ {
as_bad (_("open CFI at the end of file; missing .cfi_endproc directive")); as_bad (_("open CFI at the end of file; missing .cfi_endproc directive"));
@ -2045,10 +2045,9 @@ cfi_finish (void)
} }
while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2); while (SUPPORT_FRAME_LINKONCE && seek_next_seg == 2);
#if SUPPORT_FRAME_LINKONCE if (SUPPORT_FRAME_LINKONCE)
for (fde = all_fde_data; fde ; fde = fde->next) for (fde = all_fde_data; fde ; fde = fde->next)
fde->handled = 0; SET_HANDLED (fde, 0);
#endif
} }
} }