Index of /~idr

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[TXT]0001-WIR-nir-algebraic-Eliminiate-spurious-type-conversio.patch2020-02-11 00:02 1.5K 
[TXT]0001-report.py-Gather-and-log-some-statistics-about-the-h.patch2018-03-22 18:48 6.1K 
[TXT]0002-Use-confidence-interval-instead.patch2018-03-22 18:48 8.9K 
[DIR]2007-VGP352/2007-03-20 00:25 -  
[DIR]2007-VGP353/2007-05-28 06:26 -  
[DIR]2007-VGP393/2007-12-11 19:49 -  
[DIR]2007Q1-VGP352/2009-09-30 17:24 -  
[DIR]2007Q2-VGP353/2009-09-30 17:24 -  
[DIR]2007Q4-VGP351/2008-01-17 01:12 -  
[DIR]2007Q4-VGP393/2009-09-30 17:24 -  
[DIR]2008Q1-VGP352/2008-03-13 05:31 -  
[DIR]2008Q2-VGP353/2008-05-14 01:03 -  
[DIR]2008Q3-VGP393/2008-09-11 06:11 -  
[DIR]2009Q1-VGP351/2009-03-20 04:46 -  
[DIR]2009Q2-VGP352/2009-06-13 18:14 -  
[DIR]2009Q3-VGP353/2009-08-29 05:52 -  
[DIR]2009Q4-VGP351/2009-12-13 04:43 -  
[DIR]2010Q1-VGP352/2010-03-17 23:58 -  
[DIR]2010Q2-VGP351/2010-06-14 06:47 -  
[DIR]2010Q4-VGP352/2010-12-16 00:32 -  
[DIR]2011Q1-CS341/2011-04-06 21:15 -  
[DIR]2011Q1-VGP353/2011-03-22 22:50 -  
[DIR]2011Q2-CS341/2011-06-06 18:53 -  
[DIR]2011Q4-VGP351/2011-12-14 17:23 -  
[DIR]2012Q1-VGP352/2012-03-08 01:51 -  
[DIR]2012Q2-VGP353/2012-05-31 02:12 -  
[DIR]2012Q4-VGP351/2012-12-06 04:51 -  
[DIR]2013Q1-VGP352/2013-02-28 02:17 -  
[DIR]2013Q2-VGP353/2013-05-23 16:31 -  
[DIR]GLSL_presentation/2009-10-04 21:39 -  
[IMG]IMG_20170809_171659.jpg2017-08-10 00:18 1.4M 
[IMG]IMG_20171022_180850.jpg2017-10-23 02:04 114K 
[IMG]IMG_20171022_180904.jpg2017-10-23 02:04 115K 
[DIR]Intel-4004/2022-11-11 22:38 -  
[DIR]LCA2015/2015-01-14 20:31 -  
[TXT]MESA_gpu_program3.txt2009-10-19 23:06 190K 
[DIR]OpenGL_tutorials/2010-04-07 00:11 -  
[TXT]README.html2021-10-20 03:27 13K 
[DIR]SGI_compiler_docs/2010-05-05 18:33 -  
[TXT]after.txt2023-01-31 16:01 1.1K 
[IMG]atomicCompSwap-float-vs-NaN.png2018-05-30 02:45 2.0K 
[TXT]bad_file.patch2017-01-25 20:05 1.4K 
[TXT]bad_vs.txt2021-12-09 22:58 2.5K 
[TXT]before-vs-after.txt2020-01-22 23:31 48K 
[TXT]before.txt2022-11-23 00:23 494K 
[   ]big_matrix.shader_test2023-05-24 04:46 3.0K 
[TXT]changes.txt2023-05-25 01:21 731K 
[TXT]clientinfo_unittest.cpp2013-01-29 22:55 8.9K 
[DIR]cmod-results/2015-01-22 17:09 -  
[TXT]compare-perf.sh2020-05-14 15:37 1.0K 
[TXT]diff.txt2020-12-03 23:51 607K 
[IMG]directions.png2019-10-17 17:53 207K 
[   ]divide.glsl2016-09-08 20:16 1.3K 
[DIR]dpas_swsb/2024-04-12 18:40 -  
[TXT]dump.txt2013-05-06 21:45 9.3K 
[TXT]eglinfo.txt2019-01-23 19:22 9.1K 
[TXT]emerge-output.txt2022-03-01 01:18 93K 
[IMG]fedora-23-derp.jpg2015-11-27 23:50 100K 
[IMG]firehose.jpg2017-11-28 01:23 28K 
[   ]git-send-email-shortcut2010-10-07 22:42 264  
[TXT]glsl-mat-from-int-ctor-03-NIR_PRINT.txt2019-03-01 22:22 536K 
[DIR]glu3/2010-05-13 02:59 -  
[TXT]iadd64.html2022-10-27 18:21 6.7K 
[TXT]idr-mesa-build-flags.txt2024-06-17 20:35 679  
[DIR]initializer/2010-08-30 15:22 -  
[TXT]issue-4213-shader.txt2021-09-20 19:46 167K 
[IMG]light_cycles_pillow.jpg2010-08-02 23:59 6.1K 
[TXT]lower_vector_derefs.patch2018-10-08 18:16 1.4K 
[DIR]map-notes/2012-02-28 17:21 -  
[TXT]mesa-review-stats.html2015-01-14 20:12 29K 
[TXT]mesa_build.txt2019-06-17 21:21 704K 
[IMG]nec-multisync-xv29.jpg2022-01-26 18:31 938K 
[   ]noise.tar.bz22010-08-25 20:15 5.8K 
[IMG]oops.jpg2018-08-20 16:16 74K 
[TXT]opsdotkhr.txt2024-05-30 23:37 9.0K 
[TXT]output.txt2023-05-31 18:00 1.2M 
[IMG]pcss.jpg2012-05-02 19:46 41K 
[   ]permedia_misc.tar.bz22010-03-08 03:07 2.0M 
[TXT]problems.txt2024-01-23 23:53 6.9K 
[TXT]results.txt2022-07-07 01:18 4.6K 
[DIR]results/2016-10-04 15:15 -  
[TXT]robust.patch2013-02-21 18:07 6.3K 
[IMG]screenshot.jpg2022-01-11 18:22 127K 
[   ]shared-atomicCompSwap-int64.shader_test2018-08-31 19:29 1.5K 
[   ]simple.shader_test2012-03-20 23:41 167  
[   ]simple2.shader_test2012-03-20 23:56 133  
[IMG]snowpocalypse.jpg2023-02-23 16:12 90K 
[TXT]total-changes.txt2019-01-24 19:06 23K 
[TXT]udivmod64.cpp2016-09-15 01:58 7.2K 
[   ]udivmod64.glsl2016-09-15 01:58 1.5K 

