<div dir="ltr">In most languages that I know, if one accepts "0x" as a hex digit prefix, it also accepts "0X". So I'm wondering if it has to compare the prefix case insensitive way. I did not test it though. I'm sorry if it missed the point.<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 3:31 AM, Tim Northover <span dir="ltr"><<a href="mailto:tnorthover@apple.com" target="_blank">tnorthover@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tnorthover<br>
Date: Thu Sep 11 05:31:46 2014<br>
New Revision: 217578<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=217578&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=217578&view=rev</a><br>
Log:<br>
[mach-o]: support optional "0x" prefix for -image_base<br>
<br>
Modified:<br>
    lld/trunk/lib/Driver/DarwinLdDriver.cpp<br>
    lld/trunk/test/mach-o/image-base.yaml<br>
<br>
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=217578&r1=217577&r2=217578&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=217578&r1=217577&r2=217578&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)<br>
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Thu Sep 11 05:31:46 2014<br>
@@ -313,8 +313,12 @@ bool DarwinLdDriver::parse(int argc, con<br>
     ctx.setOutputPath("a.out");<br>
<br>
   if (llvm::opt::Arg *imageBase = parsedArgs->getLastArg(OPT_image_base)) {<br>
+    StringRef baseString = imageBase->getValue();<br>
+    if (baseString.startswith("0x"))<br>
+      baseString = baseString.drop_front(2);<br>
+<br>
     uint64_t baseAddress;<br>
-    if (StringRef(imageBase->getValue()).getAsInteger(16, baseAddress)) {<br>
+    if (baseString.getAsInteger(16, baseAddress)) {<br>
       diagnostics << "error: image_base expects a hex number\n";<br>
       return false;<br>
     } else if (baseAddress < ctx.pageZeroSize()) {<br>
<br>
Modified: lld/trunk/test/mach-o/image-base.yaml<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/image-base.yaml?rev=217578&r1=217577&r2=217578&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/image-base.yaml?rev=217578&r1=217577&r2=217578&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/mach-o/image-base.yaml (original)<br>
+++ lld/trunk/test/mach-o/image-base.yaml Thu Sep 11 05:31:46 2014<br>
@@ -1,6 +1,6 @@<br>
 # RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t -image_base 31415926000 %p/Inputs/libSystem.yaml<br>
 # RUN: macho-dump %t | FileCheck %s<br>
-# RUN: not lld -flavor darwin -arch x86_64 -image_base 31415926530 %s >/dev/null 2> %t<br>
+# RUN: not lld -flavor darwin -arch x86_64 -image_base 0x31415926530 %s >/dev/null 2> %t<br>
 # RUN: FileCheck < %t %s --check-prefix=CHECK-ERROR-MISPAGED<br>
 # RUN: not lld -flavor darwin -arch x86_64 -image_base 1000 %s >/dev/null 2> %t<br>
 # RUN: FileCheck < %t %s --check-prefix=CHECK-ERROR-OVERLAP<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>