问题描述
通过LDFLAGS连接gcc_s和gcc有什么区别?
gcc_s是一个静态库和gcc共享库?
what is the difference between linking against gcc_s and gcc by means of LDFLAGS?Is gcc_s a static library and gcc shared library?
因为我正在寻找一个解决方案,其中提到链接到gcc,而只有gcc_s在我的案件。我想知道真正的区别。
Because I was looking for a solution where it is mentioned to link against gcc whereas only gcc_s works in my case. I wish to know the real difference.
<<
隐藏符号/some/library/path.a(_filename.o)中的隐藏符号`__name_here'由DSO引用
<<hidden symbol `__name_here' in /some/library/path.a(_filename.o) is referenced by DSO
在这种情况下,问题通常通过向链接标志(LDFLAGS)中添加-l gcc或 gcc -print-libgcc-file-name
来解决。但是,不像我的其他常规平台(i386,amd64,sparc64)在这里是不够的。经过很多头部敲击(公平,它也来自音乐)我意识到,这个标志是必要的,当链接libc 和最终的可执行文件。
链接:
In this case, the problem is usually solved by adding either "-l gcc" or "gcc -print-libgcc-file-name
" to the linking flags (LDFLAGS). However, unlike my other regular platforms (i386, amd64, sparc64) here it wasn't enough. After a lot of head-banging (to be fair, it also comes from the music) I realized that this flag is necessary both when linking the libc and the final executable file.link: http://people.defora.org/~khorben/200903.html
推荐答案
libgcc_s.so
是一个共享库, libgcc.a
是一个静态库。他们不是等价的;可能需要链接两者。 libgcc_s包含在进程中不能有多个副本的全局变量; libgcc中的代码可以安全地链接多次。
libgcc_s.so
is a shared library, libgcc.a
is a static library. They are not equivalent; it may be necessary to link both. libgcc_s contains global variables which must not have multiple copies in a process; the code in libgcc is safe to link multiple times.
这篇关于-lgcc_s和gcc之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!