GitXplorerGitXplorer
t

termux-elf-cleaner

public
233 stars
60 forks
2 issues

Commits

List of commits on branch master.
Verified
3da3eeab96e57fa794c5ea0feb2eed4903545dec

CMakeList: add missing install directive

GGrimler91 committed 14 days ago
Verified
b29e7ebf6b5104aab04f925d3e690dd8ec8424c4

tests: put test files in builddir/tests/ instead of srcdir/tests/

GGrimler91 committed 20 days ago
Verified
99e14ecc4b32eb09319f87e764971cb832b75d9d

tests: remove go permissions and unset exe bit on test files

GGrimler91 committed 20 days ago
Verified
abe93335db00d2d0a433e9d74513b5aa872c4ba0

Print more info when removing version sections

GGrimler91 committed 20 days ago
Verified
5a98f3f33715d37a5979b6575e987e2cc2352dca

Only remove sections for !dry_run

GGrimler91 committed 20 days ago
Verified
1783b82356a3c9b3e010d713aa28433ad8ed7464

Get args through getopt

GGrimler91 committed 21 days ago

README

The README file for this repository.

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_VERNEED - 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