From patchwork Thu Jan 20 12:41:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PowerPC -mcmodel preprocessor define Date: Thu, 20 Jan 2011 02:41:36 -0000 From: Alan Modra X-Patchwork-Id: 79679 Message-Id: <20110120124136.GE11694@bubble.grove.modra.org> To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Someone in IBM (Ulrich Weigand?) observed that some powerpc asm may need changing for -mcmodel=medium, so it would be a good idea to define builtin macros to allow selection of the correct asm. Bootstrapped etc. powerpc64-linux. OK for 4.6? I know this isn't a regression fix, but I'm hoping the rules can be bent enough for this to go in. * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Add builtin_define __CMODEL_MEDIUM__ and __CMODEL_LARGE__. Index: gcc/config/rs6000/rs6000-c.c =================================================================== --- gcc/config/rs6000/rs6000-c.c (revision 167467) +++ gcc/config/rs6000/rs6000-c.c (working copy) @@ -385,6 +385,20 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi builtin_define ("__LONGDOUBLE128"); } + switch (TARGET_CMODEL) + { + /* Deliberately omit __CMODEL_SMALL__ since that was the default + before -mcmodel support was added. */ + case CMODEL_MEDIUM: + builtin_define ("__CMODEL_MEDIUM__"); + break; + case CMODEL_LARGE: + builtin_define ("__CMODEL_LARGE__"); + break; + default: + break; + } + switch (rs6000_current_abi) { case ABI_V4: