Commit Graph

448 Commits (d34a3c66b36e3afc8ea7f275b449033fa7a1b4bc)

Author SHA1 Message Date
LemonBoy d4434dfb67 compiler-rt: Add __floatundidf & __floatunsidf
Add AEABI builtins __aeabi_ul2d, __aeabi_ui2d
2019-05-08 23:57:09 +02:00
LemonBoy 917103710e compiler-rt: Add __floatsidf & __floatsisf
Also add their AEABI aliases, __aeabi_i2f & __aeabi_i2d
2019-05-08 22:26:54 +02:00
LemonBoy be7cacfbbe Implement stack probes for x86/x86_64
Enabled on non-Windows systems only since it already requires stack
probes.
2019-05-08 12:36:54 -04:00
LemonBoy d8ab301aa8 std: Implement TLS support for Linux
Tested on x86_64, i386, ARM, AARCH64
2019-05-07 13:09:18 +02:00
tgschultz 4dfd1f54db Ugh. I updated these but forgot to git add. 2019-05-04 03:08:33 +00:00
Marc Tiehuis 40fe6afdad Don't install zig_cpp lib for stage2 target
Missed in last commit. See #2220.
2019-05-01 21:01:34 +12:00
Marc Tiehuis 81767a658d Don't install stage2 artifacts
Fixes #2220.
2019-04-30 12:13:41 -04:00
LemonBoy b1a61a6d51 compiler-rt: Add __mulodi4 2019-04-29 18:55:20 -04:00
Andrew Kelley 2d6520d5d4
zig fmt is built directly into stage1 rather than child process
Previously, `zig fmt` on the stage1 compiler (which is what we currently
ship) would perform what equates to `zig run std/special/fmt_runner.zig`

Now, `zig fmt` is implemented with the hybrid zig/C++ strategy outlined
by #1964.

This means Zig no longer has to ship some of the stage2 .zig files, and
there is no longer a delay when running `zig fmt` for the first time.
2019-04-26 20:46:28 -04:00
Andrew Kelley 976080462c
translate-c: a little closer to self-hosted implementation 2019-04-25 00:06:54 -04:00
vegecode 01168e1577 compiler-rt: add aeabi_dcmp, comparedf2 2019-04-24 21:15:39 -04:00
Michael Dusan 5de934810f add -fvisibility-inlines-hidden
On macOS building with Xcode/clang the linker complains loudly when
symbol visibility is inconsistent. This option syncs visibilty setting
of both LLVM and Zig.
2019-04-24 14:37:14 -04:00
Andrew Kelley ed41955522
build libuserland in cross compilation mode
Previously libuserland was being built for the native target,
which could depend on native CPU features such as AVX. The
CI infrastructure is intending to create binaries that are
widely compatible and do not make use of specific CPU features.

There could be something to gain from enabling native CPU features
sometimes, by introducing a new cmake configuration option, but
since it's planned to eventually ship self-hosted rather than stage1,
I don't think it really matters.

closes #2348
2019-04-24 14:13:55 -04:00
emekoi 0f8fc3b924 fixed stack protector issues 2019-04-21 14:13:48 -04:00
vegecode bb25f212b3 compiler-rt: add aeabi_fcmp, comparesf2 2019-04-21 00:12:21 -04:00
Andrew Kelley 4ad7d09ba5
build: rename zig1 to zig0 to avoid confusion with stage1 2019-04-17 14:09:18 -04:00
Andrew Kelley 89763c9a0d
stage1 is now a hybrid of C++ and Zig
This modifies the build process of Zig to put all of the source files
into libcompiler.a, except main.cpp and userland.cpp.

Next, the build process links main.cpp, userland.cpp, and libcompiler.a
into zig1. userland.cpp is a shim for functions that will later be
replaced with self-hosted implementations.

Next, the build process uses zig1 to build src-self-hosted/stage1.zig
into libuserland.a, which does not depend on any of the things that
are shimmed in userland.cpp, such as translate-c.

