[PATCH] Respect object format choice on Darwin

Tim Northover t.p.northover at gmail.com
Sun Nov 9 18:13:06 PST 2014


================
Comment at: lib/MC/MCObjectFileInfo.cpp:844-845
@@ -843,3 +843,4 @@
        Arch == Triple::UnknownArch) &&
-      (TT.isOSDarwin() || TT.isOSBinFormatMachO())) {
+      (TT.isOSDarwin() || TT.isOSBinFormatMachO()) &&
+       TT.getObjectFormat() == Triple::MachO) {
     Env = IsMachO;
----------------
loladiro wrote:
> t.p.northover wrote:
> > The new condition is redundant: isOSBinFormatMachO is the same as your added clause, so it amounts to completely removing the isOSDarwin check. Which actually does seem like quite an improvement, even if the code you get out of x86_64-macosx-elf is clinically insane.
> Ah, interesting. Does anybody know why the `TT.isOSDarwin()` was there in the first place?
History. Until recently, the increasingly inaccurately named Triple only had 4 components. MachO was implied by either a Darwin OS or an explicit "MachO" environment/ABI.

Looks like a fairly mechanical change when the separate object format field was added, which didn't quite work in this case. This patch (well, the simplified version) is looking better and better!

http://reviews.llvm.org/D6185






More information about the llvm-commits mailing list