aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/build.zig6
-rw-r--r--lib/std/builtin.zig15
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index d310f53c06..f535b022af 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -1149,6 +1149,7 @@ pub const LibExeObjStep = struct {
name_prefix: []const u8,
filter: ?[]const u8,
single_threaded: bool,
+ code_model: builtin.CodeModel = .default,
root_src: ?FileSource,
out_h_filename: []const u8,
@@ -1970,6 +1971,11 @@ pub const LibExeObjStep = struct {
try zig_args.append("-fno-sanitize-c");
}
+ if (self.code_model != .default) {
+ try zig_args.append("-code-model");
+ try zig_args.append(@tagName(self.code_model));
+ }
+
switch (self.target) {
.Native => {},
.Cross => |cross| {
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index d65b9b08ee..d8f24753d3 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -91,6 +91,21 @@ pub const AtomicRmwOp = enum {
Min,
};
+/// 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,
+};
+
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub const Mode = enum {