-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Conversion functions to/from ELF/COFF machine types need rethinking #20771
Labels
standard library
This issue involves writing Zig code for the standard library.
Milestone
Comments
andrewrk
added
the
standard library
This issue involves writing Zig code for the standard library.
label
Jul 26, 2024
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 10, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 12, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 12, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 12, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 13, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 13, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 15, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 19, 2024
These are fundamentally incapable of producing accurate information for reasons I've laid out in ziglang#20771. Since our only use of these functions is to check that object files have the correct machine type, and since ziglang#21020 made `std.Target.to{Coff,Elf}Machine()` more accurate, just switch these checks over to that and compare the machine type tags instead. Closes ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 23, 2024
These are fundamentally incapable of producing accurate information for reasons I've laid out in ziglang#20771. Since our only use of these functions is to check that object files have the correct machine type, and since ziglang#21020 made `std.Target.to{Coff,Elf}Machine()` more accurate, just switch these checks over to that and compare the machine type tags instead. Closes ziglang#20771.
alexrp
added a commit
to alexrp/zig
that referenced
this issue
Aug 23, 2024
These are fundamentally incapable of producing accurate information for reasons I've laid out in ziglang#20771. Since our only use of these functions is to check that object files have the correct machine type, and since ziglang#21020 made `std.Target.to{Coff,Elf}Machine()` more accurate, just switch these checks over to that and compare the machine type tags instead. Closes ziglang#20771.
richerfu
pushed a commit
to richerfu/zig
that referenced
this issue
Oct 28, 2024
This enables them to give more correct results. Contributes to ziglang#20771.
richerfu
pushed a commit
to richerfu/zig
that referenced
this issue
Oct 28, 2024
These are fundamentally incapable of producing accurate information for reasons I've laid out in ziglang#20771. Since our only use of these functions is to check that object files have the correct machine type, and since ziglang#21020 made `std.Target.to{Coff,Elf}Machine()` more accurate, just switch these checks over to that and compare the machine type tags instead. Closes ziglang#20771.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zig/lib/std/Target.zig
Line 1149 in fa95c89
zig/lib/std/Target.zig
Line 1203 in fa95c89
zig/lib/std/coff.zig
Line 1044 in fa95c89
These 3 functions are all problematic for the simple reason that an
std.Target.Cpu.Arch
value is not enough information to do the correct mapping. At the very least, anstd.Target.Abi
value is also needed. All current call sites in the repo have a fullstd.Target
available, so this should be relatively easy to fix.zig/lib/std/coff.zig
Line 1061 in fa95c89
zig/lib/std/elf.zig
Line 1637 in fa95c89
These suffer from a similar problem: To do a sensible mapping, they also need to return an ABI value. However, while it's possible to go from an
Arch
+Abi
to an ELF or COFF machine type, the reverse is not true; these functions can't possibly decide between glibc and muslAbi
values, for example. This is another good argument in favor of #20690 (splitting libc and ABI), but we should probably come up with some sort of interim solution - perhaps anArchAbi
enum that identifies the ABI divorced from libc.The text was updated successfully, but these errors were encountered: