aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@st.com>2019-09-10 09:43:37 +0200
committerChristophe Lyon <clyon@gcc.gnu.org>2019-09-10 09:43:37 +0200
commit11189793b6ef60645d5d1126d0bd9d0dd83e6583 (patch)
tree47a986c1c0d6df624cd7646fffe016b335a2f0cf /libgcc
parent8b63716e87e138e7e2a01309367da9c720e07949 (diff)
downloadgcc-11189793b6ef60645d5d1126d0bd9d0dd83e6583.zip
gcc-11189793b6ef60645d5d1126d0bd9d0dd83e6583.tar.gz
gcc-11189793b6ef60645d5d1126d0bd9d0dd83e6583.tar.bz2
[ARM/FDPIC v6 05/24] [ARM] FDPIC: Fix __do_global_dtors_aux and frame_dummy generation
In FDPIC, we need to make sure __do_global_dtors_aux and frame_dummy are referenced by their address, not by pointers to the function descriptors. 2019-09-10 Christophe Lyon <christophe.lyon@st.com> Mickaël Guêné <mickael.guene@st.com> libgcc/ * libgcc/crtstuff.c: Add support for FDPIC. Co-Authored-By: Mickaël Guêné <mickael.guene@st.com> From-SVN: r275567
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog7
-rw-r--r--libgcc/crtstuff.c16
2 files changed, 22 insertions, 1 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 7696452..bb41129 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,6 +1,11 @@
2019-09-10 Christophe Lyon <christophe.lyon@st.com>
+ Mickaël Guêné <mickael.guene@st.com>
- * config.host: Handle *-*-uclinuxfdpiceabi.
+ * libgcc/crtstuff.c: Add support for FDPIC.
+
+2019-09-10 Christophe Lyon <christophe.lyon@st.com>
+
+ * config.host: Handle *-*-uclinuxfdpiceabi.
2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
diff --git a/libgcc/crtstuff.c b/libgcc/crtstuff.c
index c8a8e2c..c93e1cb 100644
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -429,9 +429,17 @@ __do_global_dtors_aux (void)
#ifdef FINI_SECTION_ASM_OP
CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
#elif defined (FINI_ARRAY_SECTION_ASM_OP)
+#if defined(__FDPIC__)
+__asm__("\t.equ\t__do_global_dtors_aux_alias, __do_global_dtors_aux\n");
+extern char __do_global_dtors_aux_alias;
+static void *__do_global_dtors_aux_fini_array_entry[]
+__attribute__ ((__used__, section(".fini_array"), aligned(sizeof(void *))))
+ = { &__do_global_dtors_aux_alias };
+#else /* defined(__FDPIC__) */
static func_ptr __do_global_dtors_aux_fini_array_entry[]
__attribute__ ((__used__, section(".fini_array"),
aligned(__alignof__(func_ptr)))) = { __do_global_dtors_aux };
+#endif /* defined(__FDPIC__) */
#else /* !FINI_SECTION_ASM_OP && !FINI_ARRAY_SECTION_ASM_OP */
static void __attribute__((used))
__do_global_dtors_aux_1 (void)
@@ -473,9 +481,17 @@ frame_dummy (void)
#ifdef __LIBGCC_INIT_SECTION_ASM_OP__
CRT_CALL_STATIC_FUNCTION (__LIBGCC_INIT_SECTION_ASM_OP__, frame_dummy)
#else /* defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
+#if defined(__FDPIC__)
+__asm__("\t.equ\t__frame_dummy_alias, frame_dummy\n");
+extern char __frame_dummy_alias;
+static void *__frame_dummy_init_array_entry[]
+__attribute__ ((__used__, section(".init_array"), aligned(sizeof(void *))))
+ = { &__frame_dummy_alias };
+#else /* defined(__FDPIC__) */
static func_ptr __frame_dummy_init_array_entry[]
__attribute__ ((__used__, section(".init_array"),
aligned(__alignof__(func_ptr)))) = { frame_dummy };
+#endif /* defined(__FDPIC__) */
#endif /* !defined(__LIBGCC_INIT_SECTION_ASM_OP__) */
#endif /* USE_EH_FRAME_REGISTRY || USE_TM_CLONE_REGISTRY */