[clang] [clang] Fix a crash when dynamic_cast-ing to a `final` class (PR #148088)

2025-07-15 Thread Oliver Hunt via cfe-commits
@@ -2341,8 +2341,15 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(Address ThisAddr, } else if (IsExact) { // If the destination type is effectively final, this pointer points to the // right type if and only if its vptr has the right value. -Value = CGM.getCXX

[clang] [clang] Update diagnostics and documentation for type aware allocators (PR #148576)

2025-07-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt edited https://github.com/llvm/llvm-project/pull/148576 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Update diagnostics for type aware allocators (PR #148576)

2025-07-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Please update `clang/docs/LanguageExtensions.rst`. Good point, also as it got dropped from C++26 I'm restoring and updating the in tree docs as well. https://github.com/llvm/llvm-project/pull/148576 ___ cfe-commits mailing list cfe-co

[clang] [clang] Update diagnostics for type aware allocators (PR #148576)

2025-07-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/148576 >From d86fea4e16dc9962f87a8969e74b62767476ec30 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 14 Jul 2025 00:26:08 -0700 Subject: [PATCH 1/3] [clang] Update diagnostics for type aware allocators Alas refl

[clang] [clang] Update diagnostics for type aware allocators (PR #148576)

2025-07-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/148576 >From d86fea4e16dc9962f87a8969e74b62767476ec30 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 14 Jul 2025 00:26:08 -0700 Subject: [PATCH 1/2] [clang] Update diagnostics for type aware allocators Alas refl

[clang] [clang] Update diagnostics for type aware allocators (PR #148576)

2025-07-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/148576 Alas reflection pushed p2719 out of C++26, so this PR changes the diagnostics to reflect that for now type aware allocation is functionally a clang extension. >From d86fea4e16dc9962f87a8969e74b62767476ec30 Mon S

[clang] [clang] Fix a crash when dynamic_cast-ing to a `final` class (PR #148088)

2025-07-13 Thread Oliver Hunt via cfe-commits
@@ -2341,8 +2341,15 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(Address ThisAddr, } else if (IsExact) { // If the destination type is effectively final, this pointer points to the // right type if and only if its vptr has the right value. -Value = CGM.getCXX

[clang] [clang][ObjC][PAC] Add ptrauth protections to objective-c (PR #147899)

2025-07-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/147899 >From 0d38b0d9b153bfb55c199d3bb4b6cdca2f708af9 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 9 Jul 2025 17:30:48 -0700 Subject: [PATCH 1/4] [clang][ObjC][PAC] Add ptrauth protections to objective-c This

[clang] [clang][ObjC][PAC] Add ptrauth protections to objective-c (PR #147899)

2025-07-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/147899 >From 0d38b0d9b153bfb55c199d3bb4b6cdca2f708af9 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 9 Jul 2025 17:30:48 -0700 Subject: [PATCH 1/3] [clang][ObjC][PAC] Add ptrauth protections to objective-c This

[clang] [clang][ObjC][PAC] Add ptrauth protections to objective-c (PR #147899)

2025-07-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/147899 >From 0d38b0d9b153bfb55c199d3bb4b6cdca2f708af9 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 9 Jul 2025 17:30:48 -0700 Subject: [PATCH 1/2] [clang][ObjC][PAC] Add ptrauth protections to objective-c This

[clang] [clang][ObjC][PAC] Add ptrauth protections to objective-c (PR #147899)

2025-07-10 Thread Oliver Hunt via cfe-commits
ojhunt wrote: dammit habitually force pushed a squash and rebase. #skilled. https://github.com/llvm/llvm-project/pull/147899 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ObjC][PAC] Add ptrauth protections to objective-c (PR #147899)

2025-07-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/147899 >From 0d38b0d9b153bfb55c199d3bb4b6cdca2f708af9 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 9 Jul 2025 17:30:48 -0700 Subject: [PATCH] [clang][ObjC][PAC] Add ptrauth protections to objective-c This PR i

[clang] [clang] Fixes #138823 (PR #147938)

2025-07-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/147938 Make sure to mark a concept decl as being invalid if the constraint is invalid. >From 8beb2eeab5270df51408d233d90d89be735b1828 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 10 Jul 2025 03:57:32 -0700 Sub

[clang] [clang][ObjC][PAC] Add ptrauth protections to objective-c (PR #147899)

2025-07-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/147899 >From 3b0a91c3d4a4ae8ec7980d2201d94f59746fb769 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 9 Jul 2025 17:30:48 -0700 Subject: [PATCH] [clang][ObjC][PAC] Add ptrauth protections to objective-c This PR i

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-27 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Re: the oracle concerns - there are some protections we have, but in general I think the current pointer auth semantics/diagnostics make it too easy to silently introduce oracles. Additionally a lot of the current unwind pointerauth work is focused on protecting the ABI boundarie

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-25 Thread Oliver Hunt via cfe-commits
ojhunt wrote: I'll be back to working on this later today - there's a pile of feedback, and a bunch of nonsense that I managed to accidentally accrue and/or re-format when pushing the PR so it will take a little time to unbreak that. It may be easiest to force push a repaired PR first and then

[clang] [Clang] Fix replaceability/relocatability computation (PR #145655)

2025-06-25 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt approved this pull request. r=me https://github.com/llvm/llvm-project/pull/145655 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @vbvictor super sorry, I'm feeling quite sick so can't really read the PR today, will probably not get to it until tomorrow https://github.com/llvm/llvm-project/pull/144270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -30,6 +30,46 @@ EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, void *, PCONTEXT, _Unwind_Personality_Fn); #endif +#if __has_include() +#include +#endif + +#if defined(__APPLE__) && __has_feature(ptrauth_qualifier

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -1877,6 +1946,32 @@ inline Registers_arm64::Registers_arm64(const void *registers) { memcpy(_vectorHalfRegisters, static_cast(registers) + sizeof(GPRs), sizeof(_vectorHalfRegisters)); +#if __has_feature(ptrauth_calls) ojhunt wrote: - [

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -93,6 +98,13 @@ class _LIBUNWIND_HIDDEN Registers_x86 { uint32_t getEDI() const { return _registers.__edi; } void setEDI(uint32_t value) { _registers.__edi = value; } + typedef uint32_t reg_t; + typedef uint32_t link_reg_t; + void loadAndAuthenticateLin

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -1845,10 +1871,53 @@ class _LIBUNWIND_HIDDEN Registers_arm64 { uint64_t getSP() const { return _registers.__sp; } void setSP(uint64_t value) { _registers.__sp = value; } - uint64_t getIP() const { return _registers.__pc; } - void setIP(uint

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -1845,10 +1871,53 @@ class _LIBUNWIND_HIDDEN Registers_arm64 { uint64_t getSP() const { return _registers.__sp; } void setSP(uint64_t value) { _registers.__sp = value; } - uint64_t getIP() const { return _registers.__pc; } - void setIP(uint

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -83,7 +83,13 @@ __llvm_profile_iterate_data(const __llvm_profile_data *Data) { /* This method is only used in value profiler mock testing. */ COMPILER_RT_VISIBILITY void * __llvm_get_function_addr(const __llvm_profile_data *Data) { - return Data->FunctionPointer; + void

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -1845,10 +1871,53 @@ class _LIBUNWIND_HIDDEN Registers_arm64 { uint64_t getSP() const { return _registers.__sp; } void setSP(uint64_t value) { _registers.__sp = value; } - uint64_t getIP() const { return _registers.__pc; } - void setIP(uint

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -83,7 +83,13 @@ __llvm_profile_iterate_data(const __llvm_profile_data *Data) { /* This method is only used in value profiler mock testing. */ COMPILER_RT_VISIBILITY void * __llvm_get_function_addr(const __llvm_profile_data *Data) { - return Data->FunctionPointer; + void

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -694,7 +705,12 @@ DEFINE_LIBUNWIND_FUNCTION(__libunwind_Registers_arm64_jumpto) gcspushm x30 Lnogcs: #endif + +#if __has_feature(ptrauth_calls) + retab +#else ojhunt wrote: see earlier comment - do we want to just adopt a single flag instead of the cur

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-18 Thread Oliver Hunt via cfe-commits
@@ -1877,6 +1946,32 @@ inline Registers_arm64::Registers_arm64(const void *registers) { memcpy(_vectorHalfRegisters, static_cast(registers) + sizeof(GPRs), sizeof(_vectorHalfRegisters)); +#if __has_feature(ptrauth_calls) + uint64_t pcRegister = 0; + memcp

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-18 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Converting to draft so I don't accidentally hit the big green commit button (that is big and green despite no approvals ?!?!) https://github.com/llvm/llvm-project/pull/144420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-18 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt converted_to_draft https://github.com/llvm/llvm-project/pull/144420 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-18 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > It is very common for type traits to factor into the ABI of a template > specialization, such that `my_variant` has a different layout depending on > `is_amazing_v`. That is why changing the value of a type trait generally > has to be considered an ABI break. ah right, it's no

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-17 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > I think we should make a point of implementing this for address-discriminated > `__ptrauth` qualifiers before we release it, because changing the type trait > in a future release will be an ABI break. I had been talking to @cor3ntin and decided we could do it later as this is a

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-17 Thread Oliver Hunt via cfe-commits
@@ -4467,17 +4467,25 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, case Builtin::BI__builtin_trivially_relocate: case Builtin::BImemmove: case Builtin::BI__builtin_memmove: { +QualType CopiedType = E->getArg(0)->getType()->getPoi

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-16 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/144420 >From b43a7e9295dfdbe0a11fb7dff669b82d8ed0630c Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 16 Jun 2025 20:48:57 +0300 Subject: [PATCH 1/2] [clang][PAC] Support trivially_relocating polymorphic objects

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-16 Thread Oliver Hunt via cfe-commits
@@ -420,6 +420,222 @@ void CodeGenFunction::EmitPointerAuthCopy(PointerAuthQualifier Qual, QualType T, Builder.CreateStore(Value, DestAddress); } +static const ConstantArrayType *tryGetTypeAsConstantArrayType(QualType T) { + if (!T->isConstantArrayType()) +return nullp

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-16 Thread Oliver Hunt via cfe-commits
@@ -1727,6 +1727,11 @@ ASTContext::PointerAuthContent ASTContext::findPointerAuthContent(QualType T) { T = T.getCanonicalType(); if (T.hasAddressDiscriminatedPointerAuth()) return PointerAuthContent::AddressDiscriminatedData; + + T = getBaseElementType(T).getCanonical

[clang] [clang][PAC] Support trivially_relocating polymorphic objects (PR #144420)

2025-06-16 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/144420 Adds support for trivial relocation of polymorphic objects with address discriminated vtable pointers. This is implemented as a post-memmove fixup pass over the impacted objects. We do this by traversing the ob

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-16 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > LLVM Buildbot has detected a new failure on builder > `ppc64le-flang-rhel-clang` running on `ppc64le-flang-rhel-test` while > building `clang` at step 6 "test-build-unified-tree-check-flang". > > Full details are available at: > https://lab.llvm.org/buildbot/#/builders/157/bui

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-16 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/143969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-16 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/7] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-16 Thread Oliver Hunt via cfe-commits
@@ -629,25 +629,46 @@ class ASTContext : public RefCountedBase { void setRelocationInfoForCXXRecord(const CXXRecordDecl *, CXXRecordDeclRelocationInfo); - /// Examines a given type, and returns whether the T itself + /// Examines a give

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-16 Thread Oliver Hunt via cfe-commits
@@ -629,25 +629,46 @@ class ASTContext : public RefCountedBase { void setRelocationInfoForCXXRecord(const CXXRecordDecl *, CXXRecordDeclRelocationInfo); - /// Examines a given type, and returns whether the T itself + /// Examines a give

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-16 Thread Oliver Hunt via cfe-commits
@@ -629,25 +629,46 @@ class ASTContext : public RefCountedBase { void setRelocationInfoForCXXRecord(const CXXRecordDecl *, CXXRecordDeclRelocationInfo); - /// Examines a given type, and returns whether the T itself + /// Examines a give

[clang] [clang][bytecode] Fix calling operator new with nothrow/align parameter (PR #144271)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt approved this pull request. Looks reasonable to me -- I spent a bunch of time trying to induce some case where this would do the wrong thing and I couldn't come up with anything as all the failure modes that would be possible outside of constexpr already fail in const

[clang] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-15 Thread Oliver Hunt via cfe-commits
@@ -2753,10 +2753,18 @@ static bool resolveAllocationOverloadInterior( if (Diagnose) { // If this is an allocation of the form 'new (p) X' for some object // pointer p (or an expression that will decay to such a pointer), - // diagnose the missing inclusion

[clang] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt requested changes to this pull request. https://github.com/llvm/llvm-project/pull/144270 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Improve diagnostics for 'placement new' with const storage argument (PR #144270)

2025-06-15 Thread Oliver Hunt via cfe-commits
@@ -2753,10 +2753,18 @@ static bool resolveAllocationOverloadInterior( if (Diagnose) { // If this is an allocation of the form 'new (p) X' for some object // pointer p (or an expression that will decay to such a pointer), - // diagnose the missing inclusion

[clang] [Clang] Fix typo in is_replaceable diagnostic (PR #144247)

2025-06-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Sure thing :D https://github.com/llvm/llvm-project/pull/144247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix typo in is_replaceable diagnostic (PR #144247)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/144247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix typo in is_replaceable diagnostic (PR #144247)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/144247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/6] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/5] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: found how to unmark the approval as the next update will change this fairly substantially https://github.com/llvm/llvm-project/pull/143969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Actually I've given this a lot of thought, I think we should not consider explicitly __ptrauth qualified types to be relocatable, how does that sound? https://github.com/llvm/llvm-project/pull/143969 ___ cfe-commits mailing list cfe-comm

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Very glad I didn't just assume my local build was sufficient and waited for the bots :D https://github.com/llvm/llvm-project/pull/143969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listi

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/4] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/3] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -628,10 +628,13 @@ class ASTContext : public RefCountedBase { getRelocationInfoForCXXRecord(const CXXRecordDecl *) const; void setRelocationInfoForCXXRecord(const CXXRecordDecl *, CXXRecordDeclRelocationInfo); + bool containsAddressD

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -15121,6 +15155,21 @@ ASTContext::baseForVTableAuthentication(const CXXRecordDecl *ThisClass) { return PrimaryBase; } +bool ASTContext::hasAddressDiscriminatedVTableAuthentication( ojhunt wrote: Which function? https://github.com/llvm/llvm-project/pull

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -1705,6 +1705,40 @@ void ASTContext::setRelocationInfoForCXXRecord( RelocatableClasses.insert({D, Info}); } +bool ASTContext::containsAddressDiscriminatedPointerAuth(QualType T) { + if (!LangOpts.PointerAuthCalls && !LangOpts.PointerAuthIntrinsics) +return false; + +

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt edited https://github.com/llvm/llvm-project/pull/143969 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/2] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143969 >From f47680310ed68a9f8e8cb15bc1cd474740072463 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 12 Jun 2025 13:17:11 -0700 Subject: [PATCH 1/2] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -557,7 +596,19 @@ set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context, reinterpret_cast(unwind_exception)); _Unwind_SetGR(context, __builtin_eh_return_data_regno(1), static_cast(results.ttypeIndex)); +#if defined(__A

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -807,7 +812,12 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext) strd31, [x0, #0x208] #endif movx0, #0 // return UNW_ESUCCESS + +#if __has_feature(ptrauth_calls) + retab +#else ojhunt wrote: This is what we have downstream, i

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -126,6 +130,36 @@ _LIBUNWIND_HIDDEN int __unw_set_reg(unw_cursor_t *cursor, unw_regnum_t regNum, // First, get the FDE for the old location and then update it. co->getInfo(&info); co->setInfoBasedOnIPRegister(false); + +#if __has_feature(ptrauth_calls) +

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -32,22 +32,23 @@ #endif #if defined(_WIN32) - #if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCXXABI_BUILDING_LIBRARY)) - #define _LIBCXXABI_HIDDEN - #define _LIBCXXABI_DATA_VIS - #define _LIBCXXABI_FUNC_VIS - #define _LI

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -32,22 +32,23 @@ #endif #if defined(_WIN32) - #if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCXXABI_BUILDING_LIBRARY)) - #define _LIBCXXABI_HIDDEN - #define _LIBCXXABI_DATA_VIS - #define _LIBCXXABI_FUNC_VIS - #define _LI

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)

2025-06-12 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/143969 This adds a function to ASTContext to query whether a type contains values with address discriminated pointer auth, and performs the required semantic checks to ensure correct reporting of relocatablity in those

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-12 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/143796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-12 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Closing this PR because there's a lot of noise in it that is just completely reverted/gone at this point. https://github.com/llvm/llvm-project/pull/143796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -292,77 +294,129 @@ Sema::CheckCXX2CRelocatableAndReplaceable(const CXXRecordDecl *D) { return HasSuitableSMP(); // is a union with no user-declared special member functions, or -if (IsUnion()) +if (IsTrivialUnion()) return HasSuitableSMP();

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -292,77 +294,129 @@ Sema::CheckCXX2CRelocatableAndReplaceable(const CXXRecordDecl *D) { return HasSuitableSMP(); // is a union with no user-declared special member functions, or -if (IsUnion()) +if (IsTrivialUnion()) return HasSuitableSMP();

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -10615,7 +10615,7 @@ void Sema::checkIllFormedTrivialABIStruct(CXXRecordDecl &RD) { } } - if (IsCXXTriviallyRelocatableType(RD)) + if (CheckCXX2CRelocatableAndReplaceable(&RD).IsRelocatable) ojhunt wrote: I think I did restore it for QualType an

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-12 Thread Oliver Hunt via cfe-commits
@@ -621,17 +621,24 @@ class ASTContext : public RefCountedBase { public: struct CXXRecordDeclRelocationInfo { +static CXXRecordDeclRelocationInfo NonRelocatable() { + return {false, false}; +} + unsigned IsRelocatable; unsigned IsReplaceable; -

[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143796)

2025-06-11 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/143796 This reworks the way we compute relocatability and replaceability of types. We do this by having a single interface the provides a full `TypeRelocationInfo` for a QualType. This simplifies the reasoning for all

[clang] [clang][PAC] add support for options parameter to __ptrauth (PR #136828)

2025-06-11 Thread Oliver Hunt via cfe-commits
@@ -65,6 +65,17 @@ enum class PointerAuthenticationMode : unsigned { SignAndAuth }; +static constexpr llvm::StringLiteral PointerAuthenticationOptionStrip = "strip"; ojhunt wrote: ah so what @erichkeane was suggesting is that places needing the string woul

[clang] [Clang] _default-movable_ should be based on the first declaration (PR #143661)

2025-06-11 Thread Oliver Hunt via cfe-commits
@@ -121,8 +121,10 @@ static bool hasSuitableConstructorForRelocation(Sema &SemaRef, CXXMethodDecl *Decl = LookupSpecialMemberFromXValue(SemaRef, D, /*Assign=*/false); ojhunt wrote: Is it reasonable to have LookupSpecialMemberFromXValue simply return

[clang] [clang][NFC] Remove dead PassTypeToPlacementDelete field (PR #143448)

2025-06-09 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Thank you for the fix! sorry for the delay, just completely forgot about it https://github.com/llvm/llvm-project/pull/143448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [clang][NFC] Remove dead PassTypeToPlacementDelete field (PR #143448)

2025-06-09 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/143448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RFC] Initial implementation of P2719 (PR #113510)

2025-06-09 Thread Oliver Hunt via cfe-commits
@@ -1434,10 +1446,13 @@ namespace { QualType ArgType; }; -unsigned NumPlacementArgs : 31; -LLVM_PREFERRED_TYPE(bool) +unsigned NumPlacementArgs : 30; +LLVM_PREFERRED_TYPE(AlignedAllocationMode) unsigned PassAlignmentToPlacementDelete : 1; +LL

[clang] [clang][NFC] Remove dead PassTypeToPlacementDelete field (PR #143448)

2025-06-09 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/143448 The CallDeleteDuringNew::PassTypeToPlacementDelete field became unneeded during the many refactorings of P2719 but I didn't actually remove it. >From c1fa0ea448210ab10e71bd7b2f4dc4d575056b39 Mon Sep 17 00:00:00

[clang] [RFC] Initial implementation of P2719 (PR #113510)

2025-06-09 Thread Oliver Hunt via cfe-commits
@@ -1434,10 +1446,13 @@ namespace { QualType ArgType; }; -unsigned NumPlacementArgs : 31; -LLVM_PREFERRED_TYPE(bool) +unsigned NumPlacementArgs : 30; +LLVM_PREFERRED_TYPE(AlignedAllocationMode) unsigned PassAlignmentToPlacementDelete : 1; +LL

[clang] [Clang] Fix a crash when diagnosing a non relocatable with no copy ctr (PR #143350)

2025-06-09 Thread Oliver Hunt via cfe-commits
@@ -2052,7 +2052,7 @@ static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef, } if (!D->hasSimpleMoveConstructor() && !D->hasSimpleCopyConstructor()) { -const auto *Decl = cast( +const auto *Decl = cast_or_null( ojhunt wrote: I didn't re

[clang] [Clang] Fix a crash when diagnosing a non relocatable with no copy ctr (PR #143350)

2025-06-09 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt edited https://github.com/llvm/llvm-project/pull/143350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix a crash when diagnosing a non relocatable with no copy ctr (PR #143350)

2025-06-09 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt approved this pull request. Looks good https://github.com/llvm/llvm-project/pull/143350 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-08 Thread Oliver Hunt via cfe-commits
ojhunt wrote: unused variable errors are likely fallout from refactoring and workaround removals I did as part of the prep, will do some cleanup/diagnostics work later this week. I mostly wanted to get this available to others to see whether they were ok adopting this rather than rolling thei

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-06 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Updating formatting before review - had discussed with Louis and he expressed a preference for some of it, but this llvm.org style bot complains many other cases (likely a local config issue when I was trying to cleanup the downstream code. So I've updated with a direct clang-fo

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-06 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143230 >From 637245f9be6ed0163c9129d27a572f153b6f8523 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Fri, 6 Jun 2025 18:50:28 -0700 Subject: [PATCH] [runtimes][PAC] Harden unwinding when possible (#138571) This harde

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-06 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/143230 >From 68103962b254565fdfad069c350af90ede7109b4 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Fri, 6 Jun 2025 18:50:28 -0700 Subject: [PATCH] [runtimes][PAC] Harden unwinding when possible (#138571) This harde

[libunwind] [libunwind][AArch64] Protect PC within libunwind's context. (PR #113368)

2025-06-06 Thread Oliver Hunt via cfe-commits
ojhunt wrote: I've finally got our downstream hardening to the point where it should be sane: https://github.com/llvm/llvm-project/pull/143230 https://github.com/llvm/llvm-project/pull/113368 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

2025-06-06 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/143230 This hardens the unwinding logic and datastructures on systems that support pointer authentication. The approach taken to hardening is to harden the schemas of as many high value fields in the myriad structs as

[clang] [ubsan] Remove -fsanitizer=vptr from -fsanitizer=undefined (PR #121115)

2025-06-06 Thread Oliver Hunt via cfe-commits
ojhunt wrote: This obviously cases https://github.com/llvm/llvm-project/issues/143065 @AaronBallman @erichkeane @zygoloid commented in the RFC - this change regresses the checks in ubsan for default compilation modes in order to make the use of sanitize=undefined easier in non-default scenario

[clang] [clang][PAC] add support for options parameter to __ptrauth (PR #136828)

2025-06-06 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From 927380bdf377581e6e40507a12c374023352c613 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 30 Apr 2025 22:26:59 -0700 Subject: [PATCH 1/6] [clang][PAC] add support for options parameter to __ptrauth T

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-06-06 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/138482 >From ecea44f2965cda3a4e6e1ccec096066830ddfa41 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Sun, 4 May 2025 21:07:33 -0700 Subject: [PATCH 1/2] [clang][ptrauth] Add support for querying the ptrauth schema of

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-06-05 Thread Oliver Hunt via cfe-commits
@@ -605,6 +605,11 @@ KEYWORD(__private_extern__ , KEYALL) KEYWORD(__module_private__ , KEYALL) UNARY_EXPR_OR_TYPE_TRAIT(__builtin_ptrauth_type_discriminator, PtrAuthTypeDiscriminator, KEYALL) +UNARY_EXPR_OR_TYPE_TRAIT(__builtin_ptrauth_has_authentication, P

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-06-05 Thread Oliver Hunt via cfe-commits
@@ -9619,6 +9620,65 @@ ObjCInterfaceDecl *ASTContext::getObjCProtocolDecl() const { return ObjCProtocolClassDecl; } +std::optional +ASTContext::getExplicitOrImplicitPointerAuth(QualType T) { + auto ExplicitQualifier = T.getPointerAuth(); ojhunt wrote: god

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-06-05 Thread Oliver Hunt via cfe-commits
@@ -9619,6 +9620,65 @@ ObjCInterfaceDecl *ASTContext::getObjCProtocolDecl() const { return ObjCProtocolClassDecl; } +std::optional +ASTContext::getExplicitOrImplicitPointerAuth(QualType T) { + auto ExplicitQualifier = T.getPointerAuth(); ojhunt wrote: - [

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-06-05 Thread Oliver Hunt via cfe-commits
@@ -3981,7 +3981,9 @@ class Parser : public CodeCompletionHandler { ExprResult ParseArrayTypeTrait(); ExprResult ParseExpressionTrait(); + ExprResult ParseBuiltinUnaryExprOrTypeTrait(UnaryExprOrTypeTrait ExprKind); ojhunt wrote: ... if something like `Pa

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-06-05 Thread Oliver Hunt via cfe-commits
@@ -9619,6 +9620,65 @@ ObjCInterfaceDecl *ASTContext::getObjCProtocolDecl() const { return ObjCProtocolClassDecl; } +std::optional +ASTContext::getExplicitOrImplicitPointerAuth(QualType T) { + auto ExplicitQualifier = T.getPointerAuth(); + if (ExplicitQualifier.isPresent(

  1   2   3   4   5   6   >