]> gcc.gnu.org Git - gcc.git/commit
Fix up some cheri warnings in libgcc
authorMatthew Malcomson <matthew.malcomson@arm.com>
Mon, 7 Mar 2022 18:04:39 +0000 (18:04 +0000)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Fri, 11 Mar 2022 10:50:15 +0000 (10:50 +0000)
commit9b82fa20f04768be50824a2e4ce8762a1a3db7ef
tree080b98b052ef00e8f7e4f2a1c9ce66904c286a48
parent3814a5de3d70e93b1d1b56b03307cf3d743ed323
Fix up some cheri warnings in libgcc

In emutls.c we introduce a new type to represent an address, to ensure
we have the same distinction between pointer and address here as
everywhere else.  This allows us to remove a provenance warning on a
binary operation between two capabilities.

One point of note is that we use __attribute__((mode(address))) rather
than ptraddr_t.  This is because ptraddr_t is not necessarily defined
for all targets, while __attribute__((mode(address))) is.  We care about
this more inside libgcc than in other software since this software is
supposed to be as portable as GCC is.

In the GCC C-language personality function we avoid some provenance warnings
by using _Unwind_Address in some binary operations, and we cast an
_Unwind_Ptr to a void * before passing it to
__builtin_code_address_from_pointer.

In unwind-dw2 and unwind-dw2-fde we just need to make the difference
between an address and a pointer clear for the compiler.  We record
addresses in many structures since they are smaller and we only need the
address.  Our functions for reading in encoded values need to be able to
return capabilities because we can have capabilities stored (indirectly)
in the debug information.  Hence we now need to cast from the "read"
value type to the "for use" value type.

Avoid unaligned warnings in `read_encoded_value_with_base`.  We know
the union we define is not aligned for capabilities, but we handle it
manually ourselves (there is never a capability directly in the debug
information, but there can be `void *`'s for other backends).

Mark the __EH_FRAME_BEGIN__ symbol as being used in the inline assembly
that the purecap implementation of get_eh_frame_begin is implemented
with.  This avoids a warning, and avoids the possibility of the variable
being optimised away.

Add the EH_FRAME_SECTION_CONST macro (which expands to `const`
or the empty string depending on configuration settings) to the
declaration of `get_eh_frame_begin` so the function does not discard the
`const` attribute.

We adjust our `asm` directive so that it indicates we are
using the __EH_FRAME_BEGIN__ symbol as this avoids an unused variable
warning.
libgcc/crtstuff.c
libgcc/emutls.c
libgcc/unwind-c.c
libgcc/unwind-dw2-fde.c
libgcc/unwind-dw2.c
libgcc/unwind-dw2.h
libgcc/unwind-pe.h
This page took 0.060396 seconds and 6 git commands to generate.