repositorypackage
0.1.3
Repository: https://github.com/karpeleslab/ldcache.git
Documentation: pkg.go.dev
# README
ldcache
Library to read/write ld.so.cache files.
Opening a ld.so.cache file
ldso, err := ldcache.Open("/etc/ld.so.cache")
if err != nil {
// ...
}
After loading a ld.so.cache file, it is possible to manipulate its Entries
, such as adding or removing entries, then generate a new file that will match the updated data.
Generating a ld.so.cache file
When generating a ld.so.cache file you need to be careful to ensure the data is properly sorted.
sort.Sort(ldso.Entries)
err := ldso.SaveAs("ld.so.cache")
// handle err
Sorting might not be needed if you did not modify the content of the file or only removed entries without altering the overall order, but when adding entries or merging files, it will be required for the linker to be able to use the file.