www.digitalmars.com         C & C++   DMDScript  

D.gnu - Assembler problem while trying to integrate D iompiler in GCC suite

reply "Gerrit P. Haase" <gerrit familiehaase.de> writes:
Hi all,

I'm trying to integrate the D frontend for GCC in the GCC 3.4.4 release,
I'm in contact with the maintainer David Friedman, he successfully
compiled the current (0.12.1) sources with MinGW and I expect that he
also has tested it with other supported platforms, however I get this
error now and I have not really an idea what the reason may be.  I found
one patch for gas for another platform:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=857
http://sources.redhat.com/bugzilla/show_bug.cgi?id=936
http://sourceware.org/ml/binutils/2005-05/msg00289.html

However I don't know if this is related or if there may be another 
problem with the e.g. source.

What is new in the source regarding this problem is this patch which 
gives me the error cited below:

diff -cr d-0.12/README d-0.12.1/README
*** d-0.12/README	Sat May 28 18:00:56 2005
--- d-0.12.1/README	Sun Jun  5 19:51:22 2005
***************
*** 1,6 ****
! D Front End for GCC - Release 0.12

! Last update: May 24, 2005
   Supported Systems

       * GCC 3.3.x, 3.4.x
--- 1,6 ----
! D Front End for GCC - Release 0.12.1

! Last update: June 5, 2005
   Supported Systems

       * GCC 3.3.x, 3.4.x
***************
*** 17,25 ****

   Downloads

!     * Main package (Release 0.12)
!       http://home.earthlink.net/~dvdfrdmn/d/gdc-0.12.tgz
!       http://home.earthlink.net/~dvdfrdmn/d/gdc-0.12.tar.bz2
       * Build Instructions
         http://home.earthlink.net/~dvdfrdmn/d/INSTALL.html
         (or see INSTALL included in the main package)
--- 17,25 ----

   Downloads

!     * Main package (Release 0.12.1)
!       http://home.earthlink.net/~dvdfrdmn/d/gdc-0.12.1.tgz
!       http://home.earthlink.net/~dvdfrdmn/d/gdc-0.12.1.tar.bz2
       * Build Instructions
         http://home.earthlink.net/~dvdfrdmn/d/INSTALL.html
         (or see INSTALL included in the main package)
***************
*** 172,177 ****
--- 172,186 ----

   Changes

+ 0.12.1:
+
+     *  Fixes
+           o Compilation errors and crashes with -fpic
+           o Crashes with interfaces on Cygwin/MinGW
+           o Support the -mno-cygwin option
+
+ 0.12:
+
       *  Fixes
             o Various problems building MinGW in MSYS
             o Mango "endless output"
diff -cr d-0.12/d-codegen.cc d-0.12.1/d-codegen.cc
*** d-0.12/d-codegen.cc	Sat May 28 18:00:56 2005
--- d-0.12.1/d-codegen.cc	Sun Jun  5 19:27:36 2005
***************
*** 1743,1748 ****
--- 1743,1805 ----
       return call_exp;
   }

