[PATCH] D41052: [LLD] [MinGW] Don't pass -dynamicbase:no by default for arm/arm64

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 13:04:25 PST 2017


mstorsjo added inline comments.


================
Comment at: MinGW/Driver.cpp:162-165
+  if (Args.getLastArgValue(OPT_m) == "thumb2pe" ||
+      Args.getLastArgValue(OPT_m) == "arm64pe") {
+    if (Args.hasArg(OPT_dynamicbase))
+      Add("-dynamicbase");
----------------
ruiu wrote:
> My understanding is passing `-dynamicbase:no` on arm/arm64 doesn't make sense and should be considered error. Don't you want to remove this special condition and handle all targets equally (so that the error would be reported if you pass `-dynamicbase:no` on arm/arm64)?
In the MinGW/GNU frontend, there is no `-dynamicbase:no` case. We have different behaviours in the COFF and MinGW frontends; in the COFF one we default to dynamicbase being enabled and it can be disabled with the `link.exe` option `-dynamicbase:no`.

In the MinGW frontend on the other hand, the default is off and it can be enabled with `--dynamicbase`. There is no option for disabling it (which in GNU options style would be `--no-dynamicbase`) AFAIK. Thus in the MinGW frontend, we pass `-dynamicbase:no` by default to the COFF linker, to match the behaviour of GNU ld. But for arm/arm64 (which GNU ld doesn't support at all for COFF), we obviously want to do things differently. Thus in this form, we either rely on the COFF linker default (on) implicitly if no flag is provided, or explicitly request it if the flag is set.


https://reviews.llvm.org/D41052





More information about the llvm-commits mailing list