【 声明:版权所有,欢迎转载,请勿用于商业用途。 联系信箱:feixiaoxing @163.com】

学过编译原理的朋友都知道,为了让编译器可以生成多种cpu后端代码,在这之前一般先将语法树翻译成中间语言。中间语言的概念大家应该不陌生。只是很多人虽然听说过中间语言,但是却未必看过编译器生成的中间语言是什么样子的。恰好,gcc编译器提供了这样的功能。只要我们编译的时候加上-fdump-tree-all就可以看到中间语言是什么样的了。

1、假设有一段简单的递归函数代码,

#include <stdio.h>int iterate(int data)
{if(1 == data) return 1;return iterate(data-1) + data;
}int main(int argc, char* argv[])
{printf("%d\n", iterate(10));return 0;
}

2、接着我们在编译的过程中添加-fdump-tree-all选项

shell> gcc -fdump-tree-all hello.c

3、等到命令结束后,在文件夹下面可以看到生成了很多的文件,

shell> ls hello.c*
hello.c                  hello.c.025t.fixup_cfg3
hello.c.001t.tu          hello.c.026t.inline_param1
hello.c.002t.class       hello.c.027t.einline
hello.c.003t.original    hello.c.042t.profile_estimate
hello.c.004t.gimple      hello.c.045t.release_ssa
hello.c.006t.omplower    hello.c.046t.inline_param2
hello.c.007t.lower       hello.c.068t.fixup_cfg4
hello.c.010t.eh          hello.c.183t.veclower
hello.c.011t.cfg         hello.c.184t.cplxlower0
hello.c.012t.ompexp      hello.c.191t.optimized
hello.c.017t.fixup_cfg1  hello.c.271t.statistics
hello.c.018t.ssa

4、选择打开hello.c.011t.cfg就可以看到生成的中间文件了,


;; Function iterate (iterate, funcdef_no=0, decl_uid=1932, cgraph_uid=0, symbol_order=0);; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2 3 4 5
;; 2 succs { 3 4 }
;; 3 succs { 5 }
;; 4 succs { 5 }
;; 5 succs { 1 }
iterate (int data)
{int D.1943;int D.1942;int D.1941;<bb 2>:if (data == 1)goto <bb 3>;elsegoto <bb 4>;<bb 3>:D.1941 = 1;goto <bb 5> (<L2>);<bb 4>:D.1942 = data + -1;D.1943 = iterate (D.1942);D.1941 = D.1943 + data;<L2>:return D.1941;};; Function main (main, funcdef_no=1, decl_uid=1936, cgraph_uid=1, symbol_order=1)Removing basic block 3
;; 1 loops found
;;
;; Loop 0
;;  header 0, latch 1
;;  depth 0, outer -1
;;  nodes: 0 1 2 3
;; 2 succs { 3 }
;; 3 succs { 1 }
main (int argc, char * * argv)
{int D.1946;int D.1945;<bb 2>:D.1945 = iterate (10);printf ("%d\n", D.1945);D.1946 = 0;<L0>:return D.1946;}

5、当然,也可以用-S命令查看一下生成的汇编代码,

 .file   "hello.c".text.globl  iterate.type    iterate, @function
iterate:
.LFB0:.cfi_startprocpushl   %ebp.cfi_def_cfa_offset 8.cfi_offset 5, -8movl  %esp, %ebp.cfi_def_cfa_register 5subl   $8, %espcmpl    $1, 8(%ebp)jne  .L2movl $1, %eaxjmp .L3
.L2:movl    8(%ebp), %eaxsubl   $1, %eaxsubl    $12, %esppushl  %eaxcall    iterateaddl $16, %espmovl   %eax, %edxmovl  8(%ebp), %eaxaddl   %edx, %eax
.L3:leave.cfi_restore 5.cfi_def_cfa 4, 4ret.cfi_endproc
.LFE0:.size iterate, .-iterate.section  .rodata
.LC0:.string    "%d\n".text.globl main.type   main, @function
main:
.LFB1:.cfi_startprocleal    4(%esp), %ecx.cfi_def_cfa 1, 0andl  $-16, %esppushl -4(%ecx)pushl   %ebp.cfi_escape 0x10,0x5,0x2,0x75,0movl %esp, %ebppushl %ecx.cfi_escape 0xf,0x3,0x75,0x7c,0x6subl   $4, %espsubl    $12, %esppushl  $10call iterateaddl $16, %espsubl   $8, %esppushl   %eaxpushl   $.LC0call   printfaddl  $16, %espmovl   $0, %eaxmovl    -4(%ebp), %ecx.cfi_def_cfa 1, 0leave.cfi_restore 5leal  -4(%ecx), %esp.cfi_def_cfa 4, 4ret.cfi_endproc
.LFE1:.size main, .-main.ident  "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609".section    .note.GNU-stack,"",@progbits

