Skip to content

laborless/mapa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mapa

Map Analyzer

mapa is a command-line tool designed to parse and analyze gnu map files generated by linkers. It extracts and organizes information such as archive members, discarded sections, memory configurations, and linker script memory maps into structured formats for further analysis.

Features

  • Parse and extract:
    • Archive members included to satisfy references.
    • Discarded input sections.
    • Memory configuration details.
    • Linker script and memory map details.
  • Save extracted data into structured files:
    • Archive members: archive_members.tsv
    • Discarded sections: discarded_sections.tsv
    • Memory configuration: memory_configuration.tsv
  • Output linker script memory map in JSON format.

Pre-Built Binary

Pre-Built Binary Releases

Installation

  1. Ensure you have Rust installed.

  2. Clone the repository:

    git clone https://github.com/laborless/mapa.git
    cd mapa
  3. Build the application:

    cargo build
  4. Run the application:

    cargo run -- <MAP_FILE_PATH>

Usage

Run the mapa application with the following command:

mapa [OPTIONS] <MAP_FILE_PATH>

Options

  • -j, --json: Enable JSON format output.
  • -o, --output-path <OUTPUT_PATH>: Specify the output path (optional). Defaults to the current directory.
  • -h, --help: Print help information.
  • -V, --version: Print version information.
  • <MAP_FILE_PATH>: Path to the map file to analyze.

Example

To analyze a map file located at test.map:

mapa test.map

This will:

  1. Parse the map file to extract relevant information.
  2. Save the extracted data into .tsv or .json files for easy analysis:

Output Files

  • archive_members.tsv: Contains archive members included to satisfy references.
  • discarded_sections.tsv: Contains discarded input sections.
  • memory_configuration.tsv: Contains memory configuration details.

JSON Output Files

  • archive_members.json: Contains archive members included to satisfy references in JSON format.
  • discarded_sections.json: Contains discarded input sections in JSON format.
  • memory_configuration.json: Contains memory configuration details in JSON format.

These JSON files provide the same data as the .tsv files but in a structured JSON format for easier integration with other tools and scripts.

Development

To run the application in debug mode:

cargo run -- test.map

Cross-Compile

Download targets

rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-pc-windows-gnu
rustup target add aarch64-unknown-linux-gnu

Download Cross-compilers

Ubuntu/Debian

sudo apt install gcc-mingw-w64
sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross

Fedora

sudo dnf install mingw64-gcc
sudo dnf install gcc-aarch64-linux-gnu glibc-devel.aarch64

Build for Each Target

cargo build --target x86_64-unknown-linux-gnu --release
cargo build --target x86_64-pc-windows-gnu --release
cargo build --target aarch64-unknown-linux-gnu --release

Build with cross

Requirement

  • Rust
  • Docker or Podman
  • Cross
cargo install cross

Build

cargo build --target x86_64-unknown-linux-gnu --release
cargo build --target x86_64-pc-windows-gnu --release
cross build --target aarch64-unknown-linux-gnu --release

also can run with cross

cross run --target aarch64-unknown-linux-gnu --release

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

Contact

For questions or feedback, please open an issue in the repository.

About

Map analyzer

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages