Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream arm64e and Pointer Authentication support #14

Merged
merged 45 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9e702b1
[AArch64][v8.3a] Add LDRA '[xN]!' alias.
ahmedbougacha Jun 26, 2019
5cb5475
[AArch64][v8.3a] Add missing imp-defs on RETA*.
ahmedbougacha Jun 26, 2019
11d7d33
[AArch64] Add 'vortex' CPU.
ahmedbougacha Oct 21, 2019
5ed200f
[AArch64] Add 'lightning' CPU.
ahmedbougacha Oct 21, 2019
7bda9ff
[Triple] Add 'arm64e', an AArch64 sub-architecture.
ahmedbougacha Oct 21, 2019
ed270ad
[Object] Add MachO CPU_SUBTYPE_ARM64E.
ahmedbougacha Sep 6, 2019
b795126
[utils] Teach UpdateTestChecks about arm64e.
ahmedbougacha Jun 26, 2019
700888c
[AArch64] Support emitting arm64e MachO in Darwin AsmBackend.
ahmedbougacha Aug 8, 2019
d3d83e5
[AArch64] Add helper functions for mapping PAC keys and instructions.
ahmedbougacha Aug 8, 2019
13d4276
[AArch64] Support @AUTH symbol variant and MachO reloc.
ahmedbougacha Sep 6, 2019
481f2fd
[Docs] Document Pointer Authentication IR additions.
ahmedbougacha Aug 8, 2019
e652bd4
[IR] Define new llvm.ptrauth intrinsics.
ahmedbougacha Aug 8, 2019
aad6348
[AArch64] Lower llvm.ptrauth.sign intrinsics.
ahmedbougacha Sep 16, 2019
9622ba4
[AArch64] Lower llvm.ptrauth.auth/resign intrinsics.
ahmedbougacha Sep 16, 2019
2a06c80
[AArch64] Lower llvm.ptrauth.strip intrinsics.
ahmedbougacha Sep 16, 2019
08678ef
[AArch64] Lower llvm.ptrauth.blend intrinsics.
ahmedbougacha Sep 16, 2019
9f1a12c
[AArch64] Lower auth calls/tail-calls.
ahmedbougacha Sep 16, 2019
cf672d9
[AArch64] Fold auth + load sequences into LDRA.
ahmedbougacha Aug 8, 2019
8198c13
[AArch64] Support emitting "hardened" jump-tables.
ahmedbougacha Aug 8, 2019
5b022b2
[IR] Define "ptrauth" operand bundles.
ahmedbougacha Aug 8, 2019
a90507b
[InstCombine] Combine ptrauth intrinsics into call operand bundles.
ahmedbougacha Aug 8, 2019
41c9f47
[AArch64] Lower "llvm.ptrauth" signed global wrappers.
ahmedbougacha Aug 8, 2019
646d0c9
[AArch64] Lower calls with ptrauth operand bundles.
ahmedbougacha Aug 8, 2019
4fdcd96
[AArch64] For arm64e Darwin TLS, sign the access thunk pointer.
ahmedbougacha Aug 8, 2019
0b6fe15
[AArch64] Support return address authentication.
ahmedbougacha Aug 8, 2019
af247a2
[Transforms] Add pass for software expansion of ptrauth.
ahmedbougacha Jun 26, 2019
b7c83ad
[DebugInfo] Add 'ptrauth' qualifier support.
adrian-prantl Jun 26, 2019
46088d1
Basic ptrauth command-line flags.
rjmccall Sep 18, 2019
4ec8ebf
Add an API for computing an ABI-stable hash of a string.
rjmccall Sep 18, 2019
a9dd959
Add support for the new pointer authentication builtins.
rjmccall Sep 18, 2019
2c01c33
IRGen preliminaries for pointer authentication, hopefully NFC.
rjmccall Sep 18, 2019
181e261
Implement pointer authentication for function pointers.
rjmccall Sep 18, 2019
fad0aa4
Pointer authentication for blocks.
rjmccall Sep 18, 2019
ea40099
Pointer authentication support for ObjC method lists.
rjmccall Sep 18, 2019
c077762
Record the original declaration for which a v-table slot was created.
rjmccall Sep 18, 2019
a018339
Implement pointer authentication for C++ virtual functions,
rjmccall Sep 18, 2019
8c97618
Pointer authentication support for C++ member function pointers.
rjmccall Sep 18, 2019
25e71b4
Add IR attributes to functions compiled under pointer authentication.
rjmccall Sep 18, 2019
6ac1ad0
Sign function pointers passed to atexit and __cxa_atexit.
rjmccall Sep 18, 2019
21d1be0
Sign the destructor pointer passed to __cxa_throw.
rjmccall Sep 18, 2019
a8e307f
Sign the v-table pointer in ObjC exception RTTI.
rjmccall Sep 18, 2019
e004081
Add prototype support for software pointer authentication.
rjmccall Sep 18, 2019
f58c74f
Implement the __ptrauth type qualifier.
rjmccall Sep 18, 2019
34229b5
Make the CGPointerAuthInfo parameter to the general CGCallee
rjmccall Sep 18, 2019
e398fa8
Language documentation for the pointer authentication feature.
rjmccall Sep 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Clang Language Extensions
BlockLanguageSpec
Block-ABI-Apple
AutomaticReferenceCounting
PointerAuthentication

