summaryrefslogtreecommitdiff
path: root/llvm/lib/ObjCopy/ConfigManager.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /llvm/lib/ObjCopy/ConfigManager.cpp
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
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;
}