LEAP ILP 32

From CDOT Wiki
Revision as of 12:04, 19 August 2015 by Artem Luzyanin (talk | contribs)
Jump to: navigation, search

This page describes the process of creating ILP32 support for LEAP.

Current state:

At the current state, gcc-ilp32 (gcc-4.9.2) is created to be correctly installed in the separate tree (/opt/ilp32/). Latest version of gcc can be found here: http://blue/koji/buildinfo?buildID=30942 It correctly produces Aarch64ELF32 files, using the technique, describe below in "Testing ILP32" section. Binutils 2.24 were created to provide scripts that are needed by the linker to work with ILP32 files. There will not be two different versions of Binutils, only one, with the scripts already there. Latest version can be found here: http://blue/koji/buildinfo?buildID=30943

To do:

Currently, we are missing some 32-bit C/C++ libraries. To successfully produce them, we need to compile GCC in MultiLib mode. Unfortunately, to compile a compiler with MultiLib support, one would need to use another existing on the system compiler with MultiLib. Currently, we are trying to use Fedora gcc as that MultiLib compiler. Unfortunately, compilation, using that Fedora compiler crashes with a message "C compiler cannot create executables". This problem is believed to occur if there are missing or corrupted libgcc, gcc-c++ and/or libstdc++ packages on the system. reinstalling those packages on LEAP system didn't help.

Next steps:

We are installing Fedora 22 on one of the builders to have a clean install with Fedora gcc. Then we will try to build our MultiLib capable gcc on that system. When succeeded, we will install our gcc on a LEAP builder, change the spec file for gcc to point towards that MultiLib capable gcc, and produce the final version of our gcc.

Testing ILP32:

  • Create "hello.c" file.
  • Add info to it at your discretion.
  • Run "/opt/ilp32/usr/bin/gcc -c -mabi=ilp32 hello.c".
  • Run "ld -m aarch64elf32 hello.o".
  • If you want to run it in one commands, use "/opt/ilp32/usr/bin/gcc -mabi=ilp32 -Xlinker -maarch64elf32 hello.c".
  • Run "file a.out".
  • Check that it says "ELF32", "executable binary" and "statically linked".



Old information (outdated, kept here for reference/info):

GCC:

%define _prefix /opt/ilp32/usr
  • I run "export RPM_PACKAGER="Artem Luzyanin <artem.luzyanin@senecacollege.ca>""
  • I run "rpmdev-bumpspec -c "Changed spec file to create ilp32-capable gcc in a separate tree."" command to add the changes with comments to the spec file.
  • I run "rpmbuild -ba --nocheck gcc.spec" command to get the rpms.
  • I run "rpm -qlp gcc-4.9.2-6.bb1.1.aarch64.rpm gcc.spec" command to check that all gcc files will be installed in the correct place (under /opt/ilp32/).

GLIBC:

  • I downloaded glibc-2.17 source rpm. I got mine from http://blue/kojifiles/packages/glibc/2.17/78.bb4/src/glibc-2.17-78.bb4.src.rpm.
  • I downloaded and installed required dependencies from the same place.
  • I run "rpm -i glibc-2.17-78.bb4.src.rpm" to install it on AArch64 builder.
  • I went in the "~/rpmbuild/SPEC" directory, and run command "rpmbuild -bp glibc.spec" to get the prep stage on the rpm.
  • I created a git repository, and pushed the content of "~/rpmbuild/BUILD/glibc{some random numbers}" directory to it to get the original information in it.
  • I went in the "~/rpmbuild/BUILD/glibc{some random numbers}" directory.

I changed "configure" file in the next ways: I run "./configure" command. I changed "Makefile" file in the next ways:

  • I run "make" command, then waited for the make for a long period of time for it to be complete (around 7 hours).
  • I committed the changes and run "git diff --patience master glibc21-leap-ilp-32 | filterdiff --format=context > ../glibc21-leap-ilp-32.patch" command to get the patch for my changes.
  • I run "export RPM_PACKAGER="Artem Luzyanin <artem.luzyanin@senecacollege.ca>""
  • I run "rpmdev-bumpspec -c "This patch is to create ilp32-compiler libraries of glibc in a separate tree."" command to add the changes with comments to the spec file.

I changed "~/rpmbuild/SPEC/glibc.spec" file in the next way: I run "rpmbuild -bs glibc.spec" command to get the source rpm.