| ... | @@ -393,7 +393,10 @@ const extern_getauxval = switch (builtin.zig_backend) { | ... | @@ -393,7 +393,10 @@ const extern_getauxval = switch (builtin.zig_backend) { |
| 393 | }; | 393 | }; |
| 394 | | 394 | |
| 395 | comptime { | 395 | comptime { |
| 396 | if (extern_getauxval) { | 396 | const root = @import("root"); |
| | 397 | // Export this only when building executable, otherwise it is overriding |
| | 398 | // the libc implementation |
| | 399 | if (extern_getauxval and (builtin.output_mode == .Exe or @hasDecl(root, "main"))) { |
| 397 | @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .weak }); | 400 | @export(getauxvalImpl, .{ .name = "getauxval", .linkage = .weak }); |
| 398 | } | 401 | } |
| 399 | } | 402 | } |