> On Wed, Apr 21, 2004, Karl Vogel wrote:
> 
> > More brain-deadness from Tru64...
> >
> > The perl.spec has a Configure option
> >
> >     -Doptimize="%{l_cflags} -O"
> >
> > This parameter is used to build up the linker flags, 
> resulting in the
> > following linker command line:
> >
> >  ld -shared -expect_unresolved "*"  -O -msym -std -s 
> -L/tmp/openpkg/lib
> >
> >
> > Now it appears that the linker doesn't understand the '-O' 
> but it does
> > understand -O0 upto -O3. So a possible fix would be to use:
> >
> >     -Doptimize="%{l_cflags} -O2"
> >
> > I think this will work on all openpkg supported platforms?!
> >
> > For reference, the 'ld' man page part:
> >
> >   -O0 Turn off all code optimizations performed by the 
> linker. This is the
> >       default.
> >
> >   -O1 Turn on the code optimizations that can be performed 
> quickly with lit-
> >       tle additional time and memory overhead during the 
> link. Note that cc
> >       passes -O1 as the default when linking.
> >
> >   -O2, -O3
> >       Turn on all code optimizations that can be performed 
> by the linker.
> >
> > I've verified that the packages builds on Tru64 with -O2.
> 
> Well, the Configure options actually reads -Doptimize="%{l_cflags -O}"
> which means that the l_cflags macro is called with option -O. This in
> turn runs "rpmtool cflags -O %{l_cc}" and there the -O input option
> becomes a real -O option in the output (because no "gcc" is found,
> else it would output -O2 -pipe). So, the correct fix is not to patch
> perl.spec from "perl" package, but to patch rpmtool from the "openpkg"
> package to know about this additional Tru64 issue.

I think this is incorrect. The build was using gcc and it does understand -O
as a _compiler_ flag (ie. gcc -O filename.c  works without problems).

The problem is that the perl Configure script uses the 'optimize' setting as
a parameter to the linker. So the 'ld' command is called directly with
$optimize as one of the parameters and since the 'ld' command on Tru64 is
not GNU ld, it doesn't work.

The part that takes this $optimize and uses it as ld flag is in
hints/dec_osf.sh :

----
# Fancy compiler suites use optimising linker as well as compiler.
# <[EMAIL PROTECTED]>
case "`uname -r`" in
*[123].*)       # old loader
                lddlflags="$lddlflags -O3"
                ;;
*)            if $test "X$optimize" = "X$undef"; then
                      lddlflags="$lddlflags -msym"
              else
                  case "$myosvers" in
                  *4.0D*)
                      # QAR 56761: -O4 + .so may produce broken code,
                      # fixed in 4.0E or better.
                      ;;
                  *)
                      lddlflags="$lddlflags $optimize"
                      ;;
                  esac
                  # -msym: If using a sufficiently recent /sbin/loader,
                  # keep the module symbols with the modules.
                  lddlflags="$lddlflags -msym -std"
              fi
                ;;
esac
----

It's this line:

>                      lddlflags="$lddlflags $optimize"




> This fix is now part of the latest openpkg-20040421-20040421 bootstrap
> package from OpenPKG-CURRENT. Upgrade to this version, try again to
> build "perl" and all should be fine related to this ld(1) option
> fiddling.

So this means..

  Index: openpkg-src/openpkg/rpmtool
 
============================================================================
  $ cvs diff -u -r1.34 -r1.35 rpmtool
  --- openpkg-src/openpkg/rpmtool       21 Apr 2004 15:18:06 -0000      1.34
  +++ openpkg-src/openpkg/rpmtool       21 Apr 2004 16:45:04 -0000      1.35
  @@ -451,7 +451,10 @@
                       cflags="$cflags -pipe"
                   fi
               else
  -                cflags="-O"
  +                case $platform in
  +                   *:OSF1:*:* ) cflags="-O1" ;;
  +                   *          ) cflags="-O"  ;;
  +                esac
               fi
           fi
           echo "x$cflags" | sed -e 's;^x;;'
  @@ .


That this patch is not entirely correct... while it will work without
problems, it is not doing what one expects.


______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   [EMAIL PROTECTED]

Reply via email to