-
Notifications
You must be signed in to change notification settings - Fork 240
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
Add %lpad_hash for Zicfilp #99
base: main
Are you sure you want to change the base?
Conversation
Zicfilp has provided two labeling schemes: simple and complex (also known as function signature-based). The simple scheme uses an lpad with a constant 0, which does not require any hashing mechanism. In contrast, the complex labeling scheme computes the MD5 hash from the signature string. Filling up an MD5 hash value is straightforward for compilers, but it is non-trivial work for humans to maintain. Therefore, we have added new assembler modifiers to compute this value. See also: riscv/riscv-cfi#151
@@ -397,9 +397,10 @@ linker relaxation accidentally if user already disable linker relaxation. | |||
|
|||
Push/pop current options to/from the options stack. | |||
|
|||
## Assembler Relocation Functions | |||
## Assembler Modifiers |
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 term is learned from GNU as manual https://sourceware.org/binutils/docs/as/RISC_002dV_002dModifiers.html
Actually, I wonder if this would turn out to be useful, since the function signature string format is (for now) drafted to be the mangled string of the function type, which IMHO is not human-friendly enough to be written/read correctly by a human programmer. Also, AFAIK, there's no convenient tool to mangle function signatures to strings, despite the widespread usage of To get a feel: Though I doubt the usefulness of this |
Should we add a modifier that takes the function prototype string instead of mangled string as input - like %lpad_hash_proto("void (*f)(int, char)"). |
I guess this would be a huge effort for assemblers to implement, since they do not know anything about the C/C++ language, so the corresponding C parser and C++ mangler would need to be pulled in, which is a big cost for a minor convenient feature like this. |
NOTE: This PR will keep in draft state until toolchain PoC and psABI spec ready.
Zicfilp has provided two labeling schemes: simple and complex (also known as function signature-based). The simple scheme uses an lpad with a constant 0, which does not require any hashing mechanism. In contrast, the complex labeling scheme computes the MD5 hash from the signature string.
Filling up an MD5 hash value is straightforward for compilers, but it is non-trivial work for humans to maintain. Therefore, we have added new assembler modifiers to compute this value.
See also: riscv/riscv-cfi#151