+
+ #if D_GCC_VER >= 34
+ #ifdef ASM_OUTPUT_DEF
+ static int thunk_labelno;
+
+ /* Create a static alias to function.  */
+
+ static tree
+ make_alias_for_thunk (tree function)
+ {
+   tree alias;
+   char buf[256];
+
+ #if defined (TARGET_IS_PE_COFF)
+   if (DECL_ONE_ONLY (function))
+     return function;
+ #endif
+
+   ASM_GENERATE_INTERNAL_LABEL (buf, "LTHUNK", thunk_labelno);
+   thunk_labelno++;
+   alias = build_decl (FUNCTION_DECL, get_identifier (buf),
+ 		      TREE_TYPE (function));
+   //DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function);
+   //cxx_dup_lang_specific_decl (alias);
+   DECL_CONTEXT (alias) = NULL;
+   TREE_READONLY (alias) = TREE_READONLY (function);
+   TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function);
+   TREE_PUBLIC (alias) = 0;
+   //DECL_INTERFACE_KNOWN (alias) = 1;
+   //DECL_NOT_REALLY_EXTERN (alias) = 1;
+   //DECL_THIS_STATIC (alias) = 1;
+   //DECL_SAVED_FUNCTION_DATA (alias) = NULL;
+   //DECL_DESTRUCTOR_P (alias) = 0;
+   //DECL_CONSTRUCTOR_P (alias) = 0;
+   //DECL_CLONED_FUNCTION (alias) = NULL_TREE;
+   DECL_EXTERNAL (alias) = 0;
+   DECL_ARTIFICIAL (alias) = 1;
+   DECL_NO_STATIC_CHAIN (alias) = 1;
+   //DECL_PENDING_INLINE_P (alias) = 0;
+   DECL_INLINE (alias) = 0;
+   DECL_DECLARED_INLINE_P (alias) = 0;
+   //DECL_DEFERRED_FN (alias) = 0;
+   //DECL_USE_TEMPLATE (alias) = 0;
+   //DECL_TEMPLATE_INSTANTIATED (alias) = 0;
+   //DECL_TEMPLATE_INFO (alias) = NULL;
+   //DECL_INITIAL (alias) = error_mark_node;
+   TREE_ADDRESSABLE (alias) = 1;
+   TREE_USED (alias) = 1;
+   SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
+   TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1;
+   if (!flag_syntax_only)
+     assemble_alias (alias, DECL_ASSEMBLER_NAME (function));
+   return alias;
+ }
+ #endif
+ #endif
+
   // Can't output thunks while a function is being compiled. Called from
   // d-decls.cc (no cur_irs)
   static Array deferredThunks;
***************
*** 1787,1799 ****
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
!     tree alias = target_decl;

       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
! #ifdef ASM_OUTPUT_DEF
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
--- 1844,1866 ----
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
!     tree alias;
! #if D_GCC_VER >= 34
! #ifdef ASM_OUTPUT_DEF
!     alias = make_alias_for_thunk(target_decl);
! #else
!     alias = target_decl;
! #endif
! #else
!     alias = target_decl;
! #endif

       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
! #if defined (ASM_OUTPUT_DEF) \
!   && !defined (TARGET_IS_PE_COFF)
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
diff -cr d-0.12/d-glue.cc d-0.12.1/d-glue.cc
*** d-0.12/d-glue.cc	Thu May 26 21:05:04 2005
--- d-0.12.1/d-glue.cc	Sun Jun  5 19:27:36 2005
***************
*** 2361,2366 ****
--- 2361,2367 ----
   		build_pointer_type( mod_ref_type ));
   	    dkeep(the_mod_ref);
   	    DECL_EXTERNAL( the_mod_ref ) = 1;
