Jakub Konka
ecf6ed7d9b
elf: allocate alloc sections when emitting relocatable
2023-11-07 15:04:57 +01:00
Jakub Konka
31b280c78f
elf: emit .rela.eh_frame section header if required
2023-11-07 14:47:11 +01:00
Jakub Konka
0211d6bf4f
elf: create link between .rela and output section
2023-11-07 14:42:27 +01:00
Jakub Konka
e22b3595c1
elf: update .rela section sizes
2023-11-07 14:29:44 +01:00
Jakub Konka
c7ed7c4690
elf: generate section symbols when writing symtab
2023-11-07 13:31:31 +01:00
Jakub Konka
3df53d1722
elf: create skeleton of required changes for supporting -r mode
2023-11-07 11:19:55 +01:00
Matthew Lugg
b3462b7cec
Merge pull request #17692 from kcbanner/struct_field_init_pass
...
sema: analyze struct field bodies in a second pass, to allow them to use the layout of the struct itself
2023-11-07 07:44:32 +00:00
mlugg
d78eda34c5
Sema: emit @intCast safety check correctly for vectors
...
This code was previously tripping an assertion by not making this value
used in the safety check a vector.
2023-11-07 06:42:15 +00:00
mlugg
9b394a200a
Sema: allow destructuring vectors
...
This was intended to work when destructuring was first implemented, and
was just unintentionally missed out.
2023-11-07 06:11:01 +00:00
Jakub Konka
bf0387b6bb
Merge pull request #17873 from ziglang/elf-archive
...
elf: implement archiving input object files
2023-11-07 03:22:14 +01:00
kcbanner
1acb6a53d0
wasm: support rendering unions using their backing type if they have no defined tag type
2023-11-07 00:49:39 +00:00
kcbanner
35c86984a6
cbe: support rendering union values that have no defined tag type
...
This was regressed in d657b6c0e2ab7c47f5416dc4df1abb2bfbecd4b6, when
the comptime memory model for unions was changed to allow them to have
no defined tag type.
2023-11-07 00:49:39 +00:00
kcbanner
f10499be0a
sema: analyze field init bodies in a second pass
...
This change allows struct field inits to use layout information
of their own struct without causing a circular dependency.
`semaStructFields` caches the ranges of the init bodies in the `StructType`
trailing data. The init bodies are then resolved by `resolveStructFieldInits`,
which is called before the inits are actually required.
Within the init bodies, the struct decl's instruction is repurposed to refer
to the field type itself. This is to allow us to easily rebuild the inst_map
mapping required for the init body instructions to refer to the field type.
Thanks to @mlugg for the guidance on this one!
2023-11-07 00:49:35 +00:00
Jakub Konka
261db02018
CheckObject: support parsing and dumping archive symtab for ELF
2023-11-06 21:18:26 +01:00
Jacob Young
9ced27dace
x86_64: fix passing register-sized payload as non-reigster-sized union
...
Closes #17885
2023-11-06 14:11:31 -05:00
Bogdan Romanyuk
62e67a2b56
Sema: emit error when pointer to extern function is called
2023-11-06 15:26:28 +00:00
Jakub Konka
1b69b0c621
elf: clearly separate updating and writing symtab from only ZigObject
2023-11-06 14:26:35 +01:00
Jakub Konka
281dabaa88
Compilation: unconditionally close open file handles for writable dance
2023-11-06 13:47:39 +01:00
Andrew Kelley
e74ced21b7
frontend: fix -fsingle-threaded default detection logic
...
The logic in 509be7cf1f10c5d329d2b0524f2af6bfcabd52de assumed that
`use_llvm` meant that the LLVM backend would be used, however, use_llvm
is false when there are no zig files to compile, which is the case for
zig cc. This logic resulted in `-fsingle-threaded` which made libc++
fail to compile for C++ code that includes the threading abstractions
(such as LLVM).
2023-11-06 01:16:09 -05:00
Andrew Kelley
1b0b46a8a9
Merge pull request #17871 from jacobly0/x86_64
...
x86_64: get a compiler compiled with the x86_64 backend passing x86_64 backend tests
2023-11-05 18:45:21 -05:00
Andrew Kelley
702b809ea3
Merge pull request #17815 from Luukdegram/wasm-no-entry
...
wasm-linker: implement `-fno-entry` and correctly pass `--shared` and `--pie` when given
2023-11-05 18:44:12 -05:00
Jacob Young
c2cda947c9
src: fix memory leaks
2023-11-05 11:54:29 -05:00
Jakub Konka
8142925c7e
elf: hook up saving object files in an archive
2023-11-05 13:37:13 +01:00
Jakub Konka
55fa8a04f1
elf: add hooks for archiving Objects
2023-11-05 12:56:17 +01:00
Jakub Konka
5c48236103
elf: init objects after parsing them
2023-11-05 12:37:15 +01:00
Jacob Young
8311fac7e8
x86_64: fix indirect return of f80
2023-11-05 06:09:06 -05:00
Jakub Konka
8d7ec05070
elf: actually save correct object names in the archive
2023-11-05 12:08:15 +01:00
Jacob Young
803ea10107
x86_64: fix tracking during br
2023-11-05 06:08:06 -05:00
Bogdan Romanyuk
e9a6197a8e
Sema: fix error notes with wrong extern type
2023-11-05 12:36:06 +02:00
Andrew Kelley
33644546a0
Sema: fix memory leak in zirTypeInfo
2023-11-05 04:48:34 -05:00
Andrew Kelley
dc63426b1e
Merge pull request #17866 from ziglang/reduce-inline-import
...
zig reduce: support inlining `@import` and more
2023-11-05 03:39:01 -05:00
Andrew Kelley
a9002156a0
zig reduce: add reduction for removing var decls
2023-11-04 20:27:15 -07:00
Andrew Kelley
e93d3a3cdb
zig reduce: don't try to remove discard statements
...
those are handled separately
2023-11-04 19:27:46 -07:00
Andrew Kelley
9e81222d92
zig reduce: some adjustments to make it go faster
...
* don't reset the rng. it seems like it was getting stuck trying the
same transforms over and over again.
* slide the window over after failing a large transform set, idea being
that transformations in the failed set are more likely to be
problematic.
2023-11-04 18:48:08 -07:00
Andrew Kelley
88acdb9aa6
zig reduce: delete statements from blocks
2023-11-04 18:06:11 -07:00
Andrew Kelley
212aa717d7
zig reduce: add transformation for removing container fields
2023-11-04 17:57:43 -07:00
Andrew Kelley
75efb736ce
zig reduce: run results through astgen
...
and use that to fix up usused variable declarations and parameters that
are caused by transformations.
also add a transformation to replace global variable init with
`undefined`.
2023-11-04 17:38:10 -07:00
Andrew Kelley
fc1e7a5644
zig reduce: rename identifiers when inlining an @import
2023-11-04 15:48:28 -07:00
Andrew Kelley
8bd01d2d9b
zig reduce: add transformation for inlining file-based @import
...
One thing is missing for it to be useful, however, which is dealing with
ambiguous reference errors introduced by the inlining process.
2023-11-04 13:57:29 -07:00
Jakub Konka
f24ceec35a
Merge pull request #17844 from ziglang/elf-object
...
elf: handle emitting relocatables and static libraries - humble beginnings
2023-11-04 20:58:15 +01:00
Andrew Kelley
98dc28bbe2
Merge pull request #17852 from ziglang/zig-reduce
...
introduce `zig reduce` subcommand
2023-11-04 14:25:50 -04:00
Jakub Konka
7a186d9eb6
Compilation: take into account if LLVM is available in lib-building logic
2023-11-04 16:09:52 +01:00
Jacob Young
095c4294aa
x86_64: fix miscompilations
...
Closes #17618
2023-11-04 09:15:05 -04:00
Jacob Young
6553359f39
x86_64: fix ub that the llvm backend was hiding
2023-11-04 08:13:13 -04:00
Jakub Konka
533c88158e
elf: actually capture positionals when linking static library
2023-11-04 09:14:15 +01:00
Jakub Konka
bd0416aeb6
elf: flag errors on hitting unimplemented codepaths
2023-11-04 09:14:05 +01:00
Jakub Konka
9cf3ebe524
elf: fix more int resolution issues
2023-11-04 09:13:50 +01:00
Jakub Konka
56296694d9
elf: fix 32bit build
2023-11-04 09:13:43 +01:00
Jakub Konka
e3b82eaa66
elf: do not store filename in strtab unless longer than 15 chars
2023-11-04 09:13:26 +01:00
Jakub Konka
acd700ac6b
elf: store ar state per input object file
2023-11-04 09:13:18 +01:00