Bug 1726637

Summary: Request a backport of fixes for SVE Vector PCS on AArch64 (binutils part)
Product: Red Hat Enterprise Linux 8 Reporter: Nick Clifton <nickc>
Component: binutilsAssignee: Nick Clifton <nickc>
binutils sub component: system-version QA Contact: Miloš Prchlík <mprchlik>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: fweimer, law, mprchlik, ohudlick, tgummels, woodard
Version: 8.2   
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: binutils-2 binutils-2.30-60.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:45:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1746913, 1755139    

Description Nick Clifton 2019-07-03 10:39:51 UTC
Clone of #1724130, created for the binutils component.

Description of problem:

Arm has introduced a vector PCS for SVE and Advanced SIMD. This showed a problem with lazy binding on SVE vector PCS while testing the qemu implementation of SVE primarily to do with saving and restoring the additional callee saved register state in the new vector PCS when lazily resolving SVE functions. 

The draft text for fixing the ABI for this is at
https://sourceware.org/ml/libc-alpha/2019-05/msg00501.html

It requires the marking of vector functions in the symbol table so the dynamic linker can bind them early. For this the symbol marking has to be propagated from the compiler to the final dynamic linked binary.


Running an executable with vector pcs turned on for SVE. Note that such binaries could be generated by other commercial toolchains as well.


This has been fixed by a series of patches for gcc
binutils and glibc. These need to be backported on systems
that run on SVE hardware to support binaries with extern
SVE calls and to support compiling code with SVE or AdvSIMD
vector calls.

Without the glibc backport, the dynamic linker clobbers
SVE call argument registers in the lazy binding entry code
when the function is first called. So binaries with extern
SVE calls will misbehave at runtime.

Without the binutils backport, the bfd linker silently
drops symbol markings at link time, creating broken
binaries that misbehave even with an updated glibc.
Without the binutils backport, the assembler fails to
assemble code with SVE or AdvSIMD calls because it does
not understand the new .variant_pcs directive.

Without the gcc backport, gcc-9 emits AdvSIMD vector calls
without marking them with .variant_pcs and thus they won't
follow the new ABI. This is unlikely to cause runtime
problems now as AdvSIMD registers are unlikely to be
corrupted by the dynamic linker, but the marking is an ABI
requirement and will be necessary to support LD_AUDIT or
arbitrary ifunc resolvers for AdvSIMD vector calls among
other features.

We plan to backport the patches below to gcc-9, binutils-2.32
and several glibc release branches.

patches:

commit 2301ed1c9af1316b4bad3747d2b03f7d44940f87
Commit:     Szabolcs Nagy <szabolcs.nagy>
CommitDate: 2019-05-24 15:05:57 +0100

    aarch64: add STO_AARCH64_VARIANT_PCS and DT_AARCH64_VARIANT_PCS

commit f166ae0188dcb89c5ae925034260a708a254ab2f
Commit:     Szabolcs Nagy <szabolcs.nagy>
CommitDate: 2019-05-24 15:07:42 +0100

    aarch64: handle .variant_pcs directive in gas

commit 0b4eac57c44ec4c9e13f5201b40936c3b3e6c639
Commit:     Szabolcs Nagy <szabolcs.nagy>
CommitDate: 2019-05-24 15:09:06 +0100

    aarch64: override default elf .set handling in gas

commit 823710d5856996d1f54f04ecb2f7647aeae99b5b
Commit:     Szabolcs Nagy <szabolcs.nagy>
CommitDate: 2019-05-24 15:11:00 +0100

    aarch64: handle STO_AARCH64_VARIANT_PCS in bfd

commit 65f381e729bedb933f3e1376e7f53f0ff63ac9a8
Commit:     Szabolcs Nagy <szabolcs.nagy>
CommitDate: 2019-05-28 12:03:51 +0100

    aarch64: fix variant_pcs ld tests

Comment 6 Nick Clifton 2019-10-29 08:16:22 UTC
Fixed in binutils-2.30-60.el8

Comment 8 Miloš Prchlík 2020-03-17 09:46:02 UTC
Verified with binutils-2.30-73.el8:

PASS: gas/aarch64/symbol-variant_pcs-1
PASS: gas/aarch64/symbol-variant_pcs-2
PASS: gas/aarch64/symbol-variant_pcs-3

PASS: ld-aarch64/variant_pcs-r
FAIL: ld-aarch64/variant_pcs-shared
FAIL: ld-aarch64/variant_pcs-now


The failures seem to be only issues with the expected formatting of the test output, unexpected lines and so on, not actual PCS issues. The patches are applied, and the test output matches the expected when it comes to PCS.

Comment 10 errata-xmlrpc 2020-04-28 16:45:36 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1797