
Identify a Binary's Architecture and ABI With file and readelf
Read a Linux binary's CPU architecture, bit width, float ABI and loader with file, readelf -h, readelf -A and xxd, before you copy it to a board.
Tag
5 posts

Read a Linux binary's CPU architecture, bit width, float ABI and loader with file, readelf -h, readelf -A and xxd, before you copy it to a board.

An assembly file without a .note.GNU-stack section makes the linker mark the whole program's stack executable. Add the section or pass -z noexecstack.

Define a default function with __attribute__((weak)) so another object file can replace it at link time, and check optional symbols with weak references.

Use __attribute__((section)) to put functions and variables in named ELF sections, then walk the section with the linker's start and stop symbols.

Bundle a Linux program with its libraries in one folder that runs from any path, using an $ORIGIN runpath, ldd to collect dependencies and a launcher check.