[PATCH] Respect object format choice on Darwin

Tim Northover t.p.northover at gmail.com
Sun Nov 9 17:37:30 PST 2014


Hi,

Interesting idea. I could see that could be useful in reducing variance in a product if your expertise is in ELF. I'm sure you know, but you should be wary with this; I wouldn't bet on the backends being quite as object-format agnostic as you'd hope, quite apart from any interactions with externally defined objects.

I did spot one thing with the patch (see below). I also think Lang should have at least a brief glance at it. He's far more aware of whether this could work than me.

Cheers.

Tim.

================
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;
----------------
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.

http://reviews.llvm.org/D6185






More information about the llvm-commits mailing list