Finally, the build process re-links main.cpp and libcompiler.a, except
with libuserland.a instead of userland.cpp. Now the shims are replaced
with .zig code. This provides all of the Zig standard library to the
stage1 C++ compiler, and enables us to move certain things to userland,
such as translate-c.

As a proof of concept I have made the `zig zen` command use text defined
in userland. I added `zig translate-c-2` which is a work-in-progress
reimplementation of translate-c in userland, which currently calls
`std.debug.panic("unimplemented")` and you can see the stack trace makes
it all the way back into the C++ main() function (Thanks LemonBoy for
improving that!).

This could potentially let us move other things into userland, such as
hashing algorithms, the entire cache system, .d file parsing, pretty
much anything that libuserland.a itself doesn't need to depend on.

This can also let us have `zig fmt` in stage1 without the overhead
of child process execution, and without the initial compilation delay
before it gets cached.

See #1964
2019-04-16 19:12:20 -04:00
Shritesh Bhattarai 93d43d4529 wasi: add std/os/wasi{,/core}.zig to CMakeLists.txt 2019-04-13 22:51:18 -05:00
Marc Tiehuis 5f4fcd5030 Add initial big.Rational type 2019-04-11 19:36:35 +12:00
Andrew Kelley bddbbef32b
Release 0.4.0 2019-04-08 15:41:41 -04:00
vegecode d72239d339 Add divdf3 to compiler_rt
Also adds __aeabi_ddiv for arm32 targets
2019-04-05 18:10:19 -04:00
Andrew Kelley 1dc6751721
fix NaN comparing equal to itself
This was broken both in comptime code and in runtime code.

closes #1174
2019-04-04 22:07:15 -04:00
Andrew Kelley be0f656c21
fix `@divFloor` returning incorrect value and add `__modti3`
Closes #2152
See #1290
2019-04-04 15:45:37 -04:00
vegecode 12c4ab3927 Add divsf3 to compiler rt 2019-04-04 15:38:09 -04:00
vegecode 779137be41 Add __aeabi_{f,d}neg and __neg{s,d,X}f2 to compiler-rt 2019-03-31 15:54:02 -05:00
emekoi cf4e9a27c5 removed static build flags on mingw 2019-03-27 12:49:26 -04:00
Andrew Kelley d83836825f
add mulXf3 to compiler-rt
this adds the following functions to compiler-rt:

 * `__mulsf3`
 * `__muldf3`
 * `__multf3`

See #1290
2019-03-22 17:46:49 -04:00
Shawn Landden b76398c993 std: add ascii with C ASCII character classes
Does NOT look at the locale the way the C functions do.

       int isalnum(int c);
       int isalpha(int c);
       int iscntrl(int c);
       int isdigit(int c);
       int isgraph(int c);
       int islower(int c);
       int isprint(int c);
       int ispunct(int c);
       int isspace(int c);
       int isupper(int c);
       int isxdigit(int c);

       int isascii(int c);
       int isblank(int c);

       int toupper(int c);
       int tolower(int c);

Tested to match glibc (when using C locale) with this program:

const c = @cImport({
    // See https://github.com/ziglang/zig/issues/515
    @cDefine("_NO_CRT_STDIO_INLINE", "1");
    @cInclude("stdio.h");
    @cInclude("string.h");
    @cInclude("ctype.h");
});

const std = @import("std");
const ascii = std.ascii;
const abort = std.os.abort;

