Erroneous reading of the value of the StackLength variable at program start
When executing the following program compiled with `-Ct -Cs7340032` options under Linux x86_64, a "Stack overflow error" will occur. ```pascal program project1; {$mode objfpc} function BigStack: Integer; var buf: array[0..6*1024*1014] of Byte; begin buf[0] := 1; buf[High(buf)] := 2; Result := buf[0] + buf[High(buf)]; end; begin if BigStack <> 3 then Halt(1); end. ``` Also the following program will exit with code 1 ```pascal program project2; {$mode objfpc} var __stklen: SizeUInt; external name '__stklen'; begin WriteLn('StackLength: ', HexStr(Pointer(StackLength))); WriteLn('@__stklen: ', HexStr(@__stklen)); if StackLength = PtrUInt(@__stklen) then Halt(1); end. ``` --- **Erroneous source code:** [rtl/linux/x86_64/si_c.inc#L90-L92](../488c389b9b8e6bff675fd486d601efe17f3b52d4/rtl/linux/x86_64/si_c.inc#L90-L92) Same in si_prc.inc and si_g.inc **To fix the error, the source code should be like this:** ``` { store stack length } movq StackLength@GOTPCREL(%rip),%rax movq (%rax),%rax movq %rax,TEntryInformation.OS.stklen(%rdi) ```
issue