This process is not for the faint of heart. There are a lot of tedious steps involved. There are two major "phases." The first phase builds a cross-binutils and a cross-compiler that runs on the host (assuming a modern Linux system) to generate binaries for the SPARC v8 Solaris platform. The second phase uses the components built in the first phase to build native binutils and a native compiler that will run on the SPARC v8 Solaris platform.

The reference target (and ultimately build) system used for this document is a SPARCstation 5 running Solaris 2.6. Names and locations of files may differ on other versions of Solaris. Platform-specific flags may differ for other SPARC processors. The reference host system used for this document is a x86-64 running Fedora 33.

Much of the information in this document is based on How to Build a GCC Cross-Compiler.

Phase 0: Setup

Before starting down this long and winding road, there is a bunch of software that must be collected both from the Internet and from the Solaris system.

Testing cross-binuntils and building the cross-compiler require some files from the Solaris system. Specifically, the contents of /usr/lib and /usr/include are needed. Collect those files using the following commands:

    cd /usr
    tar cf $HOME/from-Solaris.tar include lib

Transfer the resulting from-Solaris.tar file to the build system.

FINISHME: Also need values-Xa.o from the target system!

The complete compiler suite includes GNU binutils and the GNU compiler collection. Binutils from GIT was found to work with only trivial issues (discussed in the 'Building the cross-tools' section). The releases/gcc-4.3 branch from this repository should be used for GCC. Several code changes were necessary for GCC 4.3, and those are included in this repository.

In addition, building GCC requires mpfr, gmp, and mpc. On Fedora 33, the development packages installed on the system were sufficient to build the cross-compiler. Building these packages from source code was only necessary to build the native compiler.

All of the relevant code can be acquired with the following commands:

    wget http://ftpmirror.gnu.org/mpfr/mpfr-3.1.2.tar.xz 
    wget http://ftpmirror.gnu.org/gmp/gmp-6.0.0a.tar.xz 
    wget http://ftpmirror.gnu.org/mpc/mpc-1.0.2.tar.gz 
    git clone git://sourceware.org/git/binutils-gdb.git 
    git clone https://github.com/ianromanick/gcc.git

