diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-11-09 16:56:36 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-11-10 11:33:24 -0500 |
| commit | 91c3206b45074821749f52043937bf6ed6d9a105 (patch) | |
| tree | 5d6d674d146e4189bc22865bed42dea0f9ada320 /src/arch/aarch64/CodeGen.zig | |
| parent | b521510cd4e68407226dd95c9e87cc97ca5a0796 (diff) | |
| download | zig-91c3206b45074821749f52043937bf6ed6d9a105.tar.gz zig-91c3206b45074821749f52043937bf6ed6d9a105.zip | |
macho: use start.zig for macOS entrypoint
This effectively allows us to compile
```zig
pub fn main() void {}
```
which then calls into `std.start`.
Changes required to make this happen:
* handle signed int to immediate in x86_64 and aarch64 codegen
* ensure that on arm64 macOS, `.x19` is a caller-preserved register -
I'm not sure about that one at all and would like to brainstorm it
with anyone interested and especially Joachim.
* finally, fix a bug in the linker - mark new got entry as dirty upon
atom growth.
Diffstat (limited to 'src/arch/aarch64/CodeGen.zig')
| -rw-r--r-- | src/arch/aarch64/CodeGen.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig index a763651825..d3c72fe1b1 100644 --- a/src/arch/aarch64/CodeGen.zig +++ b/src/arch/aarch64/CodeGen.zig @@ -2393,6 +2393,9 @@ fn genTypedValue(self: *Self, typed_value: TypedValue) InnerError!MCValue { }, .Int => { const info = typed_value.ty.intInfo(self.target.*); + if (info.bits <= ptr_bits and info.signedness == .signed) { + return MCValue{ .immediate = @bitCast(u64, typed_value.val.toSignedInt()) }; + } if (info.bits > ptr_bits or info.signedness == .signed) { return self.fail("TODO const int bigger than ptr and signed int", .{}); } |
