리눅스데브코스 [6주차 - 4]<시스템 프로그래밍 - Memory Layout & Make>

심우열·2023년 5월 15일
0

1. Memory Layout

1. C언어의 장점

OS를 다루는 Low-level 프로그래밍에 좋음

  • c와 ARM/X86/RISC -V 명령어 매핑이 쉽다(inline)
  • C types와 하드웨어 데이터 구조와 연동이 좋다.
  • 디바이스 드라이버 개발 시, 하드웨어 레지스터를 위한 비트 플래그 설정이 쉽다

Rutime 시간이 최소화 됨

2. ELF(Executable and Linkable Format)

리눅스 실행 파일 포맷

  • text: code
  • .rodata: read-only data
  • .data: global C변수

3. 프로세스 메모리 레이아웃

  • text: code, read-only data
  • data: global C변수
  • stack: function's local 변수
  • heap: 동적 메모리 할당 malloc/free

4. C 프로그래밍 메모리 레이아웃

5. ELF 분석 도구(Binutils)

1. readelf -a copy

  • 실행 파일(elf) 분석 도구
  • glicb 는 C library
  • text(code), initialized data, symbol table, debug info ..

2. objdump -S copy

  • 기계어로 번역

3. nm copy

  • 심볼 출력

2. Makefie

대규모 프로그램 관리하는 툴

Makefile에 대한 자세한 내용

  • 예) 다른 툴들 maven, npm, yarn

아래 처럼 빌드하는 방법은? makefile

  • gcc -o myprogram file1.c file2.c file3.c

1. make

make?

  • 소스코드로 부터 실행 파일 또는 라이브러리를 생성하는 유틸리티

makefile?

  • make 명령어가 사용하는 스크립트 파일
  • 어떻게 컴파일 하는지
  • 어떤 파일을 컴파일 하는지

2. Makefile 규칙

target: source 1 source2 ... source N
command
command

예시

기본

myprogram: file1.c file2.c file3.c
	gcc -o myprogram file1.c file2.c file3.c

의존성

program: foo.o bar.o
	gcc -o program foo.o bar.o
foo.o: foo.c
gcc -c foo.c
bar.o: bar.c
gcc -c bar.c

변수화

OBJFILES = file1.o file2.o file3.o
PROGRAM = myprog
$(PROGRAM): $(OBJFILES)
	gcc -o $(PROGRAM) $(OBJFILES)
clean: 
	rm $(OBJFILES) $(PROGRAM)

3. make 실행

  • make target
  • make -f <makefilename>
  • make -f <makefilename> target

3. strace

  • 시스템 콜 트레이스
  • 프로그램이 실행되는 동안 호출하는 시스템콜을 추적

사용법

strace <프로그램 명>

4. 실습

1. strace

strace ./copy seek_io seek_io_copy

1. 실행 결과

