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
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
Thanks, committed
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....
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
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?
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.
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.
Created attachment 396202 [details, diff] patch to guard against Availability.h usage on anythng other than arm
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.
note2self: Availability.h present in XCode >= 3.1. Not present in 2.5. Download for 3.0 broken.
I've added a compiler check to see if Availability.h is there, that should do it, right?
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.
right, that looks much easier
committed instead, thanks!