[llvm] 5e171ce - [ifs] Add options to allow llvm-ifs to generate multiple outputs

Haowei Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 12:26:55 PST 2021


Author: Haowei Wu
Date: 2021-12-09T12:25:51-08:00
New Revision: 5e171cebd3bafbf39cdad6294fe26c3952aedbc3

URL: https://github.com/llvm/llvm-project/commit/5e171cebd3bafbf39cdad6294fe26c3952aedbc3
DIFF: https://github.com/llvm/llvm-project/commit/5e171cebd3bafbf39cdad6294fe26c3952aedbc3.diff

LOG: [ifs] Add options to allow llvm-ifs to generate multiple outputs

This change adds options to llvm-ifs to allow it to generate multiple
types of stub files at a single invocation.

Differential Revision: https://reviews.llvm.org/D115024

Added: 
    llvm/test/tools/llvm-ifs/output-format-deprecation.test

Modified: 
    llvm/test/tools/llvm-ifs/binary-read-add-soname.test
    llvm/test/tools/llvm-ifs/binary-read-arch.test
    llvm/test/tools/llvm-ifs/binary-read-bad-soname.test
    llvm/test/tools/llvm-ifs/binary-read-bad-vaddr.test
    llvm/test/tools/llvm-ifs/binary-read-neededlibs-bad-offset.test
    llvm/test/tools/llvm-ifs/binary-read-neededlibs.test
    llvm/test/tools/llvm-ifs/binary-read-no-dt-strsz.test
    llvm/test/tools/llvm-ifs/binary-read-no-dt-strtab.test
    llvm/test/tools/llvm-ifs/binary-read-no-dynamic.test
    llvm/test/tools/llvm-ifs/binary-read-replace-soname.test
    llvm/test/tools/llvm-ifs/binary-read-soname-no-null.test
    llvm/test/tools/llvm-ifs/binary-read-soname.test
    llvm/test/tools/llvm-ifs/binary-read-syms-gnu-hash.test
    llvm/test/tools/llvm-ifs/binary-read-syms-sysv-hash.test
    llvm/test/tools/llvm-ifs/conflict-header-triple.ifs
    llvm/test/tools/llvm-ifs/conflict-header-version.ifs
    llvm/test/tools/llvm-ifs/conflict-size.ifs
    llvm/test/tools/llvm-ifs/conflict-type.ifs
    llvm/test/tools/llvm-ifs/conflict-weak.ifs
    llvm/test/tools/llvm-ifs/default-empty.ifs
    llvm/test/tools/llvm-ifs/empty1.ifs
    llvm/test/tools/llvm-ifs/empty2.ifs
    llvm/test/tools/llvm-ifs/fail-file-open.test
    llvm/test/tools/llvm-ifs/fail-file-write-windows.test
    llvm/test/tools/llvm-ifs/fail-file-write.test
    llvm/test/tools/llvm-ifs/func.ifs
    llvm/test/tools/llvm-ifs/ifs-emits-current-version.test
    llvm/test/tools/llvm-ifs/ifs-read-basic.test
    llvm/test/tools/llvm-ifs/ios-tbd.ifs
    llvm/test/tools/llvm-ifs/macos-tbd.ifs
    llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs
    llvm/test/tools/llvm-ifs/object.ifs
    llvm/test/tools/llvm-ifs/output-target-error.test
    llvm/test/tools/llvm-ifs/preserve-dates-ifs.test
    llvm/test/tools/llvm-ifs/preserve-dates-stub.test
    llvm/test/tools/llvm-ifs/read-elf-dynsym.test
    llvm/test/tools/llvm-ifs/read-ifs-as-elf.test
    llvm/test/tools/llvm-ifs/read-ifs-as-ifs.test
    llvm/test/tools/llvm-ifs/read-ifs-with-bad-bitwidth.test
    llvm/test/tools/llvm-ifs/read-ifs-with-bad-endianness.test
    llvm/test/tools/llvm-ifs/read-unsupported-file.test
    llvm/test/tools/llvm-ifs/strip-target.test
    llvm/test/tools/llvm-ifs/strip-undefined-symbols.test
    llvm/test/tools/llvm-ifs/strong.ifs
    llvm/test/tools/llvm-ifs/tvos-tbd.ifs
    llvm/test/tools/llvm-ifs/version-ok.ifs
    llvm/test/tools/llvm-ifs/watchos-tbd.ifs
    llvm/test/tools/llvm-ifs/weak-mismatch.ifs
    llvm/test/tools/llvm-ifs/weak.ifs
    llvm/test/tools/llvm-ifs/write-stub-no-nonlocal-symbol.test
    llvm/test/tools/llvm-ifs/write-stub.test
    llvm/tools/llvm-ifs/llvm-ifs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-ifs/binary-read-add-soname.test b/llvm/test/tools/llvm-ifs/binary-read-add-soname.test
index c94e4dca62d4..7433545eae59 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-add-soname.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-add-soname.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- --soname=best.so %t | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- --soname=best.so %t | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-arch.test b/llvm/test/tools/llvm-ifs/binary-read-arch.test
index 5491367894ee..427035e30eb8 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-arch.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-arch.test
@@ -1,6 +1,6 @@
 # RUN: yaml2obj --docnum=1 %s -o %t
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %t | FileCheck %s -DTARGET="{ ObjectFormat: ELF, Arch: x86_64, Endianness: little, BitWidth: 64 }"
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- --hint-ifs-target="x86_64-linux-gnu" %t | FileCheck %s -DTARGET="x86_64-linux-gnu"
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %t | FileCheck %s -DTARGET="{ ObjectFormat: ELF, Arch: x86_64, Endianness: little, BitWidth: 64 }"
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- --hint-ifs-target="x86_64-linux-gnu" %t | FileCheck %s -DTARGET="x86_64-linux-gnu"
 
 --- !ELF
 FileHeader:
@@ -52,7 +52,7 @@ ProgramHeaders:
 # HINTERR: error: Triple hint does not match the actual [[MSG]]
 
 # RUN: yaml2obj --docnum=1 %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe --hint-ifs-target="aarch64-linux-gnu" %t 2>&1 | FileCheck %s -DMSG=architecture --check-prefix=HINTERR
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe --hint-ifs-target="aarch64-linux-gnu" %t 2>&1 | FileCheck %s -DMSG=architecture --check-prefix=HINTERR
 
 --- !ELF
 FileHeader:
@@ -96,7 +96,7 @@ ProgramHeaders:
     LastSec:  .dynamic
 
 # RUN: yaml2obj --docnum=2 %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe --hint-ifs-target="x86_64-unknown-linux-gnu" %t 2>&1 | FileCheck %s -DMSG="endianness" --check-prefix=HINTERR
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe --hint-ifs-target="x86_64-unknown-linux-gnu" %t 2>&1 | FileCheck %s -DMSG="endianness" --check-prefix=HINTERR
 
 --- !ELF
 FileHeader:
