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

eliminate the "default" code model #18241

Open
andrewrk opened this issue Dec 9, 2023 · 0 comments
Open

eliminate the "default" code model #18241

andrewrk opened this issue Dec 9, 2023 · 0 comments
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior.
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Dec 9, 2023

zig/lib/std/builtin.zig

Lines 116 to 129 in 69195d0

/// The code model puts constraints on the location of symbols and the size of code and data.
/// The selection of a code model is a trade off on speed and restrictions that needs to be selected on a per application basis to meet its requirements.
/// A slightly more detailed explanation can be found in (for example) the [System V Application Binary Interface (x86_64)](https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf) 3.5.1.
///
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub const CodeModel = enum {
default,
tiny,
small,
kernel,
medium,
large,
};

according to https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/x86-64-psABI-1.0.pdf page 37, "default" is not an actual code model. This is out-of-bound data. The enum should not contain it. Instead, the type ?std.builtin.CodeModel should be used to represent the possibility of default.

@andrewrk andrewrk added the breaking Implementing this issue could cause existing code to no longer compile or have different behavior. label Dec 9, 2023
@andrewrk andrewrk added this to the 0.13.0 milestone Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior.
Projects
None yet
Development

No branches or pull requests

1 participant