From 8702353912b03351c0bc7d3dc45ca308baeb2c3f Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 7 Aug 2024 16:31:06 +0000 Subject: [PATCH 1/3] src/arch/xtensa/CMakeLists.txt: drop bogus, non-portable -Wl,-EL As already discussed in commit bcbcec79e582 ("cmake: drop binutils-specific '-Wl,-EL' option") and commit ee58fef9212f ("smex/cmake: move -Wl,EL option to target_linker_options() for clang") and their corresponding reviews on GitHub, this binutils-specific, endianness option makes no difference and is causing clang compatibility issues. It's now getting in the way of #9351 "Add the new platform ACP_7_0". I ran `./scripts/docker-run.sh ./scripts/xtensa-build-all.sh -a` with and without it and there was absolutely zero binary difference. I was added in 2019 by giant commit e0ba98d21ae8 ("cmake: add CMakeLists for firmware build") without any rationale of why it would be needed. Signed-off-by: Marc Herbert --- src/arch/xtensa/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/arch/xtensa/CMakeLists.txt b/src/arch/xtensa/CMakeLists.txt index 45d6782cc22e..9828d2a56992 100644 --- a/src/arch/xtensa/CMakeLists.txt +++ b/src/arch/xtensa/CMakeLists.txt @@ -123,7 +123,6 @@ target_compile_options(sof_options INTERFACE $<$: -${optimization_flag} -g -Wall -Werror - -Wl,-EL -Wmissing-prototypes -Wpointer-arith ${XTENSA_C_FLAGS} From 52f0a51ade58522e11008816ce8a64ef9090f9ef Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 7 Aug 2024 16:36:29 +0000 Subject: [PATCH 2/3] smex/CMakeLists.txt: drop bogus, non-portable -Wl,-EL binutils option This option was added by initial commit 36929ae1b7c6 ("smex: Create new tool to build ldc file") without any justification. It has been causing countless portability issues, see previous commit for examples. It makes even less sense for a build-time utility. Get rid of it. Signed-off-by: Marc Herbert --- smex/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smex/CMakeLists.txt b/smex/CMakeLists.txt index 23eeb3a775f3..d5a9824e2c0d 100644 --- a/smex/CMakeLists.txt +++ b/smex/CMakeLists.txt @@ -23,7 +23,7 @@ target_compile_options(smex PRIVATE ) target_link_options(smex PRIVATE - -Wall -Werror -Wl,-EL + -Wall -Werror ) target_include_directories(smex PRIVATE @@ -36,4 +36,4 @@ if (NOT CONFIG_SOF_ZEPHYR_STRICT_HEADERS) target_include_directories(smex PRIVATE "${SOF_ROOT_SOURCE_DIRECTORY}/xtos/include" ) -endif() \ No newline at end of file +endif() From 92260008aed432d3124596fe28eb9e79717bdbe1 Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 7 Aug 2024 16:45:30 +0000 Subject: [PATCH 3/3] tools/plugin: drop bogus -Wl,-EL binutils endianness option This mysterious option has been causing portability issues and has never made any difference, see previous commits for details. I compiled the plugin with and without it and there was absolutely zero binary difference. Let's remove it from all tools/plugin/ CMakeLists.txt files before the mass copy/paste/diverge there spreads it even more. Signed-off-by: Marc Herbert --- tools/plugin/alsaplug/CMakeLists.txt | 4 ++-- tools/plugin/modules/CMakeLists.txt | 4 ++-- tools/plugin/modules/ov_noise_suppression/CMakeLists.txt | 2 +- tools/plugin/pipe/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/plugin/alsaplug/CMakeLists.txt b/tools/plugin/alsaplug/CMakeLists.txt index c982d90d6106..4074d8b4a31a 100644 --- a/tools/plugin/alsaplug/CMakeLists.txt +++ b/tools/plugin/alsaplug/CMakeLists.txt @@ -15,7 +15,7 @@ target_include_directories(asound_module_pcm_sof PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${sof_source_directory}/src/audio) -target_compile_options(asound_module_pcm_sof PRIVATE -DPIC -g -O3 -Wl,-EL -Wmissing-prototypes +target_compile_options(asound_module_pcm_sof PRIVATE -DPIC -g -O3 -Wmissing-prototypes -Wimplicit-fallthrough -DCONFIG_LIBRARY -imacros${config_h}) install(TARGETS asound_module_pcm_sof DESTINATION /usr/lib/x86_64-linux-gnu/alsa-lib) @@ -47,7 +47,7 @@ target_include_directories(asound_module_ctl_sof PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${sof_source_directory}/src/audio) -target_compile_options(asound_module_ctl_sof PRIVATE -DPIC -g -O3 -Wl,-EL -Wmissing-prototypes +target_compile_options(asound_module_ctl_sof PRIVATE -DPIC -g -O3 -Wmissing-prototypes -Wimplicit-fallthrough -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) install(TARGETS asound_module_ctl_sof DESTINATION /usr/lib/x86_64-linux-gnu/alsa-lib) diff --git a/tools/plugin/modules/CMakeLists.txt b/tools/plugin/modules/CMakeLists.txt index 507f183d97a1..d737972cde7d 100644 --- a/tools/plugin/modules/CMakeLists.txt +++ b/tools/plugin/modules/CMakeLists.txt @@ -11,7 +11,7 @@ target_include_directories(sof_mod_shm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../pipe ${sof_source_directory}/src/audio) -target_compile_options(sof_mod_shm PRIVATE -DPIC -g -O3 -Wl,-EL -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) +target_compile_options(sof_mod_shm PRIVATE -DPIC -g -O3 -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) install(TARGETS sof_mod_shm DESTINATION /usr/lib/x86_64-linux-gnu/alsa-lib) @@ -39,7 +39,7 @@ target_include_directories(sof_mod_alsa PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../pipe ${sof_source_directory}/src/audio) -target_compile_options(sof_mod_alsa PRIVATE -DPIC -g -O3 -Wl,-EL -Wmissing-prototypes +target_compile_options(sof_mod_alsa PRIVATE -DPIC -g -O3 -Wmissing-prototypes -Wimplicit-fallthrough -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) install(TARGETS sof_mod_alsa diff --git a/tools/plugin/modules/ov_noise_suppression/CMakeLists.txt b/tools/plugin/modules/ov_noise_suppression/CMakeLists.txt index 1e6e0f47aea2..039e9056ee45 100644 --- a/tools/plugin/modules/ov_noise_suppression/CMakeLists.txt +++ b/tools/plugin/modules/ov_noise_suppression/CMakeLists.txt @@ -20,7 +20,7 @@ add_library(sof_ns MODULE noise_suppression.c) target_link_libraries(sof_ns PRIVATE sof_ns_interface) target_link_libraries(sof_ns PRIVATE -Wl,--export-dynamic) sof_append_relative_path_definitions(sof_ns) -target_compile_options(sof_ns PRIVATE -DPIC -g -O3 -Wl,-EL -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) +target_compile_options(sof_ns PRIVATE -DPIC -g -O3 -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) install(TARGETS sof_ns DESTINATION /usr/lib/x86_64-linux-gnu/alsa-lib) target_include_directories(sof_ns PRIVATE diff --git a/tools/plugin/pipe/CMakeLists.txt b/tools/plugin/pipe/CMakeLists.txt index 69f6245cfab2..ef7960c5a048 100644 --- a/tools/plugin/pipe/CMakeLists.txt +++ b/tools/plugin/pipe/CMakeLists.txt @@ -16,7 +16,7 @@ target_include_directories(sof-pipe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${sof_source_directory}/src/audio) -target_compile_options(sof-pipe PRIVATE -DPIC -g -O3 -Wl,-EL -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) +target_compile_options(sof-pipe PRIVATE -DPIC -g -O3 -Wall -Werror -DCONFIG_LIBRARY -imacros${config_h}) target_include_directories(sof-pipe PRIVATE ${sof_install_directory}/include) target_include_directories(sof-pipe PRIVATE ${parser_install_dir}/include)