OP-TEE / optee_os

Trusted side of the TEE
Other
1.59k stars 1.07k forks source link

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

Closed vincent-mailhol closed 4 days ago

vincent-mailhol commented 1 week ago

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: e3fb2bd005f ("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.

jenswi-linaro commented 5 days ago

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

vincent-mailhol commented 5 days ago

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

Thanks for the acknowledgement. Tag applied in d93b65367495f7457ed66b1d3feeb59676cc6841.