llvm-nm and LLVM Tapi not parsing Tapi correctly?

Hi:
I’m currently using the .TBDs shipped with Xcode 12.5.

Running llvm-nm /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libSystem.B.tbd

only prints the symbols listed in the first “slice” of the tbd file:


➜ LLVMRelease bin/llvm-nm /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libSystem.B.tbd

/usr/lib/libSystem.B.dylib (for architecture armv7):
00000000 S ___System_BVersionNumber
00000000 S ___System_BVersionString
00000000 S ___crashreporter_info__
00000000 S _libSystem_atfork_child
00000000 S _libSystem_atfork_parent
00000000 S _libSystem_atfork_prepare
00000000 S _mach_init_routine

/usr/lib/libSystem.B.dylib (for architecture armv7s):
00000000 S ___System_BVersionNumber
00000000 S ___System_BVersionString
00000000 S ___crashreporter_info__
00000000 S _libSystem_atfork_child
00000000 S _libSystem_atfork_parent
00000000 S _libSystem_atfork_prepare
00000000 S _mach_init_routine

/usr/lib/libSystem.B.dylib (for architecture arm64):
0000000000000000 S ___crashreporter_info__
0000000000000000 S _libSystem_atfork_child
0000000000000000 S _libSystem_atfork_parent
0000000000000000 S _libSystem_atfork_prepare
0000000000000000 S _mach_init_routine

/usr/lib/libSystem.B.dylib (for architecture arm64e):
0000000000000000 S ___crashreporter_info__
0000000000000000 S _libSystem_atfork_child
0000000000000000 S _libSystem_atfork_parent
0000000000000000 S _libSystem_atfork_prepare
0000000000000000 S _mach_init_routine

The remaining slices of the tbd file seems to be unparsed / unhandled by LLVM’s Tapi facility. Is this intended or should I open a issue at bugzilla?
What’s the intended TapiParser library to use?

I’ve uploaded the tbd file to https://gist.github.com/Naville/cd24dc26d8e5f770ddceb30d125d86b9 in case anyone needs to reproduce this

Zhang

Hi Zhang,

If the slice you’re referring to is the embedded tbd content after each --- !tapi-tbd, that represents a different dylib thats reexported by the top level library. In this case, libSystem is the top level library and it’s follow up contents (e.g. libcache) are the reexports. This isn’t shown by default in nm. To display this information you can add the option --add-inlinedinfo to llvm-nm.

https://llvm.org/docs/CommandGuide/llvm-nm.html#cmdoption-llvm-nm-add-inlinedinfo

  • Cyndy