toolchain: prepare to pass more additional CFLAGS via the wrapper
PATCH v2 1/5 toolchain: prepare to pass more additional CFLAGS via the wrapper
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
Currently, we pass the user-supplied so-called target optimisation flags to the wrapper.
We're going to have additional such CFLAGS to pass, so push-back the formatting loop to quote the options at the last moment.
--- toolchain/toolchain-wrapper.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
toolchain/toolchain-wrapper.mk +5 -3
@@ -16,11 +16,13 @@ endif TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' +TOOLCHAIN_WRAPPER_OPTS = \ + $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) + # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a # separate argument when used in execv() by the toolchain wrapper. -TOOLCHAIN_WRAPPER_OPTS = \ - $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma)) -TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)' +TOOLCHAIN_WRAPPER_ARGS += \ + -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(TOOLCHAIN_WRAPPER_OPTS),"$(f)"$(comma))' ifeq ($(BR2_CCACHE),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
Signature · 15 lines
2.17.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 2/5 toolchain: set the ssp gcc option in kconfig
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
Currently, we repeat all the SSP level selection deep down to the toolchain wrapper itself, where we eventually translate it to the actual SSP option to use. This is a bit redundant.
Additionally, we will want to check that the toolchain actually supports that option (for those toolchain where it was backported).
So, move the translation into kconfig, and add the qstrip'ed value to the additional flags passed to the wrapper. Add it before user-supplied opitons, to keep the previous behaviour (and allow anyone crazy-enough to override it with BR2_TARGET_OPTIMIZATION).
---
Changes v1 -> v2:
- use TOOLCHAIN_WRAPPER_OPTS (Arnout)
--- Config.in | 6 ++++++ toolchain/toolchain-wrapper.c | 9 --------- toolchain/toolchain-wrapper.mk | 9 +-------- 3 files changed, 7 insertions(+), 17 deletions(-)
Config.in +6 -0
@@ -764,6 +764,12 @@ config BR2_SSP_ALL endchoice +config BR2_SSP_OPTION + string + default "-fstack-protector" if BR2_SSP_REGULAR + default "-fstack-protector-strong" if BR2_SSP_STRONG + default "-fstack-protector-all" if BR2_SSP_ALL + comment "Stack Smashing Protection needs a toolchain w/ SSP" depends on !BR2_TOOLCHAIN_HAS_SSP
toolchain/toolchain-wrapper.c +0 -9
@@ -98,15 +98,6 @@ static char *predef_args[] = {#if defined(BR_MIPS_TARGET_BIG_ENDIAN ) || defined(BR_ARC_TARGET_BIG_ENDIAN ) "-EB",#endif -#ifdef BR_SSP_REGULAR - "-fstack-protector", -#endif -#ifdef BR_SSP_STRONG - "-fstack-protector-strong", -#endif -#ifdef BR_SSP_ALL - "-fstack-protector-all", -#endif #ifdef BR_ADDITIONAL_CFLAGS BR_ADDITIONAL_CFLAGS#endif
toolchain/toolchain-wrapper.mk +1 -8
@@ -17,6 +17,7 @@ TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' TOOLCHAIN_WRAPPER_OPTS = \ + $(call qstrip,$(BR2_SSP_OPTION)) \ $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
@@ -53,14 +54,6 @@ else ifeq ($(BR2_RELRO_FULL),y) TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_FULL endif -ifeq ($(BR2_SSP_REGULAR),y) -TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_REGULAR -else ifeq ($(BR2_SSP_STRONG),y) -TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_STRONG -else ifeq ($(BR2_SSP_ALL),y) -TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_ALL -endif - define TOOLCHAIN_WRAPPER_BUILD $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
Signature · 15 lines
2.17.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 3/5 toolchain: check the SSP option is known
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
Some toolchain vendors may have backported those options to older gcc versions, and we have no way to know, so we have to check that the user's selection is acceptable.
Extend the macro that currently checks for SSP in the toolchain, with a new test that the actual SSP option is recognised and accepted.
Note that the SSP option is either totaly empty, or an already-quoted string, so we can safely and easily assign it to a shell variable to test and use it.
Note that we do not introduce BR2_TOOLCHAIN_HAS_SSP_STRONG, because:
- our internal toolchain infra only supports gcc >= 4.9, so it has
SSP strong;
- of the external pre-built toolchains, only the codesourcery-arm one has a gcc-4.8 which lacks SSP strong, all the others have a gcc >= 4.9;
- we'd still have to do the actual check for custom external toolchains anyway.
So, we're not adding BR2_TOOLCHAIN_HAS_SSP_STRONG just for a single case.
---
Changes v1 -> v2:
- expand the commit log to explain why we're not adding BR2_TOOLCHAIN_HAS_SSP_STRONG (Arnout)
--- toolchain/helpers.mk | 8 ++++++++ toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
toolchain/helpers.mk +8 -0
@@ -415,6 +415,7 @@ check_unusable_toolchain = \ # Check if the toolchain has SSP (stack smashing protector) support # # $1: cross-gcc path +# $2: gcc ssp option # check_toolchain_ssp = \ __CROSS_CC=$(strip $1) ; \
@@ -427,6 +428,13 @@ check_toolchain_ssp = \ echo "SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ exit 1 ; \ fi ; \ + __SSP_OPTION=$(2); \ + if [ -n "$${__SSP_OPTION}" ] ; then \ + if ! echo 'void main(){}' | $${__CROSS_CC} -Werror $${__SSP_OPTION} -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 ; then \ + echo "SSP option $${__SSP_OPTION} not available in this toolchain, please select another SSP level" ; \ + exit 1 ; \ + fi; \ + fi; \ rm -f $(BUILD_DIR)/.br-toolchain-test.tmp* #
toolchain/toolchain-external/pkg-toolchain-external.mk +1 -1
@@ -549,7 +549,7 @@ define $(2)_CONFIGURE_CMDS else \ $$(call check_glibc,$$$${SYSROOT_DIR}) ; \ fi - $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC)) + $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC),$(BR2_SSP_OPTION)) endef $(2)_TOOLCHAIN_WRAPPER_ARGS += $$(TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS)
Signature · 15 lines
2.17.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 4/5 toolchain: -fstack-protector-strong can be back-ported
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
Currently, use of -fstack-protector-strong is only available for gcc starting with 4.9, on the assumption that it appeared with that version.
Although this is true, it happens that quite a few vendors will have back-ported -fstack-protector-strong to older gcc versions (at least 4.8 seen in the wild).
Remove the guard against gcc>=4.9, and expand the help text.
---
Notes:
We could have changed the guard to something like:
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || BR2_TOOLCHAIN_EXTERNAL
However, the latest gcc we support in the internal toolchain *is* gcc-4.9, so the condition would have always been true. Hence, we just drop the condition.
--- Config.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Config.in +3 -3
@@ -746,14 +746,14 @@ config BR2_SSP_REGULAR config BR2_SSP_STRONG bool "-fstack-protector-strong" - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 help Like -fstack-protector but includes additional functions to be protected - those that have local array definitions, or have references to local frame addresses. -comment "Stack Smashing Protection strong needs a toolchain w/ gcc >= 4.9" - depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + -fstack-protector-strong officially appeared in gcc 4.9, but + some vendors have backported -fstack-protector-strong to older + versions of gcc. config BR2_SSP_ALL bool "-fstack-protector-all"
Signature · 15 lines
2.17.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 5/5 toolchain: allow PIC/PIE without RELRO
In reply to a message not in the archiveFrom: "Yann E. MORIN" <[email protected]>
In commit 7484c1c3b806 (toolchain/toolchain-wrapper: add BR2_RELRO_), we added the PIC/PIE flags, but based on the RELRO_FULL condition.
It is however totally possible to do a PIC/PIE executable without RELRO_FULL, as it is also valid to do a PIC/PIE build with RELRO_PARTIAL.
Add a new option that now governs the PIC/PIE flags.
Note: it is unknown if RELRO_FULL really needs PIC/PIE or not, so we keep the current situation, where RELRO-FULL forces PIC/PIE compilation. Decoupling can come later from an interested party.
--- Config.in | 8 ++++++++ toolchain/toolchain-wrapper.c | 2 +- toolchain/toolchain-wrapper.mk | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-)
Config.in +8 -0
@@ -712,6 +712,13 @@ endmenu comment "Security Hardening Options" +config BR2_PIC_PIE + bool "Build code with PIC/PIE" + depends on BR2_SHARED_LIBS + help + Generate Position-Independent Code (PIC) and link + Position-Independent Executables (PIE). + choice bool "Stack Smashing Protection" default BR2_SSP_ALL if BR2_ENABLE_SSP # legacy
@@ -794,6 +801,7 @@ config BR2_RELRO_PARTIAL config BR2_RELRO_FULL bool "Full" + select BR2_PIC_PIE help This option includes the partial configuration, but also marks the GOT as read-only at the cost of initialization time during
toolchain/toolchain-wrapper.c +1 -1
@@ -367,7 +367,7 @@ int main(int argc, char **argv) *cur++ ="-Wno-builtin-macro-redefined" ; } -#ifdef BR2_RELRO_FULL +#ifdef BR2_PIC_PIE /* Patterned after Fedora/Gentoo hardening approaches. * https://fedoraproject.org/wiki/Changes/Harden_All_Packages * https://wiki.gentoo.org/wiki/Hardened/Toolchain#Position_Independent_Executables_.28PIEs.29
toolchain/toolchain-wrapper.mk +4 -0
@@ -48,6 +48,10 @@ ifeq ($(BR2_CCACHE_USE_BASEDIR),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_BASEDIR='"$(BASE_DIR)"' endif +ifeq ($(BR2_PIC_PIE),y) +TOOLCHAIN_WRAPPER_ARGS += -DBR2_PIC_PIE +endif + ifeq ($(BR2_RELRO_PARTIAL),y) TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_PARTIAL else ifeq ($(BR2_RELRO_FULL),y)
Signature · 15 lines
2.17.1 _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 2/5 toolchain: set the ssp gcc option in kconfig
In reply to yann.morin at orange.comYann,
Quoted 36 lines · On Tue, Mar 12, 2019 at 7:10 AM <[email protected]> wrote:
From: "Yann E. MORIN" <[email protected]>
Currently, we repeat all the SSP level selection deep down to the toolchain wrapper itself, where we eventually translate it to the actual SSP option to use. This is a bit redundant.
Additionally, we will want to check that the toolchain actually supports that option (for those toolchain where it was backported).
So, move the translation into kconfig, and add the qstrip'ed value to the additional flags passed to the wrapper. Add it before user-supplied opitons, to keep the previous behaviour (and allow anyone crazy-enough to override it with
BR2_TARGET_OPTIMIZATION).Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>---
Changes v1 -> v2:
- useTOOLCHAIN_WRAPPER_OPTS(Arnout)--- Config.in | 6 ++++++ toolchain/toolchain-wrapper.c | 9 --------- toolchain/toolchain-wrapper.mk | 9 +-------- 3 files changed, 7 insertions(+), 17 deletions(-)Config.in +0
-0@@ -764,6 +764,12 @@ config BR2_SSP_ALL endchoice
Config.in config BR2_SSP_ALL · line 775
Quoted 10 lines
Config.in +6
-0+config BR2_SSP_OPTION + string + default "-fstack-protector" if BR2_SSP_REGULAR + default "-fstack-protector-strong" if BR2_SSP_STRONG + default "-fstack-protector-all" if BR2_SSP_ALL + comment "Stack Smashing Protection needs a toolchain w/ SSP" depends on !BR2_TOOLCHAIN_HAS_SSP
Much cleaner then when I pulled SSP into the wrapper :-)
PATCH v2 5/5 toolchain: allow PIC/PIE without RELRO
In reply to yann.morin at orange.comYann,
Quoted 44 lines · On Tue, Mar 12, 2019 at 7:09 AM <[email protected]> wrote:
From: "Yann E. MORIN" <[email protected]>
In commit
7484c1c3b806(toolchain/toolchain-wrapper: addBR2_RELRO_), we added the PIC/PIE flags, but based on theRELRO_FULLcondition.It is however totally possible to do a PIC/PIE executable without
RELRO_FULL, as it is also valid to do a PIC/PIE build withRELRO_PARTIAL.Add a new option that now governs the PIC/PIE flags.
Note: it is unknown if
RELRO_FULLreally needs PIC/PIE or not, so we keep the current situation, where RELRO-FULL forces PIC/PIE compilation. Decoupling can come later from an interested party.Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>--- Config.in | 8 ++++++++ toolchain/toolchain-wrapper.c | 2 +- toolchain/toolchain-wrapper.mk | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-)Config.in +7
-0@@ -712,6 +712,13 @@ endmenu comment "Security Hardening Options" +config BR2_PIC_PIE + bool "Build code with PIC/PIE" + depends on BR2_SHARED_LIBS + help + Generate Position-Independent Code (PIC) and link + Position-Independent Executables (PIE). + choice bool "Stack Smashing Protection" default BR2_SSP_ALL if BR2_ENABLE_SSP # legacy
Config.in config BR2_RELRO_PARTIAL · line 804
Quoted 4 lines
Config.in +1
-0@@ -794,6 +801,7 @@ config BR2_RELRO_PARTIAL config BR2_RELRO_FULL bool "Full" + select BR2_PIC_PIE
In the previous email chain it was being discussed if PIC/PIE was required for full RELRO. Like you guys mentioned, I believe it was always just lumped into the configuration the other distros called "full". However, I'm pretty sure they are independent and you could have full RELRO without PIC/PIE (I did not test this theory, just checked some docs and the theory holds). I'd be on the fence if we should remove this select and keep the BR2_PIC_PIE as something you'd need to independently set if you want it with BR2_RELRO_FULL. I guess, better to make that sort of change now then after more time has gone by.
toolchain/toolchain-wrapper.c int main(int argc, char **argv) · line 370
Quoted 13 lines
Config.in +0
-0help This option includes the partial configuration, but also marks the GOT as read-only at the cost of initialization time duringtoolchain/toolchain-wrapper.c +1
-1@@ -367,7 +367,7 @@ int main(int argc, char **argv) *cur++ ="-Wno-builtin-macro-redefined" ; } -#ifdef BR2_RELRO_FULL +#ifdef BR2_PIC_PIE
PATCH v2 5/5 toolchain: allow PIC/PIE without RELRO
Matt, All,
On 2019-03-12 08:50 -0500, Matthew Weber spake thusly:
Quoted 4 lines · On Tue, Mar 12, 2019 at 7:09 AM <[email protected]> wrote:
Quoted 3 lines
From: "Yann E. MORIN" <[email protected]>
In commit7484c1c3b806(toolchain/toolchain-wrapper: addBR2_RELRO_), we added the PIC/PIE flags, but based on theRELRO_FULLcondition.
[--SNIP--]
Quoted 10 lines
Quoted 3 lines
config
BR2_RELRO_FULL
bool "Full"
+ selectBR2_PIC_PIEIn the previous email chain it was being discussed if PIC/PIE was required for full RELRO. Like you guys mentioned, I believe it was always just lumped into the configuration the other distros called "full". However, I'm pretty sure they are independent and you could have full RELRO without PIC/PIE (I did not test this theory, just checked some docs and the theory holds).
Arnout did test it, and it indeed works.
Quoted 5 lines
I'd be on the fence if we
should remove this select and keep theBR2_PIC_PIEas something you'd need to independently set if you want it withBR2_RELRO_FULL. I guess, better to make that sort of change now then after more time has gone by.
I did not do that in this patch, to introduce the minimal disruption possible. I.e. a configuration which had relro-full will still get PIC/PIE. This patch just adds the possiblity to do PIC/PIE without relro-full.
If we really want to decouple the two, then I think we should do that in a separate patch, which just drops this new select, to allow relro-full without PIC/PIE.
I'll do that in a followup patch.
Regards,
Yann E. MORIN.
Quoted 19 lines
toolchain/toolchain-wrapper.c int main(int argc, char **argv) · line 370
Quoted 13 lines
help
This option includes the partial configuration, but also marks the GOT as read-only at the cost of initialization time duringtoolchain/toolchain-wrapper.c +1
-1@@ -367,7 +367,7 @@ int main(int argc, char **argv) *cur++ ="-Wno-builtin-macro-redefined" ; } -#ifdef BR2_RELRO_FULL +#ifdef BR2_PIC_PIE Reviewed-by Matthew Weber <[email protected]>_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 21 lines
____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
Arnout Vandecappelle
AppliedPATCH v2 1/5 toolchain: prepare to pass more additional CFLAGS via the wrapper
In reply to yann.morin at orange.comQuoted 5 lines · yann.morin at orange.com
From: "Yann E. MORIN" <[email protected]>
Currently, we pass the user-supplied so-called target optimisation flags to the wrapper.
Quoted 8 lines
We're going to have additional such CFLAGS to pass, so push-back the formatting loop to quote the options at the last moment.
Reported-by Arnout Vandecappelle <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 26 lines
--- toolchain/toolchain-wrapper.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)toolchain/toolchain-wrapper.mk +5
-3@@ -16,11 +16,13 @@ endif TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' +TOOLCHAIN_WRAPPER_OPTS = \ + $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) + # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a # separate argument when used in execv() by the toolchain wrapper. -TOOLCHAIN_WRAPPER_OPTS = \ - $(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)"$(comma)) -TOOLCHAIN_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(TOOLCHAIN_WRAPPER_OPTS)' +TOOLCHAIN_WRAPPER_ARGS += \ + -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(TOOLCHAIN_WRAPPER_OPTS),"$(f)"$(comma))' ifeq ($(BR2_CCACHE),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE
Arnout Vandecappelle
AppliedPATCH v2 2/5 toolchain: set the ssp gcc option in kconfig
In reply to yann.morin at orange.comQuoted 14 lines · yann.morin at orange.com
From: "Yann E. MORIN" <[email protected]>
Currently, we repeat all the SSP level selection deep down to the toolchain wrapper itself, where we eventually translate it to the actual SSP option to use. This is a bit redundant.
Additionally, we will want to check that the toolchain actually supports that option (for those toolchain where it was backported).
So, move the translation into kconfig, and add the qstrip'ed value to the additional flags passed to the wrapper. Add it before user-supplied opitons, to keep the previous behaviour (and allow anyone crazy-enough to override it with
BR2_TARGET_OPTIMIZATION).
Quoted 4 lines
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 75 lines
---
Changes v1 -> v2:
- useTOOLCHAIN_WRAPPER_OPTS(Arnout)--- Config.in | 6 ++++++ toolchain/toolchain-wrapper.c | 9 --------- toolchain/toolchain-wrapper.mk | 9 +-------- 3 files changed, 7 insertions(+), 17 deletions(-)Config.in +6
-0@@ -764,6 +764,12 @@ config BR2_SSP_ALL endchoice +config BR2_SSP_OPTION + string + default "-fstack-protector" if BR2_SSP_REGULAR + default "-fstack-protector-strong" if BR2_SSP_STRONG + default "-fstack-protector-all" if BR2_SSP_ALL + comment "Stack Smashing Protection needs a toolchain w/ SSP" depends on !BR2_TOOLCHAIN_HAS_SSPtoolchain/toolchain-wrapper.c +0
-9@@ -98,15 +98,6 @@ static char *predef_args[] = {#if defined(BR_MIPS_TARGET_BIG_ENDIAN ) || defined(BR_ARC_TARGET_BIG_ENDIAN ) "-EB",#endif -#ifdef BR_SSP_REGULAR - "-fstack-protector", -#endif -#ifdef BR_SSP_STRONG - "-fstack-protector-strong", -#endif -#ifdef BR_SSP_ALL - "-fstack-protector-all", -#endif #ifdef BR_ADDITIONAL_CFLAGS BR_ADDITIONAL_CFLAGS#endif toolchain/toolchain-wrapper.mk +1
-8@@ -17,6 +17,7 @@ TOOLCHAIN_WRAPPER_ARGS = $($(PKG)_TOOLCHAIN_WRAPPER_ARGS) TOOLCHAIN_WRAPPER_ARGS += -DBR_SYSROOT='"$(STAGING_SUBDIR)"' TOOLCHAIN_WRAPPER_OPTS = \ + $(call qstrip,$(BR2_SSP_OPTION)) \ $(call qstrip,$(BR2_TARGET_OPTIMIZATION)) # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a@@ -53,14 +54,6 @@ else ifeq ($(BR2_RELRO_FULL),y) TOOLCHAIN_WRAPPER_ARGS += -DBR2_RELRO_FULL endif -ifeq ($(BR2_SSP_REGULAR),y) -TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_REGULAR -else ifeq ($(BR2_SSP_STRONG),y) -TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_STRONG -else ifeq ($(BR2_SSP_ALL),y) -TOOLCHAIN_WRAPPER_ARGS += -DBR_SSP_ALL -endif - define TOOLCHAIN_WRAPPER_BUILD $(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \ -s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
PATCH v2 3/5 toolchain: check the SSP option is known
In reply to yann.morin at orange.comQuoted 56 lines · yann.morin at orange.com
From: "Yann E. MORIN" <[email protected]>
Some toolchain vendors may have backported those options to older gcc versions, and we have no way to know, so we have to check that the user's selection is acceptable.
Extend the macro that currently checks for SSP in the toolchain, with a new test that the actual SSP option is recognised and accepted.
Note that the SSP option is either totaly empty, or an already-quoted string, so we can safely and easily assign it to a shell variable to test and use it.
Note that we do not introduce
BR2_TOOLCHAIN_HAS_SSP_STRONG, because:- our internal toolchain infra only supports gcc >= 4.9, so it has
SSP strong;- of the external pre-built toolchains, only the codesourcery-arm one has a gcc-4.8 which lacks SSP strong, all the others have a gcc >= 4.9;
- we'd still have to do the actual check for custom external toolchains anyway.
So, we're not adding
BR2_TOOLCHAIN_HAS_SSP_STRONGjust for a single case.Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>Cc Arnout Vandecappelle <[email protected]>---
Changes v1 -> v2:
- expand the commit log to explain why we're not addingBR2_TOOLCHAIN_HAS_SSP_STRONG(Arnout)--- toolchain/helpers.mk | 8 ++++++++ toolchain/toolchain-external/pkg-toolchain-external.mk | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)toolchain/helpers.mk +1
-0@@ -415,6 +415,7 @@ check_unusable_toolchain = \ # Check if the toolchain has SSP (stack smashing protector) support # # $1: cross-gcc path +# $2: gcc ssp option # check_toolchain_ssp = \ __CROSS_CC=$(strip $1) ; \
toolchain/helpers.mk check_toolchain_ssp = \ · line 431
Quoted 4 lines
toolchain/helpers.mk +1
-0@@ -427,6 +428,13 @@ check_toolchain_ssp = \ echo "SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ exit 1 ; \ fi ; \ + __SSP_OPTION=$(2); \
Is there any reason to pass this as an argument rather than using
$(BR2_SSP_OPTION) directly?
The same goes for $(TOOLCHAIN_EXTERNAL_CC), but that ship has sailed.
Regards,
Arnout
Quoted 23 lines
toolchain/helpers.mk +6
-0+ if [ -n "$${__SSP_OPTION}" ] ; then \ + if ! echo 'void main(){}' | $${__CROSS_CC} -Werror $${__SSP_OPTION} -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 ; then \ + echo "SSP option $${__SSP_OPTION} not available in this toolchain, please select another SSP level" ; \ + exit 1 ; \ + fi; \ + fi; \ rm -f $(BUILD_DIR)/.br-toolchain-test.tmp* #toolchain/toolchain-external/pkg-toolchain-external.mk +1
-1@@ -549,7 +549,7 @@ define $(2)_CONFIGURE_CMDS else \ $$(call check_glibc,$$$${SYSROOT_DIR}) ; \ fi - $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC)) + $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC),$(BR2_SSP_OPTION)) endef $(2)_TOOLCHAIN_WRAPPER_ARGS += $$(TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS)
PATCH v2 3/5 toolchain: check the SSP option is known
Arnout, All,
On 2019-03-13 00:25 +0100, Arnout Vandecappelle spake thusly:
Quoted 2 lines · yann.morin at orange.com
Quoted 1 line
From: "Yann E. MORIN" <[email protected]>
[--SNIP--]
Quoted 3 lines
Quoted 3 lines
Note that the SSP option is either totaly empty, or an already-quoted string, so we can safely and easily assign it to a shell variable to test and use it.
Please note this paragraph above, and...
[--SNIP--]
Quoted 8 lines
toolchain/helpers.mk check_toolchain_ssp = \ · line 431
Quoted 5 lines
toolchain/helpers.mk +1
-0@@ -427,6 +428,13 @@ check_toolchain_ssp = \ echo "SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ exit 1 ; \ fi ; \ + __SSP_OPTION=$(2); \Is there any reason to pass this as an argument rather than using
$(BR2_SSP_OPTION) directly?
... correlate it with your question here.
There are two cases:
- no SSP BR2_SSP_OPTION is not defined, so it is not even the
empty quoted string ""
- some SSP BR2_SSP_OPTION is a non-empty quoted string.
So...
Quoted 1 line
toolchain/helpers.mk check_toolchain_ssp = \ · line 432
Quoted 1 line
toolchain/helpers.mk +1
-0+ if [ -n "$${__SSP_OPTION}" ] ; then \
... this test would have to use the qstrip-then-quote-anyway dance.
And finally, I tried to mimick the existing code, which lead to the current patch: pass the option as a parameter to the macro, and use an intermediate shell variable.
Regards,
Yann E. MORIN.
Quoted 22 lines
Quoted 22 lines
toolchain/helpers.mk +5
-0+ if ! echo 'void main(){}' | $${__CROSS_CC} -Werror $${__SSP_OPTION} -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 ; then \ + echo "SSP option $${__SSP_OPTION} not available in this toolchain, please select another SSP level" ; \ + exit 1 ; \ + fi; \ + fi; \ rm -f $(BUILD_DIR)/.br-toolchain-test.tmp* #toolchain/toolchain-external/pkg-toolchain-external.mk +1
-1@@ -549,7 +549,7 @@ define $(2)_CONFIGURE_CMDS else \ $$(call check_glibc,$$$${SYSROOT_DIR}) ; \ fi - $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC)) + $$(Q)$$(call check_toolchain_ssp,$$(TOOLCHAIN_EXTERNAL_CC),$(BR2_SSP_OPTION)) endef $(2)_TOOLCHAIN_WRAPPER_ARGS += $$(TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS)
Signature · 21 lines
____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 3/5 toolchain: check the SSP option is known
In reply to yann.morin at orange.comHello,
Quoted 6 lines · On Tue, 12 Mar 2019 13:09:34 +0100 <[email protected]> wrote:
# $1: cross-gcc path
toolchain/helpers.mk +1
-0+# $2: gcc ssp option # check_toolchain_ssp = \ __CROSS_CC=$(strip $1) ; \
toolchain/helpers.mk check_toolchain_ssp = \ · line 437
Quoted 10 lines
toolchain/helpers.mk +7
-0@@ -427,6 +428,13 @@ check_toolchain_ssp = \ echo "SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ exit 1 ; \ fi ; \ + __SSP_OPTION=$(2); \ + if [ -n "$${__SSP_OPTION}" ] ; then \ + if ! echo 'void main(){}' | $${__CROSS_CC} -Werror $${__SSP_OPTION} -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 ; then \ + echo "SSP option $${__SSP_OPTION} not available in this toolchain, please select another SSP level" ; \ + exit 1 ; \ + fi; \ + fi; \
Does it really make sense to check for both -fstack-protector (in the code that already exists) *and* BR2_SSP_OPTION ?
Wouldn't it make more sense to just check for BR2_SSP_OPTION ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 3/5 toolchain: check the SSP option is known
Thomas, All,
On 2019-03-26 20:26 +0100, Thomas Petazzoni spake thusly:
Quoted 23 lines
Quoted 6 lines · On Tue, 12 Mar 2019 13:09:34 +0100 <[email protected]> wrote:
# $1: cross-gcc path
toolchain/helpers.mk +1
-0+# $2: gcc ssp option # check_toolchain_ssp = \ __CROSS_CC=$(strip $1) ; \toolchain/helpers.mk check_toolchain_ssp = \ · line 437
Quoted 10 lines
toolchain/helpers.mk +7
-0@@ -427,6 +428,13 @@ check_toolchain_ssp = \ echo "SSP support not available in this toolchain, please disable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \ exit 1 ; \ fi ; \ + __SSP_OPTION=$(2); \ + if [ -n "$${__SSP_OPTION}" ] ; then \ + if ! echo 'void main(){}' | $${__CROSS_CC} -Werror $${__SSP_OPTION} -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 ; then \ + echo "SSP option $${__SSP_OPTION} not available in this toolchain, please select another SSP level" ; \ + exit 1 ; \ + fi; \ + fi; \Does it really make sense to check for both -fstack-protector (in the code that already exists) *and*
BR2_SSP_OPTION?
Quoted 1 line
Wouldn't it make more sense to just check for
BR2_SSP_OPTION?
My reasoning behind this additional test, is that there are two things we need to test:
* does the toolchain have SSP support (or not) as claimed by the user?
* does the toolchain actually support the SSP level requested by the user?
There are packages that, wrongly or rightfully so, are not concerned with te SSP level, but just the fact that there is SSP or not.
So, I decided to keep the existing test, and expand it. It means that we may indeed check for -fstack-protector twice.
Regards,
Yann E. MORIN.
Signature · 21 lines
____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.
PATCH v2 3/5 toolchain: check the SSP option is known
In reply to yann.morin at orange.comQuoted 25 lines · yann.morin at orange.com
From: "Yann E. MORIN" <[email protected]>
Some toolchain vendors may have backported those options to older gcc versions, and we have no way to know, so we have to check that the user's selection is acceptable.
Extend the macro that currently checks for SSP in the toolchain, with a new test that the actual SSP option is recognised and accepted.
Note that the SSP option is either totaly empty, or an already-quoted string, so we can safely and easily assign it to a shell variable to test and use it.
Note that we do not introduce
BR2_TOOLCHAIN_HAS_SSP_STRONG, because:- our internal toolchain infra only supports gcc >= 4.9, so it has
SSP strong;- of the external pre-built toolchains, only the codesourcery-arm one has a gcc-4.8 which lacks SSP strong, all the others have a gcc >= 4.9;
- we'd still have to do the actual check for custom external toolchains anyway.
Quoted 8 lines
So, we're not adding
BR2_TOOLCHAIN_HAS_SSP_STRONGjust for a single case.Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>Cc Arnout Vandecappelle <[email protected]>
You replied to all concerns, so I've applied as-is.
Regards,
Arnout
PATCH v2 4/5 toolchain: -fstack-protector-strong can be back-ported
In reply to yann.morin at orange.comQuoted 19 lines · yann.morin at orange.com
From: "Yann E. MORIN" <[email protected]>
Currently, use of -fstack-protector-strong is only available for gcc starting with 4.9, on the assumption that it appeared with that version.
Although this is true, it happens that quite a few vendors will have back-ported -fstack-protector-strong to older gcc versions (at least 4.8 seen in the wild).
Remove the guard against gcc>=4.9, and expand the help text.
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>---
Notes:
Quoted 6 lines
We could have changed the guard to something like:
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || BR2_TOOLCHAIN_EXTERNALHowever, the latest gcc we support in the internal toolchain *is* gcc-4.9, so the condition would have always been true. Hence, we just drop the condition.
This note is in fact interesting, so I've added it to the commit message.
However, it would have been more appropriate (if we would have had the condition) to make it
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || BR2_TOOLCHAIN_EXTERNAL_CUSTOM
(because we know our predefined external toolchains <4.9 *don't* suport this option). In fact, we only have one 4.8 predefined external toolchain: Sourcery ARM. So for that one toolchain, it's not worth adding that condition. The problem will anyway be caught by the check you just added, because it's also executed for predefined external toolchains.
Regards,
Arnout
Quoted 27 lines
--- Config.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Config.in +3
-3@@ -746,14 +746,14 @@ config BR2_SSP_REGULAR config BR2_SSP_STRONG bool "-fstack-protector-strong" - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 help Like -fstack-protector but includes additional functions to be protected - those that have local array definitions, or have references to local frame addresses. -comment "Stack Smashing Protection strong needs a toolchain w/ gcc >= 4.9" - depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + -fstack-protector-strong officially appeared in gcc 4.9, but + some vendors have backported -fstack-protector-strong to older + versions of gcc. config BR2_SSP_ALL bool "-fstack-protector-all"
Arnout Vandecappelle
AppliedPATCH v2 5/5 toolchain: allow PIC/PIE without RELRO
In reply to yann.morin at orange.comQuoted 10 lines · yann.morin at orange.com
From: "Yann E. MORIN" <[email protected]>
In commit
7484c1c3b806(toolchain/toolchain-wrapper: addBR2_RELRO_), we added the PIC/PIE flags, but based on theRELRO_FULLcondition.It is however totally possible to do a PIC/PIE executable without
RELRO_FULL, as it is also valid to do a PIC/PIE build withRELRO_PARTIAL.Add a new option that now governs the PIC/PIE flags.
Quoted 8 lines
Note: it is unknown if
RELRO_FULLreally needs PIC/PIE or not, so we keep the current situation, where RELRO-FULL forces PIC/PIE compilation. Decoupling can come later from an interested party.Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>
Applied to master, thanks.
Regards,
Arnout
PATCH v2 4/5 toolchain: -fstack-protector-strong can be back-ported
In reply to Arnout VandecappelleArnout, All,
On 2019-08-03 23:16 +0200, Arnout Vandecappelle spake thusly:
Quoted 27 lines · yann.morin at orange.com
Quoted 19 lines
From: "Yann E. MORIN" <[email protected]>
Currently, use of -fstack-protector-strong is only available for gcc starting with 4.9, on the assumption that it appeared with that version.
Although this is true, it happens that quite a few vendors will have back-ported -fstack-protector-strong to older gcc versions (at least 4.8 seen in the wild).
Remove the guard against gcc>=4.9, and expand the help text.
Signed-off-by "Yann E. MORIN" <[email protected]>Cc Matt Weber <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Thomas De Schampheleire <[email protected]>---
Notes:Quoted 6 lines
We could have changed the guard to something like:
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || BR2_TOOLCHAIN_EXTERNALHowever, the latest gcc we support in the internal toolchain *is* gcc-4.9, so the condition would have always been true. Hence, we just drop the condition.
Quoted 5 lines
This note is in fact interesting, so I've added it to the commit message.
However, it would have been more appropriate (if we would have had the condition) to make itdepends on
BR2_TOOLCHAIN_GCC_AT_LEAST_4_9||BR2_TOOLCHAIN_EXTERNAL_CUSTOM
Actually, this would no longer be true, since we recently merged support for preconfigured toolchains from br2-external trees, and such toolchain may well be a gcc-4.8 or earlier with back-ported SSP strong.
Regards,
Yann E. MORIN.
Quoted 36 lines
(because we know our predefined external toolchains <4.9 *don't* suport this option). In fact, we only have one 4.8 predefined external toolchain: Sourcery ARM. So for that one toolchain, it's not worth adding that condition. The problem will anyway be caught by the check you just added, because it's also executed for predefined external toolchains.
Regards,
ArnoutQuoted 27 lines
--- Config.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Config.in +3
-3@@ -746,14 +746,14 @@ config BR2_SSP_REGULAR config BR2_SSP_STRONG bool "-fstack-protector-strong" - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 help Like -fstack-protector but includes additional functions to be protected - those that have local array definitions, or have references to local frame addresses. -comment "Stack Smashing Protection strong needs a toolchain w/ gcc >= 4.9" - depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 + -fstack-protector-strong officially appeared in gcc 4.9, but + some vendors have backported -fstack-protector-strong to older + versions of gcc. config BR2_SSP_ALL bool "-fstack-protector-all"
Signature · 21 lines
____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | +33 534.541.179 | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' _________________________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you.