Documentation
¶
Overview ¶
Package elfmeta lets a package build pre-compute the ELF facts that filesystem-level consumers otherwise re-derive by opening and parsing every library — most prominently ld.so.cache generation, which needs only each library's machine and SONAMEs but costs a full ELF parse per file to learn them.
A producer (melange, or any packaging tool) runs Extract over a built file and stamps Xattr with the encoded Info. Consumers read the xattr instead of the file; a miss or a malformed value falls back to parsing. When carried in a package, the stamp rides the data section's PAX records like any other xattr and is covered by the package signature. It stays on installed files and persists into images by default. In apko image builds, WithStripElfmetaStamps(true) removes it after ld.so.cache generation, before writing image layers.
Stamps live on regular files only: Linux permits user.* xattrs on neither symlinks nor special files, so a library's facts are stamped on the real file and consumers resolve links before reading.
A stamp is exactly as authoritative as the package carrying it: a producer that stamps wrong facts mis-describes its own contents, just as it could ship a wrong library outright. Consumers trust it accordingly and do not re-derive stamped facts.
Index ¶
Constants ¶
const Xattr = "user.dev.chainguard.elfmeta"
Xattr is the extended attribute carrying an encoded Info. It rides wherever file metadata rides — tar PAX records, filesystem xattrs — and stays with the file for its lifetime. The name is vendored: user.* is a namespace shared with every tool on the system.
Variables ¶
This section is empty.
Functions ¶
func EligibleName ¶
EligibleName reports whether a filename is one an ldconfig-style scan would consider — the shape producers stamp by.
func ParseLibFilename ¶
ParseLibFilename splits a shared-library filename into its name and version — "libfoo.so.1" into "libfoo" and "1", "libbar.so" into "libbar" and "" — and reports an error for names outside the scheme ldconfig considers: per ldconfig(8), files named lib*.so* (regular shared objects) or ld-*.so* (the dynamic loader itself).
Types ¶
type Info ¶
Info is the pre-computed metadata: whether the file is a dynamic object at all, and if so its machine and SONAMEs. A stamped Info with Dyn=false is meaningful — it records "checked, not a dynamic object", sparing consumers the parse that would rediscover that.