Menu

#3 Make gwc build correctly on VIA C3-based machines

Unstable_(example)
closed
nobody
None
5
2017-08-17
2005-01-22
Simon South
No

This patch (against gwc-0.20-9) fixes a problem with
gwc's build process that allows it to produce an
unusable executable on systems with VIA C3 processors.

To apply:

cd gwc-0.20-9
patch -i gwc-via-c3-build.patch

The problem is this line in Makefile.in, which adds
-march and -mcpu optimization flags based on the
machine name:

CFLAGS = -Wall @CFLAGS@ -mcpu=@UNAME_MACHINE@
-march=@UNAME_MACHINE@ @GNOMEUI_CFLAGS@ @SNDFILE_CFLAGS@

This is not safe to do on C3-based machines. The patch
removes these settings. (In my opinion, this is the
correct solution, because they do not belong here
anyway. There is no guarantee @UNAME_MACHINE@ will
resolve to a valid march/mcpu option, and besides, this
is an example of a script trying to be smarter than the
user. He or she should be trusted to know the right
optimization settings for his or her platform.)

To be tidy, the patch also removes the definition of
UNAME_MACHINE from configure.in, since this is the only
place it was being used.

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

Here's the underlying problem:

The VIA C3 identifies itself (correctly) as an "i686",
even though it does not implement the i686's CMOV
instruction (which it is not required to do, per
Intel's own spec). However, gcc does not recognize
this distinction. Thus building gwc on a VIA C3-based
machine will succeed, but running the executable will
fail with an "Illegal instruction" message.

The problem is a "cmovl" instruction gcc saw fit to
generate only because the Makefile forced the use of
the "-mcpu=i686" option.

Discussion

  • Simon South

    Simon South - 2005-01-22

    Allows correct building of gwc-0.20-9 on VIA C3-based platforms

     
  • Alister Hood

    Alister Hood - 2017-08-17
    • status: open --> closed
    • Group: --> Unstable_(example)
     
  • Alister Hood

    Alister Hood - 2017-08-17

    Fixed in (at least) the latest version.

     

Log in to post a comment.