summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 0801f9d94d2..a967a7fe127 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -535,6 +535,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
Config->EntrySym = Symtab.addUndefined(S);
}
+ // Initialize Config->ImageBase.
if (auto *Arg = Args.getLastArg(OPT_image_base)) {
StringRef S = Arg->getValue();
if (S.getAsInteger(0, Config->ImageBase))
@@ -542,7 +543,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
else if ((Config->ImageBase % Target->PageSize) != 0)
warning(Arg->getSpelling() + ": address isn't multiple of page size");
} else {
- Config->ImageBase = Target->getImageBase();
+ Config->ImageBase = Config->Pic ? 0 : Target->DefaultImageBase;
}
for (std::unique_ptr<InputFile> &F : Files)
OpenPOWER on IntegriCloud