public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Enable building libgcc with capabilities
@ 2021-09-21 9:13 Matthew Malcomson
0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-09-21 9:13 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:148fe1c3bc53e7adad23a6e102611b640fe97149
commit 148fe1c3bc53e7adad23a6e102611b640fe97149
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date: Mon Aug 9 10:51:49 2021 +0100
Enable building libgcc with capabilities
In order to try and build binaries, we'll need to build libgcc with
capabilities. This commit fixes the last few things that were stopping
it building at all. There are likely many functionality problems still
in libgcc due to mishandling of capabilities and words. We'll have to
look into those as and when we find them.
The unwinder is a known problem area since we have not looked into how
capabilities should be handled there. There is also the splitting up of
the type `_Unwind_Word` which at various points in the unwinder seems to
represent the address type, the type that is stored in a register, and
the value that gets stored on the DWARF2 stack.
Fixes in this patch are:
- Define the type that we read DWARF _{s,u}leb128_t types into as being
the same type as the address value of a capability.
- Avoid the use of __attribute__ ((mode(pointer))) in emutls.c
We've defined the _{s,u}leb128_t types using a new predefined macro of
`__SIZEOF_POINTER_OFFSET__`. This may be temporary. When we work on
looking at the uses of these types we plan to look into whether using
our "address" mode attribute would be satisfactory.
Diff:
---
gcc/cppbuiltin.c | 2 ++
libgcc/emutls.c | 2 +-
libgcc/unwind-generic.h | 15 +++++++++++----
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/gcc/cppbuiltin.c b/gcc/cppbuiltin.c
index 61efe9b2b75..8f657dd22b0 100644
--- a/gcc/cppbuiltin.c
+++ b/gcc/cppbuiltin.c
@@ -179,6 +179,8 @@ define_builtin_macros_for_type_sizes (cpp_reader *pfile)
toplev calls backend_init which is not done with -E switch. */
cpp_define_formatted (pfile, "__SIZEOF_POINTER__=%d",
1 << ceil_log2 ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT));
+ cpp_define_formatted (pfile, "__SIZEOF_POINTER_OFFSET__=%d",
+ 1 << ceil_log2 ((POINTER_OFFSET_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT));
}
diff --git a/libgcc/emutls.c b/libgcc/emutls.c
index f8012f6d8d5..5f23e626b94 100644
--- a/libgcc/emutls.c
+++ b/libgcc/emutls.c
@@ -31,7 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "gthr.h"
typedef unsigned int word __attribute__((mode(word)));
-typedef unsigned int pointer __attribute__((mode(pointer)));
+typedef __UINTPTR_TYPE__ pointer;
struct __emutls_object
{
diff --git a/libgcc/unwind-generic.h b/libgcc/unwind-generic.h
index d82fa1e8021..bbdfbc75f55 100644
--- a/libgcc/unwind-generic.h
+++ b/libgcc/unwind-generic.h
@@ -252,8 +252,13 @@ extern void * _Unwind_FindEnclosingFunction (void *pc);
#error "__SIZEOF_LONG__ macro not defined"
#endif
-#ifndef __SIZEOF_POINTER__
- #error "__SIZEOF_POINTER__ macro not defined"
+#ifndef __SIZEOF_POINTER_OFFSET__
+# ifndef __SIZEOF_POINTER__
+ #error "Neither __SIZEOF_POINTER__ nor __SIZEOF_POINTER_OFFSET__ macro defined"
+# endif
+# define __ADDRESS_SIZE __SIZEOF_POINTER__
+#else
+# define __ADDRESS_SIZE __SIZEOF_POINTER_OFFSET__
#endif
@@ -265,16 +270,18 @@ extern void * _Unwind_FindEnclosingFunction (void *pc);
except when a unsigned long data type on the target machine is not
capable of storing a pointer. */
-#if __SIZEOF_LONG__ >= __SIZEOF_POINTER__
+#if __SIZEOF_LONG__ >= __ADDRESS_SIZE
typedef long _sleb128_t;
typedef unsigned long _uleb128_t;
-#elif __SIZEOF_LONG_LONG__ >= __SIZEOF_POINTER__
+#elif __SIZEOF_LONG_LONG__ >= __ADDRESS_SIZE
typedef long long _sleb128_t;
typedef unsigned long long _uleb128_t;
#else
# error "What type shall we use for _sleb128_t?"
#endif
+#undef __ADDRESS_SIZE
+
#if defined (__SEH__) && !defined (__USING_SJLJ_EXCEPTIONS__)
/* Handles the mapping from SEH to GCC interfaces. */
EXCEPTION_DISPOSITION _GCC_specific_handler (PEXCEPTION_RECORD, void *,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-21 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 9:13 [gcc(refs/vendors/ARM/heads/morello)] Enable building libgcc with capabilities Matthew Malcomson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).