LLD: the driver functions now return "false" to mean "error"
This commit is contained in:
@@ -1186,9 +1186,9 @@ pub extern fn LLVMInitializeM68kAsmParser() void;
|
||||
pub extern fn LLVMInitializeCSKYAsmParser() void;
|
||||
pub extern fn LLVMInitializeVEAsmParser() void;
|
||||
|
||||
extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) c_int;
|
||||
extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) c_int;
|
||||
extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) c_int;
|
||||
extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool;
|
||||
extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool;
|
||||
extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool;
|
||||
|
||||
pub const LinkCOFF = ZigLLDLinkCOFF;
|
||||
pub const LinkELF = ZigLLDLinkELF;
|
||||
|
||||
@@ -4481,10 +4481,11 @@ pub fn lldMain(
|
||||
defer arena_instance.deinit();
|
||||
const arena = arena_instance.allocator();
|
||||
|
||||
// Convert the args to the format llvm-ar expects.
|
||||
// Convert the args to the format LLD expects.
|
||||
// We intentionally shave off the zig binary at args[0].
|
||||
const argv = try argsCopyZ(arena, args[1..]);
|
||||
const exit_code = rc: {
|
||||
// "If an error occurs, false will be returned."
|
||||
const ok = rc: {
|
||||
const llvm = @import("codegen/llvm/bindings.zig");
|
||||
const argc = @intCast(c_int, argv.len);
|
||||
if (mem.eql(u8, args[1], "ld.lld")) {
|
||||
@@ -4497,7 +4498,7 @@ pub fn lldMain(
|
||||
unreachable;
|
||||
}
|
||||
};
|
||||
return @bitCast(u8, @truncate(i8, exit_code));
|
||||
return @boolToInt(!ok);
|
||||
}
|
||||
|
||||
const ArgIteratorResponseFile = process.ArgIteratorGeneral(.{ .comments = true, .single_quotes = true });
|
||||
|
||||
@@ -1335,17 +1335,17 @@ bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size
|
||||
return false;
|
||||
}
|
||||
|
||||
int ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output) {
|
||||
bool ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output) {
|
||||
std::vector<const char *> args(argv, argv + argc);
|
||||
return lld::coff::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output);
|
||||
}
|
||||
|
||||
int ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early, bool disable_output) {
|
||||
bool ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early, bool disable_output) {
|
||||
std::vector<const char *> args(argv, argv + argc);
|
||||
return lld::elf::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output);
|
||||
}
|
||||
|
||||
int ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early, bool disable_output) {
|
||||
bool ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early, bool disable_output) {
|
||||
std::vector<const char *> args(argv, argv + argc);
|
||||
return lld::wasm::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output);
|
||||
}
|
||||
|
||||
@@ -543,9 +543,9 @@ ZIG_EXTERN_C const char *ZigLLVMGetVendorTypeName(enum ZigLLVM_VendorType vendor
|
||||
ZIG_EXTERN_C const char *ZigLLVMGetOSTypeName(enum ZigLLVM_OSType os);
|
||||
ZIG_EXTERN_C const char *ZigLLVMGetEnvironmentTypeName(enum ZigLLVM_EnvironmentType abi);
|
||||
|
||||
ZIG_EXTERN_C int ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output);
|
||||
ZIG_EXTERN_C int ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early, bool disable_output);
|
||||
ZIG_EXTERN_C int ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early, bool disable_output);
|
||||
ZIG_EXTERN_C bool ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output);
|
||||
ZIG_EXTERN_C bool ZigLLDLinkELF(int argc, const char **argv, bool can_exit_early, bool disable_output);
|
||||
ZIG_EXTERN_C bool ZigLLDLinkWasm(int argc, const char **argv, bool can_exit_early, bool disable_output);
|
||||
|
||||
ZIG_EXTERN_C bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size_t file_name_count,
|
||||
enum ZigLLVM_OSType os_type);
|
||||
|
||||
Reference in New Issue
Block a user