@@ -140,4 +140,4 @@ ProgramHeaders:
     LastSec:  .dynamic
 
 # RUN: yaml2obj --docnum=3 %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe --hint-ifs-target="x86_64-unknown-linux-gnu" %t 2>&1 | FileCheck %s -DMSG="bit width" --check-prefix=HINTERR
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe --hint-ifs-target="x86_64-unknown-linux-gnu" %t 2>&1 | FileCheck %s -DMSG="bit width" --check-prefix=HINTERR

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-bad-soname.test b/llvm/test/tools/llvm-ifs/binary-read-bad-soname.test
index 4fe2ca2133d4..6b12199b731b 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-bad-soname.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-bad-soname.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-bad-vaddr.test b/llvm/test/tools/llvm-ifs/binary-read-bad-vaddr.test
index 4bf16a2dc89b..36547176eb93 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-bad-vaddr.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-bad-vaddr.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-neededlibs-bad-offset.test b/llvm/test/tools/llvm-ifs/binary-read-neededlibs-bad-offset.test
index d803abe239e9..2708c2ee1eb8 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-neededlibs-bad-offset.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-neededlibs-bad-offset.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-neededlibs.test b/llvm/test/tools/llvm-ifs/binary-read-neededlibs.test
index ebdd5ae15165..c7fc390b643d 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-neededlibs.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-neededlibs.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %t | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %t | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-no-dt-strsz.test b/llvm/test/tools/llvm-ifs/binary-read-no-dt-strsz.test
index bca357ccc00d..663602191a66 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-no-dt-strsz.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-no-dt-strsz.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-no-dt-strtab.test b/llvm/test/tools/llvm-ifs/binary-read-no-dt-strtab.test
index f9194592bf0e..813e46561c67 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-no-dt-strtab.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-no-dt-strtab.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-no-dynamic.test b/llvm/test/tools/llvm-ifs/binary-read-no-dynamic.test
index 3ea0bd39d023..11dc02e25e6d 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-no-dynamic.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-no-dynamic.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-replace-soname.test b/llvm/test/tools/llvm-ifs/binary-read-replace-soname.test
index f845ab440cdc..85b29ae9a100 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-replace-soname.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-replace-soname.test
@@ -1,6 +1,6 @@
 # RUN: yaml2obj %s -o %t
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %t | FileCheck %s --check-prefix=ORIGINAL
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --soname=libbest.so --output=- %t | FileCheck %s --check-prefix=REPLACED
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %t | FileCheck %s --check-prefix=ORIGINAL
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- --soname=libbest.so %t | FileCheck %s --check-prefix=REPLACED
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-soname-no-null.test b/llvm/test/tools/llvm-ifs/binary-read-soname-no-null.test
index 80b427ca1a62..230fe4ac93b3 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-soname-no-null.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-soname-no-null.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t.tbe %t 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t.tbe %t 2>&1 | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-soname.test b/llvm/test/tools/llvm-ifs/binary-read-soname.test
index 821a2fa36cf4..eea49e30b492 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-soname.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-soname.test
@@ -1,5 +1,5 @@
 # RUN: yaml2obj %s -o %t
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %t | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %t | FileCheck %s
 
 !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-syms-gnu-hash.test b/llvm/test/tools/llvm-ifs/binary-read-syms-gnu-hash.test
index 9553119c0686..4fa86dcb0418 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-syms-gnu-hash.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-syms-gnu-hash.test
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %p/Inputs/gnu_hash.so | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %p/Inputs/gnu_hash.so | FileCheck %s
 
 # CHECK:      --- !ifs-v1
 # CHECK-NEXT: IfsVersion:      3.0

diff  --git a/llvm/test/tools/llvm-ifs/binary-read-syms-sysv-hash.test b/llvm/test/tools/llvm-ifs/binary-read-syms-sysv-hash.test
index fdd8cb0fae60..94f1f60a1a75 100644
--- a/llvm/test/tools/llvm-ifs/binary-read-syms-sysv-hash.test
+++ b/llvm/test/tools/llvm-ifs/binary-read-syms-sysv-hash.test
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %p/Inputs/sysv_hash.so | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %p/Inputs/sysv_hash.so | FileCheck %s
 
 # CHECK:      --- !ifs-v1
 # CHECK-NEXT: IfsVersion:      3.0

diff  --git a/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs b/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs
index 623b76b4109c..0cba62b1e1e8 100644
--- a/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs
+++ b/llvm/test/tools/llvm-ifs/conflict-header-triple.ifs
@@ -1,4 +1,4 @@
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/object.ifs 2>&1 | \
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s %S/object.ifs 2>&1 | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
 # CHECK-IFS: error: Interface Stub: Target Mismatch.

diff  --git a/llvm/test/tools/llvm-ifs/conflict-header-version.ifs b/llvm/test/tools/llvm-ifs/conflict-header-version.ifs
index 25fcb0f57339..3359b50c5f1d 100644
--- a/llvm/test/tools/llvm-ifs/conflict-header-version.ifs
+++ b/llvm/test/tools/llvm-ifs/conflict-header-version.ifs
@@ -1,7 +1,7 @@
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/object.ifs 2>&1 | \
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s %S/object.ifs 2>&1 | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s 2>&1 | \
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s 2>&1 | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS2
 
 # CHECK-IFS: error: Interface Stub: IfsVersion Mismatch.

diff  --git a/llvm/test/tools/llvm-ifs/conflict-size.ifs b/llvm/test/tools/llvm-ifs/conflict-size.ifs
index 987a3c1a8e87..857919b954e8 100644
--- a/llvm/test/tools/llvm-ifs/conflict-size.ifs
+++ b/llvm/test/tools/llvm-ifs/conflict-size.ifs
@@ -1,4 +1,4 @@
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/object.ifs 2>&1 | \
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s %S/object.ifs 2>&1 | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
 # Here we are testing to see if two symbols with identical names will fail to

diff  --git a/llvm/test/tools/llvm-ifs/conflict-type.ifs b/llvm/test/tools/llvm-ifs/conflict-type.ifs
index 0a9879fc6df4..2f95d580fdd5 100644
--- a/llvm/test/tools/llvm-ifs/conflict-type.ifs
+++ b/llvm/test/tools/llvm-ifs/conflict-type.ifs
@@ -1,4 +1,4 @@
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/func.ifs 2>&1 | \
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s %S/func.ifs 2>&1 | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
 # Here we are testing to see if two symbols with identical names will fail to

diff  --git a/llvm/test/tools/llvm-ifs/conflict-weak.ifs b/llvm/test/tools/llvm-ifs/conflict-weak.ifs
index 4b0c522aa66a..63fa5eb9d5e9 100644
--- a/llvm/test/tools/llvm-ifs/conflict-weak.ifs
+++ b/llvm/test/tools/llvm-ifs/conflict-weak.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/func.ifs 2>&1 | \
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s %S/func.ifs 2>&1 | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
 # CHECK-IFS: Symbols:

diff  --git a/llvm/test/tools/llvm-ifs/default-empty.ifs b/llvm/test/tools/llvm-ifs/default-empty.ifs
index 419a7c068429..1fbee78195d5 100644
--- a/llvm/test/tools/llvm-ifs/default-empty.ifs
+++ b/llvm/test/tools/llvm-ifs/default-empty.ifs
@@ -1,5 +1,5 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s | FileCheck --check-prefixes=CHECK-DEFAULT %s
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %S/weak.ifs %s | FileCheck --check-prefixes=CHECK-MERGE %s
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s | FileCheck --check-prefixes=CHECK-DEFAULT %s
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %S/weak.ifs %s | FileCheck --check-prefixes=CHECK-MERGE %s
 
 # CHECK-DEFAULT: --- !ifs-v1
 # CHECK-DEFAULT-NEXT: IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/empty1.ifs b/llvm/test/tools/llvm-ifs/empty1.ifs
index 9cbf0cd7cb6b..144e50c0dddc 100644
--- a/llvm/test/tools/llvm-ifs/empty1.ifs
+++ b/llvm/test/tools/llvm-ifs/empty1.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s | FileCheck %s
 
 # CHECK: --- !ifs-v1
 # CHECK-NEXT: IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/empty2.ifs b/llvm/test/tools/llvm-ifs/empty2.ifs
