Please get rid of this declaration from videogl.h:
static gl_hidden_globals* glGlob = &glGlobalData;
This is executable code in a header file, which forces the linker to include videogl.a no matter what.
I recommend you replace it with:
#define glGlob (&glGlobalData)
Get rid of static gl_hidden_globals* glGlob = &glGlobalData;
-
- Site Admin
- Posts: 2003
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Get rid of static gl_hidden_globals* glGlob = &glGlobalData;
This is not executable code, nor does it cause the symptoms you describe.
Re: Get rid of static gl_hidden_globals* glGlob = &glGlobalData;
Okay...
I am using the source code for the FCS2 DLDI driver, and I'm building it. It doesn't use any of libnds's functions, but includes nds.h anyway, probably so it can have the data types and memory region names.
Inside the ASM code generated are these lines:
glGlob or glGlobalData are never referenced anywhere else in the generated asm code.
The linker fails to link the binary unless libnds is linked in because glGlobalData is missing. If it is given libnds as a library, it includes all of videogl.a.
This is only here because of the line "static gl_hidden_globals* glGlob = &glGlobalData;" inside videogl.h. Replacing it with "#define glGlob (&glGlobalData)" eliminates the problem.
EDIT: It appears to be entirely related to using optimization level -O0. I have no idea what possessed the author of the FCS2 DLDI driver to use such an optimization level. The problem goes away at -O1, -O2, -Os.
I am using the source code for the FCS2 DLDI driver, and I'm building it. It doesn't use any of libnds's functions, but includes nds.h anyway, probably so it can have the data types and memory region names.
Inside the ASM code generated are these lines:
Code: Select all
.section .data.rel,"aw",%progbits
.align 2
.type glGlob, %object
.size glGlob, 4
glGlob:
.word glGlobalData
The linker fails to link the binary unless libnds is linked in because glGlobalData is missing. If it is given libnds as a library, it includes all of videogl.a.
This is only here because of the line "static gl_hidden_globals* glGlob = &glGlobalData;" inside videogl.h. Replacing it with "#define glGlob (&glGlobalData)" eliminates the problem.
EDIT: It appears to be entirely related to using optimization level -O0. I have no idea what possessed the author of the FCS2 DLDI driver to use such an optimization level. The problem goes away at -O1, -O2, -Os.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 8 guests