Patchwork Further OpenBSD/amd64 and OpenBSD/i386 improvements

login
register
mail settings
Submitter Mark Kettenis
Date Sept. 4, 2012, 6:45 p.m.
Message ID <201209041845.q84IjEWb032190@glazunov.sibelius.xs4all.nl>
Download mbox | patch
Permalink /patch/181652/
State New
Headers show

Comments

Mark Kettenis - Sept. 4, 2012, 6:45 p.m.
Here are some additional fixes for OpenBSD that fix a fair number of
failing testcases.  I can split this up in smaller patches if that's
preferred.

I believe I submitted the openbsd-stdint.h bit before.  We consistenly
use "long long" types for the *max_t types, on both 32-bit and 64-bit
platforms wheras GCC defaults to using "long" on 32-bit platforms and
"long long" on 64-bit platforms.  Hence the need for overrides.


libgcc/:

2012-09-02  Mark Kettenis  <kettenis@gnu.org>

	* config.host (*-*-openbsd*): Add t-eh-dw2-dip to tmake_file.
	(i[34567]86-*-openbsd* and x86_64-*-openbsd*): Add to list of
	i[34567]86-*-* and x86_64-*-* soft-fp targets.
	* unwind-dw2-fde-dip.c: Don't include <elf.h> on OpenBSD.
	(USE_PT_GNU_EH_FRAME): Define for OpenBSD.
	(ElfW): Likewise.

gcc:/

2012-09-02  Mark Kettenis  <kettenis@gnu.org>

	* config.gcc (*-*-openbsd4.[3-9]|*-*-openbsd[5-9]*): Set
	default_use_cxa_atexit to yes.
	* config/openbsd-stdint.h (INTMAX_TYPE, UINTMAX_TYPE): Define.
	* config/i386/openbsdelf.h (LIBGCC2_HAS_TF_MODE, LIBGCC2_TF_CEXT) 
	(TF_SIZE): Define.

Patch

Index: libgcc/unwind-dw2-fde-dip.c
===================================================================
--- libgcc/unwind-dw2-fde-dip.c	(revision 190863)
+++ libgcc/unwind-dw2-fde-dip.c	(working copy)
@@ -33,7 +33,7 @@ 
 
 #include "tconfig.h"
 #include "tsystem.h"
-#ifndef inhibit_libc
+#if !defined(inhibit_libc) && !defined(__OpenBSD__)
 #include <elf.h>		/* Get DT_CONFIG.  */
 #endif
 #include "coretypes.h"
@@ -65,6 +65,12 @@ 
 #endif
 
 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
+    && defined(__OpenBSD__)
+# define ElfW(type) Elf_##type
+# define USE_PT_GNU_EH_FRAME
+#endif
+
+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
     && defined(TARGET_DL_ITERATE_PHDR) \
     && defined(__sun__) && defined(__svr4__)
 # define USE_PT_GNU_EH_FRAME
Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(revision 190863)
+++ libgcc/config.host	(working copy)
@@ -213,7 +213,7 @@ 
   esac
   ;;
 *-*-openbsd*)
-  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic"
+  tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip"
   case ${target_thread_file} in
     posix)
       tmake_file="$tmake_file t-openbsd-thread"
@@ -1150,7 +1150,8 @@ 
   i[34567]86-*-gnu* | \
   i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]* | \
   i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw* | \
-  i[34567]86-*-freebsd* | x86_64-*-freebsd*)
+  i[34567]86-*-freebsd* | x86_64-*-freebsd* | \
+  i[34567]86-*-openbsd* | x86_64-*-openbsd*)
   	tmake_file="${tmake_file} t-softfp-tf"
 	if test "${host_address}" = 32; then
 		tmake_file="${tmake_file} i386/${host_address}/t-softfp"
Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 190863)
+++ gcc/config.gcc	(working copy)
@@ -708,6 +708,11 @@ 
     *-*-openbsd2.*|*-*-openbsd3.[012])
       tm_defines="${tm_defines} HAS_LIBC_R=1" ;;
   esac
+  case ${target} in
+    *-*-openbsd4.[3-9]|*-*-openbsd[5-9]*)
+      default_use_cxa_atexit=yes
+      ;;
+  esac
   ;;
 *-*-rtems*)
   case ${enable_threads} in
Index: gcc/config/i386/openbsdelf.h
===================================================================
--- gcc/config/i386/openbsdelf.h	(revision 190863)
+++ gcc/config/i386/openbsdelf.h	(working copy)
@@ -111,3 +111,9 @@ 
 #define OBSD_HAS_CORRECT_SPECS
 
 #define HAVE_ENABLE_EXECUTE_STACK
+
+/* Put all *tf routines in libgcc.  */
+#undef LIBGCC2_HAS_TF_MODE
+#define LIBGCC2_HAS_TF_MODE 1
+#define LIBGCC2_TF_CEXT q
+#define TF_SIZE 113
Index: gcc/config/openbsd-stdint.h
===================================================================
--- gcc/config/openbsd-stdint.h	(revision 190863)
+++ gcc/config/openbsd-stdint.h	(working copy)
@@ -26,6 +26,9 @@ 
 #define UINT_FAST16_TYPE	"unsigned int"
 #define UINT_FAST32_TYPE	"unsigned int"
 #define UINT_FAST64_TYPE	"long long unsigned int"
+
+#define INTMAX_TYPE		"long long int"
+#define UINTMAX_TYPE		"long long unsigned int"
  
 #define INTPTR_TYPE		"long int"
 #define UINTPTR_TYPE		"long unsigned int"