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