This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gas -Werror compilation break [Re: [patch ld bfd gas]: Handle linkonce for cfi generated debug_frame and eh_frame data]
- From: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Kai Tietz <ktietz at redhat dot com>, Nick Clifton <nickc at redhat dot com>, Kai Tietz <ktietz70 at googlemail dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Binutils <binutils at sourceware dot org>, Alan Modra <amodra at gmail dot com>
- Date: Thu, 05 May 2011 01:29:20 +0100
- Subject: Re: gas -Werror compilation break [Re: [patch ld bfd gas]: Handle linkonce for cfi generated debug_frame and eh_frame data]
- References: <BANLkTi=_hynUgqW5UjHDSvtWox2UshG=FQ@mail.gmail.com> <BANLkTinQxcD6pcyna-_AusTeXaTy8J6Knw@mail.gmail.com> <BANLkTi=SOrur_bPOMM5GKPtozYT0pw8vEw@mail.gmail.com> <BANLkTim3DpFxpY+yjuGExYWPZXRE3xwvag@mail.gmail.com> <4DB6E500.5030807@redhat.com> <20110427203457.GA12977@host1.jankratochvil.net>
On 27/04/2011 21:34, Jan Kratochvil wrote:
> Hi Kai,
>
> On Tue, 26 Apr 2011 17:30:08 +0200, Nick Clifton wrote:
>>>>> ChangeLog gas/
>>>>> 2011-04-18 Kai Tietz
>>>>>
>>>>> * dw2gencfi.c (dwcfi_seg_list): New struct.
>>>>> (dwcfi_hash): New static hash variable.
>>>>> (get_debugseg_name): New.
>>>>> (alloc_debugseg_item): New.
>>>>> (make_debug_seg): New.
>>>>> (dwcfi_hash_insert): New.
>>>>> (dwcfi_hash_find): New.
>>>>> (dwcfi_hash_find_or_make): New.
>>>>> (cfi_insn_data): New member cur_seg.
>>>>> (cie_entry): Likewise.
>>>>> (fde_entry): New cseg and handled members.
>>>>> (alloc_fde_entry): Initialize cseg member.
>>>>> (alloc_cfi_insn_data): Initialize cur_seg member.
>>>>> (dot_cfi_sections): Compare for beginning of
>>>>> section names via strncmp.
>>>>> (get_cfi_seg): New.
>>>>> (cfi_finish): Treat link-once sections.
>>>>> (is_now_linkonce_segment): New local helper.
>>>>> (output_cie): Ignore cie entries not member of current
>>>>> segment.
>>>>> (output_fde): Likewise.
>>>>> (select_cie_for_fde): Likewise.
>>>>> (cfi_change_reg_numbers): Add new argument for current segment
>>>>> and ignore insn elements, if not part of current segment.
>>>>> * ehopt.c (get_cie_info): Use strncmp for
>>>>> section name matching.
>>>>> (heck_eh_frame): Likewise.
>
> dw2gencfi.c:1870:8: error: variable ‘cfi_seg’ set but not used [-Werror=unused-but-set-variable]
> gcc-4.6.0-5.fc15.x86_64
>
> Could you please provide a fix?
This fixes the breakage, but doesn't address the issue that it looks to me
like there's an omitted call to md_fix_up_eh_frame() after the second
invocation of get_cfi_seg().
gas/ChangeLog:
* dw2gencfi.c (dwcfi_hash): Wrap in #ifdef md_fix_up_eh_frame.
(get_debugseg_name): Likewise.
(alloc_debugseg_item): Likewise.
(make_debug_seg): Likewise.
(dwcfi_hash_insert): Likewise.
(dwcfi_hash_find): Likewise.
(dwcfi_hash_find_or_make): Likewise.
(get_cfi_seg): Likewise.
(cfi_finish): Wrap references to cfi_seg and calls to get_cfi_seg()
in #ifdef md_fix_up_eh_frame likewise.
Verified that it fixes the build on i686-pc-cygwin and
x86_64-unknown-linux-gnu, OK to install?
cheers,
DaveK
Index: gas/dw2gencfi.c
===================================================================
RCS file: /cvs/src/src/gas/dw2gencfi.c,v
retrieving revision 1.52
diff -p -u -r1.52 dw2gencfi.c
--- gas/dw2gencfi.c 26 Apr 2011 15:28:07 -0000 1.52
+++ gas/dw2gencfi.c 5 May 2011 00:18:58 -0000
@@ -86,6 +86,7 @@ struct dwcfi_seg_list
#define FRAME_NAME ".eh_frame"
+#ifdef md_fix_up_eh_frame
static struct hash_control *dwcfi_hash;
/* Build based on segment the derived .debug_...
@@ -137,6 +138,7 @@ alloc_debugseg_item (segT seg, int subse
r->seg_name = name;
return r;
}
+#endif
static segT
is_now_linkonce_segment (void)
@@ -151,6 +153,7 @@ is_now_linkonce_segment (void)
return NULL;
}
+#ifdef md_fix_up_eh_frame
/* Generate debug... segment with same linkonce properties
of based segment. */
@@ -227,6 +230,7 @@ dwcfi_hash_find_or_make (segT cseg, cons
return item;
}
+#endif
/* ??? Share this with dwarf2cfg.c. */
#ifndef TC_DWARF2_EMIT_OFFSET
@@ -1851,6 +1855,7 @@ cfi_change_reg_numbers (struct cfi_insn_
#define cfi_change_reg_numbers(insn, cseg) do { } while (0)
#endif
+#ifdef md_fix_up_eh_frame
static segT
get_cfi_seg (segT cseg, const char *base, flagword flags, int align)
{
@@ -1862,12 +1867,16 @@ get_cfi_seg (segT cseg, const char *base
record_alignment (l->seg, align);
return l->seg;
}
+#endif
void
cfi_finish (void)
{
struct cie_entry *cie, *cie_next;
- segT cfi_seg, ccseg;
+#ifdef md_fix_up_eh_frame
+ segT cfi_seg;
+#endif
+ segT ccseg;
struct fde_entry *fde;
struct cfi_insn_data *first;
int save_flag_traditional_format, seek_next_seg;
@@ -1884,7 +1893,9 @@ cfi_finish (void)
do
{
ccseg = NULL;
+#ifdef md_fix_up_eh_frame
cfi_seg = NULL;
+#endif
seek_next_seg = 0;
for (cie = cie_root; cie; cie = cie_next)
{
@@ -1905,12 +1916,12 @@ cfi_finish (void)
if (!seek_next_seg)
{
ccseg = fde->cseg;
+#ifdef md_fix_up_eh_frame
/* 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);
#endif
seek_next_seg = 1;
@@ -1943,7 +1954,9 @@ cfi_finish (void)
do
{
ccseg = NULL;
+#ifdef md_fix_up_eh_frame
cfi_seg = NULL;
+#endif
seek_next_seg = 0;
for (cie = cie_root; cie; cie = cie_next)
{
@@ -1964,10 +1977,12 @@ cfi_finish (void)
if (!seek_next_seg)
{
ccseg = fde->cseg;
+#ifdef md_fix_up_eh_frame
/* Open .debug_frame section. */
cfi_seg = get_cfi_seg (ccseg, ".debug_frame",
SEC_READONLY | SEC_DEBUGGING,
alignment);
+#endif
seek_next_seg = 1;
}
fde->handled = 1;