* (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-21 16:02 Matthew Jacob
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Jacob @ 1996-10-21 16:02 UTC (permalink / raw)
This is kind of a silly error to fall into, but I did-
I was recompiling gcc-2.7.2.1 (with itself) and the rebuilt cc1 kept
on core dumping on enquire.c.
After scratching my head and trying a couple of things and (sadly)
pestering Mr. R. Henderson, I finally realized that the problem
was simply that 8MB stack ain't nearly enough (after all, it used
to take 20+MB of stack to compiler mem_rop.c on a sparc, and that
isn't nearly so memory consumptive as an alpha...).
Because this was set as a hard limit, you have to be root to increase
it, and now I'm happily moving along compiling away.
So: Note for them's that didn't hit this already.
Question: Well, <linux/sched.h> defines an 8MB as the
default stack size. Well and good, but can
the default resource limit for stack size
in asm-alpha/resource.h make STK_LIM a soft
limit and STK_LIM << 3 the hard limit?
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-21 18:09 Craig Burley
1996-10-21 22:23 ` Andreas Johansson
0 siblings, 1 reply; 12+ messages in thread
From: Craig Burley @ 1996-10-21 18:09 UTC (permalink / raw)
[Note that I'm on the axp-list, but not the linux-alpha list, at
the moment.]
>This is kind of a silly error to fall into, but I did-
>
>I was recompiling gcc-2.7.2.1 (with itself) and the rebuilt cc1 kept
>on core dumping on enquire.c.
>
>After scratching my head and trying a couple of things and (sadly)
>pestering Mr. R. Henderson, I finally realized that the problem
>was simply that 8MB stack ain't nearly enough (after all, it used
>to take 20+MB of stack to compiler mem_rop.c on a sparc, and that
>isn't nearly so memory consumptive as an alpha...).
>
>Because this was set as a hard limit, you have to be root to increase
>it, and now I'm happily moving along compiling away.
Whoa. Maybe this is what I ran into a couple of days ago.
Not only would the cc1 I was building core-dump doing _anything_ --
even being invoked with no arguments -- running gdb on it would core-
dump gdb! The closest I got to finding the problem was getting into
where init_lex() calls xmalloc(), and stepping into the call to
malloc() would core-dump. But, so would breaking on an _earlier_
xmalloc() call and running from there!
Here's what really threw me. I knew I had been happily building and
using new cc1's for months, and that I'd made only one change that
triggered building the new (buggy) cc1. That was adding more options
to the lang_options[] table in toplev.c (via g77's gcc/f/lang-options.h
file).
I don't understand, offhand, how increasing the size of a global table
(whose length seems not to be directly used by any code in toplev.c to
set the size of something allocated on the stack) could trigger a stack
overflow error.
But, I do know that when I commented out the new options, the rebuilt cc1
worked fine -- as did the cc1 I got when I commented them back in, but
commented out g77 options that were duplicates of gcc options anyway (and
thus didn't really need to be in g77's list). So, reducing the size of this
global table did indeed make the symptoms disappear. (Are these globals
allocated on the stack, a la systems like the Mac OS??)
I realize I don't, at this moment, know all of the issues, but I'd like
to _strongly_ suggest that if we're at the point of sometimes exceeding
the _default_ stack sizes everyone gets with Linux/AXP on something as
vanilla/smallish as cc1, we need to do one of two things ASAP:
- Find whatever bug or misdesign is resulting in too much stack being used
for cc1 (after all, g77's much larger f771 runs fine on my system). This
is unlikely to be cc1's fault per se, I mean maybe the compiler/assembler/
linker/loader used to build and run cc1 are doing something really wasteful.
- Increase the default stack size for Linux/AXP so hardly anybody ever needs
to change it.
Claiming that neither of the above need to be done because people can
simply change their stack size is, IMNSHO, ludicrous. Yes, they _can_,
but how are they going to know they're supposed to do it, when all they
see is a very obscure diagnostic that points to no documentation or
explanation, and even the _debugger_ doesn't work (or explain why it isn't
working)???
So, don't claim that...let's fix the problem, either by increasing the stack
(assuming it's too small) or fixing the toolchain problems resulting in the
stack being abused by things as ordinary as cc1.
Yes, I'm volunteering, if I can do anything to help out (investigate, etc.).
I'm running a really old Linux/AXP (part of why I didn't report the problem),
and have plenty of g77 work to do, but fixing this is very important IMO.
tq vm, (burley)
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
1996-10-21 18:09 Craig Burley
@ 1996-10-21 22:23 ` Andreas Johansson
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Johansson @ 1996-10-21 22:23 UTC (permalink / raw)
> Not only would the cc1 I was building core-dump doing _anything_ --
> even being invoked with no arguments -- running gdb on it would core-
> dump gdb! The closest I got to finding the problem was getting into
> where init_lex() calls xmalloc(), and stepping into the call to
> malloc() would core-dump. But, so would breaking on an _earlier_
> xmalloc() call and running from there!
Well, I have found that single-stepping on malloc coredumps gdb every
time and with every program (and both c and c++). So this is probably
not your problem. If you set a breakpoint further away it works.
--
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
: E-mail: ajo@wopr.campus.luth.se :
: S-mail: Andreas Johansson, Karhusvagen 5 6:618, 977 54 Lulea, SWEDEN :
: Have you had your dose of 261.62 BogoMIPS today? - Run Alpha! :
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-21 23:47 David Mosberger
1996-10-22 12:55 ` Andreas Johansson
0 siblings, 1 reply; 12+ messages in thread
From: David Mosberger @ 1996-10-21 23:47 UTC (permalink / raw)
> > Not only would the cc1 I was building core-dump doing _anything_ --
> > even being invoked with no arguments -- running gdb on it would core-
> > dump gdb! The closest I got to finding the problem was getting into
> > where init_lex() calls xmalloc(), and stepping into the call to
> > malloc() would core-dump. But, so would breaking on an _earlier_
> > xmalloc() call and running from there!
> Well, I have found that single-stepping on malloc coredumps gdb every
> time and with every program (and both c and c++). So this is probably
> not your problem. If you set a breakpoint further away it works.
Most likely this is due to insufficient debug info in libc.
Unfortunately, gdb on Alpha does not handle this situation well (and,
even in the best case, there is only so much gdb can do without
debugging info---the DEC Unix calling convention is highly optimized
and just looking at the code etc will not give you all the information
to, say, backtrack in the stack).
I can guarantee you that gdb works just fine on malloc---I've spent
many long hours tracking a bug or two in it and it definitively works.
On pre-4.0 systems, you can link against -lg (instead of -lc) to get
debug info for the standard libc. I'm not sure there is an easy way
of doing this on 4.0 (short of recompiling libc). Maybe the next
release of RH will include debug info for all shared libraries. The
only cost of doing this is that the shared libs take up some extra
space, but given the current diskprices, I think it's well worth it.
As for compilation problems due to the 8MB stack limit: all I can say
is that I have built gcc and lots of other stuff many times without
having seen any problems like that. Not to say that the 8MB stack
limit isn't too small, but maybe there is something else that makes
the problem more acute.
--david
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-22 2:21 Matthew Jacob
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Jacob @ 1996-10-22 2:21 UTC (permalink / raw)
>From: David Mosberger <davidm@AZStarNet.com>
>
>As for compilation problems due to the 8MB stack limit: all I can say
>is that I have built gcc and lots of other stuff many times without
>having seen any problems like that. Not to say that the 8MB stack
>limit isn't too small, but maybe there is something else that makes
>the problem more acute.
This may be the case. I went ahead and went to rebuild everything,
and watched that while xgcc was redoing crtstuff.c the resident
set size climbed up to 512000 and then kablooie. Something else
is happening in this case, although increasing the stack limit
for enquire.c seemed to help.
All I wondered was whether folks had seen similar things. The answer
seems to be: "some have, some have not".
I'll do some debugging, but won't be able to get to it for a couple
of days.
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
1996-10-21 23:47 David Mosberger
@ 1996-10-22 12:55 ` Andreas Johansson
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Johansson @ 1996-10-22 12:55 UTC (permalink / raw)
> > Well, I have found that single-stepping on malloc coredumps gdb every
> > time and with every program (and both c and c++). So this is probably
> > not your problem. If you set a breakpoint further away it works.
>
> Most likely this is due to insufficient debug info in libc.
> Unfortunately, gdb on Alpha does not handle this situation well (and,
> even in the best case, there is only so much gdb can do without
> debugging info---the DEC Unix calling convention is highly optimized
> and just looking at the code etc will not give you all the information
> to, say, backtrack in the stack).
Ok, by single-stepping on malloc I didn't mean that I wanted to single-
step into the function, but simply over it (not "step" but "next" in gdb).
Watch this:
--------------------------------- malloc_gdb.c -------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
{
int num;
char *str;
if (argc < 2)
return (0);
if (!strcmp ("asdf", argv[1]))
printf ("asdf\n");
num = strlen (argv[1]);
str = (char *) malloc (num);
strcpy (str, argv[1]);
printf ("String: %s\n", str);
free (str);
return (0);
}
------------------------------ At the shellprompt ----------------------------
ajo@wopr ~/src/test >gcc -static -g -o malloc_gdb malloc_gdb.c
ajo@wopr ~/src/test >gdb malloc_gdb
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
(gdb) break main
Breakpoint 1 at 0x1200005e8: file malloc_gdb.c, line 10.
(gdb) run asdfkasld
Starting program: /home/ajo/src/test/malloc_gdb asdfkasld
Breakpoint 1, main () at malloc_gdb.c:10
10 if (argc < 2)
(gdb) next
13 if (!strcmp ("asdf", argv[1]))
(gdb)
16 num = strlen (argv[1]);
(gdb)
18 str = (char *) malloc (num);
(gdb)
Segmentation fault (core dumped)
Exit 139
ajo@wopr ~/src/test >gdb /usr/bin/gdb core
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
(no debugging symbols found)...
Core was generated by gdb malloc_gdb'.
Program terminated with signal 11, Segmentation fault.
#0 0x12005e8ec in make_function_type ()
(gdb) bt
#0 0x12005e8ec in make_function_type ()
#1 0x12005e988 in lookup_function_type ()
#2 0x1200ac7c8 in mdebug_build_psymtabs ()
#3 0x1200b1c70 in ecoff_relocate_efi ()
#4 0x1200bca28 in xmmalloc ()
#5 0x1200d0450 in bfd_find_target ()
warning: Hit beginning of text section without finding
warning: enclosing function for address 0x11ffff520
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable). In that case, you may wish to
increase the size of the search with the set heuristic-fence-post' command.
Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.
(gdb)
------------------------------------------------------------------------------
As you can see strcmp and strlen works quite ok, but malloc makes gdb
coredump. Curiously enough this only happends on statically linked elf-
binaries, but on the other hand, those are often much more practical to
debug.
--
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
: E-mail: ajo@wopr.campus.luth.se :
: S-mail: Andreas Johansson, Karhusvagen 5 6:618, 977 54 Lulea, SWEDEN :
: Have you had your dose of 261.62 BogoMIPS today? - Run Alpha! :
<-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=->
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-26 9:53 Craig Burley
1996-10-26 12:50 ` Richard Henderson
0 siblings, 1 reply; 12+ messages in thread
From: Craig Burley @ 1996-10-26 9:53 UTC (permalink / raw)
Follow-up on the cc1 crash I have, though this is hardly definitive....
Regarding the too-small stack problem -- that might be a problem for
others, but I've verified it isn't what is causing my crash. I've
rebuilt my gcc build directory so I can reproduce the crash, and I
can reproduce it even when logged in as root _after_ doing
"ulimit -s 65536" to increase the stack.
Eirik Fuller <eirik@netcom.com> has been exchanging email with me,
and he has tracked down what appears to be some problems on _some_
installations of Linux -- or, at least, one problem, but that
doesn't seem to afflict _my_ particular installation.
The problem he found, as the result of IMO some decent debugging work
on his part, was that somehow "struct rlimit" in his
/usr/include/sys/resource.h file was declaring its members (rm_cur and
rm_max, or whatever) as "int", while Linux (the kernel) was writing them
as "long" -- 64 bits. The upshot for him was that the call to getrlimit()
in toplev.c (the main() in cc1) was overwriting argc (with the 8MB figure ;-),
which led to problems later on.
I don't have that specific problem. My /usr/include/sys/resource.h #include's
<linux/resource.h>, which properly sets up the rlimit struct -- I've verified
this using "gcc ... -E toplev.c", because You Never Know.
But, the fact remains that I have a cc1 that not only segfaults immediately
on execution, but crashes gdb as soon as it reaches the call to malloc()
that results from the call to init_lex(). (This is _not_ the first call
to malloc()!!)
I'm too busy with g77 and other stuff to track this down, but I will make it
a high priority _if_ I run into it after I install the newest Craftworks
Linux AXP distribution (meaning it isn't fixed) and there's nobody else
looking into it. Though, Eirik is going to give it a try -- I've uploaded
the buggy cc1 for him to see if he can reproduce the problem, get any further
with his ELF-based system and hand-built ECOFF gdb (my system's ECOFF-based),
etc.
But, at least Eirik already discovered something I hadn't paid any attention
to before -- gcc's toplev.c module, which gets invoked for all the "major"
compilation phases of each language (gcc's cc1, g++'s cc1plus, g77's f771,
and so on), tries to increase the stack size from the current value to the
maximum as soon as it can.
Maybe 8MB is plenty, but if there's any concern, perhaps the default
_maximum_ stack size for Linux/AXP could be quadrupled. That way, most
programs would still get the 8MB size (which presumably yields better
performance or less resource hogging, when that's enough), while programs
that know they want more space can get it by calling setrlimit(), like gcc's
toplev.c does.
Just a thought.
In any case, the fact that my cc1 problem goes away just by changing the size
of a global array of constants suggests to me that there _is_ a hard-to-track
bug lurking in there somewhere. It might be convenient for me, and everyone,
if it disappears (e.g. once I upgrade), but I'd really rather Eirik or someone
track it down (to both the bug that crashes cc1 _and_ the bug that crashes gdb
as well) so that, at least, we can be sure it's been fixed, not just swept
under the rug by having the locations of things in memory move sufficiently
to hide it. OTOH, given that so much has changed in Linux since my system
was put together last May, it's entirely reasonable to expect that this lurking
bug lurks no longer -- has been fixed by the ongoing work. It'll be wonderful
if we get a definitive answer on this.
tq vm, (burley)
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
1996-10-26 9:53 (re)compiling gcc-2.7.2.1 under linux alpha: note && question Craig Burley
@ 1996-10-26 12:50 ` Richard Henderson
0 siblings, 0 replies; 12+ messages in thread
From: Richard Henderson @ 1996-10-26 12:50 UTC (permalink / raw)
> The problem he found, as the result of IMO some decent debugging work
> on his part, was that somehow "struct rlimit" in his
> /usr/include/sys/resource.h file was declaring its members (rm_cur and
> rm_max, or whatever) as "int", while Linux (the kernel) was writing them
> as "long" -- 64 bits. The upshot for him was that the call to getrlimit()
> in toplev.c (the main() in cc1) was overwriting argc (with the 8MB figure ;-),
> which led to problems later on.
Ah hah! Eirik must using a new glibc snapshot which is in fact buggy.
I'll have a fix for this in to Ulrich today to be included in the
Sunday snapshot.
Thanks for the report.
r~
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-26 18:21 Matthew Jacob
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Jacob @ 1996-10-26 18:21 UTC (permalink / raw)
From burley@gnu.ai.mit.edu Sat Oct 26 02:53:19 1996
>
>
>Maybe 8MB is plenty, but if there's any concern, perhaps the default
>_maximum_ stack size for Linux/AXP could be quadrupled.
Well, 8MB is too small, but I remember seeing cc1 crash after
consuming a huge amount of stack, so it probably isn't the stack
limit.
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-26 21:27 Craig Burley
0 siblings, 0 replies; 12+ messages in thread
From: Craig Burley @ 1996-10-26 21:27 UTC (permalink / raw)
>Well, 8MB is too small, but I remember seeing cc1 crash after
>consuming a huge amount of stack, so it probably isn't the stack
>limit.
I wonder if there's a bug similar to what Eirik saw that is causing
cc1 to decide it needs a lot more stack than it really does. (E.g.
on his system, getrlimit() overwrote argc, changing it from 8 or
something like that to 8 million...but he can post more details about
the effect this had, in his case, which again is not what I am
running into.)
Everyone please keep track of your "funnies" in this area! As
we begin to make progress tracking it down, we'll want some more
examples of strange behavior...don't assume that the Linux developers
are all wanting to hand-wave these things, just because they're
busy with other stuff for a while.
tq vm, (burley)
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-27 0:22 Matthew Jacob
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Jacob @ 1996-10-27 0:22 UTC (permalink / raw)
From axp-list-request@redhat.com Sat Oct 26 14:31:57 1996
>
>>Well, 8MB is too small, but I remember seeing cc1 crash after
>>consuming a huge amount of stack, so it probably isn't the stack
>>limit.
>
>I wonder if there's a bug similar to what Eirik saw that is causing
>cc1 to decide it needs a lot more stack than it really does.
Yep. I finally got off my butt to check- that's my problem too.
Good snooping!
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (re)compiling gcc-2.7.2.1 under linux alpha: note && question
@ 1996-10-27 1:15 Matthew Jacob
0 siblings, 0 replies; 12+ messages in thread
From: Matthew Jacob @ 1996-10-27 1:15 UTC (permalink / raw)
Just to be clear- this particular problem of long vs. int entities
in struct rlimit applies across all of Linux- not just alpha's.
Perhaps a hint from OSF/1 here- make an rlim_t?
--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~1996-10-27 1:15 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-10-26 9:53 (re)compiling gcc-2.7.2.1 under linux alpha: note && question Craig Burley
1996-10-26 12:50 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1996-10-27 1:15 Matthew Jacob
1996-10-27 0:22 Matthew Jacob
1996-10-26 21:27 Craig Burley
1996-10-26 18:21 Matthew Jacob
1996-10-22 2:21 Matthew Jacob
1996-10-21 23:47 David Mosberger
1996-10-22 12:55 ` Andreas Johansson
1996-10-21 18:09 Craig Burley
1996-10-21 22:23 ` Andreas Johansson
1996-10-21 16:02 Matthew Jacob
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox