Author Topic: invalid fixup  (Read 5431 times)

Biterider

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
invalid fixup
« on: October 09, 2017, 05:40:52 AM »
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:
Quote
INK : 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


« Last Edit: October 09, 2017, 07:09:59 AM by Biterider »

jj2007

  • Member
  • *****
  • Posts: 10654
  • Assembler is fun ;-)
    • MasmBasic
Re: invalid fixup
« Reply #1 on: October 09, 2017, 06:30:38 AM »
This works for me. What exactly is the problem?
Code: [Select]
include \masm32\include\masm32rt.inc
includelib \Masm32\ObjMem32.lib
.code
start:
  BStrAlloc PROTO :DWORD
  invoke BStrAlloc, 1000
  inkey hex$(eax)
  exit
end start

Biterider

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #2 on: October 09, 2017, 07:13:48 AM »
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

  • Member
  • *****
  • Posts: 10654
  • Assembler is fun ;-)
    • MasmBasic
Re: invalid fixup
« Reply #3 on: October 09, 2017, 07:22:59 AM »
I get no errors for both. Is there a specific function that throws the error?

Biterider

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #4 on: October 09, 2017, 07:06:10 PM »
Hi
I found one that can be reproduced with the following code
Code: [Select]
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]
Quote
D:\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

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #5 on: October 09, 2017, 07:29:27 PM »
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

  • Member
  • *****
  • Posts: 1225
    • uasm
Re: invalid fixup
« Reply #6 on: October 09, 2017, 07:57:50 PM »
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

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #7 on: October 09, 2017, 08:05:09 PM »
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

  • Member
  • *****
  • Posts: 10654
  • Assembler is fun ;-)
    • MasmBasic
Re: invalid fixup
« Reply #8 on: October 09, 2017, 08:16:17 PM »
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

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #9 on: October 09, 2017, 09:06:05 PM »
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

  • Member
  • *****
  • Posts: 10654
  • Assembler is fun ;-)
    • MasmBasic
Re: invalid fixup
« Reply #10 on: October 09, 2017, 11:53:01 PM »
What are you showing us? mov edx, ...

  int 3
  invoke GetObjectTemplate, 1  ; 401120
Code: [Select]
...
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:
Code: [Select]
POLINK: warning: Unknown relocation type (1) for symbol '_pFirstObject'; ignored.And it crashes, see above 8)

johnsa

  • Member
  • ****
  • Posts: 810
    • Uasm
Re: invalid fixup
« Reply #11 on: October 10, 2017, 12:34:48 AM »
Hi,

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

Code: [Select]
\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

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #12 on: October 10, 2017, 02:11:27 AM »
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

  • Member
  • ****
  • Posts: 810
    • Uasm
Re: invalid fixup
« Reply #13 on: October 10, 2017, 02:20:35 AM »
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

  • Member
  • ****
  • Posts: 546
  • ObjAsm Developer
    • ObjAsm
Re: invalid fixup
« Reply #14 on: October 10, 2017, 02:47:56 AM »
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