index d26ad6309358..5e6bd00dbcee 100644
--- a/llvm/test/tools/llvm-ifs/empty2.ifs
+++ b/llvm/test/tools/llvm-ifs/empty2.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s | FileCheck %s
 
 # CHECK: --- !ifs-v1
 # CHECK-NEXT: IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/fail-file-open.test b/llvm/test/tools/llvm-ifs/fail-file-open.test
index 072f266f5fcd..ef3d06c7a3e1 100644
--- a/llvm/test/tools/llvm-ifs/fail-file-open.test
+++ b/llvm/test/tools/llvm-ifs/fail-file-open.test
@@ -1,4 +1,4 @@
-# RUN: not llvm-ifs --output-format=IFS --output=%t.tbe %s.NotAFileInTestingDir 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --output-ifs=%t.tbe %s.NotAFileInTestingDir 2>&1 | FileCheck %s
 
 This file will not be read. An invalid file path is fed to llvm-ifs.
 

diff  --git a/llvm/test/tools/llvm-ifs/fail-file-write-windows.test b/llvm/test/tools/llvm-ifs/fail-file-write-windows.test
index 69ae7d551212..e1fa1a68bf90 100644
--- a/llvm/test/tools/llvm-ifs/fail-file-write-windows.test
+++ b/llvm/test/tools/llvm-ifs/fail-file-write-windows.test
@@ -3,7 +3,7 @@
 # REQUIRES: system-windows
 # RUN: touch %t.TestFile
 # RUN: chmod 400 %t.TestFile
-# RUN: not llvm-ifs --output-format=ELF --output=%t.TestFile %s 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
+# RUN: not llvm-ifs --output-elf=%t.TestFile %s 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
 # RUN: chmod 777 %t.TestFile
 # RUN: rm -rf %t.TestFile
 

diff  --git a/llvm/test/tools/llvm-ifs/fail-file-write.test b/llvm/test/tools/llvm-ifs/fail-file-write.test
index 1f63d8fef3a9..d5232070c1d0 100644
--- a/llvm/test/tools/llvm-ifs/fail-file-write.test
+++ b/llvm/test/tools/llvm-ifs/fail-file-write.test
@@ -5,7 +5,7 @@
 # RUN: mkdir %t.TestDir
 # RUN: touch %t.TestDir/Output.TestFile
 # RUN: chmod 400 %t.TestDir
-# RUN: not llvm-ifs --output-format=ELF --output=%t.TestDir/Output.TestFile %s 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
+# RUN: not llvm-ifs --output-elf=%t.TestDir/Output.TestFile %s 2>&1 | FileCheck -DMSG=%errc_EACCES %s --check-prefix=ERR
 # RUN: chmod 777 %t.TestDir
 # RUN: rm -rf %t.TestDir
 

diff  --git a/llvm/test/tools/llvm-ifs/func.ifs b/llvm/test/tools/llvm-ifs/func.ifs
index c8f3612259cf..a34023a645fd 100644
--- a/llvm/test/tools/llvm-ifs/func.ifs
+++ b/llvm/test/tools/llvm-ifs/func.ifs
@@ -1,14 +1,14 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/object.ifs | \
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s %S/object.ifs | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
-# RUN: llvm-ifs --input-format=IFS --output-format=ELF -o - %s %S/object.ifs | \
+# RUN: llvm-ifs --input-format=IFS --output-elf - %s %S/object.ifs | \
 # RUN: llvm-readelf --all - | FileCheck %s --check-prefixes=CHECK-ELF
 
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS --strip-ifs-target -o %t.tbd %s %S/object.ifs
-# RUN: llvm-ifs --input-format=IFS --output-format=TBD --target=x86_64-apple-darwin -o - %t.tbd | \
+# RUN: llvm-ifs --input-format=IFS --strip-ifs-target --output-ifs %t.tbd %s %S/object.ifs
+# RUN: llvm-ifs --input-format=IFS --target=x86_64-apple-darwin --output-tbd - %t.tbd | \
 # RUN: FileCheck %s --check-prefixes=CHECK-DARWIN-TBD3
 
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s %s | \
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s %s | \
 # RUN: FileCheck %s --check-prefixes=CHECK-MERGE-IFS
 
 # CHECK-IFS: --- !ifs-v1

diff  --git a/llvm/test/tools/llvm-ifs/ifs-emits-current-version.test b/llvm/test/tools/llvm-ifs/ifs-emits-current-version.test
index 1dbb974b9609..a64c96ac8d35 100644
--- a/llvm/test/tools/llvm-ifs/ifs-emits-current-version.test
+++ b/llvm/test/tools/llvm-ifs/ifs-emits-current-version.test
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --output-format=IFS --output=- %s | FileCheck %s
+# RUN: llvm-ifs --output-ifs=- %s | FileCheck %s
 
 --- !ifs-v1
 IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/ifs-read-basic.test b/llvm/test/tools/llvm-ifs/ifs-read-basic.test
index 24f952fd82f1..b0217c50e63c 100644
--- a/llvm/test/tools/llvm-ifs/ifs-read-basic.test
+++ b/llvm/test/tools/llvm-ifs/ifs-read-basic.test
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --output-format=IFS --output=- %s | FileCheck %s
+# RUN: llvm-ifs --output-ifs=- %s | FileCheck %s
 
 --- !ifs-v1
 SoName: somelib.so

diff  --git a/llvm/test/tools/llvm-ifs/ios-tbd.ifs b/llvm/test/tools/llvm-ifs/ios-tbd.ifs
index 7d2fac51e3c1..c48815f6c5c6 100644
--- a/llvm/test/tools/llvm-ifs/ios-tbd.ifs
+++ b/llvm/test/tools/llvm-ifs/ios-tbd.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=TBD  -o - %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-tbd - %s | FileCheck %s
 
 # CHECK: --- !tapi-tbd-v3
 # CHECK-NEXT: archs:           [ arm64 ]

diff  --git a/llvm/test/tools/llvm-ifs/macos-tbd.ifs b/llvm/test/tools/llvm-ifs/macos-tbd.ifs
index 684127e7079b..5f960ca71dfc 100644
--- a/llvm/test/tools/llvm-ifs/macos-tbd.ifs
+++ b/llvm/test/tools/llvm-ifs/macos-tbd.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=TBD -o - %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-tbd - %s | FileCheck %s
 
 # CHECK: --- !tapi-tbd-v3
 # CHECK-NEXT: archs:           [ arm64 ]

diff  --git a/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs b/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs
index 803633395a04..24db50b1830f 100644
--- a/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs
+++ b/llvm/test/tools/llvm-ifs/object-function-size-weak-combo.ifs
@@ -1,7 +1,7 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
-# RUN: llvm-ifs --input-format=IFS --output-format=ELF -o - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \
+# RUN: llvm-ifs --input-format=IFS --output-elf - %s %S/func.ifs %S/object.ifs %S/weak.ifs | \
 # RUN: llvm-readelf --all - | FileCheck %s --check-prefixes=CHECK-ELF
 
 # CHECK-IFS: --- !ifs-v1

diff  --git a/llvm/test/tools/llvm-ifs/object.ifs b/llvm/test/tools/llvm-ifs/object.ifs
index 1e82151a0580..a2ca7c907375 100644
--- a/llvm/test/tools/llvm-ifs/object.ifs
+++ b/llvm/test/tools/llvm-ifs/object.ifs
@@ -1,7 +1,7 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s | \
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s | \
 # RUN: FileCheck %s --check-prefixes=CHECK-IFS
 
