public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch} Fix dynamic casts across dll boundaries on windows targets
@ 2004-10-16  9:47 Danny Smith
  2004-10-17 22:25 ` Christopher Faylor
  2004-10-19  6:21 ` Aaron W. LaFramboise
  0 siblings, 2 replies; 5+ messages in thread
From: Danny Smith @ 2004-10-16  9:47 UTC (permalink / raw)
  To: GCC Patches; +Cc: Christopher Faylor

Hello
This fixes a long standing libstdc++ bug in windows targets, where dynamic casts
that cross dll boundaries fail. The bug was  first reported to
mingw lists by Colin Peters in Jun 2002 as a regression against 2.95

http://sourceforge.net/tracker/?func=detail&atid=102435&aid=568054&group_id=2435

and fixed locally by a cygwin/mingw specific hack to the typeinfo header:

http://www.cygwin.com/ml/cygwin-apps/2002-07/msg00550.html

The following uses Mark Mitchell's fix for the same problem on bpabi
targets.  Tested on i686-pc-mingw32 with no new regressions.

2004-10-16  Danny Smith  <dannysmith@users.sourceforge.net>

	* config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Define
	__GXX_MERGED_TYPEINFO_NAMES to 0.


Index: config/i386/cygming.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/cygming.h,v
retrieving revision 1.21
diff -c -3 -p -r1.21 cygming.h
*** config/i386/cygming.h	9 Sep 2004 17:11:17 -0000	1.21
--- config/i386/cygming.h	16 Oct 2004 08:23:59 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 86,91 ****
--- 86,94 ----
  	    builtin_define ("_fastcall=__attribute__((__fastcall__))");	\
  	    builtin_define ("_cdecl=__attribute__((__cdecl__))");	\
  	  }								\
+ 	/* Even though linkonce works with static libs, this is needed 	\
+ 	    to compare typeinfo symbols across dll boundaries.  */	\
+ 	builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0");		\
  	MAYBE_UWIN_CPP_BUILTINS ();					\
  	EXTRA_OS_CPP_BUILTINS ();					\
    }									\

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch} Fix dynamic casts across dll boundaries on windows targets
  2004-10-16  9:47 [Patch} Fix dynamic casts across dll boundaries on windows targets Danny Smith
@ 2004-10-17 22:25 ` Christopher Faylor
  2004-10-19  6:21 ` Aaron W. LaFramboise
  1 sibling, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2004-10-17 22:25 UTC (permalink / raw)
  To: Danny Smith; +Cc: GCC Patches

>2004-10-16  Danny Smith  <dannysmith@users.sourceforge.net>
>
>	* config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Define
>	__GXX_MERGED_TYPEINFO_NAMES to 0.

ok.

cgf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch} Fix dynamic casts across dll boundaries on windows targets
  2004-10-16  9:47 [Patch} Fix dynamic casts across dll boundaries on windows targets Danny Smith
  2004-10-17 22:25 ` Christopher Faylor
@ 2004-10-19  6:21 ` Aaron W. LaFramboise
  2004-10-19 10:52   ` Danny Smith
  1 sibling, 1 reply; 5+ messages in thread
From: Aaron W. LaFramboise @ 2004-10-19  6:21 UTC (permalink / raw)
  To: Danny Smith; +Cc: GCC Patches, Christopher Faylor

Danny Smith wrote:

> 2004-10-16  Danny Smith  <dannysmith@users.sourceforge.net>
> 
> 	* config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Define
> 	__GXX_MERGED_TYPEINFO_NAMES to 0.

Does this pessimize the case where typeinfo symbols really are
availible?  An example might be when a DLL exports the typeinfo symbols
and they are linkable with auto-import.  (Will auto-import work for
this, anyway?)

Another source for experience in this area is the recent ELF visibility
work.  For example, see the secton Caveats in
<http://www.nedprod.com/programs/gccvisibility.html>.  The suggestion
here is that if you want RTTI to work, you must take necessary steps to
export typeinfo symbols.  Is a similar approach for PE unreasonable?

Aaron W. LaFramboise

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch} Fix dynamic casts across dll boundaries on windows targets
  2004-10-19  6:21 ` Aaron W. LaFramboise
@ 2004-10-19 10:52   ` Danny Smith
  2004-10-21  3:59     ` Aaron W. LaFramboise
  0 siblings, 1 reply; 5+ messages in thread
From: Danny Smith @ 2004-10-19 10:52 UTC (permalink / raw)
  To: Aaron W. LaFramboise; +Cc: GCC Patches, Christopher Faylor

Aaron W. LaFramboise wrote:
> Danny Smith wrote:
>
>> 2004-10-16  Danny Smith  <>
>>
>> * config/i386/cygming.h (TARGET_OS_CPP_BUILTINS): Define
>> __GXX_MERGED_TYPEINFO_NAMES to 0.
>
> Does this pessimize the case where typeinfo symbols really are
> availible?

It pessimizes linking against static libs/objects

 An example might be when a DLL exports the typeinfo
> symbols and they are linkable with auto-import.  (Will auto-import
> work for this, anyway?)
>

There is a test case in the original bug report :
http://sourceforge.net/tracker/?func=detail&atid=102435&aid=568054&group
_id=2435


> Another source for experience in this area is the recent ELF
> visibility work.  For example, see the secton Caveats in
> <http://www.nedprod.com/programs/gccvisibility.html>.  The suggestion
> here is that if you want RTTI to work, you must take necessary steps
> to export typeinfo symbols.  Is a similar approach for PE
> unreasonable?


One of the problems with RTTI vs dllimport is that dllimported objects
do not have a constant address at compile time. This creates a problem
for static initialisation of,  say, another RTTI object or a vtable
that has a
dllimported typeinfo member.
Danny

>
> Aaron W. LaFramboise



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch} Fix dynamic casts across dll boundaries on windows targets
  2004-10-19 10:52   ` Danny Smith
@ 2004-10-21  3:59     ` Aaron W. LaFramboise
  0 siblings, 0 replies; 5+ messages in thread
From: Aaron W. LaFramboise @ 2004-10-21  3:59 UTC (permalink / raw)
  To: Danny Smith; +Cc: GCC Patches, Christopher Faylor

Danny Smith wrote:

> One of the problems with RTTI vs dllimport is that dllimported objects
> do not have a constant address at compile time. This creates a problem
> for static initialisation of,  say, another RTTI object or a vtable
> that has a
> dllimported typeinfo member.

Does autoimport or the pseudo-relocator help with this?

Aaron W. LaFramboise

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-10-21  3:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-16  9:47 [Patch} Fix dynamic casts across dll boundaries on windows targets Danny Smith
2004-10-17 22:25 ` Christopher Faylor
2004-10-19  6:21 ` Aaron W. LaFramboise
2004-10-19 10:52   ` Danny Smith
2004-10-21  3:59     ` Aaron W. LaFramboise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).