Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

Commit

Permalink
llvm-nm should show a symbol type of T for symbols in the (__TEXT_EXE…
Browse files Browse the repository at this point in the history
…C,__text) section.

When a the Apple link editor builds a kext bundle file type and the 
value of the -miphoneos-version-min argument is significantly current
(like 11.0) then the (__TEXT,__text) section is changed to the
(__TEXT_EXEC,__text) section.  So it would be nice for llvm-nm to
show symbols in that section with a type of T instead of the generic
type of S for some section other than text, data, etc.

rdar://36262205


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323836 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
enderby committed Jan 31, 2018
1 parent 90018a5 commit 5ee8d5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
Binary file not shown.
2 changes: 2 additions & 0 deletions test/tools/llvm-nm/AArch64/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if not 'AArch64' in config.root.targets:
config.unsupported = True
4 changes: 4 additions & 0 deletions test/tools/llvm-nm/AArch64/macho-kextbundle.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RUN: llvm-nm %p/Inputs/kextbundle.macho-aarch64 | FileCheck %s

CHECK: 0000000000004014 s _bar.stub
CHECK: 0000000000004000 T _foo
4 changes: 4 additions & 0 deletions tools/llvm-nm/llvm-nm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 5ee8d5e

Please sign in to comment.