31537 Commits

Author SHA1 Message Date
Alex Rønne Petersen
ea987faa85
std.Target: Use explicit baseline CPU models for bpf, m68k, msp430, and xcore.
This makes no difference presently, but if LLVM ever starts modeling features
for these, we would not get them by default for our baseline if we use the
generic model.
2024-10-26 21:59:59 +02:00
Alex Rønne Petersen
e26b64a87d
std.Target: Use mips32r2/mips64r2 as the baseline CPU models for mips/mips64.
This matches Clang's defaults. That also means these CPU models tend to get more
testing, so they're a safer baseline choice. Anecdotally, the oldest MIPS
hardware that I've seen anyone run Zig on was also r2.
2024-10-26 21:59:59 +02:00
Alex Rønne Petersen
385f586605
std.Target: Use sm_52 as the baseline CPU model for nvptx.
This matches Clang's default.
2024-10-26 21:59:59 +02:00
Alex Rønne Petersen
2d22cc9f61
std.Target: Use gfx906 as the baseline CPU model for amdgcn.
This matches Clang's default.
2024-10-26 21:59:59 +02:00
Alex Rønne Petersen
5b7eba95ba
std.Target: Use gfx600 as the generic CPU model for amdgcn.
This is the first model that was actually in the GCN family.
2024-10-26 21:59:59 +02:00
Alex Rønne Petersen
51dc4b0549
std.Target: Use ppc64 as the generic CPU model for powerpc64le.
ppc64le remains the baseline CPU model. Note that there's nothing about little
endian, 64-bit PowerPC that requires the features in the ppc64le model; the
reason it exists is that 64-bit PowerPC wasn't really used in little endian mode
prior to those features being commonplace. That makes the ppc64le model a good
baseline model, but not the right choice for a generic model.
2024-10-26 21:59:59 +02:00
Alex Rønne Petersen
8062bdba9a
std.Target: Use avr1 as the generic CPU model for avr.
avr2 remains the baseline CPU model.
2024-10-26 21:59:58 +02:00
Alex Rønne Petersen
c50fb58307
std.Target: Use v11 as the baseline CPU model for lanai. 2024-10-26 21:59:58 +02:00
Alex Rønne Petersen
73b4cb6314
std.Target: Use ck810 as the baseline CPU model for csky. 2024-10-26 21:59:58 +02:00
Alex Rønne Petersen
8282f3be96
std.Target: Add doc comments for Cpu.Arch.generic() and baseline(). 2024-10-26 21:59:58 +02:00
Alex Rønne Petersen
4b78dbe068
Compilation: Omit Clang CPU model flags for some targets. 2024-10-26 21:59:58 +02:00
Xavier Bouchoux
6a364b4a5e link/Elf.zig: ensure capacity before appending linker args.
fixes e567abb339e1edaf5a3c86fe632522a3b8005275 "rework linker inputs"
closes https://github.com/ziglang/zig/issues/21801
2024-10-26 19:46:40 +02:00
Nelson Crosby
b1361f237a Fix up Linux xattr syscalls
fgetxattr now doesn't accidentally call lgetxattr,
and argument types are more consistent.
2024-10-26 13:53:07 +02:00
Matthew Lugg
4adf63aefc
Merge pull request #21796 from Rexicon226/var-args
fix callconv resolution for varargs
2024-10-25 18:31:01 +01:00
llogick
985b13934d Remove @setAlignStack from the langref 2024-10-25 15:13:41 +02:00
Andrew Kelley
b8795b4d02
Merge pull request #21795 from ziglang/kqueue-watch
Build Runner: Implement File System Watching for kqueue
2024-10-25 04:00:26 -07:00
Alex Rønne Petersen
03d0e296cb
Merge pull request #21710 from alexrp/function-alignment
Some improvements to the compiler's handling of function alignment
2024-10-25 11:10:28 +02:00
Linus Groh
5769592cdd std.os.uefi: Fix calling convention build error
```
std/os/uefi/protocol/simple_text_input.zig:10:63: error: no field named 'Win64' in enum '@typeInfo(builtin.CallingConvention).@"union".tag_type.?'
std/builtin.zig:169:31: note: enum declared here
std/os/uefi/protocol/simple_text_output.zig:9:64: error: no field named 'Win64' in enum '@typeInfo(builtin.CallingConvention).@"union".tag_type.?'
std/builtin.zig:169:31: note: enum declared here
std/os/uefi/tables/runtime_services.zig:26:86: error: no field named 'Win64' in enum '@typeInfo(builtin.CallingConvention).@"union".tag_type.?'
std/builtin.zig:169:31: note: enum declared here
```
2024-10-25 10:45:55 +02:00
David Rubin
97e584a6b9
use cCallingConvention instead of .C in Sema
using `.C` in Sema is incorrect since it will be resolved under the target that Zig was compiled with, not the target build configuration. This is easily solved by just calling `cCallingConvention` on the target to resolve it.
2024-10-25 00:08:41 -07:00
Andrew Kelley
cc671a2d40 std.Build.Watch: implement removing watches for kqueue 2024-10-24 23:31:56 -07:00
David Rubin
0d83304228
remove leak from linker 2024-10-24 23:23:15 -07:00
Andrew Kelley
8819d8b061 std.Build.Watch: limit to one switch on os tag
DRY
2024-10-24 16:29:02 -07:00
Andrew Kelley
7a46ba73ce implement --watch for kqueue
it doesn't detect and remove no longer watched things yet

