diff options
| author | Shankar Easwaran <shankare@codeaurora.org> | 2014-11-13 03:25:38 +0000 |
|---|---|---|
| committer | Shankar Easwaran <shankare@codeaurora.org> | 2014-11-13 03:25:38 +0000 |
| commit | b43804b6f43749faa1bbedb09794f322c9a7f17b (patch) | |
| tree | ddbe57dd6ff7218f1813cdedaffd2de47378b989 | |
| parent | 611e585f286d140f0c7da0ba7c3a578af8902f70 (diff) | |
| download | bcm5719-llvm-b43804b6f43749faa1bbedb09794f322c9a7f17b.tar.gz bcm5719-llvm-b43804b6f43749faa1bbedb09794f322c9a7f17b.zip | |
[ELF] Fix max-page-size option.
The user can use the max-page-size option and set the maximum page size. Dont
check for maximum allowed values for page size, as its what the kernel is
configured with.
Fix the test as well.
llvm-svn: 221858
| -rw-r--r-- | lld/include/lld/ReaderWriter/ELFLinkingContext.h | 10 | ||||
| -rw-r--r-- | lld/lib/Driver/GnuLdDriver.cpp | 3 | ||||
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp | 3 | ||||
| -rw-r--r-- | lld/test/elf/X86_64/maxpagesize.test | 9 |
4 files changed, 13 insertions, 12 deletions
diff --git a/lld/include/lld/ReaderWriter/ELFLinkingContext.h b/lld/include/lld/ReaderWriter/ELFLinkingContext.h index 9bcb8f694c1..59031ed4864 100644 --- a/lld/include/lld/ReaderWriter/ELFLinkingContext.h +++ b/lld/include/lld/ReaderWriter/ELFLinkingContext.h @@ -61,16 +61,13 @@ public: // Page size. virtual uint64_t getPageSize() const { - if (_maxPageSizeOptionSet) - return _maxPageSize; + if (_maxPageSize) + return *_maxPageSize; return 0x1000; } virtual void setMaxPageSize(uint64_t pagesize) { _maxPageSize = pagesize; - _maxPageSizeOptionSet = true; } - virtual uint64_t maxPageSize() const { return _maxPageSize; } - OutputMagic getOutputMagic() const { return _outputMagic; } uint16_t getOutputELFType() const { return _outputELFType; } uint16_t getOutputMachine() const; @@ -321,8 +318,7 @@ protected: bool _mergeRODataToTextSegment; bool _demangle; bool _alignSegments; - bool _maxPageSizeOptionSet; - uint64_t _maxPageSize; + llvm::Optional<uint64_t> _maxPageSize; OutputMagic _outputMagic; StringRefVector _inputSearchPaths; diff --git a/lld/lib/Driver/GnuLdDriver.cpp b/lld/lib/Driver/GnuLdDriver.cpp index 9ca5a2073e8..9e1508b9b26 100644 --- a/lld/lib/Driver/GnuLdDriver.cpp +++ b/lld/lib/Driver/GnuLdDriver.cpp @@ -495,8 +495,7 @@ bool GnuLdDriver::parse(int argc, const char *argv[], // modulo of the default page size. if ((!parseZOption(extOpt, maxPageSize)) || (maxPageSize < ctx->getPageSize()) || - (maxPageSize > ctx->maxPageSize()) || - (!maxPageSize % ctx->maxPageSize())) { + (!maxPageSize % ctx->getPageSize())) { diagnostics << "invalid option: " << extOpt << "\n"; return false; } diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp index e00424b5436..0eccf64e1a5 100644 --- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp +++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp @@ -62,8 +62,7 @@ ELFLinkingContext::ELFLinkingContext( _mergeCommonStrings(false), _runLayoutPass(true), _useShlibUndefines(true), _dynamicLinkerArg(false), _noAllowDynamicLibraries(false), _mergeRODataToTextSegment(true), - _demangle(true), _alignSegments(true), _maxPageSizeOptionSet(false), - _maxPageSize(0x10000), _outputMagic(OutputMagic::DEFAULT), + _demangle(true), _alignSegments(true), _outputMagic(OutputMagic::DEFAULT), _sysrootPath("") {} void ELFLinkingContext::addPasses(PassManager &pm) { diff --git a/lld/test/elf/X86_64/maxpagesize.test b/lld/test/elf/X86_64/maxpagesize.test index a32eaefb96f..00774b52558 100644 --- a/lld/test/elf/X86_64/maxpagesize.test +++ b/lld/test/elf/X86_64/maxpagesize.test @@ -8,11 +8,12 @@ # RUN: --no-align-segments --noinhibit-exec -z max-page-size=0 # RUN: not lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \ # RUN: --no-align-segments --noinhibit-exec -z max-page-size=0xFF -# RUN: not lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \ +# RUN: lld -flavor gnu -target x86_64 %t.o -o %t1.exe -static \ # RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x100000 # RUN: lld -flavor gnu -target x86_64 %t.o -o %t.exe -static \ # RUN: --no-align-segments --noinhibit-exec -z max-page-size=0x10000 # RUN: llvm-readobj -program-headers %t.exe | FileCheck %s +# RUN: llvm-readobj -program-headers %t1.exe | FileCheck %s -check-prefix=CHECKLARGE # #CHECK: VirtualAddress: 0x400000 #CHECK: PhysicalAddress: 0x400000 @@ -20,6 +21,12 @@ #CHECK: VirtualAddress: 0x400178 #CHECK: PhysicalAddress: 0x400178 #CHECK: Alignment: 65536 +#CHECKLARGE: VirtualAddress: 0x400000 +#CHECKLARGE: PhysicalAddress: 0x400000 +#CHECKLARGE: Alignment: 1048576 +#CHECKLARGE: VirtualAddress: 0x400178 +#CHECKLARGE: PhysicalAddress: 0x400178 +#CHECKLARGE: Alignment: 1048576 # object --- |

