Gentoo Archives: gentoo-alt

From: Michael Weiser <michael@×××××××××××××××.net>
To: gentoo-alt@l.g.o
Subject: [gentoo-alt] {Spam?} Why is ld-wrapper forcing -macosx_version_min?
Date: Sun, 25 Jan 2015 12:53:51
Message-Id: 20150125125314.GA88972@weiser.dinsnail.net
1 Hi,
2
3 does anyone remember, why the prefix ld wrapper from
4 toolchain-prefix-wrapper-0.3.1723 forces the -macosx_version_min onto
5 the ld command line?
6
7 It breaks cross-compilation for e.g. armv6 using our shiny new
8 binutils-apple-6.1 and a multitarget clang:
9
10 michael@osx1010:~ # which clang
11 /Users/michael/nobak/gentoo/usr/bin/clang
12 michael@osx1010:~ # clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -arch armv7 -o t t.c
13 ld: building for MacOSX, but linking against dylib built for iOS Simulator file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/lib/libSystem.dylib' for architecture armv7
14 x86_64-apple-darwin14-clang-3.5.1: error: linker command failed with exit code 1 (use -v to see invocation)
15
16 Xcode clang accepts the same command line nicely and produces arm
17 output:
18
19 michael@osx1010:~ # which clang
20 /usr/bin/clang
21 michael@osx1010:~ # clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -arch armv7 -o t t.c
22 michael@osx1010:~ # file t
23 t: Mach-O executable arm
24
25 After removing the parameter override from the ld wrapper using the
26 attached patch and changed ebuild, all is well:
27
28 michael@osx1010:~ # which clang
29 /Users/michael/nobak/gentoo/usr/bin/clang
30 michael@osx1010:~ # clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -arch armv7 -o t t.c
31 michael@osx1010:~ # file t
32 t: Mach-O arm_v7 executable
33
34 Also, I do think the override is not neccessary (at least any more)
35 because the way ld64 is configured by binutils-apple now it will pick up
36 its default deployment target from the ebuild environment. And that's
37 explicitly set by all the prefix darwin profiles.
38
39 michael@osx1010:~ # ld -v
40 @(#)PROGRAM:ld PROJECT:ld64-241.9 (Gentoo binutils-apple-6.1)
41 configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m arm64
42 [...]
43 ld: warning: -arch not specified
44 ld: warning: -macosx_version_min not specified, assuming 10.9
45 ld: no object files specified for inferred architecture x86_64
46
47 Relevant code from ld64's Option.cpp:
48
49 switch ( type ) {
50 case CPU_TYPE_I386:
51 case CPU_TYPE_X86_64:
52 if ( (fMacVersionMin == ld::macVersionUnset) && (fIOSVersionMin == ld::iOSVersionUnset) && (fOutputKind != Options::kObjectFile) ) {
53 #ifdef DEFAULT_MACOSX_MIN_VERSION
54 warning("-macosx_version_min not specified, assuming " DEFAULT_MACOSX_MIN_VERSION);
55 setMacOSXVersionMin(DEFAULT_MACOSX_MIN_VERSION);
56 #else
57 warning("-macosx_version_min not specified, assuming 10.6");
58 fMacVersionMin = ld::mac10_6;
59 #endif
60 }
61 break;
62
63 So what do we think? Can we drop the option override from the ld
64 wrapper?
65 --
66 Micha

Attachments

File name MIME type
toolchain-prefix-wrapper-0.3.1723-no-mac-osx-min-version.patch text/x-diff
binutils-config-4.ebuild text/plain

Replies