ldd

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2018 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

ldd returns all the library dependencies of a list of file names. The way this is done on GNU-based systems is interesting. For each ELF, one finds the .interp section. If there is no interpreter there's not much to do. If there is an interpreter, we run it with the --list option and the file as an argument. We need to parse the output. For all lines with => as the 2nd field, we take the 3rd field as a dependency. The field may be a symlink. Rather than stat the link and do other such fooling around, we can do a readlink on it; if it fails, we just need to add that file name; if it succeeds, we need to add that file name and repeat with the next link in the chain. We can let the kernel do the work of figuring what to do if and when we hit EMLINK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LdSo

func LdSo() (string, error)

func List

func List(names []string) ([]string, error)

Types

type FileInfo

type FileInfo struct {
	FullName string
	os.FileInfo
}

func Ldd

func Ldd(names []string) ([]*FileInfo, error)

Ldd returns a list of all library dependencies for a set of files, suitable for feeding into (e.g.) a cpio program. If a file has no dependencies, that is not an error. The only possible error is if a file does not exist, or it says it has an interpreter but we can't read it, or we are not able to run its interpreter. It's not an error for a file to not be an ELF, as this function should be convenient and the list might include non-ELF executables (a.out format, scripts)

Jump to

Keyboard shortcuts

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