
csapp
天蓝岚
这个作者很懒,什么都没留下…
展开
-
利用union或者objdump判断机器字节序
利用union #include <stdio.h> int main() { union { short int value; char b[sizeof(short int)]; } tmp; tmp.value = 0x1234; printf("b[0] = 0x%x, b[1] = 0x%x\n", tmp.b[0], tmp.b[1]); return 0; } 低位字节在放在低地址即小顶端,高位字节放在低地址即大顶端 输出b[.原创 2021-04-13 09:55:49 · 141 阅读 · 0 评论 -
ubuntu下编译csapp代码出错
cc -Og -Wall -I …/include -I . hello.c …/src/csapp.o -lpthread -lm -o hello /usr/bin/ld: …/src/csapp.o: relocation R_X86_64_32 against `.rodata.str1.1’ can not be used when making a PIE object; recompile with -fPIE collect2: error: ld returned 1 exit s原创 2021-04-12 14:02:48 · 659 阅读 · 0 评论