dynlib

package
v0.2200.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package dynlib provides routines for interacting with the glibc ld.so dynamic linker/loader.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Debugf is a hook used for redirecting debug output.
	Debugf func(string, ...interface{})
)

Functions

func FindLdSo

func FindLdSo(cache *Cache) (string, string, error)

FindLdSo returns the path to the `ld.so` dynamic linker for the current architecture, which is usually a symlink

func IsSupported

func IsSupported() bool

IsSupported returns true if the architecture/os combination has dynlib support.

func ValidateLibraryClass

func ValidateLibraryClass(fn string) error

ValidateLibraryClass ensures that the library matches the current architecture.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a representation of the `ld.so.cache` file.

func LoadCache

func LoadCache() (*Cache, error)

LoadCache creates a new system shared library cache usually by loading and parsing the `/etc/ld.so.cache` file.

See `sysdeps/generic/dl-cache.h` in the glibc source tree for details regarding the format.

func (*Cache) GetLibraryPath

func (c *Cache) GetLibraryPath(name string) string

GetLibraryPath returns the path to the given library, if any. This routine makes no attempt to disambiguate multiple libraries (eg: via hwcap/search path).

func (*Cache) ResolveLibraries

func (c *Cache) ResolveLibraries(binaries []string, extraLibs []string, ldLibraryPath, fallbackSearchPath string, filterFn FilterFunc) (map[string][]string, error)

ResolveLibraries returns a map of library paths and their aliases for a given set of binaries, based off the ld.so.cache, libraries known to be internal, and a search path.

type FilterFunc

type FilterFunc func(string) error

FilterFunc is a function that implements a filter to allow rejecting dependencies when resolving libraries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL