On Thu, Oct 12, 2017 at 4:32 PM, Hans-Peter Nilsson <h...@bitrange.com> wrote:
> On Thu, 12 Oct 2017, Tsimbalist, Igor V wrote:
>>       * unwind.inc (_Unwind_RaiseException_Phase2): Use FRAMES_P_DECL,
>>       FRAMES_VAR_DECL_1, FRAMES_VAR_INC and FRAMES_P_UPDATE.
>>       (_Unwind_RaiseException): Use FRAMES_VAR_DECL, FRAMES_VAR_P and
>>       FRAMES_VAR.
>>       (_Unwind_ForcedUnwind_Phase2): Use FRAMES_P_DECL,
>>       FRAMES_VAR_DECL_1, FRAMES_VAR_INC, FRAMES_P_UPDATE.
>>       (_Unwind_ForcedUnwind): Use FRAMES_VAR_DECL, FRAMES_VAR_P and
>>       FRAMES_VAR.
>>       (_Unwind_Resume): Use FRAMES_VAR_DECL, FRAMES_VAR_P and
>>       FRAMES_VAR.
>>       (_Unwind_Resume_or_Rethrow): Use FRAMES_VAR_DECL, FRAMES_VAR_P
>>       and FRAMES_VAR.
>
> I think you'll have to test this on a non-CET target too,
> because it looks like this won't fly:
>
> -  uw_install_context (&this_context, &cur_context);
> +  uw_install_context (&this_context, &cur_context, FRAMES_VAR);
>
> You'll be introducing a naked comma for the default empty

It is done on purpose.   There are

/* Install TARGET into CURRENT so that we can return to it.  This is a
   macro because __builtin_eh_return must be invoked in the context of
   our caller.  */

#define uw_install_context(CURRENT, TARGET, FRAMES)                     \
  do                                                                    \
    {                                                                   \
      long offset = uw_install_context_1 ((CURRENT), (TARGET));         \
      void *handler = uw_frob_return_addr ((CURRENT), (TARGET));        \
      _Unwind_DebugHook ((TARGET)->cfa, handler);                       \
      _Unwind_Frames_Extra (FRAMES);                                    \
      __builtin_eh_return (offset, handler);                            \
    }                                                                   \
  while (0)

For non-CET targets, we have

#define FRAMES_VAR

[hjl@gnu-6 tmp]$ cat bar.c
#define FRAMES_VAR

#define foo(x, FRAMES) _Unwind_Frames_Extra (FRAMES)

foo (xxx, FRAMES_VAR);
[hjl@gnu-6 tmp]$ gcc -E bar.c
# 1 "bar.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "bar.c"




_Unwind_Frames_Extra ();
[hjl@gnu-6 tmp]$


> FRAMES_VAR.  I like the basic approach though, FWIW.
>
> brgds, H-P

Thanks.

-- 
H.J.

Reply via email to