configure.in: Add check for GAS subsection -1 support.
authorJakub Jelinek <jj@sunsite.ms.mff.cuni.cz>
Thu, 10 Sep 1998 22:28:30 +0000 (00:28 +0200)
committerDavid S. Miller <davem@gcc.gnu.org>
Thu, 10 Sep 1998 22:28:30 +0000 (15:28 -0700)
* configure.in: Add check for GAS subsection -1 support.
* acconfig.h (HAVE_GAS_SUBSECTION_ORDERING): Add.
* configure config.in: Rebuilt.
* config/sparc/sparc.h (CASE_VECTOR_MODE): For V9 flag_pic, use
SImode is subsection -1 works, else use DImode.
(ASM_OUTPUT_ADDR_VEC_START, ASM_OUTPUT_ADDR_VEC_END): Define if
subsection -1 works.
* config/sparc/sparc.c (sparc_output_addr_vec,
sparc_output_addr_diff_vec): Use them if defined.

From-SVN: r22383

gcc/ChangeLog
gcc/acconfig.h
gcc/config.in
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h
gcc/configure
gcc/configure.in

index d49c23253afb1aa4e8fb0a2ba83c63d0585a8aa8..753ebeac1c6b54091eba0081a832d30b9606dd06 100644 (file)
@@ -1,3 +1,15 @@
+Thu Sep 10 21:19:10 1998  Jakub Jelinek  <jj@sunsite.ms.mff.cuni.cz>
+
+       * configure.in: Add check for GAS subsection -1 support.
+       * acconfig.h (HAVE_GAS_SUBSECTION_ORDERING): Add.
+       * configure config.in: Rebuilt.
+       * config/sparc/sparc.h (CASE_VECTOR_MODE): For V9 flag_pic, use
+       SImode is subsection -1 works, else use DImode.
+       (ASM_OUTPUT_ADDR_VEC_START, ASM_OUTPUT_ADDR_VEC_END): Define if
+       subsection -1 works.
+       * config/sparc/sparc.c (sparc_output_addr_vec,
+       sparc_output_addr_diff_vec): Use them if defined.
+
 Thu Sep 10 10:46:01 1998  Mark Mitchell  <mark@markmitchell.com>
 
        * tree.h (DECL_ORIGIN): New macro.
index 4aac693381a0ba05d3142736e8a6ce49152b2817..0e43b153e213ae1df9807def4925ee81eaf0eb20 100644 (file)
 /* Define if your assembler supports .balign and .p2align.  */
 #undef HAVE_GAS_BALIGN_AND_P2ALIGN
 
+/* Define if your assembler supports .subsection and .subsection -1 starts
+   emitting at the beginning of your section */
+#undef HAVE_GAS_SUBSECTION_ORDERING
+
 /* Define if you have a working <inttypes.h> header file.  */
 #undef HAVE_INTTYPES_H
 
index 3cd381ae5a6d96a1688c8bbddc09d1e9ac2f35ae..0c5b6963a0172fdceb14e48327cfed080ec8b339 100644 (file)
 /* Define if your assembler supports .balign and .p2align.  */
 #undef HAVE_GAS_BALIGN_AND_P2ALIGN
 
+/* Define if your assembler supports .subsection and .subsection -1 starts
+   emitting at the beginning of your section */
+#undef HAVE_GAS_SUBSECTION_ORDERING
+
 /* Define if you have a working <inttypes.h> header file.  */
 #undef HAVE_INTTYPES_H
 
index ee1f8efcf749653bf4689b635bbb24b3f2169e99..6e7d27af75cbcef903eb06b5e62a16dc55eeaba6 100644 (file)
@@ -7196,6 +7196,10 @@ sparc_output_addr_vec (vec)
   rtx lab = XEXP (vec, 0), body = XEXP (vec, 1);
   int idx, vlen = XVECLEN (body, 0);
 
+#ifdef ASM_OUTPUT_ADDR_VEC_START  
+  ASM_OUTPUT_ADDR_VEC_START (asm_out_file);
+#endif
+
 #ifdef ASM_OUTPUT_CASE_LABEL
   ASM_OUTPUT_CASE_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (lab),
                         NEXT_INSN (lab));
@@ -7208,6 +7212,10 @@ sparc_output_addr_vec (vec)
       ASM_OUTPUT_ADDR_VEC_ELT
        (asm_out_file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
     }
+    
+#ifdef ASM_OUTPUT_ADDR_VEC_END
+  ASM_OUTPUT_ADDR_VEC_END (asm_out_file);
+#endif
 }
 
 static void 
@@ -7218,6 +7226,10 @@ sparc_output_addr_diff_vec (vec)
   rtx base = XEXP (XEXP (body, 0), 0);
   int idx, vlen = XVECLEN (body, 1);
 
+#ifdef ASM_OUTPUT_ADDR_VEC_START  
+  ASM_OUTPUT_ADDR_VEC_START (asm_out_file);
+#endif
+
 #ifdef ASM_OUTPUT_CASE_LABEL
   ASM_OUTPUT_CASE_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (lab),
                         NEXT_INSN (lab));
@@ -7233,6 +7245,10 @@ sparc_output_addr_diff_vec (vec)
          CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
          CODE_LABEL_NUMBER (base));
     }
+    
+#ifdef ASM_OUTPUT_ADDR_VEC_END
+  ASM_OUTPUT_ADDR_VEC_END (asm_out_file);
+#endif
 }
 
 static void