-# RUN: llvm-ifs --input-format=IFS --output-format=ELF -o - %s | \
+# RUN: llvm-ifs --input-format=IFS --output-elf - %s | \
 # RUN: llvm-readelf --all - | FileCheck %s --check-prefixes=CHECK-ELF
 
 # CHECK-IFS: --- !ifs-v1

diff  --git a/llvm/test/tools/llvm-ifs/output-format-deprecation.test b/llvm/test/tools/llvm-ifs/output-format-deprecation.test
new file mode 100644
index 000000000000..9ffd76fece55
--- /dev/null
+++ b/llvm/test/tools/llvm-ifs/output-format-deprecation.test
@@ -0,0 +1,14 @@
+## Test running llvm-ifs with --output-format option to generate deprecation warnings
+
+# RUN: llvm-ifs  --output-format=IFS --output=%t %s 2>&1 | FileCheck %s --check-prefix=WARNING
+# RUN: not llvm-ifs  --output-format=IFS --output=%t --output-ifs=%t %s 2>&1 | FileCheck %s --check-prefix=ERROR
+
+--- !ifs-v1
+SoName: somelib.so
+IfsVersion: 3.0
+Target: { ObjectFormat: ELF, Arch: x86_64, Endianness: little, BitWidth: 64 }
+Symbols: []
+...
+
+# WARNING: warning: --output-format option is deprecated, please use --output-{FILE_FORMAT} options instead
+# ERROR: error: '--output-format' cannot be used with '--output-{FILE_FORMAT}' options at the same time

diff  --git a/llvm/test/tools/llvm-ifs/output-target-error.test b/llvm/test/tools/llvm-ifs/output-target-error.test
index 7c6f8fba8657..ce746cf4e0f0 100644
--- a/llvm/test/tools/llvm-ifs/output-target-error.test
+++ b/llvm/test/tools/llvm-ifs/output-target-error.test
@@ -10,6 +10,6 @@ Target: { ObjectFormat: ELF, Arch: x86_64, Endianness: little, BitWidth: 64 }
 Symbols: []
 ...
 
-# MISSING: {{llvm-ifs(\.exe)?}}: for the --output-format option: must be specified at least once!
+# MISSING: error: at least one output should be specified.
 
 # INVALID: {{llvm-ifs(\.exe)?}}: for the --output-format option: Cannot find option named 'nope'!

diff  --git a/llvm/test/tools/llvm-ifs/preserve-dates-ifs.test b/llvm/test/tools/llvm-ifs/preserve-dates-ifs.test
index 51e1cd2895ab..83e463b9978d 100644
--- a/llvm/test/tools/llvm-ifs/preserve-dates-ifs.test
+++ b/llvm/test/tools/llvm-ifs/preserve-dates-ifs.test
@@ -1,8 +1,8 @@
 ## Test writing unchanged content to TBE file with --write-if-changed flag.
 
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=%t %p/Inputs/gnu_hash.so
+# RUN: llvm-ifs --input-format=ELF --output-ifs=%t %p/Inputs/gnu_hash.so
 # RUN: env TZ=GMT touch -m -t 197001010000 %t
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=%t --write-if-changed %p/Inputs/gnu_hash.so
+# RUN: llvm-ifs --input-format=ELF --output-ifs=%t --write-if-changed %p/Inputs/gnu_hash.so
 # RUN: env TZ=GMT ls -l %t | FileCheck %s
 
 # CHECK: {{[[:space:]]1970}}

diff  --git a/llvm/test/tools/llvm-ifs/preserve-dates-stub.test b/llvm/test/tools/llvm-ifs/preserve-dates-stub.test
index 875f6d272d92..52c58ff4a90c 100644
--- a/llvm/test/tools/llvm-ifs/preserve-dates-stub.test
+++ b/llvm/test/tools/llvm-ifs/preserve-dates-stub.test
@@ -1,8 +1,8 @@
 ## Test writing unchanged content to ELF Stub file with --write-if-changed flag.
 
-# RUN: llvm-ifs --output-format=ELF --output=%t %s
+# RUN: llvm-ifs --output-elf=%t %s
 # RUN: env TZ=GMT touch -m -t 197001010000 %t
-# RUN: llvm-ifs --output-format=ELF --output=%t --write-if-changed %s
+# RUN: llvm-ifs --output-elf=%t --write-if-changed %s
 # RUN: env TZ=GMT ls -l %t | FileCheck %s
 
 --- !ifs-v1

diff  --git a/llvm/test/tools/llvm-ifs/read-elf-dynsym.test b/llvm/test/tools/llvm-ifs/read-elf-dynsym.test
index 848c1b89f685..80edb85d768c 100644
--- a/llvm/test/tools/llvm-ifs/read-elf-dynsym.test
+++ b/llvm/test/tools/llvm-ifs/read-elf-dynsym.test
@@ -5,19 +5,19 @@
 
 ## Test if llvm-ifs reads DT_SYMTAB size through section headers by puting the wrong terminator in DT_GNU_HASH.
 # RUN: yaml2obj %s -o %tfull -DGNUHASHVALUE="[0x9]" -DTAG1="DT_GNU_HASH" -DVAL1="0xC00"
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %tfull | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %tfull | FileCheck %s
 
 ## Test if llvm-ifs fails to read DT_SYMTAB size through section headers when the value of sh_entsize is invalid.
 # RUN: yaml2obj %s -o %tfull -DGNUHASHVALUE="[0x9]" -DTAG1="DT_GNU_HASH" -DVAL1="0xC00" -DENTSIZE="0x19"
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=- %tfull 2>&1 | FileCheck %s --check-prefix=BADENTSIZE
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=- %tfull 2>&1 | FileCheck %s --check-prefix=BADENTSIZE
 
 ## Test if llvm-ifs reads DT_SYMTAB size through DT_GNU_HASH.
 # RUN: yaml2obj %s -o %tw.gnu.hash -DGNUHASHVALUE="[0x8, 0x9]" -DTAG1="DT_GNU_HASH" -DVAL1="0xC00" -DNOHEADER="true"
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --output=- %tw.gnu.hash | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --output-ifs=- %tw.gnu.hash | FileCheck %s
 
 ## Test if llvm-ifs fails to read DT_SYMTAB size through DT_GNU_HASH when there is no terminator.
 # RUN: yaml2obj %s -o %tw.gnu.hash -DGNUHASHVALUE="[0x8, 0xA]" -DTAG1="DT_GNU_HASH" -DVAL1="0xC00" -DNOHEADER="true"
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=- %tw.gnu.hash  2>&1 | FileCheck %s --check-prefix=NOTERMINATOR
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=- %tw.gnu.hash  2>&1 | FileCheck %s --check-prefix=NOTERMINATOR
 
 # CHECK:      --- !ifs-v1
 # CHECK-NEXT: IfsVersion:      3.0

diff  --git a/llvm/test/tools/llvm-ifs/read-ifs-as-elf.test b/llvm/test/tools/llvm-ifs/read-ifs-as-elf.test
index 22047a3ba2ec..ed49f12144cb 100644
--- a/llvm/test/tools/llvm-ifs/read-ifs-as-elf.test
+++ b/llvm/test/tools/llvm-ifs/read-ifs-as-elf.test
@@ -1,4 +1,4 @@
-# RUN: not llvm-ifs --input-format=ELF --output-format=IFS --output=%t %s 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --input-format=ELF --output-ifs=%t %s 2>&1 | FileCheck %s
 
 --- !ifs-v1
 SoName: somelib.so

