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

Introduce new attribute norelax #94

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/c-api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,27 @@ Functions declared with this attribute will use to the standard vector calling
convention variant as defined in the RISC-V psABI, even if the function has
vector arguments or a return value.

=== norelax

Supported Syntaxes:
.Supported Syntaxes:
[%autowidth]
|===
|*Style* |*Syntax*
|GNU |`+__attribute__((norelax))+`
|C++11 |`+[[riscv::norelax]]+`
|C23 |`+[[riscv::norelax]]+`
|===

Functions declared with this attribute will not be relaxed by the linker.

NOTE: This can be implemented with `.option push; .option norelax; <function-body>; .option pop`.
NOTE: The use case for this attribute is to apply it to functions that may be invoked
at a very early stage of the process, when the GP may not be initialized properly at that
moment.
NOTE: Functions used as ifunc resolvers should use this attribute. The compiler
Copy link
Contributor

@cyyself cyyself Nov 13, 2024

Choose a reason for hiding this comment

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

NOTE: Functions used as ifunc resolvers should use this attribute.

Should be: Functions used as ifunc resolvers and all possible ifunc resolver callees should use this attribute.

may apply this to automatically generated ifunc resolvers.

== Intrinsic Functions

Intrinsic functions (or intrinsics or built-ins) are expanded into instruction sequences by compilers.
Expand Down