aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objcopy
diff options
context:
space:
mode:
authorquic-areg <aregmi@quicinc.com>2024-02-09 10:15:23 -0600
committerGitHub <noreply@github.com>2024-02-09 16:15:23 +0000
commit7ddc32052546abd41656d2e670f3902b1bf805a7 (patch)
treecbceb6c74107162841c11f43c0be7d2ec93efa32 /llvm/tools/llvm-objcopy
parent2095655f8e2324971f11be61b88ef1644d5796b8 (diff)
downloadllvm-7ddc32052546abd41656d2e670f3902b1bf805a7.zip
llvm-7ddc32052546abd41656d2e670f3902b1bf805a7.tar.gz
llvm-7ddc32052546abd41656d2e670f3902b1bf805a7.tar.bz2
[llvm-objcopy] Support SREC output format (#75874)
Adds a new output target "srec" to write SREC files from ELF inputs. https://en.wikipedia.org/wiki/SREC_(file_format)
Diffstat (limited to 'llvm/tools/llvm-objcopy')
-rw-r--r--llvm/tools/llvm-objcopy/ObjcopyOptions.cpp1
-rw-r--r--llvm/tools/llvm-objcopy/llvm-objcopy.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
index 394eaca..9a9b631 100644
--- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
@@ -687,6 +687,7 @@ objcopy::parseObjcopyOptions(ArrayRef<const char *> RawArgsArr,
Config.OutputFormat = StringSwitch<FileFormat>(OutputFormat)
.Case("binary", FileFormat::Binary)
.Case("ihex", FileFormat::IHex)
+ .Case("srec", FileFormat::SREC)
.Default(FileFormat::Unspecified);
if (Config.OutputFormat == FileFormat::Unspecified) {
if (OutputFormat.empty()) {
diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
index 730f423..ad3e604 100644
--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
@@ -121,6 +121,7 @@ static Error executeObjcopyOnRawBinary(ConfigManager &ConfigMgr,
case FileFormat::Binary:
case FileFormat::IHex:
case FileFormat::Unspecified:
+ case FileFormat::SREC:
Expected<const ELFConfig &> ELFConfig = ConfigMgr.getELFConfig();
if (!ELFConfig)
return ELFConfig.takeError();