Skip to contentSkip to conversation

GCC 3.4.3: libobjc build failure

PATCH In review Denis Zaitsev 3 participants 13 messages Dec 20, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 GCC 3.4.3: libobjc build failure

This patch is for exactly the same issue as described in

http://gcc.gnu.org/ml/gcc/2002-12/msg00033.html

The fix is exactly the same, just another file is the target. Without it libobjc fails to build when --with-objc-gc is given to configure.

Please, apply it.

2004-12-21 Denis Zaitsev <[email protected]>

* libobjc/gc.c: Include coretypes.h and tm.h.

gc.c renamed from gc.c.orig +2 -0
@@ -26,6 +26,8 @@ Boston, MA 02111-1307, USA.  */
    the executable file might be covered by the GNU General Public License.  */
 
 #include "tconfig.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "objc.h"
 #include "encoding.h"
 
#1 lore raw
Quoted 6 lines · Denis Zaitsev

This patch is for exactly the same issue as described in

http://gcc.gnu.org/ml/gcc/2002-12/msg00033.html

The fix is exactly the same, just another file is the target. Without it libobjc fails to build when --with-objc-gc is given to configure.

This patch is incorrect as noted before. I am going to reject it as it was rejected before. Again libobjc has no reason to include these headers.

Thanks,
Andrew Pinski
libobjc maintainer

#2 lore raw
Quoted 5 lines · Andrew Pinski
Quoted 2 lines · Denis Zaitsev

This patch is for exactly the same issue as described in

Quoted 8 lines
Quoted 4 lines

http://gcc.gnu.org/ml/gcc/2002-12/msg00033.html

The fix is exactly the same, just another file is the target. Without it libobjc fails to build when --with-objc-gc is given to configure.

This patch is incorrect as noted before. I am going to reject it as it was rejected before. Again libobjc has no reason to include these headers.

a) The patches from the reference I've noted are already applied.

b) libobjc is not compiled without the new patch. How should it be fixed then?

#3 lore raw
Quoted 8 lines · Denis Zaitsev
Quoted 7 lines · Andrew Pinski
Quoted 4 lines · Denis Zaitsev

This patch is for exactly the same issue as described in

http://gcc.gnu.org/ml/gcc/2002-12/msg00033.html

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The fix is exactly the same, just another file is the target. Without it libobjc fails to build when --with-objc-gc is given to configure.

This patch is incorrect as noted before. I am going to reject it as it was rejected before. Again libobjc has no reason to include these headers.

a) The patches from the reference I've noted are already applied.

Yes and the patch was submitted before, see
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12035>.

Quoted 2 lines

b) libobjc is not compiled without the new patch. How should it be fixed then?

The uses of the macros are not needed as shown by a "grep -r ."

Does this patch fix the problem for you?

Thanks,
Andrew Pinski

Index: gc.c
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/gc.c,v
retrieving revision 1.6

gc.c +0 -12
diff -u -p -r1.6 gc.c
@@ -40,18 +40,6 @@ Boston, MA 02111-1307, USA.  */
 typedef GC_word word;
 typedef GC_signed_word signed_word;
 
-#if BITS_PER_WORD == 32
-# define LOGWL	5
-# define modWORDSZ(n) ((n) & 0x1f)        /* n mod size of word	    */
-#endif
-
-#if BITS_PER_WORD == 64
-# define LOGWL 6
-# define modWORDSZ(n) ((n) & 0x3f)        /* n mod size of word	    */
-#endif
-
-#define divWORDSZ(n) ((n) >> LOGWL)	   /* divide n by size of word      */
-
 #include <gc_typed.h>
 
 /* The following functions set up in `mask` the corresponding pointers.
#4 lore raw
Quoted 7 lines · Andrew Pinski
Quoted 3 lines

b) libobjc is not compiled without the new patch. How should it be fixed then?

The uses of the macros are not needed as shown by a "grep -r ."

Does this patch fix the problem for you?

Actually that patch will not work, sorry about that.

This one is better and should work.

If it does not report the errors please as it will help to fix the problem.

Thanks,
Andrew Pinski

Index: gc.c
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/gc.c,v
retrieving revision 1.6

gc.c +2 -12
diff -u -p -r1.6 gc.c
@@ -35,22 +35,12 @@ Boston, MA 02111-1307, USA.  */
 #if OBJC_WITH_GC
 
 #include <gc.h>
+#include <limits.h>
 
 /* gc_typed.h uses the following but doesn't declare them */
 typedef GC_word word;
 typedef GC_signed_word signed_word;
-
-#if BITS_PER_WORD == 32
-# define LOGWL	5
-# define modWORDSZ(n) ((n) & 0x1f)        /* n mod size of word	    */
-#endif
-
-#if BITS_PER_WORD == 64
-# define LOGWL 6
-# define modWORDSZ(n) ((n) & 0x3f)        /* n mod size of word	    */
-#endif
-
-#define divWORDSZ(n) ((n) >> LOGWL)	   /* divide n by size of word      */
+#define BITS_PER_WORD (CHAR_BIT * sizeof (word))
 
 #include <gc_typed.h>
 
#5 lore raw
Quoted 6 lines · Andrew Pinski

This one is better and should work.

If it does not report the errors please as it will help to fix the problem.

Yes, this patch seems to work, thanks. But the compiler still complains about undeclared atoi. Maybe it worth something to include <stdlib.h> somewhere?

#6 lore raw
Quoted 11 lines · Denis Zaitsev
Quoted 6 lines · Andrew Pinski

This one is better and should work.

