authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-07-06 12:32:14+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-07-06 12:32:14+02:00
logc5af4c75da81616eadce8cf866aac86fb9e4ba9d
tree222c7084e002e449b36412da3f28f8c1f1077da6
parentc0f9b51d846e71f46f37ffa010152c7776d77991
parentf0fdc9098919ff65daea48b5b54154406b88d107

Merge pull request '`std.debug.SelfInfo.Elf`: enable DWARF unwinding for ARM' (#36035) from alexrp/zig:arm-dwarf-unwind into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36035 Reviewed-by: mlugg <mlugg@noreply.codeberg.org>

11 files changed, 35 insertions(+), 47 deletions(-)

lib/libc/musl/arch/powerpc/syscall_arch.h+7-7
...@@ -9,7 +9,7 @@ static inline long __syscall0(long n)...@@ -9,7 +9,7 @@ static inline long __syscall0(long n)
9 register long r3 __asm__("r3");9 register long r3 __asm__("r3");
10 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"10 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
11 : "+r"(r0), "=r"(r3)11 : "+r"(r0), "=r"(r3)
12 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");12 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
13 return r3;13 return r3;
14}14}
1515
...@@ -19,7 +19,7 @@ static inline long __syscall1(long n, long a)...@@ -19,7 +19,7 @@ static inline long __syscall1(long n, long a)
19 register long r3 __asm__("r3") = a;19 register long r3 __asm__("r3") = a;
20 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"20 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
21 : "+r"(r0), "+r"(r3)21 : "+r"(r0), "+r"(r3)
22 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");22 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
23 return r3;23 return r3;
24}24}
2525
...@@ -30,7 +30,7 @@ static inline long __syscall2(long n, long a, long b)...@@ -30,7 +30,7 @@ static inline long __syscall2(long n, long a, long b)
30 register long r4 __asm__("r4") = b;30 register long r4 __asm__("r4") = b;
31 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"31 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
32 : "+r"(r0), "+r"(r3), "+r"(r4)32 : "+r"(r0), "+r"(r3), "+r"(r4)
33 :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");33 :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
34 return r3;34 return r3;
35}35}
3636
...@@ -42,7 +42,7 @@ static inline long __syscall3(long n, long a, long b, long c)...@@ -42,7 +42,7 @@ static inline long __syscall3(long n, long a, long b, long c)
42 register long r5 __asm__("r5") = c;42 register long r5 __asm__("r5") = c;
43 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"43 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
44 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)44 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
45 :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");45 :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
46 return r3;46 return r3;
47}47}
4848
...@@ -55,7 +55,7 @@ static inline long __syscall4(long n, long a, long b, long c, long d)...@@ -55,7 +55,7 @@ static inline long __syscall4(long n, long a, long b, long c, long d)
55 register long r6 __asm__("r6") = d;55 register long r6 __asm__("r6") = d;
56 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"56 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
57 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)57 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
58 :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");58 :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
59 return r3;59 return r3;
60}60}
6161
...@@ -69,7 +69,7 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)...@@ -69,7 +69,7 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
69 register long r7 __asm__("r7") = e;69 register long r7 __asm__("r7") = e;
70 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"70 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
71 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)71 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
72 :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");72 :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
73 return r3;73 return r3;
74}74}
7575
...@@ -84,7 +84,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo...@@ -84,7 +84,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
84 register long r8 __asm__("r8") = f;84 register long r8 __asm__("r8") = f;
85 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"85 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
86 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)86 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
87 :: "memory", "cr0", "r9", "r10", "r11", "r12");87 :: "memory", "cr0", "r9", "r10", "r11", "r12", "ctr", "xer");
88 return r3;88 return r3;
89}89}
9090
lib/libc/musl/arch/powerpc64/syscall_arch.h+7-7
...@@ -7,7 +7,7 @@ static inline long __syscall0(long n)...@@ -7,7 +7,7 @@ static inline long __syscall0(long n)
7 register long r3 __asm__("r3");7 register long r3 __asm__("r3");
8 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"8 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
9 : "+r"(r0), "=r"(r3)9 : "+r"(r0), "=r"(r3)
10 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");10 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
11 return r3;11 return r3;
12}12}
1313
...@@ -17,7 +17,7 @@ static inline long __syscall1(long n, long a)...@@ -17,7 +17,7 @@ static inline long __syscall1(long n, long a)
17 register long r3 __asm__("r3") = a;17 register long r3 __asm__("r3") = a;
18 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"18 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
19 : "+r"(r0), "+r"(r3)19 : "+r"(r0), "+r"(r3)
20 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");20 :: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
21 return r3;21 return r3;
22}22}
2323
...@@ -28,7 +28,7 @@ static inline long __syscall2(long n, long a, long b)...@@ -28,7 +28,7 @@ static inline long __syscall2(long n, long a, long b)
28 register long r4 __asm__("r4") = b;28 register long r4 __asm__("r4") = b;
29 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"29 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
30 : "+r"(r0), "+r"(r3), "+r"(r4)30 : "+r"(r0), "+r"(r3), "+r"(r4)
31 :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12");31 :: "memory", "cr0", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
32 return r3;32 return r3;
33}33}
3434
...@@ -40,7 +40,7 @@ static inline long __syscall3(long n, long a, long b, long c)...@@ -40,7 +40,7 @@ static inline long __syscall3(long n, long a, long b, long c)
40 register long r5 __asm__("r5") = c;40 register long r5 __asm__("r5") = c;
41 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"41 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
42 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)42 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5)
43 :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12");43 :: "memory", "cr0", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
44 return r3;44 return r3;
45}45}
4646
...@@ -53,7 +53,7 @@ static inline long __syscall4(long n, long a, long b, long c, long d)...@@ -53,7 +53,7 @@ static inline long __syscall4(long n, long a, long b, long c, long d)
53 register long r6 __asm__("r6") = d;53 register long r6 __asm__("r6") = d;
54 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"54 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
55 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)55 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6)
56 :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12");56 :: "memory", "cr0", "r7", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
57 return r3;57 return r3;
58}58}
5959
...@@ -67,7 +67,7 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)...@@ -67,7 +67,7 @@ static inline long __syscall5(long n, long a, long b, long c, long d, long e)
67 register long r7 __asm__("r7") = e;67 register long r7 __asm__("r7") = e;
68 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"68 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
69 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)69 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7)
70 :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12");70 :: "memory", "cr0", "r8", "r9", "r10", "r11", "r12", "ctr", "xer");
71 return r3;71 return r3;
72}72}
7373
...@@ -82,7 +82,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo...@@ -82,7 +82,7 @@ static inline long __syscall6(long n, long a, long b, long c, long d, long e, lo
82 register long r8 __asm__("r8") = f;82 register long r8 __asm__("r8") = f;
83 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"83 __asm__ __volatile__("sc ; bns+ 1f ; neg %1, %1 ; 1:"
84 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)84 : "+r"(r0), "+r"(r3), "+r"(r4), "+r"(r5), "+r"(r6), "+r"(r7), "+r"(r8)
85 :: "memory", "cr0", "r9", "r10", "r11", "r12");85 :: "memory", "cr0", "r9", "r10", "r11", "r12", "ctr", "xer");
86 return r3;86 return r3;
87}87}
8888
lib/std/debug/SelfInfo/Elf.zig+12-7
...@@ -92,12 +92,10 @@ pub fn getModuleSlide(si: *SelfInfo, io: Io, address: usize) Error!usize {...@@ -92,12 +92,10 @@ pub fn getModuleSlide(si: *SelfInfo, io: Io, address: usize) Error!usize {
92}92}
9393
94pub const can_unwind: bool = s: {94pub const can_unwind: bool = s: {
95 // Notably, we are yet to support unwinding on ARM. There, unwinding is not done through
96 // `.eh_frame`, but instead with the `.ARM.exidx` section, which has a different format.
97 const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) {95 const archs: []const std.Target.Cpu.Arch = switch (builtin.target.os.tag) {
98 // Not supported yet: arm
99 .haiku => &.{96 .haiku => &.{
100 .aarch64,97 .aarch64,
98 .arm,
101 .riscv64,99 .riscv64,
102 .x86,100 .x86,
103 .x86_64,101 .x86_64,
...@@ -106,12 +104,14 @@ pub const can_unwind: bool = s: {...@@ -106,12 +104,14 @@ pub const can_unwind: bool = s: {
106 .x86,104 .x86,
107 .x86_64,105 .x86_64,
108 },106 },
109 // Not supported yet: arm/armeb/thumb/thumbeb, hppa, hppa64, microblaze/microblazeel107 // Not supported yet: hppa, hppa64, microblaze/microblazeel, sh/sheb
110 .linux => &.{108 .linux => &.{
111 .aarch64,109 .aarch64,
112 .aarch64_be,110 .aarch64_be,
113 .alpha,111 .alpha,
114 .arc,112 .arc,
113 .arm,
114 .armeb,
115 .csky,115 .csky,
116 .loongarch32,116 .loongarch32,
117 .loongarch64,117 .loongarch64,
...@@ -124,6 +124,8 @@ pub const can_unwind: bool = s: {...@@ -124,6 +124,8 @@ pub const can_unwind: bool = s: {
124 .riscv32,124 .riscv32,
125 .riscv64,125 .riscv64,
126 .s390x,126 .s390x,
127 .thumb,
128 .thumbeb,
127 .x86,129 .x86,
128 .x86_64,130 .x86_64,
129 },131 },
...@@ -136,18 +138,20 @@ pub const can_unwind: bool = s: {...@@ -136,18 +138,20 @@ pub const can_unwind: bool = s: {
136 .dragonfly => &.{138 .dragonfly => &.{
137 .x86_64,139 .x86_64,
138 },140 },
139 // Not supported yet: arm
140 .freebsd => &.{141 .freebsd => &.{
141 .aarch64,142 .aarch64,
143 .arm,
142 .riscv64,144 .riscv64,
143 .x86,145 .x86,
144 .x86_64,146 .x86_64,
145 },147 },
146 // Not supported yet: arm/armeb, hppa, mips64/mips64el, sh/sheb148 // Not supported yet: hppa, mips64/mips64el, sh/sheb
147 .netbsd => &.{149 .netbsd => &.{
148 .aarch64,150 .aarch64,
149 .aarch64_be,151 .aarch64_be,
150 .alpha,152 .alpha,
153 .arm,
154 .armeb,
151 .m68k,155 .m68k,
152 .mips,156 .mips,
153 .mipsel,157 .mipsel,
...@@ -156,9 +160,10 @@ pub const can_unwind: bool = s: {...@@ -156,9 +160,10 @@ pub const can_unwind: bool = s: {
156 .x86,160 .x86,
157 .x86_64,161 .x86_64,
158 },162 },
159 // Not supported yet: arm, hppa, sh163 // Not supported yet: hppa, sh
160 .openbsd => &.{164 .openbsd => &.{
161 .aarch64,165 .aarch64,
166 .arm,
162 .m88k,167 .m88k,
163 .mips64,168 .mips64,
164 .mips64el,169 .mips64el,
src/Compilation.zig+3-7
...@@ -7327,8 +7327,6 @@ fn buildOutputFromZig(...@@ -7327,8 +7327,6 @@ fn buildOutputFromZig(
7327pub const CrtFileOptions = struct {7327pub const CrtFileOptions = struct {
7328 function_sections: bool = true,7328 function_sections: bool = true,
7329 data_sections: bool = true,7329 data_sections: bool = true,
7330 omit_frame_pointer: ?bool = null,
7331 unwind_tables: ?std.lang.UnwindTables = null,
7332 pic: ?bool = null,7330 pic: ?bool = null,
7333 no_builtin: ?bool = null,7331 no_builtin: ?bool = null,
73347332
...@@ -7375,7 +7373,7 @@ pub fn build_crt_file(...@@ -7375,7 +7373,7 @@ pub fn build_crt_file(
7375 .root_optimize_mode = comp.compilerRtOptMode(),7373 .root_optimize_mode = comp.compilerRtOptMode(),
7376 .root_strip = comp.compilerRtStrip(),7374 .root_strip = comp.compilerRtStrip(),
7377 .link_libc = false,7375 .link_libc = false,
7378 .any_unwind_tables = options.unwind_tables != .none,7376 .any_unwind_tables = comp.root_mod.unwind_tables != .none,
7379 .lto = switch (output_mode) {7377 .lto = switch (output_mode) {
7380 .Lib => if (options.allow_lto) comp.config.lto else .none,7378 .Lib => if (options.allow_lto) comp.config.lto else .none,
7381 .Obj, .Exe => .none,7379 .Obj, .Exe => .none,
...@@ -7398,11 +7396,9 @@ pub fn build_crt_file(...@@ -7398,11 +7396,9 @@ pub fn build_crt_file(
7398 .sanitize_c = .off,7396 .sanitize_c = .off,
7399 .sanitize_thread = false,7397 .sanitize_thread = false,
7400 .red_zone = comp.root_mod.red_zone,7398 .red_zone = comp.root_mod.red_zone,
7401 // Some libcs (e.g. musl) are opinionated about -fomit-frame-pointer.7399 .omit_frame_pointer = comp.root_mod.omit_frame_pointer,
7402 .omit_frame_pointer = options.omit_frame_pointer orelse comp.root_mod.omit_frame_pointer,
7403 .valgrind = false,7400 .valgrind = false,
7404 // Some libcs (e.g. MinGW) are opinionated about -funwind-tables.7401 .unwind_tables = comp.root_mod.unwind_tables,
7405 .unwind_tables = options.unwind_tables orelse .none,
7406 // Some CRT objects (e.g. musl's rcrt1.o and Scrt1.o) are opinionated about PIC.7402 // Some CRT objects (e.g. musl's rcrt1.o and Scrt1.o) are opinionated about PIC.
7407 .pic = options.pic orelse comp.root_mod.pic,7403 .pic = options.pic orelse comp.root_mod.pic,
7408 .optimize_mode = comp.compilerRtOptMode(),7404 .optimize_mode = comp.compilerRtOptMode(),
src/libs/freebsd.zig-1
...@@ -242,7 +242,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -242,7 +242,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
242 prog_node,242 prog_node,
243 files,243 files,
244 .{244 .{
245 .omit_frame_pointer = false,
246 .pic = true,245 .pic = true,
247 },246 },
248 );247 );
src/libs/libcxx.zig+1-1
...@@ -325,7 +325,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr...@@ -325,7 +325,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
325 // See the `-fno-exceptions` logic for WASI.325 // See the `-fno-exceptions` logic for WASI.
326 // The old 32-bit x86 variant of SEH doesn't use tables.326 // The old 32-bit x86 variant of SEH doesn't use tables.
327 const unwind_tables: std.lang.UnwindTables =327 const unwind_tables: std.lang.UnwindTables =
328 if (target.os.tag == .wasi or (target.cpu.arch == .x86 and target.os.tag == .windows)) .none else .async;328 if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .async;
329329
330 const config = Compilation.Config.resolve(.{330 const config = Compilation.Config.resolve(.{
331 .output_mode = output_mode,331 .output_mode = output_mode,
src/libs/libtsan.zig+1-1
...@@ -96,7 +96,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo...@@ -96,7 +96,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
96 .sanitize_c = .off,96 .sanitize_c = .off,
97 .sanitize_thread = false,97 .sanitize_thread = false,
98 .red_zone = comp.root_mod.red_zone,98 .red_zone = comp.root_mod.red_zone,
99 .omit_frame_pointer = optimize_mode != .Debug and !target.os.tag.isDarwin(),99 .omit_frame_pointer = comp.root_mod.omit_frame_pointer,
100 .valgrind = false,100 .valgrind = false,
101 .unwind_tables = unwind_tables,101 .unwind_tables = unwind_tables,
102 .optimize_mode = optimize_mode,102 .optimize_mode = optimize_mode,
src/libs/mingw.zig+1-8
...@@ -39,9 +39,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -39,9 +39,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
39 const arena = arena_allocator.allocator();39 const arena = arena_allocator.allocator();
40 const target = comp.getTarget();40 const target = comp.getTarget();
4141
42 // The old 32-bit x86 variant of SEH doesn't use tables.
43 const unwind_tables: std.lang.UnwindTables = if (target.cpu.arch != .x86) .async else .none;
44
45 switch (crt_file) {42 switch (crt_file) {
46 .crt2_o => {43 .crt2_o => {
47 var args = std.array_list.Managed([]const u8).init(arena);44 var args = std.array_list.Managed([]const u8).init(arena);
...@@ -60,7 +57,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -60,7 +57,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
60 };57 };
61 return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files, .{58 return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files, .{
62 .function_sections = false, // https://codeberg.org/ziglang/zig/issues/3070259 .function_sections = false, // https://codeberg.org/ziglang/zig/issues/30702
63 .unwind_tables = unwind_tables,
64 });60 });
65 },61 },
6662
...@@ -76,9 +72,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -76,9 +72,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
76 .owner = undefined,72 .owner = undefined,
77 },73 },
78 };74 };
79 return comp.build_crt_file("dllcrt2", .Obj, .@"mingw-w64 dllcrt2.o", prog_node, &files, .{75 return comp.build_crt_file("dllcrt2", .Obj, .@"mingw-w64 dllcrt2.o", prog_node, &files, .{});
80 .unwind_tables = unwind_tables,
81 });
82 },76 },
8377
84 .libmingw32_lib => {78 .libmingw32_lib => {
...@@ -157,7 +151,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -157,7 +151,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
157 }151 }
158152
159 return comp.build_crt_file("libmingw32", .Lib, .@"mingw-w64 libmingw32.lib", prog_node, c_source_files.items, .{153 return comp.build_crt_file("libmingw32", .Lib, .@"mingw-w64 libmingw32.lib", prog_node, c_source_files.items, .{
160 .unwind_tables = unwind_tables,
161 // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611154 // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611
162 .allow_lto = false,155 .allow_lto = false,
163 });156 });
src/libs/musl.zig-4
...@@ -43,7 +43,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro...@@ -43,7 +43,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
43 },43 },
44 };44 };
45 return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{45 return comp.build_crt_file("crt1", .Obj, .@"musl crt1.o", prog_node, &files, .{
46 .omit_frame_pointer = true,
47 .no_builtin = true,46 .no_builtin = true,
48 });47 });
49 },48 },
...@@ -61,7 +60,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro...@@ -61,7 +60,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
61 },60 },
62 };61 };
63 return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{62 return comp.build_crt_file("rcrt1", .Obj, .@"musl rcrt1.o", prog_node, &files, .{
64 .omit_frame_pointer = true,
65 .pic = true,63 .pic = true,
66 .no_builtin = true,64 .no_builtin = true,
67 });65 });
...@@ -80,7 +78,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro...@@ -80,7 +78,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
80 },78 },
81 };79 };
82 return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{80 return comp.build_crt_file("Scrt1", .Obj, .@"musl Scrt1.o", prog_node, &files, .{
83 .omit_frame_pointer = true,
84 .pic = true,81 .pic = true,
85 .no_builtin = true,82 .no_builtin = true,
86 });83 });
...@@ -166,7 +163,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro...@@ -166,7 +163,6 @@ pub fn buildCrtFile(comp: *Compilation, in_crt_file: CrtFile, prog_node: std.Pro
166 };163 };
167 }164 }
168 return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{165 return comp.build_crt_file("c", .Lib, .@"musl libc.a", prog_node, c_source_files.items, .{
169 .omit_frame_pointer = true,
170 .no_builtin = true,166 .no_builtin = true,
171 });167 });
172 },168 },
src/libs/openbsd.zig-2
...@@ -125,8 +125,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre...@@ -125,8 +125,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
125 const files = files_buf[0..files_index];125 const files = files_buf[0..files_index];
126126
127 return comp.build_crt_file("crt0", .Obj, .@"openbsd libc Scrt0.o", prog_node, files, .{127 return comp.build_crt_file("crt0", .Obj, .@"openbsd libc Scrt0.o", prog_node, files, .{
128 // Unclear why OpenBSD does this, but we'll do the same.
129 .omit_frame_pointer = if (target.cpu.arch.isX86()) false else null,
130 .pic = true,128 .pic = true,
131 });129 });
132 },130 },
test/src/StackTrace.zig+3-2
...@@ -72,6 +72,8 @@ fn addCaseTarget(...@@ -72,6 +72,8 @@ fn addCaseTarget(
72 .mips64el,72 .mips64el,
73 .sh,73 .sh,
74 .sheb,74 .sheb,
75 .xtensa,
76 .xtensaeb,
75 => .useless,77 => .useless,
76 .hexagon,78 .hexagon,
77 .powerpc,79 .powerpc,
...@@ -87,8 +89,7 @@ fn addCaseTarget(...@@ -87,8 +89,7 @@ fn addCaseTarget(
87 const supports_unwind_tables = switch (target.result.os.tag) {89 const supports_unwind_tables = switch (target.result.os.tag) {
88 // x86-windows just has no way to do stack unwinding other then using frame pointers.90 // x86-windows just has no way to do stack unwinding other then using frame pointers.
89 .windows => target.result.cpu.arch != .x86,91 .windows => target.result.cpu.arch != .x86,
90 // We do not yet implement support for the AArch32 exception table section `.ARM.exidx`.92 else => true,
91 else => !target.result.cpu.arch.isArm(),
92 };93 };
9394
94 const use_llvm_vals: []const bool = if (both_backends) &.{ true, false } else &.{true};95 const use_llvm_vals: []const bool = if (both_backends) &.{ true, false } else &.{true};