32-bit fixup in NASM .obj 
Author Message
 32-bit fixup in NASM .obj

I have a problem with the example code below when assembled with NASM
0.98 in .obj (-f obj) format. It appears that NASM generates 16-bit
fixup (FIXUPP) records, while Borland delphi 4.0 -- to which I want to
link the code -- requires 32-bit fixup (FIXU32) records. Is there a way
to force NASM to generate 32-bit fixup records?

;===============================
SEGMENT DATA PUBLIC USE32 FLAT

EXTERN GlobalData    ;var GlobalData: Integer;

SEGMENT CODE PUBLIC USE32 FLAT

GLOBAL NASMTEST

NASMTEST:

mov   eax, 1
mov  [GlobalData], eax

ret
;===============================

Any help will be appreciated. This is really a little out of my
league ;-)

Roelof

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Wed, 05 Dec 2001 03:00:00 GMT  
 32-bit fixup in NASM .obj


:I have a problem with the example code below when assembled with NASM
:0.98 in .obj (-f obj) format. It appears that NASM generates 16-bit
:fixup (FIXUPP) records, while Borland Delphi 4.0 -- to which I want to
:link the code -- requires 32-bit fixup (FIXU32) records. Is there a way
:to force NASM to generate 32-bit fixup records?

The short answer is to try -f win32 (see section 6.3 in the NASM
documentation for the reason). If this doesn't work, contact me by
email.

Best,
        -- Chuck Crayne
-----------------------------------------------------------

-----------------------------------------------------------

comp.lang.asm.x86 moderation panel member



Wed, 05 Dec 2001 03:00:00 GMT  
 32-bit fixup in NASM .obj

Quote:

> I have a problem with the example code below when assembled with NASM
> 0.98 in .obj (-f obj) format. It appears that NASM generates 16-bit
> fixup (FIXUPP) records, while Borland Delphi 4.0 -- to which I want to
> link the code -- requires 32-bit fixup (FIXU32) records. Is there a way
> to force NASM to generate 32-bit fixup records?

  Is Delphi its own linker, or do you use an external linker?
Can Delphi let you generate .OBJ files for use with an
external linker?  (The versions of TLINK I have tested work
with .OBJ code generated by NASM 0.98).

  How do you know that it requires FIXU32 records?

  In the NASM source code in outobj.c in the routine obj_write_fixup()
you could make a small change to test whether a FIXU32 record
covers your problem (assumeing you can recompile NASM).

  The line that says "forp = obj_force(forp, bytes<<3)" could
be made unconditional (get rid of the "if" line above it and
move the "forp = " line below the closing "}" of the "else"
above that.

  The line has the effect of making the size of the FIXUP
record match the size of the actual fixup.  I have found
one case in which some versions of tlink fail unless those
match.  That is why the line is present at all.

  I have variously heard that the size of the fixup record
must match the segment it is in, or must match the target
segment, or in this narrow case must match fixup itself.
The OBJ format documentation I have read seems to say that
the size only needs to be large enough to hold the value
that it must hold (which is automatic in NASM's obj_
routines without calling obj_force.

  In the general case I don't know enough about the various
linkers to know which size to choose.  The change I suggested
is certainly not an acceptable permanent change to NASM.
But in your code, the segments and the fixup itself and
almost everything about it is 32-bit, so forcing the fixup
record to be 32-bit won't do any harm.

  If that does deal with a Delphi problem, then the NASM
developers (probably me in this case) will need to find a
more general solution (possibly a command line switch) to
control this complex linker-compatibility issue.
--
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/



Thu, 06 Dec 2001 03:00:00 GMT  
 32-bit fixup in NASM .obj


Quote:
> Is Delphi its own linker, or do you use an external linker?

Its own linker.

Quote:
> Can Delphi let you generate .OBJ files for use with an
> external linker?

Yes.

Quote:
> How do you know that it requires FIXU32 records?

Stefan Hoffmeister, a very sharp member of TeamB (Borland's user
support group, see http://www.borland.com/newsgroups/teamb/) suggested
that when I asked the same question in the

Quote:
> In the NASM source code in outobj.c in the routine obj_write_fixup()
> you could make a small change to test whether a FIXU32 record
> covers your problem (assumeing you can recompile NASM).

I did that and it works, at least with my original test file. Thanks!

Quote:
> But in your code, the segments and the fixup itself and
> almost everything about it is 32-bit, so forcing the fixup
> record to be 32-bit won't do any harm.

I agree.

Quote:
> If that does deal with a Delphi problem, then the NASM
> developers (probably me in this case) will need to find a
> more general solution (possibly a command line switch) to
> control this complex linker-compatibility issue.

Maybe something like -f obj32 to force everything to 32-bit? That
option could also perhaps make USE32 the default.

Roelof
------
remove the obvious from my reply address...

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Fri, 07 Dec 2001 03:00:00 GMT  
 32-bit fixup in NASM .obj

Quote:


>   If that does deal with a Delphi problem, then the NASM
> developers (probably me in this case) will need to find a
> more general solution

FWIW, the Delphi linker is quite picky (something I am not happy with).

I'll be happy to test a few things with Delphi, any time, but I don't
have the time to dig through NASM's OBJ source code currently.

If you would like to target / accomodate for Delphi (as sort of evident
from the wishlist), I'd suggest that we take this to email?

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Wed, 12 Dec 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Division 32-Bit/32-Bit with 16-Bit Register

2. Empty obj files on 32-bit compile

3. 32-bit obj

4. Building 32 bit DLL from 32 bit EXE

5. 32 Bit ASM from 32 Bit Windows COBOL

6. 32 Bit ASM from 32 Bit Windows COBOL

7. Calling 32-bit FORTRAN dlls from 32-bit VB

8. top 32 bits of 64-bit product of two 32-bit integers

9. 32-bit ST/V outruns 32-bit ST80 on Intel

10. Need help linking NASM .obj's to C++ obj's

11. 16, 16/32, 32 bit Forths: Pros/Cons?

12. 32 bit ST communicating with 16 bit VB

 

 
Powered by phpBB® Forum Software