Commit Graph

184 Commits

Author SHA1 Message Date
Veikka Tuominen
62ff8871ed stage2+stage1: remove type parameter from bit builtins
Closes #12529
Closes #12511
Closes #6835
2022-08-22 11:19:20 +03:00
Andrew Kelley
c0b7f20893 stage2: implement stack protectors
This is one of the final remaining TODOs for the LLVM backend.
2022-08-19 03:41:13 -07:00
Jakub Konka
a0ec07fdec cc: add support for -M flag 2022-08-08 14:26:10 +02:00
Jakub Konka
80c9d3f3b1 update update_clang_options.zig to latest formatting changes 2022-08-08 14:25:45 +02:00
Meghan Denny
b5861193e0 std: rename std.Target.systemz to .s390x 2022-07-28 23:22:44 -07:00
r00ster
cff5d9c805
std.mem: add first method to SplitIterator and SplitBackwardsIterator 2022-07-25 22:04:30 +03:00
Andrew Kelley
7d636f0f9d delete the stage1 implementation of autodoc 2022-07-19 19:10:12 -07:00
Veikka Tuominen
2b67f56c35 std.fs: split Dir into IterableDir
Also adds safety check for attempting to iterate directory not opened with `iterate = true`.
2022-07-15 13:04:21 +03:00
Andrew Kelley
2b99182e25 stage2: cleanups to --compress-debug-sections
* make the setting in the linker backend be non-optional; by this time
   all defaults are supposed to be resolved.
 * integrate with `zig cc`
 * change the CLI parsing to match C compiler parsing, allowing
   `--compress-debug-sections` alone to choose a default encoding of
   zlib.
2022-07-11 14:18:56 -07:00
Andrew Kelley
2ee864ca5e CLI: add support for -fno-builtin 2022-07-05 15:21:20 -07:00
Andrew Kelley
6db190cf70 Merge remote-tracking branch 'origin/master' into llvm14 2022-07-03 22:27:21 -07:00
Jakub Konka
5735ce39ae clang: parse --verbose flag as -v 2022-07-03 09:43:01 +02:00
Andrew Kelley
d55d98919d update CPU features to LLVM 14
Notable changes:

`_i386`, `_i486`, and `_i686` are renamed to `i386`, `i486`,
and `i686` respectively. `std.zig.fmtId` is enhanced to support
formatting `i386` as `@"i386"`.

Some CPU features which are actually CPU models have been
properly flattened, such as `apple_a12`, `apple_a13`, `apple_a7`,
`cortex_a78c`, `exynos_m4`, `neoverse_e1`, `neoverse_n1`,
`neoverse_n2`, `neoverse_v1`.

Some CPU features have been added and some have been removed, following
LLVM's lead.

CSky CPU features support is added.
2022-07-01 21:35:19 -07:00
Jakub Konka
7cc4176448 clang: add Zig equivalent for -headerpad_max_install_names cli flag 2022-06-29 17:21:32 +02:00
Jakub Konka
c2c1998269 clang: update cmdline options to include weak libs and frameworks
Clang accepts `-weak-lx`, `-weak_library x` and `-weak_framework x`.
2022-06-28 21:16:23 +02:00
BratishkaErik
1bdc2b777b tools: fix update-linux-headers.zig and process_headers.zig
Signed-off-by: BratishkaErik <bratishkaerik@getgoogleoff.me>
2022-06-06 15:53:53 +02:00
Stephen Gregoratto
a4369918b1 Generate linux syscalls via. the linux source tree
Previously, updating the `SYS` enum for each architecture required
manually looking at the syscall tables and inserting any new additions.

This commit adds a tool, `generate_linux_syscalls.zig`, that automates
this process using the syscall tables in the Linux source tree. On
architectures without a table, it runs `zig cc` as a pre-processor to
extract the system-call numbers from the Linux headers.
2022-05-16 23:55:11 -04:00
Koakuma
fb0692334e target: Rename sparcv9 -> sparc64
Rename all references of sparcv9 to sparc64, to make Zig align more with
other projects. Also, added new function to convert glibc arch name to Zig
arch name, since it refers to the architecture as sparcv9.

