14054 Commits

Author SHA1 Message Date
Andrew Kelley
8c5d4295e5
Merge pull request #8876 from xxxbxxx/cxx-lto
build libc++ with lto and function-sections
2021-05-24 13:58:02 -04:00
xavier
8275c771c8 zig cc: expose header files when linking libunwind 2021-05-24 13:48:49 -04:00
Jens Goldberg
1df993706a Fix socklen_t cast in win32 recvfrom
All other uses of `ws2_32.socklen_t` in windows.zig casts the value to an i32. `recvfrom` should do so as well; it currently errors out with `expected type '?*i32', found '?*u32'`.
2021-05-24 13:46:35 -04:00
Andrew Kelley
0a99898b98
Merge pull request #8862 from hoanga/haiku-support-linker
further haiku support    initial compile and link
2021-05-24 13:45:47 -04:00
Andrew Kelley
156b968ad8 stage2: remove dead code; rename crtbegin_dir to gcc_dir 2021-05-24 10:41:59 -07:00
Al Hoang
e8cf15236d add haiku case to csu 2021-05-24 10:39:02 -07:00
Al Hoang
5280ea5d22 update compilation and elf link for haiku case
* for some reason part of the linkable bits for the crt libraries
  are split in different locations for haiku. this changeset
  accomodates this situation (crtbegin_dir lookup)
2021-05-24 10:39:02 -07:00
Al Hoang
c4a4330cc7 haiku case for libc link flags 2021-05-24 10:39:01 -07:00
Al Hoang
2be2c983cb enable symbol lookup for haiku 2021-05-24 10:39:01 -07:00
Al Hoang
db8eae65de avoid usage of execv on Haiku 2021-05-24 10:39:01 -07:00
Michael Dusan
8cebbc352a housekeeping: builtin.arch → builtin.cpu.arch 2021-05-24 13:38:47 -04:00
Michael Dusan
1dc7764f2d clang driver: fix lost argv[0] 2021-05-24 13:26:52 -04:00
Ryan Liptak
6426519e32 zig fmt: Remove workaround for . and .. path handling on Windows
Added in #4655/#5187, obsoleted by #7664
2021-05-24 13:24:21 -04:00
Michael Dusan
75cd37b8f7 dragonfly: pass zig build test 2021-05-24 10:24:41 -04:00
Andrew Kelley
55811d8dac stage2: introduce clangAssemblerSupportsMcpuArg
Clang has a completely inconsistent CLI for its integrated assembler for
each target architecture. For x86_64, for example, it does not accept
an -mcpu parameter, and emits "warning: unused parameter". However, for
ARM, -mcpu is needed in order to properly lower assembly to machine code
instructions (see new standalone test case provided thanks to @g-w1).

This is a compromise between
b8f85a805bf61ae11d6ee2bd6d8356fbc98ee3ba and
afb9f695b1bdbf81185e7d55d5783bcbab880989.
2021-05-23 21:51:10 -07:00
Andrew Kelley
609207801a make "gnu" (mingw-w64) the default C ABI on Windows
Closes #6565
2021-05-24 00:13:54 -04:00
Andrew Kelley
8fa6ca6daa
Merge pull request #8879 from squeek502/dot-and-dotdot-test
Add . and .. tests for std.fs functions
2021-05-23 23:26:05 -04:00
Michael Dusan
b3e4832240 housekeeping: remove pub from ccPrintFileName()
- this was inadvertently made public while iterating on #8730
2021-05-23 19:45:05 -04:00
Ryan Liptak
78019452f7 Add updateFile to . and .. fs tests 2021-05-23 16:35:31 -07:00
Andrew Kelley
b8f85a805b Revert "stage2: add support for zig cc assembler -mcpu option"
This reverts commit afb9f695b1bdbf81185e7d55d5783bcbab880989.

I don't think this was ever actually verified to fix the thing it
purported to, and it started causing warnings for unused command line
parameters.
2021-05-23 16:32:22 -07:00
Ryan Liptak
1bc0df7250 Add . and .. tests for std.fs functions
These tests check that . and .. are able to be handled by the std.fs functions. Before #7664, these tests would have failed on Windows.

Closes #4659
2021-05-23 16:22:27 -07:00
Andrew Kelley
ae01c65a58 stage2: fix reference to musl arch name
Also rename musl.archMuslName to musl.archName.

Fixes a merge conflict from #8730 and #8837
2021-05-23 13:32:52 -07:00
Michael Dusan
0f26120377 overhaul elf csu (c-runtime startup) logic
- more support for linux, android, freebsd, netbsd, openbsd, dragonfly
- centralize musl utils; musl logic is no longer intertwined with csu
- fix musl compilation to build crti/crtn for full archs list
- fix openbsd to support `zig build-lib -dynamic`
- initial dragonfly linking success (with a warning)

ancillary:

