flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Unix > FreeBSD 6.2 (AMD64) with fasm-1.67.23.tgz (segment fault)

Author
Thread Post new topic Reply to topic
codsna



Joined: 08 Aug 2007
Posts: 10

FreeBSD 6.2 (AMD64) with fasm-1.67.23.tgz (segment fault)

/usr/bin/ld -V -m elf_i386_fbsd -dynamic-linker /libexec/ld-elf.so.1 /usr/lib32/crt1.o /usr/lib32/crti.o /usr/lib32/crtbegin.o /usr/lib32/crtend.o /usr/lib32/crtn.o -L/usr/lib32 -lc -lgcc fasm.o -o fasm

link passed

but

chmod +x fasm

Segmentation fault (core dump)
Post 03 Oct 2007, 03:30
View user's profile Send private message Reply with quote
Patrick_



Joined: 11 Mar 2006
Posts: 53
Location: 127.0.0.1

I've got the same problem using NetBSD 4.0RC3.
Post 24 Oct 2007, 23:14
View user's profile Send private message Reply with quote
Chewy509



Joined: 19 Jun 2003
Posts: 297
Location: Bris-vegas, Australia

Getting the same on Sun Solaris Express (aka "SunOS Hellfire 5.11 snv_70b i86pc i386 i86pc")

Using: ~/cc -o fasm ./fasm/fasm.o

fasm v1.64.21 links and runs fine.
Post 28 Oct 2007, 07:13
View user's profile Send private message Visit poster's website Reply with quote
xanatose



Joined: 09 Jan 2004
Posts: 57

Im getting a
Segmentation fault: 11

Under FreeBSD, on a Pentium4.
Using cc -o fasm fasm
Post 07 Nov 2007, 15:45
View user's profile Send private message Reply with quote
xanatose



Joined: 09 Jan 2004
Posts: 57

Found the error by looking at stdio.h of FreeBSD.

Instead of:

Code:

#define stdout 1
#define stderr 2




FreeBSD define this as:

Code:

#define stdout __stdoutp
#define stderr __stderrp




Both are declared as:

Code:

extern FILE * __stdoutp;
extern FILE * __stderrp;




Since 1 and 2 are invalid as pointers, it caused the Segmentation fault.


By adding to system.inc

Code:

extrn __stdoutp
extrn __stderrp




And changing:on system.inc and fasm.asm

Code:

mov [con_handle], 1



To

Code:

push dword [__stdoutp; 32 bit pointer
pop [con_handle]




And

Code:

mov [con_handle], 2



To

Code:

push dword [__stderrp; 32 bit pointer
pop [con_handle]




It works on 32 bit FreeBSD 6.2
Post 07 Nov 2007, 23:12
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.