w10sim@systemProgramming:~/sysProgramming/tlpi-dist/fileio$ strace ./copy seek_io seek_io_copy
execve("./copy", ["./copy", "seek_io", "seek_io_copy"], 0xffffc5766c80 /* 33 vars */) = 0
brk(NULL)                               = 0xaaaaee9b4000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=28896, ...}) = 0
mmap(NULL, 28896, PROT_READ, MAP_PRIVATE, 3, 0) = 0xffffa3a2c000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0`\17\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1450832, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xffffa3a2a000
mmap(NULL, 1519552, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xffffa3892000
mprotect(0xffffa39ed000, 61440, PROT_NONE) = 0
mmap(0xffffa39fc000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15a000) = 0xffffa39fc000
mmap(0xffffa3a02000, 12224, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xffffa3a02000
close(3)                                = 0
mprotect(0xffffa39fc000, 16384, PROT_READ) = 0
mprotect(0xaaaae57a8000, 4096, PROT_READ) = 0
mprotect(0xffffa3a36000, 4096, PROT_READ) = 0
munmap(0xffffa3a2c000, 28896)           = 0
openat(AT_FDCWD, "seek_io", O_RDONLY)   = 3
openat(AT_FDCWD, "seek_io_copy", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\360\32\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\360\32\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\0\0\0\0\0\0\0\0\314\0\0\0\22\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\0\0\0\0\0\0\0\0\314\0\0\0\22\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\20\0\0\0 \0\0\0\227\221\226\6\0\0\3\0\24\1\0\0\0\0\0\0\1\0\1\0\1\0\0\0"..., 1024) = 1024
write(4, "\20\0\0\0 \0\0\0\227\221\226\6\0\0\3\0\24\1\0\0\0\0\0\0\1\0\1\0\1\0\0\0"..., 1024) = 1024
read(3, "\3\4\0\0\0\0\0\0\370-\0\0\0\0\0\0(A\1\0\0\0\0\0\3\4\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\3\4\0\0\0\0\0\0\370-\0\0\0\0\0\0(A\1\0\0\0\0\0\3\4\0\0\0\0\0\0"..., 1024) = 1024
read(3, "xB\1\0\0\0\0\0\3\4\0\0\0\0\0\0\200/\0\0\0\0\0\0\200B\1\0\0\0\0\0"..., 1024) = 1024
write(4, "xB\1\0\0\0\0\0\3\4\0\0\0\0\0\0\200/\0\0\0\0\0\0\200B\1\0\0\0\0\0"..., 1024) = 1024
read(3, "\3001\0\0\0\0\0\0\320C\1\0\0\0\0\0\3\4\0\0\0\0\0\0\3101\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\3001\0\0\0\0\0\0\320C\1\0\0\0\0\0\3\4\0\0\0\0\0\0\3101\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\2\4\0\0\34\0\0\0\0\0\0\0\0\0\0\0h?\1\0\0\0\0\0\2\4\0\0\35\0\0\0"..., 1024) = 1024
write(4, "\2\4\0\0\34\0\0\0\0\0\0\0\0\0\0\0h?\1\0\0\0\0\0\2\4\0\0\35\0\0\0"..., 1024) = 1024
read(3, "\375\3\0\221\363\v\0\371\340/\0\271\341\23\0\371\340/@\271\37\10\0qM\1\0T\340\23@\371"..., 1024) = 1024
write(4, "\375\3\0\221\363\v\0\371\340/\0\271\341\23\0\371\340/@\271\37\10\0qM\1\0T\340\23@\371"..., 1024) = 1024
read(3, "\0@3\221\275\0\0\224\0\0\200RM\376\377\227\375{\275\251\375\3\0\221\340\37\0\271\0\0\0\260"..., 1024) = 1024
write(4, "\0@3\221\275\0\0\224\0\0\200RM\376\377\227\375{\275\251\375\3\0\221\340\37\0\271\0\0\0\260"..., 1024) = 1024
read(3, "\3467\200=\347;\200=\200\0\0\260\0\360G\371\1\0@\371\3417\0\371\1\0\200\322\340\303\4\221"..., 1024) = 1024
write(4, "\3467\200=\347;\200=\200\0\0\260\0\360G\371\1\0@\371\3417\0\371\1\0\200\322\340\303\4\221"..., 1024) = 1024
read(3, "\200\0\0\260\0\344G\371\0\0@\371\225\374\377\227 \0\200RK\374\377\227\375{\275\251\375\3\0\221"..., 1024) = 1024
write(4, "\200\0\0\260\0\344G\371\0\0@\371\225\374\377\227 \0\200RK\374\377\227\375{\275\251\375\3\0\221"..., 1024) = 1024
read(3, "h>|R<length>|w<string>|s<offset>"..., 1024) = 1024
write(4, "h>|R<length>|w<string>|s<offset>"..., 1024) = 1024
read(3, "EDESTADDRREQ\0\0\0\0EMSGSIZE\0\0\0\0\0\0\0\0"..., 1024) = 1024
write(4, "EDESTADDRREQ\0\0\0\0EMSGSIZE\0\0\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\354\0\0\0\30\350\377\377\20\1\0\0\34\350\377\377(\1\0\0000\354\377\377H\1\0\0\210\354\377\377"..., 1024) = 1024
write(4, "\354\0\0\0\30\350\377\377\20\1\0\0\34\350\377\377(\1\0\0000\354\377\377H\1\0\0\210\354\377\377"..., 1024) = 1024
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\0\0\0\0\0\0\0\0\10@\1\0\0\0\0\0\330,\0\0\0\0\0\0\340,\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\0\0\0\0\0\0\0\0\10@\1\0\0\0\0\0\330,\0\0\0\0\0\0\340,\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\0302\0\0\0\0\0\0 2\0\0\0\0\0\00002\0\0\0\0\0\0@2\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\0302\0\0\0\0\0\0 2\0\0\0\0\0\00002\0\0\0\0\0\0@2\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\0\16!\2\0\0\6\10\6\3\0\0\17\221\0\0\0!\3\0\0\20B\0\0\0\23\0\21M\2\0"..., 1024) = 1024
write(4, "\0\16!\2\0\0\6\10\6\3\0\0\17\221\0\0\0!\3\0\0\20B\0\0\0\23\0\21M\2\0"..., 1024) = 1024
read(3, "\2\1\0\0\fY\3\0\0\5+\16\rz\1\0\0\10\10\235\2\0\0\10\10\2\1\0\0\16\334\0"..., 1024) = 1024
write(4, "\2\1\0\0\fY\3\0\0\5+\16\rz\1\0\0\10\10\235\2\0\0\10\10\2\1\0\0\16\334\0"..., 1024) = 1024
read(3, "\1\32\v\326\0\0\0\2\221x\0\0\177\4\0\0\4\0\372\2\0\0\10\1S\2\0\0\f\311\4\0"..., 1024) = 1024
write(4, "\1\32\v\326\0\0\0\2\221x\0\0\177\4\0\0\4\0\372\2\0\0\10\1S\2\0\0\f\311\4\0"..., 1024) = 1024
read(3, "2C\313\2\0\0\2\221@\23res\0\0014\nl\0\0\0\2\221p\25\237\4\0\0\0015\v"..., 1024) = 1024
write(4, "2C\313\2\0\0\2\221@\23res\0\0014\nl\0\0\0\2\221p\25\237\4\0\0\0015\v"..., 1024) = 1024
read(3, "\v;\v9\v\0\0\v\23\0\3\16<\31\0\0\f\1\1I\23\1\23\0\0\r!\0I\23/\v"..., 1024) = 1024
write(4, "\v;\v9\v\0\0\v\23\0\3\16<\31\0\0\f\1\1I\23\1\23\0\0\r!\0I\23/\v"..., 1024) = 1024
read(3, "\0\0\0stdarg.h\0\1\0\0types.h\0\2\0\0stddef"..., 1024) = 1024
write(4, "\0\0\0stdarg.h\0\1\0\0types.h\0\2\0\0stddef"..., 1024) = 1024
read(3, "ers\0_IO_read_end\0_ISdigit\0_freer"..., 1024) = 1024
write(4, "ers\0_IO_read_end\0_ISdigit\0_freer"..., 1024) = 1024
read(3, "\0fatal\0endptr\0getInt\0getNum\0gnFa"..., 1024) = 1024
write(4, "\0fatal\0endptr\0getInt\0getNum\0gnFa"..., 1024) = 1024
read(3, "H\0\0\0\0\0\v\0\334\30\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0\0\0\0\0\16\0"..., 1024) = 1024
write(4, "H\0\0\0\0\0\v\0\334\30\0\0\0\0\0\0\0\0\0\0\0\0\0\0H\0\0\0\0\0\16\0"..., 1024) = 1024
read(3, "\0\0\0\0\0\0\0\0\371\1\0\0\0\0\22\0\220<\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\0\0\0\0\0\0\0\0\371\1\0\0\0\0\22\0\220<\1\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
read(3, "\300#\0\0\0\0\0\0\310\0\0\0\0\0\0\0a\4\0\0\22\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\300#\0\0\0\0\0\0\310\0\0\0\0\0\0\0a\4\0\0\22\0\0\0\0\0\0\0\0\0\0\0"..., 1024) = 1024
read(3, "-init.oS\0__FRAME_END__\0__init_ar"..., 1024) = 1024
write(4, "-init.oS\0__FRAME_END__\0__init_ar"..., 1024) = 1024
read(3, "BI-tag\0.gnu.hash\0.dynsym\0.dynstr"..., 1024) = 1024
write(4, "BI-tag\0.gnu.hash\0.dynsym\0.dynstr"..., 1024) = 1024
read(3, "\211\0\0\0\1\0\0\0\6\0\0\0\0\0\0\0\360\30\0\0\0\0\0\0\360\30\0\0\0\0\0\0"..., 1024) = 1024
write(4, "\211\0\0\0\1\0\0\0\6\0\0\0\0\0\0\0\360\30\0\0\0\0\0\0\360\30\0\0\0\0\0\0"..., 1024) = 1024
read(3, "#\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\321X\0\0\0\0\0\0"..., 1024) = 320
write(4, "#\1\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\321X\0\0\0\0\0\0"..., 320) = 320
read(3, "", 1024)                       = 0
close(3)                                = 0
close(4)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

2. TLPI Makefile 분석

1. Makefile.inc

1. 코드

# Makefile.inc - common definitions used by all makefiles

TLPI_DIR = ..
TLPI_LIB = ${TLPI_DIR}/libtlpi.a
TLPI_INCL_DIR = ${TLPI_DIR}/lib

LINUX_LIBRT = -lrt
LINUX_LIBDL = -ldl
LINUX_LIBACL = -lacl
LINUX_LIBCRYPT = -lcrypt
LINUX_LIBCAP = -lcap

# "-Wextra" is a more descriptive synonym for "-W", but only
# available in more recent gcc versions

# Defining _DEFAULT_SOURCE is a workaround to avoid the warnings that
# would otherwise be produced when compiling code that defines _BSD_SOURCE
# or _SVID_SOURCE against glibc headers in version 2.20 and later.
# (The alternative would be to replace each instance of "#define _SVID_SOURCE"
# or "#define _BSD_SOURCE" in the example programs with
# "#define _DEFAULT_SOURCE".)

IMPL_CFLAGS = -std=c99 -D_XOPEN_SOURCE=600 \
                -D_DEFAULT_SOURCE \
                -g -I${TLPI_INCL_DIR} \
                -pedantic \
                -Wall \
                -W \
                -Wmissing-prototypes \
                -Wno-sign-compare \
                -Wimplicit-fallthrough \
                -Wno-unused-parameter

# clang(1) is a little more zealous than gcc(1) with respect to some warnings.
# Suppress those warnings (which, at least in the book code, relate to code
# that is fine).

ifeq ($(CC),clang)
        IMPL_CFLAGS += -Wno-uninitialized -Wno-infinite-recursion \
                        -Wno-format-pedantic
endif

CFLAGS = ${IMPL_CFLAGS}

IMPL_THREAD_FLAGS = -pthread

IMPL_LDLIBS = ${TLPI_LIB}

LDLIBS =

RM = rm -f

2. 분석

여러 가지 Makefile들을 만들 때 공통적으로 사용되는 옵션이나 명령어들에 대한 매크로를 저장해 둔 것을 볼 수 있다.

2. 최상위 Makefile

1. 코드

# Makefile to build all programs in all subdirectories
#
# DIRS is a list of all subdirectories containing makefiles
# (The library directory is first so that the library gets built first)
#

DIRS =  lib \
        acl altio \
        cap cgroups \
        daemons dirs_links \
        filebuff fileio filelock files filesys getopt \
        inotify \
        loginacct \
        memalloc \
        mmap \
        pgsjc pipes pmsg \
        proc proccred procexec procpri procres \
        progconc \
        psem pshm pty \
        shlibs \
        signals sockets \
        svipc svmsg svsem svshm \
        sysinfo \
        syslim \
        threads time timers tty \
        users_groups \
        vdso \
        vmem \
        xattr

# The "namespaces" and "seccomp" directories are deliberately excluded from
# the above list because much of the code in those directories requires a
# relatively recent kernel and userspace to build. Nevertheless, each of
# those directories contains a Makefile.

BUILD_DIRS = ${DIRS}


# Dummy targets for building and clobbering everything in all subdirectories

all:
        @ echo ${BUILD_DIRS}
        @ for dir in ${BUILD_DIRS}; do (cd $${dir}; ${MAKE}) ; \
                if test $$? -ne 0; then break; fi; done

allgen:
        @ for dir in ${BUILD_DIRS}; do (cd $${dir}; ${MAKE} allgen) ; done

clean:
        @ for dir in ${BUILD_DIRS}; do (cd $${dir}; ${MAKE} clean) ; done

2. 분석

TLPI 하위 폴더들에 대한 각각의 makefile을 실행해주는 것을 알 수 있다.

3. fileio/Makefile

1. 코드

include ../Makefile.inc

GEN_EXE = atomic_append bad_exclusive_open copy \
        multi_descriptors seek_io t_readv t_truncate

LINUX_EXE = large_file

EXE = ${GEN_EXE} ${LINUX_EXE}

all : ${EXE}

allgen : ${GEN_EXE}


clean :
        ${RM} ${EXE} *.o

showall :
        @ echo ${EXE}

${EXE} : ${TLPI_LIB}            # True as a rough approximation

2. 분석

  • GEN_EXE : 최종적으로 나올 실행파일들 이름
  • LINUX_EXE : libtlpi.a를 위한 실행파일

3. ELF 분석 실습

1. readelf

readelf -a copy

분석결과

readelf -a copy
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           AArch64
  Version:                           0x1
  Entry point address:               0x1860
  Start of program headers:          64 (bytes into file)
  Start of section headers:          27928 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         33
  Section header string table index: 32

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .interp           PROGBITS         0000000000000238  00000238
       000000000000001b  0000000000000000   A       0     0     1
  [ 2] .note.gnu.build-i NOTE             0000000000000254  00000254
       0000000000000024  0000000000000000   A       0     0     4
  [ 3] .note.ABI-tag     NOTE             0000000000000278  00000278
       0000000000000020  0000000000000000   A       0     0     4
  [ 4] .gnu.hash         GNU_HASH         0000000000000298  00000298
       000000000000001c  0000000000000000   A       5     0     8
  [ 5] .dynsym           DYNSYM           00000000000002b8  000002b8
       00000000000002b8  0000000000000018   A       6     3     8
  [ 6] .dynstr           STRTAB           0000000000000570  00000570
       000000000000012e  0000000000000000   A       0     0     1
  [ 7] .gnu.version      VERSYM           000000000000069e  0000069e
       000000000000003a  0000000000000002   A       5     0     2
  [ 8] .gnu.version_r    VERNEED          00000000000006d8  000006d8
       0000000000000040  0000000000000000   A       6     2     8
  [ 9] .rela.dyn         RELA             0000000000000718  00000718
       0000000000000dc8  0000000000000018   A       5     0     8
  [10] .rela.plt         RELA             00000000000014e0  000014e0
       00000000000001f8  0000000000000018  AI       5    21     8
  [11] .init             PROGBITS         00000000000016d8  000016d8
       0000000000000014  0000000000000000  AX       0     0     4
  [12] .plt              PROGBITS         00000000000016f0  000016f0
       0000000000000170  0000000000000010  AX       0     0     16
  [13] .text             PROGBITS         0000000000001860  00001860
       0000000000000b4c  0000000000000000  AX       0     0     8
  [14] .fini             PROGBITS         00000000000023ac  000023ac
       0000000000000010  0000000000000000  AX       0     0     4
  [15] .rodata           PROGBITS         00000000000023c0  000023c0
       00000000000006b3  0000000000000000   A       0     0     8
  [16] .eh_frame_hdr     PROGBITS         0000000000002a74  00002a74
       000000000000008c  0000000000000000   A       0     0     4
  [17] .eh_frame         PROGBITS         0000000000002b00  00002b00
       00000000000001ec  0000000000000000   A       0     0     8
  [18] .init_array       INIT_ARRAY       0000000000013cd8  00003cd8
       0000000000000008  0000000000000008  WA       0     0     8
  [19] .fini_array       FINI_ARRAY       0000000000013ce0  00003ce0
       0000000000000008  0000000000000008  WA       0     0     8
  [20] .dynamic          DYNAMIC          0000000000013ce8  00003ce8
       0000000000000200  0000000000000010  WA       6     0     8
  [21] .got              PROGBITS         0000000000013ee8  00003ee8
       0000000000000118  0000000000000008  WA       0     0     8
  [22] .data             PROGBITS         0000000000014000  00004000
       0000000000000440  0000000000000000  WA       0     0     8
  [23] .bss              NOBITS           0000000000014440  00004440
       0000000000000008  0000000000000000  WA       0     0     1
  [24] .comment          PROGBITS         0000000000000000  00004440
       000000000000002b  0000000000000001  MS       0     0     1
  [25] .debug_aranges    PROGBITS         0000000000000000  0000446b
       0000000000000060  0000000000000000           0     0     1
  [26] .debug_info       PROGBITS         0000000000000000  000044cb
       0000000000000ab1  0000000000000000           0     0     1
  [27] .debug_abbrev     PROGBITS         0000000000000000  00004f7c
       00000000000002e5  0000000000000000           0     0     1
  [28] .debug_line       PROGBITS         0000000000000000  00005261
       00000000000003e9  0000000000000000           0     0     1
  [29] .debug_str        PROGBITS         0000000000000000  0000564a
       0000000000000452  0000000000000001  MS       0     0     1
  [30] .symtab           SYMTAB           0000000000000000  00005aa0
       0000000000000c60  0000000000000018          31    82     8
  [31] .strtab           STRTAB           0000000000000000  00006700
       00000000000004d7  0000000000000000           0     0     1
  [32] .shstrtab         STRTAB           0000000000000000  00006bd7
       000000000000013a  0000000000000000           0     0     1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
  L (link order), O (extra OS processing required), G (group), T (TLS),
  C (compressed), x (unknown), o (OS specific), E (exclude),
  p (processor specific)

There are no section groups in this file.

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
                 0x00000000000001f8 0x00000000000001f8  R      0x8
  INTERP         0x0000000000000238 0x0000000000000238 0x0000000000000238
                 0x000000000000001b 0x000000000000001b  R      0x1
      [Requesting program interpreter: /lib/ld-linux-aarch64.so.1]
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000002cec 0x0000000000002cec  R E    0x10000
  LOAD           0x0000000000003cd8 0x0000000000013cd8 0x0000000000013cd8
                 0x0000000000000768 0x0000000000000770  RW     0x10000
  DYNAMIC        0x0000000000003ce8 0x0000000000013ce8 0x0000000000013ce8
                 0x0000000000000200 0x0000000000000200  RW     0x8
  NOTE           0x0000000000000254 0x0000000000000254 0x0000000000000254
                 0x0000000000000044 0x0000000000000044  R      0x4
  GNU_EH_FRAME   0x0000000000002a74 0x0000000000002a74 0x0000000000002a74
                 0x000000000000008c 0x000000000000008c  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  GNU_RELRO      0x0000000000003cd8 0x0000000000013cd8 0x0000000000013cd8
                 0x0000000000000328 0x0000000000000328  R      0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 
   03     .init_array .fini_array .dynamic .got .data .bss 
   04     .dynamic 
   05     .note.gnu.build-id .note.ABI-tag 
   06     .eh_frame_hdr 
   07     
   08     .init_array .fini_array .dynamic .got 

Dynamic section at offset 0x3ce8 contains 28 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]
 0x000000000000000c (INIT)               0x16d8
 0x000000000000000d (FINI)               0x23ac
 0x0000000000000019 (INIT_ARRAY)         0x13cd8
 0x000000000000001b (INIT_ARRAYSZ)       8 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x13ce0
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x298
 0x0000000000000005 (STRTAB)             0x570
 0x0000000000000006 (SYMTAB)             0x2b8
 0x000000000000000a (STRSZ)              302 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x13ee8
 0x0000000000000002 (PLTRELSZ)           504 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x14e0
 0x0000000000000007 (RELA)               0x718
 0x0000000000000008 (RELASZ)             3528 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE
 0x000000006ffffffe (VERNEED)            0x6d8
 0x000000006fffffff (VERNEEDNUM)         2
 0x000000006ffffff0 (VERSYM)             0x69e
 0x000000006ffffff9 (RELACOUNT)          140
 0x0000000000000000 (NULL)               0x0

Relocation section '.rela.dyn' at offset 0x718 contains 147 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000013cd8  000000000403 R_AARCH64_RELATIV                    1968
000000013ce0  000000000403 R_AARCH64_RELATIV                    1920
000000013fb0  000000000403 R_AARCH64_RELATIV                    23a8
000000013fe8  000000000403 R_AARCH64_RELATIV                    2328
000000013ff0  000000000403 R_AARCH64_RELATIV                    196c
000000014008  000000000403 R_AARCH64_RELATIV                    14008
000000014010  000000000403 R_AARCH64_RELATIV                    2458
000000014018  000000000403 R_AARCH64_RELATIV                    2460
000000014020  000000000403 R_AARCH64_RELATIV                    2468
000000014028  000000000403 R_AARCH64_RELATIV                    2470
000000014030  000000000403 R_AARCH64_RELATIV                    2478
000000014038  000000000403 R_AARCH64_RELATIV                    2480
000000014040  000000000403 R_AARCH64_RELATIV                    2488
000000014048  000000000403 R_AARCH64_RELATIV                    2490
000000014050  000000000403 R_AARCH64_RELATIV                    2498
000000014058  000000000403 R_AARCH64_RELATIV                    24a0
000000014060  000000000403 R_AARCH64_RELATIV                    24a8
000000014068  000000000403 R_AARCH64_RELATIV                    24b0
000000014070  000000000403 R_AARCH64_RELATIV                    24c8
000000014078  000000000403 R_AARCH64_RELATIV                    24d0
000000014080  000000000403 R_AARCH64_RELATIV                    24d8
000000014088  000000000403 R_AARCH64_RELATIV                    24e0
000000014090  000000000403 R_AARCH64_RELATIV                    24e8
000000014098  000000000403 R_AARCH64_RELATIV                    24f0
0000000140a0  000000000403 R_AARCH64_RELATIV                    24f8
0000000140a8  000000000403 R_AARCH64_RELATIV                    2500
0000000140b0  000000000403 R_AARCH64_RELATIV                    2508
0000000140b8  000000000403 R_AARCH64_RELATIV                    2510
0000000140c0  000000000403 R_AARCH64_RELATIV                    2518
0000000140c8  000000000403 R_AARCH64_RELATIV                    2520
0000000140d0  000000000403 R_AARCH64_RELATIV                    2528
0000000140d8  000000000403 R_AARCH64_RELATIV                    2530
0000000140e0  000000000403 R_AARCH64_RELATIV                    2538
0000000140e8  000000000403 R_AARCH64_RELATIV                    2540
0000000140f0  000000000403 R_AARCH64_RELATIV                    2548
0000000140f8  000000000403 R_AARCH64_RELATIV                    2550
000000014100  000000000403 R_AARCH64_RELATIV                    2558
000000014108  000000000403 R_AARCH64_RELATIV                    2560
000000014110  000000000403 R_AARCH64_RELATIV                    2568
000000014118  000000000403 R_AARCH64_RELATIV                    2570
000000014120  000000000403 R_AARCH64_RELATIV                    2578
000000014128  000000000403 R_AARCH64_RELATIV                    2580
000000014130  000000000403 R_AARCH64_RELATIV                    2598
000000014138  000000000403 R_AARCH64_RELATIV                    25a8
000000014140  000000000403 R_AARCH64_RELATIV                    25b0
000000014148  000000000403 R_AARCH64_RELATIV                    25b8
000000014150  000000000403 R_AARCH64_RELATIV                    25c8
000000014158  000000000403 R_AARCH64_RELATIV                    2458
000000014160  000000000403 R_AARCH64_RELATIV                    25d0
000000014168  000000000403 R_AARCH64_RELATIV                    25d8
000000014170  000000000403 R_AARCH64_RELATIV                    25e0
000000014178  000000000403 R_AARCH64_RELATIV                    25e8
000000014180  000000000403 R_AARCH64_RELATIV                    25f8
000000014188  000000000403 R_AARCH64_RELATIV                    2600
000000014190  000000000403 R_AARCH64_RELATIV                    2608
000000014198  000000000403 R_AARCH64_RELATIV                    2610
0000000141a0  000000000403 R_AARCH64_RELATIV                    2618
0000000141a8  000000000403 R_AARCH64_RELATIV                    2620
0000000141b0  000000000403 R_AARCH64_RELATIV                    2628
0000000141b8  000000000403 R_AARCH64_RELATIV                    2630
0000000141c0  000000000403 R_AARCH64_RELATIV                    2638
0000000141c8  000000000403 R_AARCH64_RELATIV                    2640
0000000141d0  000000000403 R_AARCH64_RELATIV                    2648
0000000141d8  000000000403 R_AARCH64_RELATIV                    2650
0000000141e0  000000000403 R_AARCH64_RELATIV                    2458
0000000141e8  000000000403 R_AARCH64_RELATIV                    2658
0000000141f0  000000000403 R_AARCH64_RELATIV                    2660
0000000141f8  000000000403 R_AARCH64_RELATIV                    2668
000000014200  000000000403 R_AARCH64_RELATIV                    2670
000000014208  000000000403 R_AARCH64_RELATIV                    2678
000000014210  000000000403 R_AARCH64_RELATIV                    2680
000000014218  000000000403 R_AARCH64_RELATIV                    2688
000000014220  000000000403 R_AARCH64_RELATIV                    2690
000000014228  000000000403 R_AARCH64_RELATIV                    2698
000000014230  000000000403 R_AARCH64_RELATIV                    26a0
000000014238  000000000403 R_AARCH64_RELATIV                    26a8
000000014240  000000000403 R_AARCH64_RELATIV                    26b0
000000014248  000000000403 R_AARCH64_RELATIV                    26b8
000000014250  000000000403 R_AARCH64_RELATIV                    26c0
000000014258  000000000403 R_AARCH64_RELATIV                    26d0
000000014260  000000000403 R_AARCH64_RELATIV                    26d8
000000014268  000000000403 R_AARCH64_RELATIV                    26e0
000000014270  000000000403 R_AARCH64_RELATIV                    26f0
000000014278  000000000403 R_AARCH64_RELATIV                    2700
000000014280  000000000403 R_AARCH64_RELATIV                    2708
000000014288  000000000403 R_AARCH64_RELATIV                    2710
000000014290  000000000403 R_AARCH64_RELATIV                    2718
000000014298  000000000403 R_AARCH64_RELATIV                    2720
0000000142a0  000000000403 R_AARCH64_RELATIV                    2728
0000000142a8  000000000403 R_AARCH64_RELATIV                    2730
0000000142b0  000000000403 R_AARCH64_RELATIV                    2740
0000000142b8  000000000403 R_AARCH64_RELATIV                    2748
0000000142c0  000000000403 R_AARCH64_RELATIV                    2758
0000000142c8  000000000403 R_AARCH64_RELATIV                    2768
0000000142d0  000000000403 R_AARCH64_RELATIV                    2770
0000000142d8  000000000403 R_AARCH64_RELATIV                    2780
0000000142e0  000000000403 R_AARCH64_RELATIV                    2790
0000000142e8  000000000403 R_AARCH64_RELATIV                    27a0
0000000142f0  000000000403 R_AARCH64_RELATIV                    27b0
0000000142f8  000000000403 R_AARCH64_RELATIV                    27c0
000000014300  000000000403 R_AARCH64_RELATIV                    27d0
000000014308  000000000403 R_AARCH64_RELATIV                    27e0
000000014310  000000000403 R_AARCH64_RELATIV                    27f8
000000014318  000000000403 R_AARCH64_RELATIV                    2808
000000014320  000000000403 R_AARCH64_RELATIV                    2818
000000014328  000000000403 R_AARCH64_RELATIV                    2828
000000014330  000000000403 R_AARCH64_RELATIV                    2838
000000014338  000000000403 R_AARCH64_RELATIV                    2848
000000014340  000000000403 R_AARCH64_RELATIV                    2858
000000014348  000000000403 R_AARCH64_RELATIV                    2868
000000014350  000000000403 R_AARCH64_RELATIV                    2878
000000014358  000000000403 R_AARCH64_RELATIV                    2888
000000014360  000000000403 R_AARCH64_RELATIV                    2890
000000014368  000000000403 R_AARCH64_RELATIV                    2898
000000014370  000000000403 R_AARCH64_RELATIV                    28a8
000000014378  000000000403 R_AARCH64_RELATIV                    28b8
000000014380  000000000403 R_AARCH64_RELATIV                    28c8
000000014388  000000000403 R_AARCH64_RELATIV                    28d8
000000014390  000000000403 R_AARCH64_RELATIV                    28e8
000000014398  000000000403 R_AARCH64_RELATIV                    28f8
0000000143a0  000000000403 R_AARCH64_RELATIV                    2908
0000000143a8  000000000403 R_AARCH64_RELATIV                    2918
0000000143b0  000000000403 R_AARCH64_RELATIV                    2928
0000000143b8  000000000403 R_AARCH64_RELATIV                    2930
0000000143c0  000000000403 R_AARCH64_RELATIV                    2938
0000000143c8  000000000403 R_AARCH64_RELATIV                    2940
0000000143d0  000000000403 R_AARCH64_RELATIV                    2948
0000000143d8  000000000403 R_AARCH64_RELATIV                    2950
0000000143e0  000000000403 R_AARCH64_RELATIV                    2960
0000000143e8  000000000403 R_AARCH64_RELATIV                    2968
0000000143f0  000000000403 R_AARCH64_RELATIV                    2978
0000000143f8  000000000403 R_AARCH64_RELATIV                    2988
000000014400  000000000403 R_AARCH64_RELATIV                    2998
000000014408  000000000403 R_AARCH64_RELATIV                    29a0
000000014410  000000000403 R_AARCH64_RELATIV                    29b0
000000014418  000000000403 R_AARCH64_RELATIV                    29c0
000000014420  000000000403 R_AARCH64_RELATIV                    29d0
000000014428  000000000403 R_AARCH64_RELATIV                    29e0
000000014430  000000000403 R_AARCH64_RELATIV                    29f0
000000014438  000000000403 R_AARCH64_RELATIV                    29f8
000000013fb8  000600000401 R_AARCH64_GLOB_DA 0000000000000000 _ITM_deregisterTMClone + 0
000000013fc0  000700000401 R_AARCH64_GLOB_DA 0000000000000000 __cxa_finalize@GLIBC_2.17 + 0
000000013fc8  000800000401 R_AARCH64_GLOB_DA 0000000000000000 stderr@GLIBC_2.17 + 0
000000013fd0  000c00000401 R_AARCH64_GLOB_DA 0000000000000000 stdout@GLIBC_2.17 + 0
000000013fd8  001000000401 R_AARCH64_GLOB_DA 0000000000000000 __gmon_start__ + 0
000000013fe0  001100000401 R_AARCH64_GLOB_DA 0000000000000000 __stack_chk_guard@GLIBC_2.17 + 0
000000013ff8  001900000401 R_AARCH64_GLOB_DA 0000000000000000 _ITM_registerTMCloneTa + 0

Relocation section '.rela.plt' at offset 0x14e0 contains 21 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000013f00  000300000402 R_AARCH64_JUMP_SL 0000000000000000 _exit@GLIBC_2.17 + 0
000000013f08  000400000402 R_AARCH64_JUMP_SL 0000000000000000 fputs@GLIBC_2.17 + 0
000000013f10  000500000402 R_AARCH64_JUMP_SL 0000000000000000 exit@GLIBC_2.17 + 0
000000013f18  000700000402 R_AARCH64_JUMP_SL 0000000000000000 __cxa_finalize@GLIBC_2.17 + 0
000000013f20  000900000402 R_AARCH64_JUMP_SL 0000000000000000 snprintf@GLIBC_2.17 + 0
000000013f28  000a00000402 R_AARCH64_JUMP_SL 0000000000000000 open@GLIBC_2.17 + 0
000000013f30  000b00000402 R_AARCH64_JUMP_SL 0000000000000000 __libc_start_main@GLIBC_2.17 + 0
000000013f38  000d00000402 R_AARCH64_JUMP_SL 0000000000000000 strerror@GLIBC_2.17 + 0
000000013f40  000e00000402 R_AARCH64_JUMP_SL 0000000000000000 __stack_chk_fail@GLIBC_2.17 + 0
000000013f48  000f00000402 R_AARCH64_JUMP_SL 0000000000000000 close@GLIBC_2.17 + 0
000000013f50  001000000402 R_AARCH64_JUMP_SL 0000000000000000 __gmon_start__ + 0
000000013f58  001200000402 R_AARCH64_JUMP_SL 0000000000000000 write@GLIBC_2.17 + 0
000000013f60  001300000402 R_AARCH64_JUMP_SL 0000000000000000 abort@GLIBC_2.17 + 0
000000013f68  001400000402 R_AARCH64_JUMP_SL 0000000000000000 strcmp@GLIBC_2.17 + 0
000000013f70  001500000402 R_AARCH64_JUMP_SL 0000000000000000 fwrite@GLIBC_2.17 + 0
000000013f78  001600000402 R_AARCH64_JUMP_SL 0000000000000000 fflush@GLIBC_2.17 + 0
000000013f80  001700000402 R_AARCH64_JUMP_SL 0000000000000000 read@GLIBC_2.17 + 0
000000013f88  001800000402 R_AARCH64_JUMP_SL 0000000000000000 vsnprintf@GLIBC_2.17 + 0
000000013f90  001a00000402 R_AARCH64_JUMP_SL 0000000000000000 vfprintf@GLIBC_2.17 + 0
000000013f98  001b00000402 R_AARCH64_JUMP_SL 0000000000000000 __errno_location@GLIBC_2.17 + 0
000000013fa0  001c00000402 R_AARCH64_JUMP_SL 0000000000000000 getenv@GLIBC_2.17 + 0

The decoding of unwind sections for machine type AArch64 is not currently supported.

Symbol table '.dynsym' contains 29 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000000016d8     0 SECTION LOCAL  DEFAULT   11 
     2: 0000000000014000     0 SECTION LOCAL  DEFAULT   22 
     3: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _exit@GLIBC_2.17 (2)
     4: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fputs@GLIBC_2.17 (2)
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND exit@GLIBC_2.17 (2)
     6: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTab
     7: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND __cxa_finalize@GLIBC_2.17 (2)
     8: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND stderr@GLIBC_2.17 (2)
     9: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND snprintf@GLIBC_2.17 (2)
    10: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND open@GLIBC_2.17 (2)
    11: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@GLIBC_2.17 (2)
    12: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND stdout@GLIBC_2.17 (2)
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strerror@GLIBC_2.17 (2)
    14: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@GLIBC_2.17 (2)
    15: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND close@GLIBC_2.17 (2)
    16: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
    17: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND __stack_chk_guard@GLIBC_2.17 (3)
    18: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND write@GLIBC_2.17 (2)
    19: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND abort@GLIBC_2.17 (2)
    20: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strcmp@GLIBC_2.17 (2)
    21: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fwrite@GLIBC_2.17 (2)
    22: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fflush@GLIBC_2.17 (2)
    23: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND read@GLIBC_2.17 (2)
    24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND vsnprintf@GLIBC_2.17 (2)
    25: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
    26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND vfprintf@GLIBC_2.17 (2)
    27: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __errno_location@GLIBC_2.17 (2)
    28: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getenv@GLIBC_2.17 (2)

Symbol table '.symtab' contains 132 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000238     0 SECTION LOCAL  DEFAULT    1 
     2: 0000000000000254     0 SECTION LOCAL  DEFAULT    2 
     3: 0000000000000278     0 SECTION LOCAL  DEFAULT    3 
     4: 0000000000000298     0 SECTION LOCAL  DEFAULT    4 
     5: 00000000000002b8     0 SECTION LOCAL  DEFAULT    5 
     6: 0000000000000570     0 SECTION LOCAL  DEFAULT    6 
     7: 000000000000069e     0 SECTION LOCAL  DEFAULT    7 
     8: 00000000000006d8     0 SECTION LOCAL  DEFAULT    8 
     9: 0000000000000718     0 SECTION LOCAL  DEFAULT    9 
    10: 00000000000014e0     0 SECTION LOCAL  DEFAULT   10 
    11: 00000000000016d8     0 SECTION LOCAL  DEFAULT   11 
    12: 00000000000016f0     0 SECTION LOCAL  DEFAULT   12 
    13: 0000000000001860     0 SECTION LOCAL  DEFAULT   13 
    14: 00000000000023ac     0 SECTION LOCAL  DEFAULT   14 
    15: 00000000000023c0     0 SECTION LOCAL  DEFAULT   15 
    16: 0000000000002a74     0 SECTION LOCAL  DEFAULT   16 
    17: 0000000000002b00     0 SECTION LOCAL  DEFAULT   17 
    18: 0000000000013cd8     0 SECTION LOCAL  DEFAULT   18 
    19: 0000000000013ce0     0 SECTION LOCAL  DEFAULT   19 
    20: 0000000000013ce8     0 SECTION LOCAL  DEFAULT   20 
    21: 0000000000013ee8     0 SECTION LOCAL  DEFAULT   21 
    22: 0000000000014000     0 SECTION LOCAL  DEFAULT   22 
    23: 0000000000014440     0 SECTION LOCAL  DEFAULT   23 
    24: 0000000000000000     0 SECTION LOCAL  DEFAULT   24 
    25: 0000000000000000     0 SECTION LOCAL  DEFAULT   25 
    26: 0000000000000000     0 SECTION LOCAL  DEFAULT   26 
    27: 0000000000000000     0 SECTION LOCAL  DEFAULT   27 
    28: 0000000000000000     0 SECTION LOCAL  DEFAULT   28 
    29: 0000000000000000     0 SECTION LOCAL  DEFAULT   29 
    30: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS /usr/lib/gcc/aarch64-linu
    31: 0000000000000278     0 NOTYPE  LOCAL  DEFAULT    3 $d
    32: 0000000000001860     0 NOTYPE  LOCAL  DEFAULT   13 $x
    33: 00000000000023c0     0 NOTYPE  LOCAL  DEFAULT   15 $d
    34: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS /usr/lib/gcc/aarch64-linu
    35: 0000000000001898     0 NOTYPE  LOCAL  DEFAULT   13 $x
    36: 0000000000001898    20 FUNC    LOCAL  DEFAULT   13 call_weak_fn
    37: 00000000000016d8     0 NOTYPE  LOCAL  DEFAULT   11 $x
    38: 00000000000023ac     0 NOTYPE  LOCAL  DEFAULT   14 $x
    39: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS /usr/lib/gcc/aarch64-linu
    40: 00000000000016e4     0 NOTYPE  LOCAL  DEFAULT   11 $x
    41: 00000000000023b4     0 NOTYPE  LOCAL  DEFAULT   14 $x
    42: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    43: 00000000000018b0     0 NOTYPE  LOCAL  DEFAULT   13 $x
    44: 00000000000018b0     0 FUNC    LOCAL  DEFAULT   13 deregister_tm_clones
    45: 00000000000018e0     0 FUNC    LOCAL  DEFAULT   13 register_tm_clones
    46: 0000000000014008     0 NOTYPE  LOCAL  DEFAULT   22 $d
    47: 0000000000001920     0 FUNC    LOCAL  DEFAULT   13 __do_global_dtors_aux
    48: 0000000000014440     1 OBJECT  LOCAL  DEFAULT   23 completed.9189
    49: 0000000000013ce0     0 NOTYPE  LOCAL  DEFAULT   19 $d
    50: 0000000000013ce0     0 OBJECT  LOCAL  DEFAULT   19 __do_global_dtors_aux_fin
    51: 0000000000001968     0 FUNC    LOCAL  DEFAULT   13 frame_dummy
    52: 0000000000013cd8     0 NOTYPE  LOCAL  DEFAULT   18 $d
    53: 0000000000013cd8     0 OBJECT  LOCAL  DEFAULT   18 __frame_dummy_init_array_
    54: 0000000000002b14     0 NOTYPE  LOCAL  DEFAULT   17 $d
    55: 0000000000014440     0 NOTYPE  LOCAL  DEFAULT   23 $d
    56: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS copy.c
    57: 00000000000023c8     0 NOTYPE  LOCAL  DEFAULT   15 $d
    58: 000000000000196c     0 NOTYPE  LOCAL  DEFAULT   13 $x
    59: 0000000000002b78     0 NOTYPE  LOCAL  DEFAULT   17 $d
    60: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS error_functions.c
    61: 0000000000002458     0 NOTYPE  LOCAL  DEFAULT   15 $d
    62: 0000000000014010     0 NOTYPE  LOCAL  DEFAULT   22 $d
    63: 0000000000014010  1072 OBJECT  LOCAL  DEFAULT   22 ename
    64: 0000000000001b20     0 NOTYPE  LOCAL  DEFAULT   13 $x
    65: 0000000000001b20    88 FUNC    LOCAL  DEFAULT   13 terminate
    66: 0000000000001b78   392 FUNC    LOCAL  DEFAULT   13 outputError
    67: 0000000000002b98     0 NOTYPE  LOCAL  DEFAULT   17 $d
    68: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS elf-init.oS
    69: 0000000000002328     0 NOTYPE  LOCAL  DEFAULT   13 $x
    70: 0000000000002ca0     0 NOTYPE  LOCAL  DEFAULT   17 $d
    71: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS crtstuff.c
    72: 0000000000002ce8     0 NOTYPE  LOCAL  DEFAULT   17 $d
    73: 0000000000002ce8     0 OBJECT  LOCAL  DEFAULT   17 __FRAME_END__
    74: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS 
    75: 0000000000013ce0     0 NOTYPE  LOCAL  DEFAULT   18 __init_array_end
    76: 0000000000013ce8     0 OBJECT  LOCAL  DEFAULT  ABS _DYNAMIC
    77: 0000000000013cd8     0 NOTYPE  LOCAL  DEFAULT   18 __init_array_start
    78: 0000000000002a74     0 NOTYPE  LOCAL  DEFAULT   16 __GNU_EH_FRAME_HDR
    79: 0000000000013fa8     0 OBJECT  LOCAL  DEFAULT  ABS _GLOBAL_OFFSET_TABLE_
    80: 00000000000016d8     0 FUNC    LOCAL  DEFAULT   11 _init
    81: 00000000000016f0     0 NOTYPE  LOCAL  DEFAULT   12 $x
    82: 00000000000023a8     4 FUNC    GLOBAL DEFAULT   13 __libc_csu_fini
    83: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _exit@@GLIBC_2.17
    84: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fputs@@GLIBC_2.17
    85: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND exit@@GLIBC_2.17
    86: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTab
    87: 0000000000014000     0 NOTYPE  WEAK   DEFAULT   22 data_start
    88: 0000000000014440     0 NOTYPE  GLOBAL DEFAULT   23 __bss_start__
    89: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND __cxa_finalize@@GLIBC_2.1
    90: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND stderr@@GLIBC_2.17
    91: 0000000000014448     0 NOTYPE  GLOBAL DEFAULT   23 _bss_end__
    92: 0000000000001e08   200 FUNC    GLOBAL DEFAULT   13 errExit
    93: 0000000000014440     0 NOTYPE  GLOBAL DEFAULT   22 _edata
    94: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND snprintf@@GLIBC_2.17
    95: 00000000000023ac     0 FUNC    GLOBAL HIDDEN    14 _fini
    96: 0000000000014448     0 NOTYPE  GLOBAL DEFAULT   23 __bss_end__
    97: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND open@@GLIBC_2.17
    98: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_start_main@@GLIBC_
    99: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND stdout@@GLIBC_2.17
   100: 0000000000001d00   264 FUNC    GLOBAL DEFAULT   13 errMsg
   101: 0000000000014000     0 NOTYPE  GLOBAL DEFAULT   22 __data_start
   102: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strerror@@GLIBC_2.17
   103: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@@GLIBC_2
   104: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND close@@GLIBC_2.17
   105: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
   106: 0000000000000000     0 OBJECT  GLOBAL DEFAULT  UND __stack_chk_guard@@GLIBC_
   107: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND write@@GLIBC_2.17
   108: 0000000000014008     0 OBJECT  GLOBAL HIDDEN    22 __dso_handle
   109: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND abort@@GLIBC_2.17
   110: 00000000000023c0     4 OBJECT  GLOBAL DEFAULT   15 _IO_stdin_used
   111: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strcmp@@GLIBC_2.17
   112: 0000000000001f98   192 FUNC    GLOBAL DEFAULT   13 errExitEN
   113: 0000000000002328   124 FUNC    GLOBAL DEFAULT   13 __libc_csu_init
   114: 0000000000001ed0   200 FUNC    GLOBAL DEFAULT   13 err_exit
   115: 0000000000014448     0 NOTYPE  GLOBAL DEFAULT   23 _end
   116: 0000000000001860     0 FUNC    GLOBAL DEFAULT   13 _start
   117: 0000000000002118   264 FUNC    GLOBAL DEFAULT   13 usageErr
   118: 0000000000014448     0 NOTYPE  GLOBAL DEFAULT   23 __end__
   119: 0000000000014440     0 NOTYPE  GLOBAL DEFAULT   23 __bss_start
   120: 000000000000196c   436 FUNC    GLOBAL DEFAULT   13 main
   121: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fwrite@@GLIBC_2.17
   122: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fflush@@GLIBC_2.17
   123: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND read@@GLIBC_2.17
   124: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND vsnprintf@@GLIBC_2.17
   125: 0000000000014440     0 OBJECT  GLOBAL HIDDEN    22 __TMC_END__
   126: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
   127: 0000000000002220   264 FUNC    GLOBAL DEFAULT   13 cmdLineErr
   128: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND vfprintf@@GLIBC_2.17
   129: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __errno_location@@GLIBC_2
   130: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getenv@@GLIBC_2.17
   131: 0000000000002058   192 FUNC    GLOBAL DEFAULT   13 fatal

Version symbols section '.gnu.version' contains 29 entries:
 Addr: 0x000000000000069e  Offset: 0x00069e  Link: 5 (.dynsym)
  000:   0 (*local*)       0 (*local*)       0 (*local*)       2 (GLIBC_2.17) 
  004:   2 (GLIBC_2.17)    2 (GLIBC_2.17)    0 (*local*)       2 (GLIBC_2.17) 
  008:   2 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17) 
  00c:   2 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17) 
  010:   0 (*local*)       3 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17) 
  014:   2 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17)    2 (GLIBC_2.17) 
  018:   2 (GLIBC_2.17)    0 (*local*)       2 (GLIBC_2.17)    2 (GLIBC_2.17) 
  01c:   2 (GLIBC_2.17) 

Version needs section '.gnu.version_r' contains 2 entries:
 Addr: 0x00000000000006d8  Offset: 0x0006d8  Link: 6 (.dynstr)
  000000: Version: 1  File: ld-linux-aarch64.so.1  Cnt: 1
  0x0010:   Name: GLIBC_2.17  Flags: none  Version: 3
  0x0020: Version: 1  File: libc.so.6  Cnt: 1
  0x0030:   Name: GLIBC_2.17  Flags: none  Version: 2

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 51bcc689f4ba29248156b278bd9d1137bfb2cdc1

Displaying notes found in: .note.ABI-tag
  Owner                Data size        Description
  GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.7.0

2. objdump

objdump -S copy

분석결과

more Objdump_copy.txt 

copy:     file format elf64-littleaarch64


Disassembly of section .init:

00000000000016d8 <_init>:
    16d8:       a9bf7bfd        stp     x29, x30, [sp, #-16]!
    16dc:       910003fd        mov     x29, sp
    16e0:       9400006e        bl      1898 <call_weak_fn>
    16e4:       a8c17bfd        ldp     x29, x30, [sp], #16
    16e8:       d65f03c0        ret

Disassembly of section .plt:

00000000000016f0 <.plt>:
    16f0:       a9bf7bf0        stp     x16, x30, [sp, #-16]!
    16f4:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    16f8:       f9477e11        ldr     x17, [x16, #3832]
    16fc:       913be210        add     x16, x16, #0xef8
    1700:       d61f0220        br      x17
    1704:       d503201f        nop
    1708:       d503201f        nop
    170c:       d503201f        nop

0000000000001710 <_exit@plt>:
    1710:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    1714:       f9478211        ldr     x17, [x16, #3840]
    1718:       913c0210        add     x16, x16, #0xf00
    171c:       d61f0220        br      x17

0000000000001720 <fputs@plt>:
    1720:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    1724:       f9478611        ldr     x17, [x16, #3848]
    1728:       913c2210        add     x16, x16, #0xf08
    172c:       d61f0220        br      x17

0000000000001730 <exit@plt>:
    1730:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    1734:       f9478a11        ldr     x17, [x16, #3856]
    1738:       913c4210        add     x16, x16, #0xf10
    173c:       d61f0220        br      x17

0000000000001740 <__cxa_finalize@plt>:
    1740:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    1744:       f9478e11        ldr     x17, [x16, #3864]
    1748:       913c6210        add     x16, x16, #0xf18
    174c:       d61f0220        br      x17

0000000000001750 <snprintf@plt>:
    1750:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    1754:       f9479211        ldr     x17, [x16, #3872]
    1758:       913c8210        add     x16, x16, #0xf20
    175c:       d61f0220        br      x17

0000000000001760 <open@plt>:
    1760:       d0000090        adrp    x16, 13000 <__FRAME_END__+0x10318>
    1764:       f9479611        ldr     x17, [x16, #3880]
    1768:       913ca210        add     x16, x16, #0xf28
    176c:       d61f0220        br      x17
--More--(4%)

3.nm

nm copy

분석결과

                 U abort@@GLIBC_2.17
0000000000014448 B __bss_end__
0000000000014448 B _bss_end__
0000000000014440 B __bss_start
0000000000014440 B __bss_start__
0000000000001898 t call_weak_fn
                 U close@@GLIBC_2.17
0000000000002220 T cmdLineErr
0000000000014440 b completed.9189
                 w __cxa_finalize@@GLIBC_2.17
0000000000014000 D __data_start
0000000000014000 W data_start
00000000000018b0 t deregister_tm_clones
0000000000001920 t __do_global_dtors_aux
0000000000013ce0 d __do_global_dtors_aux_fini_array_entry
0000000000014008 D __dso_handle
0000000000013ce8 a _DYNAMIC
0000000000014440 D _edata
0000000000014010 d ename
0000000000014448 B __end__
0000000000014448 B _end
0000000000001ed0 T err_exit
0000000000001e08 T errExit
0000000000001f98 T errExitEN
0000000000001d00 T errMsg
                 U __errno_location@@GLIBC_2.17
                 U _exit@@GLIBC_2.17
                 U exit@@GLIBC_2.17
0000000000002058 T fatal
                 U fflush@@GLIBC_2.17
00000000000023ac T _fini
                 U fputs@@GLIBC_2.17
0000000000001968 t frame_dummy
0000000000013cd8 d __frame_dummy_init_array_entry
0000000000002ce8 r __FRAME_END__
                 U fwrite@@GLIBC_2.17
                 U getenv@@GLIBC_2.17
0000000000013fa8 a _GLOBAL_OFFSET_TABLE_
                 w __gmon_start__
0000000000002a74 r __GNU_EH_FRAME_HDR
00000000000016d8 t _init
0000000000013ce0 d __init_array_end
0000000000013cd8 d __init_array_start
00000000000023c0 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
00000000000023a8 T __libc_csu_fini
0000000000002328 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.17
000000000000196c T main
                 U open@@GLIBC_2.17
0000000000001b78 t outputError
                 U read@@GLIBC_2.17
00000000000018e0 t register_tm_clones
                 U snprintf@@GLIBC_2.17
                 U __stack_chk_fail@@GLIBC_2.17
                 U __stack_chk_guard@@GLIBC_2.17
0000000000001860 T _start
                 U stderr@@GLIBC_2.17
                 U stdout@@GLIBC_2.17
                 U strcmp@@GLIBC_2.17
                 U strerror@@GLIBC_2.17
0000000000001b20 t terminate
0000000000014440 D __TMC_END__
0000000000002118 T usageErr
                 U vfprintf@@GLIBC_2.17
                 U vsnprintf@@GLIBC_2.17
                 U write@@GLIBC_2.17

4. TOY 프로젝트 Makefile 작성 실습

1. lab2_makefile 디렉토리 구조

2. Makefile 코드

TARGET = toy_system

SYSTEM = ./system
UI = ./ui
WEB_SERVER = ./web_server

INCLUDES = -I$(SYSTEM) -I$(UI) -I$(WEB_SERVER)

CC = gcc

objects = main.o system_server.o web_server.o input.o gui.o

.PHONY: clean

$(TARGET): $(objects)
	$(CC) -o $(TARGET) $(objects)

main.o:  main.c
	$(CC) -g $(INCLUDES) -c main.c

system_server.o: $(SYSTEM)/system_server.h $(SYSTEM)/system_server.c
	$(CC) -g $(INCLUDES) -c ./system/system_server.c

gui.o: $(UI)/gui.h $(UI)/gui.c
	$(CC) -g $(INCLUDES) -c $(UI)/gui.c

input.o: $(UI)/input.h $(UI)/input.c
	$(CC) -g $(INCLUDES) -c $(UI)/input.c

web_server.o: $(WEB_SERVER)/web_server.h $(WEB_SERVER)/web_server.c
	$(CC) -g $(INCLUDES) -c $(WEB_SERVER)/web_server.c

clean:
	rm -rf *.o
	rm -rf $(TARGET)

3. 실행 결과

profile
Dev Ops, "Git, Linux, Docker, Kubernetes, ansible, " .

0개의 댓글