Commit Graph

375 Commits

Author SHA1 Message Date
Alex Rønne Petersen
c0561da179
update_cpu_features: Don't set trustzone on cortex-m85.
cortex-m85 already has 8msecext, which is not the same as trustzone. The former
is for the M profile, while the latter is for the A profile.

Revert of a small part of #18498.
2024-09-24 11:45:01 +02:00
Alex Rønne Petersen
dcbd3cbce9
update_cpu_features: Add support for parsing DefaultExts as used for aarch64. 2024-09-24 11:08:29 +02:00
Alex Rønne Petersen
662683cafd update_cpu_features: Fix feature_overrides logic and replace an omit_cpus misuse. 2024-09-19 18:20:21 -07:00
Alex Rønne Petersen
a4af54b4e5 update_cpu_features: Update for LLVM 19.
* Add `ProcessorAlias` support.
* Bump output buffer size.
* Include `i` extension in RISC-V baselines.
* Update evaluation branch quota for RISC-V.
* Retain some CPU features that LLVM removed.
* Flatten more 'meta-features' used for CPU models.
* Remove some superfluous dependencies.
2024-09-19 18:20:21 -07:00
Maciej 'vesim' Kuliński
feaee2ba17 cc: Add support for -Wp, 2024-09-17 23:54:04 -07:00
Linus Groh
8588964972 Replace deprecated default initializations with decl literals 2024-09-12 16:01:23 +01:00
Alex Rønne Petersen
95bb53653d zig cc: Support -rtlib=none for disabling compiler-rt. 2024-09-09 10:47:35 -07:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
mlugg
a3a737e9a6
lib,test,tools,doc: update usages of @export 2024-08-27 00:44:35 +01:00
Robin Voetter
43f73af359
fix various issues related to Path handling in the compiler and std
A compilation build step for which the binary is not required could not
be compiled previously. There were 2 issues that caused this:

- The compiler communicated only the results of the emitted binary and
  did not properly communicate the result if the binary was not emitted.

  This is fixed by communicating the final hash of the artifact path (the
  hash of the corresponding /o/<hash> directory) and communicating this
  instead of the entire path. This changes the zig build --listen protocol
  to communicate hashes instead of paths, and emit_bin_path is accordingly
  renamed to emit_digest.

- There was an error related to the default llvm object path when
  CacheUse.Whole was selected. I'm not really sure why this didn't manifest
  when the binary is also emitted.

  This was fixed by improving the path handling related to flush() and
  emitLlvmObject().

In general, this commit also improves some of the path handling throughout
the compiler and standard library.
2024-08-19 19:09:11 +02:00
mlugg
65cbdefe4d tools: add CBE option to incr-check 2024-08-17 18:50:10 -04:00
mlugg
936a79f428 tools,test: improve incr-check and add new incremental tests 2024-08-17 18:50:10 -04:00
mlugg
b65865b027 tools: improve incr-check
And add a new incremental test to match!
2024-08-17 18:50:10 -04:00
Andrew Kelley
78fb9c0a17
Merge pull request #21031 from linusg/std-target-naming
std.Target: Function naming cleanup
2024-08-14 10:36:24 -07:00
Andrew Kelley
b5398180d6 std.debug.Coverage.resolveAddressesDwarf: fix broken logic
The implementation assumed that compilation units did not overlap, which
is not the case. The new implementation uses .debug_ranges to iterate
over the requested PCs.

This partially resolves #20990. The dump-cov tool is fixed but the same
fix needs to be applied to `std.Build.Fuzz.WebServer` (sorting the PC
list before passing it to be resolved by debug info).

I am observing LLVM emit multiple 8-bit counters for the same PC
addresses when enabling `-fsanitize-coverage=inline-8bit-counters`. This
seems like a bug in LLVM. I can't fathom why that would be desireable.
2024-08-13 15:02:53 -07:00
Linus Groh
4ef956ef14 std.Target: Rename c_type_* functions to camel case
From https://ziglang.org/documentation/master/#Names:

> If `x` is otherwise callable, then `x` should be `camelCase`.
2024-08-12 00:36:51 +01:00
Linus Groh
fd434fcd38 std.Target: Rename feature_set_fns to FeatureSetFns
From https://ziglang.org/documentation/master/#Names:

