test2.c
#include <stdio.h>
int main(int arg, char *argv[]){
printf("hello\n");
}
--Il existe de nombreuses définitions de fonctions standard dans stdio.h
stdio.h
à partir de la source de la glibc se bloque 3/ usr / lib / x86_64-linux-gnu /
--Si vous vérifiez avec readelf, il y a printf.o
--Si vous recherchez printf.c, il y a diverses choses comme ça sous le répertoire stdio-common sous le source glibc.
--Si vous regardez dans printf.c, vous pouvez voir qu'il appelle vfprintf
. (Terminez ici)command
ubuntu# ls /usr/include | grep stdio
stdio.h
stdio_ext.h
/usr/include/stdio.h
/* Define ISO C stdio on top of C++ iostreams.
Copyright (C) 1991-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
command
ubuntu# find . -name "stdio.h"
./include/stdio.h
./libio/stdio.h
./libio/bits/stdio.h
commmand
ubuntu# readelf -a /usr/lib/x86_64-linux-gnu/libc.a | grep printf | grep -v "[a-z_]printf"
9: 0000000000000480 9125 FUNC LOCAL DEFAULT 1 printf_positional
Fichier: libc.a(printf_fp.o)
Fichier: libc.a(reg-printf.o)
Fichier: libc.a(printf-prs.o)
Fichier: libc.a(printf_fphex.o)
Fichier: libc.a(printf_size.o)
28: 0000000000000000 2223 FUNC GLOBAL DEFAULT 1 printf_size
29: 00000000000008b0 31 FUNC GLOBAL DEFAULT 1 printf_size_info
Fichier: libc.a(printf.o)
11: 0000000000000000 158 FUNC GLOBAL DEFAULT 1 printf
10: 0000000000000370 10733 FUNC LOCAL DEFAULT 1 printf_positional
Fichier: libc.a(printf-parsemb.o)
Fichier: libc.a(printf-parsewc.o)
Fichier: libc.a(printf_chk.o)
command
# find . -name "*printf.c" | grep comm
./stdio-common/fprintf.c
./stdio-common/asprintf.c
./stdio-common/printf.c
./stdio-common/reg-printf.c
./stdio-common/tst-obprintf.c
./stdio-common/tst-swprintf.c
./stdio-common/tst-wc-printf.c
./stdio-common/fxprintf.c
./stdio-common/vprintf.c
./stdio-common/vfwprintf.c
./stdio-common/dprintf.c
./stdio-common/vfprintf.c
./stdio-common/test-vfprintf.c
./stdio-common/sprintf.c
./stdio-common/tst-printf.c
./stdio-common/tst-sprintf.c
./stdio-common/snprintf.c
stdio-common/printf.c(Extrait)
/* Write formatted output to stdout from the format string FORMAT. */
/* VARARGS1 */
int
__printf (const char *format, ...)
{
va_list arg;
int done;
va_start (arg, format);
done = vfprintf (stdout, format, arg);
va_end (arg);
return done;
}