Evgeny Karpov <evgeny.kar...@microsoft.com> writes:
> LOCAL_LABEL_PREFIX has been changed to help the assembly
> compiler recognize local labels. Emitting locals has been
> replaced with the .lcomm directive to declare uninitialized
> data without defining an exact section. Functions and objects
> were missing declarations. Binutils was not able to distinguish
> static from external, or an object from a function.
> mingw_pe_declare_object_type has been added to have type
> information for relocation on AArch64, which is not the case
> for ix86.
>
> This fix relies on changes in binutils.
> aarch64: Relocation fixes and LTO
> https://sourceware.org/pipermail/binutils/2024-August/136481.html
>
> gcc/ChangeLog:
>
>       * config/aarch64/aarch64-coff.h (LOCAL_LABEL_PREFIX):
>       Use "." as the local label prefix.
>       (ASM_OUTPUT_ALIGNED_LOCAL): Remove.
>       (ASM_OUTPUT_LOCAL): New.
>       * config/aarch64/cygming.h (ASM_OUTPUT_EXTERNAL_LIBCALL):
>       Update.
>       (ASM_DECLARE_OBJECT_NAME): New.
>       (ASM_DECLARE_FUNCTION_NAME): New.
>       * config/i386/cygming.h (ASM_DECLARE_COLD_FUNCTION_NAME):
>       Update.
>       (ASM_OUTPUT_EXTERNAL_LIBCALL): Update.
>       * config/mingw/winnt.cc (mingw_pe_declare_function_type):
>       Rename into ...
>       (mingw_pe_declare_type): ... this.
>       (i386_pe_start_function): Update.
>       * config/mingw/winnt.h (mingw_pe_declare_function_type):
>       Rename into ...
>       (mingw_pe_declare_type): ... this.
> ---
>  gcc/config/aarch64/aarch64-coff.h | 22 ++++++----------------
>  gcc/config/aarch64/cygming.h      | 18 +++++++++++++++++-
>  gcc/config/i386/cygming.h         |  8 ++++----
>  gcc/config/mingw/winnt.cc         | 18 +++++++++---------
>  gcc/config/mingw/winnt.h          |  3 +--
>  5 files changed, 37 insertions(+), 32 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64-coff.h 
> b/gcc/config/aarch64/aarch64-coff.h
> index 81fd9954f75..17f346fe540 100644
> --- a/gcc/config/aarch64/aarch64-coff.h
> +++ b/gcc/config/aarch64/aarch64-coff.h
> @@ -20,9 +20,8 @@
>  #ifndef GCC_AARCH64_COFF_H
>  #define GCC_AARCH64_COFF_H
>  
> -#ifndef LOCAL_LABEL_PREFIX
> -# define LOCAL_LABEL_PREFIX  ""
> -#endif
> +#undef LOCAL_LABEL_PREFIX
> +#define LOCAL_LABEL_PREFIX  "."
>  
>  /* Using long long breaks -ansi and -std=c90, so these will need to be
>     made conditional for an LLP64 ABI.  */
> @@ -54,19 +53,10 @@
>      }
>  #endif
>  
> -/* Output a local common block.  /bin/as can't do this, so hack a
> -   `.space' into the bss segment.  Note that this is *bad* practice,
> -   which is guaranteed NOT to work since it doesn't define STATIC
> -   COMMON space but merely STATIC BSS space.  */
> -#ifndef ASM_OUTPUT_ALIGNED_LOCAL
> -# define ASM_OUTPUT_ALIGNED_LOCAL(STREAM, NAME, SIZE, ALIGN)         \
> -    {                                                                        
> \
> -      switch_to_section (bss_section);                                       
> \
> -      ASM_OUTPUT_ALIGN (STREAM, floor_log2 (ALIGN / BITS_PER_UNIT)); \
> -      ASM_OUTPUT_LABEL (STREAM, NAME);                                       
> \
> -      fprintf (STREAM, "\t.space\t%d\n", (int)(SIZE));                       
> \
> -    }
> -#endif
> +#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
> +( fputs (".lcomm ", (FILE)),                 \
> +  assemble_name ((FILE), (NAME)),            \
> +  fprintf ((FILE), ",%lu\n", (ROUNDED)))

I'd expect this to be:

  "," HOST_WIDE_INT_PRINT_DEC "\n"

rather than ",%lu\n".  "long" generally shouldn't be used in GCC code,
since it's such an ambiguous type.

LGTM otherwise.

Thanks,
Richard

Reply via email to