SCANELF(1)

🌸 NAME 🌸

okay so bestie, meet scanelf(1) β€” the user-space utility to scan ELF files. It's living in the pax-utils docs, and it's literally here to make your ELF life easier. πŸ’…


✨ SYNOPSIS ✨

scanelf [options] ELFs or directories

πŸ¦‹ DESCRIPTION πŸ¦‹

scanelf is a user-space utility that quickly scans the ELFs, directories, or common system paths you give it for different kinds of information. That can include ELF types, their PaX markings, TEXTRELs, etc... iykyk. It's giving main character energy for your binary inspection era. πŸ’–


πŸŽ€ OPTIONS πŸŽ€

  • -A, --archives β€” scans archives (.a files). yes bestie, it does archives too.
  • -a, --all β€” prints all useful/simple info. the whole little info menu, periodt.
  • -B, --nobanner β€” don't display the header. no banner, no problem.
  • -b, --bind β€” prints symbol binding information (lazy or now). lowkey useful.
  • -D, --endian β€” prints ELF endianness (big/little/...). endian vibe check πŸ’…
  • -E, --etype ETYPE β€” prints only ELF files matching the specified etype (like ET_DYN, ET_EXEC, etc...). filter that stack, bestie.
  • -e, --header β€” prints GNU_STACK markings. iconic header info.
  • -F, --format FORMAT β€” uses the specified format for output; see the FORMAT section for more information. custom output slay.
  • -f, --from FILE β€” reads input stream from the specified filename. feed it a file, fr fr.
  • -g, --gmatch β€” uses strncmp to match libraries (use with -N). Or regexp with symbol matching. matching mode activated.
  • -h, --help β€” shows condensed usage and exits. tiny help moment 🫢
  • -I, --osabi β€” prints OSABI. get that ABI tea.
  • -i, --interp β€” prints the interpreter information (.interp/PT_INTERP). interpreter reveal ✨
  • -k, --section SECTION β€” finds ELFs with the specified section. May be specified multiple times to match multiple sections simultaneously. See SECTION MATCHING for more info. section-hunting bestie.
  • -L, --ldcache β€” utilizes ld.so.cache information (use with -r/-n). cache behavior, no cap.
  • -l, --ldpath β€” scans all directories in /etc/ld.so.conf. path-scanning era.
  • -M, --bits BITS β€” prints only ELF files matching the specified numeric bits (like 32/64). bits filter, cute.
  • -m, --mount β€” don't recursively cross mount points. stay in your lane, mount-wise.
  • -N, --lib SONAME β€” finds ELFs that need the specified SONAME. May be specified multiple times to match multiple SONAMEs simultaneously. See SONAME MATCHING for more info. library-needs detective work πŸ”
  • -n, --needed β€” prints libraries the ELF is linked against (DT_NEEDED). dependency drama, printed.
  • -O, --perms PERMS β€” prints only ELF files with matching specified octal bits (like 755). perms filter, slay.
  • -o, --file FILE β€” writes output stream to the specified filename. redirect that output πŸ’…
  • -p, --path β€” scans all directories in PATH environment. yes, that PATH.
  • -q, --quiet β€” only outputs 'bad' things. quiet mode, but make it shady.
  • -R, --recursive β€” scans directories recursively. go deeper, bestie.
  • -r, --rpath β€” prints runpaths encoded in the ELF (DT_RPATH/DT_RUNPATH). runpath reveal.
  • -S, --soname β€” prints the ELF's shared library name (DT_SONAME). soname moment.
  • -s, --symbol SYMBOL β€” finds the specified symbol; see SYMBOL MATCHING for more info. symbol search, iconic.
  • -T, --textrels β€” locates cause of TEXTRELs via objdump. detective mode, TEXTREL edition.
  • -t, --textrel β€” prints TEXTREL information. textrel tea β˜•
  • -V, --version β€” prints version and exits. version check, then bye.
  • -v, --verbose β€” be verbose (can be used more than once). more -v, more talking.
  • -X, --fix β€” tries and 'fixes' bad things (use with -r/-e). fix-it era, carefully.
  • -x, --pax β€” prints PaX markings. PaX info, periodt.
  • -Y, --eabi β€” prints EABI (only matters for a few architectures). niche but valid.
  • -y, --symlink β€” don't scan symlinks. symlinks can sit this one out.
  • -Z, --size SIZE β€” prints ELF file size. size check, cute.
  • -z, --setpax FLAGS β€” sets EI_PAX/PT_PAX_FLAGS to specified flags (use with -Xx). flag-setting business.
  • --use-ldpath β€” uses the ld.so.conf paths to find the full path to libraries (use in conjunction with --needed). path-finding assist.
  • --root PATH β€” searches the specified root tree instead of /. Generally paired with options like -l or -p. This implicitly treats all paths specified on the command line as relative to the root, so be sure to omit it if you are explicitly listing ELFs. root-tree energy, but read the warning bestie.
  • --ldcache PATH β€” uses the specified path instead of /etc/ld.so.cache. Generally paired with options like -L or -n. custom cache path, no cap.

🌈 FORMAT 🌈

The format string is much like a printf string in that it is a literal string with flags requesting different information. For example, you could use a format string and expect the following results.

# scanelf -BF "file %f needs %n; funky time" /bin/bash
file bash needs libncurses.so.5,libdl.so.2,libc.so.6; funky time

Note that when you use a format string, generally information related flags should be omitted. In other words, you do not want to try and request NEEDED output (-n) and try to specify a format output at the same time as these operations are mutually exclusive. Each information related flag has an equivalent conversion specifier, so use those instead. You can of course continue to use non-information related flags (such as --verbose). 🫢

There are three characters that introduce conversion specifiers.

  • % β€” replace with info
  • # β€” silent boolean match
  • + β€” verbose match

And there are a number of conversion specifiers. We try to match up the specifier with corresponding option. ✨

  • a β€” machine (EM) type
  • b β€” bind flags
  • e β€” program headers
  • D β€” endian
  • I β€” osabi
  • Y β€” eabi
  • F β€” long filename
  • f β€” short filename
  • i β€” interp
  • k β€” section
  • M β€” EI class
  • N β€” specified needed
  • n β€” needed libraries
  • p β€” filename (minus search)
  • o β€” etype
  • O β€” perms
  • r β€” runpaths
  • S β€” SONAME
  • s β€” symbol
  • T β€” all textrels
  • t β€” textrel status
  • x β€” pax flags

🧚 SYMBOL MATCHING 🧚

The string specified takes the form [%[modifiers]%][[+-]<symbol name>][,[.....]]. πŸ’…

If the symbol name is empty, then all symbols are matched.

If the symbol name is a glob ("*"), then all symbols are dumped in a debug format. Do not rely on the structure of this output as it changes whenever we feel like it. fr fr, do not build on it.

If the first char of the symbol name is a plus ("+"), then only match defined symbols. If it's a minus ("-"), only match undefined symbols. When we say "defined", we mean the symbol is defined in the ELF vs having an external reference. yes bestie, that distinction matters.

Putting modifiers in between the percent signs ("%") allows for more in depth filters. There are groups of modifiers. If you don't specify a member of a group, then all types in that group are matched.

  • STT group (symbol type)
    • n β€” STT_NOTYPE
    • o β€” STT_OBJECT
    • f β€” STT_FUNC
    • F β€” STT_FILE
  • STB group (symbol binding)
    • l β€” STB_LOCAL
    • g β€” STB_GLOBAL
    • w β€” STB_WEAK
  • STV group (symbol visibility)
    • p β€” STV_DEFAULT
    • i β€” STV_INTERNAL
    • h β€” STV_HIDDEN
    • P β€” STV_PROTECTED
  • SHN group (section header)
    • d β€” defined
    • u β€” SHN_UNDEF
    • a β€” SHN_ABS
    • c β€” SHN_COMMON

You can search for multiple symbols simultaneously by using a comma (,) to separate different searches. Every symbol that matches will be displayed while unmatched symbols will not. πŸŽ€


πŸ”₯ ELF ETYPES πŸ”₯

You can narrow your search by specifying the ELF object file type (ETYPE). The commandline option takes the numeric value and or symbolic type. Multiple values can be passed comma separated. Example -E ET_EXEC,ET_DYN,1. ✨

Here is the normal list available for your pleasure. You of course are free to specify any numeric value you want.

  • 0 β€” ET_NONE β€” unknown type
  • 1 β€” ET_REL β€” relocatable file
  • 2 β€” ET_EXEC β€” executable file
  • 3 β€” ET_DYN β€” shared object
  • 4 β€” ET_CORE β€” core file

πŸ’œ ELF BITS πŸ’œ

You can also narrow your search by specifying the ELF bitsize. Again, specify the numeric value or the symbolic define.

  • 32 β€” ELFCLASS32 β€” 32bit ELFs
  • 64 β€” ELFCLASS64 β€” 64bit ELFs

πŸ“ SECTION MATCHING πŸ“

A ! prefix will only show ELF's that do not have the specified section. not me using the ! to flip the vibe check.


πŸ¦‹ NEEDED SONAME MATCHING πŸ¦‹

A ! prefix will only show ELF's that do not depend on the specified library. same shady little ! energy.


🌐 HOMEPAGE 🌐

https://wiki.gentoo.org/wiki/Hardened/PaX_Utilities


😭 REPORTING BUGS 😭

Please include as much information as possible (using any available debugging options) and send bug reports to the maintainers (see the AUTHORS section). Please use the Gentoo bugzilla at https://bugs.gentoo.org/ if possible. bestie, give them all the deets so they can actually help 🫢


πŸ‘‘ SEE ALSO πŸ‘‘

chpax(1), dumpelf(1), paxctl(1), pspax(1), readelf(1), scanelf(1), elf(5)


🌸 AUTHORS 🌸

  • Ned Ludd <solar@gentoo.org> β€” Maintainer
  • Mike Frysinger <vapier@gentoo.org> β€” Maintainer
  • Fabian Groffen <grobian@gentoo.org> β€” Mach-O Maintainer

πŸŽ€ NOTES πŸŽ€

  1. https://wiki.gentoo.org/wiki/Hardened/PaX_Utilities
  2. https://bugs.gentoo.org/

this iconic lil' page is from pax-utils 1.3.11, dated 08/02/2026, and yes bestie it's the scanelf(1) manual β€” mwah πŸ’‹πŸ’–

πŸ“¦ where this page comes from