问题描述
我正在调试我的程序,然后发生最后一行,我该如何解决它?我使用 -fno-builtin 来查看 strcpy(),但它显示 __ strcpy_sse2_unaligned 正在被调用。
I was debugging my program, then the last line happened, how can I fix it? I used the -fno-builtin to have a look at the strcpy() but it shows that the __strcpy_sse2_unaligned is getting called.
root@19:~/booksrc# gcc -fno-builtin -g char_array2.c root@19:~/booksrc# gdb -q ./a.out Reading symbols from ./a.out...done. (gdb) list 1 #include <stdio.h> 2 #include <string.h> 3 4 int main() { 5 char str_a[20]; 6 7 strcpy(str_a, "Hello World!\n"); 8 printf(str_a); 9 } (gdb) break 6 Breakpoint 1 at 0x708: file char_array2.c, line 6. (gdb) break strcpy Breakpoint 2 at 0x5a0 (gdb) break 8 Breakpoint 3 at 0x71b: file char_array2.c, line 8. (gdb) run Starting program: /root/booksrc/a.out Breakpoint 1, main () at char_array2.c:7 7 strcpy(str_a, "Hello World!\n"); (gdb) cont Continuing. Breakpoint 2, __strcpy_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S:47 47 ../sysdeps/x86_64/multiarch/strcpy-sse2-unaligned.S: No such file or directory.
推荐答案
__ strcpy_sse2_unaligned 是在你的机器上使用的 strcpy 的实现。 glibc使用。
__strcpy_sse2_unaligned is the implementation of strcpy which is used on your machine. glibc automatically chooses an optimized implementation based on CPU characteristics, using an IFUNC resolver.
这不需要对GCC和GCC内建程序做任何事情。 GCC发出对 strcpy 的调用。这只是glibc碰巧调用它的函数,它 __ strcpy_sse2_unaligned 。
This does not have to do anything with GCC and GCC built-ins. GCC emits a call to strcpy. It is just that glibc happens to call the function which it __strcpy_sse2_unaligned.
这篇关于__strcpy_sse2_unaligned与-fno-builtin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!