From d1accaa33ddcbf491edbb6023d639f6d3579bc00 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 11 Sep 1998 00:28:30 +0200 Subject: [PATCH] configure.in: Add check for GAS subsection -1 support. * 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 | 12 ++++++++++++ gcc/acconfig.h | 4 ++++ gcc/config.in | 4 ++++ gcc/config/sparc/sparc.c | 16 ++++++++++++++++ gcc/config/sparc/sparc.h | 21 +++++++++++++++++++++ gcc/configure | 40 +++++++++++++++++++++++++++++++++++++++- gcc/configure.in | 34 ++++++++++++++++++++++++++++++++++ 7 files changed, 130 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d49c23253af..753ebeac1c6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +Thu Sep 10 21:19:10 1998 Jakub Jelinek + + * 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 * tree.h (DECL_ORIGIN): New macro. diff --git a/gcc/acconfig.h b/gcc/acconfig.h index 4aac693381a..0e43b153e21 100644 --- a/gcc/acconfig.h +++ b/gcc/acconfig.h @@ -20,6 +20,10 @@ /* 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 header file. */ #undef HAVE_INTTYPES_H diff --git a/gcc/config.in b/gcc/config.in index 3cd381ae5a6..0c5b6963a01 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -21,6 +21,10 @@ /* 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 header file. */ #undef HAVE_INTTYPES_H diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index ee1f8efcf74..6e7d27af75c 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -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 diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index cffa4765580..c68c3d02916 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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. */ diff --git a/gcc/configure b/gcc/configure index 8269e5e9979..608019a7896 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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 < /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 diff --git a/gcc/configure.in b/gcc/configure.in index 911a11978f3..98848d40a24 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -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 < /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 .. -- 2.30.2