Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 538602 - sys-libs/csu: updated ebuild for csu-85 and fixes for powerpc-*-darwin8
Summary: sys-libs/csu: updated ebuild for csu-85 and fixes for powerpc-*-darwin8
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-02 23:58 UTC by Michael Weiser
Modified: 2015-03-01 09:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
patch for ebuild csu-79 and updated ebuild for csu-85 (csu-79_85-darwin8.tar.gz,2.91 KB, patch)
2015-02-02 23:59 UTC, Michael Weiser
Details | Diff
updated ebuild for csu-85 (csu-85.ebuild-1.patch,775 bytes, patch)
2015-02-11 19:47 UTC, Michael Weiser
Details | Diff
patch to guard against Availability.h usage on anythng other than arm (csu-85-arm-availability.patch,429 bytes, patch)
2015-02-11 19:48 UTC, Michael Weiser
Details | Diff
updated patch to ebuild of csu-85 (csu-85.ebuild-2.patch,1.12 KB, patch)
2015-02-11 20:00 UTC, Michael Weiser
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weiser 2015-02-02 23:58:07 UTC
Compiling gcc-apple-4.2.1_p5666-r2 on powerc-apple-darwin8 would fail on linking cc1plusplus with error

bl PPC branch out of range (<large number> max is +/-16MB): from __start (0x00000000) to ___darwin_gcc3_preregister_frame_info (0x<large number>)

This was apparently manually worked around by calling that function via a pointer, creating sort of a manual branch island.

Recent versions of csu compile everything with -Os. This causes the indirect call via function pointer to be optimized out. It seems to be expected that ld64 is able to and does automatically create branch islands as needed. But that doesn't seem to happen, perhaps because of the old deployment target.

Compiling with only -O makes the function pointer stay in the object and the above error disappears.

Reproducible: Always
Comment 1 Michael Weiser 2015-02-02 23:59:16 UTC
Created attachment 395426 [details, diff]
patch for ebuild csu-79 and updated ebuild for csu-85

tested on 10.4 PPC, 10.4 x86 and 10.10 x86_64
Comment 2 Fabian Groffen gentoo-dev 2015-02-03 21:04:20 UTC
Thanks, committed
Comment 3 DIZ 2015-02-10 15:24:07 UTC
I'm working on a G4 System 10.5.8.

I get this error:

 * Csu-85.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                          [ ok ]
>>> Unpacking source...
>>> Unpacking Csu-85.tar.gz to /Volumes/GENTOO/var/tmp/portage/sys-libs/csu-85/work
>>> Source unpacked in /Volumes/GENTOO/var/tmp/portage/sys-libs/csu-85/work
>>> Preparing source in /Volumes/GENTOO/var/tmp/portage/sys-libs/csu-85/work/Csu-85 ...
>>> Source prepared.
>>> Configuring source in /Volumes/GENTOO/var/tmp/portage/sys-libs/csu-85/work/Csu-85 ...
>>> Source configured.
>>> Compiling source in /Volumes/GENTOO/var/tmp/portage/sys-libs/csu-85/work/Csu-85 ...
make -j2 USRLIBDIR=/Volumes/GENTOO/lib
cc -r  -Os -mmacosx-version-min=10.4 -mdynamic-no-pic -nostdlib -keep_private_externs start.s crt.c dyld_glue.s -o crt1.v1.o  -DCRT -DOLD_LIBSYSTEM_SUPPORT
cc -r  -Os -mmacosx-version-min=10.5 -nostdlib -keep_private_externs start.s crt.c dyld_glue.s -o crt1.v2.o  -DCRT
start.s:25:26: error: Availability.h: No such file or directory
start.s:25:26: error: Availability.h: No such file or directory
Makefile:74: recipe for target 'crt1.v2.o' failed
make: *** [crt1.v2.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:71: recipe for target 'crt1.v1.o' failed
make: *** [crt1.v1.o] Error 1


start.s is including Availability.h, which isn't found. I changed the include line in start.s:

#include <AvailabilityMacros.h>

And the make succeeded....

Maybe the Makefile needs to check for older (Tiger, Leopard) Mac SDKs?

Or maybe I'm way off base!

Thanks for any help....
Comment 4 Michael Weiser 2015-02-10 17:07:22 UTC
This is weird because my 10.5.8 PPC as well as Intel installations do have /usr/include/Availability.h. Is it possible that you've got an older Xcode? I've got XCode 3.1.3 and 3.1.4 installed and that seems to provide it via the DevSDKLeo package:

osx105:~ michael$ lsbom /Library/Receipts/boms/com.apple.pkg.DevSDKLeo.bom | grep Availability\.h
./usr/include/Availability.h	100644	0/0	5281	1636502014
Comment 5 Fabian Groffen gentoo-dev 2015-02-11 08:34:06 UTC
Reopening, maybe we should do a simple build trick with ln -s'ing AvailabilityMacros.h and using a -I directive to make it succeed if that thing exists?
Comment 6 Michael Weiser 2015-02-11 18:36:14 UTC
As I understand the problem, we could just move the darwin8 patch out of the darwin8 conditional block and also apply it on darwin9.

But what is our support objective here? My understanding was that since Xcode is freely available it can be expected that the latest one available for a given OS X version is installed. It's also entirely possible that Availability.h just went missing somehow on DIZ's system.

I'll dig into different Xcode versions for 10.5 and check when Availability.h appeared.
Comment 7 Michael Weiser 2015-02-11 19:47:56 UTC
Created attachment 396200 [details, diff]
updated ebuild for csu-85

Ah, while I was waiting for the Xcodes to download I had another look at the problematic code and realised that Availability.h is only included for iPhoneOS version checking in a bit of code that's guarded with #ifdef __arm__. So I did the same for the include which seems to do the trick. Tested on 10.4, 10.5 and 10.10 on Intel.
Comment 8 Michael Weiser 2015-02-11 19:48:41 UTC
Created attachment 396202 [details, diff]
patch to guard against Availability.h usage on anythng other than arm
Comment 9 Michael Weiser 2015-02-11 20:00:09 UTC
Created attachment 396204 [details, diff]
updated patch to ebuild of csu-85

Went a bit overboard in removing special cases in the last patch. This one should be fine. Tested on 10.4, 10.5 and 10.10 Intel as well as 10.4 PPC.
Comment 10 Michael Weiser 2015-02-11 21:23:37 UTC
note2self: Availability.h present in XCode >= 3.1. Not present in 2.5. Download for 3.0 broken.
Comment 11 Fabian Groffen gentoo-dev 2015-02-28 14:11:47 UTC
I've added a compiler check to see if Availability.h is there, that should do it, right?
Comment 12 Michael Weiser 2015-02-28 23:45:41 UTC
Looks fine to me. But have you had a look at https://bugs.gentoo.org/attachment.cgi?id=396202? That seems to fix the cause instead of working around the symptom. Since nobody is likely to try to compile csu for arm with an old Xcode on <= 10.5 it seems a much simpler fix to me.
Comment 13 Fabian Groffen gentoo-dev 2015-03-01 09:10:00 UTC
right, that looks much easier
Comment 14 Fabian Groffen gentoo-dev 2015-03-01 09:16:02 UTC
committed instead, thanks!