libloc: Apply patch to compile the perl module without stack protector.

Message ID 20200719092252.4315-1-stefan.schantl@ipfire.org
State Accepted
Commit cb4860794b9a5fcd92447414ea0b004ea9f0101f
Headers
Series libloc: Apply patch to compile the perl module without stack protector. |

Commit Message

Stefan Schantl July 19, 2020, 9:22 a.m. UTC
  Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 lfs/libloc                                           |  3 +++
 .../libloc-0.9.3-perl-no-stack-protector.patch       | 12 ++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 src/patches/libloc-0.9.3-perl-no-stack-protector.patch
  

Comments

Michael Tremer July 20, 2020, 9:23 a.m. UTC | #1
Hello,

This isn’t really the best solution I would say, but it will at least work for now.

I suppose there is an issue in the perl build system and that either the -fstack-protector-all flag is being filtered or it links libc in a funny way.

I would propose to make this conditional to i586 because the module builds fine on all other architectures.

-Michael

P.S. Did you try adding -lssp to the linker flags?

> On 19 Jul 2020, at 10:22, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
> lfs/libloc                                           |  3 +++
> .../libloc-0.9.3-perl-no-stack-protector.patch       | 12 ++++++++++++
> 2 files changed, 15 insertions(+)
> create mode 100644 src/patches/libloc-0.9.3-perl-no-stack-protector.patch
> 
> diff --git a/lfs/libloc b/lfs/libloc
> index 43af26b45..5cf3e0819 100644
> --- a/lfs/libloc
> +++ b/lfs/libloc
> @@ -78,6 +78,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
> 	@$(PREBUILD)
> 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xvf $(DIR_DL)/$(DL_FILE)
> 
> +	# Add patch for i585 to disable the stack protector.
> +	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
> +
> 	cd $(DIR_APP) && ./autogen.sh
> 	cd $(DIR_APP) && ./configure \
> 		--prefix=/usr \
> diff --git a/src/patches/libloc-0.9.3-perl-no-stack-protector.patch b/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
> new file mode 100644
> index 000000000..b615ed902
> --- /dev/null
> +++ b/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
> @@ -0,0 +1,12 @@
> +diff --git a/src/perl/Makefile.PL b/src/perl/Makefile.PL
> +index 38d5390..62016ca 100644
> +--- a/src/perl/Makefile.PL
> ++++ b/src/perl/Makefile.PL
> +@@ -11,6 +11,7 @@ WriteMakefile(
> +     LIBS              => ['-lloc'],
> +     DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
> +     INC               => '-I. -I../../',
> ++    CCFLAGS           => '-fno-stack-protector',
> + 	# Un-comment this if you add C files to link with later:
> +     # OBJECT            => '$(O_FILES)', # link all the C files too
> + );
> -- 
> 2.20.1
>
  

Patch

diff --git a/lfs/libloc b/lfs/libloc
index 43af26b45..5cf3e0819 100644
--- a/lfs/libloc
+++ b/lfs/libloc
@@ -78,6 +78,9 @@  $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 	@$(PREBUILD)
 	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar xvf $(DIR_DL)/$(DL_FILE)
 
+	# Add patch for i585 to disable the stack protector.
+	cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
+
 	cd $(DIR_APP) && ./autogen.sh
 	cd $(DIR_APP) && ./configure \
 		--prefix=/usr \
diff --git a/src/patches/libloc-0.9.3-perl-no-stack-protector.patch b/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
new file mode 100644
index 000000000..b615ed902
--- /dev/null
+++ b/src/patches/libloc-0.9.3-perl-no-stack-protector.patch
@@ -0,0 +1,12 @@ 
+diff --git a/src/perl/Makefile.PL b/src/perl/Makefile.PL
+index 38d5390..62016ca 100644
+--- a/src/perl/Makefile.PL
++++ b/src/perl/Makefile.PL
+@@ -11,6 +11,7 @@ WriteMakefile(
+     LIBS              => ['-lloc'],
+     DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
+     INC               => '-I. -I../../',
++    CCFLAGS           => '-fno-stack-protector',
+ 	# Un-comment this if you add C files to link with later:
+     # OBJECT            => '$(O_FILES)', # link all the C files too
+ );