mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
compiler: Always dynamically link executables for Fuchsia.
Fuchsia only supports PIE executables, specifically ET_DYN. https://fuchsia.dev/fuchsia-src/concepts/process/program_loading
This commit is contained in:
parent
a81fb5fb76
commit
0ccd2b0c5c
@ -135,6 +135,7 @@ pub const ResolveError = error{
|
||||
LibCppRequiresLibC,
|
||||
LibUnwindRequiresLibC,
|
||||
TargetCannotDynamicLink,
|
||||
TargetCannotStaticLinkExecutables,
|
||||
LibCRequiresDynamicLinking,
|
||||
SharedLibrariesRequireDynamicLinking,
|
||||
ExportMemoryAndDynamicIncompatible,
|
||||
@ -360,6 +361,10 @@ pub fn resolve(options: Options) ResolveError!Config {
|
||||
if (options.link_mode == .dynamic) return error.TargetCannotDynamicLink;
|
||||
break :b .static;
|
||||
}
|
||||
if (target.os.tag == .fuchsia and options.output_mode == .Exe) {
|
||||
if (options.link_mode == .static) return error.TargetCannotStaticLinkExecutables;
|
||||
break :b .dynamic;
|
||||
}
|
||||
if (explicitly_exe_or_dyn_lib and link_libc and
|
||||
(target_util.osRequiresLibC(target) or
|
||||
// For these libcs, Zig can only provide dynamic libc when cross-compiling.
|
||||
|
||||
@ -4118,6 +4118,7 @@ fn createModule(
|
||||
error.LibCppRequiresLibC => fatal("libc++ requires linking libc", .{}),
|
||||
error.LibUnwindRequiresLibC => fatal("libunwind requires linking libc", .{}),
|
||||
error.TargetCannotDynamicLink => fatal("dynamic linking unavailable on the specified target", .{}),
|
||||
error.TargetCannotStaticLinkExecutables => fatal("static linking of executables unavailable on the specified target", .{}),
|
||||
error.LibCRequiresDynamicLinking => fatal("libc of the specified target requires dynamic linking", .{}),
|
||||
error.SharedLibrariesRequireDynamicLinking => fatal("using shared libraries requires dynamic linking", .{}),
|
||||
error.ExportMemoryAndDynamicIncompatible => fatal("exporting memory is incompatible with dynamic linking", .{}),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user