compiler: Switch default code model for loongarch64 to medium.
LLVM 21 will change the default, but we're making the change now to make building Zig for loongarch64 less painful. https://github.com/llvm/llvm-project/pull/132173
This commit is contained in:
18
build.zig
18
build.zig
@@ -668,24 +668,6 @@ fn addCompilerStep(b: *std.Build, options: AddCompilerStepOptions) *std.Build.St
|
||||
.strip = options.strip,
|
||||
.sanitize_thread = options.sanitize_thread,
|
||||
.single_threaded = options.single_threaded,
|
||||
.code_model = switch (options.target.result.cpu.arch) {
|
||||
// NB:
|
||||
// For loongarch, LLVM supports only small, medium and large
|
||||
// code model. If we don't explicitly specify the code model,
|
||||
// the default value `small' will be used.
|
||||
//
|
||||
// Since zig binary itself is relatively large, using a `small'
|
||||
// code model will cause
|
||||
//
|
||||
// relocation R_LARCH_B26 out of range
|
||||
//
|
||||
// error when linking a loongarch32/loongarch64 zig binary.
|
||||
//
|
||||
// Here we explicitly set code model to `medium' to avoid this
|
||||
// error.
|
||||
.loongarch32, .loongarch64 => .medium,
|
||||
else => .default,
|
||||
},
|
||||
.valgrind = options.valgrind,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user