diff --git a/add-Wl-z-noseparate-code-for-so.patch b/add-Wl-z-noseparate-code-for-so.patch new file mode 100644 index 0000000000000000000000000000000000000000..12a6a4a825ee9aed889e85c6043c9a8edcf78df5 --- /dev/null +++ b/add-Wl-z-noseparate-code-for-so.patch @@ -0,0 +1,34 @@ +From 2eb52cc0dd1ce02871d4f863649a8656831805c7 Mon Sep 17 00:00:00 2001 +From: hongrongxuan +Date: Tue, 25 Oct 2022 21:24:21 +0800 +Subject: [PATCH] add Wl,-z,noseparate-code for so +binutils 2.31 add a separate-code(default)/noseparate-code link option to separate +.rodata from .text segment. Cause this is a dubious feature that intends to +reduce the number of ROP gadgets, and this will reduce batch program's +performance, like unixbench shell program, it will reduce 8%~10%. So +add 'Wl,-z,noseparate-code' to disable this feature. + +Refrences: +https://sourceware.org/pipermail/binutils/2018-February/101950.html +https://reviews.llvmm.org/D64903 +https://packagehub.suse.com/packages/binutils/2_37-1050100_7_34_1/ +--- + Makeconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makeconfig b/Makeconfig +index 92e76d62..28cea3de 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -366,7 +366,7 @@ LDFLAGS.so += $(combreloc-LDFLAGS) + LDFLAGS-rtld += $(combreloc-LDFLAGS) + endif + +-relro-LDFLAGS = -Wl,-z,relro ++relro-LDFLAGS = -Wl,-z,relro -Wl,-z,noseparate-code + LDFLAGS.so += $(relro-LDFLAGS) + LDFLAGS-rtld += $(relro-LDFLAGS) + +-- +2.27.0 + diff --git a/glibc.spec b/glibc.spec index 75c382e02daf7fad1b934c73dd0684fe9c2f72c0..b0ddf32a7ca00e25e01ce87f3d47f48892a1793b 100644 --- a/glibc.spec +++ b/glibc.spec @@ -36,6 +36,10 @@ %bcond_without compat_2_17 %endif +%ifarch x86_64 +%bcond_without noseparate_code +%endif + %ifarch %{valgrind_arches} %bcond_without valgrind %else @@ -66,7 +70,7 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 122 +Release: 123 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -309,6 +313,10 @@ Patch9038: elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch Patch9039: elf-ld.so-Consider-maybe-existing-hole-between-PT_LO.patch Patch9040: add-GB18030-2022-charmap.patch +%if %{with noseparate_code} +Patch9041: add-Wl-z-noseparate-code-for-so.patch +%endif + Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext @@ -1473,6 +1481,9 @@ fi %endif %changelog +* Sun Jun 4 2023 Qingqing Li - 2.34-123 +- x86: add noseparate-code for bash program performance + * Mon May 29 2023 Qingqing Li - 2.34-122 - locale: reduce the size of locale C.utf-8