+ 	    TREE_PUBLIC( the_mod_ref ) = 1;

   	    tree m1 = build(MODIFY_EXPR, void_type_node,
   		build(COMPONENT_REF, TREE_TYPE(f0), our_mod_ref, f0),



Gives me this error now:

$ /gcc/gcc-3.4.4/gcc-3.4.4-1/.build/gcc/gdc -save-temps 
-B/gcc/gcc-3.4.4/gcc-3.4.4-1/.build/gcc/ -B/usr/i686-pc-cygwin/bin/ 
-B/usr/i686-pc-cy>
gdc: warning: -pipe ignored because -save-temps specified
socketstream.s: Assembler messages:
socketstream.s:1416: Error: Local symbol `LTHUNK0' can't be equated to 
undefined symbol `__D3std6stream6Stream9readExactFPvkZv'
socketstream.s:1416: Error: Local symbol `LTHUNK1' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFAhZk'
socketstream.s:1416: Error: Local symbol `LTHUNK2' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJgZv'
socketstream.s:1416: Error: Local symbol `LTHUNK3' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJhZv'
socketstream.s:1416: Error: Local symbol `LTHUNK4' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJsZv'
socketstream.s:1416: Error: Local symbol `LTHUNK5' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJtZv'
socketstream.s:1416: Error: Local symbol `LTHUNK6' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJiZv'
socketstream.s:1416: Error: Local symbol `LTHUNK7' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJkZv'
socketstream.s:1416: Error: Local symbol `LTHUNK8' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJlZv'
socketstream.s:1416: Error: Local symbol `LTHUNK9' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJmZv'
socketstream.s:1416: Error: Local symbol `LTHUNK10' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJfZv'
socketstream.s:1416: Error: Local symbol `LTHUNK11' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJdZv'
socketstream.s:1416: Error: Local symbol `LTHUNK12' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJeZv'
socketstream.s:1416: Error: Local symbol `LTHUNK13' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJoZv'
socketstream.s:1416: Error: Local symbol `LTHUNK14' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJpZv'
socketstream.s:1416: Error: Local symbol `LTHUNK15' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJjZv'
socketstream.s:1416: Error: Local symbol `LTHUNK16' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJqZv'
socketstream.s:1416: Error: Local symbol `LTHUNK17' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJrZv'
socketstream.s:1416: Error: Local symbol `LTHUNK18' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJcZv'
socketstream.s:1416: Error: Local symbol `LTHUNK19' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJaZv'
socketstream.s:1416: Error: Local symbol `LTHUNK20' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJuZv'
socketstream.s:1416: Error: Local symbol `LTHUNK21' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJwZv'
socketstream.s:1416: Error: Local symbol `LTHUNK22' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJAaZv'
socketstream.s:1416: Error: Local symbol `LTHUNK23' can't be equated to 
undefined symbol `__D3std6stream6Stream4readFJAuZv'
socketstream.s:1416: Error: Local symbol `LTHUNK25' can't be equated to 
undefined symbol `__D3std6stream6Stream8readLineFAaZAa'
socketstream.s:1416: Error: Local symbol `LTHUNK27' can't be equated to 
undefined symbol `__D3std6stream6Stream9readLineWFAuZAu'
socketstream.s:1416: Error: Local symbol `LTHUNK28' can't be equated to 
undefined symbol `__D3std6stream6Stream7opApplyFDFKAaZiZi'
socketstream.s:1416: Error: Local symbol `LTHUNK29' can't be equated to 
undefined symbol `__D3std6stream6Stream7opApplyFDFKmKAaZiZi'
socketstream.s:1416: Error: Local symbol `LTHUNK30' can't be equated to 
undefined symbol `__D3std6stream6Stream7opApplyFDFKAuZiZi'
socketstream.s:1416: Error: Local symbol `LTHUNK31' can't be equated to 
undefined symbol `__D3std6stream6Stream7opApplyFDFKmKAuZiZi'
socketstream.s:1416: Error: Local symbol `LTHUNK32' can't be equated to 
undefined symbol `__D3std6stream6Stream10readStringFkZAa'
socketstream.s:1416: Error: Local symbol `LTHUNK33' can't be equated to 
undefined symbol `__D3std6stream6Stream11readStringWFkZAu'
socketstream.s:1416: Error: Local symbol `LTHUNK36' can't be equated to 
undefined symbol `__D3std6stream6Stream6ungetcFaZa'
socketstream.s:1416: Error: Local symbol `LTHUNK37' can't be equated to 
undefined symbol `__D3std6stream6Stream7ungetcwFuZu'
socketstream.s:1416: Error: Local symbol `LTHUNK38' can't be equated to 
undefined symbol `__D3std6stream6Stream6vscanfFAaPaZi'
socketstream.s:1416: Error: Local symbol `LTHUNK39' can't be equated to 
undefined symbol `__D3std6stream6Stream5scanfFAaYi'
socketstream.s:1416: Error: Local symbol `LTHUNK40' can't be equated to 
undefined symbol `__D3std6stream6Stream9availableFZk'
socketstream.s:1416: Error: Local symbol `LTHUNK42' can't be equated to 
undefined symbol `__D3std6stream6Stream6isOpenFZb'
socketstream.s:1416: Error: Local symbol `LTHUNK43' can't be equated to 
undefined symbol `__D3std6stream6Stream10writeExactFPvkZv'
socketstream.s:1416: Error: Local symbol `LTHUNK44' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFAhZk'
socketstream.s:1416: Error: Local symbol `LTHUNK45' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFgZv'
socketstream.s:1416: Error: Local symbol `LTHUNK46' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFhZv'
socketstream.s:1416: Error: Local symbol `LTHUNK47' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFsZv'
socketstream.s:1416: Error: Local symbol `LTHUNK48' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFtZv'
socketstream.s:1416: Error: Local symbol `LTHUNK49' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFiZv'
socketstream.s:1416: Error: Local symbol `LTHUNK50' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFkZv'
socketstream.s:1416: Error: Local symbol `LTHUNK51' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFlZv'
socketstream.s:1416: Error: Local symbol `LTHUNK52' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFmZv'
socketstream.s:1416: Error: Local symbol `LTHUNK53' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFfZv'
socketstream.s:1416: Error: Local symbol `LTHUNK54' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFdZv'
socketstream.s:1416: Error: Local symbol `LTHUNK55' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFeZv'
socketstream.s:1416: Error: Local symbol `LTHUNK56' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFoZv'
socketstream.s:1416: Error: Local symbol `LTHUNK57' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFpZv'
socketstream.s:1416: Error: Local symbol `LTHUNK58' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFjZv'
socketstream.s:1416: Error: Local symbol `LTHUNK59' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFqZv'
socketstream.s:1416: Error: Local symbol `LTHUNK60' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFrZv'
socketstream.s:1416: Error: Local symbol `LTHUNK61' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFcZv'
socketstream.s:1416: Error: Local symbol `LTHUNK62' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFaZv'
socketstream.s:1416: Error: Local symbol `LTHUNK63' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFuZv'
socketstream.s:1416: Error: Local symbol `LTHUNK64' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFwZv'
socketstream.s:1416: Error: Local symbol `LTHUNK65' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFAaZv'
socketstream.s:1416: Error: Local symbol `LTHUNK66' can't be equated to 
undefined symbol `__D3std6stream6Stream5writeFAuZv'
socketstream.s:1416: Error: Local symbol `LTHUNK67' can't be equated to 
undefined symbol `__D3std6stream6Stream9writeLineFAaZv'
socketstream.s:1416: Error: Local symbol `LTHUNK68' can't be equated to 
undefined symbol `__D3std6stream6Stream10writeLineWFAuZv'
socketstream.s:1416: Error: Local symbol `LTHUNK69' can't be equated to 
undefined symbol `__D3std6stream6Stream11writeStringFAaZv'
socketstream.s:1416: Error: Local symbol `LTHUNK70' can't be equated to 
undefined symbol `__D3std6stream6Stream12writeStringWFAuZv'
socketstream.s:1416: Error: Local symbol `LTHUNK71' can't be equated to 
undefined symbol `__D3std6stream6Stream7vprintfFAaPaZk'
socketstream.s:1416: Error: Local symbol `LTHUNK72' can't be equated to 
undefined symbol `__D3std6stream6Stream6printfFAaYk'
socketstream.s:1416: Error: Local symbol `LTHUNK73' can't be equated to 
undefined symbol `__D3std6stream6Stream6writefFYC3std6stream6Stream'
socketstream.s:1416: Error: Local symbol `LTHUNK74' can't be equated to 
undefined symbol `__D3std6stream6Stream8writeflnFYC3std6stream6Stream'
socketstream.s:1416: Error: Local symbol `LTHUNK75' can't be equated to 
undefined symbol `__D3std6stream6Stream5flushFZv'
socketstream.s:1416: Error: Local symbol `LTHUNK77' can't be equated to 
undefined symbol `__D3std6stream6Stream6isOpenFZb'


Gerrit
-- 
=^..^=
Jun 07 2005
next sibling parent reply "Gerrit P. Haase" <gerrit familiehaase.de> writes:
Gerrit P. Haase wrote:
 Hi all,
 
 I'm trying to integrate the D frontend for GCC in the GCC 3.4.4 release,
 I'm in contact with the maintainer David Friedman, he successfully
 compiled the current (0.12.1) sources with MinGW and I expect that he
 also has tested it with other supported platforms, however I get this
 error now and I have not really an idea what the reason may be.  I found
 one patch for gas for another platform:
 http://sources.redhat.com/bugzilla/show_bug.cgi?id=857
 http://sources.redhat.com/bugzilla/show_bug.cgi?id=936
 http://sourceware.org/ml/binutils/2005-05/msg00289.html
 
 However I don't know if this is related or if there may be another 
 problem with the e.g. source.
 
 What is new in the source regarding this problem is this patch which 
 gives me the error cited below:
 ***************
 *** 1787,1799 ****
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
 !     tree alias = target_decl;
 
       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
 ! #ifdef ASM_OUTPUT_DEF
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
 --- 1844,1866 ----
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
 !     tree alias;
 ! #if D_GCC_VER >= 34
 ! #ifdef ASM_OUTPUT_DEF
 !     alias = make_alias_for_thunk(target_decl);
 ! #else
 !     alias = target_decl;
 ! #endif
 ! #else
 !     alias = target_decl;
 ! #endif
 
       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
 ! #if defined (ASM_OUTPUT_DEF) \
 !   && !defined (TARGET_IS_PE_COFF)
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
Maybe this is the problem here: ! && !defined (TARGET_IS_PE_COFF) Is TARGET_IS_PE_COFF defined for Cygwin? Gerrit -- =^..^=
Jun 07 2005
parent reply "Gerrit P. Haase" <gerrit familiehaase.de> writes:
Gerrit P. Haase wrote:

 Gerrit P. Haase wrote:
 
 Hi all,

 I'm trying to integrate the D frontend for GCC in the GCC 3.4.4 release,
 I'm in contact with the maintainer David Friedman, he successfully
 compiled the current (0.12.1) sources with MinGW and I expect that he
 also has tested it with other supported platforms, however I get this
 error now and I have not really an idea what the reason may be.  I found
 one patch for gas for another platform:
 http://sources.redhat.com/bugzilla/show_bug.cgi?id=857
 http://sources.redhat.com/bugzilla/show_bug.cgi?id=936
 http://sourceware.org/ml/binutils/2005-05/msg00289.html

 However I don't know if this is related or if there may be another 
 problem with the e.g. source.

 What is new in the source regarding this problem is this patch which 
 gives me the error cited below:
 ***************
 *** 1787,1799 ****
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
 !     tree alias = target_decl;

       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
 ! #ifdef ASM_OUTPUT_DEF
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
 --- 1844,1866 ----
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
 !     tree alias;
 ! #if D_GCC_VER >= 34
 ! #ifdef ASM_OUTPUT_DEF
 !     alias = make_alias_for_thunk(target_decl);
 ! #else
 !     alias = target_decl;
 ! #endif
 ! #else
 !     alias = target_decl;
 ! #endif

       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
 ! #if defined (ASM_OUTPUT_DEF) \
 !   && !defined (TARGET_IS_PE_COFF)
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
Maybe this is the problem here: ! && !defined (TARGET_IS_PE_COFF) Is TARGET_IS_PE_COFF defined for Cygwin?
Yes it is: #define TARGET_IS_PE_COFF 1 Is this wrong in the d-codegen source? I'kll try what changes if I include Cygwin: ! #if defined (ASM_OUTPUT_DEF) \ ! && (!defined (TARGET_IS_PE_COFF) && !defined(__CYGWIN__)) Gerrit
Jun 07 2005
next sibling parent reply David Friedman <d3rdclsmail_a t_earthlink_d.t_net> writes:
Gerrit P. Haase wrote:
 Gerrit P. Haase wrote:
 
 Gerrit P. Haase wrote:

 Hi all,

 I'm trying to integrate the D frontend for GCC in the GCC 3.4.4 release,
 I'm in contact with the maintainer David Friedman, he successfully
 compiled the current (0.12.1) sources with MinGW and I expect that he
 also has tested it with other supported platforms, however I get this
 error now and I have not really an idea what the reason may be.  I found
 one patch for gas for another platform:
 http://sources.redhat.com/bugzilla/show_bug.cgi?id=857
 http://sources.redhat.com/bugzilla/show_bug.cgi?id=936
 http://sourceware.org/ml/binutils/2005-05/msg00289.html

 However I don't know if this is related or if there may be another 
 problem with the e.g. source.

 What is new in the source regarding this problem is this patch which 
 gives me the error cited below:
 ***************
 *** 1787,1799 ****
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
 !     tree alias = target_decl;

       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
 ! #ifdef ASM_OUTPUT_DEF
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
 --- 1844,1866 ----
   IRState::outputThunk(tree thunk_decl, tree target_decl, int offset)
   {
       int delta = -offset;
 !     tree alias;
 ! #if D_GCC_VER >= 34
 ! #ifdef ASM_OUTPUT_DEF
 !     alias = make_alias_for_thunk(target_decl);
 ! #else
 !     alias = target_decl;
 ! #endif
 ! #else
 !     alias = target_decl;
 ! #endif

       TREE_ADDRESSABLE(target_decl) = 1;
       TREE_USED(target_decl) = 1;
   #if D_GCC_VER >= 34
       DECL_VISIBILITY (thunk_decl) = DECL_VISIBILITY (target_decl);
 ! #if defined (ASM_OUTPUT_DEF) \
 !   && !defined (TARGET_IS_PE_COFF)
     if (targetm.have_named_sections)
       {
         resolve_unique_section (target_decl, 0, flag_function_sections);
Maybe this is the problem here: ! && !defined (TARGET_IS_PE_COFF) Is TARGET_IS_PE_COFF defined for Cygwin?
Yes it is: #define TARGET_IS_PE_COFF 1 Is this wrong in the d-codegen source? I'kll try what changes if I include Cygwin: ! #if defined (ASM_OUTPUT_DEF) \ ! && (!defined (TARGET_IS_PE_COFF) && !defined(__CYGWIN__)) Gerrit
That check for TARGET_IS_PE_COFF is necessary. Without it, there is a very nasty code gen bug that won't show up until you run the code. This is probably a better test: --- d-codegen.cc.orig Tue Jun 7 14:10:57 2005 +++ d-codegen.cc Tue Jun 7 14:11:55 2005 -1757,7 +1757,7 char buf[256]; #if defined (TARGET_IS_PE_COFF) - if (DECL_ONE_ONLY (function)) + // if (DECL_ONE_ONLY (function)) return function; #endif It might break -fpic code generation again, though. I won't be able to test it until later today, but you can try it yourself by adding "-fpic" to the DFLAGS in Phobos Makefile. David
Jun 07 2005
next sibling parent "Gerrit P. Haase" <gerrit familiehaase.de> writes:
David Friedman wrote:
 Maybe this is the problem here:
 !   && !defined (TARGET_IS_PE_COFF)


 Is TARGET_IS_PE_COFF defined for Cygwin?
Yes it is: #define TARGET_IS_PE_COFF 1 Is this wrong in the d-codegen source? I'kll try what changes if I include Cygwin: ! #if defined (ASM_OUTPUT_DEF) \ ! && (!defined (TARGET_IS_PE_COFF) && !defined(__CYGWIN__)) Gerrit
That check for TARGET_IS_PE_COFF is necessary. Without it, there is a very nasty code gen bug that won't show up until you run the code. This is probably a better test: --- d-codegen.cc.orig Tue Jun 7 14:10:57 2005 +++ d-codegen.cc Tue Jun 7 14:11:55 2005 -1757,7 +1757,7 char buf[256]; #if defined (TARGET_IS_PE_COFF) - if (DECL_ONE_ONLY (function)) + // if (DECL_ONE_ONLY (function)) return function; #endif It might break -fpic code generation again, though. I won't be able to test it until later today, but you can try it yourself by adding "-fpic" to the DFLAGS in Phobos Makefile.
-fpic is totally unsupported on Windows because on Windows everything is position independat anyway. I'll try this now. See you later, Gerrit
Jun 07 2005
prev sibling parent "Gerrit P. Haase" <gerrit familiehaase.de> writes:
David Friedman wrote:
 This is probably a better test:
 
 --- d-codegen.cc.orig    Tue Jun  7 14:10:57 2005
 +++ d-codegen.cc    Tue Jun  7 14:11:55 2005
    -1757,7 +1757,7   
    char buf[256];
 
  #if defined (TARGET_IS_PE_COFF)
 -  if (DECL_ONE_ONLY (function))
 +  //  if (DECL_ONE_ONLY (function))
      return function;
  #endif
 
 It might break -fpic code generation again, though.  I won't be able to 
 test it until later today, but you can try it yourself by adding "-fpic" 
 to the DFLAGS in Phobos Makefile.
Yes, now it compiles, thank you. Gerrit
Jun 07 2005
prev sibling parent "Gerrit P. Haase" <gerrit familiehaase.de> writes:
Gerrit P. Haase wrote:

 Maybe this is the problem here:
 !   && !defined (TARGET_IS_PE_COFF)


 Is TARGET_IS_PE_COFF defined for Cygwin?
Yes it is: #define TARGET_IS_PE_COFF 1 Is this wrong in the d-codegen source? I'kll try what changes if I include Cygwin: ! #if defined (ASM_OUTPUT_DEF) \ ! && (!defined (TARGET_IS_PE_COFF) && !defined(__CYGWIN__))
Nope, this was not the problem. Gerrit
Jun 07 2005
prev sibling parent "Gerrit P. Haase" <gerrit familiehaase.de> writes:
Gerrit P. Haase wrote:

 Hi all,
 
 I'm trying to integrate the D frontend for GCC in the GCC 3.4.4 release,
 I'm in contact with the maintainer David Friedman, he successfully
 compiled the current (0.12.1) sources with MinGW and I expect that he
 also has tested it with other supported platforms, however I get this
 error now and I have not really an idea what the reason may be. 
[...]
 What is new in the source regarding this problem is this patch which 
 gives me the error cited below:
[...] This part is 1:1 from C++/methods.c, besides the commented lines, these are ncluded in the C++ compiler, so it seems that one or more of these comments here are too much because the C++ compiler is working:
 diff -cr d-0.12/d-codegen.cc d-0.12.1/d-codegen.cc
 *** d-0.12/d-codegen.cc    Sat May 28 18:00:56 2005
 --- d-0.12.1/d-codegen.cc    Sun Jun  5 19:27:36 2005
 ***************
 *** 1743,1748 ****
 --- 1743,1805 ----
       return call_exp;
   }
 
 +
 + #if D_GCC_VER >= 34
 + #ifdef ASM_OUTPUT_DEF
 + static int thunk_labelno;
 +
 + /* Create a static alias to function.  */
 +
 + static tree
 + make_alias_for_thunk (tree function)
 + {
 +   tree alias;
 +   char buf[256];
 +
 + #if defined (TARGET_IS_PE_COFF)
 +   if (DECL_ONE_ONLY (function))
 +     return function;
 + #endif
 +
 +   ASM_GENERATE_INTERNAL_LABEL (buf, "LTHUNK", thunk_labelno);
 +   thunk_labelno++;
 +   alias = build_decl (FUNCTION_DECL, get_identifier (buf),
 +               TREE_TYPE (function));
 +   //DECL_LANG_SPECIFIC (alias) = DECL_LANG_SPECIFIC (function);
 +   //cxx_dup_lang_specific_decl (alias);
 +   DECL_CONTEXT (alias) = NULL;
 +   TREE_READONLY (alias) = TREE_READONLY (function);
 +   TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (function);
 +   TREE_PUBLIC (alias) = 0;
 +   //DECL_INTERFACE_KNOWN (alias) = 1;
 +   //DECL_NOT_REALLY_EXTERN (alias) = 1;
 +   //DECL_THIS_STATIC (alias) = 1;
 +   //DECL_SAVED_FUNCTION_DATA (alias) = NULL;
 +   //DECL_DESTRUCTOR_P (alias) = 0;
 +   //DECL_CONSTRUCTOR_P (alias) = 0;
 +   //DECL_CLONED_FUNCTION (alias) = NULL_TREE;
 +   DECL_EXTERNAL (alias) = 0;
 +   DECL_ARTIFICIAL (alias) = 1;
 +   DECL_NO_STATIC_CHAIN (alias) = 1;
 +   //DECL_PENDING_INLINE_P (alias) = 0;
 +   DECL_INLINE (alias) = 0;
 +   DECL_DECLARED_INLINE_P (alias) = 0;
 +   //DECL_DEFERRED_FN (alias) = 0;
 +   //DECL_USE_TEMPLATE (alias) = 0;
 +   //DECL_TEMPLATE_INSTANTIATED (alias) = 0;
 +   //DECL_TEMPLATE_INFO (alias) = NULL;
 +   //DECL_INITIAL (alias) = error_mark_node;
 +   TREE_ADDRESSABLE (alias) = 1;
 +   TREE_USED (alias) = 1;
 +   SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
 +   TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1;
 +   if (!flag_syntax_only)
 +     assemble_alias (alias, DECL_ASSEMBLER_NAME (function));
 +   return alias;
 + }
 + #endif
 + #endif
 +
   // Can't output thunks while a function is being compiled. Called from
   // d-decls.cc (no cur_irs)
   static Array deferredThunks;
Gerrit
Jun 07 2005