Skip to content

Add a preprocessor definitions to indidcate the landing pad labeling … #76

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kito-cheng
Copy link
Collaborator

@kito-cheng kito-cheng commented May 10, 2024

…scheme and shadow stack

  • __riscv_landing_pad: Defined if the landing pad is enabled.
  • __riscv_landing_pad_unlabeled: Defined if the unlabeled labeling scheme is enabled.
  • `__riscv_landing_pad_func_sig: Defined if the function signature based labeling scheme is enabled.
  • __riscv_shadow_stack: Defined if the shadow stack is enabled.

…scheme and shadow stack.

Also add 2 more macros to let user able to determine the scheme.

Example code:
```c
 #ifdef __riscv_landing_pad
   #if defined(__riscv_landing_pad_unlabeled)
     ...
   #elif defined(__riscv_landing_pad_func_sig)
     ...
   #else
     #error "Unknown labeling scheme"
   #endif
 #endif
```
@kito-cheng kito-cheng force-pushed the kitoc/riscv_landing_pad branch from 971a381 to 21882fa Compare September 23, 2024 14:16
@kito-cheng
Copy link
Collaborator Author

Changes:

  • Rebase to main, which rewrite as adoc format.
  • Rename __riscv_landing_pad_simple to __riscv_landing_pad_unlabeled.
  • Add __riscv_shadow_stack.

@kito-cheng kito-cheng marked this pull request as ready for review May 19, 2025 09:51
mylai-mtk added a commit to llvm/llvm-project that referenced this pull request May 19, 2025
…109600)

This patch adds preprocessor macros when Zicfilp CFI is enabled. To be
specific:

+ `#define __riscv_landing_pad 1` when `-fcf-protection=[full|branch]`
+ `#define __riscv_landing_pad_unlabeled 1` when
`-fcf-protection=[full|branch] -mcf-branch-label-scheme=unlabeled`

The macros are proposed in riscv-non-isa/riscv-c-api-doc#76 , and the
CLI flags are from riscv-non-isa/riscv-toolchain-conventions#54.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 19, 2025
…or macros (#109600)

This patch adds preprocessor macros when Zicfilp CFI is enabled. To be
specific:

+ `#define __riscv_landing_pad 1` when `-fcf-protection=[full|branch]`
+ `#define __riscv_landing_pad_unlabeled 1` when
`-fcf-protection=[full|branch] -mcf-branch-label-scheme=unlabeled`

The macros are proposed in riscv-non-isa/riscv-c-api-doc#76 , and the
CLI flags are from riscv-non-isa/riscv-toolchain-conventions#54.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants