Opened 13 years ago

Closed 13 years ago

#239 closed defect (fixed)

emxomfld can generate incorrect stack size

Reported by: Steven Levine Owned by: bird
Priority: normal Milestone: libc-0.6.4
Component: baselayout Version:
Severity: normal Keywords:
Cc:

Description

Given -Zlinker /ST:0x80000 emxomfld will generate OPTION STACK 0x80c00. The occurs because stack_size is signed and gcc implements the divide in

stack_size = (stack_size + 0xfff) / 1024;

at line 2135 as a signed shift with additional rounding. The generated code is effectively

stack_size = ((stack_size + 0xfff) + 0x3ff) >> 10;

Change History (3)

comment:1 Changed 13 years ago by bird

Status: newassigned

No, I think it's because my rounding is wrong. The statement should've read:

stack_size = (stack_size + 1023) / 1024;

or

stack_size = (stack_size + 0xfff) / 0x1000;

comment:2 Changed 13 years ago by bird

(In [3731]) emxomfld.c: Fixed rounding bug when converting /STACK:xxx (link386/ilink) to wlink. References #239.

comment:3 Changed 13 years ago by bird

Resolution: fixed
Status: assignedclosed

(In [3732]) 0.6: Backported r3731: emxomfld.c: Fixed rounding bug when converting /STACK:xxx (link386/ilink) to wlink. Fixes #239.

Note: See TracTickets for help on using tickets.