Skip to content

KarpelesLab/ldcache

Repository files navigation

GoDoc

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.

About

ld.so.cache manipulations

Resources

License

Stars

Watchers

Forks

Packages

No packages published