diff options
| author | fjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-24 18:22:12 +0000 |
|---|---|---|
| committer | fjahanian <fjahanian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-24 18:22:12 +0000 |
| commit | f4447a5d43593683a99ab182766d0be41ba4a52f (patch) | |
| tree | ded4a0527da18fb1860de81c2bc1e0f27467e8fb | |
| parent | eb1877fe3f3ddbcf8fa464f6aac45b577e2a592e (diff) | |
| download | ppe42-gcc-f4447a5d43593683a99ab182766d0be41ba4a52f.tar.gz ppe42-gcc-f4447a5d43593683a99ab182766d0be41ba4a52f.zip | |
Define __PIC__ for darwin targets.
OKed by Mike Stump.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103447 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/config/darwin.h | 8 | ||||
| -rw-r--r-- | gcc/config/rs6000/darwin.h | 1 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/pic-macro-define.c | 10 |
4 files changed, 25 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b20069cb28a..26ea0debe95 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-08-24 Fariborz Jahanian <fjahanian@apple.com> + + * config/darwin.h: define __PIC__ + * config/rs6000/darwin.h: Add SUBTARGET_OS_CPP_BUILTINS to + TARGET_OS_CPP_BUILTINS macro. + 2005-08-24 Paolo Bonzini <bonzini@gnu.org> * config/rs6000/rs6000.md: Fix thinko in the peephole2 I added diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index c611cb8b1da..08abfbe1000 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -140,6 +140,14 @@ Boston, MA 02110-1301, USA. */ { "-unexported_symbols_list", "-Zunexported_symbols_list" }, \ SUBTARGET_OPTION_TRANSLATE_TABLE +#define SUBTARGET_OS_CPP_BUILTINS() \ + do \ + { \ + if (flag_pic) \ + builtin_define ("__PIC__"); \ + } \ + while (0) + /* These compiler options take n arguments. */ #undef WORD_SWITCH_TAKES_ARG diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h index 482c6e74f9a..ef1532d776f 100644 --- a/gcc/config/rs6000/darwin.h +++ b/gcc/config/rs6000/darwin.h @@ -55,6 +55,7 @@ builtin_define ("__POWERPC__"); \ builtin_define ("__NATURAL_ALIGNMENT__"); \ darwin_cpp_builtins (pfile); \ + SUBTARGET_OS_CPP_BUILTINS (); \ } \ while (0) diff --git a/gcc/testsuite/gcc.dg/pic-macro-define.c b/gcc/testsuite/gcc.dg/pic-macro-define.c new file mode 100644 index 00000000000..7bda6fedfef --- /dev/null +++ b/gcc/testsuite/gcc.dg/pic-macro-define.c @@ -0,0 +1,10 @@ +/* { dg-do run { target "i?86-*-*-darwin" powerpc*-*-darwin* } } */ +/* { dg-options "-fPIC" } */ + +#if defined __PIC__ +int main() { + return 0; +} +#else + error "NO __PIC__ DEFINED" +#endif |

