News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

invalid fixup

Started by Biterider, October 09, 2017, 05:40:52 AM

Previous topic - Next topic

Biterider

Hi
I'm moving my stuff to USAM and I tried to build my library (ObjMem32.lib) with USAM32. It builds Ok so far, but when I try to use its procs I get the following error message when linking:
QuoteINK : LNK6004: Demo01A.exe not found or not built by the last incremental link; performing full link
ObjMem32.lib(DbgOutTextA.obj) : fatal error LNK1190: invalid fixup found, type 0x0001
Depending on the used proc it fails on different obj modules. Any idea what is going wrong?


I use the following code to build
Quote\UASM32.EXE /nologo /c /coff \Code\ObjMem32\386\*.asm
\LINK.EXE -lib *.obj /out:\Code\ObjMem32\ObjMem32.lib /NOLOGO


Biterider



jj2007

This works for me. What exactly is the problem?include \masm32\include\masm32rt.inc
includelib \Masm32\ObjMem32.lib
.code
start:
  BStrAlloc PROTO :DWORD
  invoke BStrAlloc, 1000
  inkey hex$(eax)
  exit
end start

Biterider

Hi JJ
I uploaded to the first post both libs.
The first differense is the size. The ML version is a bit bigger than the UASM version. Using the first one I can use all library procs as usual. Using the last one, I got the fixup error.


Biterider




jj2007

I get no errors for both. Is there a specific function that throws the error?

Biterider

Hi
I found one that can be reproduced with the following code
include \masm32\include\masm32rt.inc
includelib \Masm32\lib\ObjMem32.lib


externdef pFirstObject:DWORD                ;Exports pFirstObject symbol


.data
pFirstObject  DWORD     0
 
.code
start:
  GetObjectTemplate PROTO :DWORD
  invoke GetObjectTemplate, 1
  ret
end start



Compiling the asm file with ML or UASM make no difference.
[size=78%]This is the output message[/size]
QuoteD:\Masm32\Bin\UASM32.EXE /Zd /Zi /c /coff /nologo /I"D:\Masm32\Include" "Demo01A.asm"


***********
ASCII build
***********


Demo01A.asm: 14 lines, 2 passes, 108 ms, 0 warnings, 0 errors
D:\Masm32\Bin\LINK.EXE /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:CV /VERSION:4.0 /LIBPATH:"D:\Masm32\Lib" /OUT:"Demo01A.exe" "Demo01A.obj"
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.


ObjMem32.lib(GetObjectTemplate.obj) : fatal error LNK1190: invalid fixup found, type 0x0001


Make error(s) occured.
Total compile time 297 ms


Biterider

Biterider

Hi
Playing with the library code, I removed the line containing "pFirstObject" and all externdef. Now the code obviously doesn't work, but it compiles with USAM without errors.
It seems to me, that externdef isn't working the same way ML does and the linker can't find the symbols to link the modules containing them.


Regards, Biterider

habran

Hi Biterider :biggrin:
At the moment I am preoccupied with macros and did not have time to see what is going on with your code
Johnsa was absent for few days, he is probably to busy with his work, hopefully he will be able to check it today
I'll finish soon with macros, than if he does not have time, I'll see what I can do about it.


Cod-Father

Biterider

Hi Habran
Thank you for your replay.
Since I have a workaround compiling the lib with ML and using UASM for the rest, it isn't a prio 1 for me.


Biterider


jj2007

On my machine the code builds fine with externdef pFirstObject:DWORD, but at runtime you get surprises:

GetObjectTemplate:
... UAsm:
0040112B   ³>  67:8B16 0000      mov edx, [small 0]
00401130   ³. EB 18             jmp short 0040114A

... ML:
0040112B   ³>  8B15 00204000     mov edx, [402000]
00401131   ³. EB 18             jmp short 0040114B

Biterider

Hi JJ
Thanks for looking into that!

What are you showing us? mov edx, ...
Maybe there is a difference on the used linker. What are you using? I use the one supplied with the MASM32 installation "Microsoft (R) Incremental Linker Version 5.12.8078"


Biterider

jj2007

Quote from: Biterider on October 09, 2017, 09:06:05 PMWhat are you showing us? mov edx, ...

  int 3
  invoke GetObjectTemplate, 1  ; 401120
...
00401120   Ú$  8B4424 04         mov eax, [esp+4]                     ; Demo01A.00401120(guessed Arg1)
00401124   ³.  85C0              test eax, eax
00401126   ³. 75 03             jnz short 0040112B
00401128   ³.  C2 0400           retn 4
0040112B   ³>  67:8B16 0000      mov edx, [small 0]   ; <<<<<<<<< should be mov edx, [402000]
00401130   ³. EB 18             jmp short 0040114A


Btw I get the invalid fixup with the M$ linkers but not with polink. With polink, it builds but:
POLINK: warning: Unknown relocation type (1) for symbol '_pFirstObject'; ignored.
And it crashes, see above 8)

johnsa

Hi,

Can you try assembling the source files individually and also with UASM64 ?


\UASM32.EXE /nologo /c /coff \Code\ObjMem32\386\*.asm
\LINK.EXE -lib *.obj /out:\Code\ObjMem32\ObjMem32.lib /NOLOGO


For your library, just to try and help narrow it down to either UASM32 specifically or the fact that it's running all the files in one session.
If the case is repeatable after that I'll need to be able to try assemble that LIB my side and see where/why the fixup data is being written out as type 1.

Cheers
John

Biterider

Hi John
I generated all obj files individually calling UASM64 for each file and the build the lib using Link.exe.
The result didn't change. Still "ObjMem32.lib(GetObjectTemplate.obj) : fatal error LNK1190: invalid fixup found, type 0x0001".
How can I help?


Biterider

johnsa

We need to create an example source for a lib with a similar extern that generates the same type of fixup to trace where/why that happens.
Ideally we need to see what fixup record type is created when ML is used and when UASM is used (seems to be 1) and what it should be.

Would you be able to make a template lib .asm source that exhibits the same issue (without all your dependencies) ?

Biterider

Hi John
I build a lib with only 1 procedure (GetObjectTemplate) and the problem still persits.
In the attachment is the complete test case. You will find 2 batch files to build the lib and the exe files.


Biterider