diff  --git a/llvm/test/tools/llvm-ifs/read-ifs-as-ifs.test b/llvm/test/tools/llvm-ifs/read-ifs-as-ifs.test
index 77ad93488a28..1554a425a8f7 100644
--- a/llvm/test/tools/llvm-ifs/read-ifs-as-ifs.test
+++ b/llvm/test/tools/llvm-ifs/read-ifs-as-ifs.test
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS --output=- %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-ifs=- %s | FileCheck %s
 
 --- !ifs-v1
 IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/read-ifs-with-bad-bitwidth.test b/llvm/test/tools/llvm-ifs/read-ifs-with-bad-bitwidth.test
index 8f5e6d7aad36..2a65bde6ece3 100644
--- a/llvm/test/tools/llvm-ifs/read-ifs-with-bad-bitwidth.test
+++ b/llvm/test/tools/llvm-ifs/read-ifs-with-bad-bitwidth.test
@@ -1,6 +1,6 @@
 ## Test reading TBE file with bad bit width.
 
-# RUN: not llvm-ifs --output-format=IFS --output=- %s 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --output-ifs=- %s 2>&1 | FileCheck %s
 
 --- !ifs-v1
 SoName: somelib.so

diff  --git a/llvm/test/tools/llvm-ifs/read-ifs-with-bad-endianness.test b/llvm/test/tools/llvm-ifs/read-ifs-with-bad-endianness.test
index 6ce8e0dfdf0a..b52106e1a7ef 100644
--- a/llvm/test/tools/llvm-ifs/read-ifs-with-bad-endianness.test
+++ b/llvm/test/tools/llvm-ifs/read-ifs-with-bad-endianness.test
@@ -1,6 +1,6 @@
 ## Test reading TBE file with bad endianness.
 
-# RUN: not llvm-ifs --output-format=IFS --output=- %s 2>&1 | FileCheck %s
+# RUN: not llvm-ifs --output-ifs=- %s 2>&1 | FileCheck %s
 
 --- !ifs-v1
 SoName: somelib.so

diff  --git a/llvm/test/tools/llvm-ifs/read-unsupported-file.test b/llvm/test/tools/llvm-ifs/read-unsupported-file.test
index 49ea6ffe2bf9..58c855d67a25 100644
--- a/llvm/test/tools/llvm-ifs/read-unsupported-file.test
+++ b/llvm/test/tools/llvm-ifs/read-unsupported-file.test
@@ -1,4 +1,4 @@
-# RUN: not llvm-ifs --output-format=IFS --output=- %s 2>&1| FileCheck %s
+# RUN: not llvm-ifs --output-ifs=- %s 2>&1| FileCheck %s
 
 This is just some text that cannot be read by llvm-ifs.
 

diff  --git a/llvm/test/tools/llvm-ifs/strip-target.test b/llvm/test/tools/llvm-ifs/strip-target.test
index b1b3adadc223..0511b56b4e83 100644
--- a/llvm/test/tools/llvm-ifs/strip-target.test
+++ b/llvm/test/tools/llvm-ifs/strip-target.test
@@ -1,10 +1,10 @@
 ## Test writing tbe with stripped target information.
 
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --strip-ifs-target --output=- %p/Inputs/sysv_hash.so | FileCheck %s --check-prefix=NOTARGET
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --strip-ifs-arch --strip-ifs-endianness --strip-ifs-bitwidth --output=- %p/Inputs/sysv_hash.so | FileCheck %s --check-prefix=NOTARGET
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --strip-ifs-arch --output=- %p/Inputs/sysv_hash.so | FileCheck %s -DELFTARGET="ObjectFormat: ELF, Endianness: little, BitWidth: 64" --check-prefix=CHECK
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --strip-ifs-endianness --output=- %p/Inputs/sysv_hash.so | FileCheck %s -DELFTARGET="ObjectFormat: ELF, Arch: x86_64, BitWidth: 64" --check-prefix=CHECK
-# RUN: llvm-ifs --input-format=ELF --output-format=IFS --strip-ifs-bitwidth --output=- %p/Inputs/sysv_hash.so | FileCheck %s -DELFTARGET="ObjectFormat: ELF, Arch: x86_64, Endianness: little" --check-prefix=CHECK
+# RUN: llvm-ifs --input-format=ELF --strip-ifs-target --output-ifs=- %p/Inputs/sysv_hash.so | FileCheck %s --check-prefix=NOTARGET
+# RUN: llvm-ifs --input-format=ELF --strip-ifs-arch --strip-ifs-endianness --strip-ifs-bitwidth --output-ifs=- %p/Inputs/sysv_hash.so | FileCheck %s --check-prefix=NOTARGET
+# RUN: llvm-ifs --input-format=ELF --strip-ifs-arch --output-ifs=- %p/Inputs/sysv_hash.so | FileCheck %s -DELFTARGET="ObjectFormat: ELF, Endianness: little, BitWidth: 64" --check-prefix=CHECK
+# RUN: llvm-ifs --input-format=ELF --strip-ifs-endianness --output-ifs=- %p/Inputs/sysv_hash.so | FileCheck %s -DELFTARGET="ObjectFormat: ELF, Arch: x86_64, BitWidth: 64" --check-prefix=CHECK
+# RUN: llvm-ifs --input-format=ELF --strip-ifs-bitwidth --output-ifs=- %p/Inputs/sysv_hash.so | FileCheck %s -DELFTARGET="ObjectFormat: ELF, Arch: x86_64, Endianness: little" --check-prefix=CHECK
 
 
 # CHECK:      --- !ifs-v1

diff  --git a/llvm/test/tools/llvm-ifs/strip-undefined-symbols.test b/llvm/test/tools/llvm-ifs/strip-undefined-symbols.test
index 380e275f490c..010a1b91b9fc 100644
--- a/llvm/test/tools/llvm-ifs/strip-undefined-symbols.test
+++ b/llvm/test/tools/llvm-ifs/strip-undefined-symbols.test
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=ELF --strip-undefined --output-format=IFS --output=- %p/Inputs/gnu_hash.so | FileCheck %s
+# RUN: llvm-ifs --input-format=ELF --strip-undefined --output-ifs=- %p/Inputs/gnu_hash.so | FileCheck %s
 
 # CHECK:      --- !ifs-v1
 # CHECK-NEXT: IfsVersion:      3.0

diff  --git a/llvm/test/tools/llvm-ifs/strong.ifs b/llvm/test/tools/llvm-ifs/strong.ifs
index 8ae4f92e12b0..b5a9431dada6 100644
--- a/llvm/test/tools/llvm-ifs/strong.ifs
+++ b/llvm/test/tools/llvm-ifs/strong.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/strong.ifs | FileCheck %s --check-prefixes=CHECK-IFS
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s %S/strong.ifs | FileCheck %s --check-prefixes=CHECK-IFS
 
 # CHECK-IFS: --- !ifs-v1
 # CHECK-IFS-NEXT: IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/tvos-tbd.ifs b/llvm/test/tools/llvm-ifs/tvos-tbd.ifs
index 1f7c9d365194..cdb663d152b3 100644
--- a/llvm/test/tools/llvm-ifs/tvos-tbd.ifs
+++ b/llvm/test/tools/llvm-ifs/tvos-tbd.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=TBD -o - %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-tbd - %s | FileCheck %s
 
 # CHECK: --- !tapi-tbd-v3
 # CHECK-NEXT: archs:           [ arm64 ]

