summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt5
-rw-r--r--Makefile42
-rw-r--r--rgo/Makefile38
-rw-r--r--rgo/include/rgo.h8
-rw-r--r--rgo/src/memeq.S20
5 files changed, 56 insertions, 57 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 7c7e495..018f183 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,8 @@
+| 4
+
+- Add install target to makefile;
+- Merge makefiles;
+
| 3
- Enable compiler optimisations;
diff --git a/Makefile b/Makefile
index 549b771..23f7bdf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,42 @@
-.PHONY: clean purge rgo
+SRCS = \
+ rgo/src/fndbyte.S \
+ rgo/src/fndchr.S \
+ rgo/src/memcpy.S \
+ rgo/src/memdup.c \
+ rgo/src/memeq.S \
+ rgo/src/memfill.S \
+ rgo/src/strdup.c \
+ rgo/src/streq.S \
+ rgo/src/strfill.c \
+ rgo/src/strcpy.S \
+ rgo/src/strlen.S
-rgo:
- make -C rgo
+OBJS := $(SRCS:.S=.o)
+OBJS := $(OBJS:.c=.o)
+LIB := librgo.a
+
+ASFLAGS = \
+ -Iinclude \
+ -g \
+ -march=native
+
+CFLAGS = \
+ -Iinclude \
+ -O3 \
+ -g \
+ -march=native
+
+.PHONY: clean install purge
+
+$(LIB): $(OBJS)
+ ar r $@ $^
+
+install: $(LIB)
+ install -Dm644 rgo/include/rgo.h $(HDRDIR)/rgo.h
+ install -Dm755 $(LIB) $(LIBDIR)/$(LIB)
clean:
- make -C rgo $@
+ rm -fr $(OBJS)
purge:
- make -C rgo $@
+ rm -fr $(LIB) $(OBJS)
diff --git a/rgo/Makefile b/rgo/Makefile
deleted file mode 100644
index 4118fe4..0000000
--- a/rgo/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-SRCS = \
- src/fndbyte.S \
- src/fndchr.S \
- src/memcpy.S \
- src/memdup.c \
- src/memeq.S \
- src/memfill.S \
- src/strdup.c \
- src/streq.S \
- src/strfill.c \
- src/strcpy.S \
- src/strlen.S
-
-OBJS := $(SRCS:.S=.o)
-OBJS := $(OBJS:.c=.o)
-LIB := librgo.a
-
-ASFLAGS = \
- -Iinclude \
- -g \
- -march=native
-
-CFLAGS = \
- -Iinclude \
- -O3 \
- -g \
- -march=native
-
-.PHONY: clean purge
-
-$(LIB): $(OBJS)
- ar r $@ $^
-
-clean:
- rm -fr $(OBJS)
-
-purge:
- rm -fr $(LIB) $(OBJS)
diff --git a/rgo/include/rgo.h b/rgo/include/rgo.h
index f575436..f0f8d87 100644
--- a/rgo/include/rgo.h
+++ b/rgo/include/rgo.h
@@ -11,14 +11,14 @@
*/
#if !defined(__x86_64__) && !defined(__i386__)
-#error Unsupported machine architecture! Supported: AMD64, IA-32;
+#error Unsupported machine architecture! Supported: Aarch64, AMD64, IA-32;
#endif
#if !defined(rgo_ver)
#if defined(__ASSEMBLER__)
-#define rgo_ver $0x3
+#define rgo_ver $0x4
#else
-#define rgo_ver (0x3)
+#define rgo_ver (0x4)
#endif
#if defined(__ASSEMBLER__)
@@ -60,4 +60,4 @@ template<typename T> [[gnu::alloc_size(0x2),gnu::hot,gnu::malloc]] auto rgo_memd
#endif
#endif
-#endif \ No newline at end of file
+#endif
diff --git a/rgo/src/memeq.S b/rgo/src/memeq.S
index d106804..9175630 100644
--- a/rgo/src/memeq.S
+++ b/rgo/src/memeq.S
@@ -31,9 +31,9 @@ rgo_memeq:
pushl %ebx
/* ebx/esi: Current right element. */
pushl %esi
-.wrdeq:
+.wrdcmp:
cmpl $0x4,%ecx
- jl .byteeq
+ jl .bytecmp
movl (%eax),%ebx
movl (%edx),%esi
cmpl %ebx,%esi
@@ -41,8 +41,8 @@ rgo_memeq:
addl $0x4,%eax
addl $0x4,%edx
subl $0x4,%ecx
- jmp .wrdeq
-.byteeq:
+ jmp .wrdcmp
+.bytecmp:
testl %ecx,%ecx
jne .eq /* If we have reached the final element, all previous elements have compared equal, and the memory sequences are equal. */
movb (%eax),%bl
@@ -52,7 +52,7 @@ rgo_memeq:
incl %eax
incl %edx
decl %ecx
- jmp .byteeq
+ jmp .bytecmp
.eq:
popl %ebx
popl %esi
@@ -69,9 +69,9 @@ rgo_memeq:
/* rdx: Address of the current right element. */
/* rax: Current left element. */
/* rcx: Current right element. */
-.wrdeq:
+.wrdcmp:
cmpq $0x8,%rsi
- jl .byteeq
+ jl .bytecmp
movq (%rdi),%rax
movq (%rdx),%rcx
cmpq %rax,%rcx
@@ -79,8 +79,8 @@ rgo_memeq:
addq $0x8,%rdi
addq $0x8,%rdx
subq $0x8,%rsi
- jmp .wrdeq
-.byteeq:
+ jmp .wrdcmp
+.bytecmp:
testq %rsi,%rsi
jne .eq /* If we have reached the final element, all previous elements have compared equal, and the memory sequences are equal. */
movb (%rdi),%al
@@ -90,7 +90,7 @@ rgo_memeq:
incq %rdi
incq %rdx
decq %rsi
- jmp .byteeq
+ jmp .bytecmp
.eq:
movb $0x1,%al
ret