9781 Commits

Author SHA1 Message Date
Evan Haas
e283a40d17 translate-c: convert tabs to \t in object-like macro string literals
Closes #12549
2022-09-07 14:46:58 +03:00
Loris Cro
e2bb92b2e2
Merge pull request #12736 from alichraghi/patch-2
autodoc: fix highlighted line in light mode
2022-09-05 17:37:12 +02:00
Der Teufel
b8001335c4 autodoc: Opaque now handled like other container types 2022-09-04 22:47:58 +02:00
Loris Cro
dbd60e3d29 autodoc: add support for doc tests 2022-09-04 22:45:57 +02:00
Veikka Tuominen
9ce841a0f0 stage2 llvm: implement aarch64 C ABI
... at least enough to pass all the current tests.
2022-09-04 18:46:56 +03:00
riChar
349cf54b32
llvm: fix the type parameter of GlobalAlias
Closes 12680
2022-09-04 18:44:45 +03:00
Ali Chraghi
5b3ca4bb53
autodoc: fix highlighted line in light mode 2022-09-04 14:13:47 +04:30
Veikka Tuominen
b7d5582ded
Merge pull request #12723 from Vexu/stage2-fixes
Stage2 fixes
2022-09-03 15:48:28 +03:00
Veikka Tuominen
c7884af063 translate-c: do not translate packed C structs as packed Zig structs in stage2
Zig's integer backed packed structs are not compatible with C's packed structs.
2022-09-03 03:42:42 +03:00
Veikka Tuominen
0f61d1f0df stage2 llvm: improve handling of i128 on Windows C ABI 2022-09-03 03:42:42 +03:00
Veikka Tuominen
b83c037f9f Sema: only ABI sized packed structs are extern compatible 2022-09-03 01:04:46 +03:00
Veikka Tuominen
6aee07c144 Sema: remove unused src param from typeRequiresComptime 2022-09-02 19:49:11 +03:00
Loris Cro
4a08c6dd51 autodoc: fix stage2 compile error 2022-09-02 18:13:17 +02:00
Loris Cro
e72a8ed5a1 autodoc: fix merge mistake 2022-09-02 17:59:37 +02:00
Loris Cro
907c60aaa7
Merge pull request #12705 from der-teufel-programming/autodoc-big-int
Autodoc big_int
2022-09-02 17:48:17 +02:00
Loris Cro
a77d7b740f autodoc: simplify int_big json stringify procedure 2022-09-02 17:47:04 +02:00
Loris Cro
70b96169ae
Merge pull request #12709 from der-teufel-programming/autodoc-compare-operators
autodoc: Compare operators
2022-09-02 17:38:00 +02:00
Loris Cro
081d5a9690 autodoc: correct line number implementation
we also correctly take advantage of the starting byte offset of the
parent decl when calling `tree.tokenLocation()`!
2022-09-02 17:28:12 +02:00
Veikka Tuominen
f281f3d10e Sema: improve behavior of comptime_int backed enums 2022-09-02 17:57:11 +03:00
Veikka Tuominen
a9cdacff95 Sema: add error for enum tag value overflow
Closes #12291
2022-09-02 17:57:11 +03:00
Veikka Tuominen
7a51e0befe Sema: fix noalias coercion error message
Closes #11769
2022-09-02 17:57:11 +03:00
Veikka Tuominen
1c4c68e6ba AstGen: use reachableExpr for try operand
Closes #12248
2022-09-02 17:57:10 +03:00
Veikka Tuominen
db54cd247d Sema: do not emit dbg_inline_end after NoReturn
Closes #12698
2022-09-02 17:57:10 +03:00
Veikka Tuominen
8b58dab78b Sema: resolve lazy value before intToFloat
Closes #12698
2022-09-02 17:57:10 +03:00
Veikka Tuominen
7a8d9af4a9 stage2 llvm: correct handling of zero-bit types in unionFieldPtr
Pointers to zero-bit types are not zero-bit types so the function should
return something.
Closes #12716
2022-09-02 17:57:10 +03:00
Veikka Tuominen
4462d08224 stage2 llvm: fix passing packed structs to callconv(.C) functions
Closes #12704
2022-09-02 17:57:10 +03:00
Ali Chraghi
30e85c9c80
autodoc: highlight target line 2022-09-02 19:11:34 +04:30
riChar
f7784a081f
stage2: fix panic when the dependency is missing 2022-09-02 12:53:48 +03:00
Der Teufel
4c033eb35c autodoc: int_big cleanup 2022-09-02 11:01:46 +02:00
Der Teufel
0d3c6b7aa8 autodoc: Added int_big support 2022-09-02 11:01:46 +02:00
Der Teufel
3bbf08e98a autodoc: Compare operators 2022-09-01 15:17:14 +02:00
Veikka Tuominen
2cd3989cb3 Sema: add more validation to coerceVarArgParam
Closes #12706
2022-09-01 13:16:33 +03:00
Jakub Konka
b45387f20e coff: write base relocations for the dynamic linker
This means we can request ASLR on by default as other COFF linkers
do. Currently, we write the base relocations in bulk, however,
given that there is a mechanism for padding in place in PE/COFF
I believe there might be room for making it an incremental operation
(write base relocation whenever we add/update a pointer that would
require it).
2022-08-31 14:39:35 +02:00
Luuk de Gram
4ba0ad295f
Merge pull request #12687 from Luukdegram/wasm-extern-globals
wasm-linker: implement non-function extern variables
2022-08-31 13:44:06 +02:00
Andrew Kelley
56cfa8f22f Sema: prevent access of undefined fields
When instantiating a generic function, there is a period of time where
the function is inserted into monomorphed_funcs map, but is not yet
initialized. Despite semantic analysis being single-threaded, generic
function instantiation can happen recursively, meaning that the hash
and equality functions for monomorphed_funcs entries are potentially
invoked for an uninitialized function.

