27020 Commits

Author SHA1 Message Date
Jakub Konka
912a774a15 x86_64: rewrite call r/m64 to call rel32 for .got.zig refs when object 2023-11-04 09:12:35 +01:00
Jakub Konka
33a0a72e87 elf: align ar_hdr to at least 2 bytes 2023-11-04 09:12:26 +01:00
Jakub Konka
875beb25b5 elf: fix writing symtab to an archive 2023-11-04 09:12:18 +01:00
Jakub Konka
3b9455f005 elf: generate pretty rudimentary archive 2023-11-04 09:12:07 +01:00
Jakub Konka
eddf9cc65b elf: collect exports from ZigObject into AR symtab 2023-11-04 09:11:58 +01:00
Jakub Konka
481ee1b598 elf: enable static-lib flush path 2023-11-04 09:11:47 +01:00
Jakub Konka
d2c4597eb5 x86_64: rewrite .got.zig movs to standard loads when emitting objects 2023-11-04 09:11:37 +01:00
Jakub Konka
ccb2afacc0 elf: postpone creation of .got.zig entry until code emit 2023-11-04 09:11:29 +01:00
Jakub Konka
5affd29b47 elf: use StringTable for strtab management in ZigObject 2023-11-04 09:11:22 +01:00
Jakub Konka
96f221236d elf: fix r_offset when emitting relocs for the linker 2023-11-04 09:11:14 +01:00
Jakub Konka
7c5c59191e elf: claim unresolved dangling symbols as undef externs when emitting object 2023-11-04 09:10:43 +01:00
Jakub Konka
dbe13200f1 elf: emit STT_SECTION symbols 2023-11-04 09:10:30 +01:00
Jakub Konka
8055f68765 elf: make sure we never emit .got.zig relocs when linking object files 2023-11-04 09:10:23 +01:00
Jakub Konka
e8f522122a elf: fix properly updating .got.zig section 2023-11-04 09:10:14 +01:00
Jakub Konka
5698be3ef0 elf: write out contents of .rela sections 2023-11-04 09:10:06 +01:00
Jakub Konka
3606b5df3f elf: improve Symbol to handle emitting relocatable object files 2023-11-04 09:09:57 +01:00
Jakub Konka
ec2671d16b elf: update .rela section sizes; skip .got.zig when emitting object 2023-11-04 09:09:46 +01:00
Jakub Konka
21853bc310 elf: emit .rela shdrs for output sections 2023-11-04 09:09:35 +01:00
Jakub Konka
0ee2ab413f elf: emit valid section headers table when building an object file 2023-11-04 09:09:26 +01:00
Jakub Konka
74f12d0691 elf: remove now obsolete allocateNonAllocSection helper 2023-11-04 09:09:14 +01:00
Jakub Konka
abf6c20cb9 elf: rename .rodata to .data.rel.ro and remove allocateAllocSection helper 2023-11-04 09:09:01 +01:00
Jakub Konka
b1136a695f elf: remove now obsolete allocateSegment helper 2023-11-04 09:08:50 +01:00
Jakub Konka
1be94878e3 elf: generate invalid object file but with almost correct header 2023-11-04 09:08:38 +01:00
Jakub Konka
b8c8565e93 elf: implement --gc-sections for non-LLVM Zig source 2023-11-04 09:08:27 +01:00
Jakub Konka
25c53f08a6 elf: redo strings management in the linker
* atom names - are stored locally and pulled from defining object's
  strtab
* local symbols - same
* global symbols - in principle, we could store them locally, but
  for better debugging experience - when things go wrong - we
  store the offsets in a global strtab used by the symbol resolver
2023-11-04 09:08:16 +01:00
Jacob Young
7b1a644d6e print_zir: fix more crashes during printing 2023-11-04 01:54:12 -04:00
Andrew Kelley
31529f912b zig reduce: add transformation of replacing var init with undefined 2023-11-03 22:08:01 -07:00
Andrew Kelley
a2f4adbd19 zig reduce: add "delete unused globals" transform
While walking the AST looking for reductions, notice if any globals are
unreferenced, and if they are, add a transformation for removing the
global.
2023-11-03 21:31:32 -07:00
Andrew Kelley
6aedddf900 fix bootstrap 2023-11-03 20:53:38 -07:00
Jacob Young
46d3e5bb04 x86_64: reduce RegisterManager performance regression
This reduces the regression from 0.11.0 by 95%.

