glibc/add-Wl-z-noseparate-code-for-so.patch
liqingqing_1229 1e654c212a x86: add noseparate-code for bash program performance
(cherry picked from commit 34b884988db3e284ae8d219204af3aa1d05ad2d4)
2023-07-04 09:53:52 +08:00

35 lines
1.1 KiB
Diff

From 2eb52cc0dd1ce02871d4f863649a8656831805c7 Mon Sep 17 00:00:00 2001
From: hongrongxuan <hongrongxuan@huawei.com>
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