> If `x` is callable, and `x`'s return type is `type`, then `x` should
> be `TitleCase`.
2024-08-12 00:34:59 +01:00
ippsav
291fb43f27 fix(fmt): remove additional trailing newline 2024-08-09 13:07:54 -07:00
Andrew Kelley
f6f1ecf0f9 more optimized and correct management of 8-bit PC counters
* Upgrade from u8 to usize element types.
  - WebAssembly assumes u64. It should probably try to be target-aware
    instead.
* Move the covered PC bits to after the header so it goes on the same
  page with the other rapidly changing memory (the header stats).

depends on the semantics of accepted proposal #19755

closes #20994
2024-08-08 21:46:36 -07:00
Alex Rønne Petersen
6976a5da19 generate_c_size_and_align_checks: Remove extraneous newline
Groups the assertions together properly.
2024-08-08 00:51:11 -07:00
Andrew Kelley
468b976f63
Merge pull request #20975 from squeek502/cpu-features-update
update_cpu_features: Fixes and updates
2024-08-07 22:48:57 -07:00
Andrew Kelley
0e99f517f2
Merge pull request #20958 from ziglang/fuzz
introduce a fuzz testing web interface
2024-08-07 11:55:30 -07:00
Ryan Liptak
cf2558e971 update_cpu_features: Add x86 alias and arm override
Before this commit, the name `v9.5a` was being used for two different features, and one was overwriting the other in the `all_features` array.

`arrowlake_s` is an alias for `arrowlake-s`
2024-08-07 08:56:50 -07:00
Andrew Kelley
cd5f673cae
Merge pull request #20909 from alexrp/glibc-riscv
Support building glibc for riscv32/riscv64
2024-08-07 01:14:54 -07:00
Alex Rønne Petersen
8268d7be52 process_headers: Add arc-linux-gnu. 2024-08-07 01:07:09 -07:00
Andrew Kelley
895fa87d77 dump-cov: show seen PCs 2024-08-07 00:48:32 -07:00
Andrew Kelley
517cfb0dd1 fuzzing: progress towards web UI
* libfuzzer: close file after mmap
* fuzzer/main.js: connect with EventSource and debug dump the messages.
  currently this prints how many fuzzer runs have been attempted to
  console.log.
* extract some `std.debug.Info` logic into `std.debug.Coverage`.
  Prepares for consolidation across multiple different executables which
  share source files, and makes it possible to send all the
  PC/SourceLocation mapping data with 4 memcpy'd arrays.
* std.Build.Fuzz:
  - spawn a thread to watch the message queue and signal event
    subscribers.
  - track coverage map data
  - respond to /events URL with EventSource messages on a timer
2024-08-07 00:48:32 -07:00
Andrew Kelley
53aa9d75a9 std.debug.Info.resolveSourceLocations: O(N) implementation 2024-08-07 00:48:32 -07:00
Andrew Kelley
c2ab4614b6 std.Debug.Info: remove std.Progress integration
it's too fast to need it now
2024-08-07 00:48:32 -07:00
Andrew Kelley
de47acd732 code coverage dumping tool basic implementation
* std.debug.Dwarf: add `sortCompileUnits` along with a field to track
  the state for the purpose of assertions and correct API usage.
  This makes batch lookups faster.
  - in the future, findCompileUnit should be enhanced to rely on sorted
    compile units as well.
* implement `std.debug.Dwarf.resolveSourceLocations` as well as
  `std.debug.Info.resolveSourceLocations`. It's still pretty slow, since
  it calls getLineNumberInfo for each array element, repeating a lot of
  work unnecessarily.
* integrate these APIs with `std.Progress` to understand what is taking
  so long.

The output I'm seeing from this tool shows a lot of missing source
locations. In particular, the main area of interest is missing for my
tokenizer fuzzing example.
2024-08-07 00:48:32 -07:00
Andrew Kelley
2e12b45d8b introduce tool for dumping coverage file
with debug info resolved.

