Commit Graph

4352 Commits (461792f9de229970bd0a810c1c6cde6978607902)

Author SHA1 Message Date
Andrew Kelley c19dcafa17 Merge remote-tracking branch 'origin/master' into llvm11 2020-10-12 17:57:35 -07:00
Vignesh Rajagopalan 2ab0c7391a Rename .macosx to .macos 2020-10-12 18:56:25 -04:00
Andrew Kelley 9f8f446435 fixups to previous commit
* std.fs.Dir.readFile: add doc comments to explain what it means when
   the returned slice has the same length as the supplied buffer.
 * introduce readSmallFile / writeSmallFile to abstract over the
   decision to use symlink or file contents to store data.
2020-10-09 16:45:39 -07:00
mlarouche 57912964af Use regular file for caching stage 1 hash digest instead of symlink, fix zig build caching on Windows
Fix #6500
2020-10-09 16:50:43 -04:00
Jakub Konka 04b0ffdd13
Merge pull request #6577 from kubkon/macho-trie
stage2: add export trie generation in MachO linker
2020-10-09 17:41:52 +02:00
Jakub Konka 8dc4023615
Apply nitpick: top-level doc comments
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-09 17:40:37 +02:00
Josh Wolfe bc6904eccc include compiler_rt and c for wasm static libraries 2020-10-09 01:54:42 -04:00
Andrew Kelley 4053b95d8e run update_clang_options on llvm 11 rc6 2020-10-08 16:13:37 -07:00
Andrew Kelley 8b7539bd95 Merge remote-tracking branch 'origin/master' into llvm11
Conflicts:
  src/clang.zig

Master branch renamed an enum; this branch gave it an explicit tag type
and explicitly initialized values. This commit combines the changes
together.
2020-10-08 15:47:45 -07:00
Jakub Konka ba41e599bf
Clean up writing the trie into ULEB128 byte stream
Prealloc as much as possible to improve alloc performance.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-08 19:53:23 +02:00
Jakub Konka 5f86505cf7
Fix ULEB128 encoding of trie
Use algorithm described in official Apple `ld64` implementation.
Link: https://opensource.apple.com/source/ld64/ld64-123.2.1/src/abstraction/MachOTrie.hpp

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-08 19:53:03 +02:00
Tadeo Kondrak 83eda21488 zig_clang/translate_c: Use opaque declarations in Zig 2020-10-08 12:29:59 +03:00
Tadeo Kondrak 0e57f220fb stage1: Disallow arrays in function parameters or return types
Closes #6535.
2020-10-08 04:17:32 -04:00
xavier eb33394d14 notice more kinds of optimization flags and debug flags
Closes #6091
2020-10-07 18:43:05 -04:00
Jakub Konka ea44d12d1b
Add writeULEB128Mem test and couple fixes
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 23:54:51 +02:00
Andrew Kelley 95a37373e9
Merge pull request #6421 from tadeokondrak/opaque-syntax
Add opaque syntax that allows declarations
2020-10-07 16:58:50 -04:00
Jakub Konka b5b25d38a8 Fix improper reuse of global symbols in MachO
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 20:34:40 +02:00
Jakub Konka bdab4f53c1
Move trie structure into its own file-module
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 20:34:34 +02:00
Jakub Konka b13b36a71d
Approach using array list for auto mem mgmt
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 20:33:47 +02:00
Jakub Konka e76fb8d8c8
Add incomplete writing of trie to bytes buffer
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 20:33:28 +02:00
Jakub Konka f0a73df8e7 Add prototype for export trie generation in MachO linker
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 18:31:02 +02:00
Jakub Konka 07c33dfc95 Remove obsolete addPadding fn and callsites from MachO linker
This is no longer needed due to the way writing to the output
file is structured.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-07 17:18:37 +02:00
Tadeo Kondrak 0a6863a267 Remove .Cold calling convention.
This isn't a stable, defined calling convention, so it shouldn't be
grouped in with the others.

Closes https://github.com/ziglang/zig/issues/6556
2020-10-07 04:31:20 -04:00
pfg ae161863db stage1: improve error messages for missing `try` statements 2020-10-07 03:50:11 -04:00
Andrew Kelley b5a36f676b Merge remote-tracking branch 'origin/master' into llvm11
Conflicts:
  cmake/Findllvm.cmake

The llvm11 branch changed 10's to 11's and master branch added the
"using LLVM_CONFIG_EXE" help message, so the resolution was to merge
these changes together.