diff  --git a/llvm/test/tools/llvm-ifs/version-ok.ifs b/llvm/test/tools/llvm-ifs/version-ok.ifs
index cf3cd4f70711..e6f0ff6475e8 100644
--- a/llvm/test/tools/llvm-ifs/version-ok.ifs
+++ b/llvm/test/tools/llvm-ifs/version-ok.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/object.ifs
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s %S/object.ifs
 
 --- !ifs-v1
 IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/watchos-tbd.ifs b/llvm/test/tools/llvm-ifs/watchos-tbd.ifs
index 4210481a4633..a16b020cb2ef 100644
--- a/llvm/test/tools/llvm-ifs/watchos-tbd.ifs
+++ b/llvm/test/tools/llvm-ifs/watchos-tbd.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=TBD -o - %s | FileCheck %s
+# RUN: llvm-ifs --input-format=IFS --output-tbd - %s | FileCheck %s
 
 # CHECK: --- !tapi-tbd-v3
 # CHECK-NEXT: archs:           [ arm64 ]

diff  --git a/llvm/test/tools/llvm-ifs/weak-mismatch.ifs b/llvm/test/tools/llvm-ifs/weak-mismatch.ifs
index 9bcdaaac6cbb..3c6b09b8a2f0 100644
--- a/llvm/test/tools/llvm-ifs/weak-mismatch.ifs
+++ b/llvm/test/tools/llvm-ifs/weak-mismatch.ifs
@@ -1,5 +1,5 @@
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/Inputs/strong-mismatch-size.ifs 2>&1 | FileCheck %s --check-prefixes=CHECK-SIZE
-# RUN: not llvm-ifs --input-format=IFS --output-format=IFS -o - %s %S/Inputs/strong-mismatch-type.ifs 2>&1 | FileCheck %s --check-prefixes=CHECK-TYPE
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s %S/Inputs/strong-mismatch-size.ifs 2>&1 | FileCheck %s --check-prefixes=CHECK-SIZE
+# RUN: not llvm-ifs --input-format=IFS --output-ifs - %s %S/Inputs/strong-mismatch-type.ifs 2>&1 | FileCheck %s --check-prefixes=CHECK-TYPE
 
 # CHECK-SIZE: error: Interface Stub: Size Mismatch for foobar.
 # CHECK-SIZE-NEXT: Filename:

diff  --git a/llvm/test/tools/llvm-ifs/weak.ifs b/llvm/test/tools/llvm-ifs/weak.ifs
index 04939c0ec72e..f4ca4badbd18 100644
--- a/llvm/test/tools/llvm-ifs/weak.ifs
+++ b/llvm/test/tools/llvm-ifs/weak.ifs
@@ -1,4 +1,4 @@
-# RUN: llvm-ifs --input-format=IFS --output-format=IFS -o - %s | FileCheck %s --check-prefixes=CHECK-IFS
+# RUN: llvm-ifs --input-format=IFS --output-ifs - %s | FileCheck %s --check-prefixes=CHECK-IFS
 
 # CHECK-IFS: --- !ifs-v1
 # CHECK-IFS-NEXT: IfsVersion: 3.0

diff  --git a/llvm/test/tools/llvm-ifs/write-stub-no-nonlocal-symbol.test b/llvm/test/tools/llvm-ifs/write-stub-no-nonlocal-symbol.test
index bd02f459fd27..faa5b660a70c 100644
--- a/llvm/test/tools/llvm-ifs/write-stub-no-nonlocal-symbol.test
+++ b/llvm/test/tools/llvm-ifs/write-stub-no-nonlocal-symbol.test
@@ -1,6 +1,6 @@
 ## Test writing stub elf when symbol table contains no non-local symbol.
 
-# RUN: llvm-ifs --output-format=ELF --output=%t %s
+# RUN: llvm-ifs --output-elf=%t %s
 # RUN: llvm-readobj -S %t | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 
 --- !ifs-v1

diff  --git a/llvm/test/tools/llvm-ifs/write-stub.test b/llvm/test/tools/llvm-ifs/write-stub.test
index 60b9b648722c..53b9cc7f325c 100644
--- a/llvm/test/tools/llvm-ifs/write-stub.test
+++ b/llvm/test/tools/llvm-ifs/write-stub.test
@@ -1,35 +1,40 @@
 ## Test writing stub elf with minimal sections.
 
-# RUN: llvm-ifs --output-format=ELF --output=%t.elf32l --arch=x86_64 --bitwidth=32 --endianness=little %s
+# RUN: llvm-ifs --output-elf=%t.elf32l --arch=x86_64 --bitwidth=32 --endianness=little %s
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf32l | FileCheck %s -DCLASS="32-bit (0x1)" -DDE="LittleEndian (0x1)" -DHS=52 -DPHES=32 -DSHES=40 -DDYNSYMAL=4 -DDYNSYMES=16 -DDYNAMICAL=4 -DDYNAMICES=8 -DDYNTABZ=0
 
-# RUN: llvm-ifs --output-format=ELF --output=%t.elf32b --arch=x86_64 --bitwidth=32 --endianness=big %s
+# RUN: llvm-ifs --output-elf=%t.elf32b --arch=x86_64 --bitwidth=32 --endianness=big %s
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf32b | FileCheck %s -DCLASS="32-bit (0x1)" -DDE="BigEndian (0x2)" -DHS=52 -DPHES=32 -DSHES=40 -DDYNSYMAL=4 -DDYNSYMES=16 -DDYNAMICAL=4 -DDYNAMICES=8 -DDYNTABZ=0
 
-# RUN: llvm-ifs --output-format=ELF --output=%t.elf64l --arch=x86_64 --bitwidth=64 --endianness=little %s
+# RUN: llvm-ifs --output-elf=%t.elf64l --arch=x86_64 --bitwidth=64 --endianness=little %s
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf64l | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 
-# RUN: llvm-ifs --output-format=ELF --output=%t.elf64l --target=x86_64-linux-gnu %s
+# RUN: llvm-ifs --output-elf=%t.elf64l --target=x86_64-linux-gnu %s
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf64l | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 
-# RUN: llvm-ifs --output-format=ELF --output=%t.elf64b --arch=x86_64 --bitwidth=64 --endianness=big %s
+# RUN: llvm-ifs --output-elf=%t.elf64b --arch=x86_64 --bitwidth=64 --endianness=big %s
 # RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf64b | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="BigEndian (0x2)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 
-# RUN: not llvm-ifs --output-format=ELF --output=%t --arch=x86_64 --bitwidth=64 --endianness=big --target=x86_64-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=TRIPLEERR
+# RUN: not llvm-ifs --output-elf=%t --arch=x86_64 --bitwidth=64 --endianness=big --target=x86_64-linux-gnu %s 2>&1 | FileCheck %s --check-prefix=TRIPLEERR
 
-# RUN: not llvm-ifs --output-format=ELF --output=%t --bitwidth=64 --endianness=big %s 2>&1 | FileCheck %s -DMSG="Arch" --check-prefix=TARGETERR
+# RUN: not llvm-ifs --output-elf=%t --bitwidth=64 --endianness=big %s 2>&1 | FileCheck %s -DMSG="Arch" --check-prefix=TARGETERR
 
-# RUN: not llvm-ifs --output-format=ELF --output=%t --arch=x86_64 --endianness=big %s 2>&1 | FileCheck %s -DMSG="BitWidth" --check-prefix=TARGETERR
+# RUN: not llvm-ifs --output-elf=%t --arch=x86_64 --endianness=big %s 2>&1 | FileCheck %s -DMSG="BitWidth" --check-prefix=TARGETERR
 
