forked from OSchip/llvm-project
Factor out code to parse -pack-dyn-relocs. NFC.
llvm-svn: 336599
This commit is contained in:
parent
d31bc9866b
commit
45192b3746
|
@ -113,7 +113,7 @@ struct Configuration {
|
|||
uint64_t>
|
||||
CallGraphProfile;
|
||||
bool AllowMultipleDefinition;
|
||||
bool AndroidPackDynRelocs = false;
|
||||
bool AndroidPackDynRelocs;
|
||||
bool ARMHasBlx = false;
|
||||
bool ARMHasMovtMovw = false;
|
||||
bool ARMJ1J2BranchEncoding = false;
|
||||
|
@ -153,7 +153,7 @@ struct Configuration {
|
|||
bool PrintGcSections;
|
||||
bool PrintIcfSections;
|
||||
bool Relocatable;
|
||||
bool RelrPackDynRelocs = false;
|
||||
bool RelrPackDynRelocs;
|
||||
bool SaveTemps;
|
||||
bool SingleRoRx;
|
||||
bool Shared;
|
||||
|
|
|
@ -607,6 +607,20 @@ getBuildId(opt::InputArgList &Args) {
|
|||
return {BuildIdKind::None, {}};
|
||||
}
|
||||
|
||||
static std::pair<bool, bool> getPackDynRelocs(opt::InputArgList &Args) {
|
||||
StringRef S = Args.getLastArgValue(OPT_pack_dyn_relocs, "none");
|
||||
if (S == "android")
|
||||
return {true, false};
|
||||
if (S == "relr")
|
||||
return {false, true};
|
||||
if (S == "android+relr")
|
||||
return {true, true};
|
||||
|
||||
if (S != "none")
|
||||
error("unknown -pack-dyn-relocs format: " + S);
|
||||
return {false, false};
|
||||
}
|
||||
|
||||
static void readCallGraph(MemoryBufferRef MB) {
|
||||
// Build a map from symbol name to section
|
||||
DenseMap<StringRef, const Symbol *> SymbolNameToSymbol;
|
||||
|
@ -873,19 +887,8 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
|
|||
|
||||
std::tie(Config->BuildId, Config->BuildIdVector) = getBuildId(Args);
|
||||
|
||||
if (auto *Arg = Args.getLastArg(OPT_pack_dyn_relocs)) {
|
||||
StringRef S = Arg->getValue();
|
||||
if (S == "android") {
|
||||
Config->AndroidPackDynRelocs = true;
|
||||
} else if (S == "relr") {
|
||||
Config->RelrPackDynRelocs = true;
|
||||
} else if (S == "android+relr") {
|
||||
Config->AndroidPackDynRelocs = true;
|
||||
Config->RelrPackDynRelocs = true;
|
||||
} else if (S != "none") {
|
||||
error("unknown -pack-dyn-relocs format: " + S);
|
||||
}
|
||||
}
|
||||
std::tie(Config->AndroidPackDynRelocs, Config->RelrPackDynRelocs) =
|
||||
getPackDynRelocs(Args);
|
||||
|
||||
if (auto *Arg = Args.getLastArg(OPT_symbol_ordering_file))
|
||||
if (Optional<MemoryBufferRef> Buffer = readFile(Arg->getValue()))
|
||||
|
|
Loading…
Reference in New Issue