I also added a check to make sure LLVM is built with AVR enabled, which
is no longer an experimental target.
2020-10-07 00:46:05 -07:00
Andrew Kelley b2b0bf0506 fixups for the previous commit
* std.fs.File.copyRange and copyRangeAll return u64 instead of usize -
   the returned value is how much of the `len` is transferred, so the
   types should match. This removes the need for an `@intCast`.
 * fix typo that removed a subtraction
 * Fix the size of codegen.AnyMCValue which gave me a compile error when
   I tried to build self-hosted for i386-linux.
 * restore the coercion to u64 of syms_sect.sh_info. We want to make
   sure the multiplication happens with 64 bits and not the smaller type
   used by the ELF format.
 * fix another offset parameter in link/Elf.zig to be u64 instead of usize
 * add a nice little TODO note to help out Jakub
 * FmtError already has FileTooBig in it; we just need to return it.
2020-10-07 00:39:13 -07:00
Timon Kruiper bd7eab573a Fix building the zig compiler for 32-bit targets 2020-10-06 23:39:58 -07:00
Tadeo Kondrak bf4bfe54ac
Update compile error test for field access of opaque type 2020-10-06 22:08:30 -06:00
Tadeo Kondrak 0a56390230
stage1: use size_t over int as index in resolve_opaque_type 2020-10-06 22:08:28 -06:00
Tadeo Kondrak d71f339395
stage1: disallow fields in opaque types 2020-10-06 22:08:27 -06:00
Tadeo Kondrak d5b8172a82
translate_c: emit opaque {} instead of @Type(.Opaque) 2020-10-06 22:08:26 -06:00
Tadeo Kondrak 2b4b03d301
Update zig files for opaque type syntax 2020-10-06 22:08:25 -06:00
Tadeo Kondrak 069fbb3c01
Add opaque type syntax 2020-10-06 22:08:24 -06:00
travisstaloch dd4771a5d2
cache-hash: add test_filter and test_name_prefix (#6583) 2020-10-06 19:36:14 -04:00
LemonBoy 87807d53dd stage2: Fix arg processing for zig run
* Stop parsing arguments after `--`
* Calculate the correct index for the first argument after `--`
2020-10-06 19:31:57 -04:00
Vexu 58502b8bfe translate-c: respect C operator precedence in macros 2020-10-05 22:26:11 -04:00
Andrew Kelley 939b4860ef
Merge pull request #6472 from alexnask/add_some_frees
Add a few missing deallocations of temporaries to stage1
2020-10-05 04:56:58 -04:00
LemonBoy 22b5e47839 stage1: Implement @reduce builtin for vector types
The builtin folds a Vector(N,T) into a scalar T using a specified
operator.

Closes #2698
2020-10-05 04:51:45 -04:00
joachimschmidt557 7c5a24e08c Turn zig fmt back on in various src/ files 2020-10-05 04:48:58 -04:00
Andrew Kelley 55ac973953 fix each-lib-rpath functionality
It was regressed in 2 ways from the merge of #6250:
 * it was not being enabled by default when the target OS is native.
 * we were testing the libfoo.so file path existence with bogus format
   string ('{}' instead of '{s}') and so it ended up being something
   like "libstd.HashMap(K,V,...).Entry.so" instead of "libfoo.so". Using
   {} rather than {s} is a footgun, be careful!

Previous functionality is now restored.

closes #6523
2020-10-04 23:16:46 -07:00
Felix (xq) Queißner dce74c31cc Depending on system libs only enforces libraries to require dynamic linking, but neither static libs nor object files. 2020-10-05 00:27:42 -04:00
Andrew Kelley 1d777e9958 add --image-base support
Based on #6121 by Jay Petacat.
2020-10-04 17:59:44 -07:00
Andrew Kelley da596b7e4f
Merge pull request #6255 from joachimschmidt557/stage2-arm
stage2 ARM: more instructions, return values, parameters
2020-10-04 19:49:18 -04:00
Andrew Kelley 6aa668e020
Merge pull request #6476 from kubkon/macho-exe
Link basic MachO executables with stage2
2020-10-04 19:05:45 -04:00
Andrew Kelley 302a69f127
Merge pull request #6295 from Vexu/stage2
Stage2: basic imports
2020-10-04 18:00:21 -04:00
Jakub Konka c4054f8e0a Refactor flushing of MachO exe
This commit refactors free space analysis (and VM analysis) somewhat.
This is still far from perfect, but at least it's not using any
hardcoded values.

This commit also reorganizes different flushing bits here and there,
so that bit common to Exe and Obj are put in the common path, while
Exe-specific are behind an appropriate switch/if statement.
2020-10-04 15:31:47 +02:00
Jakub Konka 737a8bf204 Redo local symbols and offsets tracking to match Elf's approach 2020-10-04 15:31:47 +02:00
Jakub Konka 2ba23abd9d Add missing ensureCapacity call in codegen 2020-10-04 15:31:47 +02:00
Jakub Konka f8dd48bcd2 Fix after rebase and enable stage2 tests for macOS
Also, rewrites codegen section to store symbol address in a register
to then later invoke `callq` on the register.
2020-10-04 15:31:47 +02:00
Jakub Konka 5a7105401c First hacked together, working MachO exe! 2020-10-04 15:31:47 +02:00