Use openlibm
This commit is contained in:
@@ -0,0 +1 @@
|
||||
#include <openlibm.h>
|
||||
@@ -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
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
/args
|
||||
/create
|
||||
/create.out
|
||||
/math
|
||||
/write
|
||||
|
||||
+13
-1
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#include <math.h>
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
float c = cos(3.14);
|
||||
}
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user