Do not handle -strip in a special way. NFC.

llvm-svn: 296227
This commit is contained in:
Rui Ueyama 2017-02-25 02:12:37 +00:00
parent dfa3ad1313
commit 524d44c6fa
2 changed files with 12 additions and 10 deletions

View File

@ -145,7 +145,7 @@ struct Configuration {
bool ZWxneeded;
DiscardPolicy Discard;
SortSectionPolicy SortSection;
StripPolicy Strip = StripPolicy::None;
StripPolicy Strip;
UnresolvedPolicy UnresolvedSymbols;
Target2Policy Target2 = Target2Policy::GotRel;
BuildIdKind BuildId = BuildIdKind::None;

View File

@ -437,6 +437,7 @@ static bool isOutputFormatBinary(opt::InputArgList &Args) {
static DiscardPolicy getDiscardOption(opt::InputArgList &Args) {
if (Args.hasArg(OPT_relocatable))
return DiscardPolicy::None;
auto *Arg =
Args.getLastArg(OPT_discard_all, OPT_discard_locals, OPT_discard_none);
if (!Arg)
@ -456,12 +457,15 @@ static StringRef getDynamicLinkerOption(opt::InputArgList &Args) {
}
static StripPolicy getStripOption(opt::InputArgList &Args) {
if (auto *Arg = Args.getLastArg(OPT_strip_all, OPT_strip_debug)) {
if (Arg->getOption().getID() == OPT_strip_all)
return StripPolicy::All;
return StripPolicy::Debug;
}
return StripPolicy::None;
if (Args.hasArg(OPT_relocatable))
return StripPolicy::None;
auto *Arg = Args.getLastArg(OPT_strip_all, OPT_strip_debug);
if (!Arg)
return StripPolicy::None;
if (Arg->getOption().getID() == OPT_strip_all)
return StripPolicy::All;
return StripPolicy::Debug;
}
static uint64_t parseSectionAddress(StringRef S, opt::Arg *Arg) {
@ -575,6 +579,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->SingleRoRx = Args.hasArg(OPT_no_rosegment);
Config->SoName = getString(Args, OPT_soname);
Config->SortSection = getSortKind(Args);
Config->Strip = getStripOption(Args);
Config->Sysroot = getString(Args, OPT_sysroot);
Config->Target1Rel = getArg(Args, OPT_target1_rel, OPT_target1_abs, false);
Config->Target2 = getTarget2Option(Args);
@ -620,9 +625,6 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
if (Config->Omagic)
Config->ZRelro = false;
if (!Config->Relocatable)
Config->Strip = getStripOption(Args);
std::tie(Config->SysvHash, Config->GnuHash) = getHashStyle(Args);
// Parse --build-id or --build-id=<style>.