From 5a8c5e322b67c16be6cdcec7621c4a59ae86dd85 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 24 Aug 2026 16:05:43 -0700 Subject: [PATCH] frontend: default strip=true on hex and raw object formats --- src/Compilation/Config.zig | 1 - src/target.zig | 43 ++++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index affb7cf5c1e9ddb85e137eaef26dcb7750966657..85915ded1b97d4e324a1cebbdb1385758ebea6f0 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -487,7 +487,6 @@ pub fn resolve(options: Options) ResolveError!Config { const root_strip = b: { if (options.root_strip) |x| break :b x; if (root_optimize_mode == .small) break :b true; - if (target.cpu.arch == .spork8) break :b true; if (!target_util.hasDebugInfo(target)) break :b true; break :b false; }; diff --git a/src/target.zig b/src/target.zig index 48c29feb3899b97ce0a47f83cb64f6435263a435..5edf18e9581df4d786b515f6b5a2bfdf33e34561 100644 --- a/src/target.zig +++ b/src/target.zig @@ -396,26 +396,29 @@ pub fn classifyCompilerRtLibName(name: []const u8) CompilerRtClassification { } pub fn hasDebugInfo(target: *const std.Target) bool { - return switch (target.cpu.arch) { - // TODO: We should make newer PTX versions depend on older ones so we'd just check `ptx75`. - .nvptx, .nvptx64 => target.cpu.hasAny(.nvptx, &.{ - .ptx75, - .ptx76, - .ptx77, - .ptx78, - .ptx80, - .ptx81, - .ptx82, - .ptx83, - .ptx84, - .ptx85, - .ptx86, - .ptx87, - .ptx88, - .ptx90, - }), - .bpfel, .bpfeb => false, - else => true, + return switch (target.ofmt) { + .raw, .hex => false, + else => switch (target.cpu.arch) { + // TODO: We should make newer PTX versions depend on older ones so we'd just check `ptx75`. + .nvptx, .nvptx64 => target.cpu.hasAny(.nvptx, &.{ + .ptx75, + .ptx76, + .ptx77, + .ptx78, + .ptx80, + .ptx81, + .ptx82, + .ptx83, + .ptx84, + .ptx85, + .ptx86, + .ptx87, + .ptx88, + .ptx90, + }), + .bpfel, .bpfeb => false, + else => true, + }, }; } -- 2.54.0