Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse ELF symbol version files #24

Open
pombredanne opened this issue Jun 13, 2024 · 3 comments
Open

Parse ELF symbol version files #24

pombredanne opened this issue Jun 13, 2024 · 3 comments

Comments

@pombredanne
Copy link
Member

It could be useful to parse specific file formats such as "version.lds" files and other files to collect ELF versioning information.

For instance, some project such as libfdt use version.lds, while OpenSSL uses .num files (in https://github.com/openssl/openssl/blob/master/util/libssl.num ) and tensorflow uses the .lds extensions but with a different name pattern.

@pombredanne pombredanne transferred this issue from aboutcode-org/scancode-toolkit Jun 13, 2024
@armijnhemel
Copy link

glibc uses Versions, for example:

$ find |grep Versions| sort
./argp/Versions
./assert/Versions
./catgets/Versions
./csu/Versions
./ctype/Versions
./debug/Versions
./dirent/Versions
./dlfcn/Versions
./elf/Versions
./gmon/Versions
./hesiod/Versions
./htl/Versions
./hurd/Versions
./iconv/Versions

@armijnhemel
Copy link

In ELF files i have been able to find the following versions:

  • various GCC related ones, such as @GCC_3.3.1
  • libreport, such as @LIBREPORT_2.13.1
  • abrt, such as @LIBRABRT_2.14.5
  • xz, such as @XZ_5.0
  • json, such as @JSONC_0.14
  • systemd, such as @LIBSYSTEMD_209
  • alsa ( @ALSA_0.9 )
  • fdisk
  • elfutils
  • fuse
  • gpg
  • and a whole bunch more

A few quick and dirty commands to find these:

$ cd /usr/bin
$ readelf -Wa * | grep @ | grep UND > /tmp/symbols
$ cut -f 2- -d @ symbols2 | sort | cut -f 1 -d '(' | uniq

@armijnhemel
Copy link

Different projects use different conventions. Take elfutils: https://github.com/sourceware-org/elfutils

This project uses .map as the extension, for example:

https://github.com/sourceware-org/elfutils/blob/master/libelf/libelf.map

libxmlb also uses .map as the extension.

There isn't a standard file name. You either have to already "know" it, or add some extra information to your search process, such as the name + version that you are looking for (this is something you can extract from binary files, see above). Probably it is best to just keep a mapping of version files per project somewhere and just use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants