From a360a359b784acdb53e20cbb85576b4b3662703a Mon Sep 17 00:00:00 2001
From: Christophe Lyon <christophe.lyon@st.com>
Date: Tue, 10 Sep 2019 10:11:46 +0200
Subject: [PATCH] [ARM/FDPIC v6 23/24] [ARM] FDPIC: Implement libitm support.

The ldaddr macro in sjlj.S needs to be updated to support the FDPIC
model.

2019-09-10  Christophe Lyon  <christophe.lyon@st.com>

	libitm/
	* config/arm/sjlj.S (ldaddr): Add FDPIC support.

From-SVN: r275584
---
 libitm/ChangeLog         |  8 ++++++--
 libitm/config/arm/sjlj.S | 11 ++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index 39e84517a347..20f576887129 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,7 +1,11 @@
 2019-09-10  Christophe Lyon  <christophe.lyon@st.com>
 
-        * configure.tgt: Handle *-*-uclinux*.
-        * configure: Regenerate.
+	* config/arm/sjlj.S (ldaddr): Add FDPIC support.
+
+2019-09-10  Christophe Lyon  <christophe.lyon@st.com>
+
+	* configure.tgt: Handle *-*-uclinux*.
+	* configure: Regenerate.
 
 2019-09-06  Florian Weimer  <fweimer@redhat.com>
 
diff --git a/libitm/config/arm/sjlj.S b/libitm/config/arm/sjlj.S
index a9abf160777a..5d449645c4fd 100644
--- a/libitm/config/arm/sjlj.S
+++ b/libitm/config/arm/sjlj.S
@@ -49,7 +49,16 @@
 	.arch	armv7-m
 #endif
 
-#if defined(HAVE_MOVT) && defined(PIC)
+#if defined(__FDPIC__)
+.macro ldaddr reg, addr
+	ldr \reg, 99f
+	add \reg, \reg, r9
+.subsection 1
+	.align	2
+99:	.word	\addr(GOTOFF)
+.subsection 0
+.endm
+#elif defined(HAVE_MOVT) && defined(PIC)
 .macro ldaddr reg, addr
 	movw	\reg, #:lower16:(\addr - (98f + PC_OFS))
 	movt	\reg, #:upper16:(\addr - (98f + PC_OFS))
-- 
GitLab