使用gcc时"-h"选项的含义是什么?

Nan*_*iao 2 c gcc solaris redis

我在Solaris 10上构建redis C客户端,生成动态库的最后一步是这样的:

cc -G -o libhiredis.so -h libhiredis.so.0.11  net.o hiredis.o sds.o async.o
Run Code Online (Sandbox Code Playgroud)

ccgcc:

bash-3.00# which cc
/usr/local/bin/cc
bash-3.00# ls -lt /usr/local/bin/cc
lrwxrwxrwx   1 root     root           3 Mar 24  2011 /usr/local/bin/cc -> gcc
bash-3.00# /usr/local/bin/gcc -v
Reading specs from /data/local/bin/../lib/gcc/sparc-sun-solaris2.10/3.4.6/specs  
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --          enable-shared --enable-languages=c,c++,f77
Thread model: posix
gcc version 3.4.6
Run Code Online (Sandbox Code Playgroud)

https://gcc.gnu.org/onlinedocs/gcc/Option-Index.html,我知道"-G"选项是"创建共享对象".但是"-h"是什么意思?我在https://gcc.gnu.org/onlinedocs/gcc/Option-Index.html中找不到它.

pan*_*kaj 5

它是一个链接器选项(只用'man ld'检查):

  -h name 
  -soname=name
           When creating an ELF shared object, set the internal DT_SONAME
           field to the specified name.  When an executable is linked with a
           shared object which has a DT_SONAME field, then when the executable
           is run the dynamic linker will attempt to load the shared object
           specified by the DT_SONAME field rather than the using the file
           name given to the linker.
Run Code Online (Sandbox Code Playgroud)