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.
- 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
- Archive members:
- Output linker script memory map in JSON format.
-
Ensure you have Rust installed.
-
Clone the repository:
git clone https://github.com/laborless/mapa.git cd mapa
-
Build the application:
cargo build
-
Run the application:
cargo run -- <MAP_FILE_PATH>
Run the mapa
application with the following command:
mapa [OPTIONS] <MAP_FILE_PATH>
-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.
To analyze a map file located at test.map
:
mapa test.map
This will:
- Parse the map file to extract relevant information.
- Save the extracted data into
.tsv
or.json
files for easy analysis:
archive_members.tsv
: Contains archive members included to satisfy references.discarded_sections.tsv
: Contains discarded input sections.memory_configuration.tsv
: Contains memory configuration details.
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.
To run the application in debug mode:
cargo run -- test.map
rustup target add x86_64-unknown-linux-gnu
rustup target add x86_64-pc-windows-gnu
rustup target add aarch64-unknown-linux-gnu
sudo apt install gcc-mingw-w64
sudo apt install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
sudo dnf install mingw64-gcc
sudo dnf install gcc-aarch64-linux-gnu glibc-devel.aarch64
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
- Rust
- Docker or Podman
- Cross
cargo install cross
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
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Feel free to open issues or submit pull requests.
For questions or feedback, please open an issue in the repository.