Refresh mclinker NDK local patches since 2.6 push

Refresh local patches for git merge of mclinker upstream
05892085ddeef90d579c7e0f82a930a498064154

Change-Id: I45e3213cee51e73d050ffb07bf60ba8743ea1ea8
diff --git a/build/tools/toolchain-patches/mclinker/0001-Compile-against-llvm-3.4.patch b/build/tools/toolchain-patches/mclinker/0001-Compile-against-llvm-3.4.patch
deleted file mode 100644
index 76d60f3..0000000
--- a/build/tools/toolchain-patches/mclinker/0001-Compile-against-llvm-3.4.patch
+++ /dev/null
@@ -1,236 +0,0 @@
-From 609816828a63399cdfee87b8147131e8e587d03b Mon Sep 17 00:00:00 2001
-From: Lai Wei-Chih <Robert.Lai@mediatek.com>
-Date: Fri, 25 Oct 2013 09:41:25 +0800
-Subject: [PATCH] Compile against llvm-3.4
-
-instead of against LLVM trunk@187732
----
- include/mcld/CodeGen/TargetMachine.h |   15 ++++++++-----
- lib/CodeGen/MCLDTargetMachine.cpp    |   40 +++++++++++++++-------------------
- test/lit.cfg                         |   35 ++++++++++++++++-------------
- test/lit.site.cfg.in                 |    2 +-
- 4 files changed, 47 insertions(+), 45 deletions(-)
-
-diff --git a/include/mcld/CodeGen/TargetMachine.h b/include/mcld/CodeGen/TargetMachine.h
-index 829774f..b70a49e 100644
---- a/include/mcld/CodeGen/TargetMachine.h
-+++ b/include/mcld/CodeGen/TargetMachine.h
-@@ -19,8 +19,11 @@ class TargetMachine;
- class MCContext;
- class raw_ostream;
- class formatted_raw_ostream;
--class PassManagerBase;
- 
-+// The old pass manager infrastructure is hidden in a legacy namespace now.
-+namespace legacy {
-+class PassManagerBase;
-+} // namespace of legacy
- } // namespace of llvm
- 
- namespace mcld {
-@@ -66,7 +69,7 @@ public:
- 
-   /// appPassesToEmitFile - The target function which we has to modify as
-   /// upstreaming.
--  bool addPassesToEmitFile(llvm::PassManagerBase &,
-+  bool addPassesToEmitFile(llvm::legacy::PassManagerBase &,
-                            mcld::ToolOutputFile& pOutput,
-                            mcld::CodeGenFileType,
-                            llvm::CodeGenOpt::Level,
-@@ -77,21 +80,21 @@ public:
- private:
-   /// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
-   /// both emitting to assembly files or machine code output.
--  bool addCommonCodeGenPasses(llvm::PassManagerBase &,
-+  bool addCommonCodeGenPasses(llvm::legacy::PassManagerBase &,
-                               mcld::CodeGenFileType,
-                               llvm::CodeGenOpt::Level,
-                               bool DisableVerify,
-                               llvm::MCContext *&OutCtx);
- 
--  bool addCompilerPasses(llvm::PassManagerBase &pPM,
-+  bool addCompilerPasses(llvm::legacy::PassManagerBase &pPM,
-                          llvm::formatted_raw_ostream &pOutput,
-                          llvm::MCContext *&OutCtx);
- 
--  bool addAssemblerPasses(llvm::PassManagerBase &pPM,
-+  bool addAssemblerPasses(llvm::legacy::PassManagerBase &pPM,
-                           llvm::raw_ostream &pOutput,
-                           llvm::MCContext *&OutCtx);
- 
--  bool addLinkerPasses(llvm::PassManagerBase &pPM,
-+  bool addLinkerPasses(llvm::legacy::PassManagerBase &pPM,
-                        mcld::LinkerConfig& pConfig,
-                        mcld::Module& pModule,
-                        mcld::MemoryArea& pOutput,
-diff --git a/lib/CodeGen/MCLDTargetMachine.cpp b/lib/CodeGen/MCLDTargetMachine.cpp
-index 964a5be..e95786c 100644
---- a/lib/CodeGen/MCLDTargetMachine.cpp
-+++ b/lib/CodeGen/MCLDTargetMachine.cpp
-@@ -277,8 +277,7 @@ bool mcld::MCLDTargetMachine::addPassesToEmitFile(PassManagerBase &pPM,
- }
- 
- bool mcld::MCLDTargetMachine::addCompilerPasses(PassManagerBase &pPM,
--                                                llvm::formatted_raw_ostream &pOutput,
--                                                llvm::MCContext *&Context)
-+  llvm::formatted_raw_ostream &pOutput, llvm::MCContext *&Context)
- {
-   const MCAsmInfo &MAI = *getTM().getMCAsmInfo();
-   const MCInstrInfo &MII = *getTM().getInstrInfo();
-@@ -287,28 +286,27 @@ bool mcld::MCLDTargetMachine::addCompilerPasses(PassManagerBase &pPM,
- 
-   MCInstPrinter *InstPrinter =
-     m_pLLVMTarget->createMCInstPrinter(MAI.getAssemblerDialect(), MAI,
--                                           MII,
--                                           *Context->getRegisterInfo(), STI);
-+                                       MII, *Context->getRegisterInfo(), STI);
- 
-   MCCodeEmitter* MCE = 0;
-   MCAsmBackend *MAB = 0;
-   if (ArgShowMCEncoding) {
-     MCE = m_pLLVMTarget->createMCCodeEmitter(MII, MRI, STI, *Context);
--    MAB = m_pLLVMTarget->createMCAsmBackend(m_Triple,
--                                                getTM().getTargetCPU());
-+    MAB = m_pLLVMTarget->createMCAsmBackend(MRI, m_Triple,
-+                                            getTM().getTargetCPU());
-   }
- 
- 
-   // now, we have MCCodeEmitter and MCAsmBackend, we can create AsmStreamer.
-   OwningPtr<MCStreamer> AsmStreamer(
-     m_pLLVMTarget->createAsmStreamer(*Context, pOutput,
--                                         getVerboseAsm(),
--                                         getTM().hasMCUseLoc(),
--                                         getTM().hasMCUseCFI(),
--                                         getTM().hasMCUseDwarfDirectory(),
--                                         InstPrinter,
--                                         MCE, MAB,
--                                         ArgShowMCInst));
-+                                     getVerboseAsm(),
-+                                     getTM().hasMCUseLoc(),
-+                                     getTM().hasMCUseCFI(),
-+                                     getTM().hasMCUseDwarfDirectory(),
-+                                     InstPrinter,
-+                                     MCE, MAB,
-+                                     ArgShowMCInst));
- 
-   llvm::MachineFunctionPass* funcPass =
-     m_pLLVMTarget->createAsmPrinter(getTM(), *AsmStreamer.get());
-@@ -334,22 +332,18 @@ bool mcld::MCLDTargetMachine::addAssemblerPasses(PassManagerBase &pPM,
- 
-   // MCAsmBackend
-   MCAsmBackend* MAB =
--    m_pLLVMTarget->createMCAsmBackend(m_Triple,getTM().getTargetCPU());
-+    m_pLLVMTarget->createMCAsmBackend(MRI, m_Triple, getTM().getTargetCPU());
-   if (MCE == 0 || MAB == 0)
-     return true;
- 
-   // now, we have MCCodeEmitter and MCAsmBackend, we can create AsmStreamer.
-   OwningPtr<MCStreamer> AsmStreamer(m_pLLVMTarget->createMCObjectStreamer(
--                                                              m_Triple,
--                                                              *Context,
--                                                              *MAB,
--                                                              pOutput,
--                                                              MCE,
--                                                              getTM().hasMCRelaxAll(),
--                                                              getTM().hasMCNoExecStack()));
-+    m_Triple, *Context, *MAB, pOutput, MCE, getTM().hasMCRelaxAll(),
-+    getTM().hasMCNoExecStack()));
-+
-   AsmStreamer.get()->InitSections();
--  MachineFunctionPass *funcPass = m_pLLVMTarget->createAsmPrinter(getTM(),
--                                                                      *AsmStreamer.get());
-+  MachineFunctionPass *funcPass =
-+    m_pLLVMTarget->createAsmPrinter(getTM(), *AsmStreamer.get());
-   if (funcPass == 0)
-     return true;
-   // If successful, createAsmPrinter took ownership of AsmStreamer
-diff --git a/test/lit.cfg b/test/lit.cfg
-index 549d3ec..ebaacb8 100644
---- a/test/lit.cfg
-+++ b/test/lit.cfg
-@@ -3,6 +3,11 @@
- 
- # Configuration file for the 'lit' test runner.
- 
-+import os
-+
-+import lit.util
-+import lit.formats
-+
- # name: The name of this test suite.
- config.name = 'MCLinker'
- 
-@@ -22,7 +27,7 @@ config.target_triple = 'foo'
- # Get the bindir, and add to PATH.
- llvm_config = config.llvm_config
- if not llvm_config:
--    lit.fatal('No llvm-config specific configuration available!')
-+    lit_config.fatal('No llvm-config specific configuration available!')
- 
- llvm_bindir = lit.util.capture([llvm_config, '--bindir']).strip()
- llvm_obj_root = lit.util.capture([llvm_config, '--obj-root']).strip()
-@@ -39,36 +44,36 @@ config.test_exec_root = os.path.join(config.mclinker_obj_root, 'test')
- 
- llc = config.llc
- if not llc:
--    lit.fatal('No MCLinker specific configuration available!')
--if not lit.quiet:
--    lit.note('using LLC: %r' % llc)
-+    lit_config.fatal('No MCLinker specific configuration available!')
-+if not lit_config.quiet:
-+    lit_config.note('using LLC: %r' % llc)
- config.substitutions.append(('%LLC', llc))
- 
- mcld = config.mcld
- if not mcld:
--    lit.fatal('No MCLinker specific configuration available!')
--if not lit.quiet:
--    lit.note('using MCLinker: %r' % mcld)
-+    lit_config.fatal('No MCLinker specific configuration available!')
-+if not lit_config.quiet:
-+    lit_config.note('using MCLinker: %r' % mcld)
- config.substitutions.append(('%MCLinker', mcld))
- 
- aloneld = config.aloneld
- if not aloneld:
--    lit.fatal('No MCLinker specific configuration available!')
--if not lit.quiet:
--    lit.note('using Alone Linker: %r' % aloneld)
-+    lit_config.fatal('No MCLinker specific configuration available!')
-+if not lit_config.quiet:
-+    lit_config.note('using Alone Linker: %r' % aloneld)
- config.substitutions.append(('%AloneLinker', aloneld))
- 
- fakeld = config.fakeld
- if not fakeld:
--    lit.fatal('No MCLinker specific configuration available!')
--if not lit.quiet:
--    lit.note('using Fake Linker: %r' % fakeld)
-+    lit_config.fatal('No MCLinker specific configuration available!')
-+if not lit_config.quiet:
-+    lit_config.note('using Fake Linker: %r' % fakeld)
- config.substitutions.append(('%FakeLinker', fakeld))
- 
- golden = config.golden_model_linker
- if not golden:
-     golden = 'ld'
--if not lit.quiet:
--    lit.note('golden model linker: %r' % golden)
-+if not lit_config.quiet:
-+    lit_config.note('golden model linker: %r' % golden)
- config.substitutions.append(('%GOLDLD', golden))
- 
-diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
-index 0f50fa0..299a3d3 100644
---- a/test/lit.site.cfg.in
-+++ b/test/lit.site.cfg.in
-@@ -16,4 +16,4 @@ config.fakeld = "@FAKELD@"
- config.llvm_config = "@LLVM_CONFIG@"
- 
- # Let the main config do the real work.
--lit.load_config(config, "@MCLINKER_SOURCE_ROOT@/test/lit.cfg")
-+lit_config.load_config(config, "@MCLINKER_SOURCE_ROOT@/test/lit.cfg")
--- 
-1.7.9.5
-
diff --git a/build/tools/toolchain-patches/mclinker/0002-Fixed-darwin-ld.mcld-GNU-m-emulation-fail.patch b/build/tools/toolchain-patches/mclinker/0001-Fixed-darwin-ld.mcld-GNU-m-emulation-fail.patch
similarity index 83%
rename from build/tools/toolchain-patches/mclinker/0002-Fixed-darwin-ld.mcld-GNU-m-emulation-fail.patch
rename to build/tools/toolchain-patches/mclinker/0001-Fixed-darwin-ld.mcld-GNU-m-emulation-fail.patch
index 5ce03ad..b062599 100644
--- a/build/tools/toolchain-patches/mclinker/0002-Fixed-darwin-ld.mcld-GNU-m-emulation-fail.patch
+++ b/build/tools/toolchain-patches/mclinker/0001-Fixed-darwin-ld.mcld-GNU-m-emulation-fail.patch
@@ -1,19 +1,19 @@
-From 35896d8e00372e9c20ff54c29eb888fb9ffae430 Mon Sep 17 00:00:00 2001
+From db1cf96ebd1c8b8749b4c5b4461aac5af98558ea Mon Sep 17 00:00:00 2001
 From: Andrew Hsieh <andrewhsieh@google.com>
-Date: Sun, 22 Sep 2013 12:20:23 +0800
-Subject: [PATCH 2/3] Fixed darwin ld.mcld GNU -m emulation fail
+Date: Tue, 14 Jan 2014 14:45:14 -0800
+Subject: [PATCH 1/3] Fixed darwin ld.mcld GNU -m emulation fail
 
-Change-Id: Ie0bb6b40687052026b458d4beea35f5a4859a51b
+Change-Id: I95fb07db7b58db94328f24a46f8e6b292c38dd21
 ---
  tools/lite/lib/TripleOptions.cpp | 4 ++--
  tools/mcld/main.cpp              | 4 ++--
  2 files changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/tools/lite/lib/TripleOptions.cpp b/tools/lite/lib/TripleOptions.cpp
-index 3fbf069..5036e26 100644
+index 20ab3b1..3a20e2b 100644
 --- a/tools/lite/lib/TripleOptions.cpp
 +++ b/tools/lite/lib/TripleOptions.cpp
-@@ -84,12 +84,12 @@ ParseEmulation(llvm::Triple& pTriple, const std::string& pEmulation)
+@@ -85,12 +85,12 @@ ParseEmulation(llvm::Triple& pTriple, const std::string& pEmulation)
  {
    llvm::Triple triple = llvm::StringSwitch<llvm::Triple>(pEmulation)
      .Case("armelf_linux_eabi", llvm::Triple("arm", "", "linux", "gnueabi"))
@@ -29,10 +29,10 @@
  
    if (triple.getArch()        == llvm::Triple::UnknownArch &&
 diff --git a/tools/mcld/main.cpp b/tools/mcld/main.cpp
-index aceb0f4..f6a1e5f 100644
+index dcb8140..854aaa9 100644
 --- a/tools/mcld/main.cpp
 +++ b/tools/mcld/main.cpp
-@@ -1018,12 +1018,12 @@ static Triple ParseEmulation(const std::string& pEmulation)
+@@ -1037,12 +1037,12 @@ static Triple ParseEmulation(const std::string& pEmulation)
  {
    Triple result = StringSwitch<Triple>(pEmulation)
      .Case("armelf_linux_eabi", Triple("arm", "", "linux", "gnueabi"))
@@ -48,5 +48,5 @@
  
    if (result.getArch()        == Triple::UnknownArch &&
 -- 
-1.8.4
+1.8.5.2
 
diff --git a/build/tools/toolchain-patches/mclinker/0002-Compile-only-lite-mclinker.patch b/build/tools/toolchain-patches/mclinker/0002-Compile-only-lite-mclinker.patch
new file mode 100644
index 0000000..b156e39
--- /dev/null
+++ b/build/tools/toolchain-patches/mclinker/0002-Compile-only-lite-mclinker.patch
@@ -0,0 +1,22 @@
+From c2c44f326a82ffab6208edf08f7e4c91610a4607 Mon Sep 17 00:00:00 2001
+From: Andrew Hsieh <andrewhsieh@google.com>
+Date: Tue, 14 Jan 2014 14:45:54 -0800
+Subject: [PATCH 2/3] Compile only "lite" mclinker
+
+Change-Id: I91ccf3a2280bbb0cf56957da1552e7e59052a4b8
+---
+ tools/Makefile.am | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/Makefile.am b/tools/Makefile.am
+index fa91a8b..ebddaf4 100644
+--- a/tools/Makefile.am
++++ b/tools/Makefile.am
+@@ -1,3 +1,3 @@
+ AUTOMAKE_OPTIONS = foreign
+ 
+-SUBDIRS = lite mcld
++SUBDIRS = lite # mcld
+-- 
+1.8.5.2
+
diff --git a/build/tools/toolchain-patches/mclinker/0003-Allow-multiple-no-warn-mismatch.patch b/build/tools/toolchain-patches/mclinker/0003-Allow-multiple-no-warn-mismatch.patch
new file mode 100644
index 0000000..470ca1f
--- /dev/null
+++ b/build/tools/toolchain-patches/mclinker/0003-Allow-multiple-no-warn-mismatch.patch
@@ -0,0 +1,38 @@
+From c3f91ccde6e77a4349c7fa0a67a95eebc0151a5c Mon Sep 17 00:00:00 2001
+From: Andrew Hsieh <andrewhsieh@google.com>
+Date: Tue, 14 Jan 2014 14:46:16 -0800
+Subject: [PATCH 3/3] Allow multiple --no-warn-mismatch
+
+Change-Id: I28eba502b7ff63bb5bb994eabe63cf75458ee4b4
+---
+ tools/lite/lib/OutputFormatOptions.cpp | 1 +
+ tools/mcld/main.cpp                    | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/tools/lite/lib/OutputFormatOptions.cpp b/tools/lite/lib/OutputFormatOptions.cpp
+index cfc6c04..f2cfb87 100644
+--- a/tools/lite/lib/OutputFormatOptions.cpp
++++ b/tools/lite/lib/OutputFormatOptions.cpp
+@@ -148,6 +148,7 @@ llvm::cl::opt<mcld::GeneralOptions::HashStyle> ArgHashStyle("hash-style",
+        clEnumValEnd));
+ 
+ llvm::cl::opt<bool> ArgNoWarnMismatch("no-warn-mismatch",
++  llvm::cl::ZeroOrMore,
+   llvm::cl::desc("Allow linking together mismatched input files."),
+   llvm::cl::init(false));
+ 
+diff --git a/tools/mcld/main.cpp b/tools/mcld/main.cpp
+index 854aaa9..38e2531 100644
+--- a/tools/mcld/main.cpp
++++ b/tools/mcld/main.cpp
+@@ -731,6 +731,7 @@ ArgARMCompatibility("p",
+ 
+ static cl::opt<bool>
+ ArgNoWarnMismatch("no-warn-mismatch",
++                  cl::ZeroOrMore,
+                   cl::desc("Allow linking together mismatched input files."),
+                   cl::init(false));
+ 
+-- 
+1.8.5.2
+
diff --git a/build/tools/toolchain-patches/mclinker/0003-Compile-only-lite-mclinker.patch b/build/tools/toolchain-patches/mclinker/0003-Compile-only-lite-mclinker.patch
deleted file mode 100644
index 543dff0..0000000
--- a/build/tools/toolchain-patches/mclinker/0003-Compile-only-lite-mclinker.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-From 07478536239d505e654d88636a6400b3b7fe87b0 Mon Sep 17 00:00:00 2001
-From: Andrew Hsieh <andrewhsieh@google.com>
-Date: Sun, 22 Sep 2013 12:20:51 +0800
-Subject: [PATCH 3/3] Compile only "lite" mclinker
-
-Change-Id: I753730dc983e7b72aa164b2a0f331a63412fde79
----
- tools/Makefile.am | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/Makefile.am b/tools/Makefile.am
-index 1c6bed1..b5c6335 100644
---- a/tools/Makefile.am
-+++ b/tools/Makefile.am
-@@ -1,3 +1,3 @@
- AUTOMAKE_OPTIONS = foreign
- 
--SUBDIRS = bcc lite mcld
-+SUBDIRS = lite # bcc mcld
--- 
-1.8.4
-
diff --git a/build/tools/toolchain-patches/mclinker/0004-ARM-Bypass-R_ARM_V4BX-relocation-now.patch b/build/tools/toolchain-patches/mclinker/0004-ARM-Bypass-R_ARM_V4BX-relocation-now.patch
deleted file mode 100644
index fdc86d2..0000000
--- a/build/tools/toolchain-patches/mclinker/0004-ARM-Bypass-R_ARM_V4BX-relocation-now.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 7d6b3a763d7dc78eb70a3e4570c4f155f3019b45 Mon Sep 17 00:00:00 2001
-From: Chinyen Chou <petechou@gmail.com>
-Date: Tue, 8 Oct 2013 14:26:48 +0800
-Subject: [PATCH] [ARM] Bypass R_ARM_V4BX relocation now.
-
-Upstream 824a0b515c437abe3e5c59d1e143e9552668e710
-
-Change-Id: I2b04ec08c3660ee8904748a4c306ed49777808a6
----
- lib/Target/ARM/ARMLDBackend.cpp         | 6 ++++--
- lib/Target/ARM/ARMRelocationFunctions.h | 2 +-
- 2 files changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/lib/Target/ARM/ARMLDBackend.cpp b/lib/Target/ARM/ARMLDBackend.cpp
-index 8082426..f159c46 100644
---- a/lib/Target/ARM/ARMLDBackend.cpp
-+++ b/lib/Target/ARM/ARMLDBackend.cpp
-@@ -536,8 +536,7 @@ ARMGNULDBackend::doRelax(Module& pModule, IRBuilder& pBuilder, bool& pFinished)
-           case llvm::ELF::R_ARM_THM_CALL:
-           case llvm::ELF::R_ARM_THM_XPC22:
-           case llvm::ELF::R_ARM_THM_JUMP24:
--          case llvm::ELF::R_ARM_THM_JUMP19:
--          case llvm::ELF::R_ARM_V4BX: {
-+          case llvm::ELF::R_ARM_THM_JUMP19: {
-             // calculate the possible symbol value
-             uint64_t sym_value = 0x0;
-             LDSymbol* symbol = relocation->symInfo()->outSymbol();
-@@ -576,6 +575,9 @@ ARMGNULDBackend::doRelax(Module& pModule, IRBuilder& pBuilder, bool& pFinished)
-             }
-             break;
-           }
-+          case llvm::ELF::R_ARM_V4BX:
-+            /* FIXME: bypass R_ARM_V4BX relocation now */
-+            break;
-           default:
-             break;
-         } // end of switch
-diff --git a/lib/Target/ARM/ARMRelocationFunctions.h b/lib/Target/ARM/ARMRelocationFunctions.h
-index 94df077..364815b 100644
---- a/lib/Target/ARM/ARMRelocationFunctions.h
-+++ b/lib/Target/ARM/ARMRelocationFunctions.h
-@@ -77,7 +77,7 @@ DECL_ARM_APPLY_RELOC_FUNC(unsupport)
-   { &unsupport,         37, "R_ARM_ALU_SBREL_27_20_CK"},  \
-   { &abs32,             38, "R_ARM_TARGET1"           },  \
-   { &unsupport,         39, "R_ARM_SBREL31"           },  \
--  { &unsupport,         40, "R_ARM_V4BX"              },  \
-+  { &none,              40, "R_ARM_V4BX"              },  \
-   { &got_prel,          41, "R_ARM_TARGET2"           },  \
-   { &prel31,            42, "R_ARM_PREL31"            },  \
-   { &movw_abs_nc,       43, "R_ARM_MOVW_ABS_NC"       },  \
--- 
-1.8.4
-
diff --git a/build/tools/toolchain-patches/mclinker/0005-add-no-warn-mismatch-option-support.patch b/build/tools/toolchain-patches/mclinker/0005-add-no-warn-mismatch-option-support.patch
deleted file mode 100644
index 3c34d59..0000000
--- a/build/tools/toolchain-patches/mclinker/0005-add-no-warn-mismatch-option-support.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-commit 69dc7d5ef1c74a60b9391441924f7a25078457a6
-Author: Chinyen Chou <petechou@gmail.com>
-Date:   Mon Oct 21 14:29:15 2013 +0800
-
-    [Linker Option] Add --no-warn-mismatch option support.
-
-diff --git a/include/mcld/GeneralOptions.h b/include/mcld/GeneralOptions.h
-index 46a1e57..60487c0 100644
---- a/include/mcld/GeneralOptions.h
-+++ b/include/mcld/GeneralOptions.h
-@@ -274,6 +274,12 @@ public:
-   bool printMap() const
-   { return m_bPrintMap; }
- 
-+  void setWarnMismatch(bool pEnable = true)
-+  { m_bWarnMismatch = pEnable; }
-+
-+  bool warnMismatch() const
-+  { return m_bWarnMismatch; }
-+
-   // -G, max GP size option
-   void setGPSize(int gpsize)
-   { m_GPSize = gpsize; }
-@@ -371,6 +377,7 @@ private:
-   bool m_bNewDTags: 1; // --enable-new-dtags
-   bool m_bNoStdlib: 1; // -nostdlib
-   bool m_bPrintMap: 1; // --print-map
-+  bool m_bWarnMismatch: 1; // --no-warn-mismatch
-   uint32_t m_GPSize; // -G, --gpsize
-   StripSymbolMode m_StripSymbols;
-   RpathList m_RpathList;
-diff --git a/lib/Core/GeneralOptions.cpp b/lib/Core/GeneralOptions.cpp
-index c0196e5..b4c1f22 100644
---- a/lib/Core/GeneralOptions.cpp
-+++ b/lib/Core/GeneralOptions.cpp
-@@ -53,6 +53,7 @@ GeneralOptions::GeneralOptions()
-     m_bFatalWarnings(false),
-     m_bNewDTags(false),
-     m_bNoStdlib(false),
-+    m_bWarnMismatch(true),
-     m_GPSize(8),
-     m_StripSymbols(KeepAllSymbols),
-     m_HashStyle(SystemV) {
-diff --git a/lib/Object/ObjectLinker.cpp b/lib/Object/ObjectLinker.cpp
-index 67fd1d5..1becc30 100644
---- a/lib/Object/ObjectLinker.cpp
-+++ b/lib/Object/ObjectLinker.cpp
-@@ -185,8 +185,9 @@ void ObjectLinker::normalize()
-       }
-     }
-     else {
--      warning(diag::warn_unrecognized_input_file) << (*input)->path()
--        << m_Config.targets().triple().str();
-+      if (m_Config.options().warnMismatch())
-+        warning(diag::warn_unrecognized_input_file) << (*input)->path()
-+          << m_Config.targets().triple().str();
-     }
-   } // end of for
- }
-diff --git a/tools/lite/include/lite/OutputFormatOptions.h b/tools/lite/include/lite/OutputFormatOptions.h
-index 99ce54e..c9982d5 100644
---- a/tools/lite/include/lite/OutputFormatOptions.h
-+++ b/tools/lite/include/lite/OutputFormatOptions.h
-@@ -51,6 +51,8 @@ private:
-   llvm::cl::opt<bool>& m_ExportDynamic;
-   llvm::cl::opt<std::string>& m_BuildID;
-   llvm::cl::list<std::string>& m_ExcludeLIBS;
-+
-+  llvm::cl::opt<bool>& m_NoWarnMismatch;
- };
- 
- } // namespace of mcld
-diff --git a/tools/lite/lib/OutputFormatOptions.cpp b/tools/lite/lib/OutputFormatOptions.cpp
-index 7ee8248..cfc6c04 100644
---- a/tools/lite/lib/OutputFormatOptions.cpp
-+++ b/tools/lite/lib/OutputFormatOptions.cpp
-@@ -147,6 +147,10 @@ llvm::cl::opt<mcld::GeneralOptions::HashStyle> ArgHashStyle("hash-style",
-                  "both the classic ELF and new style GNU hash tables"),
-        clEnumValEnd));
- 
-+llvm::cl::opt<bool> ArgNoWarnMismatch("no-warn-mismatch",
-+  llvm::cl::desc("Allow linking together mismatched input files."),
-+  llvm::cl::init(false));
-+
- // Not supported yet {
- llvm::cl::opt<bool> ArgExportDynamic("export-dynamic",
-   llvm::cl::desc("Export all dynamic symbols"),
-@@ -193,7 +197,8 @@ OutputFormatOptions::OutputFormatOptions()
-     m_HashStyle(ArgHashStyle),
-     m_ExportDynamic(ArgExportDynamic),
-     m_BuildID(ArgBuildID),
--    m_ExcludeLIBS(ArgExcludeLIBS) {
-+    m_ExcludeLIBS(ArgExcludeLIBS),
-+    m_NoWarnMismatch(ArgNoWarnMismatch) {
- }
- 
- bool OutputFormatOptions::parse(mcld::Module& pModule, LinkerConfig& pConfig)
-@@ -222,6 +227,10 @@ bool OutputFormatOptions::parse(mcld::Module& pModule, LinkerConfig& pConfig)
-   pConfig.options().setOMagic(m_OMagic);
-   pConfig.options().setHashStyle(m_HashStyle);
-   pConfig.options().setExportDynamic(m_ExportDynamic);
-+  if (m_NoWarnMismatch)
-+    pConfig.options().setWarnMismatch(false);
-+  else
-+    pConfig.options().setWarnMismatch(true);
-   // build-id
-   // exclude-libs
- 
-diff --git a/tools/mcld/main.cpp b/tools/mcld/main.cpp
-index aceb0f4..3fc1a7b 100644
---- a/tools/mcld/main.cpp
-+++ b/tools/mcld/main.cpp
-@@ -707,13 +707,14 @@ ArgARMCompatibility("p",
-                     cl::desc("Ignore for ARM backward compatibility"),
-                     cl::init(false));
- 
-+/// @{
-+/// @name FIXME: end of unsupported options
-+/// @}
-+
- static cl::opt<bool>
- ArgNoWarnMismatch("no-warn-mismatch",
-                   cl::desc("Allow linking together mismatched input files."),
-                   cl::init(false));
--/// @{
--/// @name FIXME: end of unsupported options
--/// @}
- 
- static cl::opt<bool>
- ArgNoStdlib("nostdlib",
-@@ -1144,6 +1145,10 @@ static bool ProcessLinkerOptionsFromCommand(mcld::LinkerScript& pScript,
-   pConfig.options().setNoStdlib(ArgNoStdlib);
-   pConfig.options().setPrintMap(ArgPrintMap);
-   pConfig.options().setGPSize(ArgGPSize);
-+  if (ArgNoWarnMismatch)
-+    pConfig.options().setWarnMismatch(false);
-+  else
-+    pConfig.options().setWarnMismatch(true);
- 
-   if (ArgStripAll)
-     pConfig.options().setStripSymbols(mcld::GeneralOptions::StripAllSymbols);