[PATCH v7 2/3] Extract SEH shared helpers into separate file.

Jan Beulich jbeulich@suse.com
Mon Apr 20 11:51:26 GMT 2026


On 19.03.2026 12:16, Evgeny Karpov wrote:
> --- /dev/null
> +++ b/gas/config/obj-coff-seh-shared.c
> @@ -0,0 +1,214 @@
> +/* Shared helpers for SEH .pdata/.xdata COFF object file format for
> +   multiple architectures.
> +   Copyright (C) 2026 Free Software Foundation, Inc.

I think the year range from the original file needs copying here. You move
code rather than introducing in anew.

> +   This file is part of GAS.
> +
> +   GAS is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3, or (at your option)
> +   any later version.
> +
> +   GAS is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with GAS; see the file COPYING.  If not, write to the Free
> +   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
> +   02110-1301, USA.  */
> +
> +#include "obj-coff-seh.h"
> +typedef struct seh_context seh_context_t;

Nit: Blank line between these two please.

Yet then - I can't spot the original of the latter of the two lines.
You're only moving code, aren't you? Otherwise you would have mentioned
changes you make along the road?

I can certainly make the respective minor adjustments while committing
(incl the one at the bottom), but I have one other remark below.

> @@ -242,20 +85,6 @@ verify_target (const char *directive)
>    return true;
>  }
>  
> -/* Verify that we're in the context of a seh_proc.  */
> -
> -static int
> -verify_context (const char *directive)
> -{
> -  if (seh_ctx_cur == NULL)
> -    {
> -      as_bad (_("%s used outside of .seh_proc block"), directive);
> -      ignore_rest_of_line ();
> -      return 0;
> -    }
> -  return 1;
> -}

With this moved out of here, ...

> @@ -270,28 +99,6 @@ verify_context_and_target (const char *directive, seh_kind target)
>    return verify_context (directive);
>  }

... I wonder whether you really won't want/need to move this one (and
maybe verify_target()) as well.

> --- a/gas/config/obj-coff-seh.h
> +++ b/gas/config/obj-coff-seh.h
> @@ -59,6 +59,9 @@
>    .seh_code
>  */
>  
> +#ifndef OBJ_COFF_SEH_H
> +#define OBJ_COFF_SEH_H
> +
>  /* architecture specific pdata/xdata handling.  */
>  #define SEH_CMDS \
>          {"seh_proc", obj_coff_seh_proc, 0}, \
> @@ -202,3 +205,5 @@ static void obj_coff_seh_code (int);
>     PEX64_SCOPE_ENTRY_SIZE * (IDX))
>  
>  #endif
> +
> +#endif /* OBJ_COFF_SEH_H.  */

Stray full stop and blank. Header guard related comments like this one aren't
ordinary (textual) comments, and hence they don't follow the normal comment
style.

Jan


More information about the Binutils mailing list