12930 Commits

Author SHA1 Message Date
Jakub Konka
1063035be6
Merge pull request #17304 from ziglang/elf-grow-vm-2
elf: grow segments in virtual memory if they exceed allocated capacity
2023-09-28 14:29:35 +02:00
Emil Lerch
fcca3cd1a3
std.http: introduce options to http client to allow for raw uris
Addresses #17015 by introducing a new startWithOptions. The only option is currently is a flag
to use the provided URI as is, without modification when passed to the server. Normally, this
is not needed nor desired. However, some REST APIs may have requirements that cannot be satisfied
with the default handling.
2023-09-28 14:16:39 +03:00
Ryan Liptak
a362d3963c resinator: Update to latest, fix for big endian arch 2023-09-28 02:25:52 -07:00
Jakub Konka
df285949f7 elf: do not assume segments laid out in increasing order in VM space 2023-09-28 08:47:58 +02:00
Andrew Kelley
937138cb90
Merge pull request #17248 from antlilja/abs
Replace @fabs builtin with new @abs builtin
2023-09-27 17:25:19 -07:00
Veikka Tuominen
ab3ac1e670 Value: fix assertion failure when mutating extern union
Closes #17292
2023-09-27 11:47:24 -07:00
Andrew Kelley
1c02e58fc0 Revert "compiler: don't use @abs builtin yet"
This reverts commit 21780899eb17a0cb795ff40e5fae6556c38ea13e.

After this commit, a version of the compiler which supports the new
`@abs` builtin is required.
2023-09-27 11:23:28 -07:00
Andrew Kelley
21780899eb compiler: don't use @abs builtin yet
This commit can be used to rebuild zig1.wasm
2023-09-27 11:21:59 -07:00
antlilja
6a29646a55 Rename @fabs to @abs and accept integers
Replaces the @fabs builtin with a new @abs builtins which accepts
floats, signed integers and vectors of said types.
2023-09-27 11:15:53 -07:00
Jakub Konka
8f90dbba55 elf: fix typo in selecting larger addrspace for load segments 2023-09-27 20:05:46 +02:00
Jakub Konka
8b7255c22a elf: hint allocateSegment where to put the segment at 2023-09-27 19:41:59 +02:00
Jakub Konka
111349f83c elf: do not update globals not defined by the object 2023-09-27 19:22:57 +02:00
Jakub Konka
85132965f4 elf: use new error reporting API 2023-09-27 16:40:51 +02:00
Jakub Konka
09863fc970 elf: emit fatal linker error if we run out of VM space with self-hosted backends 2023-09-27 15:07:05 +02:00
Andrew Kelley
1606717b5f C backend: flatten out some of the long-lived state
When the compiler's state lives through multiple Compilation.update()
calls, the C backend stores the rendered C source code for each
decl code body and forward declarations.

With this commit, the state is still stored, but it is managed in one
big array list in link/C.zig rather than many array lists, one for each
decl. This means simpler serialization and deserialization.
2023-09-27 04:09:22 -07:00
kcbanner
70563aeac3 windows: fix not finding system libs when compiling for *-windows-msvc
When compiling for *-windows-msvc, find the native libc_installation and
add the lib dirs to lib_dirs, so that system libs can be found.

Previously, `version` and `ole32` were detected via the mingw.libExists logic,
even on .msvc, which was a false positive. This detection logic for mingw doesn't
find uuid.lib, which was the failure that triggered this bugfix.

