flat assembler
Message board for the users of flat assembler.

Index > Main > Possibly wrong relocations with Fasm and DJGPP

Author
Thread Post new topic Reply to topic
merlin



Joined: 17 Nov 2003
Posts: 11
merlin 15 Sep 2006, 10:27
Hi, I'm trying to compile and link C code with asm code,
however when I compile with fasm my asm source I get
wrong relative relocations in output objects.

For some reason fasm doesn't subtract the distance from
the instruction that follows to the start of the section, but leaves
that relocation as non-relative, but when the linker adds the offset,
the final output becomes 0+offset, which of course is wrong.

I'm compiling and linking with DJGPP (gcc + ld), my fasm code
is compiled as MS COFF.

Any ideas?
Post 15 Sep 2006, 10:27
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 15 Sep 2006, 10:41
DJGPP uses dj-coff, most win32 tools uses ms-coff.

The formats are basically identical, but the way relocations are output are different. Iirc for ms-coff, a '0' is stored and the linker does the whole relocation job. For dj, a relative position is stored, and the linker basically just adds delta.
Post 15 Sep 2006, 10:41
View user's profile Send private message Visit poster's website Reply with quote
merlin



Joined: 17 Nov 2003
Posts: 11
merlin 15 Sep 2006, 10:54
Thanks...
Is there a way to tell fasm to store relative position?
Post 15 Sep 2006, 10:54
View user's profile Send private message Reply with quote
merlin



Joined: 17 Nov 2003
Posts: 11
merlin 15 Sep 2006, 20:41
Issue solved (switched to COFF), topic closed...
Post 15 Sep 2006, 20:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.