public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kai Tietz <ktietz@redhat.com>
To: Dave Korn <dave.korn.cygwin@gmail.com>
Cc: Nick Clifton <nickc@redhat.com>,
	Kai Tietz <ktietz70@googlemail.com>,
	       "H.J. Lu" <hjl.tools@gmail.com>,
	Binutils <binutils@sourceware.org>,
	       Alan Modra <amodra@gmail.com>,
	       Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: gas -Werror compilation break  [Re: [patch ld bfd gas]: Handle linkonce for cfi generated debug_frame and eh_frame data]
Date: Thu, 05 May 2011 08:50:00 -0000	[thread overview]
Message-ID: <1550467187.247208.1304585393998.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <4DC1EF60.5050308@gmail.com>

----- Original Message -----
From: "Dave Korn" <dave.korn.cygwin@gmail.com>
To: "Jan Kratochvil" <jan.kratochvil@redhat.com>
Cc: "Kai Tietz" <ktietz@redhat.com>, "Nick Clifton" <nickc@redhat.com>, "Kai Tietz" <ktietz70@googlemail.com>, "H.J. Lu" <hjl.tools@gmail.com>, "Binutils" <binutils@sourceware.org>, "Alan Modra" <amodra@gmail.com>
Sent: Thursday, May 5, 2011 2:29:20 AM
Subject: Re: gas -Werror compilation break  [Re: [patch ld bfd gas]: Handle linkonce for cfi generated debug_frame and eh_frame data]

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

Hmm, I see the issue that cfi_seg might be just set, but not used. This can be fixed by simply adding - after setting of cfi_seg - an check for if (!cfi_seg) abort ();.  This check is superflous as cfi_seg never can be NULL, but it silence this warning.
The missing md_fix_up_eh_frame is used, as it was done in original code. Here just on case (IIRC it is the debug_frame one) uses it.  It might be necessary to add it here for the "eh_frame" case too. But I don't see actual a reason to add all this #ifdef guarding you do.

Regards,
Kai

      parent reply	other threads:[~2011-05-05  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18  9:34 [patch ld bfd gas]: Handle linkonce for cfi generated debug_frame and eh_frame data Kai Tietz
2011-04-18 12:43 ` H.J. Lu
2011-04-18 20:04   ` Kai Tietz
2011-04-24 10:20     ` Kai Tietz
2011-04-26 15:29       ` Nick Clifton
2011-04-27 20:35         ` gas -Werror compilation break [Re: [patch ld bfd gas]: Handle linkonce for cfi generated debug_frame and eh_frame data] Jan Kratochvil
2011-05-05  0:29           ` Dave Korn
2011-05-05  8:45             ` Alan Modra
2011-05-05 13:21               ` Alan Modra
2011-05-06 17:58                 ` Dave Korn
2011-05-07  2:53                   ` Alan Modra
2011-05-05  8:50             ` Kai Tietz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550467187.247208.1304585393998.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com \
    --to=ktietz@redhat.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=dave.korn.cygwin@gmail.com \
    --cc=hjl.tools@gmail.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=ktietz70@googlemail.com \
    --cc=nickc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).