[openbeos] Re: Misc. problems building Haiku on Linux

On 2005-11-13 at 19:34:47 [+0100], Ingo Weinhold wrote:
> 
> On 2005-11-13 at 17:42:03 [+0100], Vegard Wærp wrote:
> > Some are having problems building the cross tools, with the build 
> > failing with:
> > 
> > from /home/kane/haiku-src/buildtools/binutils/gas/app.c:30: 
> > /home/kane/haiku-src/buildtools/binutils/gas/config/tc-i386.h:451: 
> > error: array type has incomplete element type
> [...] 
> > This one has been reported both on Ubuntu and Fedora. Don't know which 
> > versions though.
> 
> The Linux distro isn't that interesting. I expect most problems depending 
> on the compiler version. I've tested things with the older gcc 3.3.4. The 
> 3.4.* series is stricter and the the 4.0.* series even more so. In this 
> case I suspect gcc 4 has been used. Maybe we can update our gas/binutils. 
> Oliver, are you listening? Would you deem that unwise?

Yep, I'm listening >;o)

Something at the back of my head is telling me that there was some problem 
with binutils > 2.15, but currently I can't remember what it was (maybe it 
was an incompatible interface change in ehopt.c [of which we use an old, 
forward-ported version], maybe it was something else). I guess the only way 
to find out is to try the update >:o/

Having looked into the mentioned problem just now, I suppose the problem 
could be fixed by moving the definition of struct relax_type from tc.h to 
as.h (where, according to a comment in tc.h, it used to live at some time 
in the past). I think the theory mentioned in the comment at tc.h:28 is no 
longer true (with gcc4), so we might just as well move the definition back 
into as.h. 

Could someone that has encountered the mentioned build issue with gcc4 
please refer to the enclosed patch and tell me if that fixes it?

cheers,
        Oliver
Index: as.h
===================================================================
--- as.h        (revision 11952)
+++ as.h        (working copy)
@@ -605,6 +605,26 @@
 struct expressionS;
 struct fix;
 typedef struct symbol symbolS;
+
+/* JF moved this here [tc.h] from as.h under the theory that nobody except 
+   MACHINE.c and write.c care about it anyway.  */
+/* [zooey]: the above no longer holds with gcc4, as it keeps bugging about
+            incomplete element types in arrays, if relax_type isn't defined
+            here. So I moved the definition back from tc.h to here. */
+struct relax_type
+{
+  /* Forward reach. Signed number. > 0.  */
+  long rlx_forward;
+  /* Backward reach. Signed number. < 0.  */
+  long rlx_backward;
+
+  /* Bytes length of this address.  */
+  unsigned char rlx_length;
+
+  /* Next longer relax-state.  0 means there is no 'next' relax-state.  */
+  relax_substateT rlx_more;
+};
+
 struct relax_type;
 typedef struct frag fragS;
 
Index: tc.h
===================================================================
--- tc.h        (revision 11952)
+++ tc.h        (working copy)
@@ -24,23 +24,6 @@
 
 extern const pseudo_typeS md_pseudo_table[];
 
-/* JF moved this here from as.h under the theory that nobody except MACHINE.c
-   and write.c care about it anyway.  */
-
-struct relax_type
-{
-  /* Forward reach. Signed number. > 0.  */
-  long rlx_forward;
-  /* Backward reach. Signed number. < 0.  */
-  long rlx_backward;
-
-  /* Bytes length of this address.  */
-  unsigned char rlx_length;
-
-  /* Next longer relax-state.  0 means there is no 'next' relax-state.  */
-  relax_substateT rlx_more;
-};
-
 typedef struct relax_type relax_typeS;
 
 extern const int md_reloc_size;        /* Size of a relocation record */

Other related posts: