Commit Graph

8117 Commits

Author SHA1 Message Date
kcbanner
a9b6f2d929 dwarf: add support for .debug_frame and CIE version 4 2023-07-20 22:58:14 -04:00
kcbanner
41832aa1e6 linux: add getcontext for x86_64 2023-07-20 22:58:14 -04:00
kcbanner
6abf1fbfe6 update to new builtin syntax 2023-07-20 22:58:14 -04:00
kcbanner
84a1244b6c dwarf: use eh_frame length if it's available 2023-07-20 22:58:14 -04:00
kcbanner
521988299d add more safety checks when searching for eh_frame entries using findEntry 2023-07-20 22:58:13 -04:00
kcbanner
a47212c72e - rebase and update to lastest master 2023-07-20 22:58:13 -04:00
kcbanner
adbc5bbdb3 dwarf: fixup pointer cast 2023-07-20 22:58:13 -04:00
kcbanner
5781016c35 dwarf: add support for .eh_frame_hdr when unwinding
- .eh_frame_hdr contains a binary-searchable data structure for finding an FDE. If present, we can use this
section to avoid having to parse the entire FDE/CIE list in the binary, instead only entries that are actually
required for unwinding are read.
- rework the inputs pc-relative pointer decoding to support both already-mapped sections as well as sections
mapped from a file
- store the VirtualMachine on UnwindContext so the allocations can be reused
2023-07-20 22:58:13 -04:00
kcbanner
dd2035735f debug: fix memory leak when an error occurs opening a pdb file 2023-07-20 22:58:13 -04:00
kcbanner
865d4d2d8c debug: more fixups for mips linux not having ucontext_t
- increase test-std max_rss to 1.1 above the CI observed amount
2023-07-20 22:58:13 -04:00
kcbanner
5ebca4392e debug: fixing more compile errors on arches that I hadn't tested on yet 2023-07-20 22:58:13 -04:00
kcbanner
551f153718 dwarf: fixes for non-64 bit systems 2023-07-20 22:58:13 -04:00
kcbanner
2f75d20d87 debug: use an explicit context type instead of anytype for dumpStackTraceFromBase, update crash_report to use this for exceptions 2023-07-20 22:58:13 -04:00
kcbanner
d74c8acdfb dwarf: fixup for sort changes 2023-07-20 22:58:13 -04:00
kcbanner
d1a9bb1fea debug: fixup context detection for wasi 2023-07-20 22:58:13 -04:00
kcbanner
a325d7f6d1 fmt and cleanup 2023-07-20 22:58:13 -04:00
kcbanner
c98e03fc7e - rework CFI instruction parsing to not use std.meta
- move register formatting code to zig-dwardump
2023-07-20 22:58:13 -04:00
kcbanner
e72e762d1e dwarf: implement more register mappings, fix up macos compile 2023-07-20 22:58:13 -04:00
kcbanner
9145ff7da0 dwarf: implement more register number mappings
- add dwarf.abi.RegisterContext to handle register numbers changing based on DWARF format
2023-07-20 22:58:13 -04:00
kcbanner
b449d98a93 - rework StackIterator to optionally use debug_info to unwind the stack
- add abi routines for getting register values
- unwding is working!
2023-07-20 22:58:13 -04:00
kcbanner
69399fbb82 - add default register rule
- fixup eh pointer decoding
2023-07-20 22:58:13 -04:00
kcbanner
a0a40c2e7e - implement more opcodes 2023-07-20 22:58:13 -04:00
kcbanner
7b4611cfb3 - move writing code to zig-dwarfdump
- implement restore_state, restore_extended, offset_extended
2023-07-20 22:58:13 -04:00
kcbanner
338df862d1 - fix remember_state
- implement def_cfa_register
2023-07-20 22:58:13 -04:00
kcbanner
f3f3c877e0 - add DWARF expression parser
- change read apis to use a stream
- add register formatters
2023-07-20 22:58:13 -04:00
kcbanner
38303d7b9c add VirtualMachine to run CFA instructions 2023-07-20 22:58:13 -04:00
kcbanner
8b8d627137 - add call frame instruction parser
- add register printing
2023-07-20 22:58:13 -04:00
kcbanner
6c1d1aa45c begin working on parsing unwind info 2023-07-20 22:58:13 -04:00
kcbanner
f6148f123e add CommonInformationEntry parser 2023-07-20 22:58:12 -04:00
kcbanner
ea9917d9bd debug: support loading elf debug info from external files
Some distributions (ie. Ubuntu) have their libc debug
info in separate files. This change allows the stack walking
code to read that debug info.

- add support for reading compressed ELF sections
- support reading the build-id from the elf headers in order to lookup external debug info
- support reading the .gnu_debuglink section to look up external debug info
2023-07-20 22:58:12 -04:00
Andrew Kelley
3f15010abe
Merge pull request #16430 from jacobly0/llvm-builder
llvm: begin the journey of independence from llvm
2023-07-20 12:55:03 -07:00
Linus Groh
3bada8e3ce std.hash_map: Fix casing of keyPtr variables
The only case where those should be written in camelCase is if they were
function pointers, which they aren't.
2023-07-20 12:52:05 -07:00
Alex Kladov
772debb03a reduce AstGen.numberLiteral stack usage
At the moment, the LLVM IR we generate for this fn is

