[PATCH 3/3] include/aout/aout64.h: guard ARCH_SIZE with defined()

Jan Beulich jbeulich@suse.com
Mon Sep 15 03:03:15 GMT 2025


On 14.09.2025 21:52, Andrew Hanson wrote:
> Silence -Wundef when ARCH_SIZE is not defined by checking that it is
> defined before comparing its value.
> 
> Signed-off-by: Andrew Hanson <andrew@andrewhanson.dev>

Oh, interesting - there is an S-o-b here. Why not on the earlier two
patches?

> --- a/include/aout/aout64.h
> +++ b/include/aout/aout64.h
> @@ -43,7 +43,7 @@ struct external_exec
>  
>  /* Magic numbers for a.out files.  */
>  
> -#if ARCH_SIZE==64
> +#if defined(ARCH_SIZE) && ARCH_SIZE == 64
>  #define OMAGIC 0x1001		/* Code indicating object file.  */
>  #define ZMAGIC 0x1002		/* Code indicating demand-paged executable.  */
>  #define NMAGIC 0x1003		/* Code indicating pure executable.  */

I'm not quite sure here. Yes, what you do fits what happens if the
compiler silently uses 0 as value when it's undefined. I wonder
though whether the #else not kicking in when ARCH_SIZE isn't defined
wouldn't be better. Largely depends on how the file is used right
now, i.e. how much fallout there would be.

Jan


More information about the Binutils mailing list