Use openlibm

This commit is contained in:
Jeremy Soller
2018-03-03 17:56:53 -07:00
parent 172517e4f8
commit bf987098dc
10 changed files with 29 additions and 5 deletions
View File
+1
View File
@@ -0,0 +1 @@
#include <openlibm.h>
+5
View File
@@ -2,6 +2,11 @@ set -ex
cargo build
cargo build --manifest-path crt0/Cargo.toml
cd openlibm
make
cd ..
cd tests
make clean
make run
+1
View File
@@ -2,4 +2,5 @@
/args
/create
/create.out
/math
/write
+13 -1
View File
@@ -2,6 +2,7 @@ BINS=\
alloc \
args \
create \
math \
write
all: $(BINS)
@@ -13,4 +14,15 @@ run: $(BINS)
for bin in $(BINS); do echo "\\033[1m$${bin}\\033[0m"; ./$${bin} test args; done
%: %.c
gcc -nostdinc -nostdlib -I ../include -I ../target/include ../target/debug/libcrt0.a $< ../target/debug/libc.a -o $@
gcc \
-nostdinc \
-nostdlib \
-I ../include \
-I ../target/include \
-I ../openlibm/include \
-I ../openlibm/src \
../target/debug/libcrt0.a \
$< \
../target/debug/libc.a \
../openlibm/libopenlibm.a \
-o $@
+1 -1
View File
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv) {
int main(int argc, char ** argv) {
write(STDERR_FILENO, "malloc\n", 7);
char * ptr = (char *)malloc(256);
write(STDERR_FILENO, "set\n", 4);
+1 -1
View File
@@ -1,7 +1,7 @@
#include <string.h>
#include <unistd.h>
int main(int argc, char **argv) {
int main(int argc, char ** argv) {
int i;
for(i = 0; i < argc; i++) {
write(STDOUT_FILENO, argv[i], strlen(argv[i]));
+1 -1
View File
@@ -1,7 +1,7 @@
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv) {
int main(int argc, char ** argv) {
int fd = creat("create.out", 0755);
if (fd >= 0) {
write(fd, "Hello World!\n", 13);
+5
View File
@@ -0,0 +1,5 @@
#include <math.h>
int main(int argc, char ** argv) {
float c = cos(3.14);
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include <unistd.h>
int main(int argc, char **argv) {
int main(int argc, char ** argv) {
write(STDOUT_FILENO, "Hello World!\n", 13);
return 0;
}