Re: [BUGS] solaris non gcc compiler debug options

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [BUGS] solaris non gcc compiler debug options
Дата
Msg-id 200412021811.iB2IB3502118@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [BUGS] solaris non gcc compiler debug options  (Kris Jurka <books@ejurka.com>)
Список pgsql-patches
OK, I see now.  I backed out my previous patch and did one so Solaris
has no optimization for debug.  Patch attached.

---------------------------------------------------------------------------

Kris Jurka wrote:
>
>
> On Sat, 27 Nov 2004, Bruce Momjian wrote:
>
> > Kris Jurka wrote:
> > >
> > > Compiling on solaris with a non gcc compiler does not correctly enable
> > > debugging when --enable-debug is specified.  src/template/solaris is
> > > specifying CFLAGS="-O -v" and -O overrides the -g that --enable-debug
> > > adds.
> >
> > Good point.  Our template files should be _adding_ to CFLAGS and
> > CPPFLAGS, not overriding them.  Later optimization flags on the
> > command line override earlier ones, so this patch should fix the
> > problem, and it exists in a few platforms.  Applied.
> >
>
> I don't believe you've fixed an actual problem.  Manually set CFLAGS are
> already accounted for in configure.in (line 234) here:
>
> # CFLAGS are selected so:
> # If the user specifies something in the environment, that is used.
> # else:  If the template file set something, that is used.
> # else:  If the compiler is GCC, then we use -O2.
> # else:  If the compiler is something else, then we use -0.
>
> if test "$ac_env_CFLAGS_set" = set; then
>   CFLAGS=$ac_env_CFLAGS_value
> elif test "${CFLAGS+set}" = set; then
>   : # (keep what template set)
> elif test "$GCC" = yes; then
>   CFLAGS="-O2"
> else
>   # if the user selected debug mode, don't use -O
>   if test "$enable_debug" != yes; then
>     CFLAGS="-O"
>   fi
> fi
>
> It seems the test at the end of this (enable_debug != yes) needs to be
> added to the solaris template instead of unconditionally adding -O to
> CFLAGS. I was trying to debug a problem and --enable-debug wasn't really
> helping until I took -O out of this src/template/solaris line.  The man
> page isn't particularly clear on what "best-effort" is, but it wasn't good
> enough for me.
>
>           If you issue -g, and the optimization level is -x03 or
>           lower, the compiler provides best-effort symbolic
>           information with almost full optimization. Tail-call
>           optimization and back-end inlining are disabled.
>
> Kris Jurka
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/template/aix
===================================================================
RCS file: /cvsroot/pgsql/src/template/aix,v
retrieving revision 1.16
diff -c -c -r1.16 aix
*** src/template/aix    27 Nov 2004 05:03:26 -0000    1.16
--- src/template/aix    2 Dec 2004 18:07:45 -0000
***************
*** 1,10 ****
  if test "$GCC" != yes ; then
    case $host_os in
      aix3.2.5 | aix4.1*)
!       CFLAGS="$CFLAGS -O -qmaxmem=16384 -qsrcmsg"
        ;;
      *)
!       CFLAGS="$CFLAGS -O2 -qmaxmem=16384 -qsrcmsg -qlonglong"
        ;;
    esac
  fi
--- 1,10 ----
  if test "$GCC" != yes ; then
    case $host_os in
      aix3.2.5 | aix4.1*)
!       CFLAGS="-O -qmaxmem=16384 -qsrcmsg"
        ;;
      *)
!       CFLAGS="-O2 -qmaxmem=16384 -qsrcmsg -qlonglong"
        ;;
    esac
  fi
Index: src/template/freebsd
===================================================================
RCS file: /cvsroot/pgsql/src/template/freebsd,v
retrieving revision 1.33
diff -c -c -r1.33 freebsd
*** src/template/freebsd    27 Nov 2004 05:03:26 -0000    1.33
--- src/template/freebsd    2 Dec 2004 18:07:45 -0000
***************
*** 1,3 ****
  case $host_cpu in
!   alpha*)   CFLAGS="$CFLAGS -O";;  # alpha has problems with -O2
  esac
--- 1,3 ----
  case $host_cpu in
!   alpha*)   CFLAGS="-O";;  # alpha has problems with -O2
  esac
Index: src/template/hpux
===================================================================
RCS file: /cvsroot/pgsql/src/template/hpux,v
retrieving revision 1.13
diff -c -c -r1.13 hpux
*** src/template/hpux    27 Nov 2004 05:03:26 -0000    1.13
--- src/template/hpux    2 Dec 2004 18:07:45 -0000
***************
*** 1,8 ****
! CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"

  if test "$GCC" != yes ; then
    CC="$CC -Ae"
