diff options
author | Nico Weber <nicolasweber@gmx.de> | 2018-03-30 17:17:04 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2018-03-30 17:17:04 +0000 |
commit | a764379458516b353523155c2198b0b2fb0a0b64 (patch) | |
tree | d396709aad613bafb2389473f4acd4678d9bb579 | |
parent | d5cf5cf637918664c6de75c0685786acb2a2b92c (diff) | |
download | bcm5719-llvm-a764379458516b353523155c2198b0b2fb0a0b64.tar.gz bcm5719-llvm-a764379458516b353523155c2198b0b2fb0a0b64.zip |
[lld-link] Add comment explaining that /FIXED behavior is correct despite contradicting MSDN.
Also add a test for /FIXED.
https://reviews.llvm.org/D45087
llvm-svn: 328879
-rw-r--r-- | lld/COFF/Driver.cpp | 3 | ||||
-rw-r--r-- | lld/test/COFF/fixed.test | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index d81582ff6fe..02b2208160d 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -962,6 +962,9 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { DynamicBaseArg->getOption().getID() == OPT_dynamicbase_no) Config->DynamicBase = false; + // MSDN claims "/FIXED:NO is the default setting for a DLL, and /FIXED is the + // default setting for any other project type.", but link.exe defaults to + // /FIXED:NO for exe outputs as well. Match behavior, not docs. bool Fixed = Args.hasFlag(OPT_fixed, OPT_fixed_no, false); if (Fixed) { if (DynamicBaseArg && diff --git a/lld/test/COFF/fixed.test b/lld/test/COFF/fixed.test new file mode 100644 index 00000000000..6975fed0846 --- /dev/null +++ b/lld/test/COFF/fixed.test @@ -0,0 +1,24 @@ +# REQUIRES: x86 +# RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj +# +# RUN: lld-link %t.obj /fixed %p/Inputs/std32.lib /subsystem:console \ +# RUN: /entry:main@0 /debug /out:%t.fixed.exe +# RUN: llvm-readobj -file-headers %t.fixed.exe | \ +# RUN: FileCheck -check-prefix=EXEFIXED %s +# +# RUN: lld-link %t.obj %p/Inputs/std32.lib /subsystem:console \ +# RUN: /entry:main@0 /debug /out:%t.exe +# RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=EXEREL %s +# +# RUN: yaml2obj < %p/Inputs/export.yaml > %t.obj +# +# RUN: lld-link %t.obj /dll /fixed /debug /out:%t.fixed.dll +# RUN: llvm-readobj -file-headers %t.fixed.dll | FileCheck -check-prefix=DLLFIXED %s +# +# RUN: lld-link %t.obj /dll /debug /out:%t.dll +# RUN: llvm-readobj -file-headers %t.dll | FileCheck -check-prefix=DLLREL %s + +EXEFIXED-NOT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE +DLLFIXED-NOT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE +EXEREL: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE +DLLREL: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE |