arch-arm: Do not add -march options for arm architecture along with -mcpu
PATCH v2 1/1 arch-arm: Do not add -march options for arm architecture along with -mcpu
tune files which inherit the arch definitions already define appropriate -mcpu option, which is equivalent of right -march and -mtune combination and is preferred since gcc is getting stricter and stricter with option check semantics and can now find incompatible -march and -mcpu options better with every release. It does internal feature consistency check and if it finds out discrepency between what -mcpu would expand to as compared to -march it will flag the options to be incompatible, for naked eye it sounds wrong but gcc would translate -mcpu to a given -march internally and it might not match to what we set in these arch files.
The effects are quite subtle, where this can result in configure test failing to compile due to these incompatible options and a feature option getting disabled for a recipe for no reason.
e.g. with gcc9 which can now detect that -mcpu=cortex-a5 and -march=armv7-a are incompatible, many features in libstdc++ ends up disabled due to configure check failures e.g. size_t size, ptrdiff_t sizes, which inturn results in compiling libstdc++ with unwanted disabled features.
If user has machine definitions which do not inherit the arm tune files then they can still use the -march switch as such
---
v2: Only delete -march if -mcpu is set
meta/conf/machine/include/arm/arch-armv4.inc | 3 ++- meta/conf/machine/include/arm/arch-armv5.inc | 3 ++- meta/conf/machine/include/arm/arch-armv6.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7a.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7ve.inc | 3 ++- meta/conf/machine/include/tune-arm1136jf-s.inc | 2 ++ meta/conf/machine/include/tune-arm920t.inc | 2 ++ meta/conf/machine/include/tune-arm926ejs.inc | 2 ++ meta/conf/machine/include/tune-arm9tdmi.inc | 2 ++ meta/conf/machine/include/tune-cortexa15.inc | 2 ++ meta/conf/machine/include/tune-cortexa17.inc | 2 ++ meta/conf/machine/include/tune-cortexa5.inc | 2 ++ meta/conf/machine/include/tune-cortexa7.inc | 2 ++ meta/conf/machine/include/tune-cortexa8.inc | 2 ++ meta/conf/machine/include/tune-cortexa9.inc | 2 ++ meta/conf/machine/include/tune-ep9312.inc | 4 +++- meta/conf/machine/include/tune-iwmmxt.inc | 4 +++- meta/conf/machine/include/tune-strongarm1100.inc | 2 ++ meta/conf/machine/include/tune-thunderx.inc | 2 ++ meta/conf/machine/include/tune-xscale.inc | 2 ++ 20 files changed, 42 insertions(+), 7 deletions(-)
meta/conf/machine/include/arm/arch-armv4.inc +2 -1
@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv4" TUNEVALID[arm] = "Enable ARM instruction set" TUNEVALID[armv4] = "Enable instructions for ARMv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' -march=armv4t', '', d)}" +TUNE_MARCH ?= "-march=armv4t" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' ${TUNE_MARCH}', '', d)}" # enable --fix-v4bx when we have armv4 in TUNE_FEATURES, but then disable it when we have also armv5 or thumb # maybe we should extend bb.utils.contains to support check for any checkvalues in value, now it does # checkvalues.issubset(val) which cannot be used for negative test of foo neither bar in value
meta/conf/machine/include/arm/arch-armv5.inc +2 -1
@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv5" TUNEVALID[armv5] = "Enable instructions for ARMv5" TUNECONFLICTS[armv5] = "armv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' -march=armv5t${ARMPKGSFX_DSP}', '', d)}" +TUNE_MARCH ?= "-march=armv5t${ARMPKGSFX_DSP}" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv5', 'armv5:', '' ,d)}" require conf/machine/include/arm/arch-armv4.inc
meta/conf/machine/include/arm/arch-armv6.inc +2 -1
@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv6hf" TUNEVALID[armv6] = "Enable instructions for ARMv6" TUNECONFLICTS[armv6] = "armv4 armv5" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' -march=armv6', '', d)}" +TUNE_MARCH ?= "-march=armv6" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv6', 'armv6:', '' ,d)}" require conf/machine/include/arm/arch-armv5-dsp.inc
meta/conf/machine/include/arm/arch-armv7a.inc +2 -1
@@ -3,7 +3,8 @@ ARM_INSTRUCTION_SET ?= "thumb" TUNEVALID[armv7a] = "Enable instructions for ARMv7-a" TUNECONFLICTS[armv7a] = "armv4 armv5 armv6 armv7" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' -march=armv7-a', '', d)}" +TUNE_MARCH ?= "-march=armv7-a" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 'armv7a:', '' ,d)}" require conf/machine/include/arm/arch-armv6.inc
meta/conf/machine/include/arm/arch-armv7ve.inc +2 -1
@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv7vethf" TUNEVALID[armv7ve] = "Enable instructions for ARMv7ve" TUNECONFLICTS[armv7ve] = "armv4 armv5 armv6 armv7 armv7a" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' -march=armv7ve', '', d)}" +TUNE_MARCH ?= "-march=armv7ve" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', 'armv7ve:', '' ,d)}" require conf/machine/include/arm/arch-armv7a.inc
meta/conf/machine/include/tune-arm1136jf-s.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv6hf" require conf/machine/include/arm/arch-armv6.inc TUNEVALID[arm1136jfs] = "Enable arm1136jfs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm1136jfs', ' -mcpu=arm1136jf-s', '', d)}" AVAILTUNES += "arm1136jfs"
meta/conf/machine/include/tune-arm920t.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm920t] = "Enable arm920t specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm920t', ' -mcpu=arm920t', '', d)}" AVAILTUNES += "arm920t"
meta/conf/machine/include/tune-arm926ejs.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[arm926ejs] = "Enable arm926ejs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm926ejs', ' -mcpu=arm926ej-s', '', d)}" AVAILTUNES += "arm926ejs"
meta/conf/machine/include/tune-arm9tdmi.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm9tdmi] = "Enable arm9tdmi specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm9tdmi', ' -mcpu=arm9tdmi', '', d)}" AVAILTUNES += "arm9tdmi"
meta/conf/machine/include/tune-cortexa15.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa15] = "Enable Cortex-A15 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa15', ' -mcpu=cortex-a15', '', d)}" # Little Endian base configs
meta/conf/machine/include/tune-cortexa17.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa17] = "Enable Cortex-A17 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa17', ' -mcpu=cortex-a17', '', d)}" # Little Endian base configs
meta/conf/machine/include/tune-cortexa5.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa5] = "Enable Cortex-A5 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa5', ' -mcpu=cortex-a5', '', d)}" # Little Endian base configs
meta/conf/machine/include/tune-cortexa7.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa7] = "Enable Cortex-A7 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa7', ' -mcpu=cortex-a7', '', d)}" # Little Endian base configs
meta/conf/machine/include/tune-cortexa8.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa8] = "Enable Cortex-A8 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa8', ' -mcpu=cortex-a8', '', d)}" # Little Endian base configs
meta/conf/machine/include/tune-cortexa9.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa9] = "Enable Cortex-A9 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa9', ' -mcpu=cortex-a9', '', d)}" # Little Endian base configs
meta/conf/machine/include/tune-ep9312.inc +3 -1
@@ -3,7 +3,9 @@ DEFAULTTUNE ?= "ep9312" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[ep9312] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -march=ep9312 -mcpu=ep9312', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -mcpu=ep9312', '', d)}" AVAILTUNES += "ep9312" ARMPKGARCH_tune-ep9312 = "ep9312"
meta/conf/machine/include/tune-iwmmxt.inc +3 -1
@@ -6,7 +6,9 @@ DEFAULTTUNE ?= "iwmmxt" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[iwmmxt] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -march=iwmmxt -mcpu=iwmmxt', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -mcpu=iwmmxt', '', d)}" AVAILTUNES += "iwmmxt" ARMPKGARCH_tune-iwmmxt = "iwmmxt"
meta/conf/machine/include/tune-strongarm1100.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[strongarm] = "Enable Strongarm 1100 series processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'strongarm', ' -mcpu=strongarm1100', '', d)}" AVAILTUNES += "strongarm"
meta/conf/machine/include/tune-thunderx.inc +2 -0
@@ -5,6 +5,8 @@ AVAILTUNES += "thunderx thunderx_be" TUNEVALID[thunderx] = "Enable instructions for Cavium ThunderX" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thunderx', ' -mcpu=thunderx ', '',d)}" ARMPKGARCH_tune-thunderx ?= "thunderx"
meta/conf/machine/include/tune-xscale.inc +2 -0
@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[xscale] = "Enable PXA255/PXA26x Xscale specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'xscale', ' -mcpu=xscale', '', d)}" AVAILTUNES += "xscale"
Signature · 1 line
2.20.1
Quoted 25 lines · Khem Raj
tune files which inherit the arch definitions already define appropriate
-mcpu option, which is equivalent of right -march and -mtune combination
and is preferred since gcc is getting stricter and stricter with option
check semantics and can now find incompatible -march and -mcpu options
better with every release. It does internal feature consistency check and if it finds out discrepency between what -mcpu would expand to as compared to -march it will flag the options to be incompatible, for naked eye it sounds wrong but gcc would translate -mcpu to a given -march internally and it might not match to what we set in these arch files.The effects are quite subtle, where this can result in configure test failing to compile due to these incompatible options and a feature option getting disabled for a recipe for no reason.
e.g. with gcc9 which can now detect that -mcpu=cortex-a5 and -march=armv7-a are incompatible, many features in libstdc++ ends up disabled due to configure check failures e.g.
size_tsize,ptrdiff_tsizes, which inturn results in compiling libstdc++ with unwanted disabled features.
Quoted 7 lines
If user has machine definitions which do not inherit the arm tune files
then they can still use the -march switch as suchSigned-off-by Khem Raj <[email protected]>---
v2: Only delete -march if -mcpu is set
I suspect this might cause:
https://autobuilder.yoctoproject.org/typhoon/#/builders/46/builds/212
Cheers,
Richard
Quoted 31 lines · Richard Purdie
Quoted 29 lines · Khem Raj
tune files which inherit the arch definitions already define appropriate
-mcpu option, which is equivalent of right -march and -mtune combination
and is preferred since gcc is getting stricter and stricter with option
check semantics and can now find incompatible -march and -mcpu options
better with every release. It does internal feature consistency check and if it finds out discrepency between what -mcpu would expand to as compared to -march it will flag the options to be incompatible, for naked eye it sounds wrong but gcc would translate -mcpu to a given -march internally and it might not match to what we set in these arch files.The effects are quite subtle, where this can result in configure test failing to compile due to these incompatible options and a feature option getting disabled for a recipe for no reason.
e.g. with gcc9 which can now detect that -mcpu=cortex-a5 and -march=armv7-a are incompatible, many features in libstdc++ ends up disabled due to configure check failures e.g.
size_tsize,ptrdiff_tsizes, which inturn results in compiling libstdc++ with unwanted disabled features.If user has machine definitions which do not inherit the arm tune files
then they can still use the -march switch as such
Quoted 7 lines
Quoted 3 lines
Signed-off-by Khem Raj <[email protected]>---
v2: Only delete -march if -mcpu is setI suspect this might cause:
https://autobuilder.yoctoproject.org/typhoon/#/builders/46/builds/212
Yes, this is because valgrind is trying to undo the effects of specifying mcpu + march together,
I have send a patch to fix it. see
https://patchwork.openembedded.org/patch/158223/
Quoted 5 lines
Cheers,
Richard
Quoted 69 lines · Khem Raj
tune files which inherit the arch definitions already define appropriate -mcpu option, which is equivalent of right -march and -mtune combination and is preferred since gcc is getting stricter and stricter with option check semantics and can now find incompatible -march and -mcpu options better with every release. It does internal feature consistency check and if it finds out discrepency between what -mcpu would expand to as compared to -march it will flag the options to be incompatible, for naked eye it sounds wrong but gcc would translate -mcpu to a given -march internally and it might not match to what we set in these arch files.
The effects are quite subtle, where this can result in configure test failing to compile due to these incompatible options and a feature option getting disabled for a recipe for no reason.
e.g. with gcc9 which can now detect that -mcpu=cortex-a5 and -march=armv7-a are incompatible, many features in libstdc++ ends up disabled due to configure check failures e.g.
size_tsize,ptrdiff_tsizes, which inturn results in compiling libstdc++ with unwanted disabled features.If user has machine definitions which do not inherit the arm tune files then they can still use the -march switch as such
Signed-off-by Khem Raj <[email protected]>---
v2: Only delete -march if -mcpu is setmeta/conf/machine/include/arm/arch-armv4.inc | 3 ++- meta/conf/machine/include/arm/arch-armv5.inc | 3 ++- meta/conf/machine/include/arm/arch-armv6.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7a.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7ve.inc | 3 ++- meta/conf/machine/include/tune-arm1136jf-s.inc | 2 ++ meta/conf/machine/include/tune-arm920t.inc | 2 ++ meta/conf/machine/include/tune-arm926ejs.inc | 2 ++ meta/conf/machine/include/tune-arm9tdmi.inc | 2 ++ meta/conf/machine/include/tune-cortexa15.inc | 2 ++ meta/conf/machine/include/tune-cortexa17.inc | 2 ++ meta/conf/machine/include/tune-cortexa5.inc | 2 ++ meta/conf/machine/include/tune-cortexa7.inc | 2 ++ meta/conf/machine/include/tune-cortexa8.inc | 2 ++ meta/conf/machine/include/tune-cortexa9.inc | 2 ++ meta/conf/machine/include/tune-ep9312.inc | 4 +++- meta/conf/machine/include/tune-iwmmxt.inc | 4 +++- meta/conf/machine/include/tune-strongarm1100.inc | 2 ++ meta/conf/machine/include/tune-thunderx.inc | 2 ++ meta/conf/machine/include/tune-xscale.inc | 2 ++ 20 files changed, 42 insertions(+), 7 deletions(-)meta/conf/machine/include/arm/arch-armv4.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv4" TUNEVALID[arm] = "Enable ARM instruction set" TUNEVALID[armv4] = "Enable instructions for ARMv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' -march=armv4t', '', d)}" +TUNE_MARCH ?= "-march=armv4t" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' ${TUNE_MARCH}', '', d)}" # enable --fix-v4bx when we have armv4 in TUNE_FEATURES, but then disable it when we have also armv5 or thumb # maybe we should extend bb.utils.contains to support check for any checkvalues in value, now it does # checkvalues.issubset(val) which cannot be used for negative test of foo neither bar in valuemeta/conf/machine/include/arm/arch-armv5.inc +0
-0
meta/conf/machine/include/arm/arch-armv5.inc DEFAULTTUNE ?= "armv5" · line 7
Quoted 7 lines
meta/conf/machine/include/arm/arch-armv5.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv5" TUNEVALID[armv5] = "Enable instructions for ARMv5" TUNECONFLICTS[armv5] = "armv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' -march=armv5t${ARMPKGSFX_DSP}', '', d)}" +TUNE_MARCH ?= "-march=armv5t${ARMPKGSFX_DSP}" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv5', 'armv5:', '' ,d)}"
This type of thing won't work, because the TUNE_MARCH could be loaded, overridden by other components and the order in which the files are loaded.
Add to this multilib configurations, and it becomes a mess to be sure you have things in the right order, and at 'best' you have to now modify the machine configurations to try to get the ordering correct.
That is the reason things were implemented the way they were originally.. So if you choose a particular configuration, you were sure that the arch was set properly for that system, even if others were loaded and available.
If an march is not compatible with an mcpu value.. these we clearly have a mismatch. Where is the mcpu value being defined, and why isn't it in sync with the march from the CCARGS?
--Mark
Quoted 243 lines
meta/conf/machine/include/arm/arch-armv5.inc +0
-0require conf/machine/include/arm/arch-armv4.incmeta/conf/machine/include/arm/arch-armv6.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv6hf" TUNEVALID[armv6] = "Enable instructions for ARMv6" TUNECONFLICTS[armv6] = "armv4 armv5" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' -march=armv6', '', d)}" +TUNE_MARCH ?= "-march=armv6" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv6', 'armv6:', '' ,d)}" require conf/machine/include/arm/arch-armv5-dsp.incmeta/conf/machine/include/arm/arch-armv7a.inc +2
-1@@ -3,7 +3,8 @@ ARM_INSTRUCTION_SET ?= "thumb" TUNEVALID[armv7a] = "Enable instructions for ARMv7-a" TUNECONFLICTS[armv7a] = "armv4 armv5 armv6 armv7" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' -march=armv7-a', '', d)}" +TUNE_MARCH ?= "-march=armv7-a" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 'armv7a:', '' ,d)}" require conf/machine/include/arm/arch-armv6.incmeta/conf/machine/include/arm/arch-armv7ve.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv7vethf" TUNEVALID[armv7ve] = "Enable instructions for ARMv7ve" TUNECONFLICTS[armv7ve] = "armv4 armv5 armv6 armv7 armv7a" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' -march=armv7ve', '', d)}" +TUNE_MARCH ?= "-march=armv7ve" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', 'armv7ve:', '' ,d)}" require conf/machine/include/arm/arch-armv7a.incmeta/conf/machine/include/tune-arm1136jf-s.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv6hf" require conf/machine/include/arm/arch-armv6.inc TUNEVALID[arm1136jfs] = "Enable arm1136jfs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm1136jfs', ' -mcpu=arm1136jf-s', '', d)}" AVAILTUNES += "arm1136jfs"meta/conf/machine/include/tune-arm920t.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm920t] = "Enable arm920t specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm920t', ' -mcpu=arm920t', '', d)}" AVAILTUNES += "arm920t"meta/conf/machine/include/tune-arm926ejs.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[arm926ejs] = "Enable arm926ejs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm926ejs', ' -mcpu=arm926ej-s', '', d)}" AVAILTUNES += "arm926ejs"meta/conf/machine/include/tune-arm9tdmi.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm9tdmi] = "Enable arm9tdmi specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm9tdmi', ' -mcpu=arm9tdmi', '', d)}" AVAILTUNES += "arm9tdmi"meta/conf/machine/include/tune-cortexa15.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa15] = "Enable Cortex-A15 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa15', ' -mcpu=cortex-a15', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa17.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa17] = "Enable Cortex-A17 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa17', ' -mcpu=cortex-a17', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa5.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa5] = "Enable Cortex-A5 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa5', ' -mcpu=cortex-a5', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa7.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa7] = "Enable Cortex-A7 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa7', ' -mcpu=cortex-a7', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa8.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa8] = "Enable Cortex-A8 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa8', ' -mcpu=cortex-a8', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa9.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa9] = "Enable Cortex-A9 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa9', ' -mcpu=cortex-a9', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-ep9312.inc +3
-1@@ -3,7 +3,9 @@ DEFAULTTUNE ?= "ep9312" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[ep9312] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -march=ep9312 -mcpu=ep9312', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -mcpu=ep9312', '', d)}" AVAILTUNES += "ep9312" ARMPKGARCH_tune-ep9312 = "ep9312"meta/conf/machine/include/tune-iwmmxt.inc +3
-1@@ -6,7 +6,9 @@ DEFAULTTUNE ?= "iwmmxt" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[iwmmxt] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -march=iwmmxt -mcpu=iwmmxt', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -mcpu=iwmmxt', '', d)}" AVAILTUNES += "iwmmxt" ARMPKGARCH_tune-iwmmxt = "iwmmxt"meta/conf/machine/include/tune-strongarm1100.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[strongarm] = "Enable Strongarm 1100 series processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'strongarm', ' -mcpu=strongarm1100', '', d)}" AVAILTUNES += "strongarm"meta/conf/machine/include/tune-thunderx.inc +2
-0@@ -5,6 +5,8 @@ AVAILTUNES += "thunderx thunderx_be" TUNEVALID[thunderx] = "Enable instructions for Cavium ThunderX" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thunderx', ' -mcpu=thunderx ', '',d)}" ARMPKGARCH_tune-thunderx ?= "thunderx"meta/conf/machine/include/tune-xscale.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[xscale] = "Enable PXA255/PXA26x Xscale specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'xscale', ' -mcpu=xscale', '', d)}" AVAILTUNES += "xscale"
Hi Mark
Quoted 72 lines · Mark Hatle
Quoted 70 lines · Khem Raj
tune files which inherit the arch definitions already define appropriate -mcpu option, which is equivalent of right -march and -mtune combination and is preferred since gcc is getting stricter and stricter with option check semantics and can now find incompatible -march and -mcpu options better with every release. It does internal feature consistency check and if it finds out discrepency between what -mcpu would expand to as compared to -march it will flag the options to be incompatible, for naked eye it sounds wrong but gcc would translate -mcpu to a given -march internally and it might not match to what we set in these arch files.
The effects are quite subtle, where this can result in configure test failing to compile due to these incompatible options and a feature option getting disabled for a recipe for no reason.
e.g. with gcc9 which can now detect that -mcpu=cortex-a5 and -march=armv7-a are incompatible, many features in libstdc++ ends up disabled due to configure check failures e.g.
size_tsize,ptrdiff_tsizes, which inturn results in compiling libstdc++ with unwanted disabled features.If user has machine definitions which do not inherit the arm tune files then they can still use the -march switch as such
Signed-off-by Khem Raj <[email protected]>---
v2: Only delete -march if -mcpu is setmeta/conf/machine/include/arm/arch-armv4.inc | 3 ++- meta/conf/machine/include/arm/arch-armv5.inc | 3 ++- meta/conf/machine/include/arm/arch-armv6.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7a.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7ve.inc | 3 ++- meta/conf/machine/include/tune-arm1136jf-s.inc | 2 ++ meta/conf/machine/include/tune-arm920t.inc | 2 ++ meta/conf/machine/include/tune-arm926ejs.inc | 2 ++ meta/conf/machine/include/tune-arm9tdmi.inc | 2 ++ meta/conf/machine/include/tune-cortexa15.inc | 2 ++ meta/conf/machine/include/tune-cortexa17.inc | 2 ++ meta/conf/machine/include/tune-cortexa5.inc | 2 ++ meta/conf/machine/include/tune-cortexa7.inc | 2 ++ meta/conf/machine/include/tune-cortexa8.inc | 2 ++ meta/conf/machine/include/tune-cortexa9.inc | 2 ++ meta/conf/machine/include/tune-ep9312.inc | 4 +++- meta/conf/machine/include/tune-iwmmxt.inc | 4 +++- meta/conf/machine/include/tune-strongarm1100.inc | 2 ++ meta/conf/machine/include/tune-thunderx.inc | 2 ++ meta/conf/machine/include/tune-xscale.inc | 2 ++ 20 files changed, 42 insertions(+), 7 deletions(-)meta/conf/machine/include/arm/arch-armv4.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv4" TUNEVALID[arm] = "Enable ARM instruction set" TUNEVALID[armv4] = "Enable instructions for ARMv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' -march=armv4t', '', d)}" +TUNE_MARCH ?= "-march=armv4t" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' ${TUNE_MARCH}', '', d)}" # enable --fix-v4bx when we have armv4 in TUNE_FEATURES, but then disable it when we have also armv5 or thumb # maybe we should extend bb.utils.contains to support check for any checkvalues in value, now it does # checkvalues.issubset(val) which cannot be used for negative test of foo neither bar in valuemeta/conf/machine/include/arm/arch-armv5.inc +0
-0@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv5"
Quoted 9 lines
meta/conf/machine/include/arm/arch-armv5.inc DEFAULTTUNE ?= "armv5" · line 7
Quoted 6 lines
meta/conf/machine/include/arm/arch-armv5.inc +2
-1TUNEVALID[armv5] = "Enable instructions for ARMv5" TUNECONFLICTS[armv5] = "armv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' -march=armv5t${ARMPKGSFX_DSP}', '', d)}" +TUNE_MARCH ?= "-march=armv5t${ARMPKGSFX_DSP}" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv5', 'armv5:', '' ,d)}"This type of thing won't work, because the
TUNE_MARCHcould be loaded, overridden by other components and the order in which the files are loaded.
This is happening even today, look at the valgrind recipe, we are removing options from TUNE_CCARGS
Quoted 4 lines
Add to this multilib configurations, and it becomes a mess to be sure you have things in the right order, and at 'best' you have to now modify the machine configurations to try to get the ordering correct.
Site an example I fail to understand how is order playing a part here ?
Quoted 4 lines
That is the reason things were implemented the way they were originally.. So if you choose a particular configuration, you were sure that the arch was set properly for that system, even if others were loaded and available.
Other solution we have is to substitute mcpu with mtune in tune-* files which will be in tune
with how this is layed out. The differnece would be
-mcpu = Generate this CPU specific ISA and optimize/tune/schedule the code for give cpu
march+mtune=Only use ISA specific to ARCH, but then tune/optimize the code for give cpu implementation
Based on internet research I think using a single -mcpu will give us better code for a given CPU ( I did not run becnhmarks to back this up)
using march+mtune will let the same binary run across wide range of CPU implementations of the given arch ( armv7ve ) on some it will be more
optimised ( one we chose in -mtune) but it will still run on other implementations.
Second option is more compatible across generally, if we ship same output packages for multiple machines, after Martin's rework of package tunes we
have cpu specific package arches for feeds etc. So we can ship packages built for a given cpu without any problems.
Quoted 5 lines
If an march is not compatible with an mcpu value.. these we clearly have a mismatch. Where is the mcpu value being defined, and why isn't it in sync with the march from the CCARGS?
GCC ARM port recommends using -mcpu or if you are a ninja level then use -mtune and -march
and it will override the internally computed march and -mtune values from -mcpu. and there are so
many combinations that can be created using -march option look at how this option can be construced
using + and - attrubutes.
Quoted 247 lines
--Mark
Quoted 243 lines
meta/conf/machine/include/arm/arch-armv5.inc +0
-0require conf/machine/include/arm/arch-armv4.incmeta/conf/machine/include/arm/arch-armv6.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv6hf" TUNEVALID[armv6] = "Enable instructions for ARMv6" TUNECONFLICTS[armv6] = "armv4 armv5" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' -march=armv6', '', d)}" +TUNE_MARCH ?= "-march=armv6" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv6', 'armv6:', '' ,d)}" require conf/machine/include/arm/arch-armv5-dsp.incmeta/conf/machine/include/arm/arch-armv7a.inc +2
-1@@ -3,7 +3,8 @@ ARM_INSTRUCTION_SET ?= "thumb" TUNEVALID[armv7a] = "Enable instructions for ARMv7-a" TUNECONFLICTS[armv7a] = "armv4 armv5 armv6 armv7" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' -march=armv7-a', '', d)}" +TUNE_MARCH ?= "-march=armv7-a" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 'armv7a:', '' ,d)}" require conf/machine/include/arm/arch-armv6.incmeta/conf/machine/include/arm/arch-armv7ve.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv7vethf" TUNEVALID[armv7ve] = "Enable instructions for ARMv7ve" TUNECONFLICTS[armv7ve] = "armv4 armv5 armv6 armv7 armv7a" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' -march=armv7ve', '', d)}" +TUNE_MARCH ?= "-march=armv7ve" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', 'armv7ve:', '' ,d)}" require conf/machine/include/arm/arch-armv7a.incmeta/conf/machine/include/tune-arm1136jf-s.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv6hf" require conf/machine/include/arm/arch-armv6.inc TUNEVALID[arm1136jfs] = "Enable arm1136jfs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm1136jfs', ' -mcpu=arm1136jf-s', '', d)}" AVAILTUNES += "arm1136jfs"meta/conf/machine/include/tune-arm920t.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm920t] = "Enable arm920t specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm920t', ' -mcpu=arm920t', '', d)}" AVAILTUNES += "arm920t"meta/conf/machine/include/tune-arm926ejs.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[arm926ejs] = "Enable arm926ejs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm926ejs', ' -mcpu=arm926ej-s', '', d)}" AVAILTUNES += "arm926ejs"meta/conf/machine/include/tune-arm9tdmi.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm9tdmi] = "Enable arm9tdmi specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm9tdmi', ' -mcpu=arm9tdmi', '', d)}" AVAILTUNES += "arm9tdmi"meta/conf/machine/include/tune-cortexa15.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa15] = "Enable Cortex-A15 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa15', ' -mcpu=cortex-a15', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa17.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa17] = "Enable Cortex-A17 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa17', ' -mcpu=cortex-a17', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa5.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa5] = "Enable Cortex-A5 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa5', ' -mcpu=cortex-a5', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa7.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa7] = "Enable Cortex-A7 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa7', ' -mcpu=cortex-a7', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa8.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa8] = "Enable Cortex-A8 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa8', ' -mcpu=cortex-a8', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa9.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa9] = "Enable Cortex-A9 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa9', ' -mcpu=cortex-a9', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-ep9312.inc +3
-1@@ -3,7 +3,9 @@ DEFAULTTUNE ?= "ep9312" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[ep9312] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -march=ep9312 -mcpu=ep9312', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -mcpu=ep9312', '', d)}" AVAILTUNES += "ep9312" ARMPKGARCH_tune-ep9312 = "ep9312"meta/conf/machine/include/tune-iwmmxt.inc +3
-1@@ -6,7 +6,9 @@ DEFAULTTUNE ?= "iwmmxt" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[iwmmxt] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -march=iwmmxt -mcpu=iwmmxt', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -mcpu=iwmmxt', '', d)}" AVAILTUNES += "iwmmxt" ARMPKGARCH_tune-iwmmxt = "iwmmxt"meta/conf/machine/include/tune-strongarm1100.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[strongarm] = "Enable Strongarm 1100 series processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'strongarm', ' -mcpu=strongarm1100', '', d)}" AVAILTUNES += "strongarm"meta/conf/machine/include/tune-thunderx.inc +2
-0@@ -5,6 +5,8 @@ AVAILTUNES += "thunderx thunderx_be" TUNEVALID[thunderx] = "Enable instructions for Cavium ThunderX" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thunderx', ' -mcpu=thunderx ', '',d)}" ARMPKGARCH_tune-thunderx ?= "thunderx"meta/conf/machine/include/tune-xscale.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[xscale] = "Enable PXA255/PXA26x Xscale specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'xscale', ' -mcpu=xscale', '', d)}" AVAILTUNES += "xscale"
Quoted 84 lines · Khem Raj
Hi Mark
Quoted 72 lines · Mark Hatle
Quoted 70 lines · Khem Raj
tune files which inherit the arch definitions already define appropriate -mcpu option, which is equivalent of right -march and -mtune combination and is preferred since gcc is getting stricter and stricter with option check semantics and can now find incompatible -march and -mcpu options better with every release. It does internal feature consistency check and if it finds out discrepency between what -mcpu would expand to as compared to -march it will flag the options to be incompatible, for naked eye it sounds wrong but gcc would translate -mcpu to a given -march internally and it might not match to what we set in these arch files.
The effects are quite subtle, where this can result in configure test failing to compile due to these incompatible options and a feature option getting disabled for a recipe for no reason.
e.g. with gcc9 which can now detect that -mcpu=cortex-a5 and -march=armv7-a are incompatible, many features in libstdc++ ends up disabled due to configure check failures e.g.
size_tsize,ptrdiff_tsizes, which inturn results in compiling libstdc++ with unwanted disabled features.If user has machine definitions which do not inherit the arm tune files then they can still use the -march switch as such
Signed-off-by Khem Raj <[email protected]>---
v2: Only delete -march if -mcpu is setmeta/conf/machine/include/arm/arch-armv4.inc | 3 ++- meta/conf/machine/include/arm/arch-armv5.inc | 3 ++- meta/conf/machine/include/arm/arch-armv6.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7a.inc | 3 ++- meta/conf/machine/include/arm/arch-armv7ve.inc | 3 ++- meta/conf/machine/include/tune-arm1136jf-s.inc | 2 ++ meta/conf/machine/include/tune-arm920t.inc | 2 ++ meta/conf/machine/include/tune-arm926ejs.inc | 2 ++ meta/conf/machine/include/tune-arm9tdmi.inc | 2 ++ meta/conf/machine/include/tune-cortexa15.inc | 2 ++ meta/conf/machine/include/tune-cortexa17.inc | 2 ++ meta/conf/machine/include/tune-cortexa5.inc | 2 ++ meta/conf/machine/include/tune-cortexa7.inc | 2 ++ meta/conf/machine/include/tune-cortexa8.inc | 2 ++ meta/conf/machine/include/tune-cortexa9.inc | 2 ++ meta/conf/machine/include/tune-ep9312.inc | 4 +++- meta/conf/machine/include/tune-iwmmxt.inc | 4 +++- meta/conf/machine/include/tune-strongarm1100.inc | 2 ++ meta/conf/machine/include/tune-thunderx.inc | 2 ++ meta/conf/machine/include/tune-xscale.inc | 2 ++ 20 files changed, 42 insertions(+), 7 deletions(-)meta/conf/machine/include/arm/arch-armv4.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv4" TUNEVALID[arm] = "Enable ARM instruction set" TUNEVALID[armv4] = "Enable instructions for ARMv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' -march=armv4t', '', d)}" +TUNE_MARCH ?= "-march=armv4t" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv4', ' ${TUNE_MARCH}', '', d)}" # enable --fix-v4bx when we have armv4 in TUNE_FEATURES, but then disable it when we have also armv5 or thumb # maybe we should extend bb.utils.contains to support check for any checkvalues in value, now it does # checkvalues.issubset(val) which cannot be used for negative test of foo neither bar in valuemeta/conf/machine/include/arm/arch-armv5.inc +0
-0@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv5"Quoted 9 lines
meta/conf/machine/include/arm/arch-armv5.inc DEFAULTTUNE ?= "armv5" · line 7
Quoted 6 lines
meta/conf/machine/include/arm/arch-armv5.inc +2
-1TUNEVALID[armv5] = "Enable instructions for ARMv5" TUNECONFLICTS[armv5] = "armv4" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' -march=armv5t${ARMPKGSFX_DSP}', '', d)}" +TUNE_MARCH ?= "-march=armv5t${ARMPKGSFX_DSP}" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv5', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv5', 'armv5:', '' ,d)}"This type of thing won't work, because the
TUNE_MARCHcould be loaded, overridden by other components and the order in which the files are loaded.
Quoted 2 lines
This is happening even today, look at the valgrind recipe, we are removing options from
TUNE_CCARGS
Ya, I don't doubt that. Certain recipes seem to know better then the system (rightly or wrongly so). It might be best if there was a way to simply turn OFF the TUNE_CCARGS, and make those recipes specify their own.
Quoted 6 lines
Quoted 4 lines
Add to this multilib configurations, and it becomes a mess to be sure you have things in the right order, and at 'best' you have to now modify the machine configurations to try to get the ordering correct.
Site an example I fail to understand how is order playing a part here ?
machine includes armv8 inc file, but the user needs compatibility with armv5 because they share the rootfs across systems.
When they compile, they will have TUNE_MARCH, which is inherited into all of the TUNE_CCARGS set to armv8, not the armv5 they were expecting.
If it was:
TUNE_MARCH_armv5 = '-march=armv5'
TUNE_MARCH_armv8 = '-march=armv8'
And the corresponding TUNE_CCARGS includes the localized version, instead of a commonly named on that would work -- but then the recipe still need a way to override it.
Which then leads to:
TUNE_MARCH ?= "${TUNE_MACHINE_${DEFAULTTUNE}"
with the individuals as I mentioned above.
This could let it be overridable, while still hiding the details internally. Similarly, the maybe all of the TUNE_CCARGS that use -march could be condensed into a single inclusion of TUNE_MARCH?
(really not sure if that is reasonable, just thinking out loud.)
Quoted 14 lines
Quoted 4 lines
That is the reason things were implemented the way they were originally.. So if you choose a particular configuration, you were sure that the arch was set properly for that system, even if others were loaded and available.
Other solution we have is to substitute mcpu with mtune in tune-* files which will be in tune
with how this is layed out. The differnece would be-mcpu = Generate this CPU specific ISA and optimize/tune/schedule the code for give cpu
march+mtune=Only use ISA specific to ARCH, but then tune/optimize the code for give cpu implementation
Quoted 8 lines
Based on internet research I think using a single -mcpu will give us better code for a given CPU ( I did not run becnhmarks to back this up)
using march+mtune will let the same binary run across wide range of CPU implementations of the given arch ( armv7ve ) on some it will be more
optimised ( one we chose in -mtune) but it will still run on other implementations.
Yes, I don't object to -mcpu usage.. but for a while it was highly inconsistent in the past weather -mcpu or -march/mtune was the better option.
They key though is that we need a consistent behavior in the TUNE_CCARGS based on the feature setting, and the feature setting -should- be 'unique' for the optimization level, since we can't promise a specific order of processing. (Even though generally we know what the final comparison string will look like.)
Quoted 5 lines
Second option is more compatible across generally, if we ship same output packages for multiple machines, after Martin's rework of package tunes we
have cpu specific package arches for feeds etc. So we can ship packages built for a given cpu without any problems.
This was always the goal. To have specific feeds for compatibility or optimization, depending on the end user's goals.
Quoted 262 lines
Quoted 6 lines
If an march is not compatible with an mcpu value.. these we clearly have a mismatch. Where is the mcpu value being defined, and why isn't it in sync with the march from the CCARGS?
GCC ARM port recommends using -mcpu or if you are a ninja level then use -mtune and -march
and it will override the internally computed march and -mtune values from -mcpu. and there are so
many combinations that can be created using -march option look at how this option can be construced
using + and - attrubutes.Quoted 247 lines
--Mark
Quoted 243 lines
meta/conf/machine/include/arm/arch-armv5.inc +0
-0require conf/machine/include/arm/arch-armv4.incmeta/conf/machine/include/arm/arch-armv6.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv6hf" TUNEVALID[armv6] = "Enable instructions for ARMv6" TUNECONFLICTS[armv6] = "armv4 armv5" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' -march=armv6', '', d)}" +TUNE_MARCH ?= "-march=armv6" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv6', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv6', 'armv6:', '' ,d)}" require conf/machine/include/arm/arch-armv5-dsp.incmeta/conf/machine/include/arm/arch-armv7a.inc +2
-1@@ -3,7 +3,8 @@ ARM_INSTRUCTION_SET ?= "thumb" TUNEVALID[armv7a] = "Enable instructions for ARMv7-a" TUNECONFLICTS[armv7a] = "armv4 armv5 armv6 armv7" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' -march=armv7-a', '', d)}" +TUNE_MARCH ?= "-march=armv7-a" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7a', 'armv7a:', '' ,d)}" require conf/machine/include/arm/arch-armv6.incmeta/conf/machine/include/arm/arch-armv7ve.inc +2
-1@@ -2,7 +2,8 @@ DEFAULTTUNE ?= "armv7vethf" TUNEVALID[armv7ve] = "Enable instructions for ARMv7ve" TUNECONFLICTS[armv7ve] = "armv4 armv5 armv6 armv7 armv7a" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' -march=armv7ve', '', d)}" +TUNE_MARCH ?= "-march=armv7ve" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', ' ${TUNE_MARCH}', '', d)}" MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'armv7ve', 'armv7ve:', '' ,d)}" require conf/machine/include/arm/arch-armv7a.incmeta/conf/machine/include/tune-arm1136jf-s.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv6hf" require conf/machine/include/arm/arch-armv6.inc TUNEVALID[arm1136jfs] = "Enable arm1136jfs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm1136jfs', ' -mcpu=arm1136jf-s', '', d)}" AVAILTUNES += "arm1136jfs"meta/conf/machine/include/tune-arm920t.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm920t] = "Enable arm920t specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm920t', ' -mcpu=arm920t', '', d)}" AVAILTUNES += "arm920t"meta/conf/machine/include/tune-arm926ejs.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[arm926ejs] = "Enable arm926ejs specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm926ejs', ' -mcpu=arm926ej-s', '', d)}" AVAILTUNES += "arm926ejs"meta/conf/machine/include/tune-arm9tdmi.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4t" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[arm9tdmi] = "Enable arm9tdmi specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'arm9tdmi', ' -mcpu=arm9tdmi', '', d)}" AVAILTUNES += "arm9tdmi"meta/conf/machine/include/tune-cortexa15.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa15] = "Enable Cortex-A15 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa15', ' -mcpu=cortex-a15', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa17.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa17] = "Enable Cortex-A17 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa17', ' -mcpu=cortex-a17', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa5.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa5] = "Enable Cortex-A5 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa5', ' -mcpu=cortex-a5', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa7.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7vethf-neon" require conf/machine/include/arm/arch-armv7ve.inc TUNEVALID[cortexa7] = "Enable Cortex-A7 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa7', ' -mcpu=cortex-a7', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa8.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa8] = "Enable Cortex-A8 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa8', ' -mcpu=cortex-a8', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-cortexa9.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv7athf-neon" require conf/machine/include/arm/arch-armv7a.inc TUNEVALID[cortexa9] = "Enable Cortex-A9 specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'cortexa9', ' -mcpu=cortex-a9', '', d)}" # Little Endian base configsmeta/conf/machine/include/tune-ep9312.inc +3
-1@@ -3,7 +3,9 @@ DEFAULTTUNE ?= "ep9312" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[ep9312] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -march=ep9312 -mcpu=ep9312', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'ep9312', ' -mcpu=ep9312', '', d)}" AVAILTUNES += "ep9312" ARMPKGARCH_tune-ep9312 = "ep9312"meta/conf/machine/include/tune-iwmmxt.inc +3
-1@@ -6,7 +6,9 @@ DEFAULTTUNE ?= "iwmmxt" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[iwmmxt] = "Enable Intel PXA27x specific processor optimizations" -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -march=iwmmxt -mcpu=iwmmxt', '', d)}" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'iwmmxt', ' -mcpu=iwmmxt', '', d)}" AVAILTUNES += "iwmmxt" ARMPKGARCH_tune-iwmmxt = "iwmmxt"meta/conf/machine/include/tune-strongarm1100.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv4" require conf/machine/include/arm/arch-armv4.inc TUNEVALID[strongarm] = "Enable Strongarm 1100 series processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'strongarm', ' -mcpu=strongarm1100', '', d)}" AVAILTUNES += "strongarm"meta/conf/machine/include/tune-thunderx.inc +2
-0@@ -5,6 +5,8 @@ AVAILTUNES += "thunderx thunderx_be" TUNEVALID[thunderx] = "Enable instructions for Cavium ThunderX" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'thunderx', ' -mcpu=thunderx ', '',d)}" ARMPKGARCH_tune-thunderx ?= "thunderx"meta/conf/machine/include/tune-xscale.inc +2
-0@@ -3,6 +3,8 @@ DEFAULTTUNE ?= "armv5te" require conf/machine/include/arm/arch-armv5-dsp.inc TUNEVALID[xscale] = "Enable PXA255/PXA26x Xscale specific processor optimizations" +# Since we set -mcpu option here, Do not add -march option +TUNE_MARCH = "" TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'xscale', ' -mcpu=xscale', '', d)}" AVAILTUNES += "xscale"