ps:

也许有些同学会说,这些知识点根本用不到。确实是这样,编译器出故障的机会是很低的。但是大家平时在分析软件bug的时候,了解一些编译原理和操作系统知识,对于提高自己解决问题的能力还是很有帮助的。

除了中间语言和汇编语言,其实大家看一下预处理文件也是不错的,比如gcc -E hello.c > hello.i。文件有点长,大家耐心看,

# 1 "hello.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "hello.c"# 1 "/usr/include/stdio.h" 1 3 4
# 27 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 367 "/usr/include/features.h" 3 4
# 1 "/usr/include/i386-linux-gnu/sys/cdefs.h" 1 3 4
# 410 "/usr/include/i386-linux-gnu/sys/cdefs.h" 3 4
# 1 "/usr/include/i386-linux-gnu/bits/wordsize.h" 1 3 4
# 411 "/usr/include/i386-linux-gnu/sys/cdefs.h" 2 3 4
# 368 "/usr/include/features.h" 2 3 4
# 391 "/usr/include/features.h" 3 4
# 1 "/usr/include/i386-linux-gnu/gnu/stubs.h" 1 3 4# 1 "/usr/include/i386-linux-gnu/gnu/stubs-32.h" 1 3 4
# 8 "/usr/include/i386-linux-gnu/gnu/stubs.h" 2 3 4
# 392 "/usr/include/features.h" 2 3 4
# 28 "/usr/include/stdio.h" 2 3 4# 1 "/usr/lib/gcc/i686-linux-gnu/5/include/stddef.h" 1 3 4
# 216 "/usr/lib/gcc/i686-linux-gnu/5/include/stddef.h" 3 4# 216 "/usr/lib/gcc/i686-linux-gnu/5/include/stddef.h" 3 4
typedef unsigned int size_t;
# 34 "/usr/include/stdio.h" 2 3 4# 1 "/usr/include/i386-linux-gnu/bits/types.h" 1 3 4
# 27 "/usr/include/i386-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/i386-linux-gnu/bits/wordsize.h" 1 3 4
# 28 "/usr/include/i386-linux-gnu/bits/types.h" 2 3 4typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
# 121 "/usr/include/i386-linux-gnu/bits/types.h" 3 4
# 1 "/usr/include/i386-linux-gnu/bits/typesizes.h" 1 3 4
# 122 "/usr/include/i386-linux-gnu/bits/types.h" 2 3 4__extension__ typedef __u_quad_t __dev_t;
__extension__ typedef unsigned int __uid_t;
__extension__ typedef unsigned int __gid_t;
__extension__ typedef unsigned long int __ino_t;
__extension__ typedef __u_quad_t __ino64_t;
__extension__ typedef unsigned int __mode_t;
__extension__ typedef unsigned int __nlink_t;
__extension__ typedef long int __off_t;
__extension__ typedef __quad_t __off64_t;
__extension__ typedef int __pid_t;
__extension__ typedef struct { int __val[2]; } __fsid_t;
__extension__ typedef long int __clock_t;
__extension__ typedef unsigned long int __rlim_t;
__extension__ typedef __u_quad_t __rlim64_t;
__extension__ typedef unsigned int __id_t;
__extension__ typedef long int __time_t;
__extension__ typedef unsigned int __useconds_t;
__extension__ typedef long int __suseconds_t;__extension__ typedef int __daddr_t;
__extension__ typedef int __key_t;__extension__ typedef int __clockid_t;__extension__ typedef void * __timer_t;__extension__ typedef long int __blksize_t;__extension__ typedef long int __blkcnt_t;
__extension__ typedef __quad_t __blkcnt64_t;__extension__ typedef unsigned long int __fsblkcnt_t;
__extension__ typedef __u_quad_t __fsblkcnt64_t;__extension__ typedef unsigned long int __fsfilcnt_t;
__extension__ typedef __u_quad_t __fsfilcnt64_t;__extension__ typedef int __fsword_t;__extension__ typedef int __ssize_t;__extension__ typedef long int __syscall_slong_t;__extension__ typedef unsigned long int __syscall_ulong_t;typedef __off64_t __loff_t;
typedef __quad_t *__qaddr_t;
typedef char *__caddr_t;__extension__ typedef int __intptr_t;__extension__ typedef unsigned int __socklen_t;
# 36 "/usr/include/stdio.h" 2 3 4
# 44 "/usr/include/stdio.h" 3 4
struct _IO_FILE;typedef struct _IO_FILE FILE;# 64 "/usr/include/stdio.h" 3 4
typedef struct _IO_FILE __FILE;
# 74 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/libio.h" 1 3 4
# 31 "/usr/include/libio.h" 3 4
# 1 "/usr/include/_G_config.h" 1 3 4
# 15 "/usr/include/_G_config.h" 3 4
# 1 "/usr/lib/gcc/i686-linux-gnu/5/include/stddef.h" 1 3 4
# 16 "/usr/include/_G_config.h" 2 3 4# 1 "/usr/include/wchar.h" 1 3 4
# 82 "/usr/include/wchar.h" 3 4
typedef struct
{int __count;union{unsigned int __wch;char __wchb[4];} __value;
} __mbstate_t;
# 21 "/usr/include/_G_config.h" 2 3 4
typedef struct
{__off_t __pos;__mbstate_t __state;
} _G_fpos_t;
typedef struct
{__off64_t __pos;__mbstate_t __state;
} _G_fpos64_t;
# 32 "/usr/include/libio.h" 2 3 4
# 49 "/usr/include/libio.h" 3 4
# 1 "/usr/lib/gcc/i686-linux-gnu/5/include/stdarg.h" 1 3 4
# 40 "/usr/lib/gcc/i686-linux-gnu/5/include/stdarg.h" 3 4
typedef __builtin_va_list __gnuc_va_list;
# 50 "/usr/include/libio.h" 2 3 4
# 144 "/usr/include/libio.h" 3 4
struct _IO_jump_t; struct _IO_FILE;typedef void _IO_lock_t;struct _IO_marker {struct _IO_marker *_next;struct _IO_FILE *_sbuf;int _pos;
# 173 "/usr/include/libio.h" 3 4
};enum __codecvt_result
{__codecvt_ok,__codecvt_partial,__codecvt_error,__codecvt_noconv
};
# 241 "/usr/include/libio.h" 3 4
struct _IO_FILE {int _flags;char* _IO_read_ptr;char* _IO_read_end;char* _IO_read_base;char* _IO_write_base;char* _IO_write_ptr;char* _IO_write_end;char* _IO_buf_base;char* _IO_buf_end;char *_IO_save_base;char *_IO_backup_base;char *_IO_save_end;struct _IO_marker *_markers;struct _IO_FILE *_chain;int _fileno;int _flags2;__off_t _old_offset;unsigned short _cur_column;signed char _vtable_offset;char _shortbuf[1];_IO_lock_t *_lock;
# 289 "/usr/include/libio.h" 3 4__off64_t _offset;void *__pad1;void *__pad2;void *__pad3;void *__pad4;size_t __pad5;int _mode;char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];};typedef struct _IO_FILE _IO_FILE;struct _IO_FILE_plus;extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 333 "/usr/include/libio.h" 3 4
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf,size_t __n);typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);typedef int __io_close_fn (void *__cookie);
# 385 "/usr/include/libio.h" 3 4
extern int __underflow (_IO_FILE *);
extern int __uflow (_IO_FILE *);
extern int __overflow (_IO_FILE *, int);
# 429 "/usr/include/libio.h" 3 4
extern int _IO_getc (_IO_FILE *__fp);
extern int _IO_putc (int __c, _IO_FILE *__fp);
extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));extern int _IO_peekc_locked (_IO_FILE *__fp);extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
# 459 "/usr/include/libio.h" 3 4
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,__gnuc_va_list, int *__restrict);
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,__gnuc_va_list);
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
# 75 "/usr/include/stdio.h" 2 3 4typedef __gnuc_va_list va_list;
# 90 "/usr/include/stdio.h" 3 4
typedef __off_t off_t;
# 102 "/usr/include/stdio.h" 3 4
typedef __ssize_t ssize_t;typedef _G_fpos_t fpos_t;# 164 "/usr/include/stdio.h" 3 4
# 1 "/usr/include/i386-linux-gnu/bits/stdio_lim.h" 1 3 4
# 165 "/usr/include/stdio.h" 2 3 4extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__));extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__));extern int renameat (int __oldfd, const char *__old, int __newfd,const char *__new) __attribute__ ((__nothrow__ , __leaf__));extern FILE *tmpfile (void) ;
# 209 "/usr/include/stdio.h" 3 4
extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) ;
# 227 "/usr/include/stdio.h" 3 4
extern char *tempnam (const char *__dir, const char *__pfx)__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) ;extern int fclose (FILE *__stream);extern int fflush (FILE *__stream);# 252 "/usr/include/stdio.h" 3 4
extern int fflush_unlocked (FILE *__stream);
# 266 "/usr/include/stdio.h" 3 4extern FILE *fopen (const char *__restrict __filename,const char *__restrict __modes) ;extern FILE *freopen (const char *__restrict __filename,const char *__restrict __modes,FILE *__restrict __stream) ;
# 295 "/usr/include/stdio.h" 3 4# 306 "/usr/include/stdio.h" 3 4
extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) ;
# 319 "/usr/include/stdio.h" 3 4
extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)__attribute__ ((__nothrow__ , __leaf__)) ;extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) ;extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,size_t __size) __attribute__ ((__nothrow__ , __leaf__));extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));extern int fprintf (FILE *__restrict __stream,const char *__restrict __format, ...);extern int printf (const char *__restrict __format, ...);extern int sprintf (char *__restrict __s,const char *__restrict __format, ...) __attribute__ ((__nothrow__));extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,__gnuc_va_list __arg);extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);extern int vsprintf (char *__restrict __s, const char *__restrict __format,__gnuc_va_list __arg) __attribute__ ((__nothrow__));extern int snprintf (char *__restrict __s, size_t __maxlen,const char *__restrict __format, ...)__attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));extern int vsnprintf (char *__restrict __s, size_t __maxlen,const char *__restrict __format, __gnuc_va_list __arg)__attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));# 412 "/usr/include/stdio.h" 3 4
extern int vdprintf (int __fd, const char *__restrict __fmt,__gnuc_va_list __arg)__attribute__ ((__format__ (__printf__, 2, 0)));
extern int dprintf (int __fd, const char *__restrict __fmt, ...)__attribute__ ((__format__ (__printf__, 2, 3)));extern int fscanf (FILE *__restrict __stream,const char *__restrict __format, ...) ;extern int scanf (const char *__restrict __format, ...) ;extern int sscanf (const char *__restrict __s,const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
# 443 "/usr/include/stdio.h" 3 4
extern int fscanf (FILE *__restrict __stream, const char *__restrict __format, ...) __asm__ ("" "__isoc99_fscanf");
extern int scanf (const char *__restrict __format, ...) __asm__ ("" "__isoc99_scanf");
extern int sscanf (const char *__restrict __s, const char *__restrict __format, ...) __asm__ ("" "__isoc99_sscanf") __attribute__ ((__nothrow__ , __leaf__));
# 463 "/usr/include/stdio.h" 3 4extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,__gnuc_va_list __arg)__attribute__ ((__format__ (__scanf__, 2, 0))) ;extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)__attribute__ ((__format__ (__scanf__, 1, 0))) ;extern int vsscanf (const char *__restrict __s,const char *__restrict __format, __gnuc_va_list __arg)__attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
# 494 "/usr/include/stdio.h" 3 4
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vfscanf")__attribute__ ((__format__ (__scanf__, 2, 0))) ;
extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vscanf")__attribute__ ((__format__ (__scanf__, 1, 0))) ;
extern int vsscanf (const char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __asm__ ("" "__isoc99_vsscanf") __attribute__ ((__nothrow__ , __leaf__))__attribute__ ((__format__ (__scanf__, 2, 0)));
# 522 "/usr/include/stdio.h" 3 4extern int fgetc (FILE *__stream);
extern int getc (FILE *__stream);extern int getchar (void);# 550 "/usr/include/stdio.h" 3 4
extern int getc_unlocked (FILE *__stream);
extern int getchar_unlocked (void);
# 561 "/usr/include/stdio.h" 3 4
extern int fgetc_unlocked (FILE *__stream);extern int fputc (int __c, FILE *__stream);
extern int putc (int __c, FILE *__stream);extern int putchar (int __c);# 594 "/usr/include/stdio.h" 3 4
extern int fputc_unlocked (int __c, FILE *__stream);extern int putc_unlocked (int __c, FILE *__stream);
extern int putchar_unlocked (int __c);extern int getw (FILE *__stream);extern int putw (int __w, FILE *__stream);extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream);
# 640 "/usr/include/stdio.h" 3 4# 665 "/usr/include/stdio.h" 3 4
extern __ssize_t __getdelim (char **__restrict __lineptr,size_t *__restrict __n, int __delimiter,FILE *__restrict __stream) ;
extern __ssize_t getdelim (char **__restrict __lineptr,size_t *__restrict __n, int __delimiter,FILE *__restrict __stream) ;extern __ssize_t getline (char **__restrict __lineptr,size_t *__restrict __n,FILE *__restrict __stream) ;extern int fputs (const char *__restrict __s, FILE *__restrict __stream);extern int puts (const char *__s);extern int ungetc (int __c, FILE *__stream);extern size_t fread (void *__restrict __ptr, size_t __size,size_t __n, FILE *__restrict __stream) ;extern size_t fwrite (const void *__restrict __ptr, size_t __size,size_t __n, FILE *__restrict __s);# 737 "/usr/include/stdio.h" 3 4
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,size_t __n, FILE *__restrict __stream);extern int fseek (FILE *__stream, long int __off, int __whence);extern long int ftell (FILE *__stream) ;extern void rewind (FILE *__stream);# 773 "/usr/include/stdio.h" 3 4
extern int fseeko (FILE *__stream, __off_t __off, int __whence);extern __off_t ftello (FILE *__stream) ;
# 792 "/usr/include/stdio.h" 3 4extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos);extern int fsetpos (FILE *__stream, const fpos_t *__pos);
# 815 "/usr/include/stdio.h" 3 4# 824 "/usr/include/stdio.h" 3 4extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;extern void perror (const char *__s);# 1 "/usr/include/i386-linux-gnu/bits/sys_errlist.h" 1 3 4
# 26 "/usr/include/i386-linux-gnu/bits/sys_errlist.h" 3 4
extern int sys_nerr;
extern const char *const sys_errlist[];
# 854 "/usr/include/stdio.h" 2 3 4extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;
# 872 "/usr/include/stdio.h" 3 4
extern FILE *popen (const char *__command, const char *__modes) ;extern int pclose (FILE *__stream);extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
# 912 "/usr/include/stdio.h" 3 4
extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) ;extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
# 942 "/usr/include/stdio.h" 3 4# 3 "hello.c" 2# 4 "hello.c"
int iterate(int data)
{if(1 == data) return 1;return iterate(data-1) + data;
}int main(int argc, char* argv[])
{printf("%d\n", iterate(10));return 0;
}

