summaryrefslogtreecommitdiff
path: root/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp')
-rw-r--r--llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
index 781be3d8aeb1..689c9152c7dd 100644
--- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
+++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
@@ -10,7 +10,6 @@
#include "ELFObject.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -510,7 +509,7 @@ static Error replaceAndRemoveSections(const CommonConfig &Config,
Obj, isCompressable,
[&Config, &Obj](const SectionBase *S) -> Expected<SectionBase *> {
return &Obj.addSection<CompressedSection>(
- CompressedSection(*S, Config.CompressionType));
+ CompressedSection(*S, Config.CompressionType, Obj.Is64Bits));
}))
return Err;
} else if (Config.DecompressDebugSections) {
@@ -600,8 +599,8 @@ handleUserSection(const NewSectionInfo &NewSection,
static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig,
Object &Obj) {
if (Config.OutputArch) {
- Obj.Machine = Config.OutputArch.value().EMachine;
- Obj.OSABI = Config.OutputArch.value().OSABI;
+ Obj.Machine = Config.OutputArch->EMachine;
+ Obj.OSABI = Config.OutputArch->OSABI;
}
if (!Config.SplitDWO.empty() && Config.ExtractDWO) {
@@ -699,7 +698,7 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig,
const SectionRename &SR = Iter->second;
Sec.Name = std::string(SR.NewName);
if (SR.NewFlags)
- setSectionFlagsAndType(Sec, SR.NewFlags.value());
+ setSectionFlagsAndType(Sec, *SR.NewFlags);
RenamedSections.insert(&Sec);
} else if (RelocSec && !(Sec.Flags & SHF_ALLOC))
// Postpone processing relocation sections which are not specified in
@@ -810,9 +809,9 @@ Error objcopy::elf::executeObjcopyOnBinary(const CommonConfig &Config,
if (!Obj)
return Obj.takeError();
// Prefer OutputArch (-O<format>) if set, otherwise infer it from the input.
- const ElfType OutputElfType =
- Config.OutputArch ? getOutputElfType(Config.OutputArch.value())
- : getOutputElfType(In);
+ const ElfType OutputElfType = Config.OutputArch
+ ? getOutputElfType(*Config.OutputArch)
+ : getOutputElfType(In);
if (Error E = handleArgs(Config, ELFConfig, **Obj))
return createFileError(Config.InputFilename, std::move(E));