From acd262e611f704a7ae47101bec76c22d89a2401a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 7 Feb 2004 06:37:42 +0000 Subject: Update. 2004-02-06 Steven Munroe * sysdeps/powerpc/powerpc32/dl-machine.c: Declare __cache_line_size as weak extern. (__elf_machine_runtime_setup): Invalidate the instruction cache over the whole range of the PLT. --- sysdeps/powerpc/powerpc32/dl-machine.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'sysdeps/powerpc') diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c index cf22fc707c..642cad48a2 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.c +++ b/sysdeps/powerpc/powerpc32/dl-machine.c @@ -1,5 +1,5 @@ /* Machine-dependent ELF dynamic relocation functions. PowerPC version. - Copyright (C) 1995-2001,2002,2003 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,6 +26,11 @@ #include #include +/* The value __cache_line_size is defined in memset.S and is initialised + by _dl_sysdep_start via DL_PLATFORM_INIT. */ +extern int __cache_line_size; +weak_extern (__cache_line_size) + /* Because ld.so is now versioned, these functions can be in their own file; no relocations need to be done to call them. Of course, if ld.so is not versioned... */ @@ -304,14 +309,30 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) there may be a little overlap at the start and the end. Assumes that dcbst and icbi apply to lines of 16 bytes or - more. Current known line sizes are 16, 32, and 128 bytes. */ + more. Current known line sizes are 16, 32, and 128 bytes. + The following gets the __cache_line_size, when available. */ + + /* Default minimum 4 words per cache line. */ + int line_size_words = 4; + + /* Don't try this until ld.so has relocated itself! */ + int *line_size_ptr = &__cache_line_size; + if (lazy && line_size_ptr != NULL) + { + /* Verify that __cache_line_size is defined and set. */ + if (*line_size_ptr != 0) + /* Convert bytes to words. */ + line_size_words = *line_size_ptr / 4; + } size_modified = lazy ? rel_offset_words : 6; - for (i = 0; i < size_modified; i += 4) - PPC_DCBST (plt + i); + for (i = 0; i < size_modified; i += line_size_words) + PPC_DCBST (plt + i); PPC_DCBST (plt + size_modified - 1); PPC_SYNC; - PPC_ICBI (plt); + + for (i = 0; i < size_modified; i += line_size_words) + PPC_ICBI (plt + i); PPC_ICBI (plt + size_modified - 1); PPC_ISYNC; } -- cgit v1.2.3