随想录(gcc生成的中间语言、汇编代码)相关推荐

  1. Linux x8664汇编,xorl%eax,g86生成的x86_64汇编代码中的%eax

    我在集会上总是一个菜鸟,只是捅了一下看看发生了什么.无论如何,我写了一个非常简单的函数: void multA(double *x,long size) { long i; for(i=0; i x[ ...

  2. [转]在VS中为C/C++源代码文件生成对应的汇编代码文件(.asm)

    原文链接:https://www.cnblogs.com/lulipro/p/9926474.html 转载申明:感谢原作者!如有侵权,请联系我删除,谢谢

  3. GCC如何编译内嵌汇编代码

    内核代码绝大部分使用C  语言编写,只有一小部分使用汇编语言编写,例如与特定体系结构相关的代码和对性能影响很大的代码.GCC提供了内嵌汇编的功能,可以在C代码中直接内嵌汇编语言语句,大大方便了程序设计 ...

  4. 修改vb6的编译器c2.exe使它可以输出汇编代码_xv6笔记-启动代码分析

    首先看xv6 commit的第一个makefile OBJS = main.o CC = i386-jos-elf-gcc LD = i386-jos-elf-ld OBJCOPY = i386-jo ...

  5. GCC 生成的符号表调试信息剖析

    GCC把C语言源文件('.c')编译成汇编语言文件('.s'),汇编器把汇编语言文件翻译成目标文件('.o'),最后由链接器链接所有的目标文件和有关的库生成可执行文件('a.out'). 如打开'-g ...

  6. 使用GCC生成无格式二进制文件(plain binary files)

    使用C语言生成一个二进制文件 使用自己喜欢的文本编辑器写一个test.c: int main() { } 再使用如下命令编译: gcc –c test.c ld –o test –Ttext 0x0 ...

  7. GCC生成静态库和动态库

    目录 1)阅读.理解和学习材料"用gcc生成静态库和动态库.pdf"和"静态库.a与.so库文件的生成与使用.pdf",请在Linux系统(Ubuntu)下如实 ...

  8. 在Windows 10上将C语言程序转成16位8086汇编代码

    大多数人在高校里面学的第一门汇编语言是基于16位的Intel 8086处理器(即8086汇编语言),现在的大多数系统都是32或者64位的,为了实验需要我们一般安装DosBox来作为16位DOS系统模拟 ...

  9. Linux下用gcc生成静态库和动态库及练习使用OpenCV

    我们通常把一些公用函数制作成函数库,供其它程序使用.函数库分为 静态库和动态库两种.静态库在程序编译时会被连接到目标代码中,程序运行时将不再需要该静态库.动态库在程序编译时并不会被连接到目标代码中,而 ...

最新文章

  1. 模仿人脑视觉处理,助力神经网络应对对抗性样本
  2. IDT系列:(一)初探IDT,Interrupt Descriptor Table,中断描述符表
  3. 成功解决ModuleNotFoundError: No module named 'urllib2'
  4. c语言游戏编程网盘下载,C语言游戏编程 计算器(5分下载)
  5. Protobuf序列化的原理-总结
  6. 一秒点击手机屏幕次数_手机电池不耐用,都怪这些充电坏毛病
  7. [objective-c] 04 - 消息机制 回调 目标-动作回调
  8. glassfish默认密码_在MySQL上使用含盐密码的GlassFish JDBC安全性
  9. Antd Vue 组件库之Table表单
  10. php裁剪图片白边,php生成缩略图填充白边(等比缩略图方案)_PHP
  11. MySQL如何查全部序列_Oracle查询所有序列
  12. mac乱码 飞秋_ubuntu 下安装 dukto
  13. 主分区损坏diskgenius_DiskGenius怎么修复损坏分区 显示主分区损坏解决方法
  14. vant实现Select效果--单选和多选
  15. 新一代至强CPU加速GBase 8a MPP,GBase GCDW云数据仓库助力行业迎接数字化转型新挑战
  16. Qt 笔锋 毛笔 钢笔 蜡笔 4k流畅画笔 Demo
  17. 小程序微信授权登录服务器异常,微信小程序授权登录流程(强制绑定手机号码)...
  18. 如何用ps 在图片上面写字
  19. 微信小程序文本框保留两位小数(非四舍五入)
  20. 美年旅游_自由行_编辑自由行

热门文章

  1. ansible批量安装服务器思路
  2. iOS之CATiledLayer的属性简介和使用
  3. javaEE之--------统计站点在线人数,安全登录等(观察者设计模式)
  4. 《IT蓝豹》PlayNewsStandDemo资讯类新闻客户端框架
  5. Android TabHost中Activity之间传递数据
  6. android关于pull解析的问题-1
  7. 普通软件项目开发过程规范(五)—— 总结
  8. (转)LUA与python根本就不具有可比性
  9. 如何建立内核级钩子控制操作系统实现程序隐身
  10. HTTP和WebSocket协议(二)