25109 Commits

Author SHA1 Message Date
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
Hao Li
8a18abfd60
Remove the SingleThread limitation for ARM (#16442)
The libc++ issue has been fixed in https://reviews.llvm.org/D118391, so
we don't have this issue in llvm 16+

closes #6573
2023-07-20 19:17:28 -04:00
Frank Denis
124448c1b6 Include system headers path when targeting assembly_with_cpp
This is consistent with what clang and gcc are doing, because
headers such as <cet.h> are specifically designed to be used
in the context of assembly code.

Fixes #16449
2023-07-20 16:14:12 -07:00
Jakub Konka
c0260d39d5 check-object: allow for multiple extractions within one check 2023-07-20 22:12:06 +02: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
Jakub Konka
245f6553e6 check-object: format known OS-specific types before doing generic format 2023-07-20 20:01:06 +02:00
Jakub Konka
3b6200db41 check-object: dump PT flags when dumping program headers 2023-07-20 20:01:06 +02:00
Jakub Konka
e8b613783f check-object: remove wildcard matchers as they are too clunky
Instead, we now have a looser helper called `checkContains(...)`
that will match on any occurrence similarly to `std.mem.indexOf()`.

While at it, I have cleaned up other combinators to make the entire
API more consistent, and so:
* `checkStart(phrase)` is now `checkStart()` followed by
`checkExact(phrase)`
* `checkNext(phrase)` if matching exactly is now `checkExact(phrase)`
* `checkNext(phrase)` if matching loosely is now `checkContains(phrase)`
* `checkNext(phrase)` if matching exactly with var extractors is now
`checkExtract(phrase)`

Finally, `ElfDumper` is now dumping contents of `.symtab` and `.dynsym`
symbol tables. I have also removed dumping of symtabs as optional - they
are now always dumped which cleaned up the implementation even more.
2023-07-20 20:01:06 +02:00
Jakub Konka
5839054e85 check-object: dump contents of .dynamic section 2023-07-20 20:01:06 +02:00
Jacob Young
17255bed41
Merge pull request #16443 from notcancername/cbe-empty-enum
cbe: fix bug where empty enum would be generated
2023-07-20 02:47:26 -04:00
Jacob Young
4d31d4d875 llvm: cleanup LLVM IR dumping 2023-07-20 02:44:40 -04:00
Jacob Young
a1062c63ca llvm: add Builder trailing extra interface 2023-07-20 01:48:50 -04:00
Jacob Young
ea72fea1a4 llvm: fix bootstrap 2023-07-19 23:39:42 -04:00
Jacob Young
9dd7a9eb02 llvm: fix various crashes 2023-07-19 23:38:40 -04:00
Jacob Young
9c4d5e64b4 llvm: minor fixes 2023-07-19 23:38:40 -04:00
Jacob Young
9afb349aba llvm: convert most instructions 2023-07-19 23:38:40 -04:00
Jacob Young
ef84e86992 llvm: convert cursor positioning 2023-07-19 23:38:40 -04:00
Jacob Young
3f46e747a8 llvm: convert basic block creation 2023-07-19 23:38:40 -04:00
Jacob Young
8fde3a8f04 llvm: finish converting constants 2023-07-19 23:38:40 -04:00
Jacob Young
1f8407c356 llvm: cleanup management and implement more const functions 2023-07-19 23:38:40 -04:00
Jacob Young
7ec7fe5359 llvm: cleanup init 2023-07-19 23:38:40 -04:00
Jacob Young
ff8a49448c llvm: finish converting lowerValue 2023-07-19 23:38:40 -04:00
Jacob Young
2cb52235b9 llvm: convert all calls to constInt 2023-07-19 23:38:40 -04:00
Jacob Young
65fd401c06 llvm: remove more usages of llvm.Type 2023-07-19 23:38:40 -04:00
Jacob Young
d167bd4b56 llvm: finish converting lowerType 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
Jacob Young
d195173ba2 llvm: start tracking more things without relying on the llvm api 2023-07-19 23:38:40 -04:00
Jacob Young
e7ea7d3480 test: fix cbe execution tests 2023-07-19 23:20:25 -04:00
notcancername
ce859cfcb8 cbe: fix bug where empty enum would be generated
fix a bug where an invalid empty enum would be emitted into the C
source file if the global error set was empty.
2023-07-19 23:20:25 -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
Andrew Kelley
0aacb6369f
Merge pull request #16318 from ziglang/rework-generics
rework generic function calls
2023-07-19 09:36:57 -07:00
Luuk de Gram
142dbc7b82
wasm-linker: create TLS Wasm globals correctly
Previously, they were only created when we had any TLS segment.
This meant that while the symbol existed, the global itself wouldn't.
The result of this was a crash during symbol names writing as it
would attempt to write the symbol name of a global that didn't exist.
Now we always create them, and instead update its `init` value during
`setupMemory`.

In the future, the entire symbol (and global) will be removed by
the garbage collector.
2023-07-19 17:22:46 +02:00
Luuk de Gram
1a3304ed23
test/link: add shared-memory test for WebAssembly 2023-07-19 17:22:46 +02:00
Luuk de Gram
3fd6e93f4f
wasm-linker: prevent double-free on parse failure 2023-07-19 17:22:46 +02:00
Luuk de Gram
2672f7d9e8
wasm-linker: shared-memory fixes
Implements the `start` section which will execute a given function
at startup of the program. After function execution, the _start
function will be called by the runtime. In the case of shared-memory
we set this section to the function `__wasm_init_memory` which will
initialize all memory on startup.

This also fixes the above mentioned function to ensure we correctly
lower the i32 values.

Lastly, this fixes a typo where we would retrieve a global, instead
of setting its value.
2023-07-19 17:22:46 +02:00
Luuk de Gram
376e1b4603
wasm-linker: implement TLS relocations 2023-07-19 17:22:46 +02:00