aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAmbroise Vincent <ambroise.vincent@arm.com>2019-07-18 10:56:14 +0100
committerZelalem <zelalem.aweke@arm.com>2019-12-10 15:53:44 -0600
commitd01969118f1120d469d8f870cd195cb97e55fa90 (patch)
tree9554528160f06801b8698a43e98f74703d9174c5 /include
parent87b582ef5b31c5893a470b61c217931fc7602da3 (diff)
downloadplatform_external_arm-trusted-firmware-d01969118f1120d469d8f870cd195cb97e55fa90.tar.gz
platform_external_arm-trusted-firmware-d01969118f1120d469d8f870cd195cb97e55fa90.tar.bz2
platform_external_arm-trusted-firmware-d01969118f1120d469d8f870cd195cb97e55fa90.zip
arm: gicv3: Fix compiler dependent behavior
C99 standard: "What constitutes an access to an object that has volatile-qualified type is implementation-defined". GCC is not considering the cast to void of volatile structures as an access and so is not actually issuing reads. Clang does read those structures by copying them on the stack, which in this case creates an overflow because of their large size. This patch removes the cast to void and instead uses the USED attribute to tell the compiler to retain the static variables. Change-Id: I952b5056e3f6e91841e7ef9558434352710ab80d Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com> Zelalem Aweke <zelalem.aweke@arm.com>
Diffstat (limited to 'include')
-rw-r--r--include/lib/utils.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/include/lib/utils.h b/include/lib/utils.h
index cdb125cfa..17ee93694 100644
--- a/include/lib/utils.h
+++ b/include/lib/utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -79,13 +79,11 @@ void zeromem(void *mem, u_register_t length);
* which is constant and does not depend on the execute address of the binary.
*/
#define DEFINE_LOAD_SYM_ADDR(_name) \
-static inline u_register_t load_addr_## _name(void) \
-{ \
- u_register_t v; \
- /* Create a void reference to silence compiler */ \
- (void) _name; \
- __asm__ volatile ("ldr %0, =" #_name : "=r" (v)); \
- return v; \
+static inline u_register_t load_addr_## _name(void) \
+{ \
+ u_register_t v; \
+ __asm__ volatile ("ldr %0, =" #_name : "=r" (v) : "X" (#_name));\
+ return v; \
}
/* Helper to invoke the function defined by DEFINE_LOAD_SYM_ADDR() */