home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!decwrl!csus.edu!netcom.com!aclark
- From: aclark@netcom.com (Al Clark)
- Newsgroups: comp.os.linux
- Subject: Re: SEGV in library routines
- Message-ID: <1992Nov9.192911.19545@netcom.com>
- Date: 9 Nov 92 19:29:11 GMT
- Article-I.D.: netcom.1992Nov9.192911.19545
- References: <1992Nov9.081513.22863@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Lines: 53
-
- In article <1992Nov9.081513.22863@netcom.com> zmbenhal@netcom.com (Zeyd M. Ben-Halim) writes:
- >
- >This was on the mailing list. Since I've heard no explaination I'm asking here:
- >
- > From: d88-man@nada.kth.se
- > Sender: owner-linux-activists@joker.cs.hut.fi
- > X-Note1: Remember to put 'X-Mn-Key: normal' to your mail body or header
- > X-Mn-Key: NORMAL
- >
- >
- > I have tried compiling some X-programs (e.g SRGP-library, olvwm,
- > xsokoban etc.) The compilation works ok, but when trying to run the
- > resulting executable just give segmentation fault, core dumped...
- > Using gdb shows that the seg. fault appears in a function called
- > _end(). (What is that function doing ?) It seems that the call to
- > ^^^^^^
- >I got similar error trying to run equel (part of ingres RDBMS). The stack
- >showed:
- >sys_nerr
- >_end
- >_end
- >But sys_nerr is AN integer. gdb says that it's a char. In the library is
- >appears as T (text; aka code???)
- >
- [ remaining info deleted ]
-
- I am far from an expert, so if anyone can correct me, jump
- right in, but _end is normally the symbol defining the end
- of the data segment. The program is made up of a text
- segment and an initialized data segment, amongst others, and
- the area right after the data segment, (that is, right after
- the _end symbol) is the address area from which more memory
- is allocated. You should never be executing code in this
- area, which is sufficient to cause a segment fault.
- Somehow, you are jumping to a data address. Note that
- sys_nerr is a data address, defined in errlist.o, from
- libc. I think the T merely tells the linker that this is
- an address that is to be used to resolve undefined addresses.
-
- So this means that the stack backtrace is consistent with a
- segment fault. Look further back on the trace; common
- reasons for such probs are calling a subroutine with the
- wrong number or type of arguments. For example, if you call
- a subroutine that is expecting two words of arguments, and
- you only supply one, the return address on the stack can get
- misused or corrupted, and you transfer control to some non
- text segment address and, there you go, segment violation
- and segment fault interrupt. Ansi C should detect such
- cases, but the code you're porting may be old.
-
- Good luck.
- --
- Al - aclark@netcom.com - My opinions are my own.
-