update all static pie patches to ensure -static reached the linker

on some targets, the logic for the compiler option -static seems not
to be processed when -pie is present. rather than playing
whack-a-mole, just ensure LD_PIE_SPEC specs always pass -static to ld
if either -static or -static-pie is present on the compiler driver
command line.

this may produce redundant -static arguments but it doesn't matter.
This commit is contained in:
Rich Felker 2025-07-21 02:21:23 +00:00
parent 2398261280
commit 4be756d35c
12 changed files with 12 additions and 12 deletions

View File

@ -80,7 +80,7 @@ index e6887590ae2..df6e3965f13 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -80,7 +80,7 @@ index 3c81c5798d8..cd96eac5d12 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -34,7 +34,7 @@ index 0576ea7..0a280e0 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -53,7 +53,7 @@ index 91eb0534722..74a390e6005 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -105,7 +105,7 @@ index eb1610ba8b0..87560afb03c 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static-pie:-static} %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static-pie:-static} %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""

View File

@ -74,7 +74,7 @@ index d185c01b257..5d3f81c5fc5 100644
#ifdef HAVE_LD_PIE #ifdef HAVE_LD_PIE
#ifndef LD_PIE_SPEC #ifndef LD_PIE_SPEC
-#define LD_PIE_SPEC "-pie" -#define LD_PIE_SPEC "-pie"
+#define LD_PIE_SPEC "-pie %{static-pie:-static} %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic}" +#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}"
#endif #endif
#else #else
#define LD_PIE_SPEC "" #define LD_PIE_SPEC ""