Skip to content

Commit 2625108

Browse files
committed
clear the object memory at startup if we have -Oremove-bss
1 parent 2a47e91 commit 2625108

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

backends/asm/outasm.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6795,12 +6795,10 @@ EmitMain_P1(IRList *irl, Module *P)
67956795
if ( (gl_optimize_flags & OPT_REMOVE_HUB_BSS) ) {
67966796
EmitOp2(irl, OPC_ADD, stackptr, objbase);
67976797
}
6798-
if (!gl_p2) {
6799-
// we will need local01, it is referred to in
6800-
// the LMM code
6801-
Operand *local1 = GetLocalReg(0, 0);
6802-
local1->used = 1;
6803-
}
6798+
// we will need local01, it is referred to in
6799+
// the LMM code
6800+
Operand *local1 = GetLocalReg(0, 0);
6801+
local1->used = 1;
68046802
}
68056803

68066804
if (InCog(firstfunc)) {
@@ -6882,7 +6880,10 @@ EmitMain_P2(IRList *irl, Module *P, Operand *lutstart)
68826880
EmitJump(irl, COND_NE, spinlabel);
68836881
if ( (gl_optimize_flags & OPT_REMOVE_HUB_BSS) ) {
68846882
EmitOp2(irl, OPC_MOV, stackptr, objbase);
6885-
EmitOp2(irl, OPC_ADD, stackptr, NewImmediate(current->varsize));
6883+
// EmitOp2(irl, OPC_ADD, stackptr, NewImmediate(current->varsize));
6884+
EmitOp1(irl, OPC_SETQ, NewImmediate(current->varsize/LONG_SIZE));
6885+
ir = EmitOp2(irl, OPC_WRLONG, NewImmediate(0), stackptr);
6886+
ir->srceffect = OPEFFECT_POSTINC;
68866887
} else {
68876888
EmitMove(irl, stackptr, stacklabel, NULL);
68886889
}

0 commit comments

Comments
 (0)