News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Golink error

Started by mitchi, January 18, 2009, 08:24:34 AM

Previous topic - Next topic

jorgon

Ok Mitchi

I now attach GoLink 0.26.10 beta2, which when the "/mix" switch is specified, finds a symbol which is undecorated in a DLL, but which has simple decoration of the type "_CodeLabel" (no @xx at the end or __imp_ at the beginning) in the symbol table of the caller's symbol table.

However using your files, we are still exactly back to the position we were in when you used Vortex's undecor.exe tool.  This demonstrates I think that Vortex's tool and now also GoLink (with the /mix switch) are achieving the same thing.

Currently the missing symbols are:-

objectif
caisseOK
marioActuel
carte
mario
lastDirection
position
positionJoueur
caisse
event
mur


Now you say about these symbols that:-
QuoteThese "things" are all global variables I use in my C program. What should I do ? They don't appear in the .h, just in the .c
//Carte dans le heap
int carte[NB_BLOCS_LARGEUR][NB_BLOCS_HAUTEUR];
SDL_Surface* mario[4]; // 4 surfaces pour chacune des directions de mario
SDL_Surface *mur,*caisse,*caisseOK,*objectif,*marioActuel;
SDL_Rect position, positionJoueur;
SDL_Event event;

I have looked in all the object files and DLLs you have provided, and they are not in those files as "global".
There must be something that you are doing, or not doing, in your "C" source code which makes them local variables and not global variables.
In fact, they appear in the ".asm" listing file editeur.asm provided by your compiler, and in that it is possible to see that they are being treated as local variables only (they are given an offset value on the stack).

I suspect that the reason why they are "local" and not "global" is that (as can be seen from the listing file) the declaration set out above is made after the opening braces in line 20 of your C source file editeur.c - would you mind checking this?  I am not a "C" programmer but I do use javascript and this seems to be the remaining culprit!





[attachment deleted by admin]
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

mitchi

Thanks gordon, the mix switch works now, it gets me as far as undecor was getting me now.
The missing symbols we are talking about :


objectif
caisseOK
marioActuel
carte
mario
lastDirection
position
positionJoueur
caisse
event
mur


These symbols are really global variables in a .c file. In editeur.asm, they are used too but they are all allocated on the stack using mov d[esp+something], ebx.
If you don't believe me, the lastDirection variable can only be found in jeu.c and it's not present in editeur.c.
I made of my my code modifications in jeu.c and I used these variables as global variables.

Here is jeu.c and editeur.c if you want to take a better look.

editeur.c :
http://pastebin.ca/1328645
jeu.c :
http://pastebin.ca/1328646

Now, this is where I think the problem is. If you take at jeu.asm you'll see this.
And it's exactly the same as our error message.


_DATA SEGMENT
COMM _objectif:DWORD
COMM _caisseOK:DWORD
COMM _marioActuel:DWORD
COMM _carte:DWORD:090H
COMM _mario:DWORD:04H
COMM _lastDirection:DWORD
COMM _position:QWORD
COMM _positionJoueur:QWORD
COMM _caisse:DWORD
COMM _event:BYTE:014H
COMM _mur:DWORD
_DATA ENDS


Basically, GoLink as it is right now should be able to link object files created by VC++ as long as there are no global variables in the source code.
Sorry for the wait, I was away for a couple of days watching baseball.


jorgon

Ok Mitchi

Thanks for the report.
It does seem possible that GoLink is missing some symbols created by a "C" compiler which it ought to deal with.
I'll look into this and come back to you.
Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

jorgon

Hi Mitchi

As I believe you anticipated, I found that your object files contained "common symbols", which were not being picked up by GoLink.

I have now added support for these when the /mix switch is used see http://www.masm32.com/board/index.php?topic=10770.

However, GoLink didn't find an entry point in your files defined by the .drectve section - perhaps you supplied one in the command file?

Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)

mitchi


C:\Users\chap\Desktop\gordon2>GoLink.exe /entry _SDL_main /mix main.obj fichiers
.obj jeu.obj editeur.obj SDL.DLL MSVCRT.DLL SDL_image.dll

And it worked, it did a 9 ko .exe (better than MS linker ) :)
The program starts , the main menu displays but I kept getting exception problems when I wanted to play so I fired Ollydbg to investigate... All the code is here, there is no problem. The problem lies with my switch instruction. When I use JMP [401CA0+EAX*4], the addresses in the jump table are not the right ones. It was to be expected, and I won't ask you to fix this as it would be quite difficult...

jorgon

Thanks for your report, Mitchi.

Author of the "Go" tools (GoAsm, GoLink, GoRC, GoBug)