> This patch adds Linux/x32 support to Ada. It sets LIBGNAT_TARGET_PAIRS > similar to Linux/x86-64 and replaces system-linux-x86_64.ads with > system-linux-x86.ads. It also adds "orl $0x0,(%esp)" check for SIGSEGV > probe and sets __gnat_default_libgcc_subdir to libx32 for x32. Tested > on Linux/x32 with the following Ada test failures: > > FAIL: gnat.dg/curr_task.adb execution test > FAIL: gnat.dg/lto8.adb (test for excess errors) > FAIL: gnat.dg/requeue1.adb execution test > FAIL: gnat.dg/test_image.adb execution test > FAIL: gnat.dg/timer_cancel.adb execution test > FAIL: gnat.dg/specs/addr1.ads (test for bogus messages, line 24) > FAIL: gnat.dg/specs/addr1.ads (test for excess errors) > FAIL: gnat.dg/specs/atomic1.ads (test for errors, line 9) > FAIL: gnat.dg/specs/atomic1.ads (test for errors, line 13)
Thanks for working on this. > 2012-03-02 H.J. Lu <hongjiu...@intel.com> > > * init.c (__gnat_adjust_context_for_raise): Also check > "orq $0x0,(%esp)" for x32. > > * link.c (__gnat_default_libgcc_subdir): set to libx32 for x32. > > * gcc-interface/Makefile.in (arch): Set to x32 if MULTISUBDIR > is /x32. > Support x32. This looks good to me, modulo the following nits: > --- a/gcc/ada/init.c > +++ b/gcc/ada/init.c > @@ -615,9 +615,16 @@ __gnat_adjust_context_for_raise (int signo > ATTRIBUTE_UNUSED, void *ucontext) if (signo == SIGSEGV && pc && *pc == > 0x00240c83) > mcontext->gregs[REG_ESP] += 4096 + 4 * sizeof (unsigned long); > #elif defined (__x86_64__) > - unsigned long *pc = (unsigned long *)mcontext->gregs[REG_RIP]; > - /* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */ > - if (signo == SIGSEGV && pc && (*pc & 0xffffffffff) == 0x00240c8348) > + unsigned long long *pc = (unsigned long long *)mcontext->gregs[REG_RIP]; > + if (signo == SIGSEGV && pc > + /* The pattern is "orq $0x0,(%rsp)" for a probe in 64-bit mode. */ > + && ((*pc & 0xffffffffffLL) == 0x00240c8348LL > +# ifndef __LP64__ > + /* The pattern may also be "orl $0x0,(%esp)" for a probe in x32 > + mode. */ > + || (*pc & 0xffffffffLL) == 0x00240c83LL > +# endif > + )) > mcontext->gregs[REG_RSP] += 4096 + 4 * sizeof (unsigned long); > #elif defined (__ia64__) > /* ??? The IA-64 unwinder doesn't compensate for signals. */ The preprocessor directive is very likely superfluous, let's remove it and just add the || thing. > diff --git a/gcc/ada/link.c b/gcc/ada/link.c > index 8bcad27..3648878 100644 > --- a/gcc/ada/link.c > +++ b/gcc/ada/link.c > @@ -187,7 +187,11 @@ unsigned char __gnat_using_gnu_linker = 1; > const char *__gnat_object_library_extension = ".a"; > unsigned char __gnat_separate_run_path_options = 0; > #if defined (__x86_64) > +# if defined __LP64__ > const char *__gnat_default_libgcc_subdir = "lib64"; > +# else > +const char *__gnat_default_libgcc_subdir = "libx32"; > +# endif > #else > const char *__gnat_default_libgcc_subdir = "lib"; > #endif Please follow the existing idiom and write defined (__LP64__) instead. OK with these changes. -- Eric Botcazou