随笔分类 -  编译链接

CMAKE笔记
摘要:cmake,自动生成makefile 源代码根目录需要有一个CMakeLists.txt文件 某个cmake的模块,可以通过定义一个配置文件的方式,让其他工程来引用。该配置文件一般命名为CycloneDDSConfig.cmake,或者cyclonedds-config.cmake。其他工程通过该文 阅读全文

posted @ 2022-10-26 20:18 yanhc 阅读(95) 评论(0) 推荐(0)

gcc c asm,C程序内嵌汇编
摘要:gcc说明: https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Extended-Asm.html https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/Extended-Asm.html#Extended-Asm 有时候, 阅读全文

posted @ 2020-05-31 16:32 yanhc 阅读(832) 评论(0) 推荐(0)

makefile and make tips
摘要:wildcard,扩展通配符 https://blog.csdn.net/hktkfly6/article/details/25644139 SRC = $(wildcard *.c) 等于指定编译当前目录下所有.c文件,如果还有子目录,比如子目录为inc,则再增加一个wildcard函数,象这样: 阅读全文

posted @ 2020-05-21 22:04 yanhc 阅读(256) 评论(0) 推荐(0)

sparc-rtems-gcc version
摘要:sparc-rtems-4.6.5-gcc-3.2.3-1.0.16-cygwin.tar.bz2这个是cygwin交叉编译工具,是从以下网址下载的,rtems对应4.6.5,gcc对应3.2.3https://www.gaisler.com/anonftp/rcc/bin/ sparc-rtems 阅读全文

posted @ 2020-03-18 14:12 yanhc 阅读(497) 评论(0) 推荐(0)

gnu make
摘要:模式替换 Another type of substitution reference lets you use the full power of the patsubst function. It has the same form ‘$(var:a=b)’ described above, e 阅读全文

posted @ 2020-02-23 22:02 yanhc 阅读(157) 评论(0) 推荐(0)

工程引用libm.a文件的sin函数后
摘要:更改前后的main.c //#include <math.h> int var_data = 1; int var_bss; int main() { double d; // d = sin(3.14/2); return 0; } View Code #include <math.h> int 阅读全文

posted @ 2020-02-23 20:39 yanhc 阅读(322) 评论(0) 推荐(0)

3803 register initialization
摘要:wim寄存器 window invalid mask,窗口无效屏蔽寄存器,如果某bit为1,则表示该窗口无效,不能使用。 初始化,设置%psr.CWP=0,即当前使用win0;设置wim=2,即只有win1不能使用,win0,7,6,5,4,3,2都能使用。 save时,CWP-1,变为窗口7;再s 阅读全文

posted @ 2020-02-16 19:21 yanhc 阅读(245) 评论(0) 推荐(0)

bin utilities related
摘要:objdump -S, 如果有源程序的话,将源程序与汇编代码混合在一起。 使用该选项时,输入的目标文件需要有调试信息,即用gcc -g生成的目标文件才可以,因为,调试信息中才有源程序信息。 --adjust-vma=offset 对于a.out,似乎没有编码节的地址,因此,dump出来的节内容都是从 阅读全文

posted @ 2020-02-16 14:22 yanhc 阅读(245) 评论(0) 推荐(0)

ELF文件之八——使用链接脚本-2个函数-data-bss-temp-call-debug信息
摘要:gcc编译选项可以设置生成调试信息, debug信息格式有stabs,coff,xcoff,dwarf。 常用的有两种格式,stab和dwarf,stab较早,dwarf较新。两种格式介绍:https://www.ibm.com/developerworks/cn/opensource/os-deb 阅读全文

posted @ 2020-02-15 11:33 yanhc 阅读(707) 评论(0) 推荐(0)

sparc v8 汇编语言语法
该文被密码保护。

posted @ 2020-02-12 18:37 yanhc 阅读(74) 评论(0) 推荐(0)

关于ELF文件和BIN文件
该文被密码保护。

posted @ 2020-02-09 22:27 yanhc 阅读(65) 评论(0) 推荐(0)

ELF文件之七——使用链接脚本-2个函数-data-bss-temp-call
摘要:main.c int enable; int test = 1; int main() { int temp; add(); return 0; } int add() { return 0; } View Code o反汇编的地址都是0起始,elf的地址都是映射后的地址。 多了一个.rela.te 阅读全文

posted @ 2020-02-09 20:20 yanhc 阅读(239) 评论(0) 推荐(0)

ELF文件之六——使用链接脚本-2个函数-data-bss-temp
摘要:main.c int enable; int test = 1; int main() { int temp; return 0; } int add() { return 0; } View Code elf反汇编结果如下,可以看出main函数中的栈多开了8字节,虽然局部变量只是int,占4字节 阅读全文

posted @ 2020-02-09 19:42 yanhc 阅读(234) 评论(0) 推荐(0)

ELF文件之五——使用链接脚本-2个函数-data-bss
摘要:main.c int enable; int test = 1; int main() { return 0; } int add() { return 0; } View Code bss段在elf中虽然size是4,但并不占filesize,节头表如下图所示 程序头中,项目2的文件大小为4(4字 阅读全文

posted @ 2020-02-09 19:22 yanhc 阅读(278) 评论(0) 推荐(0)

ELF文件之三——使用链接脚本-2个函数
摘要:main.c int main() { return 0; } int add() { return 0; } View Code main.o的比较 与之二相比,section header offset由0x90变为0xA4,增加0x14,即add函数的大小 需要注意的是,后面section h 阅读全文

posted @ 2020-02-09 17:51 yanhc 阅读(277) 评论(0) 推荐(0)

ELF文件之二——使用链接脚本
该文被密码保护。

posted @ 2020-02-09 17:05 yanhc 阅读(38) 评论(0) 推荐(0)

gcc, ld
摘要:GCC gcc除了具备基本的c文件编译功能外,还把其它工具的功能也集成了进来,比如as的汇编功能,ld的链接功能。 因此,gcc也可以通过-Wa, option,将option传给汇编器as;也可以通过-Wl, option,将option传给链接器ld。 -N,gcc手册中没看到该选项,这是属于链 阅读全文

posted @ 2020-02-06 20:31 yanhc 阅读(3550) 评论(0) 推荐(0)

导航