diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-09-29 14:46:40 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-09-29 14:48:12 -0700 |
| commit | 0da7c4b0c8a2a2fe0862f7757bc5976342d51dc8 (patch) | |
| tree | a009c84f49be7b52e13964014222cb960915d136 /src/Compilation.zig | |
| parent | 7c0ee423859739b5484de8de867006ead787fb66 (diff) | |
| download | zig-0da7c4b0c8a2a2fe0862f7757bc5976342d51dc8.tar.gz zig-0da7c4b0c8a2a2fe0862f7757bc5976342d51dc8.zip | |
improve stage2 COFF LLD linking
* change some {} to be {s} to gain type safety
* fix libraries being libfoo.lib instead of foo.lib for COFF
* when linking mingw-w64, add the "always link" libs so that we
generate DLL import .lib files for them as the linker code relies on.
* COFF LLD linker does not support -r so we do a file copy as an
alternative to the -r thing that ELF linking does.
I will file an issue for the corresponding TODO upon merging this
branch, to look into an optimization that possibly elides this copy
when the source and destination are both cache directories.
* add a CLI error message when trying to link multiple objects into one
and using COFF object format.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index c3cda196de..9cc2c3aa5c 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -879,6 +879,11 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { try comp.work_queue.ensureUnusedCapacity(static_lib_jobs.len + 1); comp.work_queue.writeAssumeCapacity(&static_lib_jobs); comp.work_queue.writeItemAssumeCapacity(crt_job); + + // When linking mingw-w64 there are some import libs we always need. + for (mingw.always_link_libs) |name| { + try comp.bin_file.options.system_libs.put(comp.gpa, name, .{}); + } } // Generate Windows import libs. if (comp.getTarget().os.tag == .windows) { |
