当前位置:网站首页>Chapter 5 C programming expert thinking 5.4 alert Interpositioning of links
Chapter 5 C programming expert thinking 5.4 alert Interpositioning of links
2022-08-04 04:45:00 【weixin_Guest time】
Interpositioning (some people call it "interposing") replaces the behavior of a library function by writing a function with the same name as the library function.Not only will all calls to this library function that you make yourself will be replaced by your own version of the function call, but all system calls that call the library function will also be replaced by your function.Interpositioning itself is not a bug, it is explicitly required by the compiler to support it.
Do not make any symbols in a program global unless they are intended to be one of the program's interfaces.
mktemp has now been replaced by the ANSI C standard library function tmpname.
The listed identifiers should not appear in the declarations of their own programs.Some of these identifiers are always reserved, others are only reserved if a specific header file is included.Some identifiers are reserved only at the global scope, others are reserved both at the global scope and at the file scope.Also note that all keywords are reserved.The easiest way to avoid trouble is to think that these identifiers are always owned by the system and not use them as their own.
Several items look like this: is[a-z]anything
This means anything starting with "is" followed by a lowercase letter from a to z (but not including things like numbers),Then follow any character.
A few more items look like this: acos, -f, -l.
It means that the 3 identifiers acos, acosf, acosl are reserved.All functions located in the math header file have a basic version that accepts a double argument.There may be two additional versions there: the base name with the suffix l means that the function accepts a long double parameter: the base name with the suffix f means the function accepts a float parameter.
Section 6.1.2 of the ANSI C standard specifies that for external identifiers, the compiler can define itself to make them case-insensitive.At the same time, the first 6 characters of external identifiers must be different from other identifiers (ANSI C standard section 5.2.4.1, "Compile restrictions").There are also some symbols to avoid for other libraries that are linked.You should check the ABI documentation to see which identifiers to avoid.
If the identifier is reserved, it means that the user cannot redefine it.However, this is not a constraint.When this happens, it doesn't ask the compiler to give an error message.It just caused some non-portability issues or undefined behavior.
You can use the -m option in the ld program to have the compiler generate a report.It contains a description of the symbols being Interposed.Normally, ld with the -m option produces a memory map or list showing where those symbols are placed in the executable.It shows multiple instances of the same symbol at the same time, and by looking at the contents of the report, the user can tell if Interpositioning has occurred.
The -D option in the ld program was introduced with SunOS 5.3 to provide better link-edit debugging.This option allows the user to display the link-edit process and the included input files.This option is especially useful if you need to monitor the process of extracting objects from the archive.It can also be used to display runtime binding information.
Description of ld complex program:
* Use the ldd command to list the dynamic set of dependencies of an executable.This command will tell you the function library required by the dynamically linked program
*The -Dhelp option of the ld program can provide some information to help find problems during the linking process:
*View the online of the ld programDocumentation;
*Read SunOs Linker and Libraries Manual
边栏推荐
- Postgresql源码(66)insert on conflict语法介绍与内核执行流程解析
- [C language advanced] program environment and preprocessing
- Postgresql source code (66) insert on conflict grammar introduction and kernel execution process analysis
- Significant differences between Oracle and Postgresql in PLSQL transaction rollback
- 信息学奥赛一本通 1312:【例3.4】昆虫繁殖
- C专家编程 第5章 对链接的思考 5.3 函数库链接的5个特殊秘密
- 基于gRPC编写golang简单C2远控
- SQL query String field less than 10 how to check
- How to dynamically add script dependent scripts
- How to automatically export or capture abnormal login ip and logs in elastic to the database?
猜你喜欢
Simple operation of the file system
获取单选框选中内容
drools from download to postman request success
manipulation of file contents
Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
深度学习环境配置
帮助企业实现数字化转型成功的八项指导原则
7-3 LVS+Keepalived Cluster Description and Deployment
Tensors - Application Cases
7. The principle description of LVS load balancing cluster
随机推荐
详解八大排序
附加:对于“与数据表对应的实体类“,【面对MongoDB时,使用的@Id等注解】和【以前面对MySQL时,使用的@Id等注解】,是不同的;
3000 words, is take you understand machine learning!
RSS订阅微信公众号初探-feed43
转:管理是对可能性的热爱,管理者要有闯进未知的勇气
Introduction to the memory model of the JVM
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.5 数组和指针的其他区别
如何动态添加script依赖的脚本
DataTable使用Linq进行分组汇总,将Linq结果集转化为DataTable
Embedded database development programming MySQL (full)
centos 安装postgresql13 指定版本
【流程图】
How to dynamically add script dependent scripts
3000字,一文带你搞懂机器学习!
The video of machine learning to learn [update]
2023年PMP考试会用新版教材吗?回复来了!
Take care of JVM performance optimization (own note version)
JVM Notes
SQL query String field less than 10 how to check
看DevExpress丰富图表样式,如何为基金公司业务创新赋能