diff --git a/llvm/test/tools/llvm-nm/AArch64/Inputs/kextbundle.macho-aarch64 b/llvm/test/tools/llvm-nm/AArch64/Inputs/kextbundle.macho-aarch64 new file mode 100755 index 000000000000..4a21c2e38408 Binary files /dev/null and b/llvm/test/tools/llvm-nm/AArch64/Inputs/kextbundle.macho-aarch64 differ diff --git a/llvm/test/tools/llvm-nm/AArch64/lit.local.cfg b/llvm/test/tools/llvm-nm/AArch64/lit.local.cfg new file mode 100644 index 000000000000..7184443994b6 --- /dev/null +++ b/llvm/test/tools/llvm-nm/AArch64/lit.local.cfg @@ -0,0 +1,2 @@ +if not 'AArch64' in config.root.targets: + config.unsupported = True diff --git a/llvm/test/tools/llvm-nm/AArch64/macho-kextbundle.test b/llvm/test/tools/llvm-nm/AArch64/macho-kextbundle.test new file mode 100644 index 000000000000..28c9f249efb4 --- /dev/null +++ b/llvm/test/tools/llvm-nm/AArch64/macho-kextbundle.test @@ -0,0 +1,4 @@ +RUN: llvm-nm %p/Inputs/kextbundle.macho-aarch64 | FileCheck %s + +CHECK: 0000000000004014 s _bar.stub +CHECK: 0000000000004000 T _foo diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index b6ac9c20a946..2b18a3ce8c31 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -1004,6 +1004,10 @@ static char getSymbolNMTypeChar(MachOObjectFile &Obj, basic_symbol_iterator I) { StringRef SectionName; Obj.getSectionName(Ref, SectionName); StringRef SegmentName = Obj.getSectionFinalSegmentName(Ref); + if (Obj.is64Bit() && + Obj.getHeader64().filetype == MachO::MH_KEXT_BUNDLE && + SegmentName == "__TEXT_EXEC" && SectionName == "__text") + return 't'; if (SegmentName == "__TEXT" && SectionName == "__text") return 't'; if (SegmentName == "__DATA" && SectionName == "__data")