[PATCH] gas: S_GET_{NAME,SEGMENT}() don't alter their input symbol

Indu Bhagat indu.bhagat@oracle.com
Tue Nov 7 01:09:30 GMT 2023


On 11/6/23 06:05, Jan Beulich wrote:
> Make their parameters pointer-to-const, thus allowing callers to also be
> const-correct where possible.
> 
> --- a/gas/symbols.c
> +++ b/gas/symbols.c
> @@ -2484,13 +2484,13 @@ S_IS_FORWARD_REF (const symbolS *s)
>   }
>   
>   const char *
> -S_GET_NAME (symbolS *s)
> +S_GET_NAME (const symbolS *s)
>   {
>     return s->name;
>   }
>   
>   segT
> -S_GET_SEGMENT (symbolS *s)
> +S_GET_SEGMENT (const symbolS *s)
>   {
>     if (s->flags.local_symbol)
>       return ((struct local_symbol *) s)->section;
> --- a/gas/symbols.h
> +++ b/gas/symbols.h
> @@ -109,8 +109,8 @@ extern int S_IS_STABD (symbolS *);
>   extern int S_CAN_BE_REDEFINED (const symbolS *);
>   extern int S_IS_VOLATILE (const symbolS *);
>   extern int S_IS_FORWARD_REF (const symbolS *);
> -extern const char *S_GET_NAME (symbolS *);
> -extern segT S_GET_SEGMENT (symbolS *);
> +extern const char *S_GET_NAME (const symbolS *);
> +extern segT S_GET_SEGMENT (const symbolS *);
>   extern void S_SET_SEGMENT (symbolS *, segT);
>   extern void S_SET_EXTERNAL (symbolS *);
>   extern void S_SET_NAME (symbolS *, const char *);

Thanks.

This will be enough for SCFI purposes for now.


More information about the Binutils mailing list