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

compiler.h: only use __no_stack_protector if supported by the compiler #7118

Merged

Conversation

vincent-mailhol
Copy link
Contributor

@vincent-mailhol vincent-mailhol commented Nov 8, 2024

The __attribute__((no_stack_protector)) was introduced in GCC 11. Building a TA with an older version of GCC would trigger a -Wattributes warning on the ta/user_ta_header.c file.

Use __has_attribute() to check for the support of the no_stack_protector attribute before using it. If not supported, define the __no_stack_protector alias as a NOP.

Fixes: e3fb2bd ("compiler.h: add __no_stack_protector")

Note: This no_stack_protector is the only troublesome attribute in my set up (GCC 9.4.0). Let me know if you want to also add a __has_attribute() guard to the other attributes and I will do so.

@vincent-mailhol vincent-mailhol force-pushed the check_for_no-stack-protector-support branch 2 times, most recently from bca8821 to 8fdcb76 Compare November 9, 2024 04:19
@jenswi-linaro
Copy link
Contributor

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

The __attribute__((no_stack_protector)) was introduced in GCC 11.
Building a TA with a version of GCC older than that would trigger a
-Wattributes warning on the ta/user_ta_header.c file.

Use __has_attribute() to check support of the no_stack_protector
attribute before using it. If not supported, define the
__no_stack_protector alias as a NOP.

Fixes: e3fb2bd ("compiler.h: add __no_stack_protector")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
@vincent-mailhol vincent-mailhol force-pushed the check_for_no-stack-protector-support branch from 8fdcb76 to d93b653 Compare November 11, 2024 10:38
@vincent-mailhol
Copy link
Contributor Author

vincent-mailhol commented Nov 11, 2024

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>

Thanks for the acknowledgement. Tag applied in d93b653.

@jforissier jforissier merged commit 9962720 into OP-TEE:master Nov 12, 2024
9 checks passed
@vincent-mailhol vincent-mailhol deleted the check_for_no-stack-protector-support branch November 12, 2024 11:37
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.

3 participants