aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorDaniil Kovalev <dkovalev@accesssoftek.com>2024-03-01 19:48:08 +0300
committerGitHub <noreply@github.com>2024-03-01 19:48:08 +0300
commit8f65e7b917c580d1b58b024db6fc889cbcd964c7 (patch)
tree2c06e3b0bdb19bbec253c351e5caf5d54282dad9 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent8fa33013de5d2c47da93083642cf9f655a3d9722 (diff)
downloadllvm-8f65e7b917c580d1b58b024db6fc889cbcd964c7.zip
llvm-8f65e7b917c580d1b58b024db6fc889cbcd964c7.tar.gz
llvm-8f65e7b917c580d1b58b024db6fc889cbcd964c7.tar.bz2
[Dwarf] Support `__ptrauth` qualifier in metadata nodes (#82363)
Emit `__ptrauth`-qualified types as `DIDerivedType` metadata nodes in IR with tag `DW_TAG_LLVM_ptrauth_type`, baseType referring to the type which has the qualifier applied, and the following parameters representing the signing schema: - `ptrAuthKey` (integer) - `ptrAuthIsAddressDiscriminated` (boolean) - `ptrAuthExtraDiscriminator` (integer) - `ptrAuthIsaPointer` (boolean) - `ptrAuthAuthenticatesNullValues` (boolean) Co-authored-by: Ahmed Bougacha <ahmed@bougacha.org>
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 656f2a6..85319dc 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1804,6 +1804,11 @@ void ModuleBitcodeWriter::writeDIDerivedType(const DIDerivedType *N,
Record.push_back(VE.getMetadataOrNullID(N->getAnnotations().get()));
+ if (auto PtrAuthData = N->getPtrAuthData())
+ Record.push_back(PtrAuthData->Payload.RawData);
+ else
+ Record.push_back(0);
+
Stream.EmitRecord(bitc::METADATA_DERIVED_TYPE, Record, Abbrev);
Record.clear();
}