Forth Bridge

From Infinity Wiki
Jump to: navigation, search

Forth Bridge is the fourth full-system preview release of Infinity. Forth Bridge showcases low-level Python bindings for libi8x, which are used by the note tester I8X and the note compiler's testsuite (the release announcement explains this more fully). Forth Bridge was released July 11, 2017.

Changes since Infinity Third Eye


  • libi8x now has low-level Python bindings (to be supplemented by a high-level layer in a future release.)
  • The relocation interface has changed.
  • Userdata is now immutable once set.
  • A number of bugs in the LEB128 decoders and function unregistration are now fixed.
  • A number of previously-internal functions are now public.
  • A new error code I8X_NATCALL_FAILED has been introduced.


  • I8X now uses libi8x to execute Infinity functions if libi8x and its Python bindings are installed.
  • Infinity functions provided by testcases must now be identified using the @TestCase.provide decorator.
  • The function TestCase.implement has been removed.
  • The interpreter context is no longer accessible as TestCase.i8ctx. Infinity functions should now be executed using


  • All testcases have been updated to use @TestCase.provide.

Building Infinity Forth Bridge

Note that there's presently no PIP package for the libi8x Python bindings, so for this release you'll have to build them from source. Note also that the order of things has changed for this release, it's necessary to build libi8x before I8C in order to use the new interpreter for the glibc build step.

Build libi8x with the shim libthread_db

To build libi8x with the shim libthread_db you first need to install the elfutils libelf development files. For Fedora and RHEL this is the elfutils-libelf-devel RPM. For Debian and Ubuntu the package you need is libelf-dev. Either way, once done you should see /usr/include/libelf.h on your system.

Once that's there, clone and build libi8x:

 git clone
 cd libi8x
 git branch forth-bridge infinity-forth-bridge
 git checkout forth-bridge
 make check  # optional

You should see an examples/ symbolic link if it worked.

Build libi8x Python bindings

Now you need to build and install the Python bindings that the note compiler needs. You need to have py3c installed for this, and for this development snapshot you need pycparser too. On RHEL and Fedora you can install both with sudo dnf install py3c-devel python-pycparser. If someone tells me the details for Debian/Ubuntu I'll put those in here too.

 cd python
 python test  # optional
 python install --user

You should be able to execute import _libi8x in Python without error if this step worked.

Note that for this release the Python bindings statically link libi8x; there's no need to make install libi8x.

Build I8C

The note compiler must be built from source for this release:

git clone
cd i8c
git branch forth-bridge infinity-forth-bridge
git checkout forth-bridge
python test  # optional
python install --user

You should see using libi8x interpreter (experimental) near the top of the python test output if the libi8x bindings were successfully installed.

Create a test build of glibc with Infinity notes

The command i8c needs to be in your path before you continue. If you're following this guide it'll be in ~/.local/bin/i8c, so you may need to add ~/.local/bin to your path. Alternatively you can omit the --user and install I8C globally on your system. However you install it, you need to be able to enter this exact command:

i8c --version | head -n 1

and see this exact output:

I8C 0.0.6

Once you have I8C installed you can proceed to build glibc:

mkdir -p glibc/build
git clone glibc/src
cd glibc/src
git branch forth-bridge infinity-forth-bridge
git checkout forth-bridge
cd ../build
../src/configure --prefix=/usr --with-infinity

--with-infinity is assumed if you have I8C installed, but specifiying it explicitly here forces configure to check the version for you.

You should be able to see Infinity notes in and if everything worked. Both

readelf -n nptl/
readelf -n elf/

should list several notes with owner "GNU" and unknown type 0x2323:

Displaying notes found at file offset 0x0002144c with length 0x00000378:
  Owner                 Data size	Description
  GNU                  0x0000006d	Unknown note type: (0x00002323)
  GNU                  0x0000007d	Unknown note type: (0x00002323)
  GNU                  0x000000cc	Unknown note type: (0x00002323)
  GNU                  0x0000009f	Unknown note type: (0x00002323)
  GNU                  0x0000005f	Unknown note type: (0x00002323)
  GNU                  0x0000005b	Unknown note type: (0x00002323)

See for more information about glibc test builds.

Things to do with Infinity Forth Bridge

Run the note tester on the glibc you built

The note tester I8X is hooked into glibc's make check, but lets run it directly:

 cd /path/to/glibc/build
 i8x -I. -i nptl/ ../src/nptl/tst-infinity-*.py

You should see some output as to the result of the tests, and all tests should pass. You should see using libi8x interpreter (experimental) near the top of the output if the libi8x bindings were successfully installed. If you see using Python interpreter (deprecated) then something went wrong.

Note that the coverage check has been temporarily removed for this release.

To run with glibc's make check, try this:

  cd /path/to/glibc/build
  make subdirs=nptl check

I8X's output will be in nptl/tst-infinity-*.out, and the result that glibc's make check consumes will be in nptl/tst-infinity-*.test-result. Again, you should see using libi8x interpreter (experimental) near the top of I8X's output.

GDB Things

There's no GDB-specific changes in this release, but GDB things from previous releases are still relevant. See: