On 2/7/19 2:46 AM, Segher Boessenkool wrote:
Hi Martin,
On Wed, Feb 06, 2019 at 05:28:08PM -0700, Martin Sebor wrote:
void
-__clear_cache (char *beg __attribute__((__unused__)),
- char *end __attribute__((__unused__)))
+__clear_cache (void *beg __attribute__((__unused__)),
+ void *end __attribute__((__unused__)))
{
#ifdef CLEAR_INSN_CACHE
- CLEAR_INSN_CACHE (beg, end);
+ /* Cast the void* pointers to char* as some implementations
+ of the macro assume the pointers can be subtracted from
+ one another. */
+ CLEAR_INSN_CACHE ((char *) beg, (char *) end);
#endif /* CLEAR_INSN_CACHE */
}
You can subtract pointers to void in GCC just fine, it's a GNU C extension.
See extend.texi:
In GNU C, addition and subtraction operations are supported on pointers to
@code{void} and on pointers to functions. This is done by treating the
size of a @code{void} or of a function as 1.
(and libgcc is built with GCC always).
Sure. The macro is a no-op on x86_64 where I tested so I didn't want
to take any chances this late in stage 4 and end up breaking someone's
builds.
Martin