diff options
author | Pete Cooper <peter_cooper@apple.com> | 2016-02-01 19:10:10 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2016-02-01 19:10:10 +0000 |
commit | 4a92469260d320ca97c958fec99ed23a4b47c04c (patch) | |
tree | 15491b3412eca7764b306b24f3071e793560fc1e | |
parent | 45dee061770479c276b775439a4e6082c361a640 (diff) | |
download | bcm5719-llvm-4a92469260d320ca97c958fec99ed23a4b47c04c.tar.gz bcm5719-llvm-4a92469260d320ca97c958fec99ed23a4b47c04c.zip |
Atomize the ObjC category list section.
__DATA, __objc_catlist contains a list of pointers to categories.
We want to atomize it so that the ObjC pass can later optimize and remove
categories. That will be a later patch.
llvm-svn: 259386
-rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp | 3 | ||||
-rw-r--r-- | lld/test/mach-o/objc-category-list-atom.yaml | 70 |
2 files changed, 73 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp index 32ad88fe396..c7f1e3555d6 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp @@ -89,6 +89,7 @@ const MachORelocatableSectionToAtomType sectsToAtomType[] = { ENTRY("__DATA", "__thread_bss", S_THREAD_LOCAL_ZEROFILL, typeTLVInitialZeroFill), ENTRY("__DATA", "__objc_imageinfo", S_REGULAR, typeObjCImageInfo), + ENTRY("__DATA", "__objc_catlist", S_REGULAR, typeObjC2CategoryList), ENTRY("", "", S_INTERPOSING, typeInterposingTuples), ENTRY("__LD", "__compact_unwind", S_REGULAR, typeCompactUnwindInfo), @@ -181,6 +182,8 @@ void sectionParseInfo(DefinedAtom::ContentType atomType, atomizeCU), ENTRY(typeGOT, 4, scopeLinkageUnit, mergeByContent, atomizePointerSize), + ENTRY(typeObjC2CategoryList, 4, scopeTranslationUnit, mergeByContent, + atomizePointerSize), ENTRY(typeUnknown, 1, scopeGlobal, mergeNo, atomizeAtSymbols) }; diff --git a/lld/test/mach-o/objc-category-list-atom.yaml b/lld/test/mach-o/objc-category-list-atom.yaml new file mode 100644 index 00000000000..e0611712419 --- /dev/null +++ b/lld/test/mach-o/objc-category-list-atom.yaml @@ -0,0 +1,70 @@ +# RUN: lld -flavor darwin -arch x86_64 -r -print_atoms %s -o %t | FileCheck %s +# RUN: lld -flavor darwin -arch x86_64 -r -print_atoms %t -o %t2 | FileCheck %s + + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +compat-version: 0.0 +current-version: 0.0 +has-UUID: false +OS: unknown +sections: + - segment: __DATA + section: __objc_catlist + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + alignment: 8 + address: 0x00000000000003F8 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] + relocations: + - offset: 0x00000008 + type: X86_64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 0 + - offset: 0x00000000 + type: X86_64_RELOC_UNSIGNED + length: 3 + pc-rel: false + extern: true + symbol: 1 +undefined-symbols: + - name: __category1 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 + - name: __category2 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 +page-size: 0x00000000 +... + +# Make sure we atomize the category list section by pointer sized atoms. + +# CHECK: path: '<linker-internal>' +# CHECK: defined-atoms: +# CHECK: - type: objc-category-list +# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] +# CHECK: merge: by-content +# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: pointer64 +# CHECK: offset: 0 +# CHECK: target: __category2 +# CHECK: - type: objc-category-list +# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ] +# CHECK: merge: by-content +# CHECK: alignment: 8 +# CHECK: references: +# CHECK: - kind: pointer64 +# CHECK: offset: 0 +# CHECK: target: __category1 +# CHECK: undefined-atoms: +# CHECK: - name: __category1 +# CHECK: - name: __category2 +# CHECK: ... |