This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: SH4 instruction cache invalidation


Joern Rennecke <joern.rennecke@superh.com> wrote:
> A lot of programs don't use nested-function trampolines, but we want
> the linking to work automatically for those that do use them.
> Thus, specifing the right icache invalidation object with --defsym or
> a special object on the link line would be inappropriate, since that
> would always pull the icache invalidation code in.  Using --wrap would
> be a possibility, but a rather ugly one, as each --wrap option makes
> only a binary choice (how to implement a multi-way choice with multiple
> --wrap options and a number of symbol forwarding objects in a library
> is left as an exercise to the reader ;-).
> Thus, I use multiple libraries, each of which contain one implementation
> of the ic_invalidate function.
> I've set the default for 8 KB * 2 ways cache, since that works both
> for the SH4-100 and the SH4-200 that have been made so far.
> ICACHE_LINK_SPEC can be overridden in subtarget header files to
> set a different default.
> 
> 2004-03-09  J"orn Rennecke <joern.rennecke@superh.com>
> 
> 	* config/sh/icache.asm, config/sh/lib1funcs.h:
> 	New files, broken out of:
> 	(config/sh/lib1funcs.asm).
> 	* config/sh/icache.asm (ic_invalidate): Support different cache
> 	sizes and associativities.
> 	* config/sh/icache-icbi.asm: New file.
> 	* sh.h (EXTRA_SPECS): Add icache_link_spec.
> 	(ICACHE_LINK_SPEC): Define.
> 	(LINK_SPEC): Use icache_link_spec.
> 	* t-sh: ($(T)icache08x1.a): Add new rule.
> 	($(T)icache02x2.a, $(T)icache04x2.a, $(T)icache08x2.a): Likewise.
> 	($(T)icache16x2.a, $(T)icache32x2.a, $(T)icache-icbi.a): Likewise.
> 	(EXTRA_MULTILIB_PARTS): Set to icache08x1.a.
> 	* t-elf: (EXTRA_MULTILIB_PARTS): Add icache*.a parts.

I've tested your patch for mainline on sh-linux target.  It seems
-licache* makes my linux ld try to find libicache*.a and sometimes
-licache* appears too early in the command line of linker.  I've
renamed icache*.a to libicache*.a and changed LINK_GCC_C_SEQUENCE_SPEC
like the patch below

diff -u3prN ORIG/gcc/gcc/config/sh/linux.h LOCAL/gcc/gcc/config/sh/linux.h
--- ORIG/gcc/gcc/config/sh/linux.h	Mon Jan 12 11:05:58 2004
+++ LOCAL/gcc/gcc/config/sh/linux.h	Wed Mar 10 10:16:18 2004
@@ -110,7 +110,8 @@ do { \
   "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
 
 #define LINK_GCC_C_SEQUENCE_SPEC \
-  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
+  "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G} \
+   %{!licache*:%(icache_link_spec)}"
 
 /* Output assembler code to STREAM to call the profiler.  */
 
and added libicache*.a stuff to EXTRA_MULTILIB_PARTS in t-linux
for the linux case.
I've also changed SH_LINK_SPEC in sh.h slightly to suppress -licache*
when -nodefaultlibs/-nostdlib assigned:

#define SH_LINK_SPEC "\
-m %(link_emul_prefix)\
%{m5-compact*|m5-32media*:32}\
%{m5-64media*:64}\
%{!m1:%{!m2:%{!m3*:%{!m4*:%{!m5*:%(link_default_cpu_emul)}}}}}\
%(subtarget_link_emul_suffix) \
%{mrelax:-relax} %(subtarget_link_spec)\
%{!nodefaultlibs:%{!nostdlib:%{!licache*:%(icache_link_spec)}}}"

Under these changes, I can build mainline for sh4-unknown-linux-gnu
target with your patch.  There are no regressions and all tests for
the nested functions work fine on 7750.  I'll test it with 7751R.

How about defining LINK_GCC_C_SEQUENCE_SPEC with

#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G %(icache_link_spec)"

even for sh-elf and resetting the change against SH_LINK_SPEC?

Regards,
	kaz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]