Skip to content

Commit

Permalink
Add function type and sizes.
Browse files Browse the repository at this point in the history
For GitHub issue #11 Valgrind cannot redirect libarmmem symbols
  • Loading branch information
paulfloyd authored and bavison committed Mar 18, 2024
1 parent b48ea15 commit ee8ac1d
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ all: libarmmem-v6l.so libarmmem-v6l.a libarmmem-v7l.so libarmmem-v7l.a test test
$(CROSS_COMPILE)gcc -c -o $@ $^

libarmmem-v6l.so: $(OBJS-V6L)
$(CROSS_COMPILE)gcc -shared -o $@ $^
$(CROSS_COMPILE)gcc -shared -o $@ -Wl,-soname,$@ $^

libarmmem-v6l.a: $(OBJS-V6L)
$(CROSS_COMPILE)ar rcs $@ $^

libarmmem-v7l.so: $(OBJS-V7L)
$(CROSS_COMPILE)gcc -shared -o $@ $^
$(CROSS_COMPILE)gcc -shared -o $@ -Wl,-soname,$@ $^

libarmmem-v7l.a: $(OBJS-V7L)
$(CROSS_COMPILE)ar rcs $@ $^
Expand Down
1 change: 1 addition & 0 deletions arm-mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.macro myfunc fname
.func fname
.global fname
.type fname STT_FUNC
fname:
.endm

Expand Down
1 change: 1 addition & 0 deletions memcmp-v6l.S
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ myfunc memcmp
movhi a1, #1
movlo a1, #-1
pop {DAT1-DAT6, pc}
.size memcmp,.-memcmp

.unreq S_1
.unreq S_2
Expand Down
1 change: 1 addition & 0 deletions memcmp-v7l.S
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,4 @@ myfunc memcmp
43: vpop {q4}
mov RES, #0
pop {v1-v3,pc}
.size memcmp,.-memcmp
5 changes: 5 additions & 0 deletions memcpymove-v6l.S
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

myfunc memcpy
1000: memcpy 0
.size memcpy,.-memcpy
.endfunc

/*
Expand All @@ -551,6 +552,7 @@ myfunc memmove
cmp a2, a1
bpl 1000b /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */
memcpy 1
.size memmove,.-memmove
.endfunc

/*
Expand All @@ -565,9 +567,12 @@ myfunc memmove

myfunc mempcpy
.global __mempcpy
.type __mempcpy STT_FUNC
__mempcpy:
push {v1, lr}
mov v1, a3
bl 1000b
add a1, a1, v1
pop {v1, pc}
.size mempcpy,.-mempcpy
.size __mempcpy,.-__mempcpy
5 changes: 5 additions & 0 deletions memcpymove-v7l.S
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

myfunc memcpy
1000: memcpy 0
.size memcpy,.-memcpy
.endfunc

/*
Expand All @@ -632,6 +633,7 @@ myfunc memmove
cmp a2, a1
bpl 1000b /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */
memcpy 1
.size memmove,.-memmove
.endfunc

/*
Expand All @@ -646,9 +648,12 @@ myfunc memmove

myfunc mempcpy
.global __mempcpy
.type __mempcpy STT_FUNC
__mempcpy:
push {v1, lr}
mov v1, a3
bl 1000b
add a1, a1, v1
pop {v1, pc}
.size mempcpy,.-mempcpy
.size __mempcpy,.-__mempcpy
1 change: 1 addition & 0 deletions memset-v6l.S
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ myfunc memset
174: tst N, #16
stmneia S!, {DAT0, DAT1, DAT2, DAT3}
b 166b
.size memset,.-memset

.unreq S
.unreq DAT0
Expand Down
1 change: 1 addition & 0 deletions memset-v7l.S
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ myfunc memset
vst1.8 {q0-q1}, [SI]!
sub N, N, #32
b 166b
.size memset,.-memset

.unreq SJ
.unreq N
Expand Down
1 change: 1 addition & 0 deletions strlen-v7l.S
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,4 @@ myfunc strlen
sub a1, #4
add a1, TMP3, lsr #3
pop {v1,pc}
.size strlen,.-strlen

0 comments on commit ee8ac1d

Please sign in to comment.