Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -1078,6 +1078,11 @@ Config->is64() && Args.hasFlag(OPT_highentropyva, OPT_highentropyva_no, true); + if (!Config->DynamicBase && + (Config->Machine == ARMNT || Config->Machine == ARM64)) + error("/dynamicbase:no is not compatible with " + + machineToStr(Config->Machine)); + // Handle /entry and /dll if (auto *Arg = Args.getLastArg(OPT_entry)) { Config->Entry = addUndefined(mangle(Arg->getValue())); Index: test/COFF/arm64-dynamicbase.s =================================================================== --- test/COFF/arm64-dynamicbase.s +++ test/COFF/arm64-dynamicbase.s @@ -0,0 +1,8 @@ +// REQUIRES: aarch64 +// RUN: llvm-mc -filetype=obj -triple=aarch64-windows %s -o %t.obj +// RUN: not lld-link -entry:_start -subsystem:console %t.obj -out:%t.exe -dynamicbase:no 2>&1 | FileCheck %s + .globl _start +_start: + ret + +# CHECK: dynamicbase:no is not compatible with arm64 Index: test/COFF/armnt-dynamicbase.test =================================================================== --- test/COFF/armnt-dynamicbase.test +++ test/COFF/armnt-dynamicbase.test @@ -0,0 +1,3 @@ +# RUN: yaml2obj < %p/Inputs/armnt-executable.obj.yaml > %t.obj +# RUN: not lld-link /out:%t.exe /entry:mainCRTStartup /subsystem:console %t.obj /dynamicbase:no 2>&1 | FileCheck %s +# CHECK: dynamicbase:no is not compatible with arm