Skip to content

Executable and Linkable Format

ELF (Executable and Linkable Format)는 실행 파일, 목적 파일, 공유 라이브러리 그리고 코어 덤프를 위한 표준 파일 형식이다. 1999년 86open 프로젝트에 의해 x86 기반 유닉스, 유닉스 계열 시스템들의 표준 바이너리 파일 형식으로 선택되었다.

Executable image

Elf-executable_image.jpg

How to using rpath

#include <stdio.h>
#include <elf.h>
#include <link.h>

int main()
{
  const ElfW(Dyn) *dyn = _DYNAMIC;
  const ElfW(Dyn) *rpath = NULL;
  const char *strtab = NULL;
  for (; dyn->d_tag != DT_NULL; ++dyn) {
    if (dyn->d_tag == DT_RPATH) {
      rpath = dyn;
    } else if (dyn->d_tag == DT_STRTAB) {
      strtab = (const char *)dyn->d_un.d_val;
    }
  }

  if (strtab != NULL && rpath != NULL) {
    printf("RPATH: %s\n", strtab + rpath->d_un.d_val);
  }
  return 0;
}

Tutorials

Making our own executable packer

  1. What's in a Linux executable?
  2. Running an executable without exec
  3. Position-independent code
  4. ELF relocations
  5. The simplest shared library
  6. Loading multiple ELF objects
  7. Dynamic symbol resolution
  8. Dynamic linker speed and correctness
  9. GDB scripting and Indirect functions
  10. Safer memory-mapped structures
  11. More ELF relocations
  12. A no_std Rust binary
  13. Thread-local storage

See also

Favorite site

References


  1. Fasterthanli.me-20201112.zip 

  2. Egloos.zum.com-Linker_ELF_and_fromelf.pdf 

  3. Embedded_Systems_Lab-ELF_File_Format_0.pdf 

  4. What_is_ELF.pdf 

  5. Acronyms_relevant_to_Executable_and_Linkable_Format.pdf