Merge pull request #21263 from alexrp/thumb-fixes

Some fixes for `thumb-linux-*` support
This commit is contained in:
Andrew Kelley 2024-09-06 10:55:45 -07:00 committed by GitHub
commit f29bdd6746
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 9 deletions

View File

@ -283,7 +283,9 @@ fn _start() callconv(.Naked) noreturn {
\\ mov fp, #0
\\ mov lr, #0
\\ mov a1, sp
\\ and sp, #-16
\\ mov ip, sp
\\ and ip, ip, #-16
\\ mov sp, ip
\\ b %[posixCallMainAndExit]
,
.csky =>

View File

@ -5536,10 +5536,6 @@ pub fn addCCArgs(
else => {},
}
if (target.cpu.arch.isThumb()) {
try argv.append("-mthumb");
}
{
var san_arg: std.ArrayListUnmanaged(u8) = .{};
const prefix = "-fsanitize=";
@ -5636,10 +5632,6 @@ pub fn addCCArgs(
try argv.append("-Werror=date-time");
}
if (target_util.supports_fpic(target) and mod.pic) {
try argv.append("-fPIC");
}
if (mod.unwind_tables) {
try argv.append("-funwind-tables");
} else {
@ -5730,6 +5722,14 @@ pub fn addCCArgs(
},
}
if (target.cpu.arch.isThumb()) {
try argv.append("-mthumb");
}
if (target_util.supports_fpic(target) and mod.pic) {
try argv.append("-fPIC");
}
try argv.ensureUnusedCapacity(2);
switch (comp.config.debug_format) {
.strip => {},

View File

@ -384,6 +384,7 @@ fn addCcArgs(
try args.appendSlice(&[_][]const u8{
"-std=c99",
"-ffreestanding",
"-fno-builtin",
"-fexcess-precision=standard",
"-frounding-math",
"-fno-strict-aliasing",
@ -422,6 +423,10 @@ fn addCcArgs(
"-Qunused-arguments",
"-w", // disable all warnings
});
if (target.cpu.arch.isThumb()) {
try args.append("-mimplicit-it=always");
}
}
fn start_asm_path(comp: *Compilation, arena: Allocator, basename: []const u8) ![]const u8 {