[lld] r288974 - Use the correct MaxPageSize.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 7 12:29:46 PST 2016
Author: rafael
Date: Wed Dec 7 14:29:46 2016
New Revision: 288974
URL: http://llvm.org/viewvc/llvm-project?rev=288974&view=rev
Log:
Use the correct MaxPageSize.
Now Target->MaxPageSize is only used as the default value of
Config->MaxPageSize.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/test/ELF/image-base.s
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=288974&r1=288973&r2=288974&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Dec 7 14:29:46 2016
@@ -738,7 +738,7 @@ static uint64_t getImageBase(opt::InputA
error("-image-base: number expected, but got " + S);
return 0;
}
- if ((V % Target->MaxPageSize) != 0)
+ if ((V % Config->MaxPageSize) != 0)
warn("-image-base: address isn't multiple of page size: " + S);
return V;
}
@@ -758,6 +758,14 @@ template <class ELFT> void LinkerDriver:
ELFT::Is64Bits || Config->EMachine == EM_X86_64 || Config->MipsN32Abi;
Config->Mips64EL =
(Config->EMachine == EM_MIPS && Config->EKind == ELF64LEKind);
+
+ // Initialize Config->MaxPageSize. The default value is defined by
+ // each target.
+ Config->MaxPageSize =
+ getZOptionValue(Args, "max-page-size", Target->MaxPageSize);
+ if (!isPowerOf2_64(Config->MaxPageSize))
+ error("max-page-size: value isn't a power of 2");
+
Config->ImageBase = getImageBase(Args);
// Default output filename is "a.out" by the Unix tradition.
@@ -775,13 +783,6 @@ template <class ELFT> void LinkerDriver:
for (auto *Arg : Args.filtered(OPT_trace_symbol))
Symtab.trace(Arg->getValue());
- // Initialize Config->MaxPageSize. The default value is defined by
- // each target.
- Config->MaxPageSize =
- getZOptionValue(Args, "max-page-size", Target->MaxPageSize);
- if (!isPowerOf2_64(Config->MaxPageSize))
- error("max-page-size: value isn't a power of 2");
-
// Add all files to the symbol table. This will add almost all
// symbols that we need to the symbol table.
for (InputFile *F : Files)
Modified: lld/trunk/test/ELF/image-base.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/image-base.s?rev=288974&r1=288973&r2=288974&view=diff
==============================================================================
--- lld/trunk/test/ELF/image-base.s (original)
+++ lld/trunk/test/ELF/image-base.s Wed Dec 7 14:29:46 2016
@@ -3,6 +3,10 @@
# RUN: ld.lld -image-base=0x1000000 %t -o %t1
# RUN: llvm-readobj -program-headers %t1 | FileCheck %s
+# RUN: ld.lld -image-base=0x1000 -z max-page-size=0x2000 %t -o %t1 2>&1 | FileCheck --check-prefix=WARN %s
+# WARN: warning: -image-base: address isn't multiple of page size: 0x1000
+
+
.global _start
_start:
nop
More information about the llvm-commits
mailing list