begin efforts of providing `std.debug.Info`, a cross-platform
abstraction for loading debug information into an in-memory format that
supports queries such as "what is the source location of this virtual
memory address?"

Unlike `std.debug.SelfInfo`, this API does not assume the debug
information in question happens to match the host CPU architecture, OS,
or other target properties.
2024-08-07 00:48:32 -07:00
Evan Haas
679ad36fa0
generate_c_size_and_align_checks: add __alignof check 2024-08-06 07:06:57 -07:00
Evan Haas
b2dd0a669a
generate_c_size_and_align_checks: print failed condition in _Static_assert 2024-08-06 07:03:00 -07:00
Evan Haas
4bdf04654e
tools: Add tool for checking size and alignment of C types
Prints _Static_asserts for the size and alignment of all the basic built-in C
types. The output can be run through a compiler for the specified target to
verify that Zig's values are the same as those used by a C compiler for the
target.
2024-08-05 12:56:40 -07:00
ippsav
724804a4e0
Rewrite generate_linux_syscalls.zig (#20895)
refactors the syscall generation tool aiming to reduce code duplication for both the table based arches and the ones generated using a preprocessor.
2024-08-05 10:43:47 -07:00
Andrew Kelley
fab5df4028
Merge pull request #20934 from alexrp/sparc32-leon3
`std.Target`: Bump baseline CPU for sparc32 to v9; add `sparcv9-linux-gnu` to `process_headers.zig`
2024-08-05 09:52:52 -07:00
Alex Rønne Petersen
4ba9a6f44c
process_headers: Add sparcv9-linux-gnu for glibc.
This is 32-bit SPARC targeting the v8 ABI but v9 CPU.
2024-08-05 12:19:22 +02:00
YANG Xudong
ea847535fc Add loongarch 64 to gen_stubs.zig. 2024-08-04 12:04:39 -07:00
Alex Rønne Petersen
f43c05690e
process_headers: Replace ilp32/lp64 with ilp32d/lp64d.
The former are soft float; the latter are hard float. We primarily care about
hard float here.
2024-08-02 09:54:08 +02:00
Alex Rønne Petersen
635a3d87de
glibc: Change riscv32-linux-gnuilp32 target triple to riscv32-linux-gnu.
This target triple was weird on multiple levels:

* The `ilp32` ABI is the soft float ABI. This is not the main ABI we want to
  support on RISC-V; rather, we want `ilp32d`.
* `gnuilp32` is a bespoke tag that was introduced in Zig. The rest of the world
  just uses `gnu` for RISC-V target triples.
* `gnu_ilp32` is already the name of an ILP32 ABI used on AArch64. `gnuilp32` is
  too easy to confuse with this.
* We don't use this convention for `riscv64-linux-gnu`.
* Supporting all RISC-V ABIs with this convention will result in combinatorial
  explosion; see #20690.
2024-08-02 09:54:08 +02:00
Alex Rønne Petersen
f29967f46c
generate_linux_syscalls: Skip some reserved syscalls on mips and xtensa. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen
264b830964
generate_linux_syscalls: Add generation code for xtensa. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen
09914868ea
generate_linux_syscalls: Add generation code for m68k. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen
6e7d619dc3
generate_linux_syscalls: Add generation code for s390x. 2024-07-30 01:32:48 +02:00
Alex Rønne Petersen
4028762a9a
generate_linux_syscalls: Add generation code for mips n32. 2024-07-30 01:32:47 +02:00
Alex Rønne Petersen
2598aa574b
generate_linux_syscalls: Add generation code for sparc32. 2024-07-30 01:32:47 +02:00
Alex Rønne Petersen
fb249cf3e1
generate_linux_syscalls: Add generation code for hexagon. 2024-07-30 01:32:47 +02:00
Alex Rønne Petersen
dd78ee43e4
generate_linux_syscalls: Add generation code for csky. 2024-07-30 01:32:47 +02:00
Alex Rønne Petersen
2e910f23f9
generate_linux_syscalls: Add generation code for arc. 2024-07-30 01:32:47 +02:00
Alex Rønne Petersen
94a1fd6e8e
generate_linux_syscalls: Name mips types according to ABI. 2024-07-30 01:32:47 +02:00