Strange behaviour, program segfaults
Michael Urman
mu at tortall.net
Mon Apr 10 06:53:10 PDT 2006
On Mon, Apr 10, 2006 at 11:53:54AM +0200, André Reffhaug wrote:
> I have been experimenting a little bit with it, and I've come across
> something strange. The following code, when compiled with "yasm -p gas
> -f elf file.s -o file.o" and "ld file.o -o file" causes a segmentation
> fault. When compiling with "as" it runs fine. I haven't had a lot of
> time to debug it (im at work, and writing assembler is far from what i
> should be doing) but i thought it might be worth letting you guys
> know.
Just as a data point, since I don't know gas the way Peter does. I get
the following errors when I run it with your code:
% ./yasm -p gas -f elf gastest.asm
% ld gastest.o -o gastest
ld: gastest: warning: allocated section `.text' not in segment
% ./gastest
zsh: exec format error: ./gastest
When I crossreferenced for the usage in our test cases, it uses ".text"
instead of ".section .text" so I tried that and it seems to execute
properly:
% ./gastest
zsh: exit 33 ./gastest
Peter will have to sort out whether this behavior is by design or by
accident. Since you say it works with as, I'm going to guess it's a
design oversight. And a great thing to catch before the final release of
0.5.0! :)
Michael
--
Michael Urman [- mu at tortall.net -]
More information about the yasm-devel
mailing list