[mach-o] Use default for min OS version when not specified on command line.

This matches the current darwin linker.

llvm-svn: 219376
This commit is contained in:
Nick Kledzik 2014-10-09 01:01:16 +00:00
parent 2ae2de7562
commit cb2018f57c
7 changed files with 29 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
#