* net/loveruby/cflat/compiler/CodeGenerator.java (compileAST): should not generate .data section when no global variable is defined.

git-svn-id: file:///Users/aamine/c/gitwork/public/cbc/trunk@4083 1b9489fe-b721-0410-924e-b54b9192deb8
This commit is contained in:
Minero Aoki 2008-11-16 11:11:01 +00:00
parent aa030b42b7
commit 89c7decdad
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,9 @@
Sun Nov 16 20:10:59 2008 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/CodeGenerator.java (compileAST):
should not generate .data section when no global variable is
defined.
Sun Nov 16 20:01:06 2008 Minero Aoki <aamine@loveruby.net>
* net/loveruby/cflat/compiler/CodeGenerator.java: should access

View File

@ -59,9 +59,12 @@ public class CodeGenerator
public void compileAST(AST ast) {
_file(ast.fileName());
// .data
_data();
for (DefinedVariable gvar : ast.definedGlobalVariables()) {
dataEntry(gvar);
List<DefinedVariable> gvars = ast.definedGlobalVariables();
if (!gvars.isEmpty()) {
_data();
for (DefinedVariable gvar : gvars) {
dataEntry(gvar);
}
}
if (!ast.constantTable().isEmpty()) {
_section(".rodata");