This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH 2.95.4] Offer backward compatible abi for vxworks



  VxWorks ppc targets need backward compatibility with the WRS version of
gcc, which is based on 2.7.2, and has one departure from the eabi spec: DF
mode function arguments are only word (4 byte) aligned.  Although this was
only a mistake that has since been fixed, the design is frozen in place in
the vxworks system libraries, and so vxworks should really be considered an
eabi variant.  This patch implements a new target switch, -mvxcompat272,
which causes doubles to be aligned as in 2.7.2-WRS.

  Although this patch touches non vxworks-specific target files, it is
trivial to observe by inspection of the code that it is safe as the
TARGET_VXCOMPAT272 flag will never be set for other targets.

  Any other functionality that is needed in the future for vxworks
compatibility could be subsumed into the semantics of this switch.

     DaveK

=========================================================

2001-04-02  Dave Korn <davek-ml@ntlworld.com>

        * config/rs6000/rs6000.h (target_flags):  Add new target flag bit
        MASK_VXCOMPAT272 and corresponding TARGET_VXCOMPAT272 predicate.

        * config/rs6000/vxppc.h (EXTRA_SUBTARGET_SWITCHES):  Allow new switch
        -mvxcompat272 to enable MASK_VXCOMPAT272, generating backwardly 
        compatible abi for vxworks.
        (CPP_SPEC):  Add feature detect predefined macro to indicate backwardly
        compatible abi is in use.

        * config/rs6000/rs6000.c (function_arg_padding, function_arg_boundary,
        function_arg_advance):  Only align DFmode to 32 bits, not 64, if 
        TARGET_VXCOMPAT272 is on, generating objects backwardly compatible with
        the WRS 2.7.2-based compiler and OS libraries.


diff -c3pr /gcc.orig/gcc/gcc/config/rs6000/rs6000.c /gcc.dev/gcc/gcc/config/rs6000/rs6000.c
*** /gcc.orig/gcc/gcc/config/rs6000/rs6000.c Mon Feb  5 02:05:19 2001
--- /gcc.dev/gcc/gcc/config/rs6000/rs6000.c Thu Mar 29 22:01:26 2001
***************
*** 1,6 ****
  /* Subroutines used for code generation on IBM RS/6000.
!    Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
!    Free Software Foundation, Inc.
     Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
  
  This file is part of GNU CC.
--- 1,6 ----
  /* Subroutines used for code generation on IBM RS/6000.
!    Copyright (C) 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 
!    2001 Free Software Foundation, Inc.
     Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
  
  This file is part of GNU CC.
*************** function_arg_padding (mode, type)
*** 1419,1425 ****
     
     Windows NT wants anything >= 8 bytes to be double word aligned.
  
!    V.4 wants long longs to be double word aligned.  */
  
  int
  function_arg_boundary (mode, type)
--- 1419,1426 ----
     
     Windows NT wants anything >= 8 bytes to be double word aligned.
  
!    V.4 wants long longs to be double word aligned.  
!    WRS272 does not align DFmode to 64              */
  
  int
  function_arg_boundary (mode, type)
*************** function_arg_boundary (mode, type)
*** 1427,1433 ****
       tree type;
  {
    if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
!       && (mode == DImode || mode == DFmode))
      return 64;
  
    if (DEFAULT_ABI != ABI_NT || TARGET_64BIT)
--- 1428,1434 ----
       tree type;
  {
    if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS)
!       && (mode == DImode || ((!TARGET_VXCOMPAT272) && mode == DFmode)))
      return 64;
  
    if (DEFAULT_ABI != ABI_NT || TARGET_64BIT)
