diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:42:12 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:42:12 +0000 |
commit | 1c4688a8498fea1db507842ff8dedaacad8ef77b (patch) | |
tree | e74f1bea0e682a4cd6d7edea69293ab7958eb9ae /contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp | |
parent | 68dc77c284115e8f103290474b3b9e35a3906c53 (diff) | |
parent | b7eb8e35e481a74962664b63dfb09483b200209a (diff) |
Notes
Diffstat (limited to 'contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp')
-rw-r--r-- | contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp index 4ccc67cc75db..21a1622db765 100644 --- a/contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp +++ b/contrib/llvm/tools/llvm-objcopy/llvm-objcopy.cpp @@ -185,6 +185,11 @@ LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, Error E) { } // end namespace objcopy } // end namespace llvm +static bool IsDebugSection(const SectionBase &Sec) { + return Sec.Name.startswith(".debug") || Sec.Name.startswith(".zdebug") || + Sec.Name == ".gdb_index"; +} + static bool IsDWOSection(const SectionBase &Sec) { return Sec.Name.endswith(".dwo"); } @@ -316,8 +321,7 @@ static void HandleArgs(const CopyConfig &Config, Object &Obj, // Removes: if (!Config.ToRemove.empty()) { RemovePred = [&Config](const SectionBase &Sec) { - return std::find(std::begin(Config.ToRemove), std::end(Config.ToRemove), - Sec.Name) != std::end(Config.ToRemove); + return find(Config.ToRemove, Sec.Name) != Config.ToRemove.end(); }; } @@ -346,7 +350,7 @@ static void HandleArgs(const CopyConfig &Config, Object &Obj, case SHT_STRTAB: return true; } - return Sec.Name.startswith(".debug"); + return IsDebugSection(Sec); }; if (Config.StripSections) { @@ -357,7 +361,7 @@ static void HandleArgs(const CopyConfig &Config, Object &Obj, if (Config.StripDebug) { RemovePred = [RemovePred](const SectionBase &Sec) { - return RemovePred(Sec) || Sec.Name.startswith(".debug"); + return RemovePred(Sec) || IsDebugSection(Sec); }; } @@ -385,8 +389,7 @@ static void HandleArgs(const CopyConfig &Config, Object &Obj, if (!Config.OnlyKeep.empty()) { RemovePred = [&Config, RemovePred, &Obj](const SectionBase &Sec) { // Explicitly keep these sections regardless of previous removes. - if (std::find(std::begin(Config.OnlyKeep), std::end(Config.OnlyKeep), - Sec.Name) != std::end(Config.OnlyKeep)) + if (find(Config.OnlyKeep, Sec.Name) != Config.OnlyKeep.end()) return false; // Allow all implicit removes. @@ -408,8 +411,7 @@ static void HandleArgs(const CopyConfig &Config, Object &Obj, if (!Config.Keep.empty()) { RemovePred = [Config, RemovePred](const SectionBase &Sec) { // Explicitly keep these sections regardless of previous removes. - if (std::find(std::begin(Config.Keep), std::end(Config.Keep), Sec.Name) != - std::end(Config.Keep)) + if (find(Config.Keep, Sec.Name) != Config.Keep.end()) return false; // Otherwise defer to RemovePred. return RemovePred(Sec); |