From 831486a2d3ba8eb2a012bc59083f383811fff5a3 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Mon, 16 Apr 2007 06:17:14 +0000 Subject: [PATCH] Turn the assembly optimized memcpy (simple rep movsd) back on for x86. Had to hack around the make system a bit, and the result is pretty nasty, specifically due to the amount of places in the system where various targets poke their fingers into the libroot directory. The solution is less than optimal, but should work for now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20722 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/Jamfile | 1 + src/system/kernel/Jamfile | 1 + src/system/kernel/lib/Jamfile | 4 +++- src/system/libroot/Jamfile | 1 + src/system/libroot/posix/string/Jamfile | 7 ++++++ .../posix/string/arch/ppc/arch_string.S | 0 .../libroot/posix/string/arch/ppc/libc.mk | 24 ------------------- .../posix/string/arch/sh4/arch_string.S | 0 .../libroot/posix/string/arch/sh4/libc.mk | 24 ------------------- .../arch/x86/{memcpy.S => arch_string.S} | 1 - src/system/libroot/posix/string/memcpy.c | 5 ++-- src/system/runtime_loader/Jamfile | 1 + 12 files changed, 17 insertions(+), 52 deletions(-) create mode 100644 src/system/libroot/posix/string/arch/ppc/arch_string.S delete mode 100644 src/system/libroot/posix/string/arch/ppc/libc.mk create mode 100644 src/system/libroot/posix/string/arch/sh4/arch_string.S delete mode 100644 src/system/libroot/posix/string/arch/sh4/libc.mk rename src/system/libroot/posix/string/arch/x86/{memcpy.S => arch_string.S} (94%) diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile index 4ed347f77d..0ef52afacf 100644 --- a/src/system/boot/Jamfile +++ b/src/system/boot/Jamfile @@ -22,6 +22,7 @@ local librootFunctions = strchr.o strrchr.o strtol.o + arch_string.o ; local platformObjects = ; diff --git a/src/system/kernel/Jamfile b/src/system/kernel/Jamfile index 729fb39d0a..b778072af2 100644 --- a/src/system/kernel/Jamfile +++ b/src/system/kernel/Jamfile @@ -101,6 +101,7 @@ KernelLd kernel.so : kernel_os_main.o kernel_os_arch_$(TARGET_ARCH).o kernel_posix.o + kernel_posix_arch_$(TARGET_ARCH).o $(HAIKU_STATIC_LIBSUPC++) diff --git a/src/system/kernel/lib/Jamfile b/src/system/kernel/lib/Jamfile index fa3bea133d..707a398a38 100644 --- a/src/system/kernel/lib/Jamfile +++ b/src/system/kernel/lib/Jamfile @@ -104,7 +104,7 @@ KernelMergeObject kernel_posix.o : strspn.c strstr.c strtok.c - + : $(TARGET_KERNEL_PIC_CCFLAGS) ; @@ -120,12 +120,14 @@ KernelMergeObject kernel_os_arch_$(TARGET_ARCH).o : ; SEARCH_SOURCE += [ FDirName $(posixSources) arch $(TARGET_ARCH) ] ; +SEARCH_SOURCE += [ FDirName $(posixSources) string arch $(TARGET_ARCH) ] ; KernelMergeObject kernel_posix_arch_$(TARGET_ARCH).o : setjmp.S siglongjmp.S sigsetjmp.S kernel_setjmp_save_sigs.c + arch_string.S : $(TARGET_KERNEL_PIC_CCFLAGS) ; diff --git a/src/system/libroot/Jamfile b/src/system/libroot/Jamfile index fd6d94295b..06e736c039 100644 --- a/src/system/libroot/Jamfile +++ b/src/system/libroot/Jamfile @@ -32,6 +32,7 @@ local librootObjects = posix_gnu_wctype.o posix_stdlib.o posix_string.o + posix_string_arch_$(TARGET_ARCH).o posix_sys.o posix_time.o posix_unistd.o diff --git a/src/system/libroot/posix/string/Jamfile b/src/system/libroot/posix/string/Jamfile index 404b7cbac8..8a0912fbb4 100644 --- a/src/system/libroot/posix/string/Jamfile +++ b/src/system/libroot/posix/string/Jamfile @@ -36,3 +36,10 @@ MergeObject posix_string.o : strtok.c strxfrm.c ; + +SubDir HAIKU_TOP src system libroot posix string arch $(TARGET_ARCH) ; + +MergeObject posix_string_arch_$(TARGET_ARCH).o : + arch_string.S +; + diff --git a/src/system/libroot/posix/string/arch/ppc/arch_string.S b/src/system/libroot/posix/string/arch/ppc/arch_string.S new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/system/libroot/posix/string/arch/ppc/libc.mk b/src/system/libroot/posix/string/arch/ppc/libc.mk deleted file mode 100644 index 5925d910cd..0000000000 --- a/src/system/libroot/posix/string/arch/ppc/libc.mk +++ /dev/null @@ -1,24 +0,0 @@ -LIBC_ARCH_DIR = $(LIBC_DIR)/arch/$(ARCH) -LIBC_ARCH_OBJ_DIR = $(LIBC_ARCH_DIR)/$(OBJ_DIR) - -LIBC_OBJS += - -# build prototypes -$(LIBC_ARCH_OBJ_DIR)/%.o: $(LIBC_ARCH_DIR)/%.c - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - $(CC) -c $< $(GLOBAL_CFLAGS) -Iinclude -o $@ - -$(LIBC_ARCH_OBJ_DIR)/%.d: $(LIBC_ARCH_DIR)/%.c - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - @echo "making deps for $<..." - @($(ECHO) -n $(dir $@); $(CC) $(GLOBAL_CFLAGS) -Iinclude -M -MG $<) > $@ - -$(LIBC_ARCH_OBJ_DIR)/%.d: $(LIBC_ARCH_DIR)/%.S - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - @echo "making deps for $<..." - @($(ECHO) -n $(dir $@);$(CC) $(GLOBAL_CFLAGS) -Iinclude -M -MG $<) > $@ - -$(LIBC_ARCH_OBJ_DIR)/%.o: $(LIBC_ARCH_DIR)/%.S - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - $(CC) -c $< $(GLOBAL_CFLAGS) -Iinclude -o $@ - diff --git a/src/system/libroot/posix/string/arch/sh4/arch_string.S b/src/system/libroot/posix/string/arch/sh4/arch_string.S new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/system/libroot/posix/string/arch/sh4/libc.mk b/src/system/libroot/posix/string/arch/sh4/libc.mk deleted file mode 100644 index 5925d910cd..0000000000 --- a/src/system/libroot/posix/string/arch/sh4/libc.mk +++ /dev/null @@ -1,24 +0,0 @@ -LIBC_ARCH_DIR = $(LIBC_DIR)/arch/$(ARCH) -LIBC_ARCH_OBJ_DIR = $(LIBC_ARCH_DIR)/$(OBJ_DIR) - -LIBC_OBJS += - -# build prototypes -$(LIBC_ARCH_OBJ_DIR)/%.o: $(LIBC_ARCH_DIR)/%.c - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - $(CC) -c $< $(GLOBAL_CFLAGS) -Iinclude -o $@ - -$(LIBC_ARCH_OBJ_DIR)/%.d: $(LIBC_ARCH_DIR)/%.c - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - @echo "making deps for $<..." - @($(ECHO) -n $(dir $@); $(CC) $(GLOBAL_CFLAGS) -Iinclude -M -MG $<) > $@ - -$(LIBC_ARCH_OBJ_DIR)/%.d: $(LIBC_ARCH_DIR)/%.S - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - @echo "making deps for $<..." - @($(ECHO) -n $(dir $@);$(CC) $(GLOBAL_CFLAGS) -Iinclude -M -MG $<) > $@ - -$(LIBC_ARCH_OBJ_DIR)/%.o: $(LIBC_ARCH_DIR)/%.S - @if [ ! -d $(LIBC_ARCH_OBJ_DIR) ]; then mkdir -p $(LIBC_ARCH_OBJ_DIR); fi - $(CC) -c $< $(GLOBAL_CFLAGS) -Iinclude -o $@ - diff --git a/src/system/libroot/posix/string/arch/x86/memcpy.S b/src/system/libroot/posix/string/arch/x86/arch_string.S similarity index 94% rename from src/system/libroot/posix/string/arch/x86/memcpy.S rename to src/system/libroot/posix/string/arch/x86/arch_string.S index 0bd67b39d0..c5bf8afec4 100644 --- a/src/system/libroot/posix/string/arch/x86/memcpy.S +++ b/src/system/libroot/posix/string/arch/x86/arch_string.S @@ -2,7 +2,6 @@ ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ -#include .globl memcpy diff --git a/src/system/libroot/posix/string/memcpy.c b/src/system/libroot/posix/string/memcpy.c index 501507acec..b197960154 100644 --- a/src/system/libroot/posix/string/memcpy.c +++ b/src/system/libroot/posix/string/memcpy.c @@ -6,8 +6,8 @@ #include #include - -#if !_ASM_MEMCPY +/* do not build for for arches that have overridden this with an assembly version */ +#if !defined(ARCH_x86) typedef int word; @@ -46,3 +46,4 @@ void *memcpy(void *dest, const void *src, size_t count) } #endif + diff --git a/src/system/runtime_loader/Jamfile b/src/system/runtime_loader/Jamfile index 6a1d97e35d..01ebc51cb5 100644 --- a/src/system/runtime_loader/Jamfile +++ b/src/system/runtime_loader/Jamfile @@ -46,6 +46,7 @@ StaticLibrary libruntime_loader.a : strrchr.o strspn.o strstr.o + arch_string.o [ FGristFiles kernel_vsprintf.o ] ;