From 2c286d103f8326527e9479448dceabbc0bf29662 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 17 Oct 2022 18:13:17 -0700 Subject: [PATCH 1/3] Disable TLS for GCC on targets with no Zephyr support By disabling compiler support, we can ensure that nothing else will end up using something that the OS cannot support. Signed-off-by: Keith Packard --- configs/mips-zephyr-elf.config | 1 + configs/nios2-zephyr-elf.config | 1 + configs/xtensa-espressif_esp32_zephyr-elf.config | 1 + configs/xtensa-espressif_esp32s2_zephyr-elf.config | 1 + configs/xtensa-intel_apl_adsp_zephyr-elf.config | 1 + configs/xtensa-intel_bdw_adsp_zephyr-elf.config | 1 + configs/xtensa-intel_byt_adsp_zephyr-elf.config | 1 + configs/xtensa-intel_s1000_zephyr-elf.config | 1 + configs/xtensa-nxp_imx8m_adsp_zephyr-elf.config | 1 + configs/xtensa-nxp_imx_adsp_zephyr-elf.config | 1 + configs/xtensa-sample_controller_zephyr-elf.config | 1 + 11 files changed, 11 insertions(+) diff --git a/configs/mips-zephyr-elf.config b/configs/mips-zephyr-elf.config index 9642bca8..0622cb13 100644 --- a/configs/mips-zephyr-elf.config +++ b/configs/mips-zephyr-elf.config @@ -28,6 +28,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/nios2-zephyr-elf.config b/configs/nios2-zephyr-elf.config index a76f4510..a21afd50 100644 --- a/configs/nios2-zephyr-elf.config +++ b/configs/nios2-zephyr-elf.config @@ -28,6 +28,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-espressif_esp32_zephyr-elf.config b/configs/xtensa-espressif_esp32_zephyr-elf.config index 5f3ea498..448cd32e 100644 --- a/configs/xtensa-espressif_esp32_zephyr-elf.config +++ b/configs/xtensa-espressif_esp32_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-espressif_esp32s2_zephyr-elf.config b/configs/xtensa-espressif_esp32s2_zephyr-elf.config index 97e82562..efd9f783 100644 --- a/configs/xtensa-espressif_esp32s2_zephyr-elf.config +++ b/configs/xtensa-espressif_esp32s2_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-intel_apl_adsp_zephyr-elf.config b/configs/xtensa-intel_apl_adsp_zephyr-elf.config index 92ead2a9..550b6cd7 100644 --- a/configs/xtensa-intel_apl_adsp_zephyr-elf.config +++ b/configs/xtensa-intel_apl_adsp_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-intel_bdw_adsp_zephyr-elf.config b/configs/xtensa-intel_bdw_adsp_zephyr-elf.config index 540eb333..71957468 100644 --- a/configs/xtensa-intel_bdw_adsp_zephyr-elf.config +++ b/configs/xtensa-intel_bdw_adsp_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-intel_byt_adsp_zephyr-elf.config b/configs/xtensa-intel_byt_adsp_zephyr-elf.config index 7cc9d25a..8fb27d59 100644 --- a/configs/xtensa-intel_byt_adsp_zephyr-elf.config +++ b/configs/xtensa-intel_byt_adsp_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-intel_s1000_zephyr-elf.config b/configs/xtensa-intel_s1000_zephyr-elf.config index 9ca87acb..d48b367c 100644 --- a/configs/xtensa-intel_s1000_zephyr-elf.config +++ b/configs/xtensa-intel_s1000_zephyr-elf.config @@ -29,6 +29,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-nxp_imx8m_adsp_zephyr-elf.config b/configs/xtensa-nxp_imx8m_adsp_zephyr-elf.config index ef350e7b..7763154f 100644 --- a/configs/xtensa-nxp_imx8m_adsp_zephyr-elf.config +++ b/configs/xtensa-nxp_imx8m_adsp_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-nxp_imx_adsp_zephyr-elf.config b/configs/xtensa-nxp_imx_adsp_zephyr-elf.config index 423f4619..af3019fa 100644 --- a/configs/xtensa-nxp_imx_adsp_zephyr-elf.config +++ b/configs/xtensa-nxp_imx_adsp_zephyr-elf.config @@ -30,6 +30,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y diff --git a/configs/xtensa-sample_controller_zephyr-elf.config b/configs/xtensa-sample_controller_zephyr-elf.config index e38b1933..206c9ff7 100644 --- a/configs/xtensa-sample_controller_zephyr-elf.config +++ b/configs/xtensa-sample_controller_zephyr-elf.config @@ -29,6 +29,7 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_GCC_SRC_CUSTOM=y CT_GCC_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/gcc" CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-gnu-ld --with-gnu-as --enable-initfini-array" +CT_CC_GCC_CONFIG_TLS=n CT_CC_LANG_CXX=y CT_DEBUG_GDB=y CT_GDB_SRC_CUSTOM=y From 56c5427139a6a0eab27f3e71aed7e5497aa6c0da Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 17 Oct 2022 18:31:32 -0700 Subject: [PATCH 2/3] arc: Add -mtp-regno=26 to CFLAGS Make sure everything is built with the correct TLS configuration. Signed-off-by: Keith Packard --- configs/arc-zephyr-elf.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/arc-zephyr-elf.config b/configs/arc-zephyr-elf.config index 01a21cab..daafa527 100644 --- a/configs/arc-zephyr-elf.config +++ b/configs/arc-zephyr-elf.config @@ -4,7 +4,7 @@ CT_EXPERIMENTAL=y # CT_LOG_PROGRESS_BAR is not set CT_ARCH_ARC=y CT_MULTILIB=y -CT_TARGET_CFLAGS="-mno-sdata" +CT_TARGET_CFLAGS="-mno-sdata -mtp-regno=26" CT_TARGET_VENDOR="zephyr" CT_BINUTILS_SRC_CUSTOM=y CT_BINUTILS_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/binutils" From 73cddd24be0a540d640feeb6f81a6851e943dbe1 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 24 Oct 2022 22:31:04 -0700 Subject: [PATCH 3/3] aarch64: Add -moverride=tune=no_ldp_stp_qregs to TARGET_CFLAGS From Zephyr arch/arm64/core/CMakeLists.txt: GCC may generate ldp/stp instructions with the Advanced SIMD Qn registers for consecutive 32-byte loads and stores. Saving and restoring the Advanced SIMD context is very expensive, and it is preferable to keep it turned off by not emitting these instructions for better context switching performance. Also, if these instructions happen from an ISR, they will trap and appear to leave interrupts disabled afterwards. That bug should be fixed. Signed-off-by: Keith Packard --- configs/aarch64-zephyr-elf.config | 1 + 1 file changed, 1 insertion(+) diff --git a/configs/aarch64-zephyr-elf.config b/configs/aarch64-zephyr-elf.config index 495960ac..fb9051a5 100644 --- a/configs/aarch64-zephyr-elf.config +++ b/configs/aarch64-zephyr-elf.config @@ -6,6 +6,7 @@ CT_ARCH_ARM=y CT_MULTILIB=y CT_ARCH_64=y CT_TARGET_VENDOR="zephyr" +CT_TARGET_CFLAGS="-moverride=tune=no_ldp_stp_qregs" CT_BINUTILS_SRC_CUSTOM=y CT_BINUTILS_CUSTOM_LOCATION="${GITHUB_WORKSPACE}/binutils" CT_NEWLIB_SRC_CUSTOM=y