Started stub for test1000 for self-hosting
This commit is contained in:
parent
edd4bf6ec9
commit
5e54a3d312
2
M2libc
2
M2libc
|
@ -1 +1 @@
|
||||||
Subproject commit daec5ae864c80535dac5d53f83c8718e677b9e2d
|
Subproject commit 222726e4f8d6b3898da41e6052a95b6599e1c864
|
2
cc.c
2
cc.c
|
@ -182,7 +182,7 @@ int main(int argc, char** argv, char** envp)
|
||||||
name = calloc(100, sizeof(char));
|
name = calloc(100, sizeof(char));
|
||||||
strcpy(name, "/tmp/M2-Mesoplanet-XXXXXX");
|
strcpy(name, "/tmp/M2-Mesoplanet-XXXXXX");
|
||||||
i = mkstemp(name);
|
i = mkstemp(name);
|
||||||
tempfile = fdopen(i, "w+");
|
tempfile = fdopen(i, "w");
|
||||||
if(NULL != tempfile)
|
if(NULL != tempfile)
|
||||||
{
|
{
|
||||||
/* Our preprocessed crap */
|
/* Our preprocessed crap */
|
||||||
|
|
17
cc_macro.c
17
cc_macro.c
|
@ -664,12 +664,21 @@ void macro_directive()
|
||||||
eat_current_token();
|
eat_current_token();
|
||||||
STDIO_USED = TRUE;
|
STDIO_USED = TRUE;
|
||||||
}
|
}
|
||||||
eat_current_token();
|
}
|
||||||
eat_current_token();
|
while(TRUE)
|
||||||
|
{
|
||||||
|
if(NULL == macro_token)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if('\n' == macro_token->s[0])
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
eat_current_token();
|
eat_current_token();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
eat_current_token();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
#! /bin/sh
|
||||||
|
## Copyright (C) 2021 Jeremiah Orians
|
||||||
|
## This file is part of M2-Planet.
|
||||||
|
##
|
||||||
|
## M2-Planet is free software: you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation, either version 3 of the License, or
|
||||||
|
## (at your option) any later version.
|
||||||
|
##
|
||||||
|
## M2-Planet is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
##
|
||||||
|
## You should have received a copy of the GNU General Public License
|
||||||
|
## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# Set the folling variables:
|
||||||
|
# BUILDDIR for where the tempfiles are to go
|
||||||
|
# BINDIR for where the final binary is to go.
|
||||||
|
# BLOOD_FLAG for any arguments blood-elf might need
|
||||||
|
# ARCH for the system architecture
|
||||||
|
# ENDIAN_FLAG for the system endianness
|
||||||
|
# BASE_ADDRESS for the system base address
|
||||||
|
# TOOLS for where the tools needed to build are located
|
||||||
|
# M2LIBC for where M2libc files are located
|
||||||
|
|
||||||
|
# Bootstrap build
|
||||||
|
${TOOLS}/M2-Planet --architecture ${ARCH} \
|
||||||
|
-f ${M2LIBC}/sys/types.h \
|
||||||
|
-f ${M2LIBC}/stddef.h \
|
||||||
|
-f ${M2LIBC}/${ARCH}/Linux/unistd.h \
|
||||||
|
-f ${M2LIBC}/${ARCH}/Linux/fcntl.h \
|
||||||
|
-f ${M2LIBC}/stdlib.c \
|
||||||
|
-f ${M2LIBC}/stdio.c \
|
||||||
|
-f ${M2LIBC}/bootstrappable.c \
|
||||||
|
-f ${M2LIBC}/string.c \
|
||||||
|
-f cc.h \
|
||||||
|
-f cc_globals.c \
|
||||||
|
-f cc_reader.c \
|
||||||
|
-f cc_core.c \
|
||||||
|
-f cc_macro.c \
|
||||||
|
-f cc_env.c \
|
||||||
|
-f cc_spawn.c \
|
||||||
|
-f cc.c \
|
||||||
|
--debug \
|
||||||
|
-o ${BUILDDIR}/M2-Mesoplanet.M1
|
||||||
|
|
||||||
|
${TOOLS}/blood-elf \
|
||||||
|
-f ${BUILDDIR}/M2-Mesoplanet.M1 \
|
||||||
|
${ENDIAN_FLAG} \
|
||||||
|
--entry _start \
|
||||||
|
-o ${BUILDDIR}/M2-Mesoplanet-footer.M1 ${BLOOD_FLAG}
|
||||||
|
|
||||||
|
${TOOLS}/M1 \
|
||||||
|
-f ${M2LIBC}/${ARCH}/${ARCH}_defs.M1 \
|
||||||
|
-f ${M2LIBC}/${ARCH}/libc-full.M1 \
|
||||||
|
-f ${BUILDDIR}/M2-Mesoplanet.M1 \
|
||||||
|
-f ${BUILDDIR}/M2-Mesoplanet-footer.M1 \
|
||||||
|
${ENDIAN_FLAG} \
|
||||||
|
--architecture ${ARCH} \
|
||||||
|
-o ${BUILDDIR}/M2-Mesoplanet.hex2
|
||||||
|
|
||||||
|
${TOOLS}/hex2 \
|
||||||
|
-f ${M2LIBC}/${ARCH}/ELF-${ARCH}-debug.hex2 \
|
||||||
|
-f ${BUILDDIR}/M2-Mesoplanet.hex2 \
|
||||||
|
${ENDIAN_FLAG} \
|
||||||
|
--architecture ${ARCH} \
|
||||||
|
--base-address ${BASE_ADDRESS} \
|
||||||
|
-o ${BINDIR}/M2-Mesoplanet
|
|
@ -0,0 +1,33 @@
|
||||||
|
#! /bin/sh
|
||||||
|
## Copyright (C) 2017 Jeremiah Orians
|
||||||
|
## Copyright (C) 2020-2021 deesix <deesix@tuta.io>
|
||||||
|
## This file is part of M2-Planet.
|
||||||
|
##
|
||||||
|
## M2-Planet is free software: you can redistribute it and/or modify
|
||||||
|
## it under the terms of the GNU General Public License as published by
|
||||||
|
## the Free Software Foundation, either version 3 of the License, or
|
||||||
|
## (at your option) any later version.
|
||||||
|
##
|
||||||
|
## M2-Planet is distributed in the hope that it will be useful,
|
||||||
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
## GNU General Public License for more details.
|
||||||
|
##
|
||||||
|
## You should have received a copy of the GNU General Public License
|
||||||
|
## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
BUILDDIR="test/test1000/tmp"
|
||||||
|
BINDIR="test/test1000/tmp"
|
||||||
|
ARCH=$(get_machine)
|
||||||
|
M2LIBC="./M2libc"
|
||||||
|
TOOLS=" "
|
||||||
|
BLOOD_FLAG=$(get_machine --blood)
|
||||||
|
BASE_ADDRESS=$(get_machine --hex2)
|
||||||
|
ENDIAN_FLAG=$(get_machine --endian)
|
||||||
|
|
||||||
|
mkdir -p ${BUILDDIR}
|
||||||
|
./test/test1000/bootstrap.sh
|
||||||
|
|
||||||
|
## TODO FINISH WRITING TEST
|
Loading…
Reference in New Issue