Commit ca5954b
Apply ptrauth changes and fix ARM build, tests
add back -fallow-half-arguments-and-returns for hipRuntime builds.
----------------------------------------------------------------------
Revert "[PAC][AArch64] Lower ptrauth constants in code (llvm#96879)"
This reverts commit 88dd10c.
----------------------------------------------------------------------
[PAC][AArch64] Lower ptrauth constants in code (llvm#96879)
This re-applies llvm#94241 after fixing buildbot failure, see
https://lab.llvm.org/buildbot/#/builders/51/builds/570
According to standard, `constexpr` variables and `const` variables
initialized with constant expressions can be used in lambdas w/o
capturing - see https://en.cppreference.com/w/cpp/language/lambda.
However, MSVC used on buildkite seems to ignore that rule and does not
allow using such uncaptured variables in lambdas: we have "error C3493:
'Mask16' cannot be implicitly captured because no default capture mode
has been specified" - see
https://buildkite.com/llvm-project/github-pull-requests/builds/73238
Explicitly capturing such a variable, however, makes buildbot fail with
"error: lambda capture 'Mask16' is not required to be captured for this
use [-Werror,-Wunused-lambda-capture]" - see
https://lab.llvm.org/buildbot/#/builders/51/builds/570.
Fix both cases by using `0xffff` value directly instead of giving a name
to it.
Original PR description below.
Depends on llvm#94240.
Define the following pseudos for lowering ptrauth constants in code:
- non-`extern_weak`:
- no GOT load needed: `MOVaddrPAC` - similar to `MOVaddr`, with added
PAC;
- GOT load needed: `LOADgotPAC` - similar to `LOADgot`, with added PAC;
- `extern_weak`: `LOADauthptrstatic` - similar to `LOADgot`, but use a
special stub slot named `sym$auth_ptr$key$disc` filled by dynamic linker
during relocation resolving instead of a GOT slot.
---------
Co-authored-by: Ahmed Bougacha <[email protected]>
(cherry picked from commit 1488fb4)
----------------------------------------------------------------------
[AArch64][PAC] Lower ptrauth constants in code for MachO. (llvm#97665)
This also adds support for auth stubs on MachO using __DATA,__auth_ptr.
Some of the machinery for auth stubs is already implemented; this
generalizes that a bit to support MachO, and moves some of the shared
logic into MMIImpls.
In particular, this originally had an AuthStubInfo struct, but we no
longer need it beyond a single MCExpr. So this provides variants of
the symbol stub helper type declarations and functions for "expr
stubs", where a stub points at an arbitrary MCExpr, rather than
a simple MCSymbol (and a bit).
(cherry picked from commit 5f1bb62)
----------------------------------------------------------------------
[AArch64][PAC] Sign block addresses used in indirectbr. (llvm#97647)
Enabled in clang using:
-fptrauth-indirect-gotos
and at the IR level using function attribute:
"ptrauth-indirect-gotos"
Signing uses IA and a per-function integer discriminator. The
discriminator isn't ABI-visible, and is currently:
ptrauth_string_discriminator("<function_name> blockaddress")
A sufficiently sophisticated frontend could benefit from per-indirectbr
discrimination, which would need additional machinery, such as allowing
"ptrauth" bundles on indirectbr. For our purposes, the simple scheme
above is sufficient.
This approach doesn't support subtracting label addresses and using
the result as offsets, because each label address is signed.
Pointer arithmetic on signed pointers corrupts the signature bits,
and because label address expressions aren't typed beyond void*,
we can't do anything reliably intelligent on the arithmetic exprs.
Not signing addresses when used to form offsets would allow
easily hijacking control flow by overwriting the offset.
This diagnoses the basic cases (`&&lbl2 - &&lbl1`) in the frontend,
while we evaluate either alternative implementations (e.g., lowering
blockaddress to a bb number, and indirectbr to a checked jump-table),
or better diagnostics (both at the frontend level and on unencodable
IR constants).
(cherry picked from commit b8721fa)
----------------------------------------------------------------------
[AArch64][PAC] Lower auth/resign into checked sequence. (llvm#79024)
This introduces 3 hardening modes in the authentication step of
auth/resign lowering:
- unchecked, which uses the AUT instructions as-is
- poison, which detects authentication failure (using an XPAC+CMP
sequence), explicitly yielding the XPAC result rather than the
AUT result, to avoid leaking
- trap, which additionally traps on authentication failure,
using BRK #0xC470 + key (IA C470, IB C471, DA C472, DB C473.)
Not all modes are necessarily useful in all contexts, and there
are more performant alternative lowerings in specific contexts
(e.g., when I/D TBI enablement is a target ABI guarantee.)
These will be implemented separately.
This is controlled by the `ptrauth-auth-traps` function attributes,
and can be overridden using `-aarch64-ptrauth-auth-checks=`.
This also adds the FPAC extension, which we haven't needed
before, to improve isel when we can rely on HW checking.
(cherry picked from commit d7e8a74)
----------------------------------------------------------------------
[Clang][Arm] Convert -fallow-half-arguments-and-returns to a target option. NFC
This cc1 option -fallow-half-arguments-and-returns allows __fp16 to be
passed by argument and returned, without giving an error. It is
currently always enabled for Arm and AArch64, by forcing the option in
the driver. This means any cc1 tests (especially those needing
arm_neon.h) need to specify the option too, to prevent the error from
being emitted.
This changes it to a target option instead, set to true for Arm and
AArch64. This allows the option to be removed. Previously it was implied
by -fnative_half_arguments_and_returns, which is set for certain
languages like open_cl, renderscript and hlsl, so that option now too
controls the errors. There were are few other non-arm uses of
-fallow-half-arguments-and-returns but I believe they were unnecessary.
The strictfp_builtins.c tests were converted from __fp16 to _Float16 to
avoid the issues.
Differential Revision: https://reviews.llvm.org/D133885
(cherry picked from commit 9ef11036505c0ae6cdb56ff49f39ab7abcded3cf)
----------------------------------------------------------------------
[clang] XFAIL a few tests due to 'noundef' etc
Not all, but most of these are failing due to the presence of a 'noundef' call
return attribute on some intrinsics.
This is not present on upstream 'main' due to the AlwaysInliner pass being run.
See commit 1a2e77c.
----------------------------------------------------------------------
[DebugInfo] Restore missing disabled ptrauth support
See "[DebugInfo] Teach LLVM and LLDB about ptrauth in DWARF":
commit a8c3d98
Author: Jonas Devlieghere <[email protected]>
Date: Wed Jul 27 10:44:15 2022 -0700
----------------------------------------------------------------------
Apply simple-do.ll test change from b46c085
----------------------------------------------------------------------
Adjust ptrauth.s test for ptrauth_authentication_mode encoding
----------------------------------------------------------------------
Fix dwarf-eh-prepare-dbg.ll test: dwarfAddressSpace=>addressSpace
----------------------------------------------------------------------
Update some SLPVectorizer/AArch64 tests from upstream
----------------------------------------------------------------------
Regenerate assertions in arm_mult_q15.ll
----------------------------------------------------------------------
[AsmPrinter] Handle null extracted addr class
----------------------------------------------------------------------
[PowerPC] Account for custom LLVM moniker in aix tests
----------------------------------------------------------------------
[LoongArch] Add "Verify Heterogeneous Debug Preconditions" to pipeline test
----------------------------------------------------------------------
[JITLink][RISCV] Un-XFAIL ELF_pc_indirect.s
----------------------------------------------------------------------
Change-Id: Ie6ab500b2451b3ed070dfad0bc16d003e5e2fe101 parent e6f09b9 commit ca5954b
File tree
67 files changed
+298
-220
lines changed- clang
- lib
- Basic
- Targets
- Driver/ToolChains
- Sema
- test
- CodeGenCXX
- CodeGen
- PowerPC
- SystemZ
- aarch64-sve-intrinsics
- Driver
- Headers
- SemaCXX
- Sema
- aarch64-sve-intrinsics
- llvm
- include/llvm
- BinaryFormat
- CodeGen
- lib
- CodeGen
- AsmPrinter
- DebugInfo/DWARF
- Target/AArch64
- GISel
- test
- CodeGen
- AArch64
- LoongArch
- PowerPC
- ExecutionEngine/JITLink/RISCV
- TableGen/GlobalISelCombinerEmitter
- Transforms
- HardwareLoops/ARM
- PhaseOrdering/ARM
- SLPVectorizer/AArch64
- tools/llvm-dwarfdump/AArch64
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
67 files changed
+298
-220
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
| 610 | + | |
| 611 | + | |
610 | 612 | | |
611 | 613 | | |
612 | 614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1740 | 1740 | | |
1741 | 1741 | | |
1742 | 1742 | | |
1743 | | - | |
1744 | 1743 | | |
1745 | 1744 | | |
1746 | 1745 | | |
1747 | 1746 | | |
1748 | 1747 | | |
1749 | 1748 | | |
1750 | | - | |
1751 | 1749 | | |
1752 | 1750 | | |
1753 | 1751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2529 | 2529 | | |
2530 | 2530 | | |
2531 | 2531 | | |
2532 | | - | |
| 2532 | + | |
| 2533 | + | |
2533 | 2534 | | |
2534 | 2535 | | |
2535 | 2536 | | |
| |||
2639 | 2640 | | |
2640 | 2641 | | |
2641 | 2642 | | |
2642 | | - | |
| 2643 | + | |
| 2644 | + | |
2643 | 2645 | | |
2644 | 2646 | | |
2645 | 2647 | | |
| |||
4938 | 4940 | | |
4939 | 4941 | | |
4940 | 4942 | | |
4941 | | - | |
| 4943 | + | |
| 4944 | + | |
4942 | 4945 | | |
4943 | 4946 | | |
4944 | 4947 | | |
| |||
5186 | 5189 | | |
5187 | 5190 | | |
5188 | 5191 | | |
5189 | | - | |
| 5192 | + | |
| 5193 | + | |
5190 | 5194 | | |
5191 | 5195 | | |
5192 | 5196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
0 commit comments