problem with -funit-at-a-time

Aparna Jain (apjain) apjain@cisco.com
Thu Mar 6 10:27:00 GMT 2008


 

Hi ,
 
I am compiling bootcode (bootrom.bin) on vxoworks 5.4 - gcc version
3.4.5.
 
The code generated by 3.4.5 is no more assumes the first function of a C
file  as the starting Address of the compiled code. I think this is
because of -funit-at-a-time which is enabled by default by O2 option.
 
But the vxWorks compilation  puts un-compressed version of bootrom.bin
into Rom Address and puts compressed image into Ram address.
When jumping from rom to ram, we jump based on Absolute address.
 
So the earlier code
 
..........
absEntry = (FUNCPTR) (RAM_DST_ADDRESS)
absEntry(..)
 
where as RAM_DST_ADDRESS should have the function "compressedEntry"
associated with it. And this function used to be the first function in
the file bootConfig.c
 
Due to -funit-at-a-time, compressedEntry is no more the first function
of bootConfig.o
 
So the loader command "...-e compressedEntry -Ttext (RAM_DST_ADDRESS)
places bootConfig.o in RAM_DST_ADDRESS, but the first function is placed
after some offset.
 
I used -fno-unit-at-a-time , and it was fine. But just concerned about
the throughput of the code generated. Is there any other way to deal
with this problem ?
 
thanks in advance
Aparna



More information about the Gcc-help mailing list