rtl: apply similar to r24022-r24026 changes made by Jonas to other targets

git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@24027 3ad0048d-3df7-0310-abae-a5850022a9f2