public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libc-alpha@sourceware.org,
	Jason Merrill <jason@redhat.com>
Subject: Re: [PATCH 4/4] libgcc: Use _dl_find_eh_frame in _Unwind_Find_FDE
Date: Thu, 18 Nov 2021 16:45:06 +0100	[thread overview]
Message-ID: <20211118154506.GG2646553@tucnak> (raw)
In-Reply-To: <adeb300eebaa792d64fca85f1e72fed03c1b32d1.1635955148.git.fweimer@redhat.com>

On Wed, Nov 03, 2021 at 05:28:55PM +0100, Florian Weimer wrote:
> --- a/libgcc/unwind-dw2-fde-dip.c
> +++ b/libgcc/unwind-dw2-fde-dip.c
> @@ -129,6 +129,30 @@ unw_eh_callback_data_dbase (const struct unw_eh_callback_data *data
>  #endif
>  }
>  
> +#ifdef DL_FIND_EH_FRAME_DBASE
> +#if DL_FIND_EH_FRAME_DBASE != NEED_DBASE_MEMBER
> +#error "DL_FIND_EH_FRAME_DBASE != NEED_DBASE_MEMBER"

Instead of #error just don't define USE_DL_FIND_EH_FRAME?
I.e.
#ifdef DL_FIND_EH_FRAME_DBASE
#if DL_FIND_EH_FRAME_DBASE == NEED_DBASE_MEMBER
> +#define USE_DL_FIND_EH_FRAME 1
> +#define DL_FIND_EH_FRAME_CONDITION 1
> +#endif
?
Is it a good idea to have different arguments of the function for
i386/nios2/frv/bfind vs. the rest, wouldn't just always passing void **__dbase
argument be cleaner?
Internally it is fine to differentiate based on NEED_DBASE_MEMBER, but doing
that on a public interface?

> +/* Fallback declaration for old glibc headers.  DL_FIND_EH_FRAME_DBASE is used
> +   as a proxy to determine if <dlfcn.h> declares _dl_find_eh_frame.  */
> +#if defined __GLIBC__ && !defined DL_FIND_EH_FRAME_DBASE
> +#if NEED_DBASE_MEMBER
> +void *_dl_find_eh_frame (void *__pc, void **__dbase) __attribute__ ((weak));
> +#else
> +void *_dl_find_eh_frame (void *__pc) __attribute__ ((weak));
> +#endif
> +#define USE_DL_FIND_EH_FRAME 1
> +#define DL_FIND_EH_FRAME_CONDITION (_dl_find_eh_frame != NULL)
> +#endif

I'd prefer not to do this.  If we find glibc with the support in the
headers, let's use it, otherwise let's keep using what we were doing before.

> +#if NEED_DBASE_MEMBER
> +      eh_frame = _dl_find_eh_frame (pc, &dbase);
> +#else
> +      dbase = NULL;
> +      eh_frame = _dl_find_eh_frame (pc);
> +#endif
> +      if (eh_frame == NULL)
> +	return NULL;
> +
> +      struct find_fde_tail_result result
> +	= find_fde_tail ((_Unwind_Ptr) pc, eh_frame, (_Unwind_Ptr) dbase);
> +      if (result.entry != NULL)
> +	{
> +	  bases->tbase = NULL;
> +	  bases->dbase = (void *) dbase;
> +	  bases->func = result.func;
> +	}
> +      return result.entry;
> +    }
> +#endif
> +
>    data.pc = (_Unwind_Ptr) pc;
>  #if NEED_DBASE_MEMBER
>    data.dbase = NULL;
> -- 
> 2.31.1

Otherwise LGTM.

	Jakub


  reply	other threads:[~2021-11-18 15:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 16:28 [PATCH 0/4] Use _dl_find_eh_frame to locate DWARF EH data in the unwinder Florian Weimer
2021-11-03 16:28 ` [PATCH 1/4] libgcc: Remove tbase member from struct unw_eh_callback_data Florian Weimer
2021-11-18 13:47   ` Jakub Jelinek
2021-11-03 16:28 ` [PATCH 2/4] libgcc: Remove dbase member from struct unw_eh_callback_data if NULL Florian Weimer
2021-11-18 14:33   ` Jakub Jelinek
2021-11-03 16:28 ` [PATCH 3/4] libgcc: Split FDE search code from PT_GNU_EH_FRAME lookup Florian Weimer
2021-11-18 15:21   ` Jakub Jelinek
2021-11-23 17:56     ` Florian Weimer
2021-11-25 17:16       ` Jakub Jelinek
2021-11-03 16:28 ` [PATCH 4/4] libgcc: Use _dl_find_eh_frame in _Unwind_Find_FDE Florian Weimer
2021-11-18 15:45   ` Jakub Jelinek [this message]
2021-11-25 20:42     ` Florian Weimer
2021-11-26 15:49       ` Jakub Jelinek

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=20211118154506.GG2646553@tucnak \
    --to=jakub@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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).