1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-09-27 17:09:29 +02:00

ARM: tests/Gtest-dyn1.c fixes.

Define an appropriate fdesc struct and its corresponding accessors that take
care of the thumb marker on ARM. Call the __clear_cache built-in instead of
flush_cache if the GNU compiler is used.

Signed-off-by: Ken Werner <ken.werner@linaro.org>
This commit is contained in:
Ken Werner 2011-04-06 10:36:26 +02:00
parent a624812e2a
commit 3b917f2d16

View file

@ -62,6 +62,16 @@ struct fdesc
# define get_fdesc(fdesc,func) (fdesc = *(struct fdesc *) &(func))
# define get_funcp(fdesc) ((template_t) &(fdesc))
# define get_gp(fdesc) ((fdesc).gp)
#elif __arm__
struct fdesc
{
long code;
long is_thumb;
};
# define get_fdesc(fdesc,func) ({(fdesc).code = (long) &(func) & ~0x1; \
(fdesc).is_thumb = (long) &(func) & 0x1;})
# define get_funcp(fdesc) ((template_t) ((fdesc).code | (fdesc).is_thumb))
# define get_gp(fdesc) (0)
#else
struct fdesc
{
@ -170,7 +180,12 @@ main (int argc, char *argv[])
memcpy (mem, (void *) fdesc.code, MAX_FUNC_SIZE);
mprotect ((void *) ((long) mem & ~(getpagesize () - 1)),
2*getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC);
#ifdef __GNUC__
__clear_cache(mem, mem + MAX_FUNC_SIZE);
#else
flush_cache (mem, MAX_FUNC_SIZE);
#endif
signal (SIGSEGV, sighandler);