diff --git a/CMakeLists.txt b/CMakeLists.txt index 579967a0a1b8a9ca908c7b1f2ecd2355ce25f205..d87f39401aa1d84ffc07cf24de35724e24fecee7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -609,7 +609,7 @@ else() set(ZIG1_COMPILE_FLAGS "-std=c99 -Os -fno-strict-aliasing") set(ZIG2_COMPILE_FLAGS "-std=c99 -O0 -fno-sanitize=undefined -fno-stack-protector -fno-strict-aliasing") # Must match the condition in build.zig. - if(ZIG_HOST_TARGET_ARCH MATCHES "^(arm|thumb)(eb)?$" OR ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(64)?(le)?$") + if(ZIG_HOST_TARGET_ARCH MATCHES "^(arm|thumb)(eb)?$" OR ZIG_HOST_TARGET_ARCH EQUAL "hexagon" OR ZIG_HOST_TARGET_ARCH MATCHES "^powerpc(64)?(le)?$") set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -ffunction-sections -fdata-sections") set(ZIG2_COMPILE_FLAGS "${ZIG2_COMPILE_FLAGS} -ffunction-sections -fdata-sections") endif() diff --git a/build.zig b/build.zig index ddbb9c5db002602e2f5efcd4d7f7e1285bab191c..8ebedc5b5e124d965f1d0ae889ecdde579ac529a 100644 --- a/build.zig +++ b/build.zig @@ -780,7 +780,19 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerModOptions) *std.Build.Ste exe.stack_size = stack_size; // Must match the condition in CMakeLists.txt. - const function_data_sections = options.target.result.cpu.arch.isArm() or options.target.result.cpu.arch.isPowerPC(); + const function_data_sections = switch (options.target.result.cpu.arch) { + .arm, + .armeb, + .thumb, + .thumbeb, + .hexagon, + .powerpc, + .powerpcle, + .powerpc64, + .powerpc64le, + => true, + else => false, + }; exe.link_function_sections = function_data_sections; exe.link_data_sections = function_data_sections;