summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp20
-rw-r--r--lld/test/mach-o/exe-segment-overlap.yaml24
-rw-r--r--lld/test/mach-o/hello-world-arm64.yaml2
-rw-r--r--lld/test/mach-o/hello-world-armv6.yaml2
-rw-r--r--lld/test/mach-o/hello-world-armv7.yaml2
-rw-r--r--lld/test/mach-o/hello-world-x86.yaml2
-rw-r--r--lld/test/mach-o/hello-world-x86_64.yaml6
7 files changed, 29 insertions, 29 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
index 7fb49308833..ad8f8bfa73e 100644
--- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
@@ -160,6 +160,26 @@ void MachOLinkingContext::configure(HeaderFileType type, Arch arch, OS os,
_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
diff --git a/lld/test/mach-o/exe-segment-overlap.yaml b/lld/test/mach-o/exe-segment-overlap.yaml
index ec818969de6..1fbc8412318 100644
--- a/lld/test/mach-o/exe-segment-overlap.yaml
+++ b/lld/test/mach-o/exe-segment-overlap.yaml
@@ -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
diff --git a/lld/test/mach-o/hello-world-arm64.yaml b/lld/test/mach-o/hello-world-arm64.yaml
index f6b03064875..a0555e9cc42 100644
--- a/lld/test/mach-o/hello-world-arm64.yaml
+++ b/lld/test/mach-o/hello-world-arm64.yaml
@@ -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
diff --git a/lld/test/mach-o/hello-world-armv6.yaml b/lld/test/mach-o/hello-world-armv6.yaml
index c24d0897795..746ee094da6 100644
--- a/lld/test/mach-o/hello-world-armv6.yaml
+++ b/lld/test/mach-o/hello-world-armv6.yaml
@@ -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
diff --git a/lld/test/mach-o/hello-world-armv7.yaml b/lld/test/mach-o/hello-world-armv7.yaml
index 54f737bda52..bfc03c382a0 100644
--- a/lld/test/mach-o/hello-world-armv7.yaml
+++ b/lld/test/mach-o/hello-world-armv7.yaml
@@ -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
diff --git a/lld/test/mach-o/hello-world-x86.yaml b/lld/test/mach-o/hello-world-x86.yaml
index d8f7b52d6ae..de453ed1ac4 100644
--- a/lld/test/mach-o/hello-world-x86.yaml
+++ b/lld/test/mach-o/hello-world-x86.yaml
@@ -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
diff --git a/lld/test/mach-o/hello-world-x86_64.yaml b/lld/test/mach-o/hello-world-x86_64.yaml
index 985ab5f31cf..83d4fcb3260 100644
--- a/lld/test/mach-o/hello-world-x86_64.yaml
+++ b/lld/test/mach-o/hello-world-x86_64.yaml
@@ -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
#
OpenPOWER on IntegriCloud