$npx skillfedfor your agent

dynamic-linking

Master Linux shared library fundamentals: create position-independent libraries with proper soname versioning, embed search paths using RPATH or RUNPATH, and debug loading failures with LD_DEBUG and ldd. Build plugin systems with dlopen/dlsym, intercept functions via LD_PRELOAD, and control symbol visibility to reduce binary bloat and namespace collisions.

Dynamic Linking guides you through shared library creation, RPATH/RUNPATH configuration, soname versioning, dlopen/dlsym plugin patterns, and LD_PRELOAD interposition on Linux.

AI-generated summary based on this skill's SKILL.md

148 19 MITupdated by mohitmishra786

Decision gist · record as of 2026-06-27

Dynamic Linking guides you through shared library creation, RPATH/RUNPATH configuration, soname versioning, dlopen/dlsym plugin patterns, and LD_PRELOAD interposition on Linux. Master Linux shared library fundamentals: create position-independent libraries with proper soname versioning, embed search paths using RPATH or RUNPATH, and debug loading failures with LD_DEBUG and ldd. Build plugin systems with dlopen/dlsym, intercept functions via LD_PRELOAD, and control symbol visibility to reduce binary bloat and namespace collisions.

manual: git clone https://github.com/mohitmishra786/low-level-dev-skills → cp -r low-level-dev-skills/skills/binaries/dynamic-linking ~/.claude/skills/dynamic-linking
skills/binaries/dynamic-linking/SKILL.md · version 1ee05bfb

Use it when

  • dynamic-linking explains that RPATH is a legacy search path embedded in binaries, checked before LD_LIBRARY_PATH.
  • dynamic-linking teaches you to design plugin interfaces as header files, compile plugins as shared libraries with -fPIC -shared.

Verify before relying

Read SKILL.md below before installing (2 files). Open directory: indexed for reading, not audited.

Same gist for agents: .md · .json

Install

mohitmishra786/low-level-dev-skills/dynamic-linking · repository language: JavaScript

Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I fix 'cannot open shared object file' error?

dynamic-linking addresses this by teaching you to inspect library paths with ldd, set RPATH or RUNPATH during compilation, use LD_LIBRARY_PATH as a temporary override, or register libraries system-wide with ldconfig. The skill covers diagnosing missing dependencies, embedding absolute or relative search paths in your binary, and verifying correct soname references with readelf to resolve loading failures.

What is RPATH vs RUNPATH in Linux?

dynamic-linking explains that RPATH is a legacy search path embedded in binaries, checked before LD_LIBRARY_PATH, while RUNPATH is the modern replacement, checked after LD_LIBRARY_PATH, allowing environment overrides. Both are set at link time with -Wl,-rpath or -Wl,--runpath flags. RUNPATH is preferred because it respects LD_LIBRARY_PATH and supports relative paths like $ORIGIN for portable deployments.

How do I create a dlopen dlsym plugin system?

dynamic-linking teaches you to design plugin interfaces as header files, compile plugins as shared libraries with -fPIC -shared, then load them at runtime using dlopen with RTLD_LAZY or RTLD_NOW flags, and resolve function pointers with dlsym. The skill covers error handling via dlerror, managing plugin lifecycle with dlclose, and versioning plugin ABIs to maintain compatibility across updates.

How can I use LD_PRELOAD for function interception?

dynamic-linking shows how to write a shared library that defines wrapper functions matching target signatures, compile it with -fPIC -shared, then preload it before execution: LD_PRELOAD=./wrapper.so ./program. The skill covers intercepting malloc, printf, or system calls for debugging or testing, preserving original behavior via dlsym(RTLD_NEXT), and avoiding infinite recursion in wrapper logic.

What is soname versioning and why does it matter?

dynamic-linking explains soname versioning ensures backward compatibility: set soname at link time with -Wl,-soname,libfoo.so.1, create symlinks (libfoo.so.1 → libfoo.so.1.2.3), and increment MAJOR on breaking changes, MINOR on additions, PATCH on fixes. Clients link against libfoo.so.1, so you can release libfoo.so.1.2.4 without recompilation, while libfoo.so.2 signals incompatible changes requiring rebuilds.

How do I control symbol visibility and reduce binary size?

