13841 Commits

Author SHA1 Message Date
Luuk de Gram
3f22bb96f3
wasm-linker: fix debug info relocation
This corrects calculating the offsets to the code section as we now
correctly allocate the code atoms during write taking the 'size' into
account. We also handle dead symbols which are garbage-collected by
writing -2 and -1 to skip ranges, loc and other sections respectively.
2024-01-12 14:57:37 +01:00
Luuk de Gram
7fe629a812
wasm-linker: delay code atom allocation till write
We delay atom allocation for the code section until we write the actual
atoms. We do this to ensure the offset of the atom also includes the
'size' field which is leb128-encoded and therefore variable. We need this
correct offset to ensure debug info works correctly.

The ordering of the code section is now automatic due to iterating the
function section and then finding the corresponding atom to each
function. This also ensures each function corresponds to the right atom,
and they do not go out-of-sync.

Lastly, we removed the `next` field as it is no longer required and also
removed manually setting the offset in synthetic functions. This means
atoms use less memory and synthetic functions are less prone. They will
also be placed in order of function order correctly.
2024-01-12 14:57:36 +01:00
Luuk de Gram
2b3e6f680c
wasm-linker: ensure custom sections are parsed
Not all custom sections are represented by a symbol, which means the
section will not be parsed by the lazy parsing and therefore get garbage-
collected. This is problematic as it may contain debug information that
should not be garbage-collected. To resolve this, we manually create
local symbols for those sections and also ensure they do not get garbage-
collected.
2024-01-12 14:57:32 +01:00
Andrew Kelley
30688c341b LLVM: fix lowering of extern anyopaque
closes #18461
2024-01-11 01:00:49 -08:00
Andrew Kelley
df6aed0fc3
Merge pull request #18505 from ziglang/tsan
TSAN: update to LLVM 17.0.6
2024-01-10 15:08:49 -08:00
february cozzocrea
aafff25897
translate-c: float cast from boolean expr fix 2024-01-10 19:13:11 +00:00
Andrew Kelley
71e7bef2a2 tsan: use explicit error set
Fixes fail to build from source when LLVM not linked.
2024-01-10 09:30:24 -08:00
Andrew Kelley
798c68d5a5 tsan: update build logic for tsan from llvm 17.0.6 2024-01-10 01:00:37 -07:00
Andrew Kelley
036e9fd479 libcxx: fix not passing any_sanitize_thread correctly 2024-01-10 00:51:18 -07:00
Andrew Kelley
3051d4390b Compilation: fix tsan error reporting 2024-01-10 00:51:02 -07:00
Bogdan Romanyuk
4a1a5ee47b
AstGen: add error for redundant comptime var in comptime scope (#18242) 2024-01-09 20:09:39 -05:00
Andrew Kelley
7320b24e0e
Merge pull request #18486 from castholm/undefined-version
Add support for `--(no-)undefined-version`
2024-01-09 14:23:31 -08:00
Andrew Kelley
acca16c8ce
Merge pull request #18173 from dweiller/switch-err-union
Special-case switching on error union capture
2024-01-09 13:54:27 -08:00
Joel Gustafson
dbdee2d53c
ignore charset and boundary directives in content-type headers when fetching dependencies 2024-01-09 20:16:59 +00:00
dhash
9bb6430318 Add support for --(no-)undefined-version
Co-authored-by: Motiejus Jakštys <motiejus@jakstys.lt>
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
Co-authored-by: Samuel Cantero <scanterog@gmail.com>
Co-authored-by: Giorgos Georgiou <giorgos.georgiou@datadoghq.com>
Co-authored-by: Carl Åstholm <carl@astholm.se>
2024-01-09 17:24:11 +01:00
Andrew Kelley
60094cc3fc
Merge pull request #18491 from ziglang/fix-mod-link-obj-path
std.Build.Step.Compile: fix link object paths
2024-01-09 01:11:15 -08:00
joachimschmidt557
f12ec02bd7 stage2 AArch64: get empty file compiling again 2024-01-08 23:53:24 -08:00
dweiller
67d7d7b5a7 fixup! astgen: use switch_block_err_union 2024-01-09 15:31:20 +11:00
dweiller
ec5b751373 sema: inherit block want_safety for err switch union 2024-01-09 14:42:12 +11:00
dweiller
fc6dc797ce astgen/sema: fix source locations for switch_block_err_union 2024-01-09 14:42:12 +11:00
dweiller
6a18cee3af astgen/sema: use switch_block_err_union for if-else-switch 2024-01-09 14:42:12 +11:00
dweiller
b7eb59fc14 fix x86_64 crashes for switch_block_err_union
This change only emits the unwrap_errunion_err instruction if the error
capture is actually used in a branch.
2024-01-09 14:42:12 +11:00
dweiller
adcaad6d91 sema: fix err union switch with inferred empty error sets 2024-01-09 14:42:12 +11:00
dweiller
2fa69cce72 sema: allow maybeErrorUnwrap to handle err_union_code 2024-01-09 14:42:12 +11:00
dweiller
a175a64384 sema: implement runtime switch_block_err_union 2024-01-09 14:42:12 +11:00
dweiller
6bf319ebbb sema: extract runtime switch AIR generation to function 2024-01-09 14:42:12 +11:00
dweiller
ae19f699ab sema: implement switch_block_err_union on comptime operands 2024-01-09 14:42:12 +11:00
dweiller
2cf648fba7 astgen: use switch_block_err_union 2024-01-09 14:42:12 +11:00
dweiller
b784f64a6e sema: refactor error set switch logic 2024-01-09 14:42:11 +11:00
dweiller
4136097566 zir: add switch_block_err_union 2024-01-09 14:42:11 +11:00
dweiller
063d55c504 zir: remove unused zir as instruction 2024-01-09 14:42:11 +11:00
Andrew Kelley
3023d2845c compilation: fix bad path in error message 2024-01-08 18:20:06 -07:00
Ali Chraghi
0e856da224 add type safety to ZIR for null terminated strings 2024-01-08 16:33:33 -08:00
Andrew Kelley
4cf08932b5
Merge pull request #16109
Update mingw-w64 to latest git commit
2024-01-08 16:13:14 -08:00
Andrew Kelley
ed410b9c1e lift artificial restriction on minimum glibc version
Fixes a regression introduced in
c22d1c00a8825f60e7b01b97c6f73cbc21ca8257.

See #17769
2024-01-08 13:43:10 -07:00
Andrew Kelley
9a4a74eb65 mingw: remove pow.c from aarch64-windows mingw builds
I observed a duplicate symbol linker error; pow was defined both by
mingwex.lib and ucrtbase.dll.
2024-01-08 11:53:06 -07:00
Andrew Kelley
f5ed441ddb mingw: add the build logic for the previous commit
Separate commits for the zig logic and the copied files.
2024-01-08 11:52:38 -07:00
Andrew Kelley
99922c2708 Compilation: only add __MSVCRT_VERSION__ for -lc
prevents it from being defined twice when building mingw-w64 libs.
2024-01-08 11:52:38 -07:00
Andrew Kelley
7b3afc880b Compilation: add definition to prefer ucrt for windows C/C++ files
This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt
for stdio.
2024-01-08 11:52:38 -07:00
Andrew Kelley
e2a8fe721d mingw: add comments so that I don't regress this code later
Martin Storsjö kindly took the time to discuss things at length with me,
and the results are that this status quo is correct. I added comments so
that I don't think it should be changed later.
2024-01-08 11:52:38 -07:00
Andrew Kelley
3f4c73ae93 mingw: update from msvcrt to ucrt 2024-01-08 11:52:38 -07:00
Andrew Kelley
c26bace606 mingw-w64: update CRT files to latest git commit
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

* adds ucrtbase.def.in
* mingwex: replace mingw crt files with ucrt files
* adds missing mingw-w64 ucrt files

The rules that govern which set of files are included or excluded is
contained in the logic for tools/update_mingw.zig
2024-01-08 11:52:38 -07:00
Andrew Kelley
491b460e0a add tool for updating mingw crt files 2024-01-08 11:52:38 -07:00
Jeremy Volkman
8fd15c6ca8 Use a fixed chunk size when calculating MachO UUID 2024-01-08 10:23:07 +01:00
Andrew Kelley
3176fdc0b9
Merge pull request #18470 from castholm/typeInfo-sentinels
Make `@typeInfo` return null-terminated strings
2024-01-07 22:28:24 -08:00
Veikka Tuominen
faeb0ef032 llvm: optional slices cannot be passed in parts when they allowzero
Closes #18428
2024-01-08 06:57:06 +02:00
Carl Åstholm
01b48e9381 InternPool: Fix rare buffer overflow when initializing aggregate with sentinel 2024-01-07 21:46:52 +01:00
Carl Åstholm
c8fa767f08 Work around stage1 not yet returning null-terminated @typeInfo strings
These changes can be reverted the next time stage1 is updated.
2024-01-07 16:21:08 +01:00
Carl Åstholm
a02bd81760 Make @typeInfo return null-terminated strings
Changes the types of `std.builtin.Type` `name` fields from `[]const u8`
to `[:0]const u8`, which should make them easier to pass to C APIs
expecting null-terminated strings.

This will break code that reifies types using `[]const u8` strings, such
as code that uses `std.mem.tokenize()` to construct types from strings
at comptime. Luckily, the fix is simple: simply concatenate the
`[]const u8` string with an empty string literal (`name ++ ""`) to
explicitly coerce it to `[:0]const u8`.

Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>
2024-01-07 15:35:18 +01:00
Tristan Ross
c78b6564df Compilation: pass code model in buildOutputFromZig 2024-01-06 18:33:24 -08:00