[2/4] Add ENDBRANCH64 and ENDBRANCH32 macro definitions

Submitted by Joao Moreira on Oct. 19, 2020, 10:43 p.m.

Details

Message ID 20201019224342.53303-3-joao.moreira@intel.com
State New
Series "Add CET IBT Support to MUSL"
Headers show

Commit Message

Joao Moreira Oct. 19, 2020, 10:43 p.m.
Define ENDBRANCH64 and ENDBRANCH32 macros to endbr64 and endbr32 instructions,
respectively, in case the flag CET_IBT is set. If the flag is not set, the
macros are defined to nothing.

These macros will later be used to properly add endbranch instruction to
x86 and i386 assembly functions.

Signed-off-by: Joao Moreira <joao.moreira@intel.com>
---
 src/include/ibt.s | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 src/include/ibt.s

Patch hide | download patch | download mbox

diff --git a/src/include/ibt.s b/src/include/ibt.s
new file mode 100644
index 00000000..2f16006f
--- /dev/null
+++ b/src/include/ibt.s
@@ -0,0 +1,13 @@ 
+.ifdef CET_IBT
+	.macro ENDBRANCH64
+		endbr64
+	.endm
+	.macro ENDBRANCH32
+		endbr32
+	.endm
+.else
+	.macro ENDBRANCH64
+	.endm
+	.macro ENDBRANCH32
+	.endm
+.endif