diff --git a/0001-Update-elf-objfmt.c.patch b/0001-Update-elf-objfmt.c.patch new file mode 100644 index 0000000..757b318 --- /dev/null +++ b/0001-Update-elf-objfmt.c.patch @@ -0,0 +1,32 @@ +From c7d58a55ace0fe4233aac8dc335bea0745ef7dd9 Mon Sep 17 00:00:00 2001 +From: kalebskeithley +Date: Thu, 21 May 2020 09:12:36 -0400 +Subject: [PATCH] Update elf-objfmt.c + +tl;dnr: add support for note.gnu.property note sections. + +ceph has a few optimized crc32 routines hand written in assembly in yasm format. (Nobody appears to have the stomach for rewriting them in another format.) Fedora requires that libraries be CET enabled. IOW all .o comprising a shared library need a note.gnu.properties NOTE section with some magic bits that tell the linker that the .o was compiled with the appropriate options. + +I can add such a note section, but without this change yasm will not set the correct section flag and I have to resort to some dd magic to set the correct section type before linking all the .o files into the shlib. +--- + modules/objfmts/elf/elf-objfmt.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c +index 0c3a1426..c4360c03 100644 +--- a/modules/objfmts/elf/elf-objfmt.c ++++ b/modules/objfmts/elf/elf-objfmt.c +@@ -1077,6 +1077,10 @@ elf_objfmt_section_switch(yasm_object *object, yasm_valparamhead *valparams, + align = 0; + data.type = SHT_PROGBITS; + data.flags = 0; ++ } else if (strcmp(sectname, ".note.gnu.property") == 0) { ++ align = 8; ++ data.type = SHT_NOTE; ++ data.flags = 0; + } else { + /* Default to code */ + align = 1; +-- +2.26.2 + diff --git a/yasm.spec b/yasm.spec index e0121a1..2560462 100644 --- a/yasm.spec +++ b/yasm.spec @@ -7,6 +7,7 @@ License: BSD and (GPLv2+ or Artistic or LGPLv2+) and LGPLv2 URL: http://yasm.tortall.net/ Source: http://www.tortall.net/projects/yasm/releases/yasm-%{version}.tar.gz +Patch1: 0001-Update-elf-objfmt.c.patch BuildRequires: gcc BuildRequires: bison @@ -42,6 +43,7 @@ Install this package if you need to rebuild applications that use yasm. %prep %setup -q +%patch1 -p1 %build