- 博客(47)
- 资源 (22)
- 收藏
- 关注
原创 Studying note of GCC-3.4.6 source (39)
4.1.4. Adjust options according to targetReturned from c_common_post_options, continue with process_options. Remember that input_filename accesses file field of input_location which tracks the curre
2010-04-30 11:01:00 1125
原创 GCC-3.4.6源代码学习笔记(39)
4.1.4. 根据目标平台调整选项从c_common_post_options返回,继续process_options。回忆input_filename访问input_location的file域,这个域记录了当前正在编译的文件。 process_options (continue) 4283 input_filename = main_input_filename;4
2010-04-30 10:46:00 2809
原创 Studying note of GCC-3.4.6 source (38)
4.1.3.1.2.3.1.1. #pragma interface & #pragma implementationAs extension to C++ provided by GCC, #pragma interface “filename” (op) and #pragma implementation “filename” (op) are described by [
2010-04-29 10:05:00 770
原创 GCC-3.4.6源代码学习笔记(38)
4.1.3.1.2.3.1.1. #pragma interface及#pragma implementation作为GCC提供的一个C++的扩展,【6】解释了#pragma interface “filename” (op) 及#pragma implementation “filename” (op)。 6.3 模糊链接性(Vague Linkage)在C++中有一些
2010-04-29 10:02:00 2335
原创 Studying note of GCC-3.4.6 source (37)
4.1.3.1.2.2. Read in common fileBack should_stack_file, for common file, the whole file content will be put into buffer of cpp_reader. should_stack_file (continue) 584 if (!read_fi
2010-04-28 09:44:00 816
原创 GCC-3.4.6源代码学习笔记(37)
4.1.3.1.2.2. 读入普通文件回到should_stack_file,对于普通文件,整个文件内容将被放入cpp_reader的buffer内。 should_stack_file (continue) 584 if (!read_file (pfile, file))585 return false;586 587
2010-04-28 09:24:00 1156
原创 Studying note of GCC-3.4.6 source (36)
4.1.3.1.2.1.4.4.3. The expansion bodyIn macro expansion body, hash ‘#’ only can immediately precede the macro parameter to stringify it. Otherwise it only can appear freely in assembler language as
2010-04-27 09:22:00 876
原创 Studying note of GCC-3.4.6 source (35)
4.1.3.1.2.1.1.4. Create macro definition – ISO modeAs we have seen, standard mode is token based, so for each token found, it needs a data to save its information as below. 175 struct cp
2010-04-26 09:40:00 1305
原创 GCC-3.4.6源代码学习笔记(35)
4.1.3.1.2.1.4.4. 创建宏定义 – ISO模式我们已经看到,标准模式是基于符号(token)的,因此对于每个看到的符号,都要以下面的形式保存其信息。 175 struct cpp_token
2010-04-26 09:36:00 1935
原创 Modultils工具源码分析之ksyms篇
一般来说,内核只会导出由EXPORT_PARM宏指定的符号给模块使用。为了使debugger提供更好的调试功能,需要使用kallsyms工具为内核生成__kallsyms段数据,该段描述所有不处在堆栈上的内核符号。这样debugger就能更好地解析内核符号,而不仅仅是内核指定导出的符号。刚刚编译好的内核是不带__kallsyms段的。要在内核中加入__kallsyms段,man给出了一个方法,
2010-04-23 09:56:00 1295
原创 Modultils工具源码分析之insmod篇 (完)
回到INSMOD_MAIN函数里。 1899 /* Do archdata again, this time we have the final addresses */1900 if (add_archdata(f, &archdata))1901 goto out;19021903 /* Do kallsym
2010-04-23 09:53:00 1258
原创 Modultils工具源码分析之insmod篇 (12)
回到INSMOD_MAIN里。 1893 if (!obj_relocate(f, m_addr)) { /* DEPMOD */1894 if (!noload)1895 delete_module(m_name);1896 goto out;1897
2010-04-23 09:50:00 848
原创 Modultils工具源码分析之insmod篇 (11)
回到INSMOD_MAIN。 1826 /**** No symbols or sections to be changed after kallsyms above ***/ 之前所有的操作都没动内核。下面就要来真的了。 1828 if (errors)1829 goto out;18301831 /*
2010-04-23 09:46:00 1267
原创 Studying note of GCC-3.4.6 source (34)
4.1.3.1.2.1.4. Read in macro defintionsIn rest of PCH file, it contains detail of definition of macros. By this information, we can insert those defintions in cpp_reader now. In PCH fil
2010-04-23 09:31:00 772
原创 GCC-3.4.6源代码学习笔记(34)
4.1.3.1.2.1.4. 读入宏定义在剩下的PCH文件中,包含了其宏定义的细节。根据这个信息,现在我们可以把这些定义插入cpp_reader里。在PCH文件中,每个宏定义以以下的macrodef_struct结构开头。 38 struct macrodef_struct
2010-04-23 09:27:00 1135
原创 Studying note of GCC-3.4.6 source (33)
4.1.3.1.2.1.2. Read in PCH content in intermediate formBefore, we have seen some variables are declared with GTY((…)), the program of GC (garbage collection) will parse specified files
2010-04-22 09:54:00 886
原创 GCC-3.4.6源代码学习笔记(33)
4.1.3.1.2.1.2. 读入中间形式的PCH内容之前,我们已经看到一些变量在声明中使用了GTY((…)),GC程序(垃圾回收器)将解析指定的文件(在指定列表外的文件中的GTY((…))是不被解析的,它们将导致编译错误——未定义的识别符),并将结果输出到加上gt-前缀的同名文件中。而该文件才作为编译编译器时的真正输入。因此,以下所涉及的变量才是编译器真正使用的,它
2010-04-22 09:44:00 1680 1
原创 Studying note of GCC-3.4.6 source (32)
4.1.3.1.2. Read in fileAbove at line 439, if the file has been found and opened successfully, _cpp_find_file returns the corresponding _cpp_file object, and refered by pfile->main_file.
2010-04-21 09:25:00 940
原创 GCC-3.4.6源代码学习笔记(32)
4.1.3.1.2. 读入文件上面439行,如果文件找到并成功打开,_cpp_find_file将对应的_cpp_file对象返回,交由pfile->main_file保存。由此,可以开始读入文件的内容。 cpp_read_main_file (continue) 473 _cpp_stack_file (pfile, pfile->main_f
2010-04-21 09:21:00 1225
原创 Studying note of GCC-3.4.6 source (31)
4.1.3.1.1.1. Validate PCH FileIf PCH file is found, it needs ensure this file is valid. 1257 static bool1258 validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname)
2010-04-20 09:35:00 703
原创 GCC-3.4.6源代码学习笔记(31)
4.1.3.1.1.1. 验证PCH文件如果PCH文件找到了,需确保它是有效的。 1257 static bool1258 validate_pch (cpp_reader *pfile, _cpp_file *file, const char *pchname) in cppfiles.c1259 {1260 const char *sav
2010-04-20 09:22:00 1212
原创 Studying note of GCC-3.4.6 source (30)
4.1.3. Read in source fileAs now cpp_reader is ready, it is time to read in source files. Below, macro input_line accesses line field of global variable input_location which records the current file
2010-04-19 10:13:00 803
原创 GCC-3.4.6源代码学习笔记(30)
4.1.3. 读入源代码现在cpp_reader已经就绪,是时候读入源文件了。在下面,宏input_line访问全局变量input_location的line域。这个全局变量记录了当前文件名及当前处理行号。 c_common_post_option (continue) 1162 saved_lineno = input_line;1163 input_line =
2010-04-19 10:07:00 1191
原创 Studying note of GCC-3.4.6 source (29)
4.1.2. Set up flags controlling lexerBelow, flag_inline_trees, it is 0 if we should not perform inlining, 1 if we should expand functions calls inline at the tree level, and 2 if we should consider
2010-04-16 09:50:00 700
原创 GCC-3.4.6源代码学习笔记(29)
4.1.2. 设置Lexer控制参数下面,flag_inline_trees,是0如果不执行内联,是1如果以树形式展开内联函数调用,是2如果所有函数被视为内联的候选。而flag_inline_functions,如果为非0值,允许编译器在调用点,选择某些简单的内联函数将其内联。这个变量自动被-O3打开,除非指定了-fno-inline-functions。另flag_no_inline如果
2010-04-16 09:46:00 967
原创 Studying note of GCC-3.4.6 source (28)
4.1.1. Finish the setup of search pathGCC looks in several different places for headers. On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with `#inclu
2010-04-15 09:46:00 663
原创 GCC-3.4.6源代码学习笔记(28)
4.1.1. 完成查找路径设置GCC在多个不同的地方查找头文件。在一个普通的Unix系统上,如果不另外指示,由`#include 请求的文件将在以下目录中查找: /usr/local/include LIBDIR/gcc/TARGET/VERSION/include /usr/TARGET/include /usr/include对于C++
2010-04-15 09:41:00 1260
原创 Studying note of GCC-3.4.6 source (27)
3.3.4. Finish the handlingWhen return from handle_options, decode_options updates other flags accordingly. Orinigal value of flag_no_inline and flag_really_no_inline are 2. If appropriate, flag_no_i
2010-04-14 09:25:00 680
原创 GCC-3.4.6源代码学习笔记(27)
3.3.4. 完成处理当从handle_options符号时,decode_options相应地更新其他标识。flag_no_inline和flag_really_no_inline初始是2。如果合适,flag_no_inline将被common_handle_option 设为1(见该函数的1060行)。在下面,可以看到,如果内联是可能的,这2个变量均是0。而且如果optimize是0,fl
2010-04-14 09:19:00 1325
原创 Studying note of GCC-3.4.6 source (26 cont2)
common_handle_option (continue) 1179 case OPT_fprofile:1180 profile_flag = value;1181 break;11821183 case OPT_fprofile_arcs:1184 profile_arc_flag_set = true;1
2010-04-13 12:40:00 850
原创 GCC-3.4.6源代码学习笔记(26续2)
common_handle_option (continue) 1179 case OPT_fprofile:1180 profile_flag = value;1181 break;11821183 case OPT_fprofile_arcs:1184 profile_arc_flag_set = true;1
2010-04-13 12:27:00 1431
原创 Studying note of GCC-3.4.6 source (26 cont1)
common_handle_option (continue) 909 case OPT_fcall_used_:910 fix_register (arg, 0, 1);911 break;912 913 case OPT_fcall_saved_:914 fix_register (arg, 0, 0)
2010-04-13 12:23:00 1442
原创 GCC-3.4.6源代码学习笔记(26续1)
common_handle_option (continue) 909 case OPT_fcall_used_:910 fix_register (arg, 0, 1);911 break;912 913 case OPT_fcall_saved_:914 fix_register (arg, 0, 0)
2010-04-13 12:09:00 2079
原创 Modultils工具源码分析之insmod篇 (10)
回到INSMOD_MAIN。 1819 /* archdata based on relocatable addresses */1820 if (add_archdata(f, &archdata))1821 goto out;18221823 /* ka
2010-04-08 12:17:00 1013
原创 Studying note of GCC-3.4.6 source (26)
3.3.3.1.2. Handling common options For common switches or switches can’t be finished by c_common_handle_option, common_handle_option is invoked. 655 static int656 common_handle_op
2010-04-08 12:05:00 822
原创 GCC-3.4.6源代码学习笔记(26)
3.3.3.1.2. 处理公用选项对于公用选项及c_common_handle_option未能完成处理之选项,则需要继续调用 common_handle_option。 655 static int656 common_handle_option (size_t scode, const char *arg,
2010-04-08 11:59:00 1647
原创 Modultils工具源码分析之insmod篇 (9)
处理完命令行参数,INSMOD_MAIN接下来调用arch_create_got。这个函数在./modutils-2.4.0/obj/obj_i386.c中。Insmod——arch_create_got函数158 int159 arch_create_got (struct obj_file *f)160 {161 struct i386_file *ifile
2010-04-07 11:52:00 941
原创 Studying note of GCC-3.4.6 source (25 cont2)
c_common_handle_option (continue) 657 case OPT_Wwrite_strings:658 if (!c_dialect_cxx ())659 flag_const_strings = value;660 else661 warn_write_strings =
2010-04-07 11:36:00 1005
原创 Studying note of GCC-3.4.6 source (25 cont1)
c_common_handle_option (continue) 401 case OPT_Wbad_function_cast:402 warn_bad_function_cast = value;403 break;404 405 case OPT_Wcast_qual:406 warn_cast_qu
2010-04-07 11:33:00 1024
原创 Studying note of GCC-3.4.6 source (25)
3.3.3.1.1. Options for C++For C/C++ or obj-C, handle_options of lang_hooks is the same as c_common_handle_option. In below, OPT_* is used as index into cl_options. 251 int252 c_co
2010-04-07 11:29:00 1048
Introduction to Theory of Computation
2018-09-23
Survey on Instruction Selection
2018-09-23
Towards a Compilation infrastructure for network processors
2018-09-23
Crafting a Compiler
2018-09-01
How Debuggers Work
2018-09-01
Compiler Construction-20th
2018-09-01
Compiler Construction-19th
2018-09-01
Compiler Construction-17th
2018-09-01
Compiler Construction-16th
2018-09-01
Compiler Construction-5th
2018-09-01
Construction and Evolution of Code Generator
2018-09-01
Compiler Construction-11th
2018-09-01
The compiler design handbook
2018-09-01
Data_Flow_Analysis_Theory_And_Practice(Bookos.org)
2018-09-01
The Compiler Design Handbook Optimizations and machine code generation
2018-09-01
instruction scheduling for instruction level parallel processor
2018-07-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人