[lld] r259426 - MachoFile should default to using subsections_via_symbols.
Pete Cooper via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 14:24:44 PST 2016
Author: pete
Date: Mon Feb 1 16:24:44 2016
New Revision: 259426
URL: http://llvm.org/viewvc/llvm-project?rev=259426&view=rev
Log:
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.
Added:
lld/trunk/test/mach-o/subsections-via-symbols-default.yaml
Modified:
lld/trunk/lib/ReaderWriter/MachO/File.h
Modified: lld/trunk/lib/ReaderWriter/MachO/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/File.h?rev=259426&r1=259425&r2=259426&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/File.h (original)
+++ lld/trunk/lib/ReaderWriter/MachO/File.h Mon Feb 1 16:24:44 2016
@@ -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 {
Added: lld/trunk/test/mach-o/subsections-via-symbols-default.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/subsections-via-symbols-default.yaml?rev=259426&view=auto
==============================================================================
--- lld/trunk/test/mach-o/subsections-via-symbols-default.yaml (added)
+++ lld/trunk/test/mach-o/subsections-via-symbols-default.yaml Mon Feb 1 16:24:44 2016
@@ -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
More information about the llvm-commits
mailing list