id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,port 47776,ld64 @2 Add wrapper script to select compatible linker,steve+macports@…,jeremyhu,"==== Introduction ==== It could be useful to add a wrapper script to switch between ld64 versions depending on the supplied arguments. In particular, ld64-127 or ld64-97 are required for ppc but in general it is preferable to use a more recent version. Since ld64 already supports multiple architectures, it isn't especially subversive to wrap it in a script that extends that support to legacy architectures. I'm attaching a script that calls ld-97 for ppc on 10.4 and earlier, ld-127 for ppc on 10.5 and ld-latest otherwise. It inserts the list of supported ppc architectures on stderr when called as ld -v. I haven't integrated the script with MacPorts yet, but I imagine it is possible to add as an additional subport and/or variant of ld64, with dependencies on existing subports. ==== Analysis ==== This isn't such a big deal for gcc since each architecture has a separate toolchain, into which the correct ld can be symlinked. There are also mechanisms in clang for choosing which ld will be used: 1. Create a separate toolchain in a similar way to what gcc does, eg under /usr/local/powerpc-apple-darwin10-llvm-3.6. If ld exists in the same directory as clang, it will be found. 2. Use COMPILER_PATH or -B to specify a path to search for ld. 3. Call clang -target powerpc-apple-macosx10.4 instead of clang -arch ppc -mmacosx-version-min=10.4 and symlink powerpc-apple-macosx10.4-ld to ld-97. Unfortunately none of these solutions works seamlessly when you want to build a universal binary - in each case it would be necessary to build a ppc binary separately and then call lipo yourself instead of letting clang do it for you (the -B and -target options cannot be set per-arch with -Xarch_ppc etc). One possible workaround for universal builds is to choose the linker based on the minimum supported version, rather than the supported archs - ie to support 10.4+ use ld-97, for 10.5+ use ld-127 etc. This approach is compatible with COMPILER_PATH or -B, it's just necessary to create a directory for each linker version so it can be symlinked as simply ld. ",enhancement,new,Normal,,ports,,,,larryv cooljeanius,ld64