diff options
| author | Pete Cooper <peter_cooper@apple.com> | 2016-02-01 22:24:44 +0000 |
|---|---|---|
| committer | Pete Cooper <peter_cooper@apple.com> | 2016-02-01 22:24:44 +0000 |
| commit | 55634d8e8db0f9211771b043fd8a25750a0c2081 (patch) | |
| tree | a5c813dad0514c4e3bc81139ffea57d8f319d0b1 | |
| parent | 4b198802b39dce28cf511237d4697c35dbf4c5c6 (diff) | |
| download | bcm5719-llvm-55634d8e8db0f9211771b043fd8a25750a0c2081.tar.gz bcm5719-llvm-55634d8e8db0f9211771b043fd8a25750a0c2081.zip | |
MachoFile should default to using subsections_via_symbols.
When we parse a MachoFile, we set a number of members from the parsed
file, for example, subsectionsViaSymbols.
However, a number of passes, such as ObjCPass, create local copies of
MachoFile and don't get the benefit of setting flags and other fields in
the parser. Instead we can just give a more sensible default as the parser
will definitely get the correct value from the file anyway.
llvm-svn: 259426
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/File.h | 2 | ||||
| -rw-r--r-- | lld/test/mach-o/subsections-via-symbols-default.yaml | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lld/lib/ReaderWriter/MachO/File.h b/lld/lib/ReaderWriter/MachO/File.h index 04b8eeb494b..f282d5da204 100644 --- a/lld/lib/ReaderWriter/MachO/File.h +++ b/lld/lib/ReaderWriter/MachO/File.h @@ -252,7 +252,7 @@ private: MachOLinkingContext::ObjCConstraint _objcConstraint = MachOLinkingContext::objc_unknown; uint32_t _swiftVersion = 0; - normalized::FileFlags _flags = 0; + normalized::FileFlags _flags = llvm::MachO::MH_SUBSECTIONS_VIA_SYMBOLS; }; class MachODylibFile : public SharedLibraryFile { diff --git a/lld/test/mach-o/subsections-via-symbols-default.yaml b/lld/test/mach-o/subsections-via-symbols-default.yaml new file mode 100644 index 00000000000..93ddbc943f9 --- /dev/null +++ b/lld/test/mach-o/subsections-via-symbols-default.yaml @@ -0,0 +1,28 @@ +# RUN: lld -flavor darwin -ios_simulator_version_min 5.0 -arch x86_64 -r %s -o %t +# RUN: llvm-readobj -file-headers %t | FileCheck %s + +# Make sure that we have an objc image info in the output. It should have +# been generated by the objc pass. + +--- !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_imageinfo + type: S_REGULAR + attributes: [ S_ATTR_NO_DEAD_STRIP ] + address: 0x0000000000000100 + content: [ 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00 ] +... + +# The ObjC pass creates a new image info in a new MachoFile internal to the pass. +# Make sure that we still have MH_SUBSECTIONS_VIA_SYMBOLS in the output file, even +# though that file in the ObjCPass didn't get it set from being parsed. + +# CHECK: MH_SUBSECTIONS_VIA_SYMBOLS
\ No newline at end of file |

