Multiple Architecture Support in Sorcery

Updated: 2004-11-17

My work here is based off of Benoit Papillault's work at http://benoit.papillault.free.fr/sourcemage/ and http://benoit.papillault.free.fr/sourcemage/sorcery.php and http://cvs.benoit.is-a-geek.net/cgi-bin/cvsweb.cgi/sourcemage/src/sorcery-patch/.

The work-in-progress repository is available in the Source Mage GNU/Linux repository under //sgl/sorcery/proj/proj2.

Multi-arch specification

Instead of writing Sorcery to support bi-arch I will jump right into making it support multi-arch (since some chips (e.g. Transmeta) have three or more architectures for each chip)by changing the following information from Benoit's idea:

Benoit had:

  • LIB= is the directory where native libraries will be installed. In other distros, this is usually /lib64, but here, we have choosen /lib to simplify portage.
  • SUBARCH= is the name of the sub architecture. Like the name of the architecture, it is the name of a file. Here, x86_32.
  • SUBLIB= is the directory where libraries of the sub-architecture will be installed. In other distros, this is usually /lib, but here, we have choosen /lib32. It must be a different directory than LIB= of course.

  • We will instead use arrays for each arch:
  • LIB= is the directory where native libraries will be installed. In other distros, this is usually /lib64, but here, we have choosen /lib to simplify portage.
  • SUBARCH[y]= is the name of the sub-architecture (the name of the archspec file which defines the subarchitecture).
  • SUBLIB[y]= is the directory where libraries of the sub-architecture will be installed.


  • Here's an example using amd64/x86_64:
  • /var/lib/sorcery/archspecs/amd64/x86_64
      CPUNAME="AMD Athlon 64, Athlon 64 FX and Opteron"
      # -m64 is not needed since it is the default. However, since gcc spell
      # adds  a -m32, this was causing problems.
      CFLAGS="-march=athlon-xp -mmmx -mfpmath=sse -msse -msse2 -m3dnow"
      HOST="x86_64-unknown-linux-gnu"
      FAST="-O2"
      SMALL="-Os"
      BI_ARCH="yes"
      LIB[0]="/lib"
      SUBARCH[0]="x86_32"
      SUBLIB[0]="/lib32"
  • /var/lib/sorcery/archspecs/amd64/x86_32
      CPUNAME="AMD Athlon 64, Athlon 64 FX and Opteron"
      CFLAGS="-march=athlon-xp -mmmx -mfpmath=sse -msse -msse2 -m3dnow -m32"
      HOST="i686-pc-linux-gnu"
      FAST="-O3"
      SMALL="-Os"

  • Or for a theoretical (I have no experience with these) 3-arch system:
  • /var/lib/sorcery/archspecs/amd128/x86_128
      CPUNAME="AMD Athlon 128 NX"
      # -m64 is not needed since it is the default. However, since gcc spell
      # adds  a -m32, this was causing problems.
      CFLAGS="-march=athlon-nx -mmmx -mfpmath=sse -msse -msse2 -m3dnow"
      HOST="x86_128-unknown-linux-gnu"
      FAST="-O2"
      SMALL="-Os"
      BI_ARCH="yes"
      LIB[0]="/lib"
      SUBARCH[0]="x86_64"
      SUBLIB[0]="/lib64"
      SUBARCH[1]="x86_32"
      SUBLIB[1]="/lib32"
  • /var/lib/sorcery/archspecs/amd128/x86_64
      CPUNAME="AMD Athlon 64, Athlon 64 FX and Opteron"
      # -m64 is not needed since it is the default. However, since gcc spell
      # adds  a -m32, this was causing problems.
      CFLAGS="-march=athlon-xp -mmmx -mfpmath=sse -msse -msse2 -m3dnow"
      HOST="x86_64-unknown-linux-gnu"
      FAST="-O2"
      SMALL="-Os"
      LIB[0]="/lib"
      SUBARCH[0]="x86_32"
      SUBLIB[0]="/lib32"
  • /var/lib/sorcery/archspecs/amd128/x86_32
      CPUNAME="AMD Athlon 64, Athlon 64 FX and Opteron"
      CFLAGS="-march=athlon-xp -mmmx -mfpmath=sse -msse -msse2 -m3dnow -m32"
      HOST="i686-pc-linux-gnu"
      FAST="-O3"
      SMALL="-Os"
  • Note that if they choose x86_128 they get one sub-archs: 64-bit and 32-bit, but if they choose x86_64 they only get one sub-arch: 32-bit. Should we perhaps set it up so no matter which arch you choose as native, all other possible archs are listed as sub-archs?