···117117# https://web.archive.org/web/20170222224855/http://frank.harvard.edu/~coldwell/toolchain/
118118# https://web.archive.org/web/20170224235700/http://frank.harvard.edu/~coldwell/toolchain/t-linux.diff
119119+ lib.optionalString (targetPlatform != hostPlatform && withoutTargetLibc && enableShared)
120120- (lib.optionalString (!stdenv.targetPlatform.isPower) ''
121121- echo 'libgcc.a: crti.o crtn.o' >> libgcc/Makefile.in
122122- '' + ''
123123- echo 'SHLIB_LC=' >> libgcc/Makefile.in
120120+ (let
121121+122122+ # crt{i,n}.o are the first and last (respectively) object file
123123+ # linked when producing an executable. Traditionally these
124124+ # files are delivered as part of the C library, but on GNU
125125+ # systems they are in fact built by GCC. Since libgcc needs to
126126+ # build before glibc, we can't wait for them to be copied by
127127+ # glibc. At this early pre-glibc stage these files sometimes
128128+ # have different names.
129129+ crtstuff-ofiles =
130130+ if targetPlatform.isPower
131131+ then "ecrti.o ecrtn.o ncrti.o ncrtn.o"
132132+ else "crti.o crtn.o";
133133+134134+ # Normally, `SHLIB_LC` is set to `-lc`, which means that
135135+ # `libgcc_s.so` cannot be built until `libc.so` is available.
136136+ # The assignment below clobbers this variable, removing the
137137+ # `-lc`.
138138+ #
139139+ # On PowerPC we add `-mnewlib`, which means "libc has not been
140140+ # built yet". This causes libgcc's Makefile to use the
141141+ # gcc-built `{e,n}crt{n,i}.o` instead of failing to find the
142142+ # versions which have been repackaged in libc as `crt{n,i}.o`
143143+ #
144144+ SHLIB_LC = lib.optionalString targetPlatform.isPower "-mnewlib";
145145+146146+ in ''
147147+ echo 'libgcc.a: ${crtstuff-ofiles}' >> libgcc/Makefile.in
148148+ echo 'SHLIB_LC=${SHLIB_LC}' >> libgcc/Makefile.in
124149 '')
125150126151+ lib.optionalString (!enableMultilib && hostPlatform.is64bit && !hostPlatform.isMips64n32) ''