romcc fixes for AMD64

Stefan Reinauer stepan at suse.de
Tue Sep 16 08:35:01 CEST 2003


Hi,

with the attached fix romcc is able to compile all of auto.c
for the freebios2 amd64 targets. To keep all changes clean 
and visible, they're encapsulated in ifdefs.

Note: This fix alone does not make LinuxBIOS compile on AMD64
completely yet. GCC and ld need the -m32 in some places at least
to compile everything. 

Is there any need in going 64bit for the LinuxBIOS C payload
on Opteron? Since the kernel does long mode switching itself
this should not be the case, but maybe there are different 
opinions.

Next fail I saw after romcc passed auto.c was the following:
/home/stepan/freebios2/src/superio/NSC/pc87360/superio.c:61: warning: `pnp_read_enable' defined but not used
/tmp/ccLriZXb.s: Assembler messages:
/tmp/ccLriZXb.s:243: Error: Incorrect register `%rdx' used with `l' suffix
/tmp/ccLriZXb.s:245: Error: Incorrect register `%rdx' used with `l' suffix
make: *** [superio.o] Error 1


Greetings,
Stefan
  
-- 
Architecture Team
    SuSE Linux AG
-------------- next part --------------
? romcc.diff
? romcc2.diff
? romcc3.diff
? romcc4.diff
Index: romcc.c
===================================================================
RCS file: /cvsroot/freebios/freebios2/util/romcc/romcc.c,v
retrieving revision 1.23
diff -u -r1.23 romcc.c
--- romcc.c	21 Jul 2003 20:13:45 -0000	1.23
+++ romcc.c	16 Sep 2003 12:46:28 -0000
@@ -208,8 +208,13 @@
 }
 
 /* Long on the destination platform */
+#ifdef __x86_64__
+typedef unsigned int ulong_t;
+typedef int long_t;
+#else
 typedef unsigned long ulong_t;
 typedef long long_t;
+#endif
 
 struct file_state {
 	struct file_state *prev;
@@ -861,7 +866,11 @@
  * type-> holds the number of elements.
  */
 
+#ifdef __x86_64__
+#define ELEMENT_COUNT_UNSPECIFIED (~0U)
+#else
 #define ELEMENT_COUNT_UNSPECIFIED (~0UL)
+#endif
 
 struct type {
 	unsigned int type;
@@ -2952,8 +2961,13 @@
 		meat(state, index, TOK_LIT_INT);
 		errno = 0;
 		val = strtol(state->token[index].val.str, &end, 0);
+#ifdef __x86_64__
+		if (((val == INT_MIN) || (val == INT_MAX)) &&
+			(errno == ERANGE)) {
+#else
 		if (((val == LONG_MIN) || (val == LONG_MAX)) &&
 			(errno == ERANGE)) {
+#endif
 			error(state, 0, "Integer constant to large");
 		}
 		break;
@@ -7101,7 +7115,11 @@
 	errno = 0;
 	decimal = (tk->val.str[0] != '0');
 	val = strtoul(tk->val.str, &end, 0);
+#ifdef __x86_64__
+	if ((val == UINT_MAX) && (errno == ERANGE)) {
+#else
 	if ((val == ULONG_MAX) && (errno == ERANGE)) {
+#endif
 		error(state, 0, "Integer constant to large");
 	}
 	u = l = 0;
@@ -7125,7 +7143,11 @@
 	}
 	else if (l) {
 		type = &long_type;
+#ifdef __x86_64__
+		if (!decimal && (val > INT_MAX)) {
+#else
 		if (!decimal && (val > LONG_MAX)) {
+#endif
 			type = &ulong_type;
 		}
 	}
@@ -7140,7 +7162,11 @@
 		if (!decimal && (val > INT_MAX) && (val <= UINT_MAX)) {
 			type = &uint_type;
 		}
+#ifdef __x86_64__
+		else if (!decimal && (val > INT_MAX)) {
+#else
 		else if (!decimal && (val > LONG_MAX)) {
+#endif
 			type = &ulong_type;
 		}
 		else if (val > INT_MAX) {


More information about the coreboot mailing list