export fn main(argc: c_int, argv: **u8) c_int {
    var i: u8 = undefined;
    i = 0;
    while (true) {
        if (ascii.isAlNum(i) != (c.isalnum(i) > 0)) { abort(); }
        if (ascii.isAlpha(i) != (c.isalpha(i) > 0)) { abort(); }
        if (ascii.isCtrl(i) != (c.iscntrl(i) > 0)) { abort(); }
        if (ascii.isDigit(i) != (c.isdigit(i) > 0)) { abort(); }
        if (ascii.isGraph(i) != (c.isgraph(i) > 0)) { abort(); }
        if (ascii.isLower(i) != (c.islower(i) > 0)) { abort(); }
        if (ascii.isPrint(i) != (c.isprint(i) > 0)) { abort(); }
        if (ascii.isPunct(i) != (c.ispunct(i) > 0)) { abort(); }
        if (ascii.isSpace(i) != (c.isspace(i) > 0)) { abort(); }
        if (ascii.isUpper(i) != (c.isupper(i) > 0)) { abort(); }
        if (ascii.isXDigit(i) != (c.isxdigit(i) > 0)) { abort(); }
        if (i == 255) { break; }
        i += 1;
    }

    _ = c.printf(c"Success!\n");
    return 0;
}
2019-03-22 16:25:56 -04:00
Andrew Kelley 4615ed5ea0
float literals now parse using musl's 128 bit float code
fixes float literals not having 128 bit precision
2019-03-22 14:56:03 -04:00
Andrew Kelley a581f4f0e2
Merge remote-tracking branch 'origin/master' into llvm8 2019-03-18 20:03:23 -04:00
Andrew Kelley db0e188f0e update macos static build for llvm8 2019-03-18 18:36:35 -04:00
Andrew Kelley 7dfbeca13e
libc: separate linux headers from musl/glibc 2019-03-18 13:47:59 -04:00
Andrew Kelley c8453454e1
add missing std lib file rb.zig to cmakelists.txt 2019-03-17 13:52:45 -04:00
Andrew Kelley d213708333
this empty import workaround no longer necessary 2019-03-13 14:13:09 -04:00
Andrew Kelley 54edbc6815 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-13 12:56:58 -04:00
emekoi 1ed38a682e added z3 and fixed dynamic linker on mingw 2019-03-13 10:37:53 -04:00
Andrew Kelley c73cd05468
musl: remove files that have case conflicts 2019-03-13 01:00:12 -04:00
Andrew Kelley 9741b2aab4
avoid a string that is too long for msvc 2019-03-12 18:09:40 -04:00
Andrew Kelley 5570bc986b
remove accidental swap file 2019-03-12 17:44:03 -04:00
Andrew Kelley 62486c35a4
ability to build musl from source
bundles musl 1.1.21

See #514
2019-03-12 17:32:32 -04:00
Andrew Kelley 5734b7a37a
building musl start files from source 2019-03-12 13:18:52 -04:00
Andrew Kelley b7c331eb61
add musl headers 2019-03-12 10:30:12 -04:00
Andrew Kelley 5362ca204f
Merge branch 'valgrind' of https://github.com/daurnimator/zig into daurnimator-valgrind 2019-03-11 13:27:04 -04:00
Andrew Kelley 3cdd2c0bdd Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 13:48:06 -04:00
Andrew Kelley 8369ddb09c
glibc: add missing linux header 2019-03-09 01:24:30 -05:00
Jay Weisskopf cddc77dd97 Remove glibc compat shim with restrictive license
Unlike the other glibc source code checked into the repo, `csu/init.c`
did not have a license clause that allowed linking without restrictions.

`_IO_stdin_used` is the only symbol in the file and appears to be a 20
year old compatibility shim for the glibc 2.0 ABI. Obsolete in 2.1.
2019-03-08 08:46:06 -05:00
Andrew Kelley ce76de35f1
multi-arch glibc headers 2019-03-07 12:16:10 -05:00
Andrew Kelley 697b1233f0
support other architectures for glibc startup files 2019-03-06 12:10:03 -05:00
Andrew Kelley b554f6294f
add popcountdi2 to compiler_rt 2019-03-05 23:09:00 -05:00
Andrew Kelley ba144b366c
build libunwind.a from source and link it 2019-03-05 22:45:41 -05:00
Andrew Kelley 4c386436ea
support glibc dl, m, pthread, rt 2019-03-05 18:17:22 -05:00
Andrew Kelley c5fdea59d3
building glibc from source 2019-03-05 13:26:59 -05:00
Andrew Kelley aeb16010f3
initial glibc support 2019-03-04 22:15:53 -05:00
Andrew Kelley 0714e19598
Merge remote-tracking branch 'origin/master' into llvm8 2019-03-04 08:24:56 -05:00
Andrew Kelley e402455704
rename std lib files to new convention 2019-03-02 16:46:04 -05:00
Andrew Kelley 67b4de33d2
compile error for import outside package path
closes #2024

