Skip to contentSkip to conversation

Linux x86_64 host

Qemu-devel Bob Deblier 2 participants 5 messages Oct 7, 2004

lore
Share & tools
lore
#0 lore raw

Great project!

I've been trying to see if I can get the current CVS version of QEMU working on my Fedora Core 2 x86_64, with no luck so far. There's even a compilation error in the current sparc code:

../dyngen -o op.h op.o
../dyngen -c -o opc.h op.o
gcc -Wall -O2 -g -fno-strict-aliasing -I. -I/home/bob/emulators/cvs/qemu/target-sparc -I/home/bob/emulators/cvs/qemu -I/home/bob/emulators/cvs/qemu/linux-user -I/home/bob/emulators/cvs/qemu/linux-user/sparc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/bob/emulators/cvs/qemu/slirp -c -o translate-all.o /home/bob/emulators/cvs/qemu/translate-all.c
In file included from /home/bob/emulators/cvs/qemu/translate-all.c:41:
op.h: In function `dyngen_code':
op.h:4639: error: syntax error before '.' token
op.h:4641: error: syntax error before '.' token
make[1]: *** [translate-all.o] Error 1
make[1]: Leaving directory `/home/bob/emulators/cvs/qemu/sparc-user'

I'm more than willing to make some time getting to know the system and contributing to make this work on x86_64, if somebody can give pointers on where to start investigating.

I've got many years experience programming, knowledge of several varieties of assembler (x86, x86_64, ppc, ppc64, sparcv8/9, arm, ia64 - as used in the BeeCrypt crypto library).

Sincerely,

Bob Deblier

#1 lore raw

Hi,

Quoted 6 lines · Bob Deblier

In file included from /home/bob/emulators/cvs/qemu/translate-all.c:41:
op.h: In function `dyngen_code':
op.h:4639: error: syntax error before '.' token
op.h:4641: error: syntax error before '.' token
make[1]: *** [translate-all.o] Error 1
make[1]: Leaving directory `/home/bob/emulators/cvs/qemu/sparc-user'

This is probably a symbol which starts with ".".

Reading the current CVS of dyngen.c, in line 1529 of dyngen.c, there is a "#if defines(HOST_SPARC)" and after that code which should fix exactly that error.

If the current CVS version does not resolve your compilation error, please send the offending lines of your op.h (with 10 lines before and after).

Ciao,
Dscho

#2 lore raw
Quoted 1 line · Johannes Schindelin

This is probably a symbol which starts with ".".

Correct.

Quoted 3 lines

Reading the current CVS of dyngen.c, in line 1529 of dyngen.c, there is a "#if defines(HOST_SPARC)" and after that code which should fix exactly that error.

My code tree is up-to-date, so that line apparently doesn't cure all. I've manually verified that file and it contains those lines.

I've tried changing it to #if defined(HOST_AMD64) || defined(HOST_SPARC), but that gives another error.

Quoted 5 lines

If the current CVS version does not resolve your compilation error, please send the offending lines of your op.h (with 10 lines before and after).

Ciao,
Dscho

Lines from sparc_user/op.h

case INDEX_op_flush_T0: {
    extern void op_flush_T0();
extern char helper_flush;
    memcpy(gen_code_ptr, (void *)((char *)&op_flush_T0+0), 15);
    *(uint32_t *)(gen_code_ptr + 7) = (long)(&helper_flush) -
(long)(gen_code_ptr + 7) + -4;
    gen_code_ptr += 15;
}

break;

case INDEX_op_fnegs: {
    extern void op_fnegs();
extern char .LC0;
    memcpy(gen_code_ptr, (void *)((char *)&op_fnegs+0), 31);
    *(uint32_t *)(gen_code_ptr + 10) = (long)(&.LC0) -
(long)(gen_code_ptr + 10) + -4;
    gen_code_ptr += 31;
}

break;

case INDEX_op_fabss: {
    extern void op_fabss();
extern char do_fabss;
    memcpy(gen_code_ptr, (void *)((char *)&op_fabss+0), 13);
    *(uint32_t *)(gen_code_ptr + 5) = (long)(&do_fabss) -
(long)(gen_code_ptr + 5) + -4;
    gen_code_ptr += 13;
}

break;

At your disposal for further testing,

Bob Deblier

#3 lore raw

Hi,

Quoted 5 lines · Bob Deblier

My code tree is up-to-date, so that line apparently doesn't cure all. I've manually verified that file and it contains those lines.

I've tried changing it to #if defined(HOST_AMD64) || defined(HOST_SPARC), but that gives another error.

My error. I read TARGET_SPARC. Must have to do something with not sleeping enough...

What if you change this line to HOST_AMD64, and just comment the fprintf (not the continue)? Of course, you have to change the lines around 1707 like so:

                    if (strstart(sym_name, "__op_param", &p)) {
                        snprintf(name, sizeof(name), "param%s", p);
                    } else if(sym_name[0]=='.') {
                        continue;
                    } else {
                        snprintf(name, sizeof(name), "(long)(&%s)",
sym_name);
                    }

(the "else if" and the "continue" are important).

Explanation: sym_names with a "." are most likely local symbols like jump labels, which should not even be exported in the object file.

Hth,
Dscho

#4 lore raw
Quoted 13 lines · Johannes Schindelin

What if you change this line to HOST_AMD64, and just comment the fprintf (not the continue)? Of course, you have to change the lines around 1707 like so:

                    if (strstart(sym_name, "__op_param", &p)) {
                        snprintf(name, sizeof(name), "param%s", p);
                    } else if(sym_name[0]=='.') {
                        continue;
                    } else {
                        snprintf(name, sizeof(name), "(long)(&%s)",
sym_name);
                    }
Quoted 4 lines

(the "else if" and the "continue" are important).

Explanation: sym_names with a "." are most likely local symbols like jump labels, which should not even be exported in the object file.

Gotcha - I know excatly what you're referring to now. Still doesn't completely fix the problem, but hopefully the following patch will:

diff -r1.35 dyngen.c
1541c1541,1542
< fprintf(outfile, "extern char %s;\n", sym_name);
---

Quoted 2 lines
                                      if (sym_name[0] != '.')
                                              fprintf(outfile, "extern

char %s;\n", sym_name);
1707c1708,1710
< } else {
---

Quoted 3 lines
                    } else if (sym_name[0] == '.') {
                                              continue;
                                      } else {

Sincerely,

Bob Deblier