Skip to content

Commit f962335

Browse files
committed
Address review feedback: clarify core info usage and use size() helper
- Added comments explaining the semantics of AArch64PauthAbiCoreInfo and the reserved (0, 0) value. - Replaced hardcoded sizeof(uint64_t) * 2 with AArch64PauthAbiCoreInfo::size().
1 parent e29b15b commit f962335

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lld/ELF/Config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,13 @@ enum class GcsPolicy { Implicit, Never, Always };
139139
// For some options that resemble -z bti-report={none,warning,error}
140140
enum class ReportPolicy { None, Warning, Error };
141141

142+
// Describes the signing schema for a file using the PAuth ABI extension.
143+
// Two files are considered compatible when both `platform` and `version` match.
144+
// The pair (0, 0) is reserved to indicate incompatibility with the PAuth ABI.
142145
struct AArch64PauthAbiCoreInfo {
143146
uint64_t platform;
144147
uint64_t version;
148+
// Returns true if the core info is not the reserved (0, 0) value.
145149
bool isValid() const { return platform || version; }
146150
static constexpr size_t size() { return sizeof(platform) + sizeof(version); }
147151
bool operator==(const AArch64PauthAbiCoreInfo &other) const {

lld/ELF/SyntheticSections.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ size_t GnuPropertySection::getSize() const {
357357
if (ctx.arg.andFeatures != 0)
358358
contentSize += ctx.arg.is64 ? 16 : 12;
359359
if (ctx.aarch64PauthAbiCoreInfo)
360-
contentSize += 4 + 4 + sizeof(uint64_t) * 2;
360+
contentSize += 4 + 4 + AArch64PauthAbiCoreInfo::size();
361361
assert(contentSize != 0);
362362
return contentSize + 16;
363363
}

0 commit comments

Comments
 (0)