dynamic-linking teaches symbol visibility control via -fvisibility=hidden compiler flag and __attribute__((visibility("default"))) for exported symbols, or version scripts with linker directives. This hides internal symbols, reduces binary size, prevents namespace collisions, and improves load times. Combine with -fPIC for position-independent code, and use readelf -s to verify only intended symbols are exported.

SKILL.md

Rendered from the published skill. Quoted content, verbatim.

Dynamic Linking

Purpose

Guide agents through Linux dynamic linking: shared library creation, RPATH/RUNPATH configuration, soname versioning, dlopen/dlsym plugin patterns, LD_PRELOAD interposition, and symbol visibility control.

Triggers

  • "Cannot open shared object file: No such file or directory"
  • "How do I set RPATH so my binary finds its shared library?"
  • "How do I use dlopen/dlsym for a plugin system?"
  • "What's the difference between RPATH and RUNPATH?"
  • "How do I use LD_PRELOAD to intercept a function?"
  • "How do I version my shared library with soname?"

Workflow

1. Creating a shared library

```bash

Compile with -fPIC (position-independent code)

gcc -fPIC -c src/mylib.c -o mylib.o

(truncated - see the full file via the links below)

File tree — 2 files
skills/binaries/dynamic-linking/SKILL.md
skills/binaries/dynamic-linking/references/ld-rpath-soname.md

Let your AI agent find skills like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.

wish › “Resolve shared library loading failures and configure library search paths”

Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →

Related skills

Linux File Path Abuse
by blacklanternsecurity · blacklanternsecurity/red-run

This skill guides penetration testers through Linux privilege escalation via writable critical files, NFS exports, shared library hijacking, and group-based access. It covers assessment of available vectors, exploitation techniques for each path, and integration with engagement logging and state management.

GPL-3.0updated Apr 2026
★ 241repo stars
elf-inspection
by mohitmishra786 · mohitmishra786/low-level-dev-skills

Master Linux binary analysis with workflows for examining symbol tables, section layout, dynamic linking, and debug information. Diagnose undefined symbol errors, identify binary bloat, and verify security hardening flags like PIE and RELRO using standard tools.

MITupdated Jun 2026
★ 148repo stars
binary-hardening
by mohitmishra786 · mohitmishra786/low-level-dev-skills

Binary Hardening guides you through applying and validating security protections for C/C++ executables. Learn compiler and linker flags for RELRO, PIE, stack canaries, FORTIFY_SOURCE, and CFI, plus seccomp-bpf syscall filtering and hardware defenses like Intel CET and ARM BTI. Use checksec to audit existing binaries and confirm mitigations are in place.

MITupdated Jun 2026
★ 148repo stars
Linux Sudo Suid Capabilities
by blacklanternsecurity · blacklanternsecurity/red-run

Systematically identify and exploit sudo weaknesses, SUID/SGID binaries, and Linux capability misconfigurations to gain root access. The skill covers GTFOBins-based escapes, environment variable injection, CVE exploitation, and polkit vulnerabilities across multiple attack vectors.

GPL-3.0updated Apr 2026
★ 241repo stars
linkers-lto
by mohitmishra786 · mohitmishra786/low-level-dev-skills

Master linker selection, essential flags, and link-order resolution for GNU ld, gold, and lld. Learn to enable LTO with GCC or Clang, strip dead code with --gc-sections, and debug common linker errors like undefined symbols and circular dependencies.

MITupdated Jun 2026
★ 148repo stars
linux-privilege-escalation
by yaklang · yaklang/hack-skills

This skill covers systematic Linux privilege escalation from low-privilege shell access to root. It walks through enumeration, SUID/SGID binary exploitation, capability abuse, cron job manipulation, NFS misconfigurations, writable system files, LD_PRELOAD tricks, Docker group abuse, and library hijacking—with specific commands and exploitation tables for each vector.

MITupdated Jun 2026
★ 1,480repo stars

More skills Linux Discovery (GPL-3.0) · reverse-engineering (MIT) · linux-privilege-escalation (MIT) · binutils (MIT)

Tags
runtime-library-loadingsymbol-resolutionbinary-relocationplugin-architecturefunction-hookinglibrary-versioningelf-metadatadeployment-flexibility