diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-04 06:53:14 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-04 06:54:10 +0200 |
| commit | 0ccd2b0c5cdf4bee706b4a9341b97f786b19a978 (patch) | |
| tree | 1c6b62ef1ea5794c8ca0d71d7f4f37680c683bc4 /src/Compilation/Config.zig | |
| parent | a81fb5fb76131d0df3042f20e2d20a3b9216b254 (diff) | |
| download | zig-0ccd2b0c5cdf4bee706b4a9341b97f786b19a978.tar.gz zig-0ccd2b0c5cdf4bee706b4a9341b97f786b19a978.zip | |
compiler: Always dynamically link executables for Fuchsia.
Fuchsia only supports PIE executables, specifically ET_DYN.
https://fuchsia.dev/fuchsia-src/concepts/process/program_loading
Diffstat (limited to 'src/Compilation/Config.zig')
| -rw-r--r-- | src/Compilation/Config.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig index 3415acf33e..e2dea2b93f 100644 --- a/src/Compilation/Config.zig +++ b/src/Compilation/Config.zig @@ -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. |
