[lld] [lld][GNU Properties] Refactor storage of PAuth ABI core info (PR #141920)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 06:49:22 PDT 2025
================
@@ -961,7 +961,11 @@ static void parseGnuPropertyNote(Ctx &ctx, ELFFileBase &f,
"is invalid: expected 16 bytes, but got "
<< size);
}
- f.aarch64PauthAbiCoreInfo = desc;
+ f.aarch64PauthAbiCoreInfo.emplace();
----------------
smithp35 wrote:
I don't think you need `emplace();` here.
Could
```
f.aarch64PauthAbiCoreInfo = { support::endian::read64<ELFT::Endianness>(&desc[0]), support::endian::read64<ELFT::Endianness>(&desc[8]) };
```
work.
Personally I think it is worth making aarch64PauthAbiCoreInfo a class with a constructor as there is an invariant that both of these fields need to be set. A constructor would enforce that.
Could also add a bool valid() const that could replace the calls:
```
(ctx.aarch64PauthAbiCoreInfo->aarch64PauthAbiPlatform != 0 ||
ctx.aarch64PauthAbiCoreInfo->aarch64PauthAbiVersion != 0)
```
https://github.com/llvm/llvm-project/pull/141920
More information about the llvm-commits
mailing list