10810 Commits

Author SHA1 Message Date
Andrew Kelley
6aa668e020
Merge pull request #6476 from kubkon/macho-exe
Link basic MachO executables with stage2
2020-10-04 19:05:45 -04:00
Andrew Kelley
302a69f127
Merge pull request #6295 from Vexu/stage2
Stage2: basic imports
2020-10-04 18:00:21 -04:00
Jakub Konka
c4054f8e0a Refactor flushing of MachO exe
This commit refactors free space analysis (and VM analysis) somewhat.
This is still far from perfect, but at least it's not using any
hardcoded values.

This commit also reorganizes different flushing bits here and there,
so that bit common to Exe and Obj are put in the common path, while
Exe-specific are behind an appropriate switch/if statement.
2020-10-04 15:31:47 +02:00
Jakub Konka
737a8bf204 Redo local symbols and offsets tracking to match Elf's approach 2020-10-04 15:31:47 +02:00
Jakub Konka
2ba23abd9d Add missing ensureCapacity call in codegen 2020-10-04 15:31:47 +02:00
Jakub Konka
f8dd48bcd2 Fix after rebase and enable stage2 tests for macOS
Also, rewrites codegen section to store symbol address in a register
to then later invoke `callq` on the register.
2020-10-04 15:31:47 +02:00
Jakub Konka
5a7105401c First hacked together, working MachO exe! 2020-10-04 15:31:47 +02:00
Jakub Konka
635984abc7 Move writing symbol table and export trie into functions 2020-10-04 15:31:47 +02:00
Jakub Konka
ccf9bba61f Write out LC_DYSYMTAB together with dyld_stub_binder undef symbol 2020-10-04 15:31:47 +02:00
Jakub Konka
a927f24201 Generate more MachO exe boilerplate
* Convert draft to generate all relevant segments and sections in right places
* Do not prealloc space in text blocks until we can NOP
* Write out LC_LOAD_DYLINKER command
* Add LC_LOAD_DYLIB command in order to specify to load libSystem
* Redo update decl exports (similar to Elf globals, globals need to be contiguous in
  memory)
2020-10-04 15:31:47 +02:00
Jakub Konka
57a81bb559 Re-draft required elements for minimal MachO binary 2020-10-04 15:31:47 +02:00
Jakub Konka
0e2d858d69 Revert back to original Win CI install script
Since msys2/MSYS2-packages#2050 was fixed, we can now revert back to the
original install script.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-04 11:53:07 +02:00
Andrew Kelley
8170a3d574
Merge pull request #6463 from jedisct1/ghash
std/crypto: add GHASH implementation
2020-10-04 02:46:36 -04:00
Andrew Kelley
5fda4fe4c8
Merge pull request #6454 from jedisct1/hkdf
std/crypto: implement the HKDF construction
2020-10-04 02:45:54 -04:00
LemonBoy
538d485782 std: Add pow(a,b) for big ints
Implemented following Knuth's "Evaluation of Powers" chapter in TAOCP,
some extra complexity is needed to make sure there's no aliasing and
avoid allocating too many limbs.

A brief example to illustrate why the last point is important:
consider 10^123, since 10 is well within the limits of a single limb we
can safely say that the result will surely fit in:

⌈log2(10)⌉ bit * 123 = 492 bits = 7 limbs

A naive calculation using only the number of limbs yields:

1 limb * 123 = 123 limbs

The space savings are noticeable.
2020-10-04 02:24:40 -04:00
Andrew Kelley
2de53592a1 stage1: better value for builtin.link_mode
Now it is Dynamic unless -DZIG_STATIC=on is passed to cmake.

This partially addresses #6469.
2020-10-03 23:15:45 -07:00
John Sullivan
ab7ea53541 cmake: add option to use llvm-config to find cross-target llvm deps 2020-10-04 00:41:32 -04:00
Alexandros Naskos
52ba2c3a43 Reintroduce progress bar when compiling C files 2020-10-03 22:11:29 -04:00
Tadeo Kondrak
9917b0576a stage0: check for some more required parameters 2020-10-03 21:32:32 -04:00
Tadeo Kondrak
cbdd825056 stage1: delete unused os code 2020-10-03 21:31:08 -04:00
Tadeo Kondrak
26546af1b8 Revert "Include dbg.h to third-party libs"
This reverts commit c8b4cc2ff9cf15a42f95b2302e02431a0004f5c8.

This includes many C++ standard library headers:

  #include <algorithm>
  #include <chrono>
  #include <ctime>
  #include <iomanip>
  #include <ios>
  #include <iostream>
  #include <memory>
  #include <sstream>
  #include <string>
  #include <tuple>
  #include <type_traits>
  #include <vector>

which adds more than a second of compile time for each file that
includes the header:

  ir.cpp before: 8.041s
  ir.cpp after: 6.847s
