Skip to content
This repository was archived by the owner on Nov 22, 2025. It is now read-only.
/ libc-abi-tools Public archive

Latest commit

 

History

History
63 lines (42 loc) · 2.32 KB

File metadata and controls

63 lines (42 loc) · 2.32 KB

FreeBSD libc ABI tools

This directory contains .abilist files from every version of FreeBSD libc starting from FreeBSD 14.0. These files are consolidated to generate a single 46 KB symbol mapping file that is shipped with Zig to target any version of FreeBSD starting from 7.0.

Unlike glibc, these .abilist files are generated by inspecting the actual libc.so ELF file. We do it this way because FreeBSD does not have .abilist files for its libc, and parsing its Symbol.map files is quite a bit more complicated than it might seem on the surface. Yet FreeBSD uses almost the same symbol versioning strategy as glibc, so it makes sense to standardize the process by using .abilist files, as well as the same abilists binary format.

Generating .abilist files for a new FreeBSD libc version

  1. Follow these instructions.

  2. Make sure that arches and libs are up to date.

  3. Run the tool to generate the new .abilist files:

    zig run collect.zig -- $FREEBSD_SYSROOT_PATH $FBSD_LIBC_VERSION

    Where:

    • FREEBSD_SYSROOT_PATH contains amd64, aarch64, etc directories.
    • FBSD_LIBC_VERSION should be e.g. 1.7.

    Pay attention to any warnings printed; make adjustments as necessary, e.g. to blacklist.

  4. This inspects the ELF shared libraries for each target you built earlier and generates .abilist files namespaced under the version number.

  5. Inspect the changes and then commit these new files into Git.

Updating Zig

  1. Add the new FreeBSD libc versions to the versions global constant.

  2. Make sure that lib_names and zig_targets are up to date.

  3. Run consolidate.zig in this directory.

    zig run consolidate.zig

This will generate the file abilists which you can then inspect and make sure it is OK. Copy it to $ZIG_GIT_REPO_PATH/lib/libc/freebsd/abilists.

Format Quirks

Compared to glibc, the .abilist files here have some differences:

  • The first field containing the version name can be missing if the symbol is not versioned. A reader should check if the line starts with a space to detect this.
  • There can be an extra field containing a W before the category field. If present, this indicates that the symbol has weak linkage.