From: Daniel Dunbar Date: Tue, 27 Jan 2009 20:42:58 +0000 (+0000) Subject: ccc/Darwin/clang: Fix a mistranslation for the llvm-backend; llvm-gcc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6262cc40d8108a13e6a7e96e1b2c91d8e1b9c2dc;p=clang ccc/Darwin/clang: Fix a mistranslation for the llvm-backend; llvm-gcc doesn't set the relocation model when -mdynamic-no-pic is present. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63129 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/ccc/ccclib/Tools.py b/tools/ccc/ccclib/Tools.py index 0dcd52e726..62720624cb 100644 --- a/tools/ccc/ccclib/Tools.py +++ b/tools/ccc/ccclib/Tools.py @@ -227,7 +227,7 @@ class Clang_CompileTool(Tool): 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 @@ class Clang_CompileTool(Tool): 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): diff --git a/tools/ccc/test/ccc/darwin-hello.m b/tools/ccc/test/ccc/darwin-hello.m new file mode 100644 index 0000000000..73289e99cf --- /dev/null +++ b/tools/ccc/test/ccc/darwin-hello.m @@ -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 + +int main(int argc, char **argv) { + fprintf(stdout, "Hello, World"); + return 0; +}