Commit Graph

41 Commits

Author SHA1 Message Date
Andrew Kelley
a147f06585 zig puts temporary object files in zig-cache folder
See #298
2017-04-28 02:22:12 -04:00
Andrew Kelley
7b0542d08b build system: consolidate duplicate code and more
* add ability to add assembly files when building an exe, obj, or lib
 * add implicit cast from `[N]T` to `?[]const T` (closes #343)
 * remove link_exe and link_lib in favor of allowing build_exe and
   build_lib support no root zig source file
2017-04-26 19:17:05 -04:00
Andrew Kelley
e0050af293 add some timing diagnostics
pass --enable-timing-info to print a nice table like this:

```
                Name       Start         End    Duration     Percent
          Initialize      0.0000      0.0000      0.0000      0.0001
   Semantic Analysis      0.0000      0.0421      0.0420      0.2109
     Code Generation      0.0421      0.0620      0.0200      0.1003
    LLVM Emit Object      0.0620      0.1852      0.1231      0.6180
  Build Dependencies      0.1852      0.1974      0.0122      0.0615
           LLVM Link      0.1974      0.1993      0.0018      0.0093
         Generate .h      0.1993      0.1993      0.0000      0.0000
               Total      0.0000      0.1993      0.1993      1.0000
```
2017-04-25 12:29:25 -04:00
Andrew Kelley
fb492d19eb zig build system supports building a library
See #329

Supporting work:
 * move std.cstr.Buffer0 to std.buffer.Buffer
 * add build.zig to example/shared_library/ and add an automated test
   for it
 * add std.list.List.resizeDown
 * improve std.os.makePath
   - no longer recursive
   - takes into account . and ..
 * add std.os.path.isAbsolute
 * add std.os.path.resolve
 * reimplement std.os.path.dirname
   - no longer requires an allocator
   - handles edge cases correctly
2017-04-21 01:56:12 -04:00
Andrew Kelley
d12f1f5b49 test framework supports name prefix and filter argument
rename self hosted tests to behavior tests
2017-04-19 15:38:12 -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
8c10b6dcbd ability to use zig as an assembler
see #243
2017-04-05 03:36:55 -04:00
Andrew Kelley
3ca027ca82 first pass at zig build system
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`,
   `zig build_lib` and `zig build_exe` respectively.
 * `--name` parameter is optional when it can be inferred from the
   root source filename. closes #207
 * `zig build` now looks for `build.zig` which interacts with
   `std.build.Builder` to describe the targets, and then the zig
   build system prints TODO: build these targets. See #204
 * add `@bitcast` which is mainly used for pointer reinterpret
   casting and make explicit casting not do pointer reinterpretation.
   Closes #290
 * fix debug info for byval parameters
 * sort command line help options
 * `std.debug.panic` supports format string printing
 * add `std.mem.IncrementingAllocator`
 * fix const ptr to a variable with data changing at runtime.
   closes #289
2017-03-31 05:55:41 -04:00
Andrew Kelley
a32b5929cc add stack protector safety when linking libc
* introduce zigrt file. it contains only weak symbols so that
   multiple instances can be merged. it contains __zig_panic
   so that multiple .o files can call the same panic function.
 * remove `@setFnVisible` builtin and add @setGlobalLinkage builtin
   which is more powerful
 * add `@panic` builtin function.
 * fix collision of symbols with extern prototypes and internal
   function names
 * add stack protector safety when linking against libc. To add
   the safety mechanism without libc requires implementing
   Thread Local Storage. See #276
2017-03-26 21:07:07 -04:00
Andrew Kelley
af536ac343 introduce new test syntax
* remove setFnTest builtin
 * add test "name" { ... } syntax
 * remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00
Andrew Kelley
7efa2cd81c add --each-lib-rpath option and corresponding config option
This adds an rpath entry for each used dynamic library directory.
This is necessary on some systems such as NixOS.
2017-03-13 13:11:55 -04:00
Andrew Kelley
d10bbd28e9 use lld instead of system linker 2017-03-13 11:54:56 -04:00
Andrew Kelley
3be4b6434c add ability to set linker script 2017-02-03 12:34:20 -05: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
4c0259b107 ability to specify -framework linker args for MacOS 2016-09-18 21:28:06 -04:00
José Miguel Sánchez
a1817f462a Add --zig-std-dir 2016-05-12 18:41:20 +02:00
Andrew Kelley
26718a619c recognize ar program and pass --gc-sections to ld
See #54
2016-05-11 14:44:10 -07:00
Andrew Kelley
f1d338194e rewrite how importing works
* Introduce the concept of packages. Closes #3
 * Add support for error notes.
 * Introduce `@import` and `@c_import` builtin functions and
   remove the `import` and `c_import` top level declarations.
 * Introduce the `use` top level declaration.
 * Add `--check-unused` parameter to perform semantic
   analysis and codegen on all top level declarations, not
   just exported ones and ones referenced by exported ones.
 * Delete the root export node and add `--library` argument.
2016-03-01 03:13:40 -07:00
Andrew Kelley
984e7d6cc7 first pass at linking on macos 2016-02-15 20:56:52 -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
e18170ee0b support overriding the dynamic linker argument to ld 2016-02-08 22:11:09 -07:00
Andrew Kelley
430d0dfcb2 support static linking against libc 2016-02-08 00:50:51 -07:00
Andrew Kelley
11a0644365 basic support for building a test target 2016-02-03 18:02:01 -07:00
Andrew Kelley
7af59c76e4 build: fix libc path finding 2016-02-02 15:04:14 -07:00
Andrew Kelley
0ac714f0d6 add --library-path cli option 2016-01-31 18:32:07 -07:00
Andrew Kelley
3c2093fec6 parseh understands types better and handles some situations better
See #88

Also, includes partial implementation of typedef top level declaration.
See #95

Also, fix function types. Previously the way we were deduping function type
pointers was incorrect.
2016-01-31 01:20:47 -07:00
Andrew Kelley
c281533638 build command supports -isystem argument 2016-01-27 19:22:58 -07:00
Andrew Kelley
3ef2f7058b refactor out the horrible beast that was codegen_node 2016-01-10 15:13:39 -07:00
Andrew Kelley
f5a3281877 when linking with libc use the C runtime library 2015-12-15 12:44:42 -07:00
Andrew Kelley
3d8eb10897 fix incorrect debug info path to imports 2015-12-13 14:34:07 -07:00
Andrew Kelley
29f24e3c50 add --color cli arg to override tty detection 2015-12-01 01:06:10 -07:00
Andrew Kelley
257cf09472 colored error messages that tell the source file 2015-12-01 00:50:11 -07:00
Andrew Kelley
cd68969115 closer to multiple files working 2015-11-30 22:53:37 -07:00
Andrew Kelley
55b8472374 refactor code to prepare for multiple files
verbose compiler output is now behind --verbose flag
2015-11-30 20:00:39 -07:00
Josh Wolfe
9e0ff6faa2 factor analysis code out of codegen 2015-11-30 09:14:58 -07:00
Andrew Kelley
cb4773ce29 add root export declaration which is overridable by command line options 2015-11-27 21:24:47 -07:00
Andrew Kelley
024052b448 add pub and export visibility modifiers and optimization 2015-11-27 15:46:06 -07:00
Andrew Kelley
505317a12f debug/release mode 2015-11-24 22:32:26 -07:00
Andrew Kelley
ca836191e1 debug information for functions 2015-11-24 19:07:33 -07:00
Andrew Kelley
c2e5d50027 write object file and fix void return type 2015-11-24 13:00:38 -07:00
Andrew Kelley
3b4a2afb65 semantic analysis checks for multiple definitions of functions 2015-11-23 22:47:25 -07:00