<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; ">Joe, Thanks for starting to help out with the mach-o part of lld.  Comments below:</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; "><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "> </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+std::string MachOTargetInfo::PackedVersion::unparse() const {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+  std::string buffer;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+  llvm::raw_string_ostream str(buffer);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+  str << llvm::format("%i.%i.%i", _value >> 16, (_value >> 8) & 0xFF,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+                      _value & 0xFF);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+  return str.str();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+}</div><div><br></div><div>If you change this function to take a stream to write to, you won't need the stream and buffer temporaries.</div><div><br></div><div><br></div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+  if (parsedArgs->getLastArg(OPT_dump_args)) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+    info.dumpArgs(llvm::outs());</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+    return true;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+  }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Monaco; ">+</div></div><div><br></div><div>This is called after validate() which sets up some defaults.  That will make for some unexpected output.  For instance, dumpArgs() will also add the -e option even if it was not specified.   We need to decide if dumpArgs() prints the minimal arguments or every possible argument with its default value (e.g. -image_base 0).  </div><div><br></div><div>-Nick</div><div><br></div><div><div>On May 20, 2013, at 3:42 PM, Joe Ranieri wrote:</div><blockquote type="cite"><div dir="ltr">The ld64_test patch adds basic infrastructure for testing that the Darwin driver is parsing and validating command line arguments correctly. A flag, -dump_args, has been added to the driver that will print out all of the command line arguments that would create the MachOTargetInfo. This includes arguments whose values are deduced by MachOTargetInfo::validate.<div>



<br></div><div>The ld64_executable_fix patch fixes the handling of the static executables, making the test added in the first patch pass.</div><div><br></div><div>-- Joe Ranieri</div></div>
<span><ld64_executable_fix.diff></span><span><ld64_test.diff></span>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></body></html>