1

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

文件格式无法识别

如果我做:

$ 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

4

1 回答 1

1

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

/* GNU ld script
使用共享库,但有些函数只在
静态库中,所以次要尝试。*/
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

于 2019-03-13T18:14:39.187 回答