Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Specifying a stack size causes crash: (9 Items)
   
Specifying a stack size causes crash  
Hi,

If I specify a stack size, I can't even get a breakpoint at _start.  The program crashes immediately.

Looking at the System Summary page, without specifying a stack size, it appears to be set to 8k.

Specifying a stack size of 10k (-N 10K) and after rebuilding everything, the program will crash immediately at startup.
Ideas?

Thanks
Kevin
Re: Specifying a stack size causes crash  
This is QNX 6.3.2, using the 4.2.4 compiler and 2.18 binutils.  Not sure if I have the binutils installed correctly, I 
guess that could be part of the problem, but I'm not sure.

Kevin
Re: Specifying a stack size causes crash  
Just tried building with 3.3.5, and I'm still having the same problems.  I've tried up to 1M for a stack size.

Crazy daisy....
Re: Specifying a stack size causes crash  
I wonder if it is the invocation of ldrel that is causing problems.

I ran qcc with the -vv option.  ldrel is called when I specify a stack size, but it doesn't seem to be called when I 
don't . 

Kevin
Re: Specifying a stack size causes crash  
Kevin Stallard wrote:
> I wonder if it is the invocation of ldrel that is causing problems.
> 
> I ran qcc with the -vv option.  ldrel is called when I specify a stack size, but it doesn't seem to be called when I 
don't . 

Yep, ldrel is what adds the stack note. In 6.3.2 there was an empty 
placeholder section for the note in crtn.o but newer binutils will 
discard empty sections. I suspect the problem your having is that ldrel 
is failing to correctly add a stack size note with the placeholder 
missing. Making room for a PT_NOTE segment post link without moving 
things around gets kind of tricky. n 6.4.0 we added a default stack note 
in the crtn.o files and then the 6.4.0 ldrel will modify the stack note 
in place if one exists (all new binaries), or if not (older 6.3.2 
binaries), try to create one create a stack note.

If you have a 6.4.0 system, grab the crtn.o files from it (or let me 
know which ones you need) and use the attached 64x ldrel built for 6.3.2 
and see if that works.

If it doesn't work, can you post the failing binary?

Regards,

Ryan Mansfield
Attachment: Text ldrel_ 28.47 KB
RE: Specifying a stack size causes crash  
Ryan, thank you very much for this information.  I am amazed at how fast you
replied.  Thank you.

I will give this a whirl, probably in the morning.  I'll let you know.

Thanks again,
Kevin


-----Original Message-----
From: Ryan Mansfield [mailto:community-noreply@qnx.com] 
Sent: April 13, 2010 19:56
To: general-toolchain
Subject: Re: Specifying a stack size causes crash

Kevin Stallard wrote:
> I wonder if it is the invocation of ldrel that is causing problems.
> 
> I ran qcc with the -vv option.  ldrel is called when I specify a stack
size, but it doesn't seem to be called when I don't . 

Yep, ldrel is what adds the stack note. In 6.3.2 there was an empty 
placeholder section for the note in crtn.o but newer binutils will 
discard empty sections. I suspect the problem your having is that ldrel 
is failing to correctly add a stack size note with the placeholder 
missing. Making room for a PT_NOTE segment post link without moving 
things around gets kind of tricky. n 6.4.0 we added a default stack note 
in the crtn.o files and then the 6.4.0 ldrel will modify the stack note 
in place if one exists (all new binaries), or if not (older 6.3.2 
binaries), try to create one create a stack note.

If you have a 6.4.0 system, grab the crtn.o files from it (or let me 
know which ones you need) and use the attached 64x ldrel built for 6.3.2 
and see if that works.

If it doesn't work, can you post the failing binary?

Regards,

Ryan Mansfield




_______________________________________________

General
http://community.qnx.com/sf/go/post51620

Re: Specifying a stack size causes crash  
Hey Ryan,

I'm using a windows host, the ldrel_ doesn't look like a windows binary, can you build one for 6.3.2 windows host?

Thanks
Kevin
Re: Specifying a stack size causes crash  
Ryan,

What do I do with the crtn.o file?  Am I supposed to link it against the binary? 

Sorry to ask dumb questions....

Kevin


> Kevin Stallard wrote:

> > I wonder if it is the invocation of ldrel that is causing problems.
> > 
> > I ran qcc with the -vv option.  ldrel is called when I specify a stack size,
>  but it doesn't seem to be called when I don't . 
> 
> Yep, ldrel is what adds the stack note. In 6.3.2 there was an empty 
> placeholder section for the note in crtn.o but newer binutils will 
> discard empty sections. I suspect the problem your having is that ldrel 
> is failing to correctly add a stack size note with the placeholder 
> missing. Making room for a PT_NOTE segment post link without moving 
> things around gets kind of tricky. n 6.4.0 we added a default stack note 
> in the crtn.o files and then the 6.4.0 ldrel will modify the stack note 
> in place if one exists (all new binaries), or if not (older 6.3.2 
> binaries), try to create one create a stack note.
> 
> If you have a 6.4.0 system, grab the crtn.o files from it (or let me 
> know which ones you need) and use the attached 64x ldrel built for 6.3.2 
> and see if that works.
> 
> If it doesn't work, can you post the failing binary?
> 
> Regards,
> 
> Ryan Mansfield


Re: Specifying a stack size causes crash  
Got it figured out, in my over exuberance, I must have overwritten the 6.3.2 ldrel with the 6.4.1.  I reinstalled 6.3.2,
 the 2.18 binutils and 4.2.4 gcc.  All seems to be well now.

Thank you
Kevin