-# RUN: not llvm-ifs --output-format=ELF --output=%t --arch=x86_64 --bitwidth=64 %s 2>&1 | FileCheck %s -DMSG="Endianness" --check-prefix=TARGETERR
+# RUN: not llvm-ifs --output-elf=%t --arch=x86_64 --bitwidth=64 %s 2>&1 | FileCheck %s -DMSG="Endianness" --check-prefix=TARGETERR
 
-# RUN: llvm-ifs --output-format=IFS --output=%t.target --target=x86_64-linux-gnu %s
-# RUN: not llvm-ifs --output-format=ELF --output=%t --target=aarch64-linux-gnu %t.target 2>&1 | FileCheck %s -DMSG="Triple" --check-prefix=CONFLICTERR
+# RUN: llvm-ifs --output-ifs=%t.target --target=x86_64-linux-gnu %s
+# RUN: not llvm-ifs --output-elf=%t --target=aarch64-linux-gnu %t.target 2>&1 | FileCheck %s -DMSG="Triple" --check-prefix=CONFLICTERR
 
-# RUN: llvm-ifs --output-format=IFS --output=%t.target --arch=x86_64 --endianness=little --bitwidth=64 %s
-# RUN: not llvm-ifs --output-format=ELF --output=%t --arch=AArch64 %t.target 2>&1 | FileCheck %s -DMSG=Arch --check-prefix=CONFLICTERR
-# RUN: not llvm-ifs --output-format=ELF --output=%t --endianness=big %t.target 2>&1 | FileCheck %s -DMSG=Endianness --check-prefix=CONFLICTERR
-# RUN: not llvm-ifs --output-format=ELF --output=%t --bitwidth=32 %t.target 2>&1 | FileCheck %s -DMSG=BitWidth --check-prefix=CONFLICTERR
+# RUN: llvm-ifs --output-ifs=%t.target --arch=x86_64 --endianness=little --bitwidth=64 %s
+# RUN: not llvm-ifs --output-elf=%t --arch=AArch64 %t.target 2>&1 | FileCheck %s -DMSG=Arch --check-prefix=CONFLICTERR
+# RUN: not llvm-ifs --output-elf=%t --endianness=big %t.target 2>&1 | FileCheck %s -DMSG=Endianness --check-prefix=CONFLICTERR
+# RUN: not llvm-ifs --output-elf=%t --bitwidth=32 %t.target 2>&1 | FileCheck %s -DMSG=BitWidth --check-prefix=CONFLICTERR
+
+# RUN: llvm-ifs --output-ifs=%t.ifs --output-elf=%t.elf --target=x86_64-linux-gnu %s
+# RUN: llvm-ifs --output-elf=%t.elf2 --target=x86_64-linux-gnu %t.ifs
+# RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
+# RUN: llvm-readobj -h -S --string-dump .dynstr --string-dump .shstrtab --dyn-symbols --dynamic-table %t.elf2 | FileCheck %s -DCLASS="64-bit (0x2)" -DDE="LittleEndian (0x1)" -DHS=64 -DPHES=56 -DSHES=64 -DDYNSYMAL=8 -DDYNSYMES=24 -DDYNAMICAL=8 -DDYNAMICES=16 -DDYNTABZ=000000000
 
 --- !ifs-v1
 IfsVersion: 3.0
@@ -196,4 +201,4 @@ Symbols:
 
 # TRIPLEERR: error: Target triple cannot be used simultaneously with ELF target format
 # TARGETERR: error: [[MSG]] is not defined in the text stub
-# CONFLICTERR: error: Supplied [[MSG]] conflicts with the text stub
\ No newline at end of file
+# CONFLICTERR: error: Supplied [[MSG]] conflicts with the text stub

diff  --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp
index d034793f019f..0792066f2e61 100644
--- a/llvm/tools/llvm-ifs/llvm-ifs.cpp
+++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp
@@ -57,11 +57,11 @@ cl::opt<FileFormat> InputFormat(
                clEnumValN(FileFormat::ELF, "ELF", "ELF object file")),
     cl::cat(IfsCategory));
 cl::opt<FileFormat> OutputFormat(
-    "output-format", cl::desc("Specify the output file format"),
+    "output-format", cl::desc("Specify the output file format **DEPRECATED**"),
     cl::values(clEnumValN(FileFormat::IFS, "IFS", "Text based ELF stub file"),
                clEnumValN(FileFormat::ELF, "ELF", "ELF stub file"),
                clEnumValN(FileFormat::TBD, "TBD", "Apple TBD text stub file")),
-    cl::Required, cl::cat(IfsCategory));
+    cl::cat(IfsCategory));
 cl::opt<std::string> OptArch("arch",
                              cl::desc("Specify the architecture, e.g. x86_64"),
                              cl::cat(IfsCategory));
@@ -108,10 +108,21 @@ cl::opt<std::string>
     SoName("soname",
            cl::desc("Manually set the DT_SONAME entry of any emitted files"),
            cl::value_desc("name"), cl::cat(IfsCategory));