It is possible to newer versions of mpfr, gmp, and mpc will also work. The versions listed here were used in the article referenced above for building GCC 4.9.2.

Phase 1: Building the cross-tools

All of the cross-tools will be installed in ~/sparc. The first step is to partially populate this directory with the files acquired from the Solaris machine.

    cd ~
    mkdir -p sparc/sparc-sun-solaris2
    cd sparc/sparc-sun-solaris2
    tar xf ~/from-Solaris.tar
    mv include sys-include

Building cross-binutils

The first major piece of software to build is binutils. At least as of b3a01ce2155 ("CTF: incorrect underlying type setting for enumeration types"), binutils GIT seems to work properly without major problems. The one small issue related to the target system name. Many of the later pieces of software require the full target system name, sparc-sun-solaris2.6. However, the binutils configure script claims this is unsupported. Leaving off the minor version, sparc-sun-solaris2, works fine.

    mkdir binutils-gdb-sparc-sun-solaris2
    cd binutils-gdb-sparc-sun-solaris2
    ../binutils-gdb/configure --prefix=~/sparc --target=sparc-sun-solaris2
    make && make install

After installation, a couple steps are necessary to "clean up" for the next software packages. Specifically, links must be created from the sparc-sun-solaris2 files and directories to sparc-sun-solaris2.6 files and directories.

    cd ~/sparc/bin
    for i in sparc-sun-solaris2-*; do
        ln $i $(echo $i | sed 's/solaris2/solaris2.6/')
    done
    cd ..
    ln -s sparc-sun-solaris2 sparc-sun-solaris2.6

At this point it is possible to assemble and link a small program to run on the target system! Copy and paste the following assembly program to a file called a.s.

            .global main
    main:
            save    %sp, -112, %sp
            mov     15, %o2
            mov     1, %o0
            sethi   %hi(msg), %o1
            mov     0, %i0
            call    write, 0
             or     %o1, %lo(msg), %o1
            jmp     %i7+8
             restore
    msg:
            .asciz  "Hello, world!\n"

Assemble and link the program with the following commands:

    sparc-sun-solaris2.6-as a.s -o a.o
    sparc-sun-solaris2.6-ld a.o -lc -o hello1

This should result in a hello1 file that is in the neighborhood of 2,100 bytes. More importantly, the file command should describe it as "ELF 32-bit MSB executable, SPARC, version 1 (SYSV), dynamically linked, interpreter /usr/lib/ld.so.1, not stripped". Copy the hello1 file to the Solaris sysem, and run it there. It should produce the output, "Hello, world!"

Assuming the simple program works as expected on the Solaris system, it is time to move on to building the cross-compiler.

Building cross-GCC

Building the cross-compiler proceeds in a manner similar to building the cross-binutils. There are two additional hitches. At some point between 2011 and 2021, the texinfo tools changed in a backwards incompatible way. As a result, 2021 texinfo tools cannot build the documenation for GCC 4.3. This can probably be fixed, but the root cause of the problem as not been investigated. A workaround is to replace the makeinfo command with the true command. In addition, there seem to be problems buiding GCC 4.3 with parallel make. The make commandline shown below works around both of these issues:

    cd gcc
    git checkout releases/gcc-4.3
    cd ..
    mkdir gcc-sparc-sun-solaris2.6
    cd gcc-sparc-sun-solaris2.6
    ../gcc/configure --prefix=~/sparc --target=sparc-sun-solaris2 \
        --enable-obsolete --enable-languages='c,c++'
    make MAKEINFO=/usr/bin/true -j1 && make install

Only the compilers for C and C++ are built because those are the only languages needed to build the native compiler.

At this point it is possible to compile a small program to run on the target system! Copy and paste the following C program to a file called b.c.

    #include <stdio.h>

    int main(int argc, char **argv)
    {
        printf("Hello, world!\n");
        return 0;
    }

Compile the program with the following command:

    sparc-sun-solaris2.6-gcc b.c -o hello2

This should result in a hello2 file that is in the neighborhood of 6,300 bytes. More importantly, the file command should describe it as "ELF 32-bit MSB executable, SPARC, version 1 (SYSV), dynamically linked, interpreter /usr/lib/ld.so.1, not stripped". Copy the hello2 file to the Solaris sysem, and run it there. It should produce the output, "Hello, world!"

