(If someone else helped me, thanks also to you.)
I'm summarizing what i learned for the benefit of others who
may have this problem. Naturally experts already know everything
here, and don't need to read further.
I was writing a little program to get my feet wet using the svga lib.
The problem was that, according to gdb, i was getting a segmentation fault
BEFORE main was reached, which to my naive way of thinking should have
been impossible because i thought main was the entry point into the
program.
Al pointed out that main() is NOT the entry point of a program; crt0
is. (crt0 is presumably placed in your executable by gcc or one of
the programs gcc execs.) He also said that the problem might be caused
by not linking in the proper libraries. Michael suggested that i use
strace to try to figure out what was going on. Jeroen noted that one
can observe similar behavior (SIGSEGV) in some versions of vgatest
(one of the test programs in the svgalib stuff), but not in others.
All of these observations were very helpful.
First, strace is a useful tool for seeing what system calls your
software makes.
And you can run strace on any program.
Running strace on the two versions of vgatest (one of the programs
Jeroen was talking about) reveals that the vgatest which crashes doesn't
have as many libraries linked in as the one which doesn't crash.
And that was just Al's suggestion: link in another library.
For my program, linking in `-lc' cured the problem.
Thanks again to all who helped.
yeeOn