V3 PATCH: Allow an OS to override _G_USING_THUNKS

Mark Mitchell mark@codesourcery.com
Sun Oct 29 13:26:00 GMT 2000


Because _G_config.h was hardwired to use thunks, we ran into pretty
serious problems with libio on platforms that didn't use thunks.

I bet this patch will allow Phil to fix the Solaris problem he
reported on October 27 in this message:

  http://sources.redhat.com/ml/libstdc++/2000-10/msg00229.html

Phil, try `#define _G_USING_THUNKS 0' in your OS override file, and
see if that helps.

N.B. -- I changed the tests of _G_USING_THUNKS in libioP.h to use
`#if' rather than `#ifdef'.  That's so that the _G_config.h file can
do:

  #ifndef _G_USING_THUNKS
  # define _G_USING_THUNKS	1
  #endif /* _G_USING_THUNKS */

rather than something like:

  #ifndef _G_DONT_USE_THUNKS
  #define  _G_USING_THUNKS
  #endif 

If that's problematic for some reason, please let me know, and I'll be
happy to do something else instead.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-10-29  Mark Mitchell  <mark@codesourcery.com>

	* _G_config.h (_G_USING_THUNKS): Allow overrides from
	OS-configuration files.
	* libioP.h: Test _G_USING_THUNKS with #if, rather than #ifdef.

Index: _G_config.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/libio/_G_config.h,v
retrieving revision 1.10
diff -c -p -r1.10 _G_config.h
*** _G_config.h	2000/10/25 16:54:47	1.10
--- _G_config.h	2000/10/29 21:18:13
*************** typedef unsigned int _G_uint32_t __attri
*** 116,122 ****
  /* These are the vtbl details for ELF.  */
  #define _G_NAMES_HAVE_UNDERSCORE 0
  #define _G_VTABLE_LABEL_HAS_LENGTH 1
! #define _G_USING_THUNKS	1
  #define _G_VTABLE_LABEL_PREFIX "__vt_"
  #define _G_VTABLE_LABEL_PREFIX_ID __vt_
  
--- 116,124 ----
  /* These are the vtbl details for ELF.  */
  #define _G_NAMES_HAVE_UNDERSCORE 0
  #define _G_VTABLE_LABEL_HAS_LENGTH 1
! #ifndef _G_USING_THUNKS
! # define _G_USING_THUNKS	1
! #endif /* _G_USING_THUNKS */
  #define _G_VTABLE_LABEL_PREFIX "__vt_"
  #define _G_VTABLE_LABEL_PREFIX_ID __vt_
  
Index: libioP.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/libio/libioP.h,v
retrieving revision 1.7
diff -c -p -r1.7 libioP.h
*** libioP.h	2000/10/17 08:25:08	1.7
--- libioP.h	2000/10/29 21:18:13
*************** extern "C" {
*** 82,88 ****
  # define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
  #endif
  #define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
! #ifdef _G_USING_THUNKS
  # define JUMP_FIELD(TYPE, NAME) TYPE NAME
  # define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
  # define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
--- 82,88 ----
  # define _IO_JUMPS_FUNC(THIS) _IO_JUMPS ((struct _IO_FILE_plus *) (THIS))
  #endif
  #define _IO_WIDE_JUMPS_FUNC(THIS) _IO_WIDE_JUMPS(THIS)
! #if _G_USING_THUNKS
  # define JUMP_FIELD(TYPE, NAME) TYPE NAME
  # define JUMP0(FUNC, THIS) _IO_JUMPS_FUNC(THIS)->FUNC (THIS)
  # define JUMP1(FUNC, THIS, X1) _IO_JUMPS_FUNC(THIS)->FUNC (THIS, X1)
*************** typedef void (*_IO_imbue_t) __PMT ((_IO_
*** 274,280 ****
  struct _IO_jump_t
  {
      JUMP_FIELD(_G_size_t, __dummy);
! #ifdef _G_USING_THUNKS
      JUMP_FIELD(_G_size_t, __dummy2);
  #endif
      JUMP_FIELD(_IO_finish_t, __finish);
--- 274,280 ----
  struct _IO_jump_t
  {
      JUMP_FIELD(_G_size_t, __dummy);
! #if _G_USING_THUNKS
      JUMP_FIELD(_G_size_t, __dummy2);
  #endif
      JUMP_FIELD(_IO_finish_t, __finish);


More information about the Gcc-patches mailing list