Closes #17678
2023-11-03 23:18:23 -04:00
Jacob Young
509be7cf1f x86_64: fix std test failures 2023-11-03 23:18:21 -04:00
Andrew Kelley
9a1094c00f fix compilation regression 2023-11-03 20:05:32 -07:00
Andrew Kelley
1396479656 zig reduce: redesign
Now it works like this:
1. Walk the AST of the source file looking for independent
   reductions and collecting them all into an array list.
2. Randomize the list of transformations. A future enhancement will add
   priority weights to the sorting but for now they are completely
   shuffled.
3. Apply a subset consisting of 1/2 of the transformations and check for
   interestingness.
4. If not interesting, half the subset size again and check again.
5. Repeat until the subset size is 1, then march the transformation
   index forward by 1 with each non-interesting attempt.

At any point if a subset of transformations succeeds in producing an interesting
result, restart the whole process, reparsing the AST and re-generating the list
of all possible transformations and shuffling it again.

As for std.zig.render, the fixups operate based on AST Node Index rather
than Nth index of the function occurence. This allows precise control
over how to mutate the input.
2023-11-03 20:05:32 -07:00
Andrew Kelley
dff13e088b build runner: fix missing newline in error message 2023-11-03 20:05:32 -07:00
Andrew Kelley
09d13104be std.BitSet: add setAll and unsetAll methods 2023-11-03 20:05:32 -07:00
Andrew Kelley
815b85d8a2 zig reduce: check once upfront to verify interestingness 2023-11-03 20:05:32 -07:00
Andrew Kelley
b1aaf42134 std.zig.render: fix iteration over parameters
use the handy iteration API to be correct
2023-11-03 20:05:32 -07:00
Andrew Kelley
f90ba235d0 zig reduce proof of concept 2023-11-03 20:05:32 -07:00
Andrew Kelley
73b96ac114 accept a transformation index 2023-11-03 20:05:32 -07:00
Andrew Kelley
5f1f145199 add a transformation for gutting the body of a function 2023-11-03 20:05:32 -07:00
Andrew Kelley
3263d6e6ab std.zig: move render state to struct; add fixups 2023-11-03 20:05:32 -07:00
Andrew Kelley
f8c24c2cd0 add zig reduce subcommand
Also adds `-Donly-reduce` flag in build.zig which disables LLVM and
irrelevant code for faster iteration cycles.
2023-11-03 20:05:32 -07:00
dweiller
f6de3ec963 zstandard: fix incorrect RLE decompression into ring buffer
This reverts a change introduced in #17400 causing a bug when
decompressing an RLE block into a ring buffer.

RLE blocks contain only a single byte of data to copy into the output,
so attempting to copy a slice causes buffer overruns and incorrect
decompression.
2023-11-03 23:03:43 -04:00
Andrew Kelley
1ccc68f307 frontend: rip out Decl dependencies
This incremental compilation logic will need to be reworked so that it
does not depend on buried pointers - that is, long-lived pointers that
are owned by non-top-level objects such as Decl.

In the meantime, this fixes memory leaks since the memory management of
these dependencies has bitrotted.
2023-11-03 21:24:13 -04:00
mlugg
a95be8f0e0 Sema: use correct error bit length when emitting error_set_has_value safety checks
Resolves: #17843
2023-11-03 22:39:13 +00:00
Evan Haas
3eb8a094c0 comp: remove CBE guards for aro 2023-11-03 22:18:40 +02:00
Evan Haas
e6b9312bd0 aro: Add stub definitions to enable bootstrapping
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2023-11-03 22:18:40 +02:00
XXIV
b197c4d79b
std.Atomic: remove unnecessary @ptrCast (#17825) 2023-11-03 14:55:02 -04:00
xdBronch
5bd27a2cb6 dont assume apple chips are macos exclusive 2023-11-03 14:46:53 -04:00
Ryan Liptak
ae6df9e967 start.zig: Replace kernel32 usage with ntdll
Co-authored-by: e4m2 <git@e4m2.com>
2023-11-03 19:25:46 +02:00