aboutsummaryrefslogtreecommitdiff
path: root/src/target.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/target.zig')
-rw-r--r--src/target.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/target.zig b/src/target.zig
index 8ccec7f7a8..d032b0d16e 100644
--- a/src/target.zig
+++ b/src/target.zig
@@ -626,6 +626,17 @@ pub fn supportsFunctionAlignment(target: std.Target) bool {
};
}
+pub fn functionPointerMask(target: std.Target) ?u64 {
+ // 32-bit Arm uses the LSB to mean that the target function contains Thumb code.
+ // MIPS uses the LSB to mean that the target function contains MIPS16/microMIPS code.
+ return if (target.cpu.arch.isArm() or target.cpu.arch.isMIPS32())
+ ~@as(u32, 1)
+ else if (target.cpu.arch.isMIPS64())
+ ~@as(u64, 1)
+ else
+ null;
+}
+
pub fn supportsTailCall(target: std.Target, backend: std.builtin.CompilerBackend) bool {
switch (backend) {
.stage1, .stage2_llvm => return @import("codegen/llvm.zig").supportsTailCall(target),