[PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
v2: - use aarch64_simd_decl_p to check for aarch64_vector_pcs. - emit the .variant_pcs directive even for local functions. - don't require .variant_pcs asm support in compile only tests. - add weakref tests. A dynamic linker with lazy binding support may need to handle vector PCS function symbols specially, so an ELF symbol table marking was introduced for such symbols. Function symbol references and definitions that follow the vector PCS are marked in the generated assembly with .variant_pcs and then the STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object file. The marking is propagated to the dynamic symbol table by the static linker so a dynamic linker can handle such symbols specially. For this to work, the assembler, the static linker and the dynamic linker has to be updated on a system. Old assembler does not support the new .variant_pcs directive, so a toolchain with old binutils won't be able to compile code that references vector PCS symbols. gcc/ChangeLog: 2019-05-28 Szabolcs Nagy * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. (aarch64_asm_output_external): Declare. * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. (aarch64_asm_output_alias): New. (aarch64_asm_output_external): New. * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. (ASM_OUTPUT_EXTERNAL): Define. gcc/testsuite/ChangeLog: 2019-05-28 Szabolcs Nagy * gcc.target/aarch64/pcs_attribute-2.c: New test. * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): New. diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index a0723266f22..19e9767c792 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -427,6 +427,8 @@ bool aarch64_is_long_call_p (rtx); bool aarch64_is_noplt_call_p (rtx); bool aarch64_label_mentioned_p (rtx); void aarch64_declare_function_name (FILE *, const char*, tree); +void aarch64_asm_output_alias (FILE *, const tree, const tree); +void aarch64_asm_output_external (FILE *, const tree, const char*); bool aarch64_legitimate_pic_operand_p (rtx); bool aarch64_mask_and_shift_for_ubfiz_p (scalar_int_mode, rtx, rtx); bool aarch64_masks_and_shift_for_bfi_p (scalar_int_mode, unsigned HOST_WIDE_INT, diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 83453d03095..16e534b0772 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -15276,6 +15276,19 @@ aarch64_asm_preferred_eh_data_format (int code ATTRIBUTE_UNUSED, int global) return (global ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | type; } +/* Output .variant_pcs for aarch64_vector_pcs function symbols. */ + +static void +aarch64_asm_output_variant_pcs (FILE *stream, const tree decl, const char* name) +{ + if (aarch64_simd_decl_p (decl)) +{ + fprintf (stream, "\t.variant_pcs\t"); + assemble_name (stream, name); + fprintf (stream, "\n"); +} +} + /* The last .arch and .tune assembly strings that we printed. */ static std::string aarch64_last_printed_arch_string; static std::string aarch64_last_printed_tune_string; @@ -15325,11 +15338,33 @@ aarch64_declare_function_name (FILE *stream, const char* name, aarch64_last_printed_tune_string = this_tune->name; } + aarch64_asm_output_variant_pcs (stream, fndecl, name); + /* Don't forget the type directive for ELF. */ ASM_OUTPUT_TYPE_DIRECTIVE (stream, name, "function"); ASM_OUTPUT_LABEL (stream, name); } +/* Implement ASM_OUTPUT_DEF_FROM_DECLS. Output .variant_pcs for aliases. */ + +void +aarch64_asm_output_alias (FILE *stream, const tree decl, const tree target) +{ + const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0); + const char *value = IDENTIFIER_POINTER (target); + aarch64_asm_output_variant_pcs (stream, decl, name); + ASM_OUTPUT_DEF (stream, name, value); +} + +/* Implement ASM_OUTPUT_EXTERNAL. Output .variant_pcs for undefined + function symbol references. */ + +void +aarch64_asm_output_external (FILE *stream, const tree decl, const char* name) +{ + aarch64_asm_output_variant_pcs (stream, decl, name); +} + /* Implements TARGET_ASM_FILE_START. Output the assembly header. */ static void diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index be6981889ab..f0f50e081ac 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -512,6 +512,15 @@ extern unsigned aarch64_architecture_version; #define ASM_DECLARE_FUNCTION_NAME(STR, NAME, DECL) \ aarch64_declare_function_name (STR, NAME, DECL) +/* Output assembly strings for alias definition. */ +#define ASM_OUTPUT_DEF_FROM_DECLS(STR, DECL, TARGET) \ + aarch64_asm_output_alias (STR, DECL, T
Re: [PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
Szabolcs Nagy writes: > v2: > - use aarch64_simd_decl_p to check for aarch64_vector_pcs. > - emit the .variant_pcs directive even for local functions. > - don't require .variant_pcs asm support in compile only tests. > - add weakref tests. > > A dynamic linker with lazy binding support may need to handle vector PCS > function symbols specially, so an ELF symbol table marking was > introduced for such symbols. > > Function symbol references and definitions that follow the vector PCS > are marked in the generated assembly with .variant_pcs and then the > STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object > file. The marking is propagated to the dynamic symbol table by the > static linker so a dynamic linker can handle such symbols specially. > > For this to work, the assembler, the static linker and the dynamic > linker has to be updated on a system. Old assembler does not support > the new .variant_pcs directive, so a toolchain with old binutils won't > be able to compile code that references vector PCS symbols. > > gcc/ChangeLog: > > 2019-05-28 Szabolcs Nagy > > * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. > (aarch64_asm_output_external): Declare. > * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. > (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. > (aarch64_asm_output_alias): New. > (aarch64_asm_output_external): New. > * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. > (ASM_OUTPUT_EXTERNAL): Define. > > gcc/testsuite/ChangeLog: > > 2019-05-28 Szabolcs Nagy > > * gcc.target/aarch64/pcs_attribute-2.c: New test. > * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. > * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): > New. LGTM, but an AArch64 maintainer will need to approve. > diff --git a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > index e399690f364..80ebd955e10 100644 > --- a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > +++ b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > @@ -1,4 +1,5 @@ > /* dg-do run */ > +/* { dg-require-effective-target aarch64_variant_pcs } */ > /* { dg-additional-options "-std=c99" } */ Not your problem of course, but mind fixing the dg-do markup while you're there? It should be /* { dg-do run } */ instead. As things stand, the test only gets compiled, not run. Thanks, Richard
Re: [PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
On Wed, May 29, 2019 at 11:00:46AM +0100, Richard Sandiford wrote: > Szabolcs Nagy writes: > > v2: > > - use aarch64_simd_decl_p to check for aarch64_vector_pcs. > > - emit the .variant_pcs directive even for local functions. > > - don't require .variant_pcs asm support in compile only tests. > > - add weakref tests. > > > > A dynamic linker with lazy binding support may need to handle vector PCS > > function symbols specially, so an ELF symbol table marking was > > introduced for such symbols. > > > > Function symbol references and definitions that follow the vector PCS > > are marked in the generated assembly with .variant_pcs and then the > > STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object > > file. The marking is propagated to the dynamic symbol table by the > > static linker so a dynamic linker can handle such symbols specially. > > > > For this to work, the assembler, the static linker and the dynamic > > linker has to be updated on a system. Old assembler does not support > > the new .variant_pcs directive, so a toolchain with old binutils won't > > be able to compile code that references vector PCS symbols. > > > > gcc/ChangeLog: > > > > 2019-05-28 Szabolcs Nagy > > > > * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. > > (aarch64_asm_output_external): Declare. > > * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. > > (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. > > (aarch64_asm_output_alias): New. > > (aarch64_asm_output_external): New. > > * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. > > (ASM_OUTPUT_EXTERNAL): Define. > > > > gcc/testsuite/ChangeLog: > > > > 2019-05-28 Szabolcs Nagy > > > > * gcc.target/aarch64/pcs_attribute-2.c: New test. > > * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. > > * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): > > New. > > LGTM, but an AArch64 maintainer will need to approve. OK with Richard's change suggested below. Thanks, James > > > diff --git a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > index e399690f364..80ebd955e10 100644 > > --- a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > +++ b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > @@ -1,4 +1,5 @@ > > /* dg-do run */ > > +/* { dg-require-effective-target aarch64_variant_pcs } */ > > /* { dg-additional-options "-std=c99" } */ > > Not your problem of course, but mind fixing the dg-do markup while > you're there? It should be > > /* { dg-do run } */ > > instead. As things stand, the test only gets compiled, not run. > > Thanks, > Richard
Re: [PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
On Mon, 3 Jun 2019 at 13:28, James Greenhalgh wrote: > > On Wed, May 29, 2019 at 11:00:46AM +0100, Richard Sandiford wrote: > > Szabolcs Nagy writes: > > > v2: > > > - use aarch64_simd_decl_p to check for aarch64_vector_pcs. > > > - emit the .variant_pcs directive even for local functions. > > > - don't require .variant_pcs asm support in compile only tests. > > > - add weakref tests. > > > > > > A dynamic linker with lazy binding support may need to handle vector PCS > > > function symbols specially, so an ELF symbol table marking was > > > introduced for such symbols. > > > > > > Function symbol references and definitions that follow the vector PCS > > > are marked in the generated assembly with .variant_pcs and then the > > > STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object > > > file. The marking is propagated to the dynamic symbol table by the > > > static linker so a dynamic linker can handle such symbols specially. > > > > > > For this to work, the assembler, the static linker and the dynamic > > > linker has to be updated on a system. Old assembler does not support > > > the new .variant_pcs directive, so a toolchain with old binutils won't > > > be able to compile code that references vector PCS symbols. > > > > > > gcc/ChangeLog: > > > > > > 2019-05-28 Szabolcs Nagy > > > > > > * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. > > > (aarch64_asm_output_external): Declare. > > > * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. > > > (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. > > > (aarch64_asm_output_alias): New. > > > (aarch64_asm_output_external): New. > > > * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. > > > (ASM_OUTPUT_EXTERNAL): Define. > > > > > > gcc/testsuite/ChangeLog: > > > > > > 2019-05-28 Szabolcs Nagy > > > > > > * gcc.target/aarch64/pcs_attribute-2.c: New test. > > > * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. > > > * lib/target-supports.exp > > > (check_effective_target_aarch64_variant_pcs): > > > New. > > > > LGTM, but an AArch64 maintainer will need to approve. > > OK with Richard's change suggested below. > Hi, Since this patch was committed (r271869), I've noticed regressions on aarch64: FAIL:gcc.dg/visibility-14.c scan-hidden hidden[ \t_]*foo FAIL:gcc.dg/visibility-15.c scan-hidden hidden[ \t_]*foo FAIL:gcc.dg/visibility-16.c scan-hidden hidden[ \t_]*foo FAIL:gcc.dg/visibility-17.c scan-hidden hidden[ \t_]*foo FAIL:gcc.dg/visibility-18.c scan-hidden hidden[ \t_]*foo FAIL:gcc.dg/visibility-19.c scan-hidden hidden[ \t_]*foo FAIL:gcc.dg/visibility-23.c scan-hidden hidden[ \t_]*foo Didn't you see them when you tested the patch? Thanks, Christophe > Thanks, > James > > > > > > diff --git a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > > b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > > index e399690f364..80ebd955e10 100644 > > > --- a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > > +++ b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c > > > @@ -1,4 +1,5 @@ > > > /* dg-do run */ > > > +/* { dg-require-effective-target aarch64_variant_pcs } */ > > > /* { dg-additional-options "-std=c99" } */ > > > > Not your problem of course, but mind fixing the dg-do markup while > > you're there? It should be > > > > /* { dg-do run } */ > > > > instead. As things stand, the test only gets compiled, not run. > > > > Thanks, > > Richard
Re: [PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
On 04/06/2019 13:21, Christophe Lyon wrote: > On Mon, 3 Jun 2019 at 13:28, James Greenhalgh > wrote: >> >> On Wed, May 29, 2019 at 11:00:46AM +0100, Richard Sandiford wrote: >>> Szabolcs Nagy writes: v2: - use aarch64_simd_decl_p to check for aarch64_vector_pcs. - emit the .variant_pcs directive even for local functions. - don't require .variant_pcs asm support in compile only tests. - add weakref tests. A dynamic linker with lazy binding support may need to handle vector PCS function symbols specially, so an ELF symbol table marking was introduced for such symbols. Function symbol references and definitions that follow the vector PCS are marked in the generated assembly with .variant_pcs and then the STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object file. The marking is propagated to the dynamic symbol table by the static linker so a dynamic linker can handle such symbols specially. For this to work, the assembler, the static linker and the dynamic linker has to be updated on a system. Old assembler does not support the new .variant_pcs directive, so a toolchain with old binutils won't be able to compile code that references vector PCS symbols. gcc/ChangeLog: 2019-05-28 Szabolcs Nagy * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. (aarch64_asm_output_external): Declare. * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. (aarch64_asm_output_alias): New. (aarch64_asm_output_external): New. * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. (ASM_OUTPUT_EXTERNAL): Define. gcc/testsuite/ChangeLog: 2019-05-28 Szabolcs Nagy * gcc.target/aarch64/pcs_attribute-2.c: New test. * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): New. >>> >>> LGTM, but an AArch64 maintainer will need to approve. >> >> OK with Richard's change suggested below. >> > > Hi, > > Since this patch was committed (r271869), I've noticed regressions on aarch64: > FAIL:gcc.dg/visibility-14.c scan-hidden hidden[ \t_]*foo > FAIL:gcc.dg/visibility-15.c scan-hidden hidden[ \t_]*foo > FAIL:gcc.dg/visibility-16.c scan-hidden hidden[ \t_]*foo > FAIL:gcc.dg/visibility-17.c scan-hidden hidden[ \t_]*foo > FAIL:gcc.dg/visibility-18.c scan-hidden hidden[ \t_]*foo > FAIL:gcc.dg/visibility-19.c scan-hidden hidden[ \t_]*foo > FAIL:gcc.dg/visibility-23.c scan-hidden hidden[ \t_]*foo > > Didn't you see them when you tested the patch? sorry i missed these. i broke asm visibility declarations for extern symbols, i will have a fix soon. > > Thanks, > > Christophe > > >> Thanks, >> James >> >>> diff --git a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c index e399690f364..80ebd955e10 100644 --- a/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c +++ b/gcc/testsuite/gcc.target/aarch64/torture/simd-abi-4.c @@ -1,4 +1,5 @@ /* dg-do run */ +/* { dg-require-effective-target aarch64_variant_pcs } */ /* { dg-additional-options "-std=c99" } */ >>> >>> Not your problem of course, but mind fixing the dg-do markup while >>> you're there? It should be >>> >>> /* { dg-do run } */ >>> >>> instead. As things stand, the test only gets compiled, not run. >>> >>> Thanks, >>> Richard
Re: [PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
On 28/05/2019 16:01, Szabolcs Nagy wrote: > v2: > - use aarch64_simd_decl_p to check for aarch64_vector_pcs. > - emit the .variant_pcs directive even for local functions. > - don't require .variant_pcs asm support in compile only tests. > - add weakref tests. > > A dynamic linker with lazy binding support may need to handle vector PCS > function symbols specially, so an ELF symbol table marking was > introduced for such symbols. > > Function symbol references and definitions that follow the vector PCS > are marked in the generated assembly with .variant_pcs and then the > STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object > file. The marking is propagated to the dynamic symbol table by the > static linker so a dynamic linker can handle such symbols specially. > > For this to work, the assembler, the static linker and the dynamic > linker has to be updated on a system. Old assembler does not support > the new .variant_pcs directive, so a toolchain with old binutils won't > be able to compile code that references vector PCS symbols. > > gcc/ChangeLog: > > 2019-05-28 Szabolcs Nagy > > * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. > (aarch64_asm_output_external): Declare. > * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. > (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. > (aarch64_asm_output_alias): New. > (aarch64_asm_output_external): New. > * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. > (ASM_OUTPUT_EXTERNAL): Define. > > gcc/testsuite/ChangeLog: > > 2019-05-28 Szabolcs Nagy > > * gcc.target/aarch64/pcs_attribute-2.c: New test. > * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. > * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): > New. > i'd like to backport this and follow up fixes to the gcc-9 branch, see attached patch. From 54f408f666f7224563d2a1ff10eda6ab4d8864b1 Mon Sep 17 00:00:00 2001 From: nsz Date: Mon, 3 Jun 2019 13:50:53 + Subject: [PATCH] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references Backport r271869 Backport r271913 Backport r272414 A dynamic linker with lazy binding support may need to handle vector PCS function symbols specially, so an ELF symbol table marking was introduced for such symbols. Function symbol references and definitions that follow the vector PCS are marked in the generated assembly with .variant_pcs and then the STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object file. The marking is propagated to the dynamic symbol table by the static linker so a dynamic linker can handle such symbols specially. For this to work, the assembler, the static linker and the dynamic linker has to be updated on a system. Old assembler does not support the new .variant_pcs directive, so a toolchain with old binutils won't be able to compile code that references vector PCS symbols. gcc/ChangeLog: * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. (aarch64_asm_output_external): Declare. * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. (aarch64_asm_output_alias): New. (aarch64_asm_output_external): New. * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. (ASM_OUTPUT_EXTERNAL): Define. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pcs_attribute-2.c: New test. * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): New. gcc/ChangeLog: * config/aarch64/aarch64-protos.h (aarch64_asm_output_external): Remove const. * config/aarch64/aarch64.c (aarch64_asm_output_external): Call default_elf_asm_output_external. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pcs_attribute-2.c: Remove ifunc usage. * gcc.target/aarch64/pcs_attribute-3.c: New test. --- gcc/ChangeLog | 21 + gcc/config/aarch64/aarch64-protos.h | 2 + gcc/config/aarch64/aarch64.c | 36 +++ gcc/config/aarch64/aarch64.h | 9 ++ gcc/testsuite/ChangeLog | 15 +++ .../gcc.target/aarch64/pcs_attribute-2.c | 93 +++ .../gcc.target/aarch64/pcs_attribute-3.c | 58 .../gcc.target/aarch64/torture/simd-abi-4.c | 3 +- gcc/testsuite/lib/target-supports.exp | 11 +++ 9 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/pcs_attribute-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/pcs_attribute-3.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82010817b6a..c0ec9df3db1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2019-07-05 Szabolcs Nagy + + Backport from mainline + 2019-06-03 Szabolcs Nagy + + * config/
Re: [PATCH v2] aarch64: emit .variant_pcs for aarch64_vector_pcs symbol references
Szabolcs Nagy writes: > On 28/05/2019 16:01, Szabolcs Nagy wrote: >> v2: >> - use aarch64_simd_decl_p to check for aarch64_vector_pcs. >> - emit the .variant_pcs directive even for local functions. >> - don't require .variant_pcs asm support in compile only tests. >> - add weakref tests. >> >> A dynamic linker with lazy binding support may need to handle vector PCS >> function symbols specially, so an ELF symbol table marking was >> introduced for such symbols. >> >> Function symbol references and definitions that follow the vector PCS >> are marked in the generated assembly with .variant_pcs and then the >> STO_AARCH64_VARIANT_PCS st_other flag is set on the symbol in the object >> file. The marking is propagated to the dynamic symbol table by the >> static linker so a dynamic linker can handle such symbols specially. >> >> For this to work, the assembler, the static linker and the dynamic >> linker has to be updated on a system. Old assembler does not support >> the new .variant_pcs directive, so a toolchain with old binutils won't >> be able to compile code that references vector PCS symbols. >> >> gcc/ChangeLog: >> >> 2019-05-28 Szabolcs Nagy >> >> * config/aarch64/aarch64-protos.h (aarch64_asm_output_alias): Declare. >> (aarch64_asm_output_external): Declare. >> * config/aarch64/aarch64.c (aarch64_asm_output_variant_pcs): New. >> (aarch64_declare_function_name): Call aarch64_asm_output_variant_pcs. >> (aarch64_asm_output_alias): New. >> (aarch64_asm_output_external): New. >> * config/aarch64/aarch64.h (ASM_OUTPUT_DEF_FROM_DECLS): Define. >> (ASM_OUTPUT_EXTERNAL): Define. >> >> gcc/testsuite/ChangeLog: >> >> 2019-05-28 Szabolcs Nagy >> >> * gcc.target/aarch64/pcs_attribute-2.c: New test. >> * gcc.target/aarch64/torture/simd-abi-4.c: Check .variant_pcs support. >> * lib/target-supports.exp (check_effective_target_aarch64_variant_pcs): >> New. >> > > i'd like to backport this and follow up fixes to the gcc-9 branch, > see attached patch. OK. I agree this makes sense since vector PCS functions were a new feature in GCC 9 and since not backporting it could lead to silent wrong code. Richard