This is based on the suggestion by @kubkon in PR 11847.
(https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-13 16:43:59 -04:00
Isaac Freund
2477a95d29
tools/gen_stubs: sort output by section/symbol name
This will make future diffs smaller and easier to review.
2022-05-04 18:38:45 +02:00
Isaac Freund
f4131cf8a6
musl: update to 1.2.3
This was a bit trickier than it should be due to symbol conflicts with
zig's compiler-rt implementation. We attempt to use weak linkage in
our compiler-rt, but this does not seem to be working in all cases. I
manually disabled export of the problematic compiler-rt math functions
in order to cross compile musl's libc.so for all targets as input to
`tools/gen_stubs.zig`.

Other than that, this update went fairly smoothly. Quite a few
additional symbols were added to the blacklist in `tools/gen_stubs.zig`
due to recent reorganization of zig's compiler-rt.
2022-05-04 01:00:57 +02:00
Andrew Kelley
3ef34feaeb tools: fix gdb pretty printers
needed after merging 5c3325588e.
2022-03-20 00:36:44 -07:00
Robin Voetter
4ff7553d6b gdb: restructure pretty printers into different files 2022-03-16 18:13:10 +01:00
Robin Voetter
0bd84e03b9 gdb: add printer for selfhosted Value 2022-03-16 17:57:31 +01:00
Robin Voetter
6830bcbb0a gdb: add printer for selfhosted Type 2022-03-16 17:40:21 +01:00
Robin Voetter
feb8981a95 gdb: add slice, multi array list, and array hash map printers 2022-03-16 15:50:03 +01:00
Robin Voetter
e18c29af5b gdb: add arraylist and hashmap printer 2022-03-16 12:40:08 +01:00
Andrew Kelley
d3648cc030 zig cc: integrate with -fstack-check, -fno-stack-check 2022-03-04 18:10:37 -07:00
Veikka Tuominen
cbd5d6c704 spirv spec: do not align packed struct fields 2022-02-24 19:48:34 +02:00
Andrew Kelley
210ee1067b update more API usage of std.Progress
fixes regression introduced in 5a00e24963
2022-02-08 17:49:40 -07:00
Robin Voetter
ff042e8006 spirv: improve generator
The spirv spec generator now also generates some support information:
Opcode gains a function to query a Zig type representing the operands
of the opcode. The idea is that this will enable a richer interface for
emitting spirv instructions.
2022-01-28 14:38:57 +01:00
Motiejus Jakštys
7107a0fc40 [linux headers] rename arm64 to aarch64
Zig calls it aarch64. Linux calls it arm64. Currently lib/libc/include
has both arm64 and aarch64, which is quite confusing.

tools/update-linux-headers.zig was executed against the latest stable
linux patch version, therefore some other minor header updates. I will
update the wiki on how to do it once this PR is accepted.
2022-01-26 07:57:34 +02:00
Andrew Kelley
fd6d1fe015 stage2: improvements to entry point handling
* rename `entry` to `entry_symbol_name` for the zig build API
 * integrate with `zig cc` command line options
 * integrate with COFF linking with LLD
 * integrate with self-hosted ELF linker
 * don't put it in the hash for MachO since it is ignored
2022-01-19 11:41:08 -07:00
Jakub Konka
6d9c02a54f
zig cc: integration with sysroot arg (#10568)
Prior to this change, even if the use specified the sysroot on the
compiler line like so

```
zig cc --sysroot=/path/to/sdk
```

it would only be used as a prefix to include paths and not as a prefix
for `zig ld` linker.
2022-01-11 12:41:26 -05:00
Andrew Kelley
c8af00c66e glibc: fix inconsistency of powerpc ABI mapping
See the commit message of 5b6d26e97b for
an explanation. This is the same thing but for powerpc instead of mips.
2021-12-16 03:01:13 -07:00
Andrew Kelley
5b6d26e97b glibc: fix inconsistency of mips ABI mapping
Before this commit, glibc headers did the following mapping:

 * (zig) mipsel-linux-gnu      => (glibc) mipsel-linux-gnu
 * (zig) mipsel-linux-gnu-soft => (glibc) (none)
 * (zig) mips-linux-gnu        => (glibc) mips-linux-gnu
 * (zig) mips-linux-gnu-soft   => (glibc) (none)

While the glibc ABI stubs used the (zig) gnueabi and gnueabihf ABIs,
and the stage2 available_libcs array listed:

 * (zig) mipsel-linux-gnu
 * (zig) mips-linux-gnu

The problem is the mismatch between the ABI component of the headers and
the stubs.

This commit makes the following clarifications:

 * (zig) mips-linux-gnueabi     means soft-float
 * (zig) mipsel-linux-gnueabi   means soft-float
 * (zig) mips-linux-gnueabihf   means hard-float
 * (zig) mipsel-linux-gnueabihf means hard-float

Consequently, the glibc headers now do this mapping:

 * (zig) mips-linux-gnueabihf   => (glibc) mips-linux-gnu
 * (zig) mipsel-linux-gnueabihf => (glibc) mipsel-linux-gnu
 * (zig) mips-linux-gnueabi     => (glibc) mips-linux-gnu-soft
 * (zig) mipsel-linux-gnueabi   => (glibc) mipsel-linux-gnu-soft

The glibc ABI stubs are unchanged, and the stage2 available_libcs
array's 2 entries are modified and it gains 2 more:

 * (zig) mipsel-linux-gnueabi
 * (zig) mipsel-linux-gnueabihf
 * (zig) mips-linux-gnueabi
 * (zig) mips-linux-gnueabihf

Now everything is consistent. Zig no longer recognizes a `mips-linux-gnu`
triple; one must use `mips-linux-gnueabi` (soft float) or
`mips-linux-gnueabihf` (hard float).
2021-12-15 19:09:50 -07:00
Andrew Kelley
21cffe22d4 glibc: remove duplicate files between generic-glibc/ and glibc/include/ 2021-12-15 18:34:27 -07:00
Andrew Kelley
d9fe0d2d6b tools/update_glibc: ignore some more files 2021-12-15 15:28:37 -07:00
Andrew Kelley
19ca2415f2 update glibc start files to 2.34
This commit introduces tools/update_glibc.zig to update the start files
for next time.

Some notable changes in recent glibc:

 * abi-note.S has been changed to abi-note.c but we resist the change to
   keep it easier to compile the start files.
 * elf-init.c has been deleted upstream. Further testing should be done
   to verify that binaries against glibc omitting elf-init.c still run
   properly on oldel glibc linux systems.

Closes #4926
2021-12-15 14:30:03 -07:00
Andrew Kelley
5da013e39c remove tools/update_glibc.zig
It has been replaced by https://github.com/ziglang/glibc-abi-tool/ and
should have been removed in 1442aa7dc0.
2021-12-14 21:44:44 -07:00
Andrew Kelley
da9542c0af tools/gen_stubs: add aarch64 and output preprocessor directives
Now it outputs libc.S which can be assembled with zig, and the small
differences per-architecture are handled with preprocessor directives.

There is also now a set of blacklisted symbols which contains
compiler-rt.
2021-12-09 01:21:30 -07:00
Andrew Kelley
04d44db6cc tools/gen_stubs: consolidate symbol properties into MultiSym 2021-12-08 23:45:25 -07:00
Andrew Kelley
808b9239a3 improve musl dynamic stubs file libc.s
tools/gen_stubs.zig now cuts out the middle man and operates directly on
the libc.so ELF file. it outputs accurate .size directives for objects.

std.elf gains an STV enum.
2021-12-08 22:32:31 -07:00
Lee Cannon
066eaa5e9c
allocgate: change resize to return optional instead of error 2021-11-30 23:45:01 +00:00
Lee Cannon
1093b09a98
allocgate: renamed getAllocator function to allocator 2021-11-30 23:32:47 +00:00
Lee Cannon
75548b50ff
allocgate: stage 1 and 2 building 2021-11-30 23:32:47 +00:00
Lee Cannon
85de022c56
allocgate: std Allocator interface refactor 2021-11-30 23:32:47 +00:00
Andrew Kelley
8635275202 remove linux header files that have case conflicts
similar commit from the past:
c73cd05468

This also modifies tools/update-linux-headers.zig to remove these same
files for next time to prevent a regression.

closes #10249
2021-11-30 14:29:11 -07:00
Andrew Kelley
902df103c6 std lib API deprecations for the upcoming 0.9.0 release
See #3811
2021-11-30 00:13:07 -07:00
Andrew Kelley
19eaf54bc9 update libc linux headers to v5.16-rc3
* Add missing Linux headers. Closes #9837
 * Update existing headers to latest Linux.
 * Consolidate headers that are the same for multiple Zig target CPU
   architectures. For example, Linux has only an x86 directory for both
   x86_64 and x86 CPU architectures. Now Zig only ships an x86 directory
   for Linux headers, and will emit the proper corresponding -isystem
   flags.
 * tools/update-linux-headers.zig is now available for upgrading to
   newer Linux headers, and the update process is now documented on the
   wiki.
2021-11-29 18:05:11 -07:00
Andrew Kelley
b097545a5f zig cc: honor all -m and -mno- CPU feature flags
closes #9196
2021-11-26 19:59:33 -07:00