[cfe-commits] r63129 - in /cfe/trunk/tools/ccc: ccclib/Tools.py test/ccc/darwin-hello.m

Daniel Dunbar daniel at zuster.org
Tue Jan 27 12:42:58 PST 2009


Author: ddunbar
Date: Tue Jan 27 14:42:58 2009
New Revision: 63129

URL: http://llvm.org/viewvc/llvm-project?rev=63129&view=rev
Log:
ccc/Darwin/clang: Fix a mistranslation for the llvm-backend; llvm-gcc
doesn't set the relocation model when -mdynamic-no-pic is present.

Added:
    cfe/trunk/tools/ccc/test/ccc/darwin-hello.m
Modified:
    cfe/trunk/tools/ccc/ccclib/Tools.py

Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=63129&r1=63128&r2=63129&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Tue Jan 27 14:42:58 2009
@@ -227,7 +227,7 @@
                 cmd_args.extend(arglist.renderAsInput(arg))
         else:
             # Perform argument translation for LLVM backend. This
-            # performs some care in reconciling with llvm-gcc. The
+            # takes some care in reconciling with llvm-gcc. The
             # issue is that llvm-gcc translates these options based on
             # the values in cc1, whereas we are processing based on
             # the driver arguments.
@@ -251,7 +251,7 @@
             if (archName == 'x86_64' or 
                 picEnabled):
                 cmd_args.append('--relocation-model=pic')
-            else:
+            elif not arglist.getLastArg(arglist.parser.m_dynamicNoPicOption):
                 cmd_args.append('--relocation-model=static')
 
             if arglist.getLastArg(arglist.parser.f_timeReportOption):

Added: cfe/trunk/tools/ccc/test/ccc/darwin-hello.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/test/ccc/darwin-hello.m?rev=63129&view=auto

==============================================================================
--- cfe/trunk/tools/ccc/test/ccc/darwin-hello.m (added)
+++ cfe/trunk/tools/ccc/test/ccc/darwin-hello.m Tue Jan 27 14:42:58 2009
@@ -0,0 +1,17 @@
+// Check that object files compiled with -mdynamic-no-pic can be
+// linked.
+// 
+// RUN: xcc -ccc-clang -m32 -mdynamic-no-pic %s -c -o %t.o &&
+// RUN: xcc -ccc-clang -m32 %t.o -o %t &&
+// RUN: %t | grep "Hello, World" &&
+// RUN: xcc -ccc-clang -m64 -mdynamic-no-pic %s -c -o %t.o &&
+// RUN: xcc -ccc-clang -m64 %t.o -o %t &&
+// RUN: %t | grep "Hello, World" &&
+// RUN: true
+
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+  fprintf(stdout, "Hello, World");
+  return 0;
+}





More information about the cfe-commits mailing list