there's a new cli option `--main-pkg-path` which you can use to choose
a different root package directory besides the one inferred from the
root source file

and a corresponding build.zig API:
foo.setMainPkgPath(path)
2019-03-02 10:38:27 -05:00
Andrew Kelley 2dcf1a2392
Merge remote-tracking branch 'origin/master' into llvm8 2019-02-28 09:19:18 -05:00
Andrew Kelley 4563f6b424
add builder.addFmt API and use it to test stage1 zig fmt
closes #1968
2019-02-26 18:10:40 -05:00
John Schmidt 0eed72d687 Add priority queue 2019-02-26 13:21:11 -05:00
Andrew Kelley a77a17e2c2
add `zig cc` command to act like a C compiler
closes #490
2019-02-24 12:53:28 -05:00
Andrew Kelley 6fd8d455bc
better libc detection (#1996)
* better libc detection

This introduces a new command `zig libc` which prints
the various paths of libc files. It outputs them to stdout
in a simple text file format that it is capable of parsing.
You can use `zig libc libc.txt` to validate a file.

These arguments are gone:
--libc-lib-dir [path]        directory where libc crt1.o resides
--libc-static-lib-dir [path] directory where libc crtbegin.o resides
--msvc-lib-dir [path]        (windows) directory where vcruntime.lib resides
--kernel32-lib-dir [path]    (windows) directory where kernel32.lib resides

Instead we have this argument:
--libc [file]                Provide a file which specifies libc paths

This is used to pass a libc text file (which can be generated with
`zig libc`). So it is easier to manage multiple cross compilation
environments.

`--cache on` now works when linking against libc.

`ZigTarget` now has a bool field `is_native`

Better error messaging when you try to link against libc or use
`@cImport` but the various paths cannot be found. It should also be
faster.

* save native_libc.txt in zig-cache

This avoids having to detect libc at runtime on every invocation.
2019-02-23 09:35:56 -05:00
daurnimator da7880b4cf
std: Add valgrind module 2019-02-20 16:52:20 +11:00
Andrew Kelley 3e586264e5
Merge pull request #1972 from coypoop/netbsd
Add NetBSD support
2019-02-18 00:10:31 -05:00
Maya Rashish bc10382ec1 Add NetBSD support
Mostly picking the same paths as FreeBSD.
We need a little special handling for crt files, as netbsd uses its
own (and not GCC's) for those, with slightly different names.
2019-02-17 09:17:34 +02:00
Andrew Kelley 356cfa08f4
translate-c: proof of concept for transitioning to userland
See #1964
2019-02-16 15:26:44 -05:00
Andrew Kelley ba56f365c8
bring zig fmt to stage1 2019-02-16 00:53:32 -05:00
Marc Tiehuis c34ce6878e Add parseFloat to std.fmt
This is not intended to be the long-term implementation as it doesn't
provide various properties that we eventually will want (e.g.
round-tripping, denormal support). It also uses f64 internally so the
wider f128 will be inaccurate.
2019-02-14 00:07:51 +13:00
Marc Tiehuis be861a85c8 compiler-rt: Add __addtf3, __subtf3 and __truncdfhf2
Allows addition/subtraction of f128 and narrowing casts to f16 from
larger float types.
2019-02-13 23:24:52 +13:00
Andrew Kelley 1864acd326
Merge remote-tracking branch 'origin/master' into llvm8 2019-02-09 18:57:39 -05:00
Andrew Kelley c2db077574
std.debug.assert: remove special case for test builds
Previously, std.debug.assert would `@panic` in test builds,
if the assertion failed. Now, it's always `unreachable`.

This makes release mode test builds more accurately test
the actual code that will be run.

However this requires tests to call `std.testing.expect`
rather than `std.debug.assert` to make sure output is correct.

Here is the explanation of when to use either one, copied from
the assert doc comments:

Inside a test block, it is best to use the `std.testing` module
rather than assert, because assert may not detect a test failure
in ReleaseFast and ReleaseSafe mode. Outside of a test block, assert
is the correct function to use.

closes #1304
2019-02-08 18:23:38 -05:00
Andrew Kelley 3e08b3a4f8
update embedded LLD to 8.0.0rc2 2019-02-07 17:07:18 -05:00
Andrew Kelley 89ffb58197 implement Thread Local Storage on Windows 2019-02-06 18:32:41 -05:00
Andrew Kelley d2602b442e
require running std lib tests coherently
this should actually improve CI times a bit too

See the description at the top of std/os/startup.zig (deleted in this
commit) for a more detailed understanding of what this commit does.
2019-02-06 14:32:20 -05:00
Andrew Kelley b1775ca168
thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
Andrew Kelley bfc1772d8e fixups 2019-02-01 12:22:21 -05:00
Andrew Kelley d8b6fa9134
Merge pull request #1859 from mgxm/fbsd2
Progress towards tier 1 support for FreeBSD x86_64
2018-12-29 12:49:23 -05:00
Andrew Kelley a918ce26b8
fixups 2018-12-26 15:25:54 -05:00
nebulaeonline fdea12b2d9 msvc subsystem option handling; added uefi os type 2018-12-23 22:44:02 -05:00
Marcio Giaxa 666b153144 freebsd: remove syscall files 2018-12-19 18:41:40 -02:00
Wink Saville 634d11ab28 Add add compiler_rt routines for float to signed integer conversion
And add std.math.f128_* constants.

The routines are:

  __fixdfdi, __fixdfsi, __fixdfti,
  __fixsfdi, __fixsfsi, __fixsfti,
  __fixtfdi, __fixtfsi, __fixtfti.

These all call fixint which is a generic zig function that does the
conversion:

  pub fn fixint(comptime fp_t: type, comptime fixint_t: type, a: fp_t) fixint_t

There are also a set tests:

  __fixdfdi_test, __fixdfsi_test, __fixdfti_test,
  __fixsfdi_test, __fixsfsi_test, __fixsfti_test,
  __fixtfdi_test, __fixtfsi_test, __fixtfti_test.
2018-12-12 00:21:42 -05:00
Andrew Kelley a40d160a5c
introduce std.io.SeekableStream
Relevant #764

dwarf debug info is modified to use this instead of std.os.File
directly to make it easier for bare metal projects to take advantage
of debug info parsing
2018-12-02 18:36:18 -05:00
Andrew Kelley 9493738e54
Merge branch 'freebsd-up' of https://github.com/myfreeweb/zig into freebsd2 2018-11-19 17:24:41 -05:00
tgschultz 58610a4427 Add std.meta to deployment (#1670) 2018-10-20 11:40:26 -04:00
Greg V e5627f8e63 Support more of std on FreeBSD 2018-10-20 15:21:35 +03:00
Greg V afe26bbcbd System call numbers on FreeBSD are machine-independent
But e.g. sbrk is only removed in new architectures (aarch64, riscv),
so keep it in x86_64
2018-10-20 15:15:01 +03:00
Greg V 1829c09303 Fix os/freebsd files 2018-10-20 15:15:01 +03:00
Andrew Kelley 3e72411db0
C ABI and compiler rt improvements for ARM
* add __multi3 compiler rt function. See #1290
* compiler rt includes ARM functions for thumb and aarch64 and
  other sub-arches left out. See #1526
* support C ABI for returning structs on ARM. see #1481
2018-10-13 15:18:00 -04:00
emekoi a22d9daaec added math.pow support for integer types. resolves #1637 (#1642)
added math.powi for integers; pow now handles ints
2018-10-10 10:50:23 -04:00
Andrew Kelley d40c4e7c89
Merge pull request #1429 from shawnl/arm64
initial arm64 support
2018-10-06 00:11:39 -04:00
Andrew Kelley d07413f9b7
fix missing .h files
closes #1634
2018-10-04 18:14:57 -04:00
Andrew Kelley 66cb75d114
std.Mutex: implement blocking mutexes on linux
closes #1463

Thanks to Shawn Landden for the original pull request.
This commit is based on that code.
2018-10-03 13:19:10 -04:00
Andrew Kelley 9d4eaf1e07
update std lib API for I/O
std.io.FileInStream -> std.os.File.InStream
std.io.FileInStream.init(file) -> file.inStream()
std.io.FileOutStream -> std.os.File.OutStream
std.io.FileOutStream.init(file) -> file.outStream()

remove a lot of error code possibilities from os functions

std.event.net.socketRead -> std.event.net.read
std.event.net.socketWrite -> std.event.net.write
add std.event.net.readv
add std.event.net.writev
add std.event.net.readvPosix
add std.event.net.writevPosix
add std.event.net.OutStream
add std.event.net.InStream

add std.event.io.InStream
add std.event.io.OutStream
2018-09-30 17:28:35 -04:00
Andrew Kelley 418b2e7d47
build: omit finding libxml2, zlib since no direct dependency 2018-09-30 16:56:06 -04:00
Andrew Kelley 57c4d38c55
rename std.event.tcp to std.event.net 2018-09-30 10:37:58 -04:00
emekoi e6446dfc86 fixed native target detection 2018-09-30 09:27:53 -04:00
Andrew Kelley e242f6a609
Release 0.3.0 2018-09-28 09:03:40 -04:00
Andrew Kelley f4a0658585 rely on gcc for static builds on macos 2018-09-27 22:27:52 -04:00
Andrew Kelley fe524a1fa5 build: add support for ZIG_STATIC on MacOS 2018-09-27 15:09:14 -04:00
Andrew Kelley 492821781d
add workaround for `llvm-config --system-libs`
not handling static libs correctly
2018-09-19 18:28:50 -04:00
Andrew Kelley 4b2719b51d
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-18 15:05:47 -04:00
emekoi 68c1d05917 compiling on mingw is now supported (#1542)
* compiles on mingw-w64
* fixed error in os_file_overwrite on windows
* fixed windows hello_world example
2018-09-18 00:13:17 -04:00
Andrew Kelley 4c6f1e614a
remove `zig build --init`. add `zig init-lib` and `zig init-exe`
init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.

both now have test coverage with the new "cli tests" file.

closes #1035
2018-09-17 17:11:18 -04:00
Andrew Kelley a2abdb185f
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-16 10:51:58 -04:00
Andrew Kelley a1132ffe0f stage1: build blake code with -std=c99 2018-09-11 17:29:18 -04:00
Andrew Kelley 5ee5933ade
stage1 caching: zig no longer uses zig-cache 2018-09-10 17:30:45 -04:00
Andrew Kelley c9474faa4e
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-10 12:30:57 -04:00
Andrew Kelley fbe5737c84
stage1: always optimize blake and softfloat even in debug mode 2018-09-10 09:46:15 -04:00
Andrew Kelley 173fc842c4
basic compiler id hash working 2018-09-09 18:38:41 -04:00
Shawn Landden 342cff28f5 initial arm64 support 2018-09-08 03:52:28 +00:00
Andrew Kelley 2d4b95900e
stage1: import blake2b implementation
from master branch of blake2 reference implementation
320c325437539ae91091ce62efec1913cd8093c2
2018-09-05 23:23:11 -04:00
Andrew Kelley ba7836ea48 stage1: fix build on macos 2018-09-05 12:10:53 -04:00
Andrew Kelley 9a123697e3
fix compile error on gcc 7.3.0
Only set -Werror for debug builds, and only for zig itself, not for
embedded LLD.

See #1474
2018-09-05 10:18:12 -04:00
Andrew Kelley ac3cf0775f
Merge pull request #1474 from ziglang/issue-1357
Downgrade new g++-8.0 error to warning
2018-09-05 09:05:01 -04:00
Marc Tiehuis ef2b8d4574 Downgrade new g++-8.0 error to warning
Allows building in Debug mode. Closes #1357.
2018-09-05 20:43:14 +12:00
Andrew Kelley dbde8254d0
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-04 11:58:31 -04:00
Andrew Kelley 2bd2a8ea34
Merge pull request #1441 from ziglang/poly1305-x25519
Add poly1305 and x25519 crypto primitives
2018-09-04 10:34:46 -04:00
Andrew Kelley 92f7474359 switch most windows calls to use W versions instead of A
See #534
2018-09-02 23:25:04 -04:00
Marc Tiehuis 65b89f598c Add poly1305 and x25519 crypto primitives
These are translated from [monocypher](https://monocypher.org/) which
has fairly competitive performance while remaining quite simple.

Initial performance comparision:

Zig:
 Poly1305: 1423 MiB/s
 X25519:   8671 exchanges per second

Monocypher:
 Poly1305: 1567 MiB/s
 X25519:   10539 exchanges per second

There is room for improvement and no real effort has been made at all in
optimization beyond a direct translation.
2018-08-30 18:02:19 +12:00
Andrew Kelley f1b71053de use RtlCaptureStackBackTrace on windows 2018-08-29 16:35:51 -04:00
Andrew Kelley 41723f842c Merge branch 'windows-coff-issue721' of https://github.com/Sahnvour/zig into Sahnvour-windows-coff-issue721 2018-08-28 17:32:32 -04:00
Shawn Landden 444edd9aed std.crypto: add chaCha20
v3
2018-08-27 19:44:11 -07:00
Andrew Kelley 7109035b78 Merge remote-tracking branch 'origin/master' into llvm7 2018-08-25 21:57:28 -04:00
Andrew Kelley c4d31c8323 build: update embedded LLD build files 2018-08-04 18:09:19 -04:00
Andrew Kelley e3ae2cfb52 add std.event.RwLock and a few more std changes
* add std.event.RwLock and std.event.RwLocked
 * std.debug.warn does its printing locked
 * add std.Mutex, however it's currently implemented as a spinlock
 * rename std.event.Group.cancelAll to std.event.Group.deinit and change
   the docs and assumptions.
 * add std.HashMap.clone
2018-08-01 16:26:37 -04:00
Andrew Kelley cc45527333 introduce std.event.fs for async file system functions
only works on linux so far
2018-07-30 13:44:36 -04:00
Andrew Kelley 5a919dd82d Merge remote-tracking branch 'origin/master' into self-hosted-libc-hello-world 2018-07-23 14:32:13 -04:00
Andrew Kelley 93e78ee722 self-hosted can compile libc hello world 2018-07-22 23:28:53 -04:00
Andrew Kelley 20f286f22a re-organize std lib darwin files 2018-07-22 00:04:24 -04:00
Sahnvour 2ec9a11646 Very much WIP base implementation for #721.
Currently does:
- read COFF executable file
- locate and load corresponding .pdb file
- expose .pdb content as streams (PDB format)
2018-07-21 20:30:11 +02:00
kristopher tate 501dd5f284 CMakeLists.txt: add darwin_socket.zig;
Tracking issue #1271;
thanks @Hejsil;
2018-07-22 01:47:53 +09:00
Andrew Kelley 58c5f94a99 self-hosted: share C++ code for finding libc on windows 2018-07-20 23:38:13 -04:00
Andrew Kelley 1d85b588ea self-hosted: progress on IR for supporting libc hello world
* add c int types
 * some more ir stubs
2018-07-19 00:08:47 -04:00
Andrew Kelley a8a1b5af07 fix build on windows
* move getAppDataDir and utf16leToUtf8 from self-hosted to std lib
 * fix std.event.Loop on windows
2018-07-18 10:07:22 -04:00
Andrew Kelley 97bfeac13f self-hosted: create tmp dir for .o files and emit .o file for fn 2018-07-16 20:52:50 -04:00
Andrew Kelley 9751a0ae04 std.atomic: use spinlocks
the lock-free data structures all had ABA problems and
std.atomic.Stack had a possibility to load an unmapped memory address.
2018-07-11 19:38:01 -04:00
Andrew Kelley 9bdcd2a495 add std.event.Future
This is like a promise, but it's for multiple getters, and
uses an event loop.
2018-07-11 16:00:06 -04:00
Andrew Kelley 574e31f0a0 self-hosted: first passing test
* introduce std.atomic.Int
 * add src-self-hosted/test.zig which is tested by the main test suite
   - it fully utilizes the multithreaded async/await event loop so the
     tests should Go Fast
 * `stage2/bin/zig build-obj test.zig` is able to spit out an error if 2 exported
   functions collide
 * ability for `zig test` to accept `--object` and `--assembly`
   arguments
 * std.build: TestStep supports addLibPath and addObjectFile
2018-07-10 20:18:43 -04:00
Andrew Kelley 8fba0a6ae8 introduce std.event.Group for making parallel async calls 2018-07-10 15:17:01 -04:00
Andrew Kelley b6eb404831 organize std.event into directories 2018-07-09 22:22:44 -04:00
Andrew Kelley 3f4b77f561
Merge pull request #1177 from jayschwa/fix-out-of-src-builds
Fix version detection for out-of-source builds
2018-06-30 12:01:47 -04:00
Marc Tiehuis 951512f5ae compiler_rt: Add CMake entries 2018-06-30 21:58:59 +12:00
Marc Tiehuis 53fef94b9f compiler_rt: Add missing install targets 2018-06-30 21:58:59 +12:00
Jay Weisskopf 25bbb1a8ff Fix version detection for out-of-source builds
Git was called in the build directory and not the source directory.
This works fine when the build directory resides within the source
repository, but doesn't work for out-of-source builds. Example:

```
~/zigbuild$ cmake ../zig
fatal: not a git repository (or any of the parent directories): .git
Configuring zig version 0.2.0+
```

Use Git's `-C <path>` flag to always point to the source directory so
that it doesn't matter where the build directory lives.
2018-06-29 22:22:04 -04:00
Andrew Kelley 0874a5ba77 std.atomic.queue - document limitation and add MPSC queue 2018-06-29 14:45:42 -04:00
Ben Noordhuis fd75e73ee9 add f16 type
Add support for half-precision floating point operations.

Introduce `__extendhfsf2` and `__truncsfhf2` in std/special/compiler_rt.

Add `__gnu_h2f_ieee` and `__gnu_f2h_ieee` as aliases that are used in
Windows builds.

The logic in std/special/compiler_rt/extendXfYf2.zig has been reworked
and can now operate on 16 bits floating point types.

`extendXfYf2()` and `truncXfYf2()` are marked `inline` to work around
a not entirely understood stack alignment issue on Windows when calling
the f16 versions of the builtins.

closes #1122
2018-06-27 16:20:04 +02:00
Andrew Kelley 5f38d6e2e9 add casting docs, __extenddftf2, and __extendsftf2 2018-06-21 14:44:35 -04:00
Andrew Kelley c7804277bf `@floatToInt` now has safety-checked undefined behavior
when the integer part does not fit in the destination integer type

 * Also fix incorrect safety triggered for integer casting an
   `i32` to a `u7`. closes #1138
 * adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00
Andrew Kelley 48de57d824 add basic std lib code for loading dynamic libraries
this is going to only work for very basic libraries;
I plan to slowly add more features over time to support more
complicated libraries
2018-06-16 17:01:23 -04:00
Jay Weisskopf b3a3e2094e Make `zig version` compliant with SemVer (#1113)
The git revision is build metadata and should be appended with a plus sign.

https://semver.org/#spec-item-10
2018-06-15 14:06:56 -04:00
Marc Tiehuis 9110140514 Add i128 compiler-rt div/mul support 2018-06-13 22:25:04 +12:00