Skip to content
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 a preprocessor definitions to indidcate the landing pad labeling … #76

Draft
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

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

Example code:

#ifdef __riscv_landing_pad
  #if __riscv_landing_pad == __riscv_landing_pad_simple
    ...
  #elif __riscv_landing_pad == __riscv_landing_pad_func_sig
    ...
  #else
    #error "Unknown labeling scheme"
  #endif
#endif

riscv-c-api.md Outdated
Comment on lines 51 to 52
| __riscv_landing_pad_simple | 1 | Constant value for the simple labeling scheme. |
| __riscv_landing_pad_func_sig | 2 | Constant value for the function signature based labeling scheme. |
Copy link

@mylai-mtk mylai-mtk May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| __riscv_landing_pad_simple | 1 | Defined if the "simple" landing pad is in use. Constant value for the simple labeling scheme. |
| __riscv_landing_pad_func_sig | 2 | Defined if the "func_sig" landing pad is in use. Constant value for the function signature based labeling scheme. |

Add some conditions to spare the preprocessor from bloated macros?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if we are to limit when these macros are defined, why not just use:

#if defined(__riscv_zicfilp_landing_pad_simple)
...
#elif defined(__riscv_zicfilp_landing_pad_func_sig)
...
#endif

? This avoids more new macros, and it's clear when these macros would be defined, and when they would not.

Copy link
Collaborator Author

@kito-cheng kito-cheng Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, but I keep __riscv_landing_pad for now, we could remove that later...if that is not really used in anywhere :)

…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.

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