| ... | @@ -2516,6 +2516,20 @@ fn buildOutputType( | ... | @@ -2516,6 +2516,20 @@ fn buildOutputType( |
| 2516 | stack_size = parseStackSize(linker_args_it.nextOrFatal()); | 2516 | stack_size = parseStackSize(linker_args_it.nextOrFatal()); |
| 2517 | } else if (mem.eql(u8, arg, "--image-base")) { | 2517 | } else if (mem.eql(u8, arg, "--image-base")) { |
| 2518 | image_base = parseImageBase(linker_args_it.nextOrFatal()); | 2518 | image_base = parseImageBase(linker_args_it.nextOrFatal()); |
| | 2519 | } else if (mem.eql(u8, arg, "--enable-auto-image-base") or |
| | 2520 | mem.eql(u8, arg, "--disable-auto-image-base")) |
| | 2521 | { |
| | 2522 | // `--enable-auto-image-base` is a flag that binutils added in ~2000 for MinGW. |
| | 2523 | // It does a hash of the file and uses that as part of the image base value. |
| | 2524 | // Presumably the idea was to avoid DLLs needing to be relocated when loaded. |
| | 2525 | // This is practically irrelevant today as all PEs produced since Windows Vista |
| | 2526 | // have ASLR enabled by default anyway, and Windows 10+ has Mandatory ASLR which |
| | 2527 | // doesn't even care what the PE file wants and relocates it anyway. |
| | 2528 | // |
| | 2529 | // Unfortunately, Libtool hardcodes usage of this archaic flag when targeting |
| | 2530 | // MinGW, so to make `zig cc` for that use case work, accept and ignore the |
| | 2531 | // flag, and warn the user that it has no effect. |
| | 2532 | warn("auto-image-base options are unimplemented and ignored", .{}); |
| 2519 | } else if (mem.eql(u8, arg, "-T") or mem.eql(u8, arg, "--script")) { | 2533 | } else if (mem.eql(u8, arg, "-T") or mem.eql(u8, arg, "--script")) { |
| 2520 | linker_script = linker_args_it.nextOrFatal(); | 2534 | linker_script = linker_args_it.nextOrFatal(); |
| 2521 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { | 2535 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { |