16860 Commits

Author SHA1 Message Date
Alex Rønne Petersen
e5d9d3f8a1 Compilation: Pass -municode on to Clang.
This is supposed to define the UNICODE macro; it's not just a linker option.

Closes #21978.
2024-11-13 14:22:45 +01:00
mlugg
9ebce51e16 compiler: un-jit zig fmt
This command being JITed leads to a substantially worse first-time user
experience, since you have to wait for upwards of 20 seconds for
`fmt.zig` to build. This is especially bad when your editor is
configured to run `zig fmt` on save and does so in a blocking manner. As
such, it makes sense from a usability perspective to not JIT this
particular command.
2024-11-12 21:55:46 -08:00
Alex Rønne Petersen
1db8cade5a
Merge pull request #21920 from alexrp/nobuiltin
compiler: Improve handling of `-fno-builtin` and compiler-rt options
2024-11-12 16:40:00 +01:00
mlugg
bbbc95afd0 AstGen: add missing rvalue call to labeledBlockExpr
...and fix a minor x86_64 backend bug exposed by this fix.

Resolves: #21974
2024-11-12 14:51:10 +00:00
Robin Voetter
62f4a6b4d8
Merge pull request #21937 from Snektron/spirv-vulkan-ptrs
spirv: miscellaneous vulkan + zig stuff
2024-11-09 21:50:33 +01:00
Wooster
35201e9d93 Sema: fix wording in error message
It's an FQN, not an actual file name.
2024-11-09 20:21:32 +00:00
Robin Voetter
9cd7b8359c
spirv: enable variable pointers for now
This seems to be required for ptr_elem_ptr with storage buffers. Note that
this does not imply that the pointer can be regarded as physical too.

Some variants of ptr_elem_ptr will need to be forbidden
2024-11-09 01:53:13 +01:00
Robin Voetter
efb7539cb6
spirv: dont emit forward pointer for annotation instructions 2024-11-09 01:53:13 +01:00
Robin Voetter
89bd987f1c
spirv: emit ArrayStride for many-item pointers 2024-11-08 20:43:57 +01:00
Robin Voetter
b16252b17e
spirv: make all vulkan structs Block for now 2024-11-08 20:43:57 +01:00
Robin Voetter
d35dfc5a3f
add storage_buffer address space 2024-11-08 20:43:57 +01:00
Robin Voetter
688d7055e3
spirv: assembler hacky constant placeholders 2024-11-08 20:43:55 +01:00
Robin Voetter
b5301558ae
spirv: make default generic address space for vulkan Function
We are not using Private variables. This needs to be cleaned up a bit
more, this will happen with the general address space improvements.
2024-11-08 20:38:23 +01:00
Robin Voetter
7682ced08e
spirv: track global OpVariables properly in assembler
Also cleans up the assembler a bit in general.
2024-11-08 20:38:22 +01:00
Robin Voetter
4fbc100959
spirv: properly resolve type inputs in assembly
For now the frontend still allows type inputs in assembly. We
might as well resolve them properly in the SPIR-V backend.
2024-11-08 20:38:21 +01:00
Robin Voetter
08ad7afc1e
spirv: forbid pointer arithmetic 2024-11-08 20:38:20 +01:00
Alex Rønne Petersen
c9052ef931
llvm: Disable lowering to f16 on sparc. 2024-11-08 14:57:16 +01:00
Alex Rønne Petersen
89a506a7ef
musl: Don't explicitly pass -fno-unwind-tables -fno-asynchronous-unwind-tables.
These are already handled by build_crt_file().
2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
5685a10ded
libunwind: Pass -fPIC -funwind-tables via module options instead of CFLAGS. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
eb14fd8806
libcxx: Pass -fPIC via module options instead of CFLAGS. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
796d4845ff
musl: Pass -fomit-frame-pointer via CrtFileOptions. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
7fef0b4a23
musl: Pass -f(function,data)-sections via CrtFileOptions instead of CFLAGS. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
f973d3e93e
glibc, musl, wasi-libc: Don't explicitly pass -fno-stack-protector.
This is already handled by build_crt_file().
2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
2a65b84572
tsan: Handle more Apple targets when picking library name. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
0563525b21
tsan: Synchronize CFLAGS with upstream.
In particular:

* -fms-extensions for MinGW
* -fno-builtin
* -fno-emulated-tls for Android 29+
* -fno-exceptions
* -fomit-frame-pointer
* -fvisibility=hidden
2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
bdca2d0f48
llvm: Also apply the nobuiltin attribute for the no_builtin module option.
From `zig build-exe --help`:

  -fno-builtin              Disable implicit builtin knowledge of functions

It seems entirely reasonable and even expected that this option should imply
both no-builtins on functions (which disables transformation of recognized code
patterns to libcalls) and nobuiltin on call sites (which disables transformation
of libcalls to intrinsics). We now match Clang's behavior for -fno-builtin.

