126 Commits

Author SHA1 Message Date
Andrew Kelley
c15e464320
Merge branch 'uefi' of https://github.com/nrdmn/zig into nrdmn-uefi 2019-09-13 14:10:42 -04:00
Andrew Kelley
8f0df86937
I'm pretty sure sp is the stack pointer on all ARM 2019-09-05 14:15:39 -04:00
Andrew Kelley
8b1900e5df
Revert "Merge pull request #2991 from emekoi/mingw-ci"
This reverts commit ec7d7a5b14540ea3b2bab9f11318630338467965, reversing
changes made to 81c441f8855d4c58f0b2ff86d3d007cf0bf395d3.

It looks like this broke colors in Windows Command Prompt (#3147)
and this method of detecting native C ABI isn't working well (#3121).
2019-09-01 00:33:02 -04:00
Andrew Kelley
ec7d7a5b14
Merge pull request #2991 from emekoi/mingw-ci
mingw improvements
2019-08-21 12:29:42 -04:00
yvt
2cb1f93894 correct LLVM subarch names for arm 2019-08-16 08:46:18 -07:00
Andrew Kelley
24d5ec0783
fix async function frames not aligned enough 2019-08-11 22:35:12 -04:00
emekoi
59e2c87b4b move windows abi detection to get_native_target 2019-08-03 18:40:27 -05:00
emekoi
102d3f30c4 accept unix style paths on windows-gnu 2019-08-02 19:39:33 -05:00
emekoi
f15ec9a59b implemented runtime abi detetction for windows 2019-08-02 19:32:46 -05:00
Andrew Kelley
38b5812c48
allow 128 bit cmpxchg on x86_64 2019-08-01 02:46:37 -04:00
Nick Erdmann
63d56c532d
src/target.cpp: UEFI improvements 2019-07-29 00:19:40 +02:00
Andrew Kelley
95e04e3874
back to msvc as the default C ABI on Windows
Zig provides a libc for the GNU C ABI on Windows, and cannot (at least
yet) provide one for the MSVC C ABI. However when not linking libc,
zig has no problem targeting MSVC as the C ABI. And this should be the
default.

Related: #2911
2019-07-17 12:40:48 -04:00
Andrew Kelley
c0b4121ff2
libc headers before C language headers, and disable libunwind on arm32 2019-07-16 21:38:18 -04:00
Andrew Kelley
d994379173
update bundled musl source to 1.1.23 2019-07-16 19:54:14 -04:00
Andrew Kelley
7b8ba871a9
mingw libc: solve the segfault having to do with destructors
* fixed --verbose-cc printing an extra "zig" before the rest of
   the command line
 * windows-gnu targets use libfoo.a, foo.o extensions to match mingw
   conventions.
2019-07-12 14:44:34 -04:00
Andrew Kelley
d9c4c96bf2
add -Wno-pragma-pack when targeting windows-gnu
windows.h has files such as pshpack1.h which do #pragma packing,
triggering a clang warning. So for this target, this warning is
disabled.

this commit also improves the error message printed when no libc can be
used, printing the "zig triple" rather than the "llvm triple".
2019-07-11 23:48:13 -04:00
Andrew Kelley
b4bbfe8c05
the msvc target abi will have to be solved a different way 2019-07-11 12:56:51 -04:00
Andrew Kelley
1c7f21852f
ship with mingw-w64 v6.0.0
See #514
2019-07-09 23:34:16 -04:00
Andrew Kelley
8692c6fc0d
zero initialize target
Fixes glibc_version being set to garbage. I've made this mistake
before so this is an attempt to prevent future bugs. Zig doesn't
have zero-initialization, so are we being a hypocrite by using this
C feature? No, because C doesn't have the feature that forces you to
initialize all fields. That would have prevented this bug every single
time.
2019-07-08 02:10:26 -04:00
Andrew Kelley
f04782785f
fix not setting a target glibc version on non-linux 2019-07-07 19:24:44 -04:00
Andrew Kelley
7ccf7807b3
ability to target any glibc version 2019-07-07 17:56:08 -04:00
Andrew Kelley
516b5e649f
better CLI error message for missing sub-architecture 2019-06-27 11:05:12 -04:00
Andrew Kelley
7c5ceb0c4c
standard library integrates with knowledge of stripped debug info 2019-06-14 18:45:41 -04:00
Andrew Kelley
2c0280ba08
improve the stack check CLI options
See #2526
2019-05-27 20:59:19 -04:00
Andrew Kelley
81e960eb74
improvements to build-lib use case of WebAssembly
* build-exe does include the startup code that supplies _start for the
   wasm32-freestanding target. Previously this did not occur because
   of logic excluding "freestanding".
 * build-lib for wasm32-freestanding target gets linked by LLD. To avoid
   infinite recursion, compiler_rt and zig libc are built as objects
   rather than libraries.
   - no "lib" prefix and ".wasm" extension instead of ".a". Rather than
   build-lib foo.zig producing "libfoo.a", now it produces "foo.wasm".
 * go back to using `.o` extension for webassembly objects
 * zig libc only provides _start symbol for wasm when linking libc.
2019-05-16 13:56:56 -04:00
Shritesh Bhattarai
b64e6cb813 change wasm obj ext to .wasm 2019-05-15 20:41:22 -04:00
Andrew Kelley
14cdb01f35 improvements to zig's implementation of libc and WebAssembly
* rename std/special/builtin.zig to std/special/c.zig
   not to be confused with @import("builtin") which is entirely
   different, this is zig's multi-target libc implementation.
 * WebAssembly: build-exe is for executables which have a main().
   build-lib is for building libraries of functions to use from,
   for example, a web browser environment.
   - for now pass --export-all for libraries when there are any
     C objects because we have no way to detect the list of exports
     when compiling C code.
   - stop passing --no-entry for executables. if you want --no-entry
     then use build-lib.
 * make the "musl" ABI the default ABI for wasm32-freestanding.
 * zig provides libc for wasm32-freestanding-musl.
2019-05-15 20:14:58 -04:00
Shritesh Bhattarai
0f1d92e2cf wasm: force single threaded 2019-04-14 10:21:48 -04:00
Shritesh Bhattarai
63f2e96eea wasm: use .wasm ext for exe 2019-04-12 13:17:59 -04:00
Matthew Iannucci
27cd830ec8 Add initial support for iOS targets (#2237)
* Add iOS C int sizes... try to hack in iOS DebugInfo

* Get rid of ios link check for now

* Remove macos linkversion check
2019-04-11 13:15:17 -04:00
Andrew Kelley
64b2cf776c
implement target_c_type_size_in_bits for WASI 2019-03-27 16:08:45 -04:00
Andrew Kelley
324cbb9864
stage1: implement get_dynamic_linker for riscv 2019-03-22 17:12:41 -04:00
Andrew Kelley
3c7555cb67
Merge remote-tracking branch 'origin/llvm8' 2019-03-20 13:34:07 -04:00
Andrew Kelley
3c36929603
zig targets prints the available libcs 2019-03-19 15:04:29 -04:00
Andrew Kelley
a581f4f0e2
Merge remote-tracking branch 'origin/master' into llvm8 2019-03-18 20:03:23 -04:00
Andrew Kelley
862ac42a6e
ignore -lm on darwin because it's handled by libSystem 2019-03-13 23:44:38 -04:00
Andrew Kelley
20c36949e1
fix target_requires_pic and reloc_mode
disable failing thread local variable test.
see #2063
2019-03-13 23:15:34 -04:00
Andrew Kelley
5d2edac12d
breaking: remove --static; add -dynamic
`--static` is no longer an option. Instead, Zig makes things as static
as possible by default. `-dynamic` can be used to choose a dynamic
library rather than a static one.

`--enable-pic` is a new option. Usually it will be enabled
automatically, but in the case of build-exe with no dynamic libraries
on Linux or freestanding, Zig chooses off by default.

closes #1703
closes #1828
2019-03-13 19:50:41 -04:00
Andrew Kelley
284f6baf1c remove nios2 from list of libc targets 2019-03-13 13:33:00 -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
5734b7a37a
building musl start files from source 2019-03-12 13:18:52 -04:00
Andrew Kelley
3cdd2c0bdd Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 13:48:06 -04:00
Andrew Kelley
91955dee58
breaking changes to zig build API and improved caching
* in Zig build scripts, getOutputPath() is no longer a valid function
   to call, unless setOutputDir() was used, or within a custom make()
   function. Instead there is more convenient API to use which takes
   advantage of the caching system. Search this commit diff for
   `exe.run()` for an example.
 * Zig build by default enables caching. All build artifacts will go
   into zig-cache. If you want to access build artifacts in a convenient
   location, it is recommended to add an `install` step. Otherwise
   you can use the `run()` API mentioned above to execute programs
   directly from their location in the cache. Closes #330.
   `addSystemCommand` is available for programs not built with Zig
   build.
 * Please note that Zig does no cache evicting yet. You may have to
   manually delete zig-cache directories periodically to keep disk
   usage down. It's planned for this to be a simple Least Recently
   Used eviction system eventually.
 * `--output`, `--output-lib`, and `--output-h` are removed. Instead,
   use `--output-dir` which defaults to the current working directory.
   Or take advantage of `--cache on`, which will print the main output
   path to stdout, and the other artifacts will be in the same directory
   with predictable file names. `--disable-gen-h` is available when
   one wants to prevent .h file generation.
 * `@cImport` is always independently cached now. Closes #2015.
   It always writes the generated Zig code to disk which makes debug
   info and compile errors better. No more "TODO: remember C source
   location to display here"
 * Fix .d file parsing. (Fixes the MacOS CI failure)
 * Zig no longer creates "temporary files" other than inside a
   zig-cache directory.

This breaks the CLI API that Godbolt uses. The suggested new invocation
can be found in this commit diff, in the changes to `test/cli.zig`.
2019-03-08 23:23:11 -05:00
Andrew Kelley
197311d7dd windows and uefi don't have dynamic linkers 2019-03-07 13:25:17 -05:00
Andrew Kelley
697b1233f0
support other architectures for glibc startup files 2019-03-06 12:10:03 -05:00
Andrew Kelley
4c386436ea
support glibc dl, m, pthread, rt 2019-03-05 18:17:22 -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
764205ac13
better error message for -target windows CLI
closes #1169
2019-03-01 18:42:09 -05:00