Assuming the simple program works as expected on the Solaris system, it is time to move on to building the native compiler. This is where the "fun" really begins.

Phase 2: Building the native tools

All of the native tools will be installed in /opt/local. Normally these tools would be installed on the target machine in /usr/local. Since /usr/local on the build machine contains native binaries, it is not practical to build the programs to install there. /opt/local is chosen because it is unlikely to confict with anything on the build system, and it should also work on the target system. Using chroot is also possible, but it is requires more effort.

Prepare the installation directory using the following commands:

    sudo mkdir /opt/local
    sudo chown $(id -un):$(id -gn) /opt/local

Building gmp

FINISHME

    tar xf gmp-6.0.0a.tar.xz
    mkdir gmp-sparc-sun-solaris2.6
    cd gmp-sparc-sun-solaris2.6
    ../gmp-6.0.0/configure --prefix=/opt/local --target=sparc-sun-solaris2.6 \
        --host=sparc-sun-solaris2.6 --build=$MACHTYPE
    make && make install
    cd ..

Building mpfr

FINISHME

    tar xf mpfr-3.1.2.tar.xz
    mkdir mpfr-sparc-sun-solaris2.6
    cd mpfr-sparc-sun-solaris2.6
    ../mpfr-3.1.2/configure --prefix=/opt/local --target=sparc-sun-solaris2.6 \
        --host=sparc-sun-solaris2.6 --build=$MACHTYPE --with-gmp=/opt/local
    make && make install
    cd ..

Building mpc

FINISHME

    tar xf mpc-1.0.2.tar.gz
    mkdir mpc-sparc-sun-solaris2.6
    cd mpc-sparc-sun-solaris2.6
    ../mpc-1.0.2/configure --prefix=/opt/local --target=sparc-sun-solaris2.6 \
        --host=sparc-sun-solaris2.6 --build=$MACHTYPE --with-gmp=/opt/local \
        --with-mpfr=/opt/local
    make && make install
    cd ..

Building native binutils

FINISHME

    mkdir binutils-gdb-sparc-sun-solaris2-native
    cd binutils-gdb-sparc-sun-solaris2-native
    ../binutils-gdb/configure --prefix=/opt/local --target=sparc-sun-solaris2 \
        --host=sparc-sun-solaris2 --build=$MACHTYPE
    make && make install

Building native GCC

FINISHME

    mkdir gcc-sparc-sun-solaris2.6
    cd gcc-sparc-sun-solaris2.6-native
    ../gcc/configure --prefix=/opt/local --target=sparc-sun-solaris2 \
        --host=sparc-sun-solaris2 --build=$MACHTYPE --enable-obsolete \
        --enable-languages='c,c++' --with-gmp=/opt/local \
        --with-mpfr=/opt/local --with-mpc=/opt/local
    make MAKEINFO=/usr/bin/true -j1 && make install

Transfering the files to the Solaris system presents still more problems. Several of the files have full paths that are longer than 99 characters, and Solaris 2.6 tar cannot handle that. It will terminate with the error

    tar: directory checksum error

The majority of online sources (e.g., stackechange) will emphatically state that this is due to giving tar a compressed file, but that is not the only cause of this problem. An IBM support article does, however, provide a correct solution without providing any analysis of the root cause. There are two reasonable solutions. As suggested in the IBM support article, cross-building GNU Tar for the target system will work. Having GNU Tar on the target system is probably the best long-term solution. Cross-building it should be accomplished in a similar manner as cross-building any of the other components built here.

An alternative workaround is the create two separate archive files. The first contains all of the files except the files in local/include/c++/4.3.6/ext/pb_ds/detail, and the second contains only those files. The second archive is created relative to that directory, so the full paths of those files are much, much shorter.

    cd /opt
    tar -c -H v7 --exclude='local/include/c++/4.3.6/ext/pb_ds/detail/*' \
        -f ~/everything.tar local 
    cd local/include/c++/4.3.6/ext/pb_ds
    tar -c -H v7 -f ~/just-detail.tar detail

Once the files are extracted on the target system there are a couple additional steps.

  1. Change the ownership of all the files to bin:bin using cd /opt/local ; chown -R bin:bin *
  2. Add /opt/local/bin to the user's PATH variable.
  3. Add /opt/local/lib to the user's LD_LIBRARY_PATH variable.