authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-06 10:55:45-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-09-06 10:55:45-07:00
logf29bdd6746691d0a547140e435056a000419480f
tree0ca346e932f845c4dc710dc00484c3c3b64c20e4
parent96fcc8d63bf8391e5cf2246e9427e9ab56399d86
parent0ecc6332b4eb1ced547ffa38f57471134aaa4d13
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #21263 from alexrp/thumb-fixes

Some fixes for `thumb-linux-*` support

3 files changed, 16 insertions(+), 9 deletions(-)

lib/std/start.zig+3-1
......@@ -283,7 +283,9 @@ fn _start() callconv(.Naked) noreturn {
283283 \\ mov fp, #0
284284 \\ mov lr, #0
285285 \\ mov a1, sp
286 \\ and sp, #-16
286 \\ mov ip, sp
287 \\ and ip, ip, #-16
288 \\ mov sp, ip
287289 \\ b %[posixCallMainAndExit]
288290 ,
289291 .csky =>
src/Compilation.zig+8-8
......@@ -5536,10 +5536,6 @@ pub fn addCCArgs(
55365536 else => {},
55375537 }
55385538
5539 if (target.cpu.arch.isThumb()) {
5540 try argv.append("-mthumb");
5541 }
5542
55435539 {
55445540 var san_arg: std.ArrayListUnmanaged(u8) = .{};
55455541 const prefix = "-fsanitize=";
......@@ -5636,10 +5632,6 @@ pub fn addCCArgs(
56365632 try argv.append("-Werror=date-time");
56375633 }
56385634
5639 if (target_util.supports_fpic(target) and mod.pic) {
5640 try argv.append("-fPIC");
5641 }
5642
56435635 if (mod.unwind_tables) {
56445636 try argv.append("-funwind-tables");
56455637 } else {
......@@ -5730,6 +5722,14 @@ pub fn addCCArgs(
57305722 },
57315723 }
57325724
5725 if (target.cpu.arch.isThumb()) {
5726 try argv.append("-mthumb");
5727 }
5728
5729 if (target_util.supports_fpic(target) and mod.pic) {
5730 try argv.append("-fPIC");
5731 }
5732
57335733 try argv.ensureUnusedCapacity(2);
57345734 switch (comp.config.debug_format) {
57355735 .strip => {},
src/musl.zig+5
......@@ -384,6 +384,7 @@ fn addCcArgs(
384384 try args.appendSlice(&[_][]const u8{
385385 "-std=c99",
386386 "-ffreestanding",
387 "-fno-builtin",
387388 "-fexcess-precision=standard",
388389 "-frounding-math",
389390 "-fno-strict-aliasing",
......@@ -422,6 +423,10 @@ fn addCcArgs(
422423 "-Qunused-arguments",
423424 "-w", // disable all warnings
424425 });
426
427 if (target.cpu.arch.isThumb()) {
428 try args.append("-mimplicit-it=always");
429 }
425430}
426431
427432fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![]const u8 {