Giter Club home page Giter Club logo

arm-mem's Introduction

arm-mem

ARM-accelerated versions of selected functions from string.h

To build the library, use $ make or, if cross-compiling, use $ CROSS_COMPILE=arm-linux-gnueabihf- make

Also included is a simple test harness, inspired by the benchmarker from the pixman library. This can be built via the "test" make target.

arm-mem's People

Contributors

bavison avatar paulfloyd avatar rsaxvc avatar rverton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arm-mem's Issues

Compatibility with Raspbian Buster?

Hi there,

I just tested to run my RPi (2 Model B) on Raspbian Buster. The current archive.raspberrypi.org does not yet contain a Buster repo, just Stretch, however it works fine, besides the package for this git repo: raspi-copies-and-fills. I needed to purge it, to allow Raspbian Buster upgrade.

The question is, if this is an issue from source, or if I could compile it also for Raspbian Buster. Maybe there is already a Buster ready compiled package available somewhere 😃?

Ref: https://raspberrypi.stackexchange.com/questions/72594/failed-to-start-udev-kernel-device-manager?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Thanks for your nice work!
MichaIng

memset() fails for negative byte value

memset() does not honour the "converted to an unsigned char" required by 7.21.6.1 of ISO/IEC 9899:1999(E)

signed char smallint = -3;
signed char smallarray[10];

memset(smallarray, smallint, 10);

results in smallarray[0] ←→ -3
smallarray[1] ←→ -1
smallarray[2] ←→ -1
smallarray[3] ←→ -1
smallarray[4] ←→ -3
...
code widens the smallint of -3 to int with sign extension - correctly. memset() fails to AND this with 0xff before shifting and ORing.

Submit as patch for glibc?

Hi

Did you consider submitting these improvements to the glibc developers to get it into the default build everywhere?

valgrind trouble / deprecated SETEND instructions

Valgrind crashes during memcmp() due to the presence (really lack of implementation in Valgrind) of SETEND. ARM has deprecated these instructions, though they're still available in A32 and T32.

This pull request: #5 Removes the SETEND instructions and replaces them with REV instructions, which I expect to be a few cycles slower, but work with valgrind.

Build failure.

dec5ddf seems to be completely messed up.

gcc version 4.9.3 20150311 (prerelease) (crosstool-NG crosstool-ng-1.21.0-33-g334c22a) edit: linaro
glibc-2.21
binutils-2.25

make[1]: Entering directory '/home/asavah/piko7/src/arm-mem'
arm-rpi2-linux-gnueabihf-gcc -c -o architecture.o architecture.S
arm-rpi2-linux-gnueabihf-gcc -c -o memcmp.o memcmp.S
arm-rpi2-linux-gnueabihf-gcc -c -o memcpymove.o memcpymove.S
arm-rpi2-linux-gnueabihf-gcc -c -o memcpymove-a7.o memcpymove-a7.S
arm-rpi2-linux-gnueabihf-gcc -c -o memset.o memset.S
arm-rpi2-linux-gnueabihf-gcc  -pipe --sysroot=/home/asavah/piko7/build/rpi2/rootfs -Wl,--sysroot=/home/asavah/piko7/build/rpi2/rootfs -std=gnu99 -O2 -c -o trampoline.o trampoline.c
In file included from /home/asavah/piko7/build/rpi2/rootfs/usr/include/string.h:634:0,
                 from trampoline.c:29:
trampoline.c:57:18: error: redefinition of ‘__builtin_mempcpy’
 DISPATCH(void *, mempcpy,  (void *__restrict __dest, __const void *__restrict __src, size_t __n), (__dest, __src, __n))
                  ^
trampoline.c:57:1: note: in expansion of macro ‘DISPATCH’
 DISPATCH(void *, mempcpy,  (void *__restrict __dest, __const void *__restrict __src, size_t __n), (__dest, __src, __n))
 ^