If it does not report the errors please as it will help to fix the problem.

Yes, this patch seems to work, thanks. But the compiler still complains about undeclared atoi. Maybe it worth something to include <stdlib.h> somewhere?

Yes, this is what I applied to both the mainline and the 3.4 branch.

Thanks,
Andrew Pinski

ChangeLog:

* gc.c: Remove definition of LOGWL, modWORDSZ, and divWORDSZ since they are not used. Include limits.h and stdlib.h.

Index: gc.c
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/gc.c,v
retrieving revision 1.6

gc.c +3 -12
diff -u -p -r1.6 gc.c
@@ -31,26 +31,17 @@ Boston, MA 02111-1307, USA.  */
 
 #include <assert.h>
 #include <string.h>
+#include <stdlib.h>
 
 #if OBJC_WITH_GC
 
 #include <gc.h>
+#include <limits.h>
 
 /* gc_typed.h uses the following but doesn't declare them */
 typedef GC_word word;
 typedef GC_signed_word signed_word;
-
-#if BITS_PER_WORD == 32
-# define LOGWL	5
-# define modWORDSZ(n) ((n) & 0x1f)        /* n mod size of word	    */
-#endif
-
-#if BITS_PER_WORD == 64
-# define LOGWL 6
-# define modWORDSZ(n) ((n) & 0x3f)        /* n mod size of word	    */
-#endif
-
-#define divWORDSZ(n) ((n) >> LOGWL)	   /* divide n by size of word      */
+#define BITS_PER_WORD (CHAR_BIT * sizeof (word))
 
 #include <gc_typed.h>
 
#7 lore raw
Quoted 6 lines · Andrew Pinski

Yes, this is what I applied to both the mainline and the 3.4 branch.

Thanks,
Andrew Pinski

ChangeLog:

But with this changelog as I had forgot to put something about BITS_PER_WORD.

2004-12-20 Andrew Pinski <[email protected]>

PR libobjc/12035
* gc.c: Remove definition of LOGWL, modWORDSZ, and divWORDSZ
since
they are not used.
Include limits.h and stdlib.h.
Define BITS_PER_WORD.

Thanks,
Andrew Pinski

#8 lore raw
In reply to Andrew Pinski
Quoted 8 lines · Andrew Pinski
Quoted 5 lines · Denis Zaitsev
Quoted 4 lines · Andrew Pinski

This one is better and should work.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

If it does not report the errors please as it will help to fix the problem.

Yes, this patch seems to work, thanks. But the compiler still complains about undeclared atoi. Maybe it worth something to include <stdlib.h> somewhere?

Yes, this is what I applied to both the mainline and the 3.4 branch.

Ok. Does it means that something alike should be applied for the files, which are including coretypes.h and tm.h for now?

#9 lore raw
Quoted 2 lines · Denis Zaitsev

Ok. Does it means that something alike should be applied for the files, which are including coretypes.h and tm.h for now?

Those are more complex and will not be fixed until 4.1.

-- Pinski

#10 lore raw
Quoted 7 lines · Andrew Pinski
Quoted 2 lines · Denis Zaitsev

Ok. Does it means that something alike should be applied for the files, which are including coretypes.h and tm.h for now?

Those are more complex and will not be fixed until 4.1.

Ok. Thanks.

#11 lore raw
In reply to Andrew Pinski
Quoted 24 lines · Andrew Pinski

The uses of the macros are not needed as shown by a "grep -r ."

Does this patch fix the problem for you?

Thanks,
Andrew Pinski

Index: gc.c
===================================================================
RCS file: /cvs/gcc/gcc/libobjc/gc.c,v
retrieving revision 1.6
diff -u -p -r1.6 gc.c

gc.c +0 -5
@@ -40,18 +40,6 @@ Boston, MA 02111-1307, USA.  */
 typedef GC_word word;
 typedef GC_signed_word signed_word;
 
-#if BITS_PER_WORD == 32
-# define LOGWL	5
-# define modWORDSZ(n) ((n) & 0x1f)        /* n mod size of word	    */
-#endif
-

gc.c Boston, MA 02111-1307, USA. */ · line 45

Quoted 10 lines
gc.c +0 -7
-#if BITS_PER_WORD == 64
-# define LOGWL 6
-# define modWORDSZ(n) ((n) & 0x3f)        /* n mod size of word	    */
-#endif
-
-#define divWORDSZ(n) ((n) >> LOGWL)	   /* divide n by size of word      */
-
 #include <gc_typed.h>
 
 /* The following functions set up in `mask` the corresponding pointers.

The problem is not really here, but there:

line 316 of gc.c:

  size = ROUND (bits_no, BITS_PER_WORD) / BITS_PER_WORD;

So... Why doesn't your grep show this?

#12 lore raw
In reply to Andrew Pinski

At Mon, 20 Dec 2004 16:38:36 -0500,

Quoted 6 lines · Andrew Pinski
Quoted 2 lines · Denis Zaitsev

This patch is for exactly the same issue as described in

Quoted 8 lines
Quoted 4 lines

http://gcc.gnu.org/ml/gcc/2002-12/msg00033.html

The fix is exactly the same, just another file is the target. Without it libobjc fails to build when --with-objc-gc is given to configure.

This patch is incorrect as noted before. I am going to reject it as it was rejected before. Again libobjc has no reason to include these headers.

The patch is the Wrong Thing in a formal sense. However, it may be the correct thing to do in the short term. libobjc files have been including coretypes.h and tm.h for a very long time; adding a few more is not the end of the world, especially not on an old release branch!

zw