Only build the issue_5825 test if the native target is x86_64-windows-msvc,
since it requires the .msvc abi.
2023-09-27 04:07:12 -07:00
Jakub Konka
e178580d86 elf: pre-allocate large VM capacity per segment 2023-09-27 10:00:20 +02:00
Jakub Konka
1200a5a240 elf: allow expanding segments in virtual memory 2023-09-27 09:59:59 +02:00
Jakub Konka
7a43f45908
Merge pull request #17284 from ziglang/elf-tests
elf: link against musl libc, add ELF test harness, dynamically allocate misc SHF_ALLOC sections
2023-09-27 07:39:58 +02:00
LinuxUserGD
ceaae42e90 Add '--compress-debug-sections=zstd' 2023-09-26 14:18:01 -07:00
Andrew Kelley
5d907171e2
Merge pull request #17152 from mikdusan/macos-sdk
macos SDK updates and enhancements
2023-09-26 13:16:07 -07:00
Phil Richards
15ce965252
define _WIN32_WINNT for windows compilations based on target minver (#17224) 2023-09-26 15:25:08 -04:00
Jakub Konka
e30f396b73 elf: properly close the output file when linking 2023-09-26 21:07:47 +02:00
Jakub Konka
eb497c50e3 elf: dynamically allocate remaining alloc sections (and segments) 2023-09-26 21:07:47 +02:00
Jakub Konka
5e617e4b0c elf: put libc on the linker line if requested 2023-09-26 21:07:47 +02:00
Jakub Konka
e7c6dfde3d elf: do not try to create LlvmObject if module is null 2023-09-26 21:07:47 +02:00
Michael Dusan
0c8bf405eb
kubkon review changes: 4
- fix `darwin_sdk_layout.?` with null checks
2023-09-26 07:51:32 -04:00
Veikka Tuominen
f4c884617f
Merge pull request #17215 from kcbanner/read_from_memory_union
sema: add support for unions in readFromMemory and writeToMemory
2023-09-26 11:16:03 +03:00
Michael Dusan
ebd0776b28
kubkon review changes: 3
- make vendored settings failure unreachable
- rename field `darwinSdkLayout` → `darwin_sdk_layout`
- make `darwin_sdk_layout` optional
2023-09-25 17:07:41 -04:00
Michael Dusan
f6877fbc49
kubkon review changes: 2
- drop --verbose-link printing until ready to put in driver frontend
2023-09-25 15:53:05 -04:00
Michael Dusan
9357973912
kubkon review changes: 1
general:
- rename `DarwinSdkLayout` → `DarwinSdkLayout`
- drop `DarwinSdkLayout.installation` (not needed for darwin)
- document struct

inferSdkVersion:
- use explicit allocator
- avoid trying to infer SDK ver from vendored path
2023-09-25 15:53:05 -04:00
Michael Dusan
50f2d79582
macos: update libc names for darwin
- dropped incorrect names
- added list of names found in the SDKs
- ios, tvos and watchos filesystems are case-sensitive
2023-09-25 15:53:05 -04:00
Michael Dusan
5d6521d281
macos: better SDK version detection
SDK version detection:
- read SDKSettings.json before inferral from SDK path
- vendored libc: add SDKSettings.json for SDK version info

resolveLibSystem:
- adjust search order to { search_dirs, { sysroot or vendored }}
- previous search order was { sysroot, search_dirs, vendored }
2023-09-25 15:53:05 -04:00
Michael Dusan
15fd7cd154
macos: vendored libc: combine headers: part 2
- update include dirs to use combined dir
- use one libSystem.tbd (drop use of libSystem.VERSION.tbd)
- update canBuildLibC to check for minimum os version only
2023-09-25 15:53:05 -04:00
Michael Dusan
f3ff0b6e6d
macos: discontinue redundant search/link for libc 2023-09-25 15:53:04 -04:00
Michael Dusan
f40c6a5c47
macho: add verbose args for -platform_version 2023-09-25 15:53:04 -04:00
Techatrix
2adb932ad6 translate-c: convert clang errors messages into std.zig.ErrorBundle 2023-09-25 18:10:44 +03:00
kcbanner
e7bf143b36 type: handle the 0-length array case in abiSizeAdvanced
This fixes a panic in `unionAbiSize` when a 0-length array of a union is used as a struct field.

Because `resolveTypeLayout` does not resolve the `elem_ty` if `arrayLenIncludingSentinel` returns
0 for the array, the child union type is not guaranteed to have a resolved layout at this point.

Fixed this case by just returning 0 here.
2023-09-25 05:24:55 -07:00
Garrett Beck
8fab4f98c4 Prevent hitting a clang assert when dealing with FullSourceLoc 2023-09-25 12:49:23 +03:00
Andrew Kelley
28ac9f8b70
Merge pull request #17253 from ziglang/MultiArrayList-0bit-struct
std.MultiArrayList: add test coverage for 0-bit structs
2023-09-25 02:33:32 -07:00
Jay Petacat
731fd217db Add embedded SVG favicon to reference doc templates
The SVG looks way better than the pixelated PNG and will adapt best to
whatever screen it is being displayed on. The PNG continues to be used
because Apple Safari does not support SVG favicons yet. All other major
browsers do. See https://caniuse.com/link-icon-svg.

This is a companion PR to ziglang/www.ziglang.org#310.
2023-09-25 12:24:06 +03:00
Andrew Kelley
eb072fa528
Merge pull request #17256 from ziglang/packed-bit-offsets
compiler: packed structs cache bit offsets
2023-09-24 19:42:06 -07:00
Andrew Kelley
ac6f9eb2ca InternPool: store_hash=false for FieldMap
This is something I wanted to do a long time ago but was blocked
by #10618 which is now solved.
2023-09-24 15:49:56 -07:00
Andrew Kelley
df5f0517b3
Merge pull request #17205 from mlugg/rls-ref
compiler: preserve result type information through address-of operator
2023-09-24 15:19:48 -07:00
Michael Dusan
127198e58c cbe: support more symbol attributes
implement codegen for:

- decl weak linkage
- decl aliases
- fn decl weak linkage

windows msvc:
- `__declspec(selectany)` is not supported for functions
- skip weak linkage for functions

closes #17050
2023-09-24 14:44:15 -07:00
Andrew Kelley
c08c0fc6ed revert "compiler: packed structs cache bit offsets"
This is mostly a revert of a7088fd9a3edb037f0f51bb402a3c557334634f3.
Measurement revealed the commit actually regressed performance.
2023-09-24 14:37:36 -07:00
Andrew Kelley
a7088fd9a3 compiler: packed structs cache bit offsets
Instead of linear search every time a packed struct field's bit or byte
offset is wanted, they are computed once during resolution of the packed
struct's backing int type, and stored in InternPool for O(1) lookup.

Closes #17178
2023-09-23 23:06:08 -07:00
mlugg
fb6fff2561 resinator: do not include in only_core_functionality builds
This prevents resinator from being included in zig1 and zig2.
2023-09-24 06:57:11 +01:00
antlilja
8eff0a0a66 Support non zig dependencies
Dependencies no longer require a build.zig file.

Adds path function to Dependency struct which
returns a LazyPath into a dependency.
2023-09-24 02:47:21 +01:00
Andrew Kelley
c9413a880b
Merge pull request #17244 from ziglang/elf-vm-mgmt
elf: misc improvements, plus let's actually link against a parsed archive!
2023-09-23 18:32:43 -07:00