-cl::opt<std::string> OutputFilePath("output", cl::desc("Output file"),
+cl::opt<std::string> OutputFilePath("output",
+                                    cl::desc("Output file **DEPRECATED**"),
                                     cl::cat(IfsCategory));
 cl::alias OutputFilePathA("o", cl::desc("Alias for --output"),
                           cl::aliasopt(OutputFilePath), cl::cat(IfsCategory));
+cl::opt<std::string> OutputELFFilePath("output-elf",
+                                       cl::desc("Output path for ELF file"),
+                                       cl::cat(IfsCategory));
+cl::opt<std::string> OutputIFSFilePath("output-ifs",
+                                       cl::desc("Output path for IFS file"),
+                                       cl::cat(IfsCategory));
+cl::opt<std::string> OutputTBDFilePath("output-tbd",
+                                       cl::desc("Output path for TBD file"),
+                                       cl::cat(IfsCategory));
+
 cl::opt<bool> WriteIfChanged(
     "write-if-changed",
     cl::desc("Write the output file only if it is new or has changed."),
@@ -320,8 +331,6 @@ int main(int argc, char *argv[]) {
         WithColor::error() << "Interface Stub: Target Mismatch."
                            << "\nFilenames: " << PreviousInputFilePath << " "
                            << InputFilePath;
-        //  << "\nTriple Values: " << Stub.Triple << " "
-        //  << TargetStub->Triple << "\n";
         return -1;
       }
       if (Stub.SoName != TargetStub->SoName) {
@@ -408,63 +417,136 @@ int main(int argc, char *argv[]) {
   if (OverrideError)
     fatalError(std::move(OverrideError));
 
-  switch (OutputFormat.getValue()) {
-  case FileFormat::TBD: {
-    std::error_code SysErr;
-    raw_fd_ostream Out(OutputFilePath, SysErr);
-    if (SysErr) {
-      WithColor::error() << "Couldn't open " << OutputFilePath
-                         << " for writing.\n";
-      return -1;
-    }
-    if (!Stub.Target.Triple) {
-      WithColor::error()
-          << "Triple should be defined when output format is TBD";
+  if (OutputELFFilePath.getNumOccurrences() == 0 &&
+      OutputIFSFilePath.getNumOccurrences() == 0 &&
+      OutputTBDFilePath.getNumOccurrences() == 0) {
+    if (OutputFormat.getNumOccurrences() == 0) {
+      WithColor::error() << "at least one output should be specified.";
       return -1;
     }
-    return writeTbdStub(llvm::Triple(Stub.Target.Triple.getValue()),
-                        Stub.Symbols, "TBD", Out);
+  } else if (OutputFormat.getNumOccurrences() == 1) {
+    WithColor::error() << "'--output-format' cannot be used with "
+                          "'--output-{FILE_FORMAT}' options at the same time";
+    return -1;
   }
-  case FileFormat::IFS: {
-    Stub.IfsVersion = IfsVersionCurrent;
-    if (InputFormat.getValue() == FileFormat::ELF &&
-        OptTargetTripleHint.getNumOccurrences() == 1) {
-      std::error_code HintEC(1, std::generic_category());
-      IFSTarget HintTarget = parseTriple(OptTargetTripleHint);
-      if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue())
-        fatalError(make_error<StringError>(
-            "Triple hint does not match the actual architecture", HintEC));
-      if (Stub.Target.Endianness.getValue() !=
-          HintTarget.Endianness.getValue())
-        fatalError(make_error<StringError>(
-            "Triple hint does not match the actual endianness", HintEC));
-      if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue())
-        fatalError(make_error<StringError>(
-            "Triple hint does not match the actual bit width", HintEC));
-
-      stripIFSTarget(Stub, true, false, false, false);
-      Stub.Target.Triple = OptTargetTripleHint.getValue();
-    } else {
-      stripIFSTarget(Stub, StripIFSTarget, StripIFSArch,
-                     StripIFSEndiannessWidth, StripIFSBitWidth);
+  if (OutputFormat.getNumOccurrences() == 1) {
+    // TODO: Remove OutputFormat flag in the next revision.
+    WithColor::warning() << "--output-format option is deprecated, please use "
+                            "--output-{FILE_FORMAT} options instead\n";
+    switch (OutputFormat.getValue()) {
+    case FileFormat::TBD: {
+      std::error_code SysErr;
+      raw_fd_ostream Out(OutputFilePath, SysErr);
+      if (SysErr) {
+        WithColor::error() << "Couldn't open " << OutputFilePath
+                           << " for writing.\n";
+        return -1;
+      }
+      if (!Stub.Target.Triple) {
+        WithColor::error()
+            << "Triple should be defined when output format is TBD";
+        return -1;
+      }
+      return writeTbdStub(llvm::Triple(Stub.Target.Triple.getValue()),
+                          Stub.Symbols, "TBD", Out);
+    }
+    case FileFormat::IFS: {
+      Stub.IfsVersion = IfsVersionCurrent;
+      if (InputFormat.getValue() == FileFormat::ELF &&
+          OptTargetTripleHint.getNumOccurrences() == 1) {
+        std::error_code HintEC(1, std::generic_category());
+        IFSTarget HintTarget = parseTriple(OptTargetTripleHint);
+        if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue())
+          fatalError(make_error<StringError>(
+              "Triple hint does not match the actual architecture", HintEC));
+        if (Stub.Target.Endianness.getValue() !=
+            HintTarget.Endianness.getValue())
+          fatalError(make_error<StringError>(
+              "Triple hint does not match the actual endianness", HintEC));
+        if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue())
+          fatalError(make_error<StringError>(
+              "Triple hint does not match the actual bit width", HintEC));
+
+        stripIFSTarget(Stub, true, false, false, false);
+        Stub.Target.Triple = OptTargetTripleHint.getValue();
+      } else {
+        stripIFSTarget(Stub, StripIFSTarget, StripIFSArch,
+                       StripIFSEndiannessWidth, StripIFSBitWidth);
+      }
+      if (StripUndefined)
+        stripIFSUndefinedSymbols(Stub);
+      Error IFSWriteError = writeIFS(OutputFilePath.getValue(), Stub);
+      if (IFSWriteError)
+        fatalError(std::move(IFSWriteError));
+      break;
+    }
+    case FileFormat::ELF: {
+      Error TargetError = validateIFSTarget(Stub, true);
+      if (TargetError)
+        fatalError(std::move(TargetError));
+      Error BinaryWriteError =
+          writeBinaryStub(OutputFilePath, Stub, WriteIfChanged);
+      if (BinaryWriteError)
+        fatalError(std::move(BinaryWriteError));
+      break;
+    }
+    }
+  } else {
+    // Check if output path for individual format.
+    if (OutputELFFilePath.getNumOccurrences() == 1) {
+      Error TargetError = validateIFSTarget(Stub, true);
+      if (TargetError)
+        fatalError(std::move(TargetError));
+      Error BinaryWriteError =
+          writeBinaryStub(OutputELFFilePath, Stub, WriteIfChanged);
+      if (BinaryWriteError)
+        fatalError(std::move(BinaryWriteError));
+    }
+    if (OutputIFSFilePath.getNumOccurrences() == 1) {
+      Stub.IfsVersion = IfsVersionCurrent;
+      if (InputFormat.getValue() == FileFormat::ELF &&
+          OptTargetTripleHint.getNumOccurrences() == 1) {
+        std::error_code HintEC(1, std::generic_category());
+        IFSTarget HintTarget = parseTriple(OptTargetTripleHint);
+        if (Stub.Target.Arch.getValue() != HintTarget.Arch.getValue())
+          fatalError(make_error<StringError>(
+              "Triple hint does not match the actual architecture", HintEC));
+        if (Stub.Target.Endianness.getValue() !=
+            HintTarget.Endianness.getValue())
+          fatalError(make_error<StringError>(
+              "Triple hint does not match the actual endianness", HintEC));
+        if (Stub.Target.BitWidth.getValue() != HintTarget.BitWidth.getValue())
+          fatalError(make_error<StringError>(
+              "Triple hint does not match the actual bit width", HintEC));
+
+        stripIFSTarget(Stub, true, false, false, false);
+        Stub.Target.Triple = OptTargetTripleHint.getValue();
+      } else {
+        stripIFSTarget(Stub, StripIFSTarget, StripIFSArch,
+                       StripIFSEndiannessWidth, StripIFSBitWidth);
+      }
+      if (StripUndefined)
+        stripIFSUndefinedSymbols(Stub);
+      Error IFSWriteError = writeIFS(OutputIFSFilePath.getValue(), Stub);
+      if (IFSWriteError)
+        fatalError(std::move(IFSWriteError));
+    }
+    if (OutputTBDFilePath.getNumOccurrences() == 1) {
+      std::error_code SysErr;
+      raw_fd_ostream Out(OutputTBDFilePath, SysErr);
+      if (SysErr) {
+        WithColor::error() << "Couldn't open " << OutputTBDFilePath
+                           << " for writing.\n";
+        return -1;
+      }
+      if (!Stub.Target.Triple) {
+        WithColor::error()
+            << "Triple should be defined when output format is TBD";
+        return -1;
+      }
+      return writeTbdStub(llvm::Triple(Stub.Target.Triple.getValue()),
+                          Stub.Symbols, "TBD", Out);
     }
-    if (StripUndefined)
-      stripIFSUndefinedSymbols(Stub);
-    Error IFSWriteError = writeIFS(OutputFilePath.getValue(), Stub);
-    if (IFSWriteError)
-      fatalError(std::move(IFSWriteError));
-    break;
-  }
-  case FileFormat::ELF: {
-    Error TargetError = validateIFSTarget(Stub, true);
-    if (TargetError)
-      fatalError(std::move(TargetError));
-    Error BinaryWriteError =
-        writeBinaryStub(OutputFilePath, Stub, WriteIfChanged);
-    if (BinaryWriteError)
-      fatalError(std::move(BinaryWriteError));
-    break;
-  }
   }
   return 0;
 }


        


More information about the llvm-commits mailing list