Coder Social home page Coder Social logo

mybcbin / termux-elf-cleaner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from termux/termux-elf-cleaner

0.0 0.0 0.0 8.71 MB

Utility to remove unused ELF sections causing warnings.

License: GNU General Public License v3.0

Shell 2.98% C++ 37.86% C 45.38% Makefile 9.26% M4 4.52%

termux-elf-cleaner's Introduction

termux-elf-cleaner

Utility for Android ELF files to remove unused parts that the linker warns about.

Description

When loading ELF files, the Android linker warns about unsupported dynamic section entries with warnings such as:

WARNING: linker: /data/data/org.kost.nmap.android.networkmapper/bin/nmap: unused DT entry: type 0x6ffffffe arg 0x8a7d4
WARNING: linker: /data/data/org.kost.nmap.android.networkmapper/bin/nmap: unused DT entry: type 0x6fffffff arg 0x3

This utility strips away the following dynamic section entries:

  • DT_RPATH - not supported in any Android version.
  • DT_GNU_HASH - supported from Android 6.0.
  • DT_RUNPATH - supported from Android 7.0.
  • DT_VERDEF - supported from Android 6.0.
  • DT_VERDEFNUM - supported from Android 6.0.
  • DT_VERNEEDED - supported from Android 6.0.
  • DT_VERNEEDNUM - supported from Android 6.0.
  • DT_VERSYM - supported from Android 6.0.
  • DT_AARCH64_BTI_PLT - supported from Android 12.
  • DT_AARCH64_PAC_PLT - supported from Android 12.
  • DT_AARCH64_VARIANT_PCS - supported from Android 12.

It also removes the three ELF sections of type:

  • SHT_GNU_verdef
  • SHT_GNU_verneed
  • SHT_GNU_versym

And makes sure that the alignment of a TLS segment is at least 32 (for 32bit arches) or 64 (for 64bit arches), to prevent errors similar to:

error: "valgrind": executable's TLS segment is underaligned: alignment is 8, needs to be at least 64 for ARM64 Bionic

Usage

Usage: termux-elf-cleaner [OPTION-OR-FILENAME]...

Processes ELF files to remove unsupported section types and
dynamic section entries which the Android linker warns about.

Options:

--api-level NN        choose target api level, i.e. 21, 24, ..
--dry-run             print info but but do not remove entries
--quiet               do not print info about removed entries
--help                display this help and exit
--version             output version information and exit

License

SPDX-License-Identifier: GPL-3.0-or-later

See also

termux-elf-cleaner's People

Contributors

grimler91 avatar fornwall avatar oxr463 avatar landfillbaby avatar oleavr avatar imkiva avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.