*************** function_arg_advance (cum, mode, type, n
*** 1461,1467 ****
       cum->fregno++;
     else
       {
!        if (mode == DFmode)
           cum->words += cum->words & 1;
         cum->words += RS6000_ARG_SIZE (mode, type, 1);
       }
--- 1462,1469 ----
       cum->fregno++;
     else
       {
!         /* DFmode is 32-, not 64- aligned on stack in 272 abi */
!        if (mode == DFmode && (!TARGET_VXCOMPAT272))
           cum->words += cum->words & 1;
         cum->words += RS6000_ARG_SIZE (mode, type, 1);
       }
diff -c3pr /gcc.orig/gcc/gcc/config/rs6000/rs6000.h /gcc.dev/gcc/gcc/config/rs6000/rs6000.h
*** /gcc.orig/gcc/gcc/config/rs6000/rs6000.h Fri Dec 22 20:39:59 2000
--- /gcc.dev/gcc/gcc/config/rs6000/rs6000.h Thu Mar 29 22:01:26 2001
***************
*** 1,5 ****
  /* Definitions of target machine for GNU compiler, for IBM RS/6000.
!    Copyright (C) 1992, 93-8, 1999 Free Software Foundation, Inc.
     Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
  
  This file is part of GNU CC.
--- 1,5 ----
  /* Definitions of target machine for GNU compiler, for IBM RS/6000.
!    Copyright (C) 1992, 93-8, 1999, 2001 Free Software Foundation, Inc.
     Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
  
  This file is part of GNU CC.
*************** extern int target_flags;
*** 279,284 ****
--- 279,287 ----
  /* Disable fused multiply/add operations */
  #define MASK_NO_FUSED_MADD 0x00020000
  
+ /* Generate backwardly compatible v272 eabi */
+ #define MASK_VXCOMPAT272    0x00040000
+ 
  #define TARGET_POWER  (target_flags & MASK_POWER)
  #define TARGET_POWER2  (target_flags & MASK_POWER2)
  #define TARGET_POWERPC  (target_flags & MASK_POWERPC)
*************** extern int target_flags;
*** 297,302 ****
--- 300,306 ----
  #define TARGET_STRING_SET (target_flags & MASK_STRING_SET)
  #define TARGET_NO_UPDATE (target_flags & MASK_NO_UPDATE)
  #define TARGET_NO_FUSED_MADD (target_flags & MASK_NO_FUSED_MADD)
+ #define TARGET_VXCOMPAT272    (target_flags & MASK_VXCOMPAT272)
  
  #define TARGET_32BIT  (! TARGET_64BIT)
  #define TARGET_HARD_FLOAT (! TARGET_SOFT_FLOAT)
diff -c3pr /gcc.orig/gcc/gcc/config/rs6000/vxppc.h /gcc.dev/gcc/gcc/config/rs6000/vxppc.h
*** /gcc.orig/gcc/gcc/config/rs6000/vxppc.h Mon May 17 02:30:56 1999
--- /gcc.dev/gcc/gcc/config/rs6000/vxppc.h Thu Mar 29 22:01:26 2001
***************
*** 1,5 ****
  /* Definitions of target machine for GNU compiler.  Vxworks PowerPC version.
!    Copyright (C) 1996 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
--- 1,5 ----
  /* Definitions of target machine for GNU compiler.  Vxworks PowerPC version.
!    Copyright (C) 1996, 2001 Free Software Foundation, Inc.
  
  This file is part of GNU CC.
  
*************** Boston, MA 02111-1307, USA.  */
*** 20,27 ****
--- 20,35 ----
  
  /* This file just exists to give specs for the PowerPC running on VxWorks.  */
  
  #include "rs6000/sysv4.h"
  
+ /*   This option makes gcc emit code that uses the variant (partial)
+    implementation of eabi that was current at the time of 2.7.2      */
+ 
+ #undef EXTRA_SUBTARGET_SWITCHES
+ #define EXTRA_SUBTARGET_SWITCHES \
+           { "vxcompat272",  MASK_VXCOMPAT272  },    \
+           { "no-vxcompat272",  -MASK_VXCOMPAT272  },
+ 
  /* ??? This file redefines CPP_SPEC which is wrong.  It should instead define
     one of the extra specs that gets included in CPP_SPEC.  For instance,
     CPP_OS_DEFAULT_SPEC.  The mrelocatable line was copied from CPP_SYSV_SPEC.
*************** Boston, MA 02111-1307, USA.  */
*** 29,34 ****
--- 37,43 ----
  
  #undef CPP_SPEC
  #define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
+ %{mvxcompat272: -D__VXCOMPAT272__} \
  %{mads: %(cpp_os_ads) } \
  %{myellowknife: %(cpp_os_yellowknife) } \
  %{mmvme: %(cpp_os_mvme) } \

vxworks-272compat.diff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]