!   CFLAGS="$CFLAGS +O2"
  fi

  # Pick right test-and-set (TAS) code.  We need out-of-line assembler
--- 1,8 ----
! CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"

  if test "$GCC" != yes ; then
    CC="$CC -Ae"
!   CFLAGS="+O2"
  fi

  # Pick right test-and-set (TAS) code.  We need out-of-line assembler
Index: src/template/linux
===================================================================
RCS file: /cvsroot/pgsql/src/template/linux,v
retrieving revision 1.26
diff -c -c -r1.26 linux
*** src/template/linux    27 Nov 2004 05:03:26 -0000    1.26
--- src/template/linux    2 Dec 2004 18:07:45 -0000
***************
*** 1,2 ****
  # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
! CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
--- 1,2 ----
  # Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
! CPPFLAGS="-D_GNU_SOURCE"
Index: src/template/osf
===================================================================
RCS file: /cvsroot/pgsql/src/template/osf,v
retrieving revision 1.18
diff -c -c -r1.18 osf
*** src/template/osf    27 Nov 2004 05:03:26 -0000    1.18
--- src/template/osf    2 Dec 2004 18:07:45 -0000
***************
*** 1,4 ****
  if test "$GCC" != yes ; then
    CC="$CC -std"
!   CFLAGS="$CFLAGS -O -ieee"
  fi
--- 1,4 ----
  if test "$GCC" != yes ; then
    CC="$CC -std"
!   CFLAGS="-O -ieee"
  fi
Index: src/template/solaris
===================================================================
RCS file: /cvsroot/pgsql/src/template/solaris,v
retrieving revision 1.21
diff -c -c -r1.21 solaris
*** src/template/solaris    27 Nov 2004 05:03:26 -0000    1.21
--- src/template/solaris    2 Dec 2004 18:07:45 -0000
***************
*** 1,6 ****
  if test "$GCC" != yes ; then
    CC="$CC -Xa"            # relaxed ISO C mode
!   CFLAGS="$CFLAGS -O -v"        # -v is like gcc -Wall
  fi

  # Pick right test-and-set (TAS) code.  We need out-of-line assembler
--- 1,9 ----
  if test "$GCC" != yes ; then
    CC="$CC -Xa"            # relaxed ISO C mode
!   CFLAGS="-v"            # -v is like gcc -Wall
!   if test "$enable_debug" != yes; then
!     CFLAGS="$CFLAGS -O"        # any optimization breaks debug
!   fi
  fi

  # Pick right test-and-set (TAS) code.  We need out-of-line assembler
Index: src/template/univel
===================================================================
RCS file: /cvsroot/pgsql/src/template/univel,v
retrieving revision 1.17
diff -c -c -r1.17 univel
*** src/template/univel    27 Nov 2004 05:03:26 -0000    1.17
--- src/template/univel    2 Dec 2004 18:07:45 -0000
***************
*** 1,2 ****
! CFLAGS="$CFLAGS -v -O -K i486,host,inline,loop_unroll -Dsvr4"
  LIBS="-lc89"
--- 1,2 ----
! CFLAGS="-v -O -K i486,host,inline,loop_unroll -Dsvr4"
  LIBS="-lc89"
Index: src/template/unixware
===================================================================
RCS file: /cvsroot/pgsql/src/template/unixware,v
retrieving revision 1.38
diff -c -c -r1.38 unixware
*** src/template/unixware    27 Nov 2004 05:03:26 -0000    1.38
--- src/template/unixware    2 Dec 2004 18:07:45 -0000
***************
*** 13,21 ****
  __EOF__

    if $CC -c -O -Kinline conftest.c >conftest.err 2>&1; then
!     CFLAGS="$CFLAGS -O -Kinline"
    else
!     CFLAGS="$CFLAGS -O -Kinline,no_host"
    fi
    rm -f conftest.*

--- 13,21 ----
  __EOF__

    if $CC -c -O -Kinline conftest.c >conftest.err 2>&1; then
!     CFLAGS="-O -Kinline"
    else
!     CFLAGS="-O -Kinline,no_host"
    fi
    rm -f conftest.*


В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: pt_BR FAQ updated
Следующее
От: Mark Kirkwood
Дата:
Сообщение: Docs - Plpgsql trigger example auditing changes into another table