nm devtoolset 的 .so 文件给出无法识别的文件格式

nm devtoolset's .so files gives File format not recognized

我只是好奇为什么 nm 抱怨:

File format not recognized

如果我这样做:

$ nm /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so
nm: /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so: File format not recognized

但是,同样的命令可以对股票成功执行 /lib64/libstdc++.so.6

它不是共享库。这是一个在编译时使用的 ld 脚本,而不是 运行-time
cat /opt/rh/devtoolset-8/root/usr/lib/gcc/x86_64-redhat-linux/8/libstdc++.so

/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf64-x86-64)
INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared )

对于OUTPUT_FORMATINPUT的解释:见https://sourceware.org/binutils/docs-2.32/ld/LD-Index.html#LD-Index