This problem was mitigated by pre-setting the hash field on the newly
allocated function, however it did not solve the problem for hash
collisions in which case the equality function would be invoked. That it
was solved for hash() but not eql() explains why the problem was
difficult to observe. I tested this patch by temporarily sabotaging the
hash and making it always return 0.

This fix is centered on adding a new field to Module.Fn which is the one
checked by eql() and is populated pre-initialization.

closes #12643
2022-08-30 18:34:08 -07:00
Andrew Kelley
7377dce368 avoid exposing supportsTailCall in the standard library
This is problematic because in practice it depends on whether the
compiler backend supports it too, as evidenced by the TODO comment about
LLVM not supporting some architectures that in fact do support tail
calls.

Instead this logic is organized strategically in src/target.zig, part of
the internal compiler source code, and the behavior tests in question
duplicate some logic for deciding whether to proceed with the test.

The proper place to expose this flag is in `@import("builtin")` - the
generated source file - so that third party compilers can advertise
whether they support tail calls.
2022-08-30 12:50:15 -07:00
Veikka Tuominen
65d3723968 Sema: check that target supports tail calls 2022-08-30 12:22:07 -07:00
Veikka Tuominen
c558de6655 stage2 llvm: use tag value instead of field index in airUnionInit
Closes #12656
2022-08-30 12:22:07 -07:00
Veikka Tuominen
d3b4b2edf1 Sema: shift of comptime int with runtime value
Closes #12290
2022-08-30 12:22:07 -07:00
Veikka Tuominen
01d19a8d3c Sema: do not emit generic poison for non generic parameters
Closes #12679
2022-08-30 12:22:07 -07:00
Veikka Tuominen
67a44211f7 Sema: improve handling of always_tail call modifier
Closes #4301
Closes #5692
Closes #6281
Closes #10786
Closes #11149
Closes #11776
2022-08-30 12:22:07 -07:00
Luuk de Gram
8627858bbc
test/link: add test for extern resolution
Adds a linker tests to verify extern/undefined symbols
representing non-functions are being resolved correctly.
2022-08-30 18:32:08 +02:00
Luuk de Gram
4f72ac265a
wasm: create relocations for extern decls
This also fixes performing relocations for data symbols
of which the target symbol exists in an external object file.
We do this by checking if the target symbol was discarded,
and if so: get the new location so that we can find the
corresponding atom that belongs to said new location. Previously
it would always assume the symbol would live in the same file
as the atom/symbol that is doing the relocation.
2022-08-30 16:38:55 +02:00
Luuk de Gram
414fcea162
link/Wasm: handle extern variables
Generate symbols for extern variables and try to resolve them.
Unresolved 'data' symbols generate an error as they cannot be
exported from the Wasm runtime into a Wasm module. This means,
they can only be resolved by other object files such as from other
Zig or C code compiled to Wasm.
2022-08-30 16:38:51 +02:00
Jakub Konka
601f2147e0 coff: cleanup relocations; remove COFF support from other backends
Given that COFF will want to support PIC from ground-up, there is no
point in leaving outdated code for COFF in other backends such as
arm or aarch64. Instead, when we are ready to look into those, we
can start figuring out what to add and where.
2022-08-30 10:42:21 +02:00
Jakub Konka
ebdb286736 coff: commit missing Object.zig placeholder 2022-08-30 10:42:21 +02:00
Jakub Konka
f0d4ce4494 coff: add basic handling of GOT PC relative indirection 2022-08-30 10:42:21 +02:00
Jakub Konka
db1a3bb0e7 coff: fallback to _start as default entry point for now
This is not technically correct, but given that we are not yet able
to link against the CRT, it's a good default until then.

Add basic logging of generated symbol table in the linker.
2022-08-30 10:42:21 +02:00
Jakub Konka
b4e3b87a52 coff: ...and lift-off! 2022-08-30 10:42:21 +02:00
Jakub Konka
30baba899c coff: add missing bits required for minimal PE example 2022-08-30 10:42:21 +02:00