9563 Commits

Author SHA1 Message Date
Meghan Denny
0879cbeed2 remove 'builtin.stage2_arch', Sema is smart enough now 2022-08-07 16:07:08 -07:00
Andrew Kelley
b3d463c9e6
Merge pull request #12337 from Vexu/stage2-safety
Stage2: implement remaining runtime safety checks
2022-08-06 14:59:10 -07:00
Veikka Tuominen
3e2defd36c stage2: add a helpful error for when async is used 2022-08-06 14:51:20 -07:00
joachimschmidt557
b300eecb9d stage2 DWARF: fix size and offset in slices
Previously, `@sizeOf(usize)` was used, however, the pointer size of
the host may differ from the target when cross-compiling.
2022-08-06 14:44:05 -07:00
Veikka Tuominen
bd21f499dc Type: adjust C type sizes 2022-08-06 14:42:05 -07:00
Veikka Tuominen
75275a1514 Sema: do not emit pointer safety checks for pointers to zero-bit types 2022-08-06 15:22:14 +03:00
Anton Lilja
86d9c3de2b
Sema: fix infinite recursion in explainWhyTypeIsComptime
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-08-06 14:17:09 +03:00
Andrew Kelley
5c9826630d Sema: elide safety of modulus and remainder division sometimes
Piggybacking on 40f8f0134f5da9baaefd0fdab529d5585fa46199, remainder
division, modulus, and `%` syntax no longer emit safety checks for a
comptime-known denominator.
2022-08-05 21:13:18 -07:00
Veikka Tuominen
0daa77bd63 stage2 cbe: correct airIsNull ptr operand check 2022-08-05 22:13:58 +03:00
Veikka Tuominen
f46d7304b1 stage2: add runtime safety for invalid enum values 2022-08-05 22:13:58 +03:00
Veikka Tuominen
19d5ffc710 Sema: add safety check for non-power-of-two shift amounts 2022-08-05 22:13:58 +03:00
Veikka Tuominen
9116e26c1f Sema: add null check for implicit casts 2022-08-05 22:13:58 +03:00
Veikka Tuominen
5605f6e0e3 Sema: account for sentinel in bounds check 2022-08-05 22:13:57 +03:00
Veikka Tuominen
6aa438f065 Sema: add null pointer slice safety check when len is comptime known 2022-08-05 22:13:57 +03:00
Veikka Tuominen
eec2978fac Sema: better safety check on switch on corrupt value 2022-08-05 22:13:57 +03:00
joachimschmidt557
f46c80b267
stage2 AArch64: improve correctness of register aliases
Also implements ptr_elem_ptr
2022-08-05 20:30:52 +02:00
joachimschmidt557
508b90fcfa
stage2 AArch64: implement basic integer rem/mod 2022-08-05 20:30:52 +02:00
joachimschmidt557
8b24c783c5
stage2 AArch64: implement basic integer division 2022-08-05 20:30:51 +02:00
joachimschmidt557
dcb236acf4
stage2 AArch64: memcpy support in store and more complete intcast 2022-08-05 20:30:51 +02:00
joachimschmidt557
02738228f2
stage2 AArch64: support returning values by reference
also adds some more support for slices passed as stack arguments
2022-08-05 20:30:51 +02:00
joachimschmidt557
65b3c27f24
stage2 AArch64: all arguments passed via stack from now on
Only in the Undefined calling convention, not in other calling
conventions
2022-08-05 20:30:51 +02:00
joachimschmidt557
cf3aaceed9
stage2 AArch64: introduce MCValue.stack_argument_offset
This new MCValue union member shares the same semantics as the MCValue
type of the same name in the ARM backend.
2022-08-05 20:30:51 +02:00
joachimschmidt557
423bef4dfc
stage2 AArch64: Fix struct_field_val for register_with_overflow
Now mirrors the behavior of the native ARM backend
2022-08-05 20:30:47 +02:00
Meredith Oleander
fd3415ad5e
translate-c: fix alignment in pointer casts 2022-08-05 15:38:48 +03:00
Veikka Tuominen
42ade6a114
Merge pull request #12300 from antlilja/getParamName
Replace param_names and anytype_args fields inside of Fn with functions
2022-08-05 15:29:59 +03:00
Loris Cro
55ec2148fd autodoc: fix analysis of function return types 2022-08-04 23:24:18 +02:00
Jakub Konka
4a4f3c50ce
Merge pull request #12320 from ziglang/macho-zld-sync 2022-08-03 22:02:50 -07:00
Andrew Kelley
e483336ba4
Merge pull request #12318 from Vexu/stage2-compile-errors
Stage2: misc compile error improvements
2022-08-03 20:13:07 -07:00
Jakub Konka
007eb3bd71 macho: fix some TODOs 2022-08-03 21:26:52 +02:00
Jakub Konka
2c8fc3b597 macho: add missing u64 to usize casts
Fixes 32bit builds.
2022-08-03 21:19:41 +02:00
Jakub Konka
90e3268270 macho: do not preempt segment headers; do it when commiting to file
This way, tracking segment-to-section mapping becomes a lot easier
since it's effectively just start index plus number of sections
defined within the segment. If a section becomes empty however
care needs to be taken to remove the header upon committing to the
final binary.
2022-08-03 21:19:41 +02:00
Jakub Konka
1e710396d4 macho: fix linking in incremental context
Fix incorrect writing of symtab and strtab in dSYM bundle in incremental
context.

Fix incorrectly navigating unnamed consts (freeing) in incremental context.
This is currently hard-coded to require all consts to land in `__TEXT,__const`,
which is wrong and needs a rewrite.
2022-08-03 21:19:41 +02:00
Jakub Konka
7bba3d330a macho: cleanup output section selection logic
Cache only section indexes used by the linker for synthetic sections
and/or incremental codepath.
2022-08-03 21:19:41 +02:00
Jakub Konka
bb532584bc macho: update how we insert output sections
Instead of generating sections upfront, allow generation by scanning
the object files for input -> output sections mapping. Next, always
strive to keep output sections in the final container sorted as they
appear in the final binary. This makes the linker less messy wrt
handling of output sections sort order for dyld/macOS not to complain.
There's still more work to be done for incremental context though
to make this work but looks promising already.
2022-08-03 21:19:41 +02:00
Jakub Konka
f26d5ee7ea macho: sync with zld
gitrev a2c32e972f8c5adfcda8ed2d99379ae868f59c24

a2c32e972f
2022-08-03 21:19:41 +02:00
Loris Cro
4c750016eb autodoc: inferred error unions in function return values 2022-08-03 17:21:56 +02:00
Veikka Tuominen
4ab60dc18b Sema: add error for dependency loops 2022-08-03 17:10:39 +03:00
Veikka Tuominen
b79929b2ea AstGen: better source location for if/while condition unwrapping 2022-08-03 16:45:33 +03:00
Veikka Tuominen
d1d24b426d AstGen: check loop bodies and else branches for unused result 2022-08-03 16:45:33 +03:00
Veikka Tuominen
aa78ebaf95 Sema: improve circular dependency errors 2022-08-03 16:45:33 +03:00
Veikka Tuominen
797ded47f0 Sema: move last error message from Inlining to Sema 2022-08-03 16:45:33 +03:00
Veikka Tuominen
02112f8836 AstGen: add error for break/continue out of defer expression 2022-08-03 16:45:33 +03:00
Veikka Tuominen
6547c3887e Sema: add error for closure capture at runtime 2022-08-03 16:45:33 +03:00
Loris Cro
447a4cc115 autodoc: fix off-by-1 error in analysis of pointer types 2022-08-02 17:49:36 +02:00
Loris Cro
c5afefec42 autodoc: fix autodoc analysis for @typeInfo
We were previously erroneously saving it as a `@TypeOf`.
2022-08-02 17:49:36 +02:00
Veikka Tuominen
14f0b70570 Sema: add safety for sentinel slice 2022-08-02 18:34:30 +03:00
Veikka Tuominen
292906fb23 Sema: fix reify Fn alignment and args 2022-08-02 18:33:03 +03:00
Veikka Tuominen
e47706f344 Sema: validate packed struct field types 2022-08-01 23:59:40 +03:00
Veikka Tuominen
f1768b40b2 stage2: better source location for var decls 2022-08-01 23:37:01 +03:00
Veikka Tuominen
57f9405a8f Sema: validate bitcast operand type 2022-08-01 23:37:01 +03:00