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 ¶
Types ¶
type FileInfo ¶
func Ldd ¶
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)