mirror of
https://github.com/ziglang/zig.git
synced 2025-12-18 12:13:20 +00:00
parent
5d8bc56ab6
commit
aa76ca2931
@ -1037,13 +1037,24 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
|
|||||||
|
|
||||||
const sysroot = options.sysroot orelse libc_dirs.sysroot;
|
const sysroot = options.sysroot orelse libc_dirs.sysroot;
|
||||||
|
|
||||||
const must_pie = target_util.requiresPIE(options.target);
|
const pie: bool = pie: {
|
||||||
const pie: bool = if (options.want_pie) |explicit| pie: {
|
if (options.output_mode != .Exe) {
|
||||||
if (!explicit and must_pie) {
|
if (options.want_pie == true) return error.OutputModeForbidsPie;
|
||||||
return error.TargetRequiresPIE;
|
break :pie false;
|
||||||
}
|
}
|
||||||
break :pie explicit;
|
if (target_util.requiresPIE(options.target)) {
|
||||||
} else must_pie or tsan;
|
if (options.want_pie == false) return error.TargetRequiresPie;
|
||||||
|
break :pie true;
|
||||||
|
}
|
||||||
|
if (tsan) {
|
||||||
|
if (options.want_pie == false) return error.TsanRequiresPie;
|
||||||
|
break :pie true;
|
||||||
|
}
|
||||||
|
if (options.want_pie) |want_pie| {
|
||||||
|
break :pie want_pie;
|
||||||
|
}
|
||||||
|
break :pie false;
|
||||||
|
};
|
||||||
|
|
||||||
const must_pic: bool = b: {
|
const must_pic: bool = b: {
|
||||||
if (target_util.requiresPIC(options.target, link_libc))
|
if (target_util.requiresPIC(options.target, link_libc))
|
||||||
@ -6533,7 +6544,7 @@ fn buildOutputFromZig(
|
|||||||
.want_tsan = false,
|
.want_tsan = false,
|
||||||
.want_unwind_tables = comp.bin_file.options.eh_frame_hdr,
|
.want_unwind_tables = comp.bin_file.options.eh_frame_hdr,
|
||||||
.want_pic = comp.bin_file.options.pic,
|
.want_pic = comp.bin_file.options.pic,
|
||||||
.want_pie = comp.bin_file.options.pie,
|
.want_pie = null,
|
||||||
.emit_h = null,
|
.emit_h = null,
|
||||||
.strip = comp.compilerRtStrip(),
|
.strip = comp.compilerRtStrip(),
|
||||||
.is_native_os = comp.bin_file.options.is_native_os,
|
.is_native_os = comp.bin_file.options.is_native_os,
|
||||||
@ -6608,7 +6619,7 @@ pub fn build_crt_file(
|
|||||||
.want_valgrind = false,
|
.want_valgrind = false,
|
||||||
.want_tsan = false,
|
.want_tsan = false,
|
||||||
.want_pic = comp.bin_file.options.pic,
|
.want_pic = comp.bin_file.options.pic,
|
||||||
.want_pie = comp.bin_file.options.pie,
|
.want_pie = null,
|
||||||
.want_lto = switch (output_mode) {
|
.want_lto = switch (output_mode) {
|
||||||
.Lib => comp.bin_file.options.lto,
|
.Lib => comp.bin_file.options.lto,
|
||||||
.Obj, .Exe => false,
|
.Obj, .Exe => false,
|
||||||
|
|||||||
@ -248,7 +248,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void {
|
|||||||
.want_valgrind = false,
|
.want_valgrind = false,
|
||||||
.want_tsan = comp.bin_file.options.tsan,
|
.want_tsan = comp.bin_file.options.tsan,
|
||||||
.want_pic = comp.bin_file.options.pic,
|
.want_pic = comp.bin_file.options.pic,
|
||||||
.want_pie = comp.bin_file.options.pie,
|
.want_pie = null,
|
||||||
.want_lto = comp.bin_file.options.lto,
|
.want_lto = comp.bin_file.options.lto,
|
||||||
.function_sections = comp.bin_file.options.function_sections,
|
.function_sections = comp.bin_file.options.function_sections,
|
||||||
.emit_h = null,
|
.emit_h = null,
|
||||||
@ -411,7 +411,7 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void {
|
|||||||
.want_valgrind = false,
|
.want_valgrind = false,
|
||||||
.want_tsan = comp.bin_file.options.tsan,
|
.want_tsan = comp.bin_file.options.tsan,
|
||||||
.want_pic = comp.bin_file.options.pic,
|
.want_pic = comp.bin_file.options.pic,
|
||||||
.want_pie = comp.bin_file.options.pie,
|
.want_pie = null,
|
||||||
.want_lto = comp.bin_file.options.lto,
|
.want_lto = comp.bin_file.options.lto,
|
||||||
.function_sections = comp.bin_file.options.function_sections,
|
.function_sections = comp.bin_file.options.function_sections,
|
||||||
.emit_h = null,
|
.emit_h = null,
|
||||||
|
|||||||
@ -104,7 +104,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: *std.Progress.Node) !void {
|
|||||||
.want_valgrind = false,
|
.want_valgrind = false,
|
||||||
.want_tsan = false,
|
.want_tsan = false,
|
||||||
.want_pic = comp.bin_file.options.pic,
|
.want_pic = comp.bin_file.options.pic,
|
||||||
.want_pie = comp.bin_file.options.pie,
|
.want_pie = null,
|
||||||
// Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825
|
// Disable LTO to avoid https://github.com/llvm/llvm-project/issues/56825
|
||||||
.want_lto = false,
|
.want_lto = false,
|
||||||
.function_sections = comp.bin_file.options.function_sections,
|
.function_sections = comp.bin_file.options.function_sections,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user