aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-12-15 17:53:29 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-12-15 18:34:27 -0700
commite977455f7c5693369d547c4d9b2e0b902f578d65 (patch)
tree1a07981c76145e6eb265ab29e0fccc3d0d0a3b77 /src/Compilation.zig
parent59a3a27a6828af96cf579417a194fd1ee35fa0c7 (diff)
downloadzig-e977455f7c5693369d547c4d9b2e0b902f578d65.tar.gz
zig-e977455f7c5693369d547c4d9b2e0b902f578d65.zip
glibc: improve RISC-V support
* omit crti.o / crtn.o for this architecture * add missing entry.h header from upstream
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index d87ad78a71..236a344027 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1586,7 +1586,17 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
// If we need to build glibc for the target, add work items for it.
// We go through the work queue so that building can be done in parallel.
if (comp.wantBuildGLibCFromSource()) {
- try comp.addBuildingGLibCJobs();
+ if (glibc.needsCrtiCrtn(comp.getTarget())) {
+ try comp.work_queue.write(&[_]Job{
+ .{ .glibc_crt_file = .crti_o },
+ .{ .glibc_crt_file = .crtn_o },
+ });
+ }
+ try comp.work_queue.write(&[_]Job{
+ .{ .glibc_crt_file = .scrt1_o },
+ .{ .glibc_crt_file = .libc_nonshared_a },
+ .{ .glibc_shared_objects = {} },
+ });
}
if (comp.wantBuildMuslFromSource()) {
try comp.work_queue.ensureUnusedCapacity(6);
@@ -4046,16 +4056,6 @@ pub fn get_libc_crt_file(comp: *Compilation, arena: Allocator, basename: []const
return full_path;
}
-fn addBuildingGLibCJobs(comp: *Compilation) !void {
- try comp.work_queue.write(&[_]Job{
- .{ .glibc_crt_file = .crti_o },
- .{ .glibc_crt_file = .crtn_o },
- .{ .glibc_crt_file = .scrt1_o },
- .{ .glibc_crt_file = .libc_nonshared_a },
- .{ .glibc_shared_objects = {} },
- });
-}
-
fn wantBuildLibCFromSource(comp: Compilation) bool {
const is_exe_or_dyn_lib = switch (comp.bin_file.options.output_mode) {
.Obj => false,