diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-01-30 14:46:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-30 14:46:00 +0100 |
| commit | c5e34df555a98c51919eb45b0ab2a5ee3b37f4bf (patch) | |
| tree | a93b06b59814e38cd0498f7319ab59b3909427fc /src/main.zig | |
| parent | 5af7f7ba8bc991557549b05403707d8ccca5aaf3 (diff) | |
| download | zig-c5e34df555a98c51919eb45b0ab2a5ee3b37f4bf.tar.gz zig-c5e34df555a98c51919eb45b0ab2a5ee3b37f4bf.zip | |
main: accept and ignore auto-image-base linker options
Closes #19613.
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig index 716bf7c37f..205ce46d0a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2516,6 +2516,20 @@ fn buildOutputType( stack_size = parseStackSize(linker_args_it.nextOrFatal()); } else if (mem.eql(u8, arg, "--image-base")) { image_base = parseImageBase(linker_args_it.nextOrFatal()); + } else if (mem.eql(u8, arg, "--enable-auto-image-base") or + mem.eql(u8, arg, "--disable-auto-image-base")) + { + // `--enable-auto-image-base` is a flag that binutils added in ~2000 for MinGW. + // It does a hash of the file and uses that as part of the image base value. + // Presumably the idea was to avoid DLLs needing to be relocated when loaded. + // This is practically irrelevant today as all PEs produced since Windows Vista + // have ASLR enabled by default anyway, and Windows 10+ has Mandatory ASLR which + // doesn't even care what the PE file wants and relocates it anyway. + // + // Unfortunately, Libtool hardcodes usage of this archaic flag when targeting + // MinGW, so to make `zig cc` for that use case work, accept and ignore the + // flag, and warn the user that it has no effect. + warn("auto-image-base options are unimplemented and ignored", .{}); } else if (mem.eql(u8, arg, "-T") or mem.eql(u8, arg, "--script")) { linker_script = linker_args_it.nextOrFatal(); } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { |
