Skip to content

Use Rust elf-cleaner implementation#8915

Merged
topjohnwu merged 1 commit intomasterfrom
elf
Apr 2, 2025
Merged

Use Rust elf-cleaner implementation#8915
topjohnwu merged 1 commit intomasterfrom
elf

Conversation

@topjohnwu
Copy link
Copy Markdown
Owner

No description provided.

@yujincheng08
Copy link
Copy Markdown
Collaborator

How about DT_PREINIT_ARRAY?

@topjohnwu
Copy link
Copy Markdown
Owner Author

@yujincheng08 Right now there is no executable with DT_PREINIT_ARRAY, so it's not needed. Furthermore, removing it from the ELF actually breaks functionality (preinit routines will be skipped), which may be unexpected. If the linker somehow generates it, we should find a way to avoid it.

@topjohnwu topjohnwu merged commit 1fa318d into master Apr 2, 2025
53 of 54 checks passed
@topjohnwu topjohnwu deleted the elf branch April 2, 2025 01:32
@yujincheng08 yujincheng08 requested a review from Copilot April 2, 2025 04:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the project to use a Rust-based elf-cleaner implementation and updates the rustup-wrapper configuration. Key changes include:

  • Renaming and updating the rustup-wrapper’s Cargo.toml (name changed from "rustup_wrapper" to "rustup-wrapper" and edition bumped to "2024").
  • Adding a new Rust implementation for elf-cleaner with its Cargo.toml.
  • Modifying the build script to invoke the Rust implementation instead of the previous compiled binary.

Reviewed Changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated no comments.

File Description
tools/rustup-wrapper/Cargo.toml Updated package name and edition to align with current standards.
tools/elf-cleaner/src/main.rs Introduced the Rust implementation for cleaning ELF binaries.
tools/elf-cleaner/Cargo.toml Added Cargo configuration for the new elf-cleaner tool.
build.py Updated commands to run the Rust-based elf-cleaner and fixed naming references.
Files not reviewed (4)
  • .gitattributes: Language not supported
  • .gitmodules: Language not supported
  • tools/elf-cleaner/.gitignore: Language not supported
  • tools/termux-elf-cleaner: Language not supported
Comments suppressed due to low confidence (2)

tools/elf-cleaner/src/main.rs:12

  • Consider defining SUPPORTED_DT_FLAGS as a u64 constant to match the type of DT_FLAGS_1 values, which would eliminate the need for an inline cast and reduce potential type conversion issues.
const SUPPORTED_DT_FLAGS: u32 = elf::DF_1_NOW | elf::DF_1_GLOBAL;

tools/rustup-wrapper/Cargo.toml:1

  • The package edition has been updated to '2024'. Please ensure that all dependencies and toolchain configurations are compatible with this edition update.
[package]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants