diff options
Diffstat (limited to 'sysdeps/powerpc/powerpc32')
-rw-r--r-- | sysdeps/powerpc/powerpc32/a2/memcpy.S | 23 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/dl-machine.c | 11 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/memset.S | 29 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc32/sysdep.h | 26 |
4 files changed, 53 insertions, 36 deletions
diff --git a/sysdeps/powerpc/powerpc32/a2/memcpy.S b/sysdeps/powerpc/powerpc32/a2/memcpy.S index fe5dab847a..6f4d8a7b34 100644 --- a/sysdeps/powerpc/powerpc32/a2/memcpy.S +++ b/sysdeps/powerpc/powerpc32/a2/memcpy.S @@ -18,6 +18,7 @@ <https://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <rtld-global-offsets.h> #define PREFETCH_AHEAD 4 /* no cache lines SRC prefetching ahead */ #define ZERO_AHEAD 2 /* no cache lines DST zeroing ahead */ @@ -106,25 +107,23 @@ EALIGN (memcpy, 5, 0) L(dst_aligned): -#ifdef SHARED +#ifdef PIC mflr r0 -/* Establishes GOT addressability so we can load __cache_line_size - from static. This value was set from the aux vector during startup. */ +/* Establishes GOT addressability so we can load the cache line size + from rtld_global_ro. This value was set from the aux vector during + startup. */ SETUP_GOT_ACCESS(r9,got_label) - addis r9,r9,__cache_line_size-got_label@ha - lwz r9,__cache_line_size-got_label@l(r9) - mtlr r0 -#else -/* Load __cache_line_size from static. This value was set from the - aux vector during startup. */ - lis r9,__cache_line_size@ha - lwz r9,__cache_line_size@l(r9) + addis r9,r9,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi r9,r9,_GLOBAL_OFFSET_TABLE_-got_label@l + mtlr r0 #endif + __GLRO(r9, r9, _dl_cache_line_size, + RTLD_GLOBAL_RO_DL_CACHE_LINE_SIZE_OFFSET) cmplwi cr5, r9, 0 bne+ cr5,L(cachelineset) -/* __cache_line_size not set: generic byte copy without much optimization */ +/* Cache line size not set: generic byte copy without much optimization */ andi. r0,r5,1 /* If length is odd copy one byte. */ beq L(cachelinenotset_align) lbz r7,0(r4) /* Read one byte from source. */ diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c index d5ea4b97f4..6090e60d3c 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.c +++ b/sysdeps/powerpc/powerpc32/dl-machine.c @@ -25,11 +25,6 @@ #include <dl-machine.h> #include <_itoa.h> -/* The value __cache_line_size is defined in dl-sysdep.c and is initialised - by _dl_sysdep_start via DL_PLATFORM_INIT. */ -extern int __cache_line_size attribute_hidden; - - /* Stuff for the PLT. */ #define PLT_INITIAL_ENTRY_WORDS 18 #define PLT_LONGBRANCH_ENTRY_WORDS 0 @@ -309,14 +304,14 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile) Assumes that dcbst and icbi apply to lines of 16 bytes or more. Current known line sizes are 16, 32, and 128 bytes. - The following gets the __cache_line_size, when available. */ + The following gets the cache line size, when available. */ /* Default minimum 4 words per cache line. */ int line_size_words = 4; - if (lazy && __cache_line_size != 0) + if (lazy && GLRO(dl_cache_line_size) != 0) /* Convert bytes to words. */ - line_size_words = __cache_line_size / 4; + line_size_words = GLRO(dl_cache_line_size) / 4; size_modified = lazy ? rel_offset_words : 6; for (i = 0; i < size_modified; i += line_size_words) diff --git a/sysdeps/powerpc/powerpc32/memset.S b/sysdeps/powerpc/powerpc32/memset.S index 5f614c07d7..26c37f8a17 100644 --- a/sysdeps/powerpc/powerpc32/memset.S +++ b/sysdeps/powerpc/powerpc32/memset.S @@ -17,12 +17,13 @@ <https://www.gnu.org/licenses/>. */ #include <sysdep.h> +#include <rtld-global-offsets.h> /* void * [r3] memset (void *s [r3], int c [r4], size_t n [r5])); Returns 's'. The memset is done in four sizes: byte (8 bits), word (32 bits), - 32-byte blocks (256 bits) and __cache_line_size (128, 256, 1024 bits). + 32-byte blocks (256 bits) and cache line size (128, 256, 1024 bits). There is a special case for setting whole cache lines to 0, which takes advantage of the dcbz instruction. */ @@ -95,7 +96,7 @@ L(caligned): /* Check if we can use the special case for clearing memory using dcbz. This requires that we know the correct cache line size for this - processor. Getting the __cache_line_size may require establishing GOT + processor. Getting the cache line size may require establishing GOT addressability, so branch out of line to set this up. */ beq cr1, L(checklinesize) @@ -230,26 +231,22 @@ L(medium_28t): blr L(checklinesize): -#ifdef SHARED - mflr rTMP /* If the remaining length is less the 32 bytes then don't bother getting the cache line size. */ beq L(medium) -/* Establishes GOT addressability so we can load __cache_line_size - from static. This value was set from the aux vector during startup. */ +#ifdef PIC + mflr rTMP +/* Establishes GOT addressability so we can load the cache line size + from rtld_global_ro. This value was set from the aux vector during + startup. */ SETUP_GOT_ACCESS(rGOT,got_label) - addis rGOT,rGOT,__cache_line_size-got_label@ha - lwz rCLS,__cache_line_size-got_label@l(rGOT) + addis rGOT,rGOT,_GLOBAL_OFFSET_TABLE_-got_label@ha + addi rGOT,rGOT,_GLOBAL_OFFSET_TABLE_-got_label@l mtlr rTMP -#else -/* Load __cache_line_size from static. This value was set from the - aux vector during startup. */ - lis rCLS,__cache_line_size@ha -/* If the remaining length is less the 32 bytes then don't bother getting - the cache line size. */ - beq L(medium) - lwz rCLS,__cache_line_size@l(rCLS) #endif +/* Load rtld_global_ro._dl_cache_line_size. */ + __GLRO(rCLS, rGOT, _dl_cache_line_size, + RTLD_GLOBAL_RO_DL_CACHE_LINE_SIZE_OFFSET) /* If the cache line size was not set then goto to L(nondcbz), which is safe for any cache line size. */ diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h index ceed9ef158..0dee5f2757 100644 --- a/sysdeps/powerpc/powerpc32/sysdep.h +++ b/sysdeps/powerpc/powerpc32/sysdep.h @@ -157,4 +157,30 @@ GOT_LABEL: ; \ /* Label in text section. */ #define C_TEXT(name) name +/* Read the value of member from rtld_global_ro. */ +#ifdef PIC +# ifdef SHARED +# if IS_IN (rtld) +/* Inside ld.so we use the local alias to avoid runtime GOT + relocations. */ +# define __GLRO(rOUT, rGOT, member, offset) \ + lwz rOUT,_rtld_local_ro@got(rGOT); \ + lwz rOUT,offset(rOUT) +# else +# define __GLRO(rOUT, rGOT, member, offset) \ + lwz rOUT,_rtld_global_ro@got(rGOT); \ + lwz rOUT,offset(rOUT) +# endif +# else +# define __GLRO(rOUT, rGOT, member, offset) \ + lwz rOUT,member@got(rGOT); \ + lwz rOUT,0(rOUT) +# endif +#else +/* Position-dependent code does not require access to the GOT. */ +# define __GLRO(rOUT, rGOT, member, offset) \ + lis rOUT,(member+LOWORD)@ha \ + lwz rOUT,(member+LOWORD)@l(rOUT) +#endif /* PIC */ + #endif /* __ASSEMBLER__ */ |