define internal fastcc void @AstGen.numberLiteral ...  {
Entry:
  ...
  %16 = alloca %"fmt.parse_float.decimal.Decimal(f128)", align 8
  ...

That `Decimal` is huuuge! It stores

    pub const max_digits =  11564;
    digits: [max_digits]u8,

on the stack.

It comes from `convertSlow` function, which LLVM happily inlined,
despite it being the cold path. Forbid inlining that to not penalize
callers with excessive stack usage.

Backstory: I was looking for needles memcpys in TigerBeetle, and came up
with this copyhound.zig tool for doing just that:

   ee67e2ab95/src/copyhound.zig

Got curious, run it on the Zig's own code base, and looked at some of
the worst offenders.

List of worst offenders:

warning: crypto.kyber_d00.Kyber.SecretKey.decaps: 7776 bytes memcpy
warning: crypto.ff.Modulus.powPublic: 8160 bytes memcpy
warning: AstGen.numberLiteral: 11584 bytes memcpy
warning: crypto.tls.Client.init__anon_133566: 13984 bytes memcpy
warning: http.Client.connectUnproxied: 16896 bytes memcpy
warning: crypto.tls.Client.init__anon_133566: 16904 bytes memcpy
warning: objcopy.ElfFileHelper.tryCompressSection: 32768 bytes memcpy

Note from Andrew: I removed `noinline` from this commit since it should
be enough to set it to be cold.
2023-07-20 12:51:18 -07:00
xdBronch
e313584a48 more UEFI alignment fixes 2023-07-20 12:46:33 -07:00
Jacob Young
9dd7a9eb02 llvm: fix various crashes 2023-07-19 23:38:40 -04:00
Jacob Young
3314fd83af llvm: compute data layout without help like a grownup compiler 2023-07-19 23:38:40 -04:00
zooster
996eb01746
collconv -> callconv (#16453) 2023-07-20 00:40:47 +00:00
Frank Denis
32aeb2c2ec
Be more conservative in the description of Aegis256Mac (#16452)
It is assumed that generating a collision requires more than 2^156
ciphertext modifications. This is plenty enough for any practical
purposes, but it hasn't been proven to be >= 2^256.

Be consistent and conservative here; just claim the same security
as the other variants.
2023-07-19 23:59:24 +00:00
Luuk de Gram
cec1e973b6
Merge pull request #16439 from Luukdegram/wasm-linker
wasm-linker: finish shared-memory & TLS implementation
2023-07-19 21:55:30 +02:00
Luuk de Gram
1a3304ed23
test/link: add shared-memory test for WebAssembly 2023-07-19 17:22:46 +02:00
Andrew Kelley
f3dc53f6b5 compiler: rework inferred error sets
* move inferred error sets into InternPool.
   - they are now represented by pointing directly at the corresponding
     function body value.
 * inferred error set working memory is now in Sema and expires after
   the Sema for the function corresponding to the inferred error set is
   finished having its body analyzed.
 * error sets use a InternPool.Index.Slice rather than an actual slice
   to avoid lifetime issues.
2023-07-18 19:02:05 -07:00
Mathew R Gordon
11695745e5 getenv: remove unnessary small key block
The code removed does unnecessary copying in order to create a null-terminated pointer, just to pass it to libc getenv. It only does this for `small keys`, which are under 64 bytes in size.

Instead of going out of the way to add a null byte to a function that takes normal slices, this should just be handled by the loop below, which scans c.environ to find the value
2023-07-18 11:44:23 +02:00
Frank Denis
a0b35249a2
Replace hand-written endian-specific loads with std.mem.readInt*() (#16431)
And when we have the choice, favor little-endian because it's 2023.

Gives a slight performance improvement:

   md5: 552 -> 555 MiB/s
  sha1: 768 -> 786 MiB/s
sha512: 211 -> 217 MiB/s
2023-07-18 00:40:31 +02:00
Luiz Berti
a86f589a9f
Small documentation fixes on std.crypto (#16427)
* Small documentation fix of ChaCha variants

Previous documentation was seemingly copy-pasted and left
behind some errors where the number of rounds was not
properly updated.

* Suggest `std.crypto.utils.secureZero` on `@memset` docs

* Revert previous change
2023-07-17 21:16:41 +00:00
Mathew R Gordon
bf827d0b55
std: Make getenv return 0-terminated slice 2023-07-17 10:57:41 +00:00
George Zhao
9abe392647
std.crypto: add finalResult and peek api for Sha1 (#16426)
close #16250
2023-07-17 10:02:57 +00:00
Andrew Kelley
a576082170 std: reword some comments 2023-07-16 18:32:52 -07:00
Erik Arvstedt
c6aa29b6fd SinglyLinkedList: rename invert -> reverse 2023-07-15 21:37:54 -07:00
Loris Cro
7dd1cf26f9 autodoc: improved linking for declrefs 2023-07-14 19:11:55 +02:00
Loris Cro
a187141056
Autodoc tokenizer (#16409)
* autodoc: init work to refactor exprName

* autodoc: Implement more expressions in exprName refactor

* autodoc: more work

* autodoc: More exprName to ex refactoring

* autodoc: Remove whitespace flag from renderer; Add pre tags in
value and variable drawing in renderContainer

* autodoc: add inline styling to pre blocks

* autodoc: move renderer code to main.js

* autodoc: More exprName to ex refactoring; Fn signatures rendered with new code

* autodoc: Fix function rendering. Add more things to ex

* autodoc: nuke exprName

---------

Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>
2023-07-14 16:27:09 +02:00