zayac / hera-mcst

Automatically exported from code.google.com/p/hera-mcst
0 stars 0 forks source link

#ASM#data section ignored #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Добрый день!

Игнорируется секция с глобалами, в 
результате падаем на неинициализированной 
метке.

$ cat t.c 
int a;

int main()
{
int res = 1;
res += a;
return res;
}
$ ./lcc t.c -S
$ ./assembler t.s
t.s. Warning in line 0: ".section ".text"". Section detected.
main: 0
.L1: 7
t.s. Warning in line 9: ".section ".bss"". Section detected.
t.s. Warning in line 10: ".type a,". Section detected.
t.s. Warning in line 11: ".size a,2". Section detected.
t.s. Warning in line 12: ".common a,2,2". Section detected.
<< Instructions >>
set %r9,1
    setlo %r9, 1        0xe901
    sethi %r9, 0        0xf900

set %r13,a
Error. A label a is not defined.

Original issue reported on code.google.com by diman...@gmail.com on 28 Apr 2011 at 7:22

GoogleCodeExporter commented 9 years ago
И как должны global должны быть прописаны в MIF?

Original comment by zaichen...@gmail.com on 28 Apr 2011 at 7:30

GoogleCodeExporter commented 9 years ago
Нужно сделать отдельный файл *.mif с данными. 
Память кода и данных раздельная, так что 
адреса могут пересекаться.

Пока что, наверное, стоит добавлять к 
именам суффиксы code и data, например, при 
сборке t.s создается t_code.mif и t_data.mif (если он 
нужен).

Original comment by diman...@gmail.com on 2 May 2011 at 7:34