Commit graph

28475 commits

Author SHA1 Message Date
Jacob Young
1d4a7e123c llvm: revert bad cleanup 2024-02-23 03:23:49 +01:00
Jacob Young
be4ad235a7 Builder: fix inconsequential llvm ir metadata syntax 2024-02-23 03:23:49 +01:00
Jacob Young
8d0f6605fe Builder: sync distinct bits with previous implementation 2024-02-23 03:23:49 +01:00
Igor Anić
30f15e3afe fix crash in tar found by fuzzing
Running fuzzing tar test with [zig std lib
fuzzing](https://github.com/squeek502/zig-std-lib-fuzzing) reached and
assert in tar implementation. Assert (in std lib) should not be
reachable by external input, so I'm fixing this to return error.
2024-02-22 18:20:05 -08:00
antlilja
dfde194287 LLVM Builder: Make some Metadata no longer be distinct 2024-02-23 03:12:54 +01:00
antlilja
0ba2185a42 LLVM Builder: Formatting 2024-02-23 03:12:35 +01:00
Jacob Young
c894df54f7 Builder: fix debug location of the first instruction in a block 2024-02-23 01:45:25 +01:00
Jacob Young
dbfa3238fe Builder: fix float constants in llvm ir 2024-02-22 23:51:53 +01:00
Andrew Kelley
8802ec583b
Merge pull request #19032 from ianic/add_buffered_tee
propose adding BufferedTee to the std.io
2024-02-22 14:02:17 -08:00
Jacob Young
e60d667111 Module: fix @embedFile of files containing zero bytes
If an adapted string key with embedded nulls was put in a hash map with
`std.hash_map.StringIndexAdapter`, then an incorrect hash would be
entered for that entry such that it is possible that when looking for
the exact key that matches the prefix of the original key up to the
first null would sometimes match this entry due to hash collisions and
sometimes not if performed later after a grow + rehash, causing the same
key to exist with two different indices breaking every string equality
comparison ever, for example claiming that a container type doesn't
contain a field because the field name string in the struct and the
string representing the identifier to lookup might be equal strings but
have different string indices.  This could maybe be fixed by changing
`std.hash_map.StringIndexAdapter.hash` to only hash up to the first
null, therefore ensuring that the entry's hash is correct and that all
future lookups will be consistent, but I don't trust anything so instead
I assert that there are no embedded nulls.
2024-02-22 12:33:53 -08:00
Jae B
241e100827 update root.os.system override to require "system" field, this allows easier overriding of os.heap.page_allocator 2024-02-22 21:33:58 +02:00
Jacob Young
83e66d301e Builder: fix bitcode strtab 2024-02-22 19:50:41 +01:00
antlilja
2ab982eb13 Revert build.zig to old 7GB value 2024-02-22 19:41:53 +01:00
Jacob Young
69a6f31596 Builder: fix llvm ir value names
Hello world now verifies when not stripped.
2024-02-22 19:10:52 +01:00
Igor Anić
a5326c5ef8 return few previous fixes
Review: https://github.com/ziglang/zig/pull/19032#pullrequestreview-1896251841
2024-02-22 17:20:41 +01:00
antlilja
6cc51d3c33 LLVM: Set new debug location after inlining 2024-02-22 16:07:25 +01:00
antlilja
de536e8473 LLVM Builder: Emit metadata kinds and function metadata attachments 2024-02-22 15:29:28 +01:00
antlilja
92eec8dfec LLVM Builder: Emit type for debug subprogram 2024-02-22 15:24:22 +01:00
Igor Anić
d00faa2407 use BufferedTee in Fetch/git.zig 2024-02-22 15:18:03 +01:00
Igor Anić
eb67fab2d9 refactor according to Ian's review
https://github.com/ziglang/zig/pull/19032#pullrequestreview-1894702793
2024-02-22 12:29:21 +01:00
Jacob Young
4b215e3a11 Builder: support printing metadata in llvm ir 2024-02-22 08:54:35 +01:00
Andre Weissflog
dd1fc1cb8c std.os.emscripten: fix regression caused by code cleanup in std.os.wasi (Closes #19019) 2024-02-21 17:09:29 -08:00
antlilja
a907353ca4 LLVM Builder: Fix on 32-bit systems 2024-02-22 00:39:56 +01:00
Jakub Konka
a92e6146da elf+riscv: return an error for unimplemented HI20 forward lookup 2024-02-21 23:49:22 +01:00
Jakub Konka
6236f5b810 link+riscv: simplify bitSlice helper 2024-02-21 23:40:44 +01:00
Jakub Konka
2ad2e2f6f5 link+riscv: use riscv64/bits.zig to implement write helpers 2024-02-21 23:34:05 +01:00
antlilja
53f6071486 LLVM Builder: Emit debug vector types with DIVector flag 2024-02-21 23:33:25 +01:00
antlilja
5e9d0da43b LLVM Builder: Correctly emit debug subranges
The bitcode abbrev was missing the subrange code
2024-02-21 23:32:21 +01:00
Jakub Konka
ddb33baa11 test/link/elf: test static linking C riscv64-musl 2024-02-21 23:08:29 +01:00
Jakub Konka
720dd80007 elf+riscv: implement enough to get basic hello world in C working 2024-02-21 23:04:43 +01:00
Jakub Konka
ca6f41ee30 elf+riscv: skip parsing .riscv.attributes section for now 2024-02-21 22:50:55 +01:00
Jakub Konka
d19001abac elf: skip STT_NOTYPE only if SHN_UNDEF from symtab inclusion 2024-02-21 22:49:58 +01:00
Jakub Konka
9fd112804f link: commit missing files 2024-02-21 22:48:19 +01:00
Jakub Konka
8ba31ed39a elf: sort input relocs if targeting riscv64 2024-02-21 22:47:52 +01:00
Jakub Konka
55dadc3d85 test/link/elf: test static linking C aarch64-musl 2024-02-21 22:40:03 +01:00
Jakub Konka
7fd4576596 elf+aarch64: resolve .eh_frame relocs 2024-02-21 22:28:02 +01:00
Jakub Konka
7aeba3a3d1 elf+aarch64: implement some resolveRelocNonAlloc logic 2024-02-21 22:25:25 +01:00
Jakub Konka
887709ed5c elf+aarch64: implement some resolveRelocAlloc logic 2024-02-21 22:22:40 +01:00
Jakub Konka
d7d47a2c0c elf+aarch64: implement some scanReloc logic 2024-02-21 22:07:51 +01:00
Jakub Konka
ee364d542a link: introduce common set of aarch64 abstractions 2024-02-21 22:00:28 +01:00
antlilja
e57f553c07 LLVM Builder: Rework MetadataString to not rely on String
This fixes a problem where empty strings where not emitted as null.
This should also emit a smaller stringtab as all metadata strings were
emitted in both the strtab and in the strings block inside the metadata
block.
2024-02-21 21:46:04 +01:00
Jakub Konka
60a8f9b989 elf: make GOT arch aware when resolving relocs 2024-02-21 20:58:43 +01:00
Jakub Konka
775a161794 elf: simplify logic for resolving .eh_frame relocs on different arches 2024-02-21 20:50:29 +01:00
Jakub Konka
06c191a4ff elf: simplify logic for resolving nonalloc relocs on different arches 2024-02-21 20:29:56 +01:00
Igor Anić
ce1a590fc9 cleanup tests 2024-02-21 20:26:29 +01:00
Jakub Konka
4cde47a169 elf: simplify logic for resolving alloc relocs on different arches 2024-02-21 20:11:32 +01:00
Igor Anić
d995029844 add BufferedTee
BufferedTee provides reader interface to the consumer. Data read by consumer
is also written to the output. Output is hold lookahead_size bytes behind
consumer. Allowing consumer to put back some bytes to be read again. On flush
all consumed bytes are flushed to the output.

      input   ->   tee   ->   consumer
                    |
                 output

input - underlying unbuffered reader
output - writer, receives data read by consumer
consumer - uses provided reader interface

If lookahead_size is zero output always has same bytes as consumer.
2024-02-21 20:01:45 +01:00
Jacob Young
0b7af25637 MachO: fix calcLoadCommandsSize computation
Closes #19026
2024-02-21 19:56:55 +01:00
Jacob Young
48bd0ed7f3 llvm: fix builds that don't link with libllvm 2024-02-21 19:18:34 +01:00
Jakub Konka
60bc2e7616 elf: simplify logic for handling scanning relocs on different arches 2024-02-21 19:06:10 +01:00