Eric Roller's Development Blog

Mac OS X 10.4 SDK: crt1.o w/o -mlong-branch

- Posted in macOS by

Compiling an application for the MacOX10.4u SDK (with Xcode 3.2.4, GCC 4.2.1) results in this linker warning:

ld: warning: object file compiled with -mlong-branch which is no longer needed. To remove this warning, recompile without -mlong-branch: /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/crt1.o

This is not a critical issue and can be ignored. However, it can also be fixed as shown by an answer from Bernhard Baehr on lists.apple.com:

What needs to be done is to recompile the Csu package which can be found on Apple's opensource archive, e.g. the one for 10.4.11 x86 where the -mlong_branch flag has already been removed: http://www.opensource.apple.com/release/mac-os-x-10411x86 http://www.opensource.apple.com/tarballs/Csu/Csu-71.tar.gz

Then it's just a question of recompiling it:

cd ~/Downloads
tar zxvf Csu-71.tar.gz
cd Csu-71
make RC_ARCHS="ppc ppc64 i386 x86_64"

Then we can replace the (stripped) object file in the SDK:

cd /Developer/SDKs/MacOSX10.4u.sdk/usr/lib/
sudo mv crt1.o{,.org}
sudo strip -S ~/Downloads/Csu-71/crt1.o -o crt1.o
sudo chmod 644 crt1.o