public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with -funit-at-a-time
@ 2008-03-06 10:27 Aparna Jain (apjain)
  2008-03-08  2:10 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Aparna Jain (apjain) @ 2008-03-06 10:27 UTC (permalink / raw)
  To: gcc-help

 

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: problem with -funit-at-a-time
  2008-03-06 10:27 problem with -funit-at-a-time Aparna Jain (apjain)
@ 2008-03-08  2:10 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2008-03-08  2:10 UTC (permalink / raw)
  To: Aparna Jain (apjain); +Cc: gcc-help

"Aparna Jain (apjain)" <apjain@cisco.com> writes:

> 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.

...

> 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 ?

If you need the output to be in the same order as the input, then in
gcc 3.4.5 -fno-unit-at-a-time is the right approach.  In gcc 4.2 and
later, you can instead use -fno-toplevel-reorder, which retains the
ordering while also giving you the performance benefits of
-funit-at-a-time.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-08  2:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-06 10:27 problem with -funit-at-a-time Aparna Jain (apjain)
2008-03-08  2:10 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).