Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
Just saw this: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?vie...
_alloca
Article 10/26/2022
Allocates memory on the stack. This function is *deprecated* because a more secure version is available; see:
_malloca https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-170 .
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?vi...
Requirements
RoutineRequired header _malloca<malloc.h>
All the best,
Ron Teitelbaum
On Mon, Dec 19, 2022 at 12:00 PM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
On Mon, Dec 19, 2022 at 9:29 AM Ron Teitelbaum ron@usmedrec.com wrote:
Just saw this:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?vie...
_alloca
Article 10/26/2022
Allocates memory on the stack. This function is *deprecated* because a more secure version is available; see:
_malloca https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-170 .
Mucroshaft are such irritating *FUCKS*. It has exactly the same signature as alloca. Why didn't they just upgrade the implementation instead of forcing everyone to rewrite their code??
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?vi...
Requirements
RoutineRequired header _malloca<malloc.h>
All the best,
Ron Teitelbaum
On Mon, Dec 19, 2022 at 12:00 PM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
That's why (quoted from the doc page):
Unlike _alloca, which doesn't require or permit a call to free to free the memory so allocated, _malloca requires the use of _freea https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/freea?view=msvc-170 to free memory.
Am Fr., 30. Dez. 2022 um 23:07 Uhr schrieb Eliot Miranda < eliot.miranda@gmail.com>:
On Mon, Dec 19, 2022 at 9:29 AM Ron Teitelbaum ron@usmedrec.com wrote:
Just saw this:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?vie...
_alloca
Article 10/26/2022
Allocates memory on the stack. This function is *deprecated* because a more secure version is available; see:
_malloca https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-170 .
Mucroshaft are such irritating *FUCKS*. It has exactly the same signature as alloca. Why didn't they just upgrade the implementation instead of forcing everyone to rewrite their code??
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?vi...
Requirements
RoutineRequired header _malloca<malloc.h>
All the best,
Ron Teitelbaum
On Mon, Dec 19, 2022 at 12:00 PM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
-- _,,,^..^,,,_ best, Eliot
On Fri, Dec 30, 2022 at 2:51 PM Jakob Reschke jakres+squeak@gmail.com wrote:
That's why (quoted from the doc page):
Unlike _alloca, which doesn't require or permit a call to free to free the memory so allocated, _malloca requires the use of _freea https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/freea?view=msvc-170 to free memory.
Still not a good enough justification, IMO. They could modify the compiler to plant a call to _freea on return. I'm also curious to see if _freea actually does anything. The whole point of alloca is that deallocation is automatic on return because the memory is stack allocated.
Am Fr., 30. Dez. 2022 um 23:07 Uhr schrieb Eliot Miranda <
eliot.miranda@gmail.com>:
On Mon, Dec 19, 2022 at 9:29 AM Ron Teitelbaum ron@usmedrec.com wrote:
Just saw this:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?vie...
_alloca
Article 10/26/2022
Allocates memory on the stack. This function is *deprecated* because a more secure version is available; see:
_malloca https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-170 .
Mucroshaft are such irritating *FUCKS*. It has exactly the same signature as alloca. Why didn't they just upgrade the implementation instead of forcing everyone to rewrite their code??
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?vi...
Requirements
RoutineRequired header _malloca<malloc.h>
All the best,
Ron Teitelbaum
On Mon, Dec 19, 2022 at 12:00 PM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
-- _,,,^..^,,,_ best, Eliot
Probably to avoid stack overflows, _malloca allocates from the heap rather than from the stack if the size exceeds a threshold. That's why you have to call _freea. I assume that _freea inspects the address or some internals about the allocated memory and then either does nothing for stack memory or does something like free() for heap memory...
It might be justified to let the compiler always insert _freea automatically (it would have to make sure not to mix implementations though), but this is C and C programmers love to do everything by themselves, don't they? ;-) It would mean a special case for the compiler, but on the other hand if _alloca and _malloca are usually built-ins, they are already special cases. Still there might be some portability concerns if the C standard (which does not even include alloca...) does not require that a C compiler insert _freea automatically.
During this Internet research I have also seen a mention that alloca() is in some environments replaced with a fallback library implementation that uses heap memory. And that you have to call alloca(0) every now and then to release the memory. So much for portability.
Am Sa., 31. Dez. 2022 um 00:41 Uhr schrieb Eliot Miranda < eliot.miranda@gmail.com>:
On Fri, Dec 30, 2022 at 2:51 PM Jakob Reschke jakres+squeak@gmail.com wrote:
That's why (quoted from the doc page):
Unlike _alloca, which doesn't require or permit a call to free to free the memory so allocated, _malloca requires the use of _freea https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/freea?view=msvc-170 to free memory.
Still not a good enough justification, IMO. They could modify the compiler to plant a call to _freea on return. I'm also curious to see if _freea actually does anything. The whole point of alloca is that deallocation is automatic on return because the memory is stack allocated.
Am Fr., 30. Dez. 2022 um 23:07 Uhr schrieb Eliot Miranda <
eliot.miranda@gmail.com>:
On Mon, Dec 19, 2022 at 9:29 AM Ron Teitelbaum ron@usmedrec.com wrote:
Just saw this:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?vie...
_alloca
Article 10/26/2022
Allocates memory on the stack. This function is *deprecated* because a more secure version is available; see:
_malloca https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-170 .
Mucroshaft are such irritating *FUCKS*. It has exactly the same signature as alloca. Why didn't they just upgrade the implementation instead of forcing everyone to rewrite their code??
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?vi...
Requirements
RoutineRequired header _malloca<malloc.h>
All the best,
Ron Teitelbaum
On Mon, Dec 19, 2022 at 12:00 PM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
-- _,,,^..^,,,_ best, Eliot
-- _,,,^..^,,,_ best, Eliot
Am Sa., 31. Dez. 2022 um 00:58 Uhr schrieb Jakob Reschke < jakres+squeak@gmail.com>:
During this Internet research I have also seen a mention that alloca() is in some environments replaced with a fallback library implementation that uses heap memory. And that you have to call alloca(0) every now and then to release the memory.
Note that this was not about Windows or Cygwin, but about some GNU library.
Hi Eliot, hi all --
Cygwin seems to be kind of outdated. Many important packages are not maintained anymore. Only clang 8 is supported. Well, GitHub offers MSYS2, so I switched to that locally as well. Works like a charm. clang 15.05.
Best, Marcel
Am 31.12.2022 01:03:53 schrieb Jakob Reschke jakres+squeak@gmail.com:
On Dec 31, 2022, at 2:46 AM, Taeumel, Marcel Marcel.Taeumel@hpi.de wrote:
Hi Eliot, hi all --
Cygwin seems to be kind of outdated. Many important packages are not maintained anymore. Only clang 8 is supported. Well, GitHub offers MSYS2, so I switched to that locally as well. Works like a charm. clang 15.05.
Agreed. I would happily move windows builds to the MSVC toolchain (which uses clang and which we use to build the Virtend VM). I do use gnu make from Cygwin to build when using the MSVC toolchain; nmake is too crappy. And I like using the Cygwin shell more than powershell. But I could be persuaded to switch over to powershell; not to nmake.
Best, Marcel
Am 31.12.2022 01:03:53 schrieb Jakob Reschke jakres+squeak@gmail.com:
cygLLVMSupport-8.dll imports _alloca from cygwin1.dll. Discovered using the dependency tool from https://github.com/lucasg/Dependencies
So Marcel, is this clang-8.exe run in a Cygwin environment where cygwin1.dll is in the search path?
The rest of the text is more about _alloca and why it might not be in the Windows standard libraries, but may not necessarily help solve the problem.
_alloca being deprecated does not mean that it is expected that it gets removed: https://learn.microsoft.com/en-us/cpp/c-runtime-library/security-features-in... .
I would have expected the function in ucrtbase.dll based on https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features... But it is not there, and neither is _malloca.
Might be a compiler built-in function, that would explain why it is not in a shared library. https://mingw-users.narkive.com/W6kWKbzP/alloca-function-does-not-exist As we can see now, Cygwin decided to ship a proper function in their DLL instead.
Am Mo., 19. Dez. 2022 um 18:29 Uhr schrieb Ron Teitelbaum <ron@usmedrec.com
:
Just saw this:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/alloca?vie...
_alloca
Article 10/26/2022
Allocates memory on the stack. This function is *deprecated* because a more secure version is available; see:
_malloca https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?view=msvc-170 .
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/malloca?vi...
Requirements
RoutineRequired header _malloca<malloc.h>
All the best,
Ron Teitelbaum
On Mon, Dec 19, 2022 at 12:00 PM Marcel Taeumel marcel.taeumel@hpi.de wrote:
Hi all!
Has anybody tried to build OSVM in Windows 11 via Cygwin64?
clang-8 does not work because "_alloca" cannot be found ... hmm...
So, who implements _alloca? It's not msvcrt.dll ... how to find that out?
Best, Marcel
vm-dev@lists.squeakfoundation.org