From 9b6022ca7e117540b82eeffa92b13e02e90b38cb Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 12 Jun 2024 11:25:43 -0700 Subject: [PATCH] Avoid asm.S usage on various Linux architectures Resolves: RHEL-31139 --- avoid-asm.patch | 39 +++++++++++++++++++++++++++++++++++++++ libdex.spec | 2 ++ 2 files changed, 41 insertions(+) create mode 100644 avoid-asm.patch diff --git a/avoid-asm.patch b/avoid-asm.patch new file mode 100644 index 0000000..48f63b3 --- /dev/null +++ b/avoid-asm.patch @@ -0,0 +1,39 @@ +From 95b957d5381ae6b313333f50bb941e9970d55127 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 12 Jun 2024 11:17:52 -0700 +Subject: [PATCH] build: avoid asm.S on general Linux when possible + +We only use asm.S when on mips when we're on Linux. Removing this means +for the other Linux cases means the compiler can automatically enable some +features we might want like CET for indirect branches. +--- + src/meson.build | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/meson.build b/src/meson.build +index 2967968..4a106a1 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -91,10 +91,18 @@ if host_machine.system() != 'windows' + # Not really used on Windows now, see also + # https://github.com/mesonbuild/meson/issues/4366 + libdex_sources += [ +- 'asm.S', + 'dex-unix-signal.c', + 'dex-ucontext.c', + ] ++ ++ # If we're on Linux and mips we might still need asm.S. ++ # But otherwise linux can do it all without any custom ++ # assembler. Failure to do this might result in CET being ++ # disabled for the process by GCC. ++ if host_machine.system() != 'linux' or host_machine.cpu_family() == 'mips' ++ libdex_sources += ['asm.S'] ++ endif ++ + libdex_headers += ['dex-unix-signal.h'] + endif + +-- +2.45.1 + diff --git a/libdex.spec b/libdex.spec index d5134c6..00d288c 100644 --- a/libdex.spec +++ b/libdex.spec @@ -7,6 +7,8 @@ License: LGPL-2.1-or-later URL: https://gitlab.gnome.org/GNOME/libdex Source0: https://download.gnome.org/sources/libdex/0.6/%{name}-%{version}.tar.xz +Patch0: avoid-asm.patch + BuildRequires: /usr/bin/vapigen BuildRequires: gcc BuildRequires: gi-docgen