Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std.Target: A bunch of C type size/alignment fixes #20960

Merged
merged 14 commits into from
Aug 6, 2024

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Aug 6, 2024

Fixes a bunch of issues uncovered with the help of #20951.

  • There are still some remaining issues for avr, but I am not making any changes there until there's a resolution to [clang][AVR] Alignment discrepancies between clang and avr-gcc for short, long long, and double llvm/llvm-project#102172.
  • It's worth noting that the default ABI choices that Clang makes for m68k-linux-gnu are different from the ones that GCC does; in particular, Clang defaults to -malign-int while GCC does not. We'll stick with the Clang default for now, but this makes us incompatible with at least the Debian m68k port, which is fairly problematic since AFAIK that's the only active m68k Linux distro. (Obligatory plug for RFC/Proposal: Turning Zig target triples into quadruples #20690.)
  • While working on this, it became clear that the spir/spir64 removal in std.Target: Remove more dead OS/architecture tags #20870 was too hasty. These tags are actually still used in target triples like spir-unknown-unknown which means to target the OpenCL SPIR environment and emit SPIR-V bytecode (no, not SPIR bytecode). This of course means that they really represent an environment/ABI now, not real "architectures". So the sensible thing to do is to reintroduce spir as an Abi tag that can be used as spirv[32,64]-opencl-spir. I'll do this in a follow-up PR.

alexrp added 14 commits August 6, 2024 20:17
CPU feature set has nothing to do with ABI choice; the pointer bit width is
determined only by looking at the choice of sparc vs sparc64.
This value was correct for the old SPIR, but not for SPIR-V.
This value was correct for the old SPIR, but not for SPIR-V.
…t purposes.

This is arbitrary since spirv (as opposed to spirv32/spirv64) refers to the
version with logical memory layout, i.e. no 'real' pointers. This change at
least matches what clang does.
@alexrp
Copy link
Member Author

alexrp commented Aug 6, 2024

cc @Snektron for the GPU bits, @koachan for the sparc bits.

@alexrp
Copy link
Member Author

alexrp commented Aug 6, 2024

By the way, the methodology here was just:

zig run generate_c_size_and_align_checks.zig -- <zig triple> | clang --target=<clang triple> -fsyntax-only -xc -

@andrewrk andrewrk merged commit c8a226a into ziglang:master Aug 6, 2024
10 checks passed
@alexrp alexrp deleted the size-align-fixes branch August 6, 2024 23:08
andrewrk added a commit that referenced this pull request Aug 12, 2024
Follow-up on `std.Target` GPU changes in #20960
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants