Freepascal generated executable is taking 2x+ more time to do the same task than other compilers:
C: 7.691s
C++: 7.752s
Assembly: 7.909s (handwritten)
D: 8.073s
Rust: 8.974s
Pascal: 20.074s
I ran your code on my Ryzen 2700+ system and it took 12.507 seconds to output the content to a text file. (I redirected the output to a file).
I ran it with -O4 -OpCOREAVX2 -CfSSE42 on Windows x64 using the FPC/Lazarus config in my signature.
I hashed the output that was generated, and did not get the same SHA256 value that you did, probably because I'm running it on Windows and have different line endings.
My own (other) prime number generator that is based on the Generate Prime Numbers via Segmented Sieve Method and crank them out faster.
+>primegentest 15485863
Max Search ......... 15,485,863 (0xEC4BA7)
Total Primes ....... 1,000,000 (0xF4240)
Highest Prime ...... 15,485,863 (0xEC4BA7)
---------------------------------------------------------------------------
Start Time ......... 05/12/2020 12:54:13.786
End Time ........... 05/12/2020 12:54:14.005
Elapsed Time ....... 0:00:00.219
---------------------------------------------------------------------------
When redirecting the output to a file, and actually printing the resulting values, it takes 4 seconds:
+>primegentest 15485863 -s 2> C:\Temp\1M-PrimeNumbers.TXT
Max Search ......... 15,485,863 (0xEC4BA7)
Total Primes ....... 1,000,000 (0xF4240)
Highest Prime ...... 15,485,863 (0xEC4BA7)
---------------------------------------------------------------------------
Start Time ......... 05/12/2020 12:55:29.862
End Time ........... 05/12/2020 12:55:34.027
Elapsed Time ....... 0:00:04.165
---------------------------------------------------------------------------