From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Bertalan <dani@danielbertalan.dev>
Date: Mon, 11 Sep 2023 16:37:27 +0200
Subject: [PATCH] libstdc++: Build static library with -fPIC

We want the libstdc++.a library to contain -fPIC code in order to link
it statically into LibC/our shared objects. However, the build system
forces no-pic/pie instead.

This hack is from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58638
---
 libstdc++-v3/configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 0cd50a29ab76d8af432aefdcb07b43f15f70688a..472b7ed7093aeb37233f2d98a37ddd9d24899b51 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -15789,8 +15789,8 @@ if test "$enable_shared" = yes; then
   glibcxx_compiler_shared_flag="-D_GLIBCXX_SHARED"
 
 else
-  glibcxx_lt_pic_flag=
-  glibcxx_compiler_pic_flag=
+  glibcxx_lt_pic_flag="-prefer-pic"
+  glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
   glibcxx_compiler_shared_flag=
 fi
 
