Commit Graph

36 Commits

Author SHA1 Message Date
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
5734b7a37a
building musl start files from source 2019-03-12 13:18:52 -04: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
ade10387a5
breaking changes to the way targets work in zig
* CLI: `-target [name]` instead of `--target-*` args.
   This matches clang's API.
 * `builtin.Environ` renamed to `builtin.Abi`
   - likewise `builtin.environ` renamed to `builtin.abi`
 * stop hiding the concept of sub-arch. closes #1526
 * `zig targets` only shows available targets. closes #438
 * include all targets in readme, even those that don't
   print with `zig targets` but note they are Tier 4
 * refactor target.cpp and make the naming conventions
   more consistent
 * introduce the concept of a "default C ABI" for a given
   OS/Arch combo. As a rule of thumb, if the system compiler
   is clang or gcc then the default C ABI is the gnu ABI.
2019-02-26 15:58:10 -05:00
Andrew Kelley
525c2eaf5d building DLLs on Windows works better 2019-02-25 13:34:25 -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
Andrew Kelley
db74832e40
valgrind client requests for undefined values
with this change, when you assign undefined, zig emits a few
assembly instructions to tell valgrind that the memory is undefined

it's on by default for debug builds, and disabled otherwise. only
support for linux, darwin, solaris, mingw on x86_64 is currently
implemented.

--disable-valgrind turns it off even in debug mode.
--enable-valgrind turns it on even in release modes.

It's always disabled for compiler_rt.a and builtin.a.

Adds `@import("builtin").valgrind_support` which lets code know
at comptime whether valgrind client requests are enabled.

See #1989
2019-02-19 12:07:56 -05:00
Andrew Kelley
df87044fd6
omit nonnull attribute for C pointers
See #1059
2019-02-14 16:10:12 -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
Andrew Kelley
085d049a08
aarch64 improvements
* support C ABI for all return types
 * don't include __aeabi_uldivmod & co on aarch64 since
   it's 64 bit
2018-11-17 11:21:00 -05:00
Andrew Kelley
5a3c02137e
support building static libraries
closes #1493
closes #54
2018-10-09 13:15:14 -04:00
Andrew Kelley
a2abdb185f
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-16 10:51:58 -04:00
Andrew Kelley
67735c6f15
ability to disable cache. off by default except for...
...zig run, zig build, compiler_rt.a, and builtin.a
2018-09-11 00:32:40 -04:00
Andrew Kelley
1f96a86676 Merge remote-tracking branch 'origin/master' into llvm7 2018-05-26 12:06:08 -04:00
Andrew Kelley
a6ae45145f add @newStackCall builtin function
See #1006
2018-05-12 17:35:15 -04:00
Andrew Kelley
62668e3e6b update to llvm 7.0.0 2018-03-22 15:39:50 -04:00
Andrea Orru
e932919e68 Darwin -> MacOSX, added Zen. See #438 2018-01-06 23:10:53 -05:00
Andrew Kelley
6fece14cfb self-hosted: build against zig_llvm and embedded LLD
Now the self-hosted compiler re-uses the same C++ code for interfacing
with LLVM as the C++ code.
It also links against the same LLD library files.
2017-12-26 19:44:08 -05:00
Marc Tiehuis
795703a39c Add emit command-line option (#580)
Add emit command-line option
2017-11-03 09:09:33 -04:00
Andrew Kelley
845f22101b zig test on 64-bit windows runs 32-bit tests 2017-09-30 14:40:16 -04:00
Andrew Kelley
eb0979189b add windows to test targets
cross-compiling hello world with no libc for windows is working
2017-08-31 11:41:58 -04:00
Andrew Kelley
bf67427c67 fix crash when using zig to link
without explicit dynamic linker
2017-04-13 01:15:25 -04:00
Andrew Kelley
11a6550324 fix some -Wconversion errors 2017-04-10 20:02:39 -04:00
Andrew Kelley
d65cd73a8b add support to use zig as a linker driver
closes #243

I also added --grep to ./run_tests if you want to single out
some specific tests
2017-04-05 07:49:40 -04:00
Andrew Kelley
3239b3cb69 use size_t for indexes
protect against incorrect copies in debug mode
2016-09-19 11:54:01 -04:00
Andrew Kelley
ed50bd1b65 progress toward stack trace printing 2016-08-17 20:11:04 -07:00
Andrew Kelley
58c13aa949 rename 'environ' to 'env_type'
environ appears to clash with another symbol in mingw land
2016-02-16 20:03:41 -07:00
Andrew Kelley
4e3f6de027 c integer size takes into account architecture and OS 2016-02-12 12:07:11 -07:00
Andrew Kelley
2dc4ac0e21 add @compile_var("os") and @compile_var("arch") 2016-02-11 18:33:04 -07:00
Andrew Kelley
2bf6c28bc3 ability to cross compile
hello_libc.zig can produce a windows build
2016-02-11 01:33:27 -07:00
Andrew Kelley
54a8b6a110 cleanup target data organization 2016-02-10 16:58:15 -07:00
Andrew Kelley
1ff2edf67e add "targets" command to list architectures, oses, abis 2016-02-10 15:41:50 -07:00