[PATCH v2 3/4] powerpc: Relocate stinfo->main

Tulio Magno Quites Machado Filho tuliom@linux.ibm.com
Fri Apr 8 22:32:45 GMT 2022


Alan Modra via Libc-alpha <libc-alpha@sourceware.org> writes:

> diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.c b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
> index bb97d16145..8f0d3a0eac 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/libc-start.c
> +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.c
> @@ -23,6 +23,10 @@
>  #ifndef SHARED
>  #include <hwcapinfo.h>
>  #endif
> +#if ENABLE_STATIC_PIE && !defined SHARED
> +/* For elf_machine_load_address.  */
> +#include <dl-machine.h>
> +#endif
>  
>  /* The main work is done in the generic function.  */
>  #define LIBC_START_MAIN generic_start_main
> @@ -95,8 +99,15 @@ __libc_start_main_impl (int argc, char **argv,
>    __tcb_parse_hwcap_and_convert_at_platform ();
>  #endif
>  
> -  return generic_start_main (stinfo->main, argc, argv, auxvec,
> -			     stinfo->init, stinfo->fini, rtld_fini,
> +  void *main = stinfo->main;

Some GCC versions (e.g. GCC 8) complain about the name of this variable:

../sysdeps/unix/sysv/linux/powerpc/libc-start.c: In function ‘__libc_start_main_impl’:
../sysdeps/unix/sysv/linux/powerpc/libc-start.c:102:9: error: ‘main’ is usually a function [-Werror=main]

Looks good to me if this variable is either renamed or if this part of the code
is built with -Wno-main.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno


More information about the Libc-alpha mailing list