From b20dbe28f054f2d21bdf5093d0ea732d28cde704 Mon Sep 17 00:00:00 2001 From: Evgeny Karpov Date: Tue, 16 Jul 2024 22:43:32 +0200 Subject: [PATCH] Use the biggest adjustment Replace GOT symbols with ABSOLUTE --- gcc/config/aarch64/aarch64-coff.h | 11 +++++------ gcc/config/aarch64/aarch64.cc | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/config/aarch64/aarch64-coff.h b/gcc/config/aarch64/aarch64-coff.h index 3afd26506cf..55da023921e 100644 --- a/gcc/config/aarch64/aarch64-coff.h +++ b/gcc/config/aarch64/aarch64-coff.h @@ -65,12 +65,11 @@ #define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNMENT) \ { \ - unsigned HOST_WIDE_INT rounded = SIZE; \ - if (SIZE == 0) \ - rounded = 1; \ - rounded += (ALIGNMENT / BITS_PER_UNIT) - 1; \ - rounded = (rounded / (ALIGNMENT / BITS_PER_UNIT) \ - * ((ALIGNMENT) / BITS_PER_UNIT)); \ + unsigned HOST_WIDE_INT rounded = MAX((SIZE), 1); \ + unsigned HOST_WIDE_INT alignment = MAX((ALIGNMENT), BIGGEST_ALIGNMENT); \ + rounded += (alignment / BITS_PER_UNIT) - 1; \ + rounded = (rounded / (alignment / BITS_PER_UNIT) \ + * (alignment / BITS_PER_UNIT)); \ ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, rounded); \ } diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 303a869fe74..416697e4004 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -20997,7 +20997,7 @@ aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset) if ((flag_pic || SYMBOL_REF_WEAK (x)) && !aarch64_symbol_binds_local_p (x)) return aarch64_cmodel == AARCH64_CMODEL_SMALL_SPIC - ? SYMBOL_SMALL_GOT_28K : SYMBOL_SMALL_GOT_4G; + ? SYMBOL_SMALL_ABSOLUTE : SYMBOL_SMALL_ABSOLUTE; /* Same reasoning as the tiny code model, but the offset cap here is 1MB, allowing +/-3.9GB for the offset to the symbol. */