trampoline.c:56:17: note: previous definition of ‘__builtin_mempcpy’ was here
 DISPATCH(void *,__mempcpy, (void *__restrict __dest, __const void *__restrict __src, size_t __n), (__dest, __src, __n))
                 ^
trampoline.c:56:1: note: in expansion of macro ‘DISPATCH’
 DISPATCH(void *,__mempcpy, (void *__restrict __dest, __const void *__restrict __src, size_t __n), (__dest, __src, __n))
 ^
Makefile:7: recipe for target 'trampoline.o' failed
make[1]: *** [trampoline.o] Error 1
make[1]: Leaving directory '/home/asavah/piko7/src/arm-mem'
Makefile:55: recipe for target 'build' failed
make: *** [build] Error 2

As suggested in comments of ~/usr/include/string.h I tried defining __NO_STRING_INLINES in CFLAGS, it helped, somewhat:

make[1]: Entering directory '/home/asavah/piko7/src/arm-mem'
arm-rpi2-linux-gnueabihf-gcc -c -o architecture.o architecture.S
arm-rpi2-linux-gnueabihf-gcc -c -o memcmp.o memcmp.S
arm-rpi2-linux-gnueabihf-gcc -c -o memcpymove.o memcpymove.S
arm-rpi2-linux-gnueabihf-gcc -c -o memcpymove-a7.o memcpymove-a7.S
arm-rpi2-linux-gnueabihf-gcc -c -o memset.o memset.S
arm-rpi2-linux-gnueabihf-gcc  -pipe --sysroot=/home/asavah/piko7/build/rpi2/rootfs -Wl,--sysroot=/home/asavah/piko7/build/rpi2/rootfs -D__NO_STRING_INLINES -std=gnu99 -O2 -c -o trampoline.o trampoline.c
arm-rpi2-linux-gnueabihf-gcc -shared -o libarmmem.so architecture.o memcmp.o memcpymove.o memcpymove-a7.o memset.o trampoline.o
/home/asavah/piko7/toolchain-rpi2/arm-rpi2-linux-gnueabihf/lib/gcc/arm-rpi2-linux-gnueabihf/4.9.3/../../../../arm-rpi2-linux-gnueabihf/bin/ld.bfd: trampoline.o: relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
trampoline.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:13: recipe for target 'libarmmem.so' failed
make[1]: *** [libarmmem.so] Error 1
make[1]: Leaving directory '/home/asavah/piko7/src/arm-mem'
Makefile:55: recipe for target 'build' failed
make: *** [build] Error 2

So we are back to #3 with relocation issues.

memcpy slower than libc on Allwinner A20

Benchmarked using CacheBench from LLCbench.

Steps to reproduce:

  • Download and extract llcbench
  • Compile llcbench's cachebench:
cd </path/to/extracted/llcbench/directory>
make linux-lam
make cache-bench
  • Run cachebench's memcpy benchmarks:
./cachebench/cachebench -p
  • Compare results with and without libarmmem.so

Unified a7 object causes crash on Pi1 when preloading library

Hi,

After e6c03fd and adding this to /etc/ld.so.preload I get a segmentation fault at boot on Pi1 with Raspbian. Have not had this issue with earlier versions of your library. My init instantly segfaults, and as pid1 dies, kernel oops! Removing the preload line brought me back up.

Here is output of readelf -A on the shared object generated under Raspbian Jessie using GCC 4.9.1 as the compiler:

File Attributes
Tag_CPU_name: "6"
Tag_CPU_arch: v6
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_FP_arch: VFPv3
Tag_Advanced_SIMD_arch: NEONv1
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_enum_size: int
Tag_ABI_HardFP_use: SP and DP
Tag_ABI_VFP_args: VFP registers
Tag_CPU_unaligned_access: v6

For now I am tempted to use your earlier build which had a separate lib for a7 as we package this library twice anyway (once for rbp1 and once for rbp2), but it's good to report this kind of thing.

gdb is not helpful, because I am not sure set env LD_PRELOAD was working properly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.