검색해보니 readelf가 조금 더 분석에 강력하다고 한다.
#include <stdio.h> void main() { unsigned char b = 0xF1; unsigned short c = 0xF1; unsigned int d = 0xF1; printf("%X\n",b); printf("%X\n",c); printf("%X\n",d); }
위의 소스를 분석한 내용이다. 내용이 많으므로 눌러서 보기바람.
$ gcc -S test.c
$ more test.s
.file "test.c"
.section .rodata
.LC0:
.string "%X\n"
.text
.globl main
.type main, @function
main:
leal 4(%esp), %ecx
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
pushl %ecx
subl $36, %esp
movb $-15, -11(%ebp)
movw $241, -10(%ebp)
movl $241, -8(%ebp)
movzbl -11(%ebp), %eax
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call printf
movzwl -10(%ebp), %eax
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call printf
movl -8(%ebp), %eax
movl %eax, 4(%esp)
movl $.LC0, (%esp)
call printf
addl $36, %esp
popl %ecx
popl %ebp
leal -4(%ecx), %esp
ret
.size main, .-main
.ident "GCC: (GNU) 4.1.2 20070626 (Red Hat 4.1.2-13)"
.section .note.GNU-stack,"",@progbits
$ gcc -Wl,-Map -Wl,test.map test.c
$ more test.map
Archive member included because of file (symbol)
/usr/lib/libc_nonshared.a(elf-init.oS)
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o (__libc_csu_fini)
Discarded input sections
.note.GNU-stack
0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.note.GNU-stack
0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
.note.GNU-stack
0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
.note.GNU-stack
0x00000000 0x0 /tmp/ccEFLwle.o
__i686.get_pc_thunk.bx
0x00000000 0x0 /usr/lib/libc_nonshared.a(elf-init.oS)
.note.GNU-stack
0x00000000 0x0 /usr/lib/libc_nonshared.a(elf-init.oS)
.note.GNU-stack
0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.note.GNU-stack
0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
Memory Configuration
Name Origin Length Attributes
*default* 0x00000000 0xffffffff
Linker script and memory map
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
LOAD /tmp/ccEFLwle.o
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/libgcc.a
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/libgcc_s.so
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libc.so
START GROUP
LOAD /lib/libc.so.6
LOAD /usr/lib/libc_nonshared.a
LOAD /lib/ld-linux.so.2
END GROUP
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/libgcc.a
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/libgcc_s.so
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
LOAD /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
0x08048000 PROVIDE (__executable_start, 0x8048000)
0x08048114 . = (0x8048000 + SIZEOF_HEADERS)
.interp 0x08048114 0x13
*(.interp)
.interp 0x08048114 0x13 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.note.ABI-tag 0x08048128 0x20
.note.ABI-tag 0x08048128 0x20 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.hash
*(.hash)
.gnu.hash 0x08048148 0x20
*(.gnu.hash)
.gnu.hash 0x08048148 0x20 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.dynsym 0x08048168 0x50
*(.dynsym)
.dynsym 0x08048168 0x50 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.dynstr 0x080481b8 0x4c
*(.dynstr)
.dynstr 0x080481b8 0x4c /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.gnu.version 0x08048204 0xa
*(.gnu.version)
.gnu.version 0x08048204 0xa /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.gnu.version_d 0x08048210 0x0
*(.gnu.version_d)
.gnu.version_d
0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.gnu.version_r 0x08048210 0x20
*(.gnu.version_r)
.gnu.version_r
0x08048210 0x20 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.rel.dyn 0x08048230 0x8
*(.rel.init)
*(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
.rel.text 0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
*(.rel.fini)
*(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
*(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
*(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
*(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
*(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
*(.rel.ctors)
*(.rel.dtors)
*(.rel.got)
.rel.got 0x08048230 0x8 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
*(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
.rel.bss 0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.rela.dyn
*(.rela.init)
*(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
*(.rela.fini)
*(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
*(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
*(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
*(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
*(.rela.ctors)
*(.rela.dtors)
*(.rela.got)
*(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
.rel.plt 0x08048238 0x18
*(.rel.plt)
.rel.plt 0x08048238 0x18 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.rela.plt
*(.rela.plt)
.init 0x08048250 0x17
*(.init)
.init 0x08048250 0xb /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
0x08048250 _init
.init 0x0804825b 0x5 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
.init 0x08048260 0x5 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.init 0x08048265 0x2 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
.plt 0x08048268 0x40
*(.plt)
.plt 0x08048268 0x40 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x08048288 __libc_start_main@@GLIBC_2.0
0x08048298 printf@@GLIBC_2.0
.text 0x080482b0 0x1e8
*(.text .stub .text.* .gnu.linkonce.t.*)
.text 0x080482b0 0x24 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080482b0 _start
.text 0x080482d4 0x26 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
*fill* 0x080482fa 0x6 90909090
.text 0x08048300 0x83 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
*fill* 0x08048383 0x1 90909090
.text 0x08048384 0x66 /tmp/ccEFLwle.o
0x08048384 main
*fill* 0x080483ea 0x6 90909090
.text 0x080483f0 0x79 /usr/lib/libc_nonshared.a(elf-init.oS)
0x080483f0 __libc_csu_fini
0x08048400 __libc_csu_init
.text.__i686.get_pc_thunk.bx
0x08048469 0x4 /usr/lib/libc_nonshared.a(elf-init.oS)
0x08048469 __i686.get_pc_thunk.bx
*fill* 0x0804846d 0x3 90909090
.text 0x08048470 0x28 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.text 0x08048498 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
*(.text.*personality*)
*(.gnu.warning)
.fini 0x08048498 0x1c
*(.fini)
.fini 0x08048498 0x13 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
0x08048498 _fini
.fini 0x080484ab 0x5 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
.fini 0x080484b0 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
0x080484b4 PROVIDE (__etext, .)
0x080484b4 PROVIDE (_etext, .)
0x080484b4 PROVIDE (etext, .)
.rodata 0x080484b4 0x10
*(.rodata .rodata.* .gnu.linkonce.r.*)
.rodata 0x080484b4 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080484b4 _fp_hw
.rodata.cst4 0x080484b8 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080484b8 _IO_stdin_used
.rodata 0x080484bc 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
0x080484bc __dso_handle
.rodata 0x080484c0 0x4 /tmp/ccEFLwle.o
.rodata1
*(.rodata1)
.eh_frame_hdr 0x080484c4 0x0
*(.eh_frame_hdr)
.eh_frame_hdr 0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.eh_frame 0x080484c4 0x4
*(.eh_frame)
.eh_frame 0x080484c4 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
0x080484c8 . = (ALIGN (0x1000) - ((0x1000 - .) & 0xfff))
0x080494c8 . = (0x1000 DATA_SEGMENT_ALIGN 0x1000)
.eh_frame
*(.eh_frame)
.gcc_except_table
*(.gcc_except_table .gcc_except_table.*)
.tdata
*(.tdata .tdata.* .gnu.linkonce.td.*)
.tbss
*(.tbss .tbss.* .gnu.linkonce.tb.*)
*(.tcommon)
.preinit_array 0x080494c8 0x0
0x080494c8 PROVIDE (__preinit_array_start, .)
*(.preinit_array)
0x080494c8 PROVIDE (__preinit_array_end, .)
.init_array 0x080494c8 0x0
0x080494c8 PROVIDE (__init_array_start, .)
*(SORT(.init_array.*))
*(.init_array)
0x080494c8 PROVIDE (__init_array_end, .)
.fini_array 0x080494c8 0x0
0x080494c8 PROVIDE (__fini_array_start, .)
*(.fini_array)
*(SORT(.fini_array.*))
0x080494c8 PROVIDE (__fini_array_end, .)
.ctors 0x080494c8 0x8
*crtbegin.o(.ctors)
.ctors 0x080494c8 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
.ctors 0x080494cc 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.dtors 0x080494d0 0x8
*crtbegin.o(.dtors)
.dtors 0x080494d0 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
.dtors 0x080494d4 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
0x080494d4 __DTOR_END__
.jcr 0x080494d8 0x4
*(.jcr)
.jcr 0x080494d8 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
.jcr 0x080494d8 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.data.rel.ro
*(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
*(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
.dynamic 0x080494dc 0xc8
*(.dynamic)
.dynamic 0x080494dc 0xc8 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080494dc _DYNAMIC
.got 0x080495a4 0x4
*(.got)
.got 0x080495a4 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080495a8 . = (. DATA_SEGMENT_RELRO_END 0xc)
.got.plt 0x080495a8 0x18
*(.got.plt)
.got.plt 0x080495a8 0x18 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080495a8 _GLOBAL_OFFSET_TABLE_
.data 0x080495c0 0x4
*(.data .data.* .gnu.linkonce.d.*)
.data 0x080495c0 0x4 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
0x080495c0 data_start
0x080495c0 __data_start
.data 0x080495c4 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
.data 0x080495c4 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
.data 0x080495c4 0x0 /tmp/ccEFLwle.o
.data 0x080495c4 0x0 /usr/lib/libc_nonshared.a(elf-init.oS)
.data 0x080495c4 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.data 0x080495c4 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
*(.gnu.linkonce.d.*personality*)
.data1
*(.data1)
0x080495c4 _edata = .
0x080495c4 PROVIDE (edata, .)
0x080495c4 __bss_start = .
.bss 0x080495c4 0x8
*(.dynbss)
.dynbss 0x00000000 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
*(.bss .bss.* .gnu.linkonce.b.*)
.bss 0x080495c4 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.bss 0x080495c4 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
.bss 0x080495c4 0x5 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
*fill* 0x080495c9 0x3 00
.bss 0x080495cc 0x0 /tmp/ccEFLwle.o
.bss 0x080495cc 0x0 /usr/lib/libc_nonshared.a(elf-init.oS)
.bss 0x080495cc 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.bss 0x080495cc 0x0 /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
*(COMMON)
0x080495cc . = ALIGN ((. != 0x0)?0x4:0x1)
0x080495cc . = ALIGN (0x4)
0x080495cc . = ALIGN (0x4)
0x080495cc _end = .
0x080495cc PROVIDE (end, .)
0x080495cc . = DATA_SEGMENT_END (.)
.stab
*(.stab)
.stabstr
*(.stabstr)
.stab.excl
*(.stab.excl)
.stab.exclstr
*(.stab.exclstr)
.stab.index
*(.stab.index)
.stab.indexstr
*(.stab.indexstr)
.comment 0x00000000 0x114
*(.comment)
.comment 0x00000000 0x2e /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o
.comment 0x0000002e 0x2e /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o
.comment 0x0000005c 0x2e /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o
.comment 0x0000008a 0x2e /tmp/ccEFLwle.o
.comment 0x000000b8 0x2e /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o
.comment 0x000000e6 0x2e /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crtn.o
.debug
*(.debug)
.line
*(.line)
.debug_srcinfo
*(.debug_srcinfo)
.debug_sfnames
*(.debug_sfnames)
.debug_aranges
*(.debug_aranges)
.debug_pubnames
*(.debug_pubnames)
.debug_info
*(.debug_info .gnu.linkonce.wi.*)
.debug_abbrev
*(.debug_abbrev)
.debug_line
*(.debug_line)
.debug_frame
*(.debug_frame)
.debug_str
*(.debug_str)
.debug_loc
*(.debug_loc)
.debug_macinfo
*(.debug_macinfo)
.debug_weaknames
*(.debug_weaknames)
.debug_funcnames
*(.debug_funcnames)
.debug_typenames
*(.debug_typenames)
.debug_varnames
*(.debug_varnames)
.debug_pubtypes
*(.debug_pubtypes)
.debug_ranges
*(.debug_ranges)
/DISCARD/
*(.note.GNU-stack)
OUTPUT(a.out elf32-i386)
$ gcc test.c
$ objdump -x a.out
a.out: file format elf32-i386
a.out
architecture: i386, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x080482b0
Program Header:
PHDR off 0x00000034 vaddr 0x08048034 paddr 0x08048034 align 2**2
filesz 0x000000e0 memsz 0x000000e0 flags r-x
INTERP off 0x00000114 vaddr 0x08048114 paddr 0x08048114 align 2**0
filesz 0x00000013 memsz 0x00000013 flags r--
LOAD off 0x00000000 vaddr 0x08048000 paddr 0x08048000 align 2**12
filesz 0x000004c8 memsz 0x000004c8 flags r-x
LOAD off 0x000004c8 vaddr 0x080494c8 paddr 0x080494c8 align 2**12
filesz 0x000000fc memsz 0x00000104 flags rw-
DYNAMIC off 0x000004dc vaddr 0x080494dc paddr 0x080494dc align 2**2
filesz 0x000000c8 memsz 0x000000c8 flags rw-
NOTE off 0x00000128 vaddr 0x08048128 paddr 0x08048128 align 2**2
filesz 0x00000020 memsz 0x00000020 flags r--
STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
filesz 0x00000000 memsz 0x00000000 flags rw-
Dynamic Section:
NEEDED libc.so.6
INIT 0x8048250
FINI 0x8048498
GNU_HASH 0x8048148
STRTAB 0x80481b8
SYMTAB 0x8048168
STRSZ 0x4c
SYMENT 0x10
DEBUG 0x0
PLTGOT 0x80495a8
PLTRELSZ 0x18
PLTREL 0x11
JMPREL 0x8048238
REL 0x8048230
RELSZ 0x8
RELENT 0x8
VERNEED 0x8048210
VERNEEDNUM 0x1
VERSYM 0x8048204
Version References:
required from libc.so.6:
0x0d696910 0x00 02 GLIBC_2.0
Sections:
Idx Name Size VMA LMA File off Algn
0 .interp 00000013 08048114 08048114 00000114 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .note.ABI-tag 00000020 08048128 08048128 00000128 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .gnu.hash 00000020 08048148 08048148 00000148 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .dynsym 00000050 08048168 08048168 00000168 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .dynstr 0000004c 080481b8 080481b8 000001b8 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .gnu.version 0000000a 08048204 08048204 00000204 2**1
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .gnu.version_r 00000020 08048210 08048210 00000210 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .rel.dyn 00000008 08048230 08048230 00000230 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .rel.plt 00000018 08048238 08048238 00000238 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
9 .init 00000017 08048250 08048250 00000250 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
10 .plt 00000040 08048268 08048268 00000268 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
11 .text 000001e8 080482b0 080482b0 000002b0 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
12 .fini 0000001c 08048498 08048498 00000498 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
13 .rodata 00000010 080484b4 080484b4 000004b4 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
14 .eh_frame 00000004 080484c4 080484c4 000004c4 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
15 .ctors 00000008 080494c8 080494c8 000004c8 2**2
CONTENTS, ALLOC, LOAD, DATA
16 .dtors 00000008 080494d0 080494d0 000004d0 2**2
CONTENTS, ALLOC, LOAD, DATA
17 .jcr 00000004 080494d8 080494d8 000004d8 2**2
CONTENTS, ALLOC, LOAD, DATA
18 .dynamic 000000c8 080494dc 080494dc 000004dc 2**2
CONTENTS, ALLOC, LOAD, DATA
19 .got 00000004 080495a4 080495a4 000005a4 2**2
CONTENTS, ALLOC, LOAD, DATA
20 .got.plt 00000018 080495a8 080495a8 000005a8 2**2
CONTENTS, ALLOC, LOAD, DATA
21 .data 00000004 080495c0 080495c0 000005c0 2**2
CONTENTS, ALLOC, LOAD, DATA
22 .bss 00000008 080495c4 080495c4 000005c4 2**2
ALLOC
23 .comment 00000114 00000000 00000000 000005c4 2**0
CONTENTS, READONLY
SYMBOL TABLE:
08048114 l d .interp 00000000 .interp
08048128 l d .note.ABI-tag 00000000 .note.ABI-tag
08048148 l d .gnu.hash 00000000 .gnu.hash
08048168 l d .dynsym 00000000 .dynsym
080481b8 l d .dynstr 00000000 .dynstr
08048204 l d .gnu.version 00000000 .gnu.version
08048210 l d .gnu.version_r 00000000 .gnu.version_r
08048230 l d .rel.dyn 00000000 .rel.dyn
08048238 l d .rel.plt 00000000 .rel.plt
08048250 l d .init 00000000 .init
08048268 l d .plt 00000000 .plt
080482b0 l d .text 00000000 .text
08048498 l d .fini 00000000 .fini
080484b4 l d .rodata 00000000 .rodata
080484c4 l d .eh_frame 00000000 .eh_frame
080494c8 l d .ctors 00000000 .ctors
080494d0 l d .dtors 00000000 .dtors
080494d8 l d .jcr 00000000 .jcr
080494dc l d .dynamic 00000000 .dynamic
080495a4 l d .got 00000000 .got
080495a8 l d .got.plt 00000000 .got.plt
080495c0 l d .data 00000000 .data
080495c4 l d .bss 00000000 .bss
00000000 l d .comment 00000000 .comment
080482d4 l F .text 00000000 call_gmon_start
00000000 l df *ABS* 00000000 crtstuff.c
080494c8 l O .ctors 00000000 __CTOR_LIST__
080494d0 l O .dtors 00000000 __DTOR_LIST__
080494d8 l O .jcr 00000000 __JCR_LIST__
080495c4 l O .bss 00000004 dtor_idx.5768
080495c8 l O .bss 00000001 completed.5766
08048300 l F .text 00000000 __do_global_dtors_aux
08048360 l F .text 00000000 frame_dummy
00000000 l df *ABS* 00000000 crtstuff.c
080494cc l O .ctors 00000000 __CTOR_END__
080484c4 l O .eh_frame 00000000 __FRAME_END__
080494d8 l O .jcr 00000000 __JCR_END__
08048470 l F .text 00000000 __do_global_ctors_aux
00000000 l df *ABS* 00000000 test.c
080494c8 l .ctors 00000000 .hidden __preinit_array_start
080494c8 l .ctors 00000000 .hidden __fini_array_end
080495a8 l O .got.plt 00000000 .hidden _GLOBAL_OFFSET_TABLE_
080494c8 l .ctors 00000000 .hidden __preinit_array_end
080494c8 l .ctors 00000000 .hidden __fini_array_start
080494c8 l .ctors 00000000 .hidden __init_array_end
080494c8 l .ctors 00000000 .hidden __init_array_start
080494dc l O .dynamic 00000000 .hidden _DYNAMIC
080495c0 w .data 00000000 data_start
080483f0 g F .text 00000005 __libc_csu_fini
080482b0 g F .text 00000000 _start
00000000 w *UND* 00000000 __gmon_start__
00000000 w *UND* 00000000 _Jv_RegisterClasses
080484b4 g O .rodata 00000004 _fp_hw
08048498 g F .fini 00000000 _fini
00000000 F *UND* 0000019f __libc_start_main@@GLIBC_2.0
080484b8 g O .rodata 00000004 _IO_stdin_used
080495c0 g .data 00000000 __data_start
080484bc g O .rodata 00000000 .hidden __dso_handle
080494d4 g O .dtors 00000000 .hidden __DTOR_END__
08048400 g F .text 00000069 __libc_csu_init
00000000 F *UND* 00000039 printf@@GLIBC_2.0
080495c4 g *ABS* 00000000 __bss_start
080495cc g *ABS* 00000000 _end
080495c4 g *ABS* 00000000 _edata
08048469 g F .text 00000000 .hidden __i686.get_pc_thunk.bx
08048384 g F .text 00000066 main
08048250 g F .init 00000000 _init
$ readelf -a a.out
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x80482b0
Start of program headers: 52 (bytes into file)
Start of section headers: 1972 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 28
Section header string table index: 25
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 08048114 000114 000013 00 A 0 0 1
[ 2] .note.ABI-tag NOTE 08048128 000128 000020 00 A 0 0 4
[ 3] .gnu.hash GNU_HASH 08048148 000148 000020 04 A 4 0 4
[ 4] .dynsym DYNSYM 08048168 000168 000050 10 A 5 1 4
[ 5] .dynstr STRTAB 080481b8 0001b8 00004c 00 A 0 0 1
[ 6] .gnu.version VERSYM 08048204 000204 00000a 02 A 4 0 2
[ 7] .gnu.version_r VERNEED 08048210 000210 000020 00 A 5 1 4
[ 8] .rel.dyn REL 08048230 000230 000008 08 A 4 0 4
[ 9] .rel.plt REL 08048238 000238 000018 08 A 4 11 4
[10] .init PROGBITS 08048250 000250 000017 00 AX 0 0 4
[11] .plt PROGBITS 08048268 000268 000040 04 AX 0 0 4
[12] .text PROGBITS 080482b0 0002b0 0001e8 00 AX 0 0 16
[13] .fini PROGBITS 08048498 000498 00001c 00 AX 0 0 4
[14] .rodata PROGBITS 080484b4 0004b4 000010 00 A 0 0 4
[15] .eh_frame PROGBITS 080484c4 0004c4 000004 00 A 0 0 4
[16] .ctors PROGBITS 080494c8 0004c8 000008 00 WA 0 0 4
[17] .dtors PROGBITS 080494d0 0004d0 000008 00 WA 0 0 4
[18] .jcr PROGBITS 080494d8 0004d8 000004 00 WA 0 0 4
[19] .dynamic DYNAMIC 080494dc 0004dc 0000c8 08 WA 5 0 4
[20] .got PROGBITS 080495a4 0005a4 000004 04 WA 0 0 4
[21] .got.plt PROGBITS 080495a8 0005a8 000018 04 WA 0 0 4
[22] .data PROGBITS 080495c0 0005c0 000004 00 WA 0 0 4
[23] .bss NOBITS 080495c4 0005c4 000008 00 WA 0 0 4
[24] .comment PROGBITS 00000000 0005c4 000114 00 0 0 1
[25] .shstrtab STRTAB 00000000 0006d8 0000db 00 0 0 1
[26] .symtab SYMTAB 00000000 000c14 000440 10 27 48 4
[27] .strtab STRTAB 00000000 001054 00025a 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
There are no section groups in this file.
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
INTERP 0x000114 0x08048114 0x08048114 0x00013 0x00013 R 0x1
[Requesting program interpreter: /lib/ld-linux.so.2]
LOAD 0x000000 0x08048000 0x08048000 0x004c8 0x004c8 R E 0x1000
LOAD 0x0004c8 0x080494c8 0x080494c8 0x000fc 0x00104 RW 0x1000
DYNAMIC 0x0004dc 0x080494dc 0x080494dc 0x000c8 0x000c8 RW 0x4
NOTE 0x000128 0x08048128 0x08048128 0x00020 0x00020 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
04 .dynamic
05 .note.ABI-tag
06
Dynamic section at offset 0x4dc contains 20 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x0000000c (INIT) 0x8048250
0x0000000d (FINI) 0x8048498
0x6ffffef5 (GNU_HASH) 0x8048148
0x00000005 (STRTAB) 0x80481b8
0x00000006 (SYMTAB) 0x8048168
0x0000000a (STRSZ) 76 (bytes)
0x0000000b (SYMENT) 16 (bytes)
0x00000015 (DEBUG) 0x0
0x00000003 (PLTGOT) 0x80495a8
0x00000002 (PLTRELSZ) 24 (bytes)
0x00000014 (PLTREL) REL
0x00000017 (JMPREL) 0x8048238
0x00000011 (REL) 0x8048230
0x00000012 (RELSZ) 8 (bytes)
0x00000013 (RELENT) 8 (bytes)
0x6ffffffe (VERNEED) 0x8048210
0x6fffffff (VERNEEDNUM) 1
0x6ffffff0 (VERSYM) 0x8048204
0x00000000 (NULL) 0x0
Relocation section '.rel.dyn' at offset 0x230 contains 1 entries:
Offset Info Type Sym.Value Sym. Name
080495a4 00000106 R_386_GLOB_DAT 00000000 __gmon_start__
Relocation section '.rel.plt' at offset 0x238 contains 3 entries:
Offset Info Type Sym.Value Sym. Name
080495b4 00000107 R_386_JUMP_SLOT 00000000 __gmon_start__
080495b8 00000207 R_386_JUMP_SLOT 00000000 __libc_start_main
080495bc 00000307 R_386_JUMP_SLOT 00000000 printf
There are no unwind sections in this file.
Symbol table '.dynsym' contains 5 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
2: 00000000 415 FUNC GLOBAL DEFAULT UND __libc_start_main@GLIBC_2.0 (2)
3: 00000000 57 FUNC GLOBAL DEFAULT UND printf@GLIBC_2.0 (2)
4: 080484b8 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
Symbol table '.symtab' contains 68 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 08048114 0 SECTION LOCAL DEFAULT 1
2: 08048128 0 SECTION LOCAL DEFAULT 2
3: 08048148 0 SECTION LOCAL DEFAULT 3
4: 08048168 0 SECTION LOCAL DEFAULT 4
5: 080481b8 0 SECTION LOCAL DEFAULT 5
6: 08048204 0 SECTION LOCAL DEFAULT 6
7: 08048210 0 SECTION LOCAL DEFAULT 7
8: 08048230 0 SECTION LOCAL DEFAULT 8
9: 08048238 0 SECTION LOCAL DEFAULT 9
10: 08048250 0 SECTION LOCAL DEFAULT 10
11: 08048268 0 SECTION LOCAL DEFAULT 11
12: 080482b0 0 SECTION LOCAL DEFAULT 12
13: 08048498 0 SECTION LOCAL DEFAULT 13
14: 080484b4 0 SECTION LOCAL DEFAULT 14
15: 080484c4 0 SECTION LOCAL DEFAULT 15
16: 080494c8 0 SECTION LOCAL DEFAULT 16
17: 080494d0 0 SECTION LOCAL DEFAULT 17
18: 080494d8 0 SECTION LOCAL DEFAULT 18
19: 080494dc 0 SECTION LOCAL DEFAULT 19
20: 080495a4 0 SECTION LOCAL DEFAULT 20
21: 080495a8 0 SECTION LOCAL DEFAULT 21
22: 080495c0 0 SECTION LOCAL DEFAULT 22
23: 080495c4 0 SECTION LOCAL DEFAULT 23
24: 00000000 0 SECTION LOCAL DEFAULT 24
25: 080482d4 0 FUNC LOCAL DEFAULT 12 call_gmon_start
26: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
27: 080494c8 0 OBJECT LOCAL DEFAULT 16 __CTOR_LIST__
28: 080494d0 0 OBJECT LOCAL DEFAULT 17 __DTOR_LIST__
29: 080494d8 0 OBJECT LOCAL DEFAULT 18 __JCR_LIST__
30: 080495c4 4 OBJECT LOCAL DEFAULT 23 dtor_idx.5768
31: 080495c8 1 OBJECT LOCAL DEFAULT 23 completed.5766
32: 08048300 0 FUNC LOCAL DEFAULT 12 __do_global_dtors_aux
33: 08048360 0 FUNC LOCAL DEFAULT 12 frame_dummy
34: 00000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
35: 080494cc 0 OBJECT LOCAL DEFAULT 16 __CTOR_END__
36: 080484c4 0 OBJECT LOCAL DEFAULT 15 __FRAME_END__
37: 080494d8 0 OBJECT LOCAL DEFAULT 18 __JCR_END__
38: 08048470 0 FUNC LOCAL DEFAULT 12 __do_global_ctors_aux
39: 00000000 0 FILE LOCAL DEFAULT ABS test.c
40: 080494c8 0 NOTYPE LOCAL HIDDEN 16 __preinit_array_start
41: 080494c8 0 NOTYPE LOCAL HIDDEN 16 __fini_array_end
42: 080495a8 0 OBJECT LOCAL HIDDEN 21 _GLOBAL_OFFSET_TABLE_
43: 080494c8 0 NOTYPE LOCAL HIDDEN 16 __preinit_array_end
44: 080494c8 0 NOTYPE LOCAL HIDDEN 16 __fini_array_start
45: 080494c8 0 NOTYPE LOCAL HIDDEN 16 __init_array_end
46: 080494c8 0 NOTYPE LOCAL HIDDEN 16 __init_array_start
47: 080494dc 0 OBJECT LOCAL HIDDEN 19 _DYNAMIC
48: 080495c0 0 NOTYPE WEAK DEFAULT 22 data_start
49: 080483f0 5 FUNC GLOBAL DEFAULT 12 __libc_csu_fini
50: 080482b0 0 FUNC GLOBAL DEFAULT 12 _start
51: 00000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
52: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses
53: 080484b4 4 OBJECT GLOBAL DEFAULT 14 _fp_hw
54: 08048498 0 FUNC GLOBAL DEFAULT 13 _fini
55: 00000000 415 FUNC GLOBAL DEFAULT UND __libc_start_main@@GLIBC_
56: 080484b8 4 OBJECT GLOBAL DEFAULT 14 _IO_stdin_used
57: 080495c0 0 NOTYPE GLOBAL DEFAULT 22 __data_start
58: 080484bc 0 OBJECT GLOBAL HIDDEN 14 __dso_handle
59: 080494d4 0 OBJECT GLOBAL HIDDEN 17 __DTOR_END__
60: 08048400 105 FUNC GLOBAL DEFAULT 12 __libc_csu_init
61: 00000000 57 FUNC GLOBAL DEFAULT UND printf@@GLIBC_2.0
62: 080495c4 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
63: 080495cc 0 NOTYPE GLOBAL DEFAULT ABS _end
64: 080495c4 0 NOTYPE GLOBAL DEFAULT ABS _edata
65: 08048469 0 FUNC GLOBAL HIDDEN 12 __i686.get_pc_thunk.bx
66: 08048384 102 FUNC GLOBAL DEFAULT 12 main
67: 08048250 0 FUNC GLOBAL DEFAULT 10 _init
Histogram for `.gnu.hash' bucket list length (total of 2 buckets):
Length Number % of total Coverage
0 1 ( 50.0%)
1 1 ( 50.0%) 100.0%
Version symbols section '.gnu.version' contains 5 entries:
Addr: 0000000008048204 Offset: 0x000204 Link: 4 (.dynsym)
000: 0 (*local*) 0 (*local*) 2 (GLIBC_2.0) 2 (GLIBC_2.0)
004: 1 (*global*)
Version needs section '.gnu.version_r' contains 1 entries:
Addr: 0x0000000008048210 Offset: 0x000210 Link to section: 5 (.dynstr)
000000: Version: 1 File: libc.so.6 Cnt: 1
0x0010: Name: GLIBC_2.0 Flags: none Version: 2
Notes at offset 0x00000128 with length 0x00000020:
Owner Data size Description
GNU 0x00000010 NT_VERSION (version)
$ ldd a.out
linux-gate.so.1 => (0x00110000)
libc.so.6 => /lib/libc.so.6 (0x001b9000)
/lib/ld-linux.so.2 (0x0019c000)
솔찍히 머가 먼지 모르겠다.
덧 : 생각해보니 이것저것 생각나는거 다 붙이다 보니 제목이 안 맞네 ㄱ- 바꿔야 하나?
'Linux' 카테고리의 다른 글
rdate - get the time via the network (0) | 2009.03.02 |
---|---|
Visuel Hexdiff - console based visual hex diff (4) | 2009.02.24 |
ln의 반대말은? - unlink (0) | 2009.02.23 |
sleep 함수들 (0) | 2009.02.22 |
ls 와 친해지기 - 디렉토리만 봅시다! (0) | 2009.02.22 |