binary

package
v2.1.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package binary provides binary file manipulation utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBuildID

func ReadBuildID(path string) string

ReadBuildID reads the ELF build-id from the given binary. Returns an empty string if the binary has no build-id.

func SeparateDebugInfo

func SeparateDebugInfo(binary, debugDir string) (string, error)

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

func SeparateDebugInfoWithEnv(binary, debugDir string, env map[string]string) (string, error)

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

func StripFile(path string, args ...string) error

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

func StripFileWithEnv(path string, env map[string]string, args ...string) error

StripFileWithEnv is the env-overlay variant of StripFile. STRIP is read from env first (parallel-build safe), with os.Getenv as fallback.

func StripLTO

func StripLTO(path string, args ...string) error

StripLTO removes LTO (Link Time Optimization) sections from a binary file. It respects the STRIP environment variable for cross-compilation support.

func StripLTOWithEnv added in v2.1.2

func StripLTOWithEnv(path string, env map[string]string, args ...string) error

StripLTOWithEnv is the env-overlay variant of StripLTO.

Types

This section is empty.

Jump to

Keyboard shortcuts

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