4608 Commits

Author SHA1 Message Date
Andrew Kelley
52b24d5725 stage1: add some code comments for ConstValSpecial 2020-11-29 18:02:13 -07:00
Andrew Kelley
3fb0cc0a14 CLI: add missing usage help text 2020-11-29 16:32:24 -07:00
Andrew Kelley
263f25fea6
Merge pull request #7116 from joachimschmidt557/stage2-arm
stage2 ARM: add basic arithmetic instructions
2020-11-29 10:43:29 -08:00
LemonBoy
df99cfdf1e stage1: Fix typeInfo generation for arrays w/o sentinel
ZigTypeIdOptional types have a different way of specifying their payload
value depending on whether the child type is a pointer or not (plus some
other special cases).

Fixes #7251
2020-11-29 10:39:10 -08:00
LemonBoy
c80d196094 stage1: Add missing bitcast when rendering var ptr
Some types require this extra bitcast, eg. structs or unions with extra
padding fields inserted by the compiler.

Fixes #7250
2020-11-29 10:37:06 -08:00
Andrew Kelley
e701ac1a51
Merge pull request #7237 from koachan/sparc64-longdouble_fork
Add "long double" mapping and implement fork() on Linux/sparc64
2020-11-29 10:33:43 -08:00
joachimschmidt557
2ad2636588
stage2 ARM: use strb + implement genBoolOp 2020-11-28 18:19:22 +01:00
joachimschmidt557
f06f0ebcda
stage2 ARM: Implement genNot 2020-11-28 18:19:22 +01:00
joachimschmidt557
85a3991a43
stage2 codegen: use switch in genBoolOp 2020-11-28 18:19:22 +01:00
joachimschmidt557
27c5c97f21
stage2 ARM: genAdd, genSub for simple cases 2020-11-28 18:19:19 +01:00
Andrew Kelley
c3b0182f31 restore sonames by default when using zig cli
Before this commit, the branch regressed this case:

zig build-lib foo.zig -dynamic
readelf -d libfoo.so
 x000000000000000e (SONAME) Library soname: [libfoo.so]

Now it works again, but it preserves the property that using `zig cc`
has the SONAME off by default to match C compilers.
2020-11-27 17:49:55 -07:00
Jakub Konka
dd522c0c97 stage2 elf: fix glibc to always specify soname 2020-11-27 15:42:39 -07:00
Jakub Konka
375bab8460 stage2 elf: refactor override_soname to soname 2020-11-27 15:42:39 -07:00
Jakub Konka
12efefeba5 stage2 elf: make -soname an opt-in and not opt-out
As discussed with LemonBoy, it makes more sense to have the `-soname`
an opt-in option rather than opt-out, which is especially true if
we are to align `zig cc` with `cc` to a greater degree.
2020-11-27 15:42:39 -07:00
LemonBoy
f91df39ad2 stage1: Fix crash in *[N]T to []T conversion with zst
Prevent the crash by not making the codegen try to access the
non-existing ptr field in the slice.