2020-10-03 21:29:29 -04:00
Andrew Kelley
d1e779cea8 ci: update azure msys base installer
hopefully resolves the CI failures
2020-10-03 17:33:51 -07:00
Andrew Kelley
b306149b22 zig run foo.c is perfectly valid 2020-10-03 17:27:09 -07:00
Andrew Kelley
a2b86777b5 fix alignment in CLI usage text 2020-10-03 17:21:45 -07:00
Andrew Kelley
0e7523c7d7 stage1 main(): catch unreachable in debug builds for easier troubleshooting
Fixup to 2a3393eff853fe0a1dee766c859a345186e91fa3
2020-10-03 17:16:19 -07:00
Andrew Kelley
70f3767903 revert adding std.event.Loop.runDetached
I'd like to discuss this before adding it. I think this is the wrong
direction to go with this API.
2020-10-03 17:13:22 -07:00
Alexandros Naskos
f3397fad68
Merge pull request #6519 from LemonBoy/fix-6497
stage2: Build libunwind for non-msvc Windows targets
2020-10-04 01:23:35 +03:00
LemonBoy
3b40b68210 stage2: Build libunwind for non-msvc Windows targets
Closes #6497
2020-10-03 20:47:06 +02:00
Alexandros Naskos
4396373ccb
Merge pull request #6503 from kristoff-it/fix-darwin-symlink-exe
fix symlink path not being resolved in darwin
2020-10-03 18:29:44 +03:00
Loris Cro
276598346a provide the full buffer length to _NSGetExecutablePath
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-03 12:03:22 +02:00
Alexandros Naskos
e31cc80130
Merge pull request #6427 from tadeokondrak/enums-explicit-tag-type-extern-allowed
Allow enums with explicit extern-allowed tag types in extern types
2020-10-03 12:51:39 +03:00
Alexandros Naskos
b5034bd776
Merge pull request #6506 from FireFox317/stage2-cli
Print error when running `zig test/run` without a source file
2020-10-03 12:47:49 +03:00
Timon Kruiper
539e90e26d Print error when running zig test/run without a source file
Closes #6498
2020-10-02 19:59:00 +02:00
Loris Cro
f841ea77e2 make symlink buffer null-terminated
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 19:33:14 +02:00
Loris Cro
a2074c1ec3 fix symlink path not being resolved in darwin
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-10-02 17:06:29 +02:00
Alexandros Naskos
e9434ff8f4
Merge pull request #6430 from jedisct1/llvm-config
Print the llvm-config path on configuration error
2020-10-02 17:02:08 +03:00
Alexandros Naskos
55eb7c16c0
Merge pull request #6494 from IridescentRose/emit-reloc-patch
Emit reloc patch
2020-10-02 17:00:47 +03:00
Alexandros Naskos
cd4c1ea790
Merge pull request #6491 from markfirmware/patch-2
Fixes --linker-script unrecognized
2020-10-02 17:00:22 +03:00
Alexandros Naskos
006b780d44
Merge pull request #6484 from LemonBoy/winshit
Some windows fixes
2020-10-02 15:05:44 +03:00
Alexandros Naskos
e207031837
Merge pull request #6402 from tadeokondrak/@Type(.Fn)
Implement @Type for Fn
2020-10-02 09:44:27 +03:00
Tadeo Kondrak
65016dff32
Add test for implicit extern-allowed enum tag type in extern struct 2020-10-01 18:10:20 -06:00
Tadeo Kondrak
cae49b1b9d
Add tests for enums with explicit extern-allowed tag types in extern types 2020-10-01 18:09:47 -06:00
Tadeo Kondrak
61ce72a38c
Allow enums with explicit extern-allowed tag types in extern types
Closes https://github.com/ziglang/zig/issues/1467
2020-10-01 18:09:15 -06:00
Tadeo Kondrak
183d1d4ba1
Switch TypeInfo.Fn.alignment to comptime_int from u29
All integers in TypeInfo are intentionally comptime_int:
https://github.com/ziglang/zig/issues/1683
2020-10-01 18:01:41 -06:00
Tadeo Kondrak
96a151d4b8
Skip @Type/@typeInfo Fn/BoundFn tests on wasm32/wasm64 2020-10-01 18:01:40 -06:00
Tadeo Kondrak
e18fdc12b0
stage1: Implement @Type for Fn and BoundFn 2020-10-01 18:01:38 -06:00
Tadeo Kondrak
97ab720d84
stage1: Add alignment to TypeInfo.Fn 2020-10-01 17:59:42 -06:00
Alexandros Naskos
0228887b94
Merge pull request #6428 from tadeokondrak/alignment-typeinfo-struct-union
Add alignment field to TypeInfo.UnionField and TypeInfo.StructField
2020-10-02 02:56:18 +03:00
Nathan
84b6d2a80a Resolved additional formatting issues. 2020-10-01 18:03:34 -04:00
Nathan
5e3ce11b18 Resolve name and format issues. 2020-10-01 17:47:32 -04:00