link: avoid creating stage2 llvm module when using stage1

This commit is contained in:
Andrew Kelley 2022-01-04 00:11:45 -07:00
parent ff66a18555
commit b6d6152e65
4 changed files with 13 additions and 4 deletions

View File

@ -409,7 +409,10 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*Coff {
},
.ptr_width = ptr_width,
};
if (build_options.have_llvm and options.use_llvm) {
const use_llvm = build_options.have_llvm and options.use_llvm;
const use_stage1 = build_options.is_stage1 and options.use_stage1;
if (use_llvm and !use_stage1) {
self.llvm_object = try LlvmObject.create(gpa, options);
}
return self;

View File

@ -304,7 +304,9 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*Elf {
},
.ptr_width = ptr_width,
};
if (build_options.have_llvm and options.use_llvm) {
const use_llvm = build_options.have_llvm and options.use_llvm;
const use_stage1 = build_options.is_stage1 and options.use_stage1;
if (use_llvm and !use_stage1) {
self.llvm_object = try LlvmObject.create(gpa, options);
}
return self;

View File

@ -396,7 +396,9 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*MachO {
.needs_prealloc = needs_prealloc,
};
if (build_options.have_llvm and options.use_llvm) {
const use_llvm = build_options.have_llvm and options.use_llvm;
const use_stage1 = build_options.is_stage1 and options.use_stage1;
if (use_llvm and !use_stage1) {
self.llvm_object = try LlvmObject.create(gpa, options);
}

View File

@ -145,7 +145,9 @@ pub fn createEmpty(gpa: Allocator, options: link.Options) !*Wasm {
.allocator = gpa,
},
};
if (build_options.have_llvm and options.use_llvm) {
const use_llvm = build_options.have_llvm and options.use_llvm;
const use_stage1 = build_options.is_stage1 and options.use_stage1;
if (use_llvm and !use_stage1) {
self.llvm_object = try LlvmObject.create(gpa, options);
}
return self;