In both cases, we're painting with a fairly broad brush by applying this to an
entire module, but it's better than nothing. #21833 proposes a more fine-grained
way to apply nobuiltin.
2024-11-05 22:41:06 +01:00
Alex Rønne Petersen
e88501a090
Compilation: Fix unwind table logic for compiler-rt.
This looks to be a refactoring leftover.
2024-11-05 20:10:12 +01:00
Alex Rønne Petersen
7b1d2fa004
Compilation: Also set essential module options when including compiler-rt.o.
Closes #21831.
2024-11-05 14:43:02 +01:00
Alex Rønne Petersen
b57819118d
Compilation: Move no_builtin to Package.Module.
This option, by its very nature, needs to be attached to a module. If it isn't,
the code in a module could break at random when compiled into an application
that doesn't have this option set.

After this change, skip_linker_dependencies no longer implies no_builtin in the
LLVM backend.
2024-11-05 14:43:02 +01:00
Alex Rønne Petersen
56b416662a
compiler: Update clangMightShellOutForAssembly() for Clang 19.
Clang only uses the system assembler for nvptx and xcore nowadays.
2024-11-05 14:43:02 +01:00
Alex Rønne Petersen
bd7dda0c55
Merge pull request #21907 from alexrp/valgrind-stuff
Add client request support for all architectures supported by Valgrind
2024-11-05 10:03:44 +01:00
Alex Rønne Petersen
bd8ef0036d llvm: Use no-builtins attribute instead of nobuiltin.
The former prevents recognizing code patterns and turning them into libcalls,
which is what we want for compiler-rt. The latter is meant to be used on call
sites to prevent them from being turned into intrinsics.

Context: https://github.com/ziglang/zig/issues/21833
2024-11-04 14:17:57 +01:00
Alex Rønne Petersen
8a73a965d3
llvm: Add client request support for all archs supported by Valgrind. 2024-11-04 13:53:20 +01:00
Alex Rønne Petersen
814a41b48f link.Coff: Pass -lldmingw to LLD earlier and regardless of -lc.
The -lldmingw option affects a lot of logic throughout LLD. We need to pass it
for *-windows-gnu even when we're not actually linking MinGW since we're still
using the MinGW ABI with all that that entails. (One particular problem we would
run into is missing handling of stdcall-decorated symbols for 32-bit x86.) Also,
various other LLD options are sensitive to this option, so it's best to pass it
as early as possible.

Closes #11817.
2024-11-04 07:19:11 +01:00
Alex Rønne Petersen
3054486d1d
Merge pull request #21843 from alexrp/callconv-followup
Some follow-up work for #21697
2024-11-03 14:27:09 +01:00
Alex Rønne Petersen
2f003f39b2
Merge pull request #21599 from alexrp/thumb-porting 2024-11-03 14:25:30 +01:00
Alex Rønne Petersen
947b7195bf llvm: Update the list of address spaces for LLVM 19.
Mainly affects amdgcn.
2024-11-03 13:44:38 +01:00
Alex Rønne Petersen
3a2647b7d3
glibc: Don't build CRT objects that won't be used. 2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
4c70aea460
Compilation: Use the regular module mechanism for setting PIC on CRT objects.
addCCArgs() will then pass the appropriate flag to Clang.
2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
39abcc303c
Compilation: Pass -fno-PIC to clang if PIC is disabled.
Let's not implicitly rely on whatever Clang's default is.
2024-11-03 09:29:33 +01:00
Alex Rønne Petersen
c9e67e71c1
std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().
The old isARM() function was a portability trap. With the name it had, it seemed
like the obviously correct function to use, but it didn't include Thumb. In the
vast majority of cases where someone wants to ask "is the target Arm?", Thumb
*should* be included.

There are exactly 3 cases in the codebase where we do actually need to exclude
Thumb, although one of those is in Aro and mirrors a check in Clang that is
itself likely a bug. These rare cases can just add an extra isThumb() check.
2024-11-03 09:29:30 +01:00
Alex Rønne Petersen
4e843b4e2b
llvm: Remove extraneous commas for branch hint metadata in textual IR output. 2024-11-02 11:06:33 +01:00
Alex Rønne Petersen
e4e3d7ab41
Sema: Disallow calling functions with certain special calling conventions. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
f508e22705
link.Dwarf: Some minor corrections to calling conventions to ~match Clang.
This can't be completely 1:1 due to the fact that we model CCs more precisely,
but this is about as close as we can get.
2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
c217fd2b9c
cbe: Support some more calling conventions. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
3a5142af8d
compiler: Handle arm_aapcs16_vfp alongside arm_aapcs_vfp in some places. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
be8a527eb2
std.os.windows: Deprecate WINAPI in favor of CallingConvention.winapi. 2024-11-02 10:44:18 +01:00
Alex Rønne Petersen
a5bc9cbb15
llvm: Fix lowering of gnuilp32 ABI to be gnu_ilp32.
LLVM doesn't even recognize the gnuilp32 spelling as an alternative.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
43878f51d9
glibc: Emit _IO_stdin_used reference in .rodata.
This fixes an X86_64_32 relocation linker error when targeting gnux32.
2024-11-02 10:42:53 +01:00
Alex Rønne Petersen
ec0e6440b1
musl: Update sources from musl 1.2.5.
Adds mipsn32 and x32 sources.

Also remove some useless .in files.
2024-11-02 10:42:53 +01:00