NetWinder Compiler Notes

Scott Bambrough, scottb@netwinder.org $Revision: 1.1.1.1 $, $Date: 1999/11/02 15:25:12 $

This document describes the GNU Compiler Collection used on the NetWinder.

Contents

1 The GNU Compiler Collection 1 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Known bugs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Miscellaneous 3 2.1 Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.3 Copyright Notice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1 The GNU Compiler Collection

1.1 Introduction

The current compiler released for the NetWinder is based on GCC 2.95.1. The current build includes patches for ARM ELF from Phil Blundell, Richard Earnshaw and Rebel.com. All patches have been submitted for inclusion into the GCC source tree, and are currently awaiting evaluation.

1.2 Known bugs.

1) Problem: Internal compiler error: unrecognizable instruction when building sendmail. A description of the problem may be found at:

http://egcs.cygnus.com/ml/gcc-bugs/1999-09/msg00023.html .

2) Problem: Unrecognizable instruction building mod_php-3.0.3. A description of the problem may be found at:

http://egcs.cygnus.com/ml/gcc-bugs/1999-10/msg00075.html .

An analysis of this problem can be found at:

http://egcs.cygnus.com/ml/gcc-bugs/1999-10/msg00097.html .

This seems to be similar to problem 1.

3) Problem: GCC appears to hang while compiling the following:

     int main(int argc, char **argv)
     {
       unsigned long u;
       u = 1;
       u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
       u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
       u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
       u += u; u += u; u += u; u += u; u += u; u += u; u += u; u += u;
       if (!u) _exit (0);
       _exit (1);
     }

A description and analysis of the problem can be found by following the mailing list thread that begins here:

http://egcs.cygnus.com/ml/gcc-bugs/1999-06/msg00853.html .

4) Problem: Internal error: insn does not satisfy constraints when building QT 1.42. A description of the problem may be found at:

http://egcs.cygnus.com/ml/gcc-bugs/1999-10/msg00078.html .

I received confirmation that a fix for this had been applied to the mainline sources on October 13, 1999. I have yet to try the patch on GCC 2.95.1, and it is not in the current RPM release.

5) Problem: Internal error: Multiply not satisfying constraints. A description, analysis and patches may be found by following the mailing list thread that begins here.

http://egcs.cygnus.com/ml/gcc-bugs/1999-09/msg00040.html .

This is similar to problem three, and patches have been generated. They are being reviewed and should make it into the the mainline code. Whether they get placed in the 2.95 branch is doubtful. I will consider applying the patches to GCC 2.95.1 and including them in the RPM’s Rebel.com distributes. The current RPM’s do not have these patches included.

6) Problem: Internal compiler error: unrecognizable instruction when building sendmail. A description of the problem may be found here:

http://egcs.cygnus.com/ml/gcc-bugs/1999-09/msg00023.html .

7) Problem: Routine NewGrab at line 129 in source file xc/lib/Xt/PassivGrab.c from the XFree86-3.3.3.1 distribution is compiled incorrectly. Specifically the parameter widget does not get assigned to grab->widget correctly. The pointer is corrupt and a segmentation fault occurs. Andrew has determined a work around for this problem and has included it as a patch in the latest X RPM.

8) Problem: Objective C is broken. I don’t have the details at hand.

9) Problem: Java compiler is inoperative. Requires a port of libgcj in order to be functional. This has been started but is on hold while I await bugfixes in the mainstream compiler. I received confirmation on October 20, 1999 that the bugs had been fixed in the mainline CVS tree, and that I should now be able to bootstrap the compiler. I am currently testing this.

10) Problem: Error: Can not represent OFFSET_IMM relocation in this object file format when building mgetty. A description can be found at:

http://egcs.cygnus.com/ml/gcc-bugs/1999-10/msg00078.html .

This seems to be a different problem than the one described below.

There is a similar code generation bug that crops up when generating constants when optimization is turned on. The error message that is generated follows.

     testglib.s:6949: Error: Can not represent OFFSET_IMM relocation in
     this object file format (1)

The problem is a local label (.LC164 in this case) that is referenced, but never defined in the compiler output anywhere. This label only appears in the rtl output in the .greg file after the reload phase.

The "C" code defines the following long long variable:

     __extension__typedef unsigned long long guint64;
     guint64 gu64t1 = (__extension__(0x1d636b02300a7aa7ULL));

At line 869 in the "C" code it loads this value, ands it with the long long value 0xff and then shifts the result right by 56 bits.

The problem is in the ARM specific constant-reloading pass which runs as part of the machine dependent reorganization pass right at the end, before the final assembly is emitted. This pass contains too many assumptions, and the example breaks another of them (in this case, the broken assumption is that a constant needing reloading will always be a simple mov insn). To fix this requires a rewrite of the constant reloading pass.

This bug was reported to the GCC maintainers, where it was determined a rewrite of the constant reloading pass was required. This rewrite is complete, and it is checked into the mainline GCC source. Unfortunately, the changes are too extensive to be considered a bug fix for the purpose of having it added to the GCC 2.95 branch.

Jim Studt proposed a patch to the arm.md file that prevents the problem from occurring. Richard Earnshaw has added a similar patch to the GCC 2.95.1 branch. This prevents the problem from occurring but does not fix the root cause.

2 Miscellaneous

2.1 Author

The author and maintainer of the NetWinder Compiler Notes is Scott Bambrough (scottb@netwinder.org). Please send any comments, additions, or corrections so they can be included in the next release. The latest version of this document may be obtained from http://www.netwinder.org/~scottb/notes/

Compiler-Notes.html .

2.2 History

The first public release of this document was as an html web page.

October 21, 1999 (version 1.0): Converted web page to SGML, and updated the content.

2. Miscellaneous 4

2.3 Copyright Notice

This document is copyright (c) Scott Bambrough, 1999. Permission is granted to make and distribute verbatim copies of this document. The copyright notice and this permission notice must be preserved on all copies.