[lld] r219376 - [mach-o] Use default for min OS version when not specified on command line.
Nick Kledzik
kledzik at apple.com
Wed Oct 8 18:01:16 PDT 2014
Author: kledzik
Date: Wed Oct 8 20:01:16 2014
New Revision: 219376
URL: http://llvm.org/viewvc/llvm-project?rev=219376&view=rev
Log:
[mach-o] Use default for min OS version when not specified on command line.
This matches the current darwin linker.
Modified:
lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
lld/trunk/test/mach-o/exe-segment-overlap.yaml
lld/trunk/test/mach-o/hello-world-arm64.yaml
lld/trunk/test/mach-o/hello-world-armv6.yaml
lld/trunk/test/mach-o/hello-world-armv7.yaml
lld/trunk/test/mach-o/hello-world-x86.yaml
lld/trunk/test/mach-o/hello-world-x86_64.yaml
Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Wed Oct 8 20:01:16 2014
@@ -160,6 +160,26 @@ void MachOLinkingContext::configure(Head
_os = os;
_osMinVersion = minOSVersion;
+ // If min OS not specified on command line, use reasonable defaults.
+ if (minOSVersion == 0) {
+ switch (_arch) {
+ case arch_x86_64:
+ case arch_x86:
+ parsePackedVersion("10.8", _osMinVersion);
+ _os = MachOLinkingContext::OS::macOSX;
+ break;
+ case arch_armv6:
+ case arch_armv7:
+ case arch_armv7s:
+ case arch_arm64:
+ parsePackedVersion("7.0", _osMinVersion);
+ _os = MachOLinkingContext::OS::iOS;
+ break;
+ default:
+ break;
+ }
+ }
+
switch (_outputMachOType) {
case llvm::MachO::MH_EXECUTE:
// If targeting newer OS, use _main
Modified: lld/trunk/test/mach-o/exe-segment-overlap.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/exe-segment-overlap.yaml?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/test/mach-o/exe-segment-overlap.yaml (original)
+++ lld/trunk/test/mach-o/exe-segment-overlap.yaml Wed Oct 8 20:01:16 2014
@@ -1,9 +1,9 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t
+# RUN: lld -flavor darwin -arch x86_64 %s -o %t %p/Inputs/libSystem.yaml
# RUN: llvm-readobj -sections -section-data %t | FileCheck %s
--- !native
defined-atoms:
- - name: start
+ - name: _main
scope: global
content: [ 90 ]
@@ -19,26 +19,6 @@ defined-atoms:
section-name: __CUST/__custom
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-flags: [ ]
-install-name: /usr/lib/libSystem.B.dylib
-sections:
- - segment: __TEXT
- section: __text
- type: S_REGULAR
- attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
- address: 0x0000000000000000
- content: [ 0x55 ]
-
-global-symbols:
- - name: dyld_stub_binder
- type: N_SECT
- scope: [ N_EXT ]
- sect: 1
- value: 0x0000000000000000
-
# CHECK-LABEL: Section {
# CHECK: Name: __text
# CHECK: Segment: __TEXT
Modified: lld/trunk/test/mach-o/hello-world-arm64.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/hello-world-arm64.yaml?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/test/mach-o/hello-world-arm64.yaml (original)
+++ lld/trunk/test/mach-o/hello-world-arm64.yaml Wed Oct 8 20:01:16 2014
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch arm64 -ios_version_min 7.0 %s -o %t && \
+# RUN: lld -flavor darwin -arch arm64 %s -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that arm64 hello-world can be linked into a mach-o executable
Modified: lld/trunk/test/mach-o/hello-world-armv6.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/hello-world-armv6.yaml?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/test/mach-o/hello-world-armv6.yaml (original)
+++ lld/trunk/test/mach-o/hello-world-armv6.yaml Wed Oct 8 20:01:16 2014
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch armv6 -ios_version_min 7.0 %s -o %t && \
+# RUN: lld -flavor darwin -arch armv6 %s -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that armv6 (arm) hello-world can be linked into a mach-o executable
Modified: lld/trunk/test/mach-o/hello-world-armv7.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/hello-world-armv7.yaml?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/test/mach-o/hello-world-armv7.yaml (original)
+++ lld/trunk/test/mach-o/hello-world-armv7.yaml Wed Oct 8 20:01:16 2014
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch armv7 -ios_version_min 7.0 %s -o %t && \
+# RUN: lld -flavor darwin -arch armv7 %s -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that armv7 (thumb) hello-world can be linked into a mach-o executable
Modified: lld/trunk/test/mach-o/hello-world-x86.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/hello-world-x86.yaml?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/test/mach-o/hello-world-x86.yaml (original)
+++ lld/trunk/test/mach-o/hello-world-x86.yaml Wed Oct 8 20:01:16 2014
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch i386 -macosx_version_min 10.8 %s -o %t && \
+# RUN: lld -flavor darwin -arch i386 %s -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that i386 hello-world can be linked into a mach-o executable
Modified: lld/trunk/test/mach-o/hello-world-x86_64.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/hello-world-x86_64.yaml?rev=219376&r1=219375&r2=219376&view=diff
==============================================================================
--- lld/trunk/test/mach-o/hello-world-x86_64.yaml (original)
+++ lld/trunk/test/mach-o/hello-world-x86_64.yaml Wed Oct 8 20:01:16 2014
@@ -1,8 +1,8 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t && \
+# RUN: lld -flavor darwin -arch x86_64 %s -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -dead_strip \
-# RUN: -o %t2 && llvm-nm -m -n %t2 | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 %s -dead_strip -o %t2
+# RUN: llvm-nm -m -n %t2 | FileCheck %s
#
# Test that x86_64 hello-world can be linked into a mach-o executable
#
More information about the llvm-commits
mailing list