Introduction
============
Expand Down Expand Up @@ -2828,6 +2829,10 @@ reordering of memory accesses and side effect instructions. Other instructions
like simple arithmetic may be reordered around the intrinsic. If you expect to
have no reordering at all, use inline assembly instead.

Pointer Authentication
^^^^^^^^^^^^^^^^^^^^^^
See :doc:`PointerAuthentication`.

X86/X86-64 Language Extensions
------------------------------

Expand Down
877 changes: 877 additions & 0 deletions clang/docs/PointerAuthentication.rst

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
/// space.
QualType removeAddrSpaceQualType(QualType T) const;

/// Return the "other" type-specific discriminator for the given type.
uint16_t getPointerAuthTypeDiscriminator(QualType T);

/// Apply Objective-C protocol qualifiers to the given type.
/// \param allowOnPointerType specifies if we can apply protocol
/// qualifiers on ObjCObjectPointerType. It can be set to true when
Expand Down Expand Up @@ -1983,6 +1986,16 @@ class ASTContext : public RefCountedBase<ASTContext> {
return getQualifiedType(type.getUnqualifiedType(), Qs);
}

/// \brief Return a type with the given __ptrauth qualifier.
QualType getPointerAuthType(QualType type, PointerAuthQualifier pointerAuth) {
assert(!type.getPointerAuth());
assert(pointerAuth);

Qualifiers qs;
qs.setPointerAuth(pointerAuth);
return getQualifiedType(type, qs);
}

unsigned char getFixedPointScale(QualType Ty) const;
unsigned char getFixedPointIBits(QualType Ty) const;
FixedPointSemantics getFixedPointSemantics(QualType Ty) const;
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/AST/GlobalDecl.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class GlobalDecl {
LHS.MultiVersionIndex == RHS.MultiVersionIndex;
}

bool operator!=(const GlobalDecl &Other) const {
return !(*this == Other);
}

void *getAsOpaquePtr() const { return Value.getOpaqueValue(); }

static GlobalDecl getFromOpaquePtr(void *P) {
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/AST/NonTrivialTypeVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ struct CopiedTypeVisitor {
return asDerived().visitARCStrong(FT, std::forward<Ts>(Args)...);
case QualType::PCK_ARCWeak:
return asDerived().visitARCWeak(FT, std::forward<Ts>(Args)...);
case QualType::PCK_PtrAuth:
return asDerived().visitPtrAuth(FT, std::forward<Ts>(Args)...);
case QualType::PCK_Struct:
return asDerived().visitStruct(FT, std::forward<Ts>(Args)...);
case QualType::PCK_Trivial:
Expand Down
46 changes: 46 additions & 0 deletions clang/include/clang/AST/StableHash.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//===--- StableHash.h - An ABI-stable string hash ---------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// The interface to an ABI-stable string hash algorithm.
//
//===----------------------------------------------------------------------===//

#ifndef CLANG_AST_STABLEHASH_H
#define CLANG_AST_STABLEHASH_H

#include <cstdint>

namespace llvm {
class StringRef;
}

namespace clang {
class ASTContext;

/// Compute a stable 64-bit hash of the given string.
///
/// The exact algorithm is the little-endian interpretation of the
/// non-doubled (i.e. 64-bit) result of applying a SipHash-2-4 using
/// a specific key value which can be found in the source.
///
/// By "stable" we mean that the result of this hash algorithm will
/// the same across different compiler versions and target platforms.
uint64_t getStableStringHash(llvm::StringRef string);

/// Compute a pointer-auth extra discriminator for the given string,
/// suitable for both the blend operation and the __ptrauth qualifier.
///
/// The result of this hash will be the same across different compiler
/// versions but may vary between targets due to differences in the
/// range of discriminators desired by the target.
uint64_t getPointerAuthStringDiscriminator(const ASTContext &ctx,
llvm::StringRef string);

} // end namespace clang

#endif
Loading