Browse Source

fix gcc 8+ static pie patches to make -static-pie pass -static to ld

previously this was missed because there's target-specific spec magic
for a few targets to do it, but many including arm don't have it.
without this, use of -static-pie produces broken binaries which lack
an interpreter but link to shared libraries on the targets affected.

use of -static -pie (preferred form) is not affected. gcc versions
prior to 8.x did not have -static-pie (because there was no upstream
static pie support) so this patch is only needed for 8+, and only to
prevent breakage if someone uses the -static-pie option instead of
-static with -pie.
Rich Felker 5 years ago
parent
commit
b49456e19a
2 changed files with 2 additions and 2 deletions
  1. 1 1
      patches/gcc-8.3.0/0012-static-pie.diff
  2. 1 1
      patches/gcc-9.2.0/0012-static-pie.diff

+ 1 - 1
patches/gcc-8.3.0/0012-static-pie.diff

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

+ 1 - 1
patches/gcc-9.2.0/0012-static-pie.diff

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