Disable amd64 assembly on non-intel architectures

All builds would include an .S file which contains a pre-processor
directive that makes the file effectively empty on non-amd64
architectures. Objects built from assembly get an executable stack by
default. The file has a stanza to make the stack non-executable, but
on non-amd64 architectures this stanza is skipped together with the
rest of the file. Nevertheless, it seems that even the empty file
causes an executable stack to be created. To avoid the issue, do a
build with the assembler file explicitly skipped.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-12-28 17:37:11 +01:00 committed by Pádraig Brady
parent f9fafbbc38
commit 1da1913cc1
1 changed files with 11 additions and 2 deletions

View File

@ -4,10 +4,12 @@
%else
%ifarch %{ix86} x86_64
%bcond_without pzstd
%bcond_without asm
%else
# aarch64 and armv7hl at least currently segfault
# in ThreadPool test for the pzstd util
%bcond_with pzstd
%bcond_with asm
%endif
%endif
@ -26,6 +28,7 @@ BuildRequires: gcc gtest-devel
%if %{with pzstd}
BuildRequires: gcc-c++
%endif
BuildRequires: execstack
%description
Zstd, short for Zstandard, is a fast lossless compression algorithm,
@ -62,14 +65,16 @@ find -name .gitignore -delete
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="$RPM_LD_FLAGS"
for dir in lib programs; do
%make_build -C "$dir"
%make_build -C "$dir" %{!?with_asm:ZSTD_NO_ASM=1}
done
%if %{with pzstd}
export CXXFLAGS="$RPM_OPT_FLAGS -std=c++11"
%make_build -C contrib/pzstd
%make_build -C contrib/pzstd %{!?with_asm:ZSTD_NO_ASM=1}
%endif
%check
execstack lib/libzstd.so.1
export CFLAGS="$RPM_OPT_FLAGS"
export LDFLAGS="$RPM_LD_FLAGS"
make -C tests test-zstd
@ -121,6 +126,10 @@ install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
%ldconfig_scriptlets -n lib%{name}
%changelog
* Tue Dec 28 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.5.1-1
- Disable amd64 assembly on non-intel architectures (#2035802):
this should avoid the issue where an executable stack is created.
* Wed Dec 22 2021 Pádraig Brady <P@draigBrady.com> - 1.5.1-1
- Latest upstream