Mantelijo / zig-glibc-abilist

Predecessor to https://github.com/ziglang/glibc-abi-tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

This repository contains .abilist files from glibc. These files are used to generate symbol mapping files that are used with zig cc

Adding new glibc version .abilist files

  1. Clone glibc
git clone git://sourceware.org/git/glibc.git
  1. Add new version to TARGET_VERSIONS tuple in import_glibc_abilist.py

  2. Run import_glibc_abilist.py

import_glibc_abilist.py path/to/glibc/repo

Updating .abilist symbols file for zig

  1. Run update_glibc.zig at the root of this repo
zig run update_glibc.zig -- glibc/ path/to/zig/lib

symbol mapping files will be updated in path/to/zig/lib/libc/glibc.

Binary encoding format:

  • 1 byte - number of glibc versions
  • ordered list of glibc versions terminated by newline byte
  • 1 byte - number of targets
  • ordered list of targets terminated by newline byte
  • number of targets amount of entries x 7 (one entry for each library). Each entry is:
    • u64 (8 bytes) bit set for versions available in library for that particular target.
    • in total this is 56 bytes (7x8) per each target
  • list of symbols:
    • null terminated symbol name
    • list of inclusions
      • u32 (4 bytes) bitset for targets (1 << (INDEX_IN_TARGET_LIST))
        • last inclusion is indicated if 1 << 31 bit is set in target bitset
      • u64 (8 bytes) glibc version bitset (1 << (INDEX_IN_GLIBC_VERSION_LIST))
      • u8 (1 byte) library index from a known library names list

List all symbols with their library, targets and versions in current symbols file

zig run list_symbols.zig

About

Predecessor to https://github.com/ziglang/glibc-abi-tool


Languages

Language:Zig 95.5%Language:Python 4.5%