glibc: -DSHARED编译配置

在glibc的源文件中有好多是这样的判断;

__run_exit_handlers (int status, struct exit_function_list **listp,
		     bool run_list_atexit, bool run_dtors)
{
    
    
  /* First, call the TLS destructors.  */
#ifndef SHARED    、、、、、 这里的 SHARED 是怎么来的
  if (&__call_tls_dtors != NULL)
#endif

在MakeConfig文件中:
#Under --enable-shared, we will build a shared library of PIC objects.
#The PIC object files are named foo.os. 为什么用这个后缀 os,
object-suffixes += .os
CPPFLAGS-.os = -DPIC -DSHARED

怎么确定我们的glibc的so有没有用这个 --enable-shared; 目前没有找到好的办法确定,但是一般的库就是shared。

configure文件中的注释
–enable-shared build shared library [default=yes if GNU ld] 、、、 默认是yes

#Check whether --enable-shared was given.
if test "${enable_shared+set}" = set; then :
  enableval=$enable_shared; shared=$enableval
else
  shared=yes    、、、、 默认值yes
fi

猜你喜欢

转载自blog.csdn.net/qq_36428903/article/details/126075056