Documentation
¶
Overview ¶
Package binary provides binary file manipulation utilities.
Index ¶
- func ReadBuildID(path string) string
- func SeparateDebugInfo(binary, debugDir string) (string, error)
- func SeparateDebugInfoWithEnv(binary, debugDir string, env map[string]string) (string, error)
- func StripFile(path string, args ...string) error
- func StripFileWithEnv(path string, env map[string]string, args ...string) error
- func StripLTO(path string, args ...string) error
- func StripLTOWithEnv(path string, env map[string]string, args ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadBuildID ¶
ReadBuildID reads the ELF build-id from the given binary. Returns an empty string if the binary has no build-id.
func SeparateDebugInfo ¶
SeparateDebugInfo extracts debug information from the binary using OBJCOPY from os.Getenv. See SeparateDebugInfoWithEnv for the env-overlay variant.
func SeparateDebugInfoWithEnv ¶ added in v2.1.2
SeparateDebugInfoWithEnv extracts debug information from the binary into a separate file organized by build-id, then adds a .gnu_debuglink to the original binary. The debug file is stored at <debugDir>/.build-id/<prefix>/<suffix>.debug. Returns the path to the debug file, or empty string if no build-id was found. OBJCOPY is read from env (with os.Getenv fallback) to support parallel builds without process-env mutation.
func StripFile ¶
StripFile removes debugging symbols from a binary file. It respects the STRIP environment variable for cross-compilation support.
func StripFileWithEnv ¶ added in v2.1.2
StripFileWithEnv is the env-overlay variant of StripFile. STRIP is read from env first (parallel-build safe), with os.Getenv as fallback.
Types ¶
This section is empty.