summaryrefslogtreecommitdiff
path: root/stage2-eglibc-fix-specs
diff options
context:
space:
mode:
Diffstat (limited to 'stage2-eglibc-fix-specs')
-rw-r--r--stage2-eglibc-fix-specs18
1 files changed, 15 insertions, 3 deletions
diff --git a/stage2-eglibc-fix-specs b/stage2-eglibc-fix-specs
index 82e292036..fec0d08d0 100644
--- a/stage2-eglibc-fix-specs
+++ b/stage2-eglibc-fix-specs
@@ -16,11 +16,23 @@
set -eu
+sysroot="$(dirname "$(pwd)")"
specs_dir="$(dirname $($TARGET_STAGE1-gcc --print-libgcc-file-name))"
-mkdir -p "$specs_dir"
+target_specs_dir="$DESTDIR/${specs_dir#$sysroot}"
+mkdir -p "$target_specs_dir"
-$TARGET_STAGE1-gcc -dumpspecs | \
+$TARGET_STAGE1-gcc -dumpspecs |
sed -e "s@[gMS]\?crt[1in].o%s@%:getenv(STAGE2_SYSROOT $PREFIX/lib/&)@g" \
-e "s@/lib\(64\)\?/ld@$PREFIX/lib/ld@g" \
- > "$specs_dir/specs"
+ > "$target_specs_dir/specs-for-sysroot"
+# NASTY HACK #
+# We create a symlink to the actual specs here, so that later the
+# symlink can be replaced with a dangling link.
+#
+# This is necessary as we need to have gcc use its internal specs,
+# which can differ to the specs generated by `gcc -dumpspecs`.
+#
+# The dangling symlink will not make it onto the final system, just
+# like all other bootstrap only components.
+ln -s specs-for-sysroot "$target_specs_dir/specs"