Skip to content

FASTSHIFT/merge_lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

merge_lib - Static Library Object File Merger

A Python tool to merge all object files (.o) from a static library (.a) into a single object file. Supports custom paths for ar and ld commands.

Features

  • Extracts object files from static libraries using ar command
  • Merges extracted object files into one using ld -r
  • Supports custom paths for ar and ld commands
  • Option to keep temporary files for debugging
  • Verbose output mode

Requirements

  • Python 3.6+
  • ar and ld commands available in PATH (or specify custom paths)

Installation

No installation required. Just ensure Python 3 is installed and the script has execute permissions:

chmod +x merge_lib.py

Usage

Basic syntax:

./merge_lib.py input_library.a [-o output.o] [options]

Command Line Options

Option Description
input_library.a Input static library file (required)
-o, --output Output object filename (default: same as library name with .o extension)
--ar Custom path to ar command (default: ar)
--ld Custom path to ld command (default: ld)
--keep-temp Keep temporary directory for debugging
--verbose Show verbose output
-h, --help Show help message

Examples

  1. Basic usage:
./merge_lib.py libexample.a

Outputs: libexample.o

  1. Custom output filename:
./merge_lib.py libexample.a -o combined.o
  1. With custom tool paths:
./merge_lib.py libexample.a --ar /custom/path/to/ar --ld /custom/path/to/ld
  1. Keep temporary files and show verbose output:
./merge_lib.py libexample.a --keep-temp --verbose

Notes

  • The tool creates a temporary directory during operation (cleaned up unless --keep-temp is specified)
  • Requires both ar and ld commands to be available (either in PATH or specified)
  • Tested on Linux systems, may require adjustments for other platforms

About

Merge all object files (.o) from a static library (.a) into a single object file Supports custom paths for ar and ld commands

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages