Split LinkerDriver::link. NFC.

llvm-svn: 289078
This commit is contained in:
Rui Ueyama 2016-12-08 17:44:37 +00:00
parent 34bf8677a4
commit e4eadb6a24
1 changed files with 11 additions and 8 deletions

View File

@ -720,6 +720,16 @@ void LinkerDriver::inferMachineType() {
error("target emulation unknown: -m or at least one .o file required"); error("target emulation unknown: -m or at least one .o file required");
} }
// Parse -z max-page-size=<value>. The default value is defined by
// each target.
static uint64_t getMaxPageSize(opt::InputArgList &Args) {
uint64_t Val =
getZOptionValue(Args, "max-page-size", Target->DefaultMaxPageSize);
if (!isPowerOf2_64(Val))
error("max-page-size: value isn't a power of 2");
return Val;
}
// Parses -image-base option. // Parses -image-base option.
static uint64_t getImageBase(opt::InputArgList &Args) { static uint64_t getImageBase(opt::InputArgList &Args) {
// Use default if no -image-base option is given. // Use default if no -image-base option is given.
@ -755,14 +765,7 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
ELFT::Is64Bits || Config->EMachine == EM_X86_64 || Config->MipsN32Abi; ELFT::Is64Bits || Config->EMachine == EM_X86_64 || Config->MipsN32Abi;
Config->Mips64EL = Config->Mips64EL =
(Config->EMachine == EM_MIPS && Config->EKind == ELF64LEKind); (Config->EMachine == EM_MIPS && Config->EKind == ELF64LEKind);
Config->MaxPageSize = getMaxPageSize(Args);
// Initialize Config->MaxPageSize. The default value is defined by
// each target.
Config->MaxPageSize =
getZOptionValue(Args, "max-page-size", Target->DefaultMaxPageSize);
if (!isPowerOf2_64(Config->MaxPageSize))
error("max-page-size: value isn't a power of 2");
Config->ImageBase = getImageBase(Args); Config->ImageBase = getImageBase(Args);
// Default output filename is "a.out" by the Unix tradition. // Default output filename is "a.out" by the Unix tradition.