index cffa476558003cfed1e0a072746727d99a5e6238..c68c3d02916836551c2af9ac8c2d01465142e84f 100644 (file)
@@ -2473,8 +2473,15 @@ extern struct rtx_def *legitimize_pic_address ();
    for the index in the tablejump instruction.  */
 /* If we ever implement any of the full models (such as CM_FULLANY),
    this has to be DImode in that case */
+#ifdef HAVE_GAS_SUBSECTION_ORDERING
 #define CASE_VECTOR_MODE \
 (! TARGET_PTR64 ? SImode : flag_pic ? SImode : TARGET_CM_MEDLOW ? SImode : DImode)
+#else
+/* If assembler does not have working .subsection -1, we use DImode for pic, as otherwise
+   we have to sign extend which slows things down. */
+#define CASE_VECTOR_MODE \
+(! TARGET_PTR64 ? SImode : flag_pic ? DImode : TARGET_CM_MEDLOW ? SImode : DImode)
+#endif
 
 /* Define as C expression which evaluates to nonzero if the tablejump
    instruction expects the table to contain offsets from the address of the
@@ -2999,6 +3006,20 @@ do {                                                                     \
   fputc ('\n', FILE);                                                  \
 } while (0)
 
+/* This is what to output before and after case-vector (both
+   relative and absolute).  If .subsection -1 works, we put case-vectors
+   at the beginning of the current section.  */
+
+#ifdef HAVE_GAS_SUBSECTION_ORDERING
+
+#define ASM_OUTPUT_ADDR_VEC_START(FILE)                                        \
+  fprintf(FILE, "\t.subsection\t-1\n")
+
+#define ASM_OUTPUT_ADDR_VEC_END(FILE)                                  \
+  fprintf(FILE, "\t.previous\n")
+
+#endif
+
 /* This is how to output an assembler line
    that says to advance the location counter
    to a multiple of 2**LOG bytes.  */
index 8269e5e9979c754765cbac482ee696c7d9408503..608019a7896cef3b3ad11586235a68f39a7a79d4 100755 (executable)
@@ -5534,6 +5534,44 @@ EOF
 fi
 echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6
 
+echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6
+echo "configure:5539: checking assembler subsection support" >&5
+gcc_cv_as_subsections=
+if test x$gcc_cv_as != x; then
+       # Check if we have .subsection
+       echo ".subsection 1" > conftest.s
+       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+               gcc_cv_as_subsections=".subsection"
+               if test -x nm$host_exeext; then
+                       gcc_cv_nm=./nm$host_exeext
+               elif test x$host = x$target; then
+                       # Native build.
+                       gcc_cv_nm=nm$host_exeext
+               fi
+               if test x$gcc_cv_nm != x; then
+                       cat > conftest.s <<EOF
+conftest_label1: .word 0
+.subsection -1
+conftest_label2: .word 0
+.previous
+EOF
+                       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+                               $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
+                               $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
+                               if ! cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then
+                                       gcc_cv_as_subsections="working .subsection -1"
+                                       cat >> confdefs.h <<\EOF
+#define HAVE_GAS_SUBSECTION_ORDERING 1
+EOF
+
+                               fi
+                       fi
+               fi
+       fi
+       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+fi
+echo "$ac_t""$gcc_cv_as_subsections" 1>&6
+
 # Figure out what language subdirectories are present.
 subdirs=
 for lang in ${srcdir}/*/config-lang.in ..
@@ -5731,7 +5769,7 @@ fi
 
 # Warn if using init_priority.
 echo $ac_n "checking whether to enable init_priority by default""... $ac_c" 1>&6
-echo "configure:5735: checking whether to enable init_priority by default" >&5
+echo "configure:5773: checking whether to enable init_priority by default" >&5
 if test x$enable_init_priority != xyes; then
   enable_init_priority=no
 fi
index 911a11978f3f3a88f3ddef74451a4e880f822500..98848d40a24564d6e80fecfd84574bd783fd5a3d 100644 (file)
@@ -3669,6 +3669,40 @@ if test x$gcc_cv_as != x; then
 fi
 AC_MSG_RESULT($gcc_cv_as_alignment_features)
 
+AC_MSG_CHECKING(assembler subsection support)
+gcc_cv_as_subsections=
+if test x$gcc_cv_as != x; then
+       # Check if we have .subsection
+       echo ".subsection 1" > conftest.s
+       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+               gcc_cv_as_subsections=".subsection"
+               if test -x nm$host_exeext; then
+                       gcc_cv_nm=./nm$host_exeext
+               elif test x$host = x$target; then
+                       # Native build.
+                       gcc_cv_nm=nm$host_exeext
+               fi
+               if test x$gcc_cv_nm != x; then
+                       cat > conftest.s <<EOF
+conftest_label1: .word 0
+.subsection -1
+conftest_label2: .word 0
+.previous
+EOF
+                       if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then
+                               $gcc_cv_nm conftest.o | grep conftest_label1 > conftest.nm1
+                               $gcc_cv_nm conftest.o | grep conftest_label2 | sed -e 's/label2/label1/' > conftest.nm2
+                               if ! cmp conftest.nm1 conftest.nm2 > /dev/null 2>&1; then
+                                       gcc_cv_as_subsections="working .subsection -1"
+                                       AC_DEFINE(HAVE_GAS_SUBSECTION_ORDERING)
+                               fi
+                       fi
+               fi
+       fi
+       rm -f conftest.s conftest.o conftest.nm1 conftest.nm2
+fi
+AC_MSG_RESULT($gcc_cv_as_subsections)
+
 # Figure out what language subdirectories are present.
 subdirs=
 for lang in ${srcdir}/*/config-lang.in ..