xiaoxiang781216 commented on a change in pull request #1558:
URL: https://github.com/apache/incubator-nuttx/pull/1558#discussion_r468480368
##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -31,6 +31,10 @@ ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -O2 -fno-strict-aliasing
endif
+ifeq ($(CONFIG_STACK_CANARIES),y)
+ ARCHOPTIMIZATION += -fstack-protector-all
+endif
Review comment:
> i'm not sure if i get you intention.
>
> * do you mean to make HOSTSRCS to use nuttx ssp things
(libs/libc/stdlib/lib_stackchk.c) instead of the host provided ones? it sounds
awkward to me.
Yes, both HOSTSRCS and SRCS use libs/libc/stdlib/lib_stackchk.c. We can't
provide two implementation here because compiler hardcode the name of cookie
and funntion. gcc don't link toolchain's libssp.a by default, and libssp.a is
designed to be replaced by customer in mind. it's just like NuttX replace
toolchain's libc/libm.
> * how are those symbols resolved for MODULES and ELF?
Same as other normal libc function.
SSP is almost same as the old mechanism but very fast:
https://github.com/apache/incubator-nuttx/blob/master/arch/arm/src/armv7-m/arm_stackcheck.c
and can be implemented in the arch independent way.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]