From 183c3df078d3a26992df3781755a5f070b8c908e Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Mon, 25 Jan 2021 16:20:12 +0900 Subject: [PATCH] Add pie compile option Change-Id: Ie97081e9e7d193135f7d223c7aded49772c52b60 --- packaging/add_pie_compile_option.patch | 13 +++++++++++++ packaging/python3-base.spec | 2 ++ packaging/python3.spec | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 packaging/add_pie_compile_option.patch diff --git a/packaging/add_pie_compile_option.patch b/packaging/add_pie_compile_option.patch new file mode 100644 index 00000000..04376e6b --- /dev/null +++ b/packaging/add_pie_compile_option.patch @@ -0,0 +1,13 @@ +diff --git a/configure.ac b/configure.ac +index 789df36e..ae403066 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2755,7 +2755,7 @@ then + LINKFORSHARED="-Wl,-E -Wl,+s";; + # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; + Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; +- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";; ++ Linux*|GNU*) LINKFORSHARED="-pie -Xlinker -export-dynamic";; + # -u libsys_s pulls in all symbols in libsys + Darwin/*) + LINKFORSHARED="$extra_undefs -framework CoreFoundation" diff --git a/packaging/python3-base.spec b/packaging/python3-base.spec index 9dc739b9..db89c9d7 100644 --- a/packaging/python3-base.spec +++ b/packaging/python3-base.spec @@ -88,6 +88,7 @@ Source7: python3.csh Source8: macros.python3.py Source9: import_failed.py Source10: import_failed.map +Source11: add_pie_compile_option.patch # The following files are not used in the build. @@ -238,6 +239,7 @@ other applications. %prep %setup -q -n %{tarname} +%{__patch} -p1 < %{SOURCE11} ### COMMON-PREP-BEGIN ### diff --git a/packaging/python3.spec b/packaging/python3.spec index d22f2258..abb714fa 100644 --- a/packaging/python3.spec +++ b/packaging/python3.spec @@ -68,6 +68,7 @@ Group: Development/Languages/Python Url: http://www.python.org/ Source0: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz #Source1: http://www.python.org/ftp/python/%{version}/%{tarname}.tar.xz.asc +Source10: add_pie_compile_option.patch BuildRequires: automake BuildRequires: fdupes @@ -153,6 +154,8 @@ Console User Interface. %prep %setup -q -n %{tarname} +%{__patch} -p1 < %{SOURCE10} + ### COMMON-PREP-BEGIN ### # drop Autoconf version requirement -- 2.34.1