Use musl instead of litc in biscuit programs

master
Jiajie Chen 6 years ago
parent fb9a1d5f70
commit 9f46239322

@ -17,7 +17,7 @@ if (${ARCH} STREQUAL i386)
set(CMAKE_C_FLAGS "-m32 -mno-red-zone")
elseif (${ARCH} STREQUAL x86_64)
if(APPLE)
set(PREFIX x86_64-elf-)
set(PREFIX x86_64-linux-musl-)
endif ()
set(CMAKE_C_FLAGS "-m64 -mno-red-zone")
elseif (${ARCH} STREQUAL riscv32)
@ -39,17 +39,13 @@ endif ()
set(CMAKE_ASM_COMPILER ${PREFIX}gcc)
set(CMAKE_C_COMPILER ${PREFIX}gcc)
set(CMAKE_RANLIB ${PREFIX}ranlib)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -MMD -MP -O -g -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-stack-protector -fPIC -std=gnu11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -Wno-pointer-to-int-cast -Wno-format -MMD -MP -O -g -fPIC -std=gnu99")
set(CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS})
set(CMAKE_C_LINK_FLAGS "${LINK_FLAGS} -nostdlib") # override default value to get rid of '-Wl,-search_paths_first -Wl,-headerpad_max_install_names'
set(CMAKE_C_LINK_FLAGS "${LINK_FLAGS}") # override default value to get rid of '-Wl,-search_paths_first -Wl,-headerpad_max_install_names'
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) # override default value to get rid of '-rdynamic' on Linux
# Library
add_library(ulib ${LIBS})
# Execuatble
foreach (PATH ${SRCS})
get_filename_component(NAME ${PATH} NAME_WE)
add_executable(${NAME} ${PATH})
target_link_libraries(${NAME} ulib gcc)
endforeach ()

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static int lstn(uint16_t lport)
{
@ -126,6 +126,6 @@ int main(int argc, char **argv)
if (close(fd) == -1)
err(-1, "close");
fprintf(stderr, "wrote %zu bytes. rebooting.\n", did);
reboot();
reboot(RB_AUTOBOOT);
return 0;
}

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static long
_fetch(long n)

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static long
nowms(void)

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[512];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[512];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <stdio.h>
#include <common.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,9 +1,11 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{
while (1) {
char *ret = readline("input:");
printf("input:");
char buf[1024];
char *ret = gets(buf);
if (!ret)
break;
printf("got: %s\n", ret);

@ -41,7 +41,7 @@
*
*/
#include <stdio.h>
#include <common.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mman.h>

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include<stdio.h>
#include<common.h>
#include<unistd.h>
#include<err.h>
#include<poll.h>

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
void child(int id)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[5120];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char buf[1024];

@ -1,4 +1,4 @@
#include<stdio.h>
#include<common.h>
#include<unistd.h>
#include<err.h>
#include<sys/socket.h>

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main()
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
void cmb(void)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static void gcrun(char * const *cmd, long *_ngcs, long *_xput, double *_gcfrac)
{
@ -281,7 +281,7 @@ __attribute__((unused))
static void usage()
{
fprintf(stderr, "usage: %s [-n target gcs] [-c target gc frac]"
" -x <0gc xput> <allocr>\n", __progname);
" -x <0gc xput> <allocr>\n", "halp");
exit(-1);
}

@ -1,4 +1,4 @@
#include <stdio.h>
#include <common.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -715,9 +715,7 @@ typedef struct {
struct dirent dents[];
} DIR;
// tls is not fully supported at the time
//extern __thread int errno;
extern int errno;
extern __thread int errno;
#define BUFSIZ 4096
#define L_tmpnam 20

@ -0,0 +1,27 @@
#include <arpa/inet.h>
#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/kdev_t.h>
#include <pthread.h>
#include <poll.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/uio.h>
#include <sys/param.h>
#include <sys/un.h>
#include <sys/reboot.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <spawn.h>
#include <unistd.h>
#include <uchar.h>
#define WAIT_ANY (-1)
#include <limits.h>
#define uchar unsigned char

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static void fexec(char * const args[])
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -64,9 +64,7 @@
#define SYS_FUTEX 31342
#define SYS_GETTID 31343
// tls is not fully support at the time
//__thread int errno;
int errno;
__thread int errno;
static int dolock = 1;

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static char lmss[1ul << 11];
@ -81,7 +81,7 @@ int nc(int s)
static void usage()
{
fprintf(stderr, "usage:\n"
"%s [-M] [-c host] [-p port] [-l listen port]\n", __progname);
"%s [-M] [-c host] [-p port] [-l listen port]\n", "lnc");
exit(-1);
}

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
void dprint(int fd, char *par, int left, int rec)
{
@ -77,7 +77,7 @@ void usage(void)
{
fprintf(stderr, "%s [-R]\n"
"-R recurse subdirectories\n"
"\n", __progname);
"\n", "ls");
exit(-1);
}

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
void mkargs(char *line, char *args[], size_t n)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static long
nowms(void)

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
char *ps[1000];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
int main(int argc, char **argv)
{

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
__thread int id;

@ -1,4 +1,4 @@
#include <stdio.h>
#include <common.h>
#include <unistd.h>
int main(int argc, char **argv)

@ -1,4 +1,4 @@
#include <stdio.h>
#include <common.h>
#include <unistd.h>
int main(int argc, char **argv)
@ -6,6 +6,6 @@ int main(int argc, char **argv)
printf("syncing...");
sync();
printf("done. rebooting...\n");
reboot();
reboot(RB_AUTOBOOT);
return 0;
}

@ -1,4 +1,4 @@
#include <stdio.h>
#include <common.h>
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
@ -35,8 +35,7 @@ void rm(char *fn)
struct stat st;
if (stat(fn, &st) == -1)
err(-1, "stat");
if (S_ISREG(st.st_mode) || S_ISSOCK(st.st_mode) ||
S_ISDEV(st.st_mode)) {
if (S_ISREG(st.st_mode) || S_ISSOCK(st.st_mode)) {
if (unlink(fn) == -1)
err(-1, "unlink");
return;
@ -51,7 +50,7 @@ int main(int argc, char **argv)
{
if (argc != 2) {
fprintf(stderr, "usage: %s <non-empty dir to remove>\n",
__progname);
"rmtree");
exit(-1);
}
char *fn = argv[1];

@ -1,4 +1,4 @@
#include <litc.h>
#include <common.h>
static int lstn(uint16_t lport)
{

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save