sysdeps/unix/ 의 Makefile 과 make-syscalls.sh, 그리고 syscalls.list 를 참조해보면,
open.c 나 open.S 가 없으니 Makefile 에서 호출된 make-syscall.sh 에 의해 동적으로 만들어진 소스코드가 GCC 의 입력으로 들어가서 open.o 라는 오브젝트가 만들어지겠습니다.
코드 베이스는 같은 디렉토리의 syscall-template.S 겠고,
__libc_open 이라는 strong symbol 과 __open 그리고 open 이라는 weak symbol 두 개가 들어가지 싶습니다.
아래는 fedora 에서 본 겁니다.
[schoi0@sel-schoi0-d2 simple_root]$ readelf -s /usr/lib64/libc.so.6 | grep " open$\| __open$\| __libc_open$"
3953: 00000000000e6450 90 FUNC LOCAL DEFAULT 12 __libc_open
6103: 00000000000e6450 90 FUNC WEAK DEFAULT 12 open
7135: 00000000000e6450 90 FUNC WEAK DEFAULT 12 __open
[schoi0@sel-schoi0-d2 simple_root]$ gdb /usr/lib64/libc.so.6
GNU gdb (GDB) Fedora 7.7.1-21.fc20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib64/libc.so.6...Reading symbols from /usr/lib/debug/lib64/libc-2.18.so.debug...done.
done.
(gdb) l open
76 #else
77
78 /* This is a "normal" system call stub: if there is an error,
79 it returns -1 and sets errno. */
80
81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
82 ret
83 T_PSEUDO_END (SYSCALL_SYMBOL)
84
85 #endif
https://sourceware.org/git/?p
https://sourceware.org/git/?p=glibc.git
sysdeps/unix/ 의 Makefile 과 make-syscalls.sh, 그리고 syscalls.list 를 참조해보면,
open.c 나 open.S 가 없으니 Makefile 에서 호출된 make-syscall.sh 에 의해 동적으로 만들어진 소스코드가 GCC 의 입력으로 들어가서 open.o 라는 오브젝트가 만들어지겠습니다.
코드 베이스는 같은 디렉토리의 syscall-template.S 겠고,
__libc_open 이라는 strong symbol 과 __open 그리고 open 이라는 weak symbol 두 개가 들어가지 싶습니다.
아래는 fedora 에서 본 겁니다.
댓글 달기