To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1241
1240  |  1242
Subject: 
Re: Possible bug with bss allocation
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 22 Jul 2000 06:10:26 GMT
Viewed: 
1549 times
  
I was having some random hangs with a legOS program.  If I added a
little code or subtracted a little, everything started working again.
I've isolated it to a problem whereby writing a zero to the last byte of
bss data will hang the RCX.  This only happens when the length of the
.text segment (and presumably .data and .bss segments) are just right.
In my testing, I always had a multiple of 16 bytes of .bss data and no
.data segment.  If the .text segment's length mod 16 was equal to 4,
then I got the hang.  I'm guessing that some important housekeeping
structure is overlapped with the end of the .bss segment and if the
alignment is just write, then zeroing out that last byte of .bss data
has dire consequences.  This seemed to happen regardless to the
magnitued of the .bss and .text sizes.  The example below is pretty
minimal, but I also saw it happening with a 4K text segment and 1K of
bss.  Here's a test program:

The common section is aligned to 16 bytes by ld. This is unknown to
the tools generating the final .lx files.

The fix is to force the alignment of the .bss section to 2, with this
ld will generate files that work with the current tools. I changed
genlds.c in CVS at sourceforge.net to output the correct linker script
for this.

If you are using this, please make shure genlds gets rebuild, issue a
make realclean in your legOS directory.


Eddie C. Dost
ecd@skynet.be



Message has 1 Reply:
  Re: Possible bug with bss allocation
 
(...) Thanks for the fix, it works great. Dave Baum (24 years ago, 22-Jul-00, to lugnet.robotics.rcx.legos)

Message is in Reply To:
  Possible bug with bss allocation
 
I was having some random hangs with a legOS program. If I added a little code or subtracted a little, everything started working again. I've isolated it to a problem whereby writing a zero to the last byte of bss data will hang the RCX. This only (...) (24 years ago, 22-Jul-00, to lugnet.robotics.rcx.legos)

8 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR