toolchain/clang: handle big.LITTLE Arm SoCs
PATCH 1/1 toolchain/clang: handle big.LITTLE Arm SoCs
clang doesn't have Arm big.LITTLE specific tune options - when they are used, the compilation fails with an error like this:
aarch64-poky-linux-clang: error: unsupported argument 'cortex-a72.cortex-a53+crc+crypto' to option '-mcpu='
To avoid this, in case a big.LITTLE SoC is the target, select the tune corresponding to the LITTLE core.
This has been lifted from meta-clang, extended with cortexa73-cortexa35 which was missing.
--- meta/classes/toolchain/clang.bbclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
meta/classes/toolchain/clang.bbclass +16 -0
@@ -34,4 +34,20 @@ TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1" +# clang doesn't support big.LITTLE tunes, choose always the tune for the LITTLE cores +TUNE_CCARGS:remove = "\ + -mcpu=cortex-a57.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a72.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a15.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a17.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a72.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a75.cortex-a55${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a76.cortex-a55${TUNE_CCARGS_MARCH_OPTS}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mcpu=cortex-a53${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mcpu=cortex-a7${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35 cortexa73-cortexa35", " -mcpu=cortex-a35${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortexa55 cortexa76-cortexa55", " -mcpu=cortex-a55${TUNE_CCARGS_MARCH_OPTS}", "", d)}" + TCOVERRIDE = "toolchain-clang"
Hi Gyorgy,
Quoted 30 lines · Gyorgy Sarvari via lists.openembedded.org
clang doesn't have Arm big.LITTLE specific tune options - when they are used, the compilation fails with an error like this:
aarch64-poky-linux-clang: error: unsupported argument 'cortex-a72.cortex-a53+crc+crypto' to option '-mcpu='
To avoid this, in case a big.LITTLE SoC is the target, select the tune corresponding to the LITTLE core.
This has been lifted from meta-clang, extended with cortexa73-cortexa35 which was missing.
Signed-off-by Gyorgy Sarvari <[email protected]>--- meta/classes/toolchain/clang.bbclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)meta/classes/toolchain/clang.bbclass +6
-0@@ -34,4 +34,20 @@ TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1" +# clang doesn't support big.LITTLE tunes, choose always the tune for the LITTLE cores +TUNE_CCARGS:remove = "\ + -mcpu=cortex-a57.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a72.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a15.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a17.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \
meta/classes/toolchain/clang.bbclass TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre · line 52
Quoted 10 lines
meta/classes/toolchain/clang.bbclass +10
-0+ -mcpu=cortex-a72.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a75.cortex-a55${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a76.cortex-a55${TUNE_CCARGS_MARCH_OPTS}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mcpu=cortex-a53${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mcpu=cortex-a7${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35 cortexa73-cortexa35", " -mcpu=cortex-a35${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortexa55 cortexa76-cortexa55", " -mcpu=cortex-a55${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +
Wouldn't it be better to have this in the tune conf file directly? I'm a bit worried we'll have more big.LITTLE flavors in the future and because this is in a separate file it'll be out of date.
We should be able to do that by simply using the toolchain-clang or toolchain-gcc override wherever appropriate?
E.g.
MCPU = "cortexa73-cortexa35"
# clang doesn't have Arm big.LITTLE specific tune options, so select the tune corresponding to the LITTLE core. MCPU:toolchain-clang = "cortexa35"
TUNE_CCARGS .= "${@bb.utils.contains("TUNE_FEATURES", "cortexa73-cortexa35", " -mcpu=${MCPU}", "", d)}"
[... and other replacements in meta/conf/machine/include/arm/armv8a/tune-cortexa73-cortexa35.inc]
(NOT TESTED) something like that?
What do you think?
Cheers,
Quentin
Quoted 60 lines · Quentin Schulz
Hi Gyorgy,
Quoted 30 lines · Gyorgy Sarvari via lists.openembedded.org
clang doesn't have Arm big.LITTLE specific tune options - when they are used, the compilation fails with an error like this:
aarch64-poky-linux-clang: error: unsupported argument 'cortex-a72.cortex-a53+crc+crypto' to option '-mcpu='
To avoid this, in case a big.LITTLE SoC is the target, select the tune corresponding to the LITTLE core.
This has been lifted from meta-clang, extended with cortexa73-cortexa35 which was missing.
Signed-off-by Gyorgy Sarvari <[email protected]>--- meta/classes/toolchain/clang.bbclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)meta/classes/toolchain/clang.bbclass +6
-0@@ -34,4 +34,20 @@ TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1" +# clang doesn't support big.LITTLE tunes, choose always the tune for the LITTLE cores +TUNE_CCARGS:remove = "\ + -mcpu=cortex-a57.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a72.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a15.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a17.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \meta/classes/toolchain/clang.bbclass TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre · line 52
Quoted 10 lines
meta/classes/toolchain/clang.bbclass +10
-0+ -mcpu=cortex-a72.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a75.cortex-a55${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a76.cortex-a55${TUNE_CCARGS_MARCH_OPTS}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mcpu=cortex-a53${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mcpu=cortex-a7${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35 cortexa73-cortexa35", " -mcpu=cortex-a35${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortexa55 cortexa76-cortexa55", " -mcpu=cortex-a55${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +Wouldn't it be better to have this in the tune conf file directly? I'm a bit worried we'll have more big.LITTLE flavors in the future and because this is in a separate file it'll be out of date.
We should be able to do that by simply using the toolchain-clang or toolchain-gcc override wherever appropriate?
E.g.
MCPU = "cortexa73-cortexa35"
# clang doesn't have Arm big.LITTLE specific tune options, so select the tune corresponding to the LITTLE core. MCPU:toolchain-clang = "cortexa35"
TUNE_CCARGS.= "${@bb.utils.contains("TUNE_FEATURES", "cortexa73-cortexa35", " -mcpu=${MCPU}", "", d)}"
Quoted 6 lines
[... and other replacements in meta/conf/machine/include/arm/armv8a/tune-cortexa73-cortexa35.inc]
(NOT TESTED) something like that?
What do you think?
I have no strong opinion about this... with that said, the original list was indeed slightly outdated. Will send a v2 later today with this implementation.
Quoted 62 lines · Quentin Schulz via lists.openembedded.org
Hi Gyorgy,
Quoted 30 lines · Gyorgy Sarvari via lists.openembedded.org
clang doesn't have Arm big.LITTLE specific tune options - when they are used, the compilation fails with an error like this:
aarch64-poky-linux-clang: error: unsupported argument 'cortex-a72.cortex-a53+crc+crypto' to option '-mcpu='
To avoid this, in case a big.LITTLE SoC is the target, select the tune corresponding to the LITTLE core.
This has been lifted from meta-clang, extended with cortexa73-cortexa35 which was missing.
Signed-off-by Gyorgy Sarvari <[email protected]>--- meta/classes/toolchain/clang.bbclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)meta/classes/toolchain/clang.bbclass +6
-0@@ -34,4 +34,20 @@ TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2" LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1" +# clang doesn't support big.LITTLE tunes, choose always the tune for the LITTLE cores +TUNE_CCARGS:remove = "\ + -mcpu=cortex-a57.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a72.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a15.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a17.cortex-a7${TUNE_CCARGS_MARCH_OPTS} \meta/classes/toolchain/clang.bbclass TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre · line 52
Quoted 10 lines
meta/classes/toolchain/clang.bbclass +10
-0+ -mcpu=cortex-a72.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a35${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a73.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a75.cortex-a55${TUNE_CCARGS_MARCH_OPTS} \ + -mcpu=cortex-a76.cortex-a55${TUNE_CCARGS_MARCH_OPTS}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa53 cortexa57-cortexa53 cortexa73-cortexa53", " -mcpu=cortex-a53${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa15-cortexa7 cortexa17-cortexa7", " -mcpu=cortex-a7${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa72-cortexa35 cortexa73-cortexa35", " -mcpu=cortex-a35${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +TUNE_CCARGS:append = "${@bb.utils.contains_any("TUNE_FEATURES", "cortexa75-cortexa55 cortexa76-cortexa55", " -mcpu=cortex-a55${TUNE_CCARGS_MARCH_OPTS}", "", d)}" +Wouldn't it be better to have this in the tune conf file directly? I'm a bit worried we'll have more big.LITTLE flavors in the future and because this is in a separate file it'll be out of date.
We should be able to do that by simply using the toolchain-clang or toolchain-gcc override wherever appropriate?
E.g.
MCPU = "cortexa73-cortexa35"
# clang doesn't have Arm big.LITTLE specific tune options, so select the tune corresponding to the LITTLE core. MCPU:toolchain-clang = "cortexa35"
TUNE_CCARGS.= "${@bb.utils.contains("TUNE_FEATURES", "cortexa73-cortexa35", " -mcpu=${MCPU}", "", d)}"
Quoted 6 lines
[... and other replacements in meta/conf/machine/include/arm/armv8a/tune-cortexa73-cortexa35.inc]
(NOT TESTED) something like that?
What do you think?
Agreed. Having it in tune files is definitely easier to maintain
Quoted 12 lines
Cheers,
Quentin-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#220469): https://lists.openembedded.org/g/openembedded-core/message/220469
Mute This Topic: https://lists.openembedded.org/mt/114186273/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-