编译器
文章平均质量分 75
漫小牛
这个作者很懒,什么都没留下…
展开
-
[An Introduction to GCC 学习笔记] 16 gprof, gcov
Compiler-related ToolsThe GNU profiler gprof is a useful tool for measuring the performance of a program - it records the number of calls to each function and the amount of time spent there, on a perfunction basis. Functions which consume a large fractio原创 2021-07-12 15:07:11 · 82 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 15 How the compiler works, Identifying files
The PreprocessorThe first stage of the compilation process is the use of the preprocessor to expand macros and included header files.To perform this stage, GCC executes the following command:$ cpp hello.c > hello.iThe result is a file ‘hello.i’原创 2021-07-05 22:03:53 · 107 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 14 优化问题3
Optimization and DebuggingWith GCC it is possible to use optimization in combination with the debugging option ‘-g’. Many other compiler do not allow this.When using debugging and optimization together, the internal rearrangements carried out by the opt原创 2021-07-04 03:54:49 · 241 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 13 优化问题2
Loop UnrollingA prime example of an optimization with a speed-space tradeoff is loop unrolling:This form of optimization increases the speed of loops by eliminating the “end of loop” condition on each iteration.Loop unrolling is an optimization that in原创 2021-07-04 03:26:30 · 114 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 12 优化问题
Compiling with OptimizationGCC is an optimizing compiler. It provides a wide range of options which aim to increase the speed, or reduce the size, of the executable files it generates.Optimization is a complex process. For each high-level command in the原创 2021-07-01 11:00:27 · 181 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 11 core文件分析
Compiling for DebuggingNormally, an executable file does not contain any reference to the original program source code, such as variable names or line-numbers. The executable file is simply the sequence of machine code instructions produced by the compil原创 2021-07-01 09:43:28 · 188 阅读 · 2 评论 -
[An Introduction to GCC 学习笔记] 01 介绍GCC、发展历史
前言gcc是一个在开源软件世界里的顶级的编译器。几乎所有的编译器,都是美国的舶来品。任何一个公司要成功,一定要在开源的道路上走下去。ObjectivesAfter completing the lesson, you should be able to do the following:Learn the history and features of GCC.Learn the basic skills of using GCC. Learn the basic optimizatio原创 2021-06-25 18:42:57 · 447 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 02 GCC的特点
GCC特点GCC is a portable compiler - it runs on most platforms available today, and can produce output for many types of processors. In addition to the processors used in personal computers, it also supports microcontrollers, DSPs and 64 bit CPUsGCC is not原创 2021-06-25 19:46:46 · 128 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 03 hello world、编译多个文件
helloworldThe classic example program for the C language is:#include <stdio.h>int main(void){ printf("Hello world!\n"); return 0;}To compile the file with gcc, use the following command:$ gcc -Wall hello.c -o hello在众多的警告选项之中,最常用的就是-Wall选原创 2021-06-25 21:05:40 · 154 阅读 · 1 评论 -
[An Introduction to GCC 学习笔记] 04 Verbose选项、-c、链接次序
1 Verbose CompilationThe ‘-V’ option can be used to display detailed information about the exact sequence of commands used to compile and link a program.The output produced by ‘-v’ can be useful whenever there is a problem with the compilation process原创 2021-06-25 21:43:55 · 224 阅读 · 1 评论 -
[An Introduction to GCC 学习笔记] 05 Make、外部库
1 Recompiling and RelinkingIn general, linking is faster than complition - in a large project with many source files, recompiling only those that have been modified can make a significant saving.The process of recompiling only the modified files in a pr原创 2021-06-25 22:24:52 · 86 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 06 链接外部库、头文件
1 Linking with External LibrariesTo enable the compiler to link the external library, we need to supply the library in the gcc command line:$ gcc -Wall main.c /usr/lib/libm.a -o calcTo avoid the need to specify long paths on the command line, the co原创 2021-06-26 07:42:02 · 154 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 07 链接外部静态库
Creating a Library with arThe GNU archiver ar combines a collection of objects files into a single archive file, also know as a library. An archive file is simply a convenient way of distributing a large number of related object files together.You can u原创 2021-06-27 08:59:54 · 122 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 08 链接外部外部动态库、C标准
Shared vs Static LibrariesExternal libraries are usually provide in two forms: static libraries and shared libraries.1 Static libraries are the ‘.a’ files. When a program is linked against a static library, the machine code from the object files for an原创 2021-06-27 10:19:40 · 118 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 09 -Wall
Warning Options in -WallThe warning option ‘-Wall’ enables warning for many common errors, and should always be used. It combines a large number of other, more specific, warning options which can also be selected individually:‘-Wcomment’‘-Wformat’‘-Wu原创 2021-06-27 11:04:56 · 224 阅读 · 0 评论 -
[An Introduction to GCC 学习笔记] 10 Warn、预编译
Addtional Warning OptionsGCC provides many other warning options that are not included in ‘-Wall’, but are often useful. Typically these product warning for source code which may be technically valid but is very likely to cause problems. The crieria for t原创 2021-06-28 10:49:45 · 91 阅读 · 0 评论