[llvm-commits] [PATCH] [lld] Move everything over to TargetInfo.

Michael Spencer bigcheesegs at gmail.com
Tue Jan 22 16:46:27 PST 2013


  As for OutputKind. I see 11 different types in mach-o/loader.h.

  I'm fine with adding them to OutputKind. The only ones that are actually Mach-O specific are:

  * MH_FVLIB - I assume this means a non-pic shared library. Controlling this should probably just be a flag.
  * MH_PRELOAD
  * MH_DSYM
  * MH_KEXT_BUNDLE


================
Comment at: lib/ReaderWriter/MachO/WriterMachO.cpp:654
@@ +653,3 @@
+    return MH_DYLIB;
+  case OutputKind::Relocatable:
+    return MH_OBJECT;
----------------
kledzik at apple.com wrote:
> You dropped the "bundle" case
Fixed.

================
Comment at: lib/ReaderWriter/MachO/WriterMachO.cpp:800-805
@@ -798,8 +799,8 @@
   // Add entry point load command to main executables
-  if ( _options.addEntryPointLoadCommand() ) {
+  if (_targetInfo.getLinkerOptions()._outputKind == OutputKind::Executable) {
     _entryPointLoadCommand = new entry_point_command(is64);
     this->addLoadCommand(_entryPointLoadCommand);
-  }
-  else if ( _options.addUnixThreadLoadCommand() ) {
-    _threadLoadCommand = new thread_command(_options.cpuType(), is64);
+  } else if (_targetInfo.getLinkerOptions()._outputKind ==
+             OutputKind::Executable) {
+    _threadLoadCommand = new thread_command(_targetInfo.getCPUType(), is64);
     this->addLoadCommand(_threadLoadCommand);
----------------
kledzik at apple.com wrote:
> These if conditions are now incorrect.
They have exactly the same semantics as what was there previously. I moved them into MachOTargetInfo with the same function names.


http://llvm-reviews.chandlerc.com/D321



More information about the llvm-commits mailing list