Subject: Re: Assembly Language Programs
To: Alessandro Coppelli <email@example.com>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 04/12/2006 05:06:01
[I was going to move this to tech-userlevel, since it is mostly a
userlevel issue, but it seems the kernel is involved in that emulations
appear to be relevant. So I'm just adding tech-userlevel; please
remove one or the other if you're replying to just one aspect.]
> I am interested to developing a little
> assembly language programs.
> I [read] the article written by Thomas Sommers
> ( http://user.nj.net/~tms/hello.html )
> I followed author's instructions but at the end of compilation
> as -o <name>.o <name>.s
> ld -o <name> <name>.o
> what I have is
> # Segmentation fault ( core dumped )
> Someone knows what is happenig ?
The article says it's for FreeBSD, but you're using NetBSD. This
strikes me as the most likely underlying problem.
Looking at the code, there is nothing obviously wrong with it, though.
I find that when I try it, it simply exits, without a coredump.
Running it under ktrace reveals that it is being mistaken for a Linux
12754 ktrace CALL execve(0xbfbfd4ac,0xbfbfd938,0xbfbfd940)
12754 ktrace NAMI "./z"
12754 z EMUL "linux"
12754 z RET oldolduname -1 errno -2 No such file or directory
12754 z CALL write(0xbfbfdff0,0,0)
12754 z RET write -1 errno -9 Bad file descriptor
12754 z CALL exit(0xbfbfdff0)
Why it isn't behaving this way for you is a good question. Perhaps
it's a NetBSD version difference (what version are you using?), perhaps
it's your kernel (do you ahve COMPAT_LINUX turned on?)....
I suspect there may be missing .note sections or some such.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML firstname.lastname@example.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B