[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: [microblaze-uclinux] Compiler/linker problem (?)



Hello Rod,

We had a problem with stings not being handled correctly. It was similar in that the binary ran fine but some strings printed garbage or the wrong string. We did not go into detail but by trial and error we found that compiling with -fwritable-strings helped.

Hope to be of some help!

Lars Peterson

--- Den ons 2008-06-25 skrev Rod Campbell <rod@xxxxxxxxxxxxxxxxxx>:

> Från: Rod Campbell <rod@xxxxxxxxxxxxxxxxxx>
> Ämne: [microblaze-uclinux] Compiler/linker problem (?)
> Till: "mblaze-uClinux list" <microblaze-uclinux@xxxxxxxxxxxxxx>
> Datum: onsdag 25 juni 2008 23.10
> Hi,
> 
> I've been using uClinux 2.4 on microblaze successfully
> for a few years.  
> Just recently I ran into a problem that I wonder if anyone
> else has 
> seen  (and if anyone has any insights).
> 
> My uClinux program runs fine except for one problem.  The
> symptom is 
> that a pointer to a string (stored in an array of string
> pointers) is 
> corrupted.  Naturally I thought that I was just doing
> something goofy 
> somewhere in my code.  After checking it out, I found to my
> surprise 
> that the corruption exists in the bflt executable itself. 
> 
> The module code basically looks like this:
> 
> // many string arrays
> 
> char *strVals[14] =
>   {"1+1 ", "1/0 ", "2/0 ",
> "3/0 ",
>    "3/0L", "2/1 ", "2/1L",
> "3/1 ",
>    "3/1L", "2/2 ", "2/2L",
> "3/2 ",
>    "3/2L", "Pass"};
>  
> // more string arrays and other variables
> 
> const unsigned char PcmBypass = 8; 
> 
> // start of functions
> 
> When I look at dump of the bflt exe, I see that in the
> array of pointers 
> that is created for strVals[], the 5th pointer points to
> the storage 
> area for PcmBypass instead of where "3/0L" is
> stored.   I looked at the 
> executable file while it was still in flash (not after
> being loaded into 
> RAM for execution).
> 
> If I change the definition of PcmBypass to "unsigned
> char PcmBypass = 8; 
> ", meaning I just remove the "const", it
> compiles and runs fine.
> 
> If I use mb-objdump to explore the elf file created by
> mb-gcc, I don't 
> see any problems - I see the array of strVals[] pointers
> and they look 
> correct.
> 
> I compiled and ran an earlier version of the program and
> saw the same 
> type of problem; the only difference was that the PcmBypass
> pointer 
> clobbered a pointer in a different array.
> 
> I reference the variable PcmBypass in code only once, and
> that is in the 
> same file that it is defined in.  There are no "extern
> unsigned char 
> PcmBypass" statements.
> 
> The exe I create is made up of several files and the exe
> itself is large 
> but by no means the largest I've built - about 180K
> bytes.  I am using 
> the stock microblaze-elf-tools-20060213 tools supplied with
> 2.4.32-uc0  
> uClinux.
> 
> Any insights would be appreciated.
> 
> Rod Campbell     
> 
> 
> 
>  
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@xxxxxxxxxxxxxx
> Project Home Page :
> http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive :
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/


      ___________________________________________________
Sök efter kärleken!
Hitta din tvillingsjäl på Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/