c/ppc32 programming help wanted: calc ppc32 build bug

David Woodhouse dwmw2 at infradead.org
Fri Sep 21 09:26:17 UTC 2007


On Thu, 2007-09-20 at 21:04 -0500, Eric Sandeen wrote:
> Matthew Miller wrote:
> > Since I don't have a ppc machine of my own, it's hard to track this down. I
> > kind of suspect something is wrong in the "longbits.h" code, but it could be
> > somewhere else entirely.
> > 
> > <https://bugzilla.redhat.com/show_bug.cgi?id=299581>
> > 
> > 
> 
> Looking at the preprocessed source might help?  (gcc -E)

No, it just makes your eyes bleed.

I have no idea what's going on here, or why it might have built on other
systems -- it looks horridly broken. It seems to be trying to treat the
fpos_t data type (which is an opaque structure and must be accessed with
fgetpos()) as if it was a scalar integer, along the lines of:

	unsigned long foo;
	fpos_t bar;
	foo = bar;

If that builds on i386, I have no clue why. And I also have no clue what
all this SWAP_HALF_IN_FOO() is all about, either.

I'll keep poking at it, for as long as I can stand before I have to kill
myself.

But first, let's start by fixing this unrelated (unless it was done
while smoking the same batch of crack) gem...

--- endian.c~	2007-09-01 23:01:25.000000000 +0100
+++ endian.c	2007-09-21 10:06:05.000000000 +0100
@@ -53,10 +53,8 @@ char byte[8] = { (char)0x12, (char)0x36,
 int
 main(void)
 {
-#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
 	/* pointers into the byte order array */
 	int *intp = (int *)byte;
-#endif
 #if defined(DEBUG)
 	short *shortp = (short *)byte;
 	long *longp = (long *)byte;
@@ -76,11 +74,17 @@ main(void)
 	printf("#define BIG_ENDIAN\t4321\n");
 	printf("#define LITTLE_ENDIAN\t1234\n");
 
+	/* Yes. We _know_ they're the standard endian.h defines.
+	   They're both going to be defined.
+	   Always.
+	   So what, for the love of $DEITY, made anyone think 
+	   _this_ was a good idea....
 #if defined(LITTLE_ENDIAN)
 	printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n");
 #elif defined(BIG_ENDIAN)
 	printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n");
 #else
+	*/
 	/* Determine byte order */
 	if (intp[0] == 0x12364859) {
 	    /* Most Significant Byte first */
@@ -93,7 +97,7 @@ main(void)
 		"Unknown int Byte Order, set CALC_BYTE_ORDER in Makefile\n");
 	    exit(1);
 	}
-#endif
+//#endif
 	/* exit(0); */
 	return 0;
 }

-- 
dwmw2




More information about the fedora-devel-list mailing list