ICU-21019 x86: Add .note.gnu.property section for Intel CET
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 10 Mar 2020 11:34:46 +0000 (04:34 -0700)
committerSteven R. Loomis <srl295@gmail.com>
Wed, 18 Mar 2020 17:55:22 +0000 (10:55 -0700)
Intel Control-flow Enforcement Technology (CET):

https://software.intel.com/en-us/articles/intel-sdm

contains shadow stack (SHSTK) and indirect branch tracking (IBT).  When
CET is enabled, ELF object files must be marked with .note.gnu.property
section.  GCC provides <cet.h> which can be included in assembly codes
to generate CET maker when compiling with -fcf-protection.

icu4c/source/tools/toolutil/pkg_genc.cpp

index a4b6d7aa931cfd0a146f21a8cc0067cab9e179d9..21996434d3aefe8e7b4bd7e587452fd04d89263b 100644 (file)
@@ -131,6 +131,9 @@ static const struct AssemblyType {
     {"gcc",
         ".globl %s\n"
         "\t.section .note.GNU-stack,\"\",%%progbits\n"
+        "#ifdef __CET__\n"
+        "# include <cet.h>\n"
+        "#endif\n"
         "\t.section .rodata\n"
         "\t.balign 16\n"
         "#ifdef U_HIDE_DATA_SYMBOL\n"