From: Phillip S. <ps...@cf...> - 2001-12-09 16:57:20
|
gcc seems to generate a call to alloca to allocate stack space for large locals. When I link with -nostdlib, I get an unresolved external. I would like to get gcc to stop generating calls to this external function, and instead inline the code, but since I couldn't do that, I figured I'd dig through the symbol tables of *.a in the mingw lib directory looking for _alloca and explicitly link that in. I found several imports of _alloca, but no definition for it in any of the libraries, so what magic is going on here, and how can I satisfy gcc? |
From: Mikael A. <mik...@ma...> - 2001-12-09 17:53:37
|
Hi ! If the alloca is taken fro MSVCRT then I think the correct name is _alloca, that would be __alloca as symbol name (with two underscores), because when you use alloca() in a Visual Studio application you must link with oldnames.lib, if not you must use the name _alloca. Could that be the problem ? Mikael ----- Original Message ----- From: "Phillip Susi" <ps...@cf...> To: <min...@li...> Sent: Sunday, December 09, 2001 5:52 PM Subject: [Mingw-users] missing alloca > gcc seems to generate a call to alloca to allocate stack space for large > locals. When I link with -nostdlib, I get an unresolved external. I would > like to get gcc to stop generating calls to this external function, and > instead inline the code, but since I couldn't do that, I figured I'd dig > through the symbol tables of *.a in the mingw lib directory looking for > _alloca and explicitly link that in. I found several imports of _alloca, > but no definition for it in any of the libraries, so what magic is going on > here, and how can I satisfy gcc? > > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > |
From: Phillip S. <ps...@cf...> - 2001-12-10 02:08:01
|
No, it couldn't be. Visual Studio has nothing to do with this, gcc is internally generating asm code that calls alloca, only when I link with -nostdlibs, it gives an unresolved external ( though it does work when I don't use -nostdlibs ). I've searched all of the libraries in the mingw directory, and can not find the implementation for it there, so I have no idea where gcc is getting it from when I don't use -nostartfiles. At 06:55 PM 12/9/2001 +0100, you wrote: >Hi ! > >If the alloca is taken fro MSVCRT then I think the correct name is _alloca, >that would be __alloca as symbol name (with two underscores), because when >you use alloca() in a Visual Studio application you must link with >oldnames.lib, if not you must use the name _alloca. > >Could that be the problem ? > >Mikael |
From: <dan...@ya...> - 2001-12-10 06:43:49
|
--- Phillip Susi <ps...@cf...> wrote: > No, it couldn't be. Visual Studio has nothing to do with this, gcc is > internally generating asm code that calls alloca, only when I link with > -nostdlibs, it gives an unresolved external ( though it does work when I > don't use -nostdlibs ). I've searched all of the libraries in the mingw > directory, and can not find the implementation for it there, so I have no > > idea where gcc is getting it from when I don't use -nostartfiles. > Reading the fine GCC manual, I find: "The macro __STRICT_ANSI__ is predefined when the -ansi option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ANSI standard doesn't call for; this is to avoid interfering with any programs that might use these names for other things. The functions alloca, abort, exit, and _exit are not builtin functions when -ansi is used" > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users http://shopping.yahoo.com.au - Yahoo! Shopping - Free CDs for thousands of Priority Shoppers! |
From: Phillip S. <ps...@cf...> - 2001-12-11 04:23:23
|
I'm not using -ansi At 05:43 PM 12/10/2001 +1100, you wrote: >Reading the fine GCC manual, I find: > >"The macro __STRICT_ANSI__ is predefined when the -ansi option is used. >Some header files may notice this macro and refrain from declaring certain >functions or defining certain macros that the ANSI standard doesn't call >for; this is to avoid interfering with any programs that might use these >names for other things. > >The functions alloca, abort, exit, and _exit are not builtin functions when >-ansi is used" |
From: Earnie B. <ear...@ya...> - 2001-12-11 12:09:49
|
Phillip Susi wrote: > > I'm not using -ansi > > At 05:43 PM 12/10/2001 +1100, you wrote: > >Reading the fine GCC manual, I find: > > > >"The macro __STRICT_ANSI__ is predefined when the -ansi option is used. > >Some header files may notice this macro and refrain from declaring certain > >functions or defining certain macros that the ANSI standard doesn't call > >for; this is to avoid interfering with any programs that might use these > >names for other things. > > > >The functions alloca, abort, exit, and _exit are not builtin functions when > >-ansi is used" > I think the suggestion was to use it. Not a question of "do you use it". Earnie. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
From: Oleg S. <se...@ma...> - 2001-12-10 01:52:49
|
Hi, I've found _alloca located in mingw32\lib\gcc-lib\mingw32\2.95.2\libgcc.a(_chkstk.o). Hope this works for you. Oleg. Phillip Susi wrote: > > gcc seems to generate a call to alloca to allocate stack space for large > locals. When I link with -nostdlib, I get an unresolved external. I would > like to get gcc to stop generating calls to this external function, and > instead inline the code, but since I couldn't do that, I figured I'd dig > through the symbol tables of *.a in the mingw lib directory looking for > _alloca and explicitly link that in. I found several imports of _alloca, > but no definition for it in any of the libraries, so what magic is going on > here, and how can I satisfy gcc? > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users |