-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang][PAC] add support for options parameter to __ptrauth #136828
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
927380b
02bc476
5903e97
ef4a253
6b1501a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3606,9 +3606,9 @@ def ObjCRequiresPropertyDefs : InheritableAttr { | |
|
||
def PointerAuth : TypeAttr { | ||
let Spellings = [CustomKeyword<"__ptrauth">]; | ||
let Args = [IntArgument<"Key">, | ||
BoolArgument<"AddressDiscriminated", 1>, | ||
IntArgument<"ExtraDiscriminator", 1>]; | ||
let Args = [IntArgument<"Key">, BoolArgument<"AddressDiscriminated", 1>, | ||
IntArgument<"ExtraDiscriminator", 1>, | ||
StringArgument<"Options", 1>]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be an update to AttrDocs.td for the new argument? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll see if there's any existing documentation as the attribute can't be specified by attribute syntax There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the PointerAuthentication document |
||
let Documentation = [PtrAuthDocs]; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,17 @@ enum class PointerAuthenticationMode : unsigned { | |
SignAndAuth | ||
}; | ||
|
||
static constexpr llvm::StringLiteral PointerAuthenticationOptionStrip = "strip"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cor3ntin @AaronBallman is there a better/more idiomatic way of doing these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the language option level, I think it's more idiomatic to use an enumeration instead of string literals and doing string processing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd suggest doing a string-switch on it, then storing an enum in the AST. We can then print it/whatever on the way out. But a pair of conversion functions is typically all you should need. Though, it doesn't seem that these are leaving the Either way, LangOpts is a little bit of an odd place for this to live. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not stored as a string (or even an attribute), they're stored as flags and enums in the pointer auth qualifier on the type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was meaning "is there a more idiomatic way to have these string constants specified?" :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I hadn't included the updated to stringifying the qualifier so these were only used in one place. |
||
static constexpr llvm::StringLiteral PointerAuthenticationOptionSignAndStrip = | ||
"sign-and-strip"; | ||
static constexpr llvm::StringLiteral PointerAuthenticationOptionSignAndAuth = | ||
"sign-and-auth"; | ||
static constexpr llvm::StringLiteral PointerAuthenticationOptionIsaPointer = | ||
"isa-pointer"; | ||
static constexpr llvm::StringLiteral | ||
PointerAuthenticationOptionAuthenticatesNullValues = | ||
"authenticates-null-values"; | ||
|
||
/// Bitfields of LangOptions, split out from LangOptions in order to ensure that | ||
/// this large collection of bitfields is a trivial class type. | ||
class LangOptionsBase { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR does not actually provide the implementation of this option, as it touches a number of places unrelated to parsing the option.