Closes #6951
2020-11-27 14:33:26 -08:00
Jakub Konka
3bc1c719bd
Merge pull request #7231 from kubkon/stage2-arm-macos
stage2: Hello, Silicon!\n
2020-11-27 21:49:06 +01:00
Jakub Konka
5ed76268c9 stage2 macho: apply more review comments 2020-11-27 20:55:34 +01:00
Jakub Konka
02baaac506
Update src/codegen.zig
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2020-11-27 20:31:26 +01:00
Koakuma
cf2ee4ae2c Add sparc64 long double mapping 2020-11-27 18:51:50 +07:00
Jakub Konka
ebb2f20815 stage2 macho: Dir.copyFile does the rename for us! 2020-11-26 21:12:20 +01:00
Jakub Konka
a8f8d82215 stage2 macho: use Dir.copyFile instead of manual create+copy 2020-11-26 20:21:53 +01:00
LemonBoy
21c488ce68 stage1: Force union member types to be resolved
No test case because I couldn't reduce the huuuge test case.
Fixes the problem discovered by @ifreund.
2020-11-26 10:49:47 -08:00
Jakub Konka
7e8f7da3ec stage2 macho: rename inodes to prevent SIGKILL 2020-11-26 11:50:09 +01:00
Jakub Konka
64eae8f392 stage2 macho: move PIE fixups to link file; fix tests 2020-11-26 11:50:09 +01:00
Jakub Konka
c749b78df5 stage2 macho: add orr and orn instructions 2020-11-26 11:50:09 +01:00
Jakub Konka
10942e3f86 stage2 macho: Hello, Silicon! 2020-11-26 11:50:09 +01:00
Jakub Konka
2cd84b1b3f stage2 macho: refactor PIE generation on x86_64 2020-11-26 11:50:09 +01:00
Jakub Konka
ef5132c508 stage2 macho: first, rough draft at trampolining 2020-11-26 11:50:09 +01:00
Jakub Konka
80b1041c21 stage2 macho: use RIP-relative for memory-set regs x86_64 2020-11-26 11:50:09 +01:00
Jakub Konka
59fe3d447d stage2 macho: make file structure compatible with codesign tool 2020-11-26 11:50:09 +01:00
Jakub Konka
e7db372864 stage2 macho: cleanup logs 2020-11-26 11:50:09 +01:00
Jakub Konka
cd79c6dda1 stage2 macho: fix issues with codesigning 2020-11-26 11:50:09 +01:00
Jakub Konka
a6e93da717 stage2 macho: generate a code sig (not valid yet) 2020-11-26 11:50:09 +01:00
Jakub Konka
9dcf7ee9c9 stage2 macho: add info about __TEXT segment 2020-11-26 11:50:09 +01:00
Jakub Konka
79381dc4fb stage2 macho: add empty CodeDirectory blob 2020-11-26 11:50:09 +01:00
Jakub Konka
d14cd59ef0 stage2 macho: move code signature logic into struct 2020-11-26 11:50:09 +01:00
Jakub Konka
3ac804628f stage2 macho: write out constants in CS 2020-11-26 11:50:09 +01:00
Jakub Konka
2bd963ad6a stage2 macho: don't pad out holes between sections 2020-11-26 11:50:09 +01:00
Jakub Konka
403dc50ff7 stage2 macho: preallocate empty code sig space 2020-11-26 11:50:09 +01:00
Jakub Konka
bbc4ee3f17 stage2 macho: refactor 2020-11-26 11:50:09 +01:00
Jakub Konka
a2e0e33249 stage2 macho: bring back incremental symbol commits 2020-11-26 11:50:09 +01:00
Jakub Konka
e1b65ff8d2 stage2 macho: cleanup minimum version command 2020-11-26 11:50:09 +01:00
Jakub Konka
be0d5571d2 stage2 macho: revert required alignment always at 4 2020-11-26 11:50:09 +01:00
Jakub Konka
2972f630a4 stage2 macho: start reverting some tweaks 2020-11-26 11:50:09 +01:00
Jakub Konka
4e3520a2f7 stage2 macho: make page size target cpu arch dependent 2020-11-26 11:50:09 +01:00
Jakub Konka
8450e6f156 stage2 macho: pages need to be 16kb aligned! 2020-11-26 11:50:09 +01:00
Jakub Konka
4a3d757f3e stage2 MachO: reduce size of __TEXT segment 2020-11-26 11:50:09 +01:00
Jakub Konka
7a407246ed stage2 MachO: remove discontinuities between segments 2020-11-26 11:50:09 +01:00
Jakub Konka
6ac7e99dad Write local symbols when flushing 2020-11-26 11:50:09 +01:00
Jakub Konka
b3fdfe5ca0 stage2 MachO: clean up segment protection flags 2020-11-26 11:50:09 +01:00