Jakub Konka
4eff0f4ea1
macho: fix condition for checking available size for an atom
2021-09-01 16:49:16 +02:00
Jakub Konka
7a99cd069a
macho: clean up allocating atom logic
...
Instead of checking for stage1 at every callsite, move the logic
inside `allocateAtom`. This is fine since this logic will disappear
anyhow once I add expanding and shifting segments and sections.
2021-09-01 12:14:29 +02:00
Philip Åkesson
4f0aa7d639
std: Use truncating cast in WIFSTOPPED for Linux, FreeBSD and DragonFly
...
The intermediate value can be larger than an u16, so @truncate is needed
to match the behavior of musl.
2021-08-31 22:03:54 -04:00
Andrew Kelley
3b9ec4e4df
Merge pull request #9655 from nektro/stage2-rem
...
stage2: implement runtime `%` and `@rem`
2021-08-31 21:59:48 -04:00
Andrew Kelley
d522f925b7
Merge pull request #9603 from g-w1/arrcat
...
stage2: add array concatenation + multiplication ( ++ and **) at comptime
2021-08-31 21:52:47 -04:00
Sebastian Ullrich
9d4a6d67aa
libunwind: fix unwinding through libunwind stack frames
...
Fixes #9591
2021-08-31 21:50:16 -04:00
Andrew Kelley
75263e160e
CI: update Linux and macOS tarballs to LLVM 12.0.1
2021-08-31 16:39:25 -07:00
Jakub Konka
d0dc622638
macho: do not reset section's size after allocating atom
2021-09-01 00:06:43 +02:00
Jakub Konka
50db993119
macho: fix allocating sections within segment when parsing objects
2021-08-31 23:05:01 +02:00
Philipp Lühmann
76b85cd665
fix typo
2021-08-31 14:05:44 -04:00
joachimschmidt557
435d8ae536
stage2 ARM: add missing parameters for bic, bics
2021-08-31 14:05:20 -04:00
Meghan
50c6b6cc66
stage2: only initialize the llvm backend for the target we are building ( #9659 )
2021-08-31 13:50:09 -04:00
Andrew Kelley
d0f04824f1
re-enable all the MIPS tests
...
LLVM 12.0.1 fixed the regressions from LLVM 12.0.0.
Closes #8155
2021-08-31 10:36:33 -07:00
Jacob G-W
7cdb30ee95
stage2: move array mult test from basic.zig to misc.zig!
2021-08-31 07:46:24 -04:00
Jacob G-W
f6d9ac481b
stage2: add array mult **
2021-08-31 07:46:24 -04:00
Jacob G-W
a360f2bf6c
add string concat test to basic.zig from misc.zig!
...
This means it is passing in stage2!
2021-08-31 07:46:24 -04:00
Jacob G-W
908f722107
stage2 llvm backend: if an array has a senteniel, add it
2021-08-31 07:46:23 -04:00
fn ⌃ ⌥
b25e58b0ac
std.hash_map: add getKey methods ( #9607 )
2021-08-31 00:32:34 -04:00
Jacob G-W
353eec73ca
stage2: add array concatenation
2021-08-30 22:54:33 -04:00
Meghan Denny
cf9684ce75
stage2: add @rem tests to llvm and c backends
2021-08-30 19:48:31 -07:00
Lee Cannon
ede47d49eb
Print enum values for build options in help output ( #9650 )
2021-08-30 21:39:02 -04:00
Martin Wickham
cf75cad899
Add comptime memory tests
2021-08-30 18:50:07 -04:00
joachimschmidt557
4334dbb9a5
stage2 codegen: Remove use of usingnamespace
2021-08-30 13:40:03 -04:00
Boo
ef39725055
Fix float formatting for 0.0 when precision is 0 ( #9642 )
2021-08-30 13:39:05 -04:00
Jakub Konka
2831d6e9b8
macho: add first pass at allocating parsed atoms in objects
...
This commit makes it possible to combine self-hosted with a pre-compiled
C object file, e.g.:
```
zig-out/bin/zig build-exe hello.zig add.o
```
where `add.o` is a pre-compiled C object file.
2021-08-30 15:43:20 +02:00
Meghan Denny
e878a6633f
stage2: implement runtime % and @rem
2021-08-30 00:31:40 -07:00
Meghan Denny
56845082bc
stage2/sema: clarify todo arithmetic operator error
2021-08-30 00:30:14 -07:00
Andrew Kelley
861b784454
AstGen: fix incorrectly using decl_val/decl_ref
...
in identifiers rather than directly referencing the instructions.
2021-08-29 13:43:03 -07:00
Veikka Tuominen
be9b490f84
translate-c: remove now unnecessary mangling of primitive type shadowing
...
Closes #6382
2021-08-29 15:11:38 +03:00
jdmichaud
49c9975484
zig fmt: respect trailing commas in inline assembly
2021-08-29 11:57:32 +02:00
Isaac Freund
7b863aa8ac
AstGen: short-circuit rvalue() if code is unreachable
...
This avoids generating instructions which will never be reached.
2021-08-29 08:59:27 +00:00
Andrew Kelley
4bb5d17edc
AstGen: pre-scan all decls in a namespace
...
Also:
* improve the "ambiguous reference" error by swapping the order of
"declared here" and "also declared here" notes.
* improve the "not accessible from inner function" error:
- point out that it has to do with the thing being mutable
- eliminate the incorrect association with it being a function
- note where it crosses a namespace boundary
* struct field types are evaluated in a context that has the struct
namespace visible. Likewise with align expressions, linksection
expressions, enum tag values, and union/enum tag argument
expressions.
Closes #9194
Closes #9622
2021-08-28 16:04:38 -07:00
Andrew Kelley
05cf44933d
stage2: delete keywords true, false, undefined, null
...
The grammar does not need these as keywords; they are merely primitives
provided by the language the same as `void`, `u32`, etc.
2021-08-28 12:10:55 -07:00
Andrew Kelley
6a6e2cd64f
AstGen: allow locals with same name as primitives with @"" syntax
...
This makes local names follow the same rule as declaration names.
2021-08-28 13:28:34 -04:00
Andrew Kelley
f30aa25cbf
declarations may collide with primitives with @"" syntax
...
* stage2 AstGen: add missing compile error for declaring a local
that shadows a primitive. Even with `@""` syntax, it may not have
the same name as a primitive.
* stage2 AstGen: add a compile error for a global declaration
whose name matches a primitive. However it is allowed when using
`@""` syntax.
* stage1: delete all "declaration shadows primitive" compile errors
because they are now handled by stage2 AstGen.
* stage1/stage2 AstGen: notice when using `@""` syntax and:
- treat `_` as a regular identifier
- skip checking if an identifire is a primitive
Check the new test cases for clarifications on semantics.
closes #6062
2021-08-27 21:34:13 -07:00
Robin Voetter
cfae70ec8e
Make slice always return a reference
...
Previously this returned an rvalue, which leads to unexpected behaviour
when writing expressions such as `x[1..][1..].`
2021-08-27 18:53:03 -04:00
Robin Voetter
3aa533519d
Store to mutable pointer in analyzeRef
...
This function previously attempted to store a value to an immutable
pointer, after which storePtr would yield an error.
2021-08-27 18:53:03 -04:00
Robin Voetter
3a3704be05
Don't use .none_or_ref for for(expr)
...
We can already know whether the user want the expression to be a pointer or
ref based on whether the asterisk token is used, like with if and switch.
2021-08-27 18:53:03 -04:00
Jakub Konka
a14e98fcac
macho: remove sorting sections and refactor atom parsing in objects
2021-08-27 20:32:11 +02:00
Jakub Konka
ad4a8e7665
macho: keep actual file offset for zerofill sections separately
...
This way, we will conform to the standard practice of setting the
offset within the section header to the beginning of the file and
we will be able to track the location of the section in the file
for incremental updates.
2021-08-27 13:47:43 +02:00
Jakub Konka
1e65d41a65
macho: merge __common with __bss section
2021-08-27 11:30:02 +02:00
Jakub Konka
705cd64080
macho: preactively add zerofill sections in correct order
...
The required order on macOS nowadays is:
* __data
* __thread_vars
* __thread_data
* __thread_bss
* __bss
2021-08-27 10:45:56 +02:00
Lee Cannon
311797f686
Rework build system build_options API ( #9623 )
...
* rework `build_options` to integrate with the FileSource abstraction
* support mapping as an arbitrarily named package
* support mapping to multiple different artifacts
* use hash of contents for options filename
2021-08-26 19:53:23 -04:00
Jakub Konka
8bd0687713
macho: port mechanism for allocating symbols within atoms
...
such as entire sections represented as a single atom.
2021-08-26 16:16:34 +02:00
joachimschmidt557
04cafd8137
stage2 ARM: Add qadd, qsub, qdadd, qdsub instructions
...
These are integer saturating arithmetic instructions
2021-08-26 14:42:28 +02:00
Jakub Konka
29df0ca39d
Merge remote-tracking branch 'origin/master' into zld-incr
2021-08-26 14:35:34 +02:00
Jakub Konka
570c75cb74
macho: write all atoms in flush so that we can resolve relocs
2021-08-26 14:23:28 +02:00
Jakub Konka
432fb7054d
macho: fix stub writing in self-hosted setting
2021-08-26 13:45:28 +02:00
Jakub Konka
d19d3342c2
macho: save lazy binding info as part of the atom
2021-08-26 11:43:11 +02:00
Jakub Konka
c12183b608
macho: fix text atom allocation
2021-08-25 23:00:58 +02:00