Commit Graph

398 Commits

Author SHA1 Message Date
Alex Rønne Petersen
fc8a4c445d
gen_stubs: Require less manual intervention and produce better output.
The tool will now skip over undefined symbols. These can only occur as a result
of building musl without compiler-rt, i.e. -rtlib=none. Thanks to this, it's no
longer necessary to patch Zig's compiler-rt, nor is it necessary to maintain a
symbol blacklist.

See the updated instructions here: https://github.com/ziglang/zig/wiki/Updating-libc#updating-the-libcs-file

Additionally, the tool now produces slightly more compact output by recognizing
symbols that are defined for a single arch, for a family of arches, or only for
arches using 32-bit or 64-bit time as their primary ABI.

Finally, the tool now supports all architectures that we can emit code for, with
the single exception of x86_64-linux-muslx32. (x32 currently fails with a ton of
relocation errors, leading me to believe that it might be an LLVM or LLD bug.)
2024-11-23 03:10:58 +01:00
Alex Rønne Petersen
3054486d1d
Merge pull request #21843 from alexrp/callconv-followup
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
Some follow-up work for #21697
2024-11-03 14:27:09 +01:00
Alex Rønne Petersen
baf60426d4
std.Target: Rename amdgpu module to amdgcn.
This was an inconsistency left over from c825b567b2.
2024-11-02 10:44:14 +01:00
Alex Rønne Petersen
d61e4ef8b0
generate_linux_syscalls: Generate syscalls for x32.
Also update the syscalls file based on Linux 6.10. No diffs other than x32.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
94cf5b26f4
process_headers: Add muslabin32 and muslx32 support. 2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
497b502ce4
process_headers: Simplify the code a bit. 2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
fccf15fc9f std.Target: Remove armv7k/armv7s.
Like d1d95294fd, this is more Apple nonsense where
they abused the arch component of the triple to encode what's really an ABI.

Handling this correctly in Zig's target triple model would take quite a bit of
work. Fortunately, the last Armv7-based Apple Watch was released in 2017 and
these targets are now considered legacy. By the time Zig hits 1.0, they will be
a distant memory. So just remove them.
2024-11-02 10:25:40 +01:00
Krzysztof Wolicki
e9f3d18b57
Fix small TODO in tools/migrate_langref.zig (#21825) 2024-10-28 00:03:33 +00:00
Jacob Young
d354daf143 lldb: disable pretty printers on self-hosted backends 2024-10-09 07:48:09 -04:00
Alex Rønne Petersen
790fc8cd98
Merge pull request #21499 from alexrp/loongarch-gnusf
Add `loongarch64-linux-gnusf` target support
2024-10-07 01:24:00 +02:00
Alex Rønne Petersen
be5378b038
Merge pull request #21587 from alexrp/hexagon-porting
Some initial `hexagon-linux` port work
2024-10-06 13:35:56 +02:00
mlugg
ada60616b3
incr-check: minor fixes
* fix inconsistency in global cache directory name
* don't error if spawning external executor fails
* handle CRLF correctly
2024-10-05 20:52:26 +01:00
mlugg
dfc0a27090
incr-check: clean up temporary directory by default
The new `--preserve-tmp` flag can be used to preserve the temporary
directory for debugging purposes.
2024-10-05 20:52:26 +01:00
mlugg
5ce962eb69
incr-check: better progress output, support external executors
If no external executor is available for a successful binary, its
execution is silently skipped. This allows the CI to test, to the
fullest extent possible, incremental cross-compilation to targets whose
binaries can't be executed on the host.
2024-10-05 20:52:25 +01:00
mlugg
f60c045cef
tests: add test-incremental step
This is contained in the `test` step, so is tested by CI.

This commit also includes some enhancements to the `incr-check` tool to
make this work correctly.
2024-10-05 20:52:25 +01:00
Alex Rønne Petersen
eb363bf845
Merge pull request #21572 from alexrp/tests-llvm-targets
`test`: Rewrite the target triple list for `llvm_targets`.
2024-10-04 19:37:12 +02:00
Alex Rønne Petersen
8060fad425
generate_linux_syscalls: Rename mmap_pgoff to mmap2. 2024-10-03 09:12:35 +02:00
Alex Rønne Petersen
cb1ac0bb2f
update_cpu_features: Don't delete the output file if there are no CPU features.
At bare minimum, the compiler expects std.Target.<arch>.cpu.generic to work for
any given architecture when generating the builtin module. So rather than try to
hack that into working when the affected modules are omitted, just actually keep
them.

This affected lanai and xcore.
2024-10-03 05:01:14 +02:00
Alex Rønne Petersen
f03142cfe9
process_headers: Add loongarch64-linux-gnusf. 2024-10-03 04:39:39 +02:00
Alex Rønne Petersen
8ee52f99ce
Merge pull request #21505 from alexrp/cpu-features-exts
`update_cpu_features`: Add support for parsing `DefaultExts` as used for aarch64.
2024-10-03 00:41:48 +02:00
mlugg
054dbb6798
incr-check: specify backend in manifest, allow multiple targets/backends 2024-09-25 20:39:31 +01:00
Jakub Konka
1714b74edf incr-check: actually handle end message for a compiler update 2024-09-25 17:54:50 +02:00
Jakub Konka
1c2048ebcc incr-check: add --debug-link flag for verbose linker logging 2024-09-25 17:54:50 +02:00
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