diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-01-27 20:42:58 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-01-27 20:42:58 +0000 |
commit | 6262cc40d8108a13e6a7e96e1b2c91d8e1b9c2dc (patch) | |
tree | 73c78882514b6c4e528249048bb473eafd4e7ecf | |
parent | 03eb543cf7ebee463b33b5802b83ac92c21770cf (diff) |
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
-rw-r--r-- | tools/ccc/ccclib/Tools.py | 4 | ||||
-rw-r--r-- | tools/ccc/test/ccc/darwin-hello.m | 17 |
2 files changed, 19 insertions, 2 deletions
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 <stdio.h> + +int main(int argc, char **argv) { + fprintf(stdout, "Hello, World"); + return 0; +} |