zig icon indicating copy to clipboard operation
zig copied to clipboard

stage 2: Update `CType` size/alignment

Open topolarity opened this issue 1 year ago • 3 comments

These updates were made by testing all supported arch-OS-ABI combinations against the sizeof/_Alignof reported by Clang and correcting any discrepancies. There's bound to be some incorrect entries in here where Clang's support for a target is limited (i386-android is a recent example), but this should be a good start.

One interesting discovery along the way is that there are 32-bit ABI's for 64-bit architectures where void * is 32-bits: gnux32, muslx32, and gnuabin32. (This PR does nothing to support those)

P.S. Here's the full test.

topolarity avatar Oct 22 '22 02:10 topolarity

I'm surprised by the linker errors. Are we perhaps missing custom re-exports with renames of globals in compiler-rt for some 32bit targets?

kubkon avatar Oct 22 '22 14:10 kubkon

I'm surprised by the linker errors. Are we perhaps missing custom re-exports with renames of globals in compiler-rt for some 32bit targets?

The problem is that on PPC, we only export "PPC-style" symbol names but the Zig LLVM backend lowers softfloat calls to the standard compiler-rt names. I ran into the same problem on https://github.com/ziglang/zig/pull/13100

Assuming it sounds alright to you, the simplest fix is just to re-export the symbols under both names.

topolarity avatar Oct 22 '22 20:10 topolarity

I'm surprised by the linker errors. Are we perhaps missing custom re-exports with renames of globals in compiler-rt for some 32bit targets?

The problem is that on PPC, we only export "PPC-style" symbol names but the Zig LLVM backend lowers softfloat calls to the standard compiler-rt names. I ran into the same problem on #13100

Assuming it sounds alright to you, the simplest fix is just to re-export the symbols under both names.

Yep, my thinking exactly!

kubkon avatar Oct 22 '22 21:10 kubkon