10663 Commits

Author SHA1 Message Date
Jakub Konka
d7e42014ca elf: add growAllocSection and growNonAllocSection
Update `Dwarf.zig` to use `growNonAllocSection` for ELF and implement
routine to make space for `.debug_line` header.
2022-12-09 09:24:25 +01:00
Jakub Konka
aa2f48f013 dsym: reuse growSection where possible 2022-12-09 09:24:25 +01:00
Jakub Konka
fa44c73c1e dwarf: move any remaining section growth to dsym 2022-12-09 09:24:25 +01:00
Jakub Konka
b14e580ad8 dwarf: move growing debug_aranges section to dsym 2022-12-09 09:24:25 +01:00
Jakub Konka
136a508027 dsym: finish markDirty helper 2022-12-09 09:24:25 +01:00
Jakub Konka
ecb341a006 dwarf: move growing debug_abbrev section to dsym 2022-12-09 09:24:25 +01:00
Jakub Konka
381abcfb7a dwarf: move another sect growing routine to d_sym 2022-12-09 09:24:25 +01:00
Jakub Konka
4bb66b63ba macho: add helper for getting ptr to DebugSymbols 2022-12-09 09:24:25 +01:00
Jakub Konka
05e221796a dwarf+d_sym: move logic for growing section to d_sym 2022-12-09 09:24:25 +01:00
Jakub Konka
4c38ba7d1b dwarf: move SrcFns if debug_line header exceeded its padding 2022-12-09 09:24:25 +01:00
Jakub Konka
be2b85f670 dwarf: refactor object file format and ptr width switches in writeDbgLineHeader 2022-12-09 09:24:25 +01:00
Jakub Konka
8e71a79e4b dwarf: fix incorrect calc of dir index 2022-12-09 09:24:25 +01:00
Jakub Konka
62145a1b08 dwarf: refactor routine for precalculating size of dbg line header 2022-12-09 09:24:25 +01:00
Jakub Konka
6817219e27 dwarf: generate list of include dirs and file names like LLVM backend 2022-12-09 09:24:25 +01:00
Jakub Konka
6ec34edb9a dwarf: fully resolve each path to each file source 2022-12-09 09:24:25 +01:00
Jakub Konka
f5c764d892 dwarf: track source files via *const Module.File pointers 2022-12-09 09:24:25 +01:00
Jakub Konka
4c4821d993 dwarf: specify all referenced zig source files 2022-12-09 09:24:25 +01:00
Veikka Tuominen
ee9fc54cd0 TypedValue: fix handling of tuples represented as empty_struct_value 2022-12-08 22:21:49 +02:00
Veikka Tuominen
d5ecb318c4 Sema: check for uneeded src loc when using --debug-compile-errors 2022-12-08 11:10:08 +02:00
Veikka Tuominen
f8dcd34775 TypedValue.print: detect string literals
Closes #4281
Closes #13785
2022-12-07 20:32:27 +02:00
Veikka Tuominen
dff32a2cd7 Sema: resolve lazy values in analyzeMinMax
Closes #13797
2022-12-07 14:48:24 +02:00
Veikka Tuominen
ddce76059b Sema: add error for @tagName on empty enum 2022-12-07 14:48:24 +02:00
Veikka Tuominen
d078d08e4f Sema: export function instead of the constant referencing it
Closes #13706
2022-12-07 14:48:24 +02:00
Veikka Tuominen
92f1a29c40 AstGen: make @compileError operand implicitly comptime
This matches the language reference.
2022-12-07 14:48:24 +02:00
Andrew Kelley
53a9ee699a
Merge pull request #13799 from ziglang/close-stage1-issues
close stage1 issues
2022-12-07 03:06:10 -05:00
Casey Banner
8ccb9a6ad3
cache: Fix LockViolation during C compilation paths (#13591)
- C compilation flows didn't hold an exclusive lock on the cache manifest file when writing to it in all cases
- On windows, explicitly unlock the file lock before closing it
2022-12-06 23:15:54 -05:00
Andrew Kelley
50eb7983cd remove most conditional compilation based on stage1
There are still a few occurrences of "stage1" in the standard library
and self-hosted compiler source, however, these instances need a bit
more careful inspection to ensure no breakage.
2022-12-06 20:38:54 -07:00
Andrew Kelley
b7b905d227 add behavior test for while(true) not needing else unreachable
closes #707
2022-12-06 17:57:27 -07:00
Andrew Kelley
e7d28344fa
Merge pull request #13560 from ziglang/wasi-bootstrap
Nuke the C++ implementation of Zig from orbit using WASI
2022-12-06 18:52:39 -05:00
Frank Denis
817cf6a82e
Update wasi-libc to 8b7148f69ae241a2749b3defe4606da8143b72e0 (#13793) 2022-12-06 22:48:35 +00:00
Andrew Kelley
3f693cf5d5 CLI: quality of life enhancement for windows CBE behavior tests
When testing with

```
stage4/bin/zig test ../test/behavior.zig -I../test -ofmt=c -target x86_64-windows
```

previously, one would see this message:

```
error: lld-link: subsystem must be defined
```

Now, `--subsystem console` as well as `-lntdll -lkernel32` are on the
`zig run` line, producing a binary.
2022-12-06 12:46:59 -07:00
Jacob Young
91e489174b CBE: avoid trailing space 2022-12-06 12:27:28 -07:00
Jacob Young
3686787f67 CBE: add windows-specific reserved identifiers 2022-12-06 12:27:28 -07:00
Andrew Kelley
823d1e7087 add std.heap.wasm_allocator 2022-12-06 12:27:28 -07:00
Andrew Kelley
a3fadd2813 stage2: revert change to handling of --color on
This change has been extracted to #13786 and can be solved separately
than this branch.
2022-12-06 12:15:05 -07:00
Andrew Kelley
cb012490ee translate-c: fix wrong logic adjustment
In ea9ad1e85dd5e2ba18e7d55f7a7f9694282159f1, I incorrectly applied
boolean logic to one of the pieces of logic, resulting in a regression
in translate-c.
2022-12-06 12:15:05 -07:00
Jacob Young
c8541f0a12 cc: remove argument parsing from only-c builds 2022-12-06 12:15:04 -07:00
Jacob Young
47a2a526e2 test: remove reference to stage1 2022-12-06 12:15:04 -07:00
Jacob Young
f421efbcc1 CBE: fix bad local reuse for volatile memset 2022-12-06 12:15:04 -07:00
Andrew Kelley
7ef745db59 Sema: queue type resolution for result of @fieldParentPtr 2022-12-06 12:15:04 -07:00
Andrew Kelley
9cb06f3b8b fix merge conflicts from master branch 2022-12-06 12:15:04 -07:00
Andrew Kelley
ef447c3eca redo CMakeLists.txt to use WASI interpreter
current status is that it hits error: OutOfMemory for unknown reasons,
probably due to bugs in the C WASI interpreter port.
2022-12-06 12:15:04 -07:00
Andrew Kelley
8c1c67bdd0 stage2: take advantage of the new WasmAllocator 2022-12-06 12:15:04 -07:00
Andrew Kelley
3dcdd5544f stage2: make --color override apply to std.Progress 2022-12-06 12:15:04 -07:00
Andrew Kelley
3a8117439d allow build-obj and build-exe in -Donly-c builds 2022-12-06 12:15:04 -07:00
Andrew Kelley
d5312d53a0 WASI: remove absolute path emulation from std lib
Instead of checking for absolute paths and current working directories
in various file system operations, there is one simple solution: allow
overriding `std.fs.cwd` on WASI.

os.realpath is back to causing a compile error when used on WASI. This
caused a compile error in the Sema handling of `@src()`. The compiler
should never call realpath, so the commit that made this change is
reverted (95ab942184427e7c9b840d71f4d093931e3e48fb). If this breaks
debug info, a different strategy is needed to solve it other than using
realpath.

I also removed the preopens code and replaced it with something much
simpler. There is no longer any global state in the standard library.

Additionally-
 * os.openat no longer does an unnecessary fstat on WASI when O.WRONLY
   is not provided.
 * os.chdir is back to causing a compile error on WASI.
2022-12-06 12:15:04 -07:00
Andrew Kelley
3ba916584d actually remove stage1 2022-12-06 12:15:04 -07:00
Andrew Kelley
db023b98a4 build: introduce -Dwasi-bootstrap option
Also, make -Donly-c prevent Autodoc from being included in the binary.

This produces a 2.6 MiB zig.wasm file. 781 KB if piped through zstd.
2022-12-06 12:15:04 -07:00
Andrew Kelley
28514476ef remove -fstage1 option
After this commit, the self-hosted compiler does not offer the option to
use stage1 as a backend anymore.
2022-12-06 12:15:04 -07:00
Andrew Kelley
36da3000c0 Sema: resolve elem type for non-default aligned ptrs
Before this commit, I observe a crash from this abiSize call because the
element type is a struct that is not yet resolved. This is triggered by
running the behavior tests with -ofmt=c -target x86_64-windows.
2022-12-06 02:54:58 -05:00