it also isn't aware of any file names reported by kqueue. I'm unsure if
that functionality exists.
2024-10-24 16:24:56 -07:00
Jakub Konka
56996a2809
link/Coff: simplify file structure by collapsing all files into Coff.zig (#21761)
* coff: collapse Coff/lld.zig logic into Coff.zig

* coff: rename std.coff uses to coff_util

* coff: rename self to coff for *Coff references

* coff: collapse Coff/Atom.zig logic into Coff.zig

* coff: collapse Coff/Relocation.zig logic into Coff.zig

* coff: collapse Coff/ImportTable.zig logic into Coff.zig

* coff: remove unused Coff/Object.zig

* link/Coff: fix rebase gone wrong
2024-10-24 13:50:02 +00:00
Veikka Tuominen
9ffee5abed
Sema: fix check for whether current AnalUnit is a test function
Closes #21159
2024-10-24 13:34:07 +03:00
Andrew Kelley
c563ba6b15
Merge pull request #21700 from ziglang/cli-lib-dirs
move linker input file parsing to the frontend
2024-10-23 22:56:04 -07:00
Andrew Kelley
4bdc2d3871 avoid unnecessarily building Scrt1.o when cross-compiling glibc
which, in this branch causes a miscompilation because it would get sent
to the linker.
2024-10-23 16:27:39 -07:00
Andrew Kelley
5e11790c7b mutex protect comp.arena in --verbose-link 2024-10-23 16:27:39 -07:00
Andrew Kelley
2530d638d6 more helpful message when testTlsOffsetAlignment fails 2024-10-23 16:27:39 -07:00
Andrew Kelley
504ad56815 link.flushTaskQueue: move safety lock
The safety lock needs to happen after check()
2024-10-23 16:27:39 -07:00
Andrew Kelley
ba71079837 combine codegen work queue and linker task queue
these tasks have some shared data dependencies so they cannot be done
simultaneously. Future work should untangle these data dependencies so
that more can be done in parallel.

for now this commit ensures correctness by making linker input parsing
and codegen tasks part of the same queue.
2024-10-23 16:27:39 -07:00
Andrew Kelley
9a511b4b27 work on compiler_rt and fuzzer libs earlier in the pipeline
don't wait for AstGen and C source files to complete before starting to
build compiler_rt and libfuzzer
2024-10-23 16:27:39 -07:00
Andrew Kelley
989e782a01 link.Elf.ZigObject.updateFunc: reduce data dependencies
Unfortunately it's not a complete solution, so a follow-up commit will
need to do something more drastic like not do the linker task queue at
the same time as codegen task queue.

From that point, it is possible to do more work at the same time but
that should be a separate branch. This one has gotten big enough.
2024-10-23 16:27:39 -07:00
Andrew Kelley
e0623df9f7 Compilation.create: skip libc_installation on darwin
If the "is darwin" check is moved below the libc_installation check
below, error.LibCInstallationMissingCrtDir is returned from
lci.resolveCrtPaths().

This should be revisited because it makes sense to check
libc_installation first even on darwin.

Anyway for now this more closely matches logic from master branch.
2024-10-23 16:27:39 -07:00
Andrew Kelley
f2efe05155 use deterministic order in relocatable-eh-frame tests
This test does not pass in master branch either if you flip the object
order around.
2024-10-23 16:27:39 -07:00
Andrew Kelley
3deb9ab30a use unstable sort in relocatable writeSyntheticSections
unstable sort is always better if you have no ties
2024-10-23 16:27:39 -07:00
Andrew Kelley
336466c9df glibc sometimes makes archives be ld scripts
it is incredible how many bad ideas glibc is bundled into one project.
2024-10-23 16:27:39 -07:00
Andrew Kelley
ccac11196b link.Elf: unstable sort for section headers
using name as tie-breaker.
2024-10-23 16:27:39 -07:00
Andrew Kelley
1c45903274 handle _fltused in compiler_rt
so we don't have to do an entire compilation unit for just this silly
symbol
2024-10-23 16:27:39 -07:00
Andrew Kelley
22948616ff split a fat test case 2024-10-23 16:27:39 -07:00
Andrew Kelley
5d75d8f6fc also find static libc files on the host
and don't look for glibc files on windows
2024-10-23 16:27:39 -07:00
Andrew Kelley
2d8ea78249 link.Elf: remove ZigObject from files
By making it a field of link.Elf, it is now accessible without a data
dependency on `files`, fixing a race condition with the codegen thread
and linker thread.
2024-10-23 16:27:38 -07:00
Andrew Kelley
ab33d2e7a9 add missing check for output mode in tsan logic 2024-10-23 16:27:38 -07:00
Andrew Kelley
3cc19cd865 better error messages 2024-10-23 16:27:38 -07:00
Andrew Kelley
d1ecb742ec don't create unused musl crt objects 2024-10-23 16:27:38 -07:00
Andrew Kelley
de0f7fcf52 unify parsing codepaths between relocatable and non 2024-10-23 16:27:38 -07:00
Andrew Kelley
12f3a7c3c2 fix wasm crt logic 2024-10-23 16:27:38 -07:00
Andrew Kelley
3f6b6b1bcd revert macos target version bump 2024-10-23 16:27:38 -07:00
Andrew Kelley
c2898c436f branch fixes 2024-10-23 16:27:38 -07:00
Andrew Kelley
5ca54036ca move linker input file parsing to the compilation pipeline 2024-10-23 16:27:38 -07:00