- fix emutls (openbsd) tests to use `try`
2021-05-23 15:38:57 -04:00
Daniele Cocca
44e480aa2c translate_c: remove unused WriteFileStep import 2021-05-23 14:35:19 -04:00
xavier
a6e65f3a0e keep statically linked libc++ symbols hidden. 2021-05-23 19:58:38 +02:00
xavier
40d8518253 apply -flto and -ffunction-sections when compiling libc++ 2021-05-23 19:58:26 +02:00
Evan Haas
d321a4b765 translate-c: Translate FnDecl's that appear within functions 2021-05-23 15:42:36 +03:00
joachimschmidt557
e8236551ab stage2: Move BlockData out of ir.Inst.Block 2021-05-22 21:15:25 -04:00
Andrew Kelley
1c636e2564
Merge pull request #8844 from ifreund/inline
Support inline keyword as well as callconv(.Inline)
2021-05-22 20:56:30 -04:00
jacob gw
9baf891772 stage2: astgen error for return or try in defer block 2021-05-22 20:54:14 -04:00
Sébastien Marie
ceacb7d247 openbsd: complete kqueue(2) constant definitions 2021-05-22 20:52:44 -04:00
Isaac Freund
b2126d3345 stage2: only pass -lm -lc -ldl for android libc
The other libc components are not available on android.
2021-05-22 20:52:14 -04:00
Sobeston
742d588b3a std.os: munmap takes a const pointer 2021-05-22 20:51:53 -04:00
Matthew Borkowski
d7bf4f8070 fix Boyer-Moore-Horspool algorithm in indexOfPos and lastIndexOf when element type is larger than a byte 2021-05-22 20:51:17 -04:00
Jakub Konka
8c87a981f1 cc,wasi: force isysroot to / 2021-05-22 20:50:06 -04:00
Andrew Kelley
b750e074c6 stage2: rework astgen command into zig ast-check
This addresses the use case of quickly reporting AstGen compile errors
for a file, for use with an IDE for example.

 * Rename from `zig asgen` to `zig ast-check`
 * It is now a command always available; not only in debug builds.
 * Give it usage text and proper CLI parsing.
 * Support reading from stdin when no positional arg is provided.
 * `-t` flag makes it print textual ZIR. Without this flag, it only
   provides compile errors.
 * Support `--color` parameter to override the tty detection

closes #8871
2021-05-22 17:23:16 -07:00
Andrew Kelley
51701fb2da stage2: omit printing source lines in compile errors
when configured to not use tty awareness
2021-05-22 17:17:32 -07:00
Andrew Kelley
63aabbbba7
Merge pull request #8852 from Snektron/spirv
SPIR-V: More codegen
2021-05-22 18:20:20 -04:00
Andrew Kelley
7cd9b30e0a
Merge pull request #7664 from marler8997/fixWindowsPaths
implement nt path conversion for windows
2021-05-22 17:58:59 -04:00
Andrew Kelley
79dee75b1c stage2: rename ir.zig to air.zig
We've settled on the nomenclature for the artifacts the compiler
pipeline produces:

1. Tokens
2. AST (Abstract Syntax Tree)
3. ZIR (Zig Intermediate Representation)
4. AIR (Analyzed Intermediate Representation)
5. Machine Code

Renaming `ir` identifiers to `air` will come with the inevitable
air-memory-layout branch that I plan to start after the 0.8.0 release.
2021-05-22 14:29:16 -07:00
Jakub Konka
9d311e9960
Merge pull request #8857 from ziglang/cc-wasm-ar
wasm: produce static lib by default and rename produced object files to simply .o from .o.wasm
2021-05-22 16:13:47 +02:00
Jakub Konka
2b0d322ea0 zld: permit system static libs
This commits permits passing in static archives using the system
lib flag `-la`. With this commit, `zig ld` will now look firstly for
a dynamic library (which always takes precedence), and will fall back
on `liba.a` if the dylib is not found. The static archive is searched
for in the system lib search dirs like the dylibs.
2021-05-22 16:12:45 +02:00
Robin Voetter
cba97e4773 SPIR-V: Make functions which always return a null result return void instead 2021-05-22 16:11:56 +02:00
Robin Voetter
228f71fa0c SPIR-V: Generate locals at the start of a function 2021-05-22 16:11:56 +02:00
Robin Voetter
6634abfd26 SPIR-V: Debug line info/source info 2021-05-22 16:11:56 +02:00
Robin Voetter
e3be1a1e88 SPIR-V: DeclGen constructor/destructor 2021-05-22 16:11:56 +02:00
Robin Voetter
46184ab85e SPIR-V: branching 2021-05-22 16:11:56 +02:00
Robin Voetter
5edc5f9730 SPIR-V: Pass source location to genType and genConstant for better error reporting 2021-05-22 16:11:56 +02:00
Robin Voetter
63d0576f1c SPIR-V: Preliminary alloc/store/load generation 2021-05-22 16:11:56 +02:00
Robin Voetter
6a121d9ccd SPIR-V: Split out genCmp from genBinOp 2021-05-22 16:11:56 +02:00