最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

macos - Can a symbol that is both hidden and not hidden in an archive be exported? - Stack Overflow

programmeradmin1浏览0评论

Question related to Symbol Visibility on MacOSX: I have a static library that I wish to apply an exported symbols list on using the ld command. I'm hitting this problem when I run xcrun ld on the build static library: cannot export hidden symbol: __foo.

foo is a symbol that's in a transitive dependency whose source code I do not have available. Running nm -m on the symbol provides the following output format:

000000000000WXYZ (__TEXT,__const) weak external __foo
000000000000LMNO (__TEXT,__const) weak private external __foo
000000000000PQRS (__TEXT,__const) weak external __foo
000000000000ABCD (__TEXT,__const) weak external __foo

In the objdump output, the weak private external shows as .hidden while others do not.

This is the only symbol in the entire binary that is both weak external and weak private external. I am trying to figure out what is the best way to handle this case. Do I always not export weak private external symbols, or is there some other check I need to do?

Here it states that if all inputs are private extern, the output will be private extern only and not be exported which tells me that I should be exporting this symbol. But I obviously cannot because of the error above.

Command to apply the exported symbols list: xcrun ld -sdk iphoneos -arch arm64 -exported_symbols_list foo.txt -fexceptions -ObjC.

nm command: nm -m foo.a objdump command: nm -t foo.a

发布评论

评论列表(0)

  1. 暂无评论