configure.in (HAVE_AS_SPARC_UA_PCREL): Check for working %r_disp32().
authorJakub Jelinek <jakub@redhat.com>
Sun, 28 Apr 2002 19:57:42 +0000 (21:57 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 28 Apr 2002 19:57:42 +0000 (21:57 +0200)
* configure.in (HAVE_AS_SPARC_UA_PCREL): Check for working
%r_disp32().
* src/sparc/v8.S: Use it.
* src/sparc/v9.S: Likewise.
* fficonfig.h.in: Rebuilt.
* configure: Rebuilt.

From-SVN: r52858

libffi/ChangeLog
libffi/configure
libffi/configure.in
libffi/fficonfig.h.in
libffi/src/sparc/v8.S
libffi/src/sparc/v9.S

index 178dd9544a49b46e0af7e348342438fcfcb5c596..cd5a456e2bca2be01b6590db38c05789ae4f110c 100644 (file)
@@ -1,3 +1,12 @@
+2002-04-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * configure.in (HAVE_AS_SPARC_UA_PCREL): Check for working
+       %r_disp32().
+       * src/sparc/v8.S: Use it.
+       * src/sparc/v9.S: Likewise.
+       * fficonfig.h.in: Rebuilt.
+       * configure: Rebuilt.
+
 2002-04-08  Hans Boehm  <Hans_Boehm@hp.com>
 
        * src/java_raw_api.c (ffi_java_raw_size): Handle FFI_TYPE_DOUBLE
index e5ca777ab9638c2f212f15ef3cf95e673f5c22e1..9649abaf3a450558688fe23805e5432603555de0 100755 (executable)
@@ -3421,6 +3421,48 @@ if test $ac_cv_c_bigendian = unknown; then
 fi
 
 
+if test x$TARGET == xSPARC; then
+    echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6
+echo "configure:3426: checking assembler and linker support unaligned pc related relocs" >&5
+if eval "test \"`echo '$''{'libffi_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+       save_CFLAGS="$CFLAGS"
+       save_LDFLAGS="$LDFLAGS"
+       CFLAGS="$CFLAGS -fpic"
+       LDFLAGS="$LDFLAGS -shared"
+       cat > conftest.$ac_ext <<EOF
+#line 3436 "configure"
+#include "confdefs.h"
+asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  libffi_cv_as_sparc_ua_pcrel=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  libffi_cv_as_sparc_ua_pcrel=no
+fi
+rm -f conftest*
+       CFLAGS="$save_CFLAGS"
+       LDFLAGS="$save_LDFLAGS"
+fi
+
+echo "$ac_t""$libffi_cv_as_sparc_ua_pcrel" 1>&6
+    if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then
+       cat >> confdefs.h <<\EOF
+#define HAVE_AS_SPARC_UA_PCREL 1
+EOF
+
+    fi
+fi
+
 
 
 
index 9dfa33dfebba450beb2da3a8a35c2f520cd645c5..9e9ab1c142512214d79102bcc51ac51b63557ae0 100644 (file)
@@ -96,6 +96,24 @@ AC_COMPILE_CHECK_SIZEOF(long double)
 AC_COMPILE_CHECK_SIZEOF(void *)
 AC_C_BIGENDIAN_CROSS
 
+if test x$TARGET == xSPARC; then
+    AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs],
+       libffi_cv_as_sparc_ua_pcrel, [
+       save_CFLAGS="$CFLAGS"
+       save_LDFLAGS="$LDFLAGS"
+       CFLAGS="$CFLAGS -fpic"
+       LDFLAGS="$LDFLAGS -shared"
+       AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],,
+                   [libffi_cv_as_sparc_ua_pcrel=yes],
+                   [libffi_cv_as_sparc_ua_pcrel=no])
+       CFLAGS="$save_CFLAGS"
+       LDFLAGS="$save_LDFLAGS"])
+    if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then
+       AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1,
+                 [Define if your assembler and linker support unaligned PC relative relocs.])
+    fi
+fi
+
 AC_SUBST(TARGET)
 AC_SUBST(TARGETDIR)
 
index f7ea90bbdf92e01a2e4004dcd939033a5d07a8f4..ac15aeddbd7c726fc778a969814cb6f41fd9aca1 100644 (file)
@@ -68,3 +68,6 @@
 
 /* Define if you have the memcpy function.  */
 #undef HAVE_MEMCPY
+
+/* Define if your assembler and linker support unaligned PC relative relocs.  */
+#undef HAVE_AS_SPARC_UA_PCREL
index 8cccd6e750c3c84b8cfc42efa325c5fced7bf01a..d94fe03d2aa9080bfc9abf4c802a656f90c8893c 100644 (file)
@@ -115,7 +115,11 @@ longlong:
        .byte   0x80-WS ! sleb128 -WS; CIE Data Alignment Factor
        .byte   0xf     ! CIE RA Column
        .byte   0x1     ! uleb128 0x1; Augmentation size
+#ifdef HAVE_AS_SPARC_UA_PCREL
+       .byte   0x1b    ! FDE Encoding (pcrel sdata4)
+#else
        .byte   0x50    ! FDE Encoding (aligned absolute)
+#endif
        .byte   0xc     ! DW_CFA_def_cfa
        .byte   0xe     ! uleb128 0xe
        .byte   0x0     ! uleb128 0x0
@@ -125,9 +129,14 @@ longlong:
        .uaword .LLEFDE1-.LLASFDE1      ! FDE Length
 .LLASFDE1:
        .uaword .LLASFDE1-.LLframe1     ! FDE CIE offset
+#ifdef HAVE_AS_SPARC_UA_PCREL
+       .uaword %r_disp32(.LLFB1)
+       .uaword .LLFE1-.LLFB1   ! FDE address range
+#else
        .align  WS
        .nword  .LLFB1
        .uanword .LLFE1-.LLFB1  ! FDE address range
+#endif
        .byte   0x0     ! uleb128 0x0; Augmentation size
        .byte   0x4     ! DW_CFA_advance_loc4
        .uaword .LLCFI0-.LLFB1
index 9d02bb85885873e4b3764721ad4945397a9b172a..bd358c0d84d379d254fdaab4b24ba5d3bc8bf274 100644 (file)
@@ -136,7 +136,11 @@ dostruct:
        .byte   0x78    ! sleb128 -8; CIE Data Alignment Factor
        .byte   0xf     ! CIE RA Column
        .byte   0x1     ! uleb128 0x1; Augmentation size
+#ifdef HAVE_AS_SPARC_UA_PCREL
+       .byte   0x1b    ! FDE Encoding (pcrel sdata4)
+#else
        .byte   0x50    ! FDE Encoding (aligned absolute)
+#endif
        .byte   0xc     ! DW_CFA_def_cfa
        .byte   0xe     ! uleb128 0xe
        .byte   0xff,0xf        ! uleb128 0x7ff
@@ -146,9 +150,14 @@ dostruct:
        .uaword .LLEFDE1-.LLASFDE1      ! FDE Length
 .LLASFDE1:
        .uaword .LLASFDE1-.LLframe1     ! FDE CIE offset
+#ifdef HAVE_AS_SPARC_UA_PCREL
+       .uaword %r_disp32(.LLFB1)
+       .uaword .LLFE1-.LLFB1           ! FDE address range
+#else
        .align 8
        .xword  .LLFB1
        .uaxword        .LLFE1-.LLFB1   ! FDE address range
+#endif
        .byte   0x0     ! uleb128 0x0; Augmentation size
        .byte   0x4     ! DW_CFA_advance_loc4
        .uaword .LLCFI0-.LLFB1