News:

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

GoLink Bug (or user error)?

Started by Paul, January 15, 2009, 05:13:45 PM

Previous topic - Next topic

Paul

Hi All,

I am trying to GoLink several object files, one of which was produced by GoAsm. The others were produced by the VC compiler by means of command line 'cl -c.'

My GoLink command file looks like this:

ddb_format.obj
ddb_util.obj
ullshr.obj
llshr.obj
drddb.obj
-files
-console
-fo drddb.exe
kernel32.dll
user32.dll
msvcrt.dll

GoLink says the following:

C:\GoASM\ddb_format.obj
    Made on Tuesday, January 13, 2009 at 6:12 PM size: 2,726 bytes
C:\GoASM\ddb_util.obj
    Made on Tuesday, January 13, 2009 at 6:12 PM size: 3,873 bytes
C:\GoASM\ullshr.obj
    Made on Tuesday, November 06, 2007 at 7:17 PM size: 1,382 bytes
C:\GoASM\llshr.obj
    Made on Tuesday, November 06, 2007 at 7:17 PM size: 1,370 bytes
C:\GoASM\drddb.obj
    Made on Thursday, January 15, 2009 at 11:43 AM size: 6,950 bytes
C:\WINDOWS\system32\kernel32.dll
    Made on Tuesday, August 03, 2004 at 11:56 PM size: 983,552 bytes
    Number of required imports found in this file: 10
C:\WINDOWS\system32\user32.dll
    Made on Tuesday, August 03, 2004 at 11:56 PM size: 577,024 bytes
    Number of required imports found in this file: 1
C:\WINDOWS\system32\msvcrt.dll
    Made on Tuesday, August 03, 2004 at 11:56 PM size: 343,040 bytes
    Number of required imports found in this file: 3

Error!
The following symbols were defined more than once:-
$SG31112 (ddb_format.obj, ddb_util.obj)
$SG31138 (ddb_format.obj, ddb_util.obj)
$$000000 (ullshr.obj, llshr.obj)
The following symbol was not defined in the object file or files:-
_printf
Output file not made

I'm not worried about the undefined _printf. Rather, I simply don't understand the duplicate symbols errors. Aren't distinct source files free to use whatever symbols they like? How might I work around this problem?

Thank you.

-Paul

Vortex

While GoLink expects normal object files, MS Visual C++ compilers are generating MS COFF object modules with decorated symbols. The decoration can be a real issue if you are compiling C++ source code instead of C code. If it's possible, could you send your project to the board?

jorgon

Hi Paul

QuoteAren't distinct source files free to use whatever symbols they like?

In the usual case, if symbols are declared in more than one object file, then the linker would not know which one to use when the symbol is referenced.
However judging from the names of the duplicated symbols here, they might not be intended to be addressed by another module (it is possible the intention is that they should only be addressed by the module or object file in which they are situated).  If so, it may be that they are marked in the object file as for internal use only.  This might be a value in the symbol table (possibly the storage class value).  If they are marked in this way it is possible I could make GoLink ignore the duplication.  Would you mind posting the object files containing the duplicate symbols so that I can have a look?

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

Paul

Hi Jeremy,

I am attaching the object files in which GoLink finds duplicate symbols.

Thanks for your help.

Cordially,

Paul



[attachment deleted by admin]

jorgon

Hi Paul

The attached version of GoLink does not mind if it finds more than one symbol (in different object files) provided the duplicate symbol has a storage class in the symbol table of IMAGE_SYM_CLASS_STATIC (which as I understand it would normally denote that the symbol is not intended to be referenced by an external module at link-time).




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

Paul

Thank you very much, Jeremy. I will give it a whirl today and post results here.

Cordially,

Paul

Paul

Works beautifully; thanks very much.

Will you make this change part of the 'official' GoLink?

Cordially,

Paul