summaryrefslogtreecommitdiff
path: root/llvm/lib/ObjCopy/ConfigManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ObjCopy/ConfigManager.cpp')
-rw-r--r--llvm/lib/ObjCopy/ConfigManager.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/llvm/lib/ObjCopy/ConfigManager.cpp b/llvm/lib/ObjCopy/ConfigManager.cpp
index 2b17d728aad3..eef8a2190c4d 100644
--- a/llvm/lib/ObjCopy/ConfigManager.cpp
+++ b/llvm/lib/ObjCopy/ConfigManager.cpp
@@ -13,6 +13,13 @@
using namespace llvm;
using namespace llvm::objcopy;
+Expected<const ELFConfig &> ConfigManager::getELFConfig() const {
+ if (!Common.ExtractSection.empty())
+ return createStringError(llvm::errc::invalid_argument,
+ "option is not supported for ELF");
+ return ELF;
+}
+
Expected<const COFFConfig &> ConfigManager::getCOFFConfig() const {
if (!Common.SplitDWO.empty() || !Common.SymbolsPrefix.empty() ||
!Common.SymbolsPrefixRemove.empty() || !Common.SymbolsToSkip.empty() ||
@@ -27,7 +34,7 @@ Expected<const COFFConfig &> ConfigManager::getCOFFConfig() const {
Common.DiscardMode == DiscardType::Locals ||
!Common.SymbolsToAdd.empty() || Common.GapFill != 0 ||
Common.PadTo != 0 || Common.ChangeSectionLMAValAll != 0 ||
- !Common.ChangeSectionAddress.empty())
+ !Common.ChangeSectionAddress.empty() || !Common.ExtractSection.empty())
return createStringError(llvm::errc::invalid_argument,
"option is not supported for COFF");
@@ -48,7 +55,7 @@ Expected<const MachOConfig &> ConfigManager::getMachOConfig() const {
Common.DiscardMode == DiscardType::Locals ||
!Common.SymbolsToAdd.empty() || Common.GapFill != 0 ||
Common.PadTo != 0 || Common.ChangeSectionLMAValAll != 0 ||
- !Common.ChangeSectionAddress.empty())
+ !Common.ChangeSectionAddress.empty() || !Common.ExtractSection.empty())
return createStringError(llvm::errc::invalid_argument,
"option is not supported for MachO");
@@ -69,7 +76,7 @@ Expected<const WasmConfig &> ConfigManager::getWasmConfig() const {
!Common.SetSectionFlags.empty() || !Common.SetSectionType.empty() ||
!Common.SymbolsToRename.empty() || Common.GapFill != 0 ||
Common.PadTo != 0 || Common.ChangeSectionLMAValAll != 0 ||
- !Common.ChangeSectionAddress.empty())
+ !Common.ChangeSectionAddress.empty() || !Common.ExtractSection.empty())
return createStringError(llvm::errc::invalid_argument,
"only flags for section dumping, removal, and "
"addition are supported");
@@ -99,7 +106,7 @@ Expected<const XCOFFConfig &> ConfigManager::getXCOFFConfig() const {
Common.Weaken || Common.StripUnneeded || Common.DecompressDebugSections ||
Common.GapFill != 0 || Common.PadTo != 0 ||
Common.ChangeSectionLMAValAll != 0 ||
- !Common.ChangeSectionAddress.empty()) {
+ !Common.ChangeSectionAddress.empty() || !Common.ExtractSection.empty()) {
return createStringError(
llvm::errc::invalid_argument,
"no flags are supported yet, only basic copying is allowed");
@@ -116,18 +123,16 @@ ConfigManager::getDXContainerConfig() const {
!Common.AllocSectionsPrefix.empty() ||
Common.DiscardMode != DiscardType::None || !Common.AddSection.empty() ||
!Common.DumpSection.empty() || !Common.KeepSection.empty() ||
- !Common.OnlySection.empty() || !Common.SectionsToRename.empty() ||
- !Common.SetSectionAlignment.empty() || !Common.SetSectionFlags.empty() ||
- !Common.SetSectionType.empty() || Common.ExtractDWO ||
- Common.OnlyKeepDebug || Common.StripAllGNU || Common.StripDWO ||
- Common.StripDebug || Common.StripNonAlloc || Common.StripSections ||
- Common.StripUnneeded || Common.DecompressDebugSections ||
- Common.GapFill != 0 || Common.PadTo != 0 ||
- Common.ChangeSectionLMAValAll != 0 ||
+ !Common.SectionsToRename.empty() || !Common.SetSectionAlignment.empty() ||
+ !Common.SetSectionFlags.empty() || !Common.SetSectionType.empty() ||
+ Common.ExtractDWO || Common.OnlyKeepDebug || Common.StripAllGNU ||
+ Common.StripDWO || Common.StripDebug || Common.StripNonAlloc ||
+ Common.StripSections || Common.StripUnneeded ||
+ Common.DecompressDebugSections || Common.GapFill != 0 ||
+ Common.PadTo != 0 || Common.ChangeSectionLMAValAll != 0 ||
!Common.ChangeSectionAddress.empty()) {
- return createStringError(
- llvm::errc::invalid_argument,
- "no flags are supported yet, only basic copying is allowed");
+ return createStringError(llvm::errc::invalid_argument,
+ "option is not supported for DXContainer");
}
return DXContainer;
}