2004-08-16 Jakub Jelinek * configure.ac (HAVE_LD_OVERLAPPING_OPD): New test. * configure: Rebuilt. * config.in: Rebuilt. * config/rs6000/rs6000.c (OVERLAPPING_OPD): Define. (rs6000_elf_declare_function_name): Use it. --- gcc/configure.ac.jj 2004-08-13 04:49:44.000000000 -0400 +++ gcc/configure.ac 2004-08-16 05:12:36.000000000 -0400 @@ -2689,6 +2689,23 @@ EOF AC_DEFINE(HAVE_LD_NO_DOT_SYMS, 1, [Define if your PowerPC64 linker only needs function descriptor syms.]) fi + AC_CACHE_CHECK(linker support for overlapping .opd entries, + gcc_cv_ld_overlapping_opd, + [gcc_cv_ld_overlapping_opd=no + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then + gcc_cv_ld_overlapping_opd=yes + fi + elif test x$gcc_cv_ld != x ; then + if $gcc_cv_ld -melf64ppc --help 2>/dev/null | grep non-overlapping-opd > /dev/null; then + gcc_cv_ld_overlapping_opd=yes + fi + fi + ]) + if test x"$gcc_cv_ld_overlapping_opd" = xyes; then + AC_DEFINE(HAVE_LD_OVERLAPPING_OPD, 1, + [Define if your PowerPC64 linker handles overlapping .opd entries.]) + fi ;; esac --- gcc/configure.jj 2004-08-13 04:49:44.000000000 -0400 +++ gcc/configure 2004-08-16 05:21:44.000000000 -0400 @@ -11394,6 +11394,32 @@ cat >>confdefs.h <<\_ACEOF _ACEOF fi + echo "$as_me:$LINENO: checking linker support for overlapping .opd entries" >&5 +echo $ECHO_N "checking linker support for overlapping .opd entries... $ECHO_C" >&6 +if test "${gcc_cv_ld_overlapping_opd+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + gcc_cv_ld_overlapping_opd=no + if test $in_tree_ld = yes ; then + if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 16 -o "$gcc_cv_gld_major_version" -gt 2; then + gcc_cv_ld_overlapping_opd=yes + fi + elif test x$gcc_cv_ld != x ; then + if $gcc_cv_ld -melf64ppc --help 2>/dev/null | grep non-overlapping-opd > /dev/null; then + gcc_cv_ld_overlapping_opd=yes + fi + fi + +fi +echo "$as_me:$LINENO: result: $gcc_cv_ld_overlapping_opd" >&5 +echo "${ECHO_T}$gcc_cv_ld_overlapping_opd" >&6 + if test x"$gcc_cv_ld_overlapping_opd" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LD_OVERLAPPING_OPD 1 +_ACEOF + + fi ;; esac --- gcc/config.in.jj 2004-08-13 04:49:45.000000000 -0400 +++ gcc/config.in 2004-08-16 05:17:55.000000000 -0400 @@ -315,6 +315,9 @@ /* Define if your PowerPC64 linker only needs function descriptor syms. */ #undef HAVE_LD_NO_DOT_SYMS +/* Define if your PowerPC64 linker handles overlapping .opd entries. */ +#undef HAVE_LD_OVERLAPPING_OPD + /* Define if your linker supports -pie option. */ #undef HAVE_LD_PIE --- gcc/config/rs6000/rs6000.c.jj 2004-08-13 04:49:44.000000000 -0400 +++ gcc/config/rs6000/rs6000.c 2004-08-16 05:37:48.000000000 -0400 @@ -15487,6 +15487,15 @@ rs6000_elf_asm_out_destructor (rtx symbo assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1); } +#ifdef HAVE_LD_OVERLAPPING_OPD +/* If the linker supports overlapping .opd entries and we know this function + doesn't ever use r11 passed to it, we can overlap the fd_aux function + descriptor field with next function descriptor's fd_func field. */ +# define OVERLAPPING_OPD (cfun->static_chain_decl == NULL) +#else +# define OVERLAPPING_OPD 0 +#endif + void rs6000_elf_declare_function_name (FILE *file, const char *name, tree decl) { @@ -15496,7 +15505,8 @@ rs6000_elf_declare_function_name (FILE * ASM_OUTPUT_LABEL (file, name); fputs (DOUBLE_INT_ASM_OP, file); rs6000_output_function_entry (file, name); - fputs (",.TOC.@tocbase,0\n\t.previous\n", file); + fprintf (file, ",.TOC.@tocbase%s\n\t.previous\n", + OVERLAPPING_OPD ? "" : ",0"); if (DOT_SYMBOLS) { fputs ("\t.size\t", file);