우분투에서 파일이 있음에도 실행이 안됩니다.

ha3k1e의 이미지

우분투 초보라서 잘 모르겠습니다.. 도움 부탁드립니다.

@ubuntu:~/rever$ ll
-rw-rw-r--  1 hkkim hkkim  164 Oct 22 06:26 hello.asm

이 상태에서, 어셈으로 코딩한 것을 실행 파일로 만들려고 합니다.
nasm -felf64 hello.asm && ld -I/lib/ld-linux.so.2 -lc --entry main hello.o

실행 결과 생긴 파일은,
@ubuntu:~/rever$ ll
-rwxrwxr-x  1 hkkim hkkim 2872 Oct 22 06:47 a.out*
-rw-rw-r--  1 hkkim hkkim  164 Oct 22 06:26 hello.asm
-rw-rw-r--  1 hkkim hkkim  880 Oct 22 06:47 hello.o

여기서 a.out 뒤에 *이 붙는 것은 무슨 의미인가요..?
@ubuntu:~/rever$ ./a.out 
bash: ./a.out: No such file or directory

실행 시킬려고하면 이렇게 파일이 없다고 뜹니다.

그런데, objdump를 쓰면 또 읽힙니다..

@ubuntu:~/rever$ objdump -d a.out 
 
a.out:     file format elf64-x86-64
 
 
Disassembly of section .plt:
 
0000000000400220 <printf@plt-0x10>:
  400220:	ff 35 7a 01 20 00    	pushq  0x20017a(%rip)        # 6003a0 <_GLOBAL_OFFSET_TABLE_+0x8>
  400226:	ff 25 7c 01 20 00    	jmpq   *0x20017c(%rip)        # 6003a8 <_GLOBAL_OFFSET_TABLE_+0x10>
  40022c:	0f 1f 40 00          	nopl   0x0(%rax)
 
0000000000400230 <printf@plt>:
  400230:	ff 25 7a 01 20 00    	jmpq   *0x20017a(%rip)        # 6003b0 <_GLOBAL_OFFSET_TABLE_+0x18>
  400236:	68 00 00 00 00       	pushq  $0x0
  40023b:	e9 e0 ff ff ff       	jmpq   400220 <printf@plt-0x10>
 
Disassembly of section .text:
 
0000000000400240 <main>:
  400240:	68 b8 03 60 00       	pushq  $0x6003b8
  400245:	e8 e6 ff ff ff       	callq  400230 <printf@plt>
  40024a:	b8 01 00 00 00       	mov    $0x1,%eax
  40024f:	bb 00 00 00 00       	mov    $0x0,%ebx
  400254:	cd 80                	int    $0x80

김정균의 이미지

일단 file 뒤에 asterik가 붙는 것은

https://superuser.com/questions/178786/what-does-the-asterisk-mean-after-a-filename-when-you-type-ls-l

참고 하시면 됩니다. 쉽게 실행 파일임을 표시해 준다고 보시면 됩니다.

그리고, 증상은 실행만 안되는 것 같은데.. 혹시 마운트 옵션에 noexec 가 있지 않은지 확인해 보세요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.