[lld] r221584 - [ELF] Support -z max-page-size option

Shankar Easwaran shankare at codeaurora.org
Mon Nov 10 17:55:11 PST 2014


On 11/10/2014 7:52 PM, Rui Ueyama wrote:
> On Mon, Nov 10, 2014 at 6:54 AM, Shankar Easwaran <shankare at codeaurora.org>
> wrote:
>
>> Author: shankare
>> Date: Mon Nov 10 08:54:43 2014
>> New Revision: 221584
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=221584&view=rev
>> Log:
>> [ELF] Support -z max-page-size option
>>
>> The GNU linker allows the user to change the page size by using the option
>> -z
>> max-page-size.
>>
>> Modified:
>>      lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>>      lld/trunk/lib/Driver/GnuLdDriver.cpp
>>      lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
>>
>> Modified: lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h?rev=221584&r1=221583&r2=221584&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h (original)
>> +++ lld/trunk/include/lld/ReaderWriter/ELFLinkingContext.h Mon Nov 10
>> 08:54:43 2014
>> @@ -58,7 +58,19 @@ public:
>>     };
>>
>>     llvm::Triple getTriple() const { return _triple; }
>> -  virtual uint64_t getPageSize() const { return 0x1000; }
>> +
>> +  // Page size.
>> +  virtual uint64_t getPageSize() const {
>> +    if (_maxPageSizeOptionSet)
>> +      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;
>> @@ -308,6 +320,9 @@ protected:
>>     bool _mergeRODataToTextSegment;
>>     bool _demangle;
>>     bool _alignSegments;
>> +  bool _maxPageSizeOptionSet;
>> +  uint64_t _maxPageSize;
>>
> Maybe this is a place you want to use llvm::Optional<uint64_t> instead of
> having two fields for one value?
Sure, thanks for the info, much cleaner!

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-commits mailing list