mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-16 00:00:06 +01:00
start to create a toolchain for HermitCore
This commit is contained in:
parent
f6aa000bd4
commit
b78e485e38
5 changed files with 34 additions and 16 deletions
|
@ -54,7 +54,7 @@ STRIP_DEBUG = --strip-debug
|
|||
KEEP_DEBUG = --only-keep-debug
|
||||
OUTPUT_FORMAT = -O elf32-i386
|
||||
|
||||
CFLAGS_FOR_NEWLIB = $(STACKPROT) -mtune=native
|
||||
CFLAGS_FOR_NEWLIB = -O2 -mtune=native #$(STACKPROT)
|
||||
LDFLAGS_FOR_NEWLIB =
|
||||
NASMFLAGS_FOR_NEWLIB = -felf64
|
||||
CFLAGS_FOR_TOOLS = -O2 -Wall
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
TOPDIR = $(shell pwd)
|
||||
ARCH = x86
|
||||
TARGET=x86_64-hermit-elf64
|
||||
TARGET=x86_64-hermit
|
||||
|
||||
NEWLIB = $(TOPDIR)/$(ARCH)/$(TARGET)
|
||||
RM = rm -rf
|
||||
CD = cd
|
||||
MKDIR = mkdir
|
||||
TMP = $(TOPDIR)/tmp
|
||||
OPT = --disable-shared --disable-multilib --disable-newlib-multithread --disable-newlib-reent-small
|
||||
ARCHOPT = #-mavx2 -mfma
|
||||
OPT = --disable-shared --disable-multilib --enable-newlib-multithread #--disable-newlib-reent-small
|
||||
|
||||
# Prettify output
|
||||
V = 0
|
||||
|
@ -18,14 +17,21 @@ ifeq ($V,0)
|
|||
endif
|
||||
|
||||
default: $(ARCH)
|
||||
$Q$(MAKE) ARCH=$(ARCH) TARGET=$(TARGET) CFLAGS+="$(ARCHOPT) -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples depend
|
||||
$Q$(MAKE) ARCH=$(ARCH) TARGET=$(TARGET) CFLAGS+="$(ARCHOPT) -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C examples
|
||||
$Q$(MAKE) -C examples depend
|
||||
$Q$(MAKE) -C examples
|
||||
|
||||
$(ARCH):
|
||||
@echo Build newlib
|
||||
$Q$(RM) $(TMP)
|
||||
$Q$(MKDIR) $(TMP)
|
||||
$Q$(CD) $(TMP); $(TOPDIR)/src/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) $(OPT) && $(MAKE) && $(MAKE) install
|
||||
$Q$(MKDIR) $(TMP)/binutils
|
||||
$Q$(CD) $(TMP)/binutils; $(TOPDIR)/binutils/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) --disable-shared --disable-nls --disable-gdb --disable-libdecnumber --disable-readline --disable-sim && $(MAKE) && $(MAKE) install
|
||||
$Q$(MKDIR) $(TMP)/newlib
|
||||
$Q$(CD) $(TMP)/newlib; $(TOPDIR)/src/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) $(OPT) && $(MAKE) && $(MAKE) install
|
||||
$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-I. -Iplatform/hermit -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte depend
|
||||
$Q$(MAKE) TARGET=$(TARGET) CFLAGS+="-I. -Iplatform/hermit -ffreestanding -O3 -Wall -I$(NEWLIB)/include -I../../include -I../../arch/$(ARCH)/include" LDFLAGS+="-nostdlib -L$(NEWLIB)/lib" -C pte
|
||||
$Q$(MKDIR) $(TMP)/gcc
|
||||
$Q$(CD) $(TMP)/gcc; $(TOPDIR)/gcc/configure --target=$(TARGET) --prefix=$(TOPDIR)/$(ARCH) --without-headers --with-newlib --enable-languages=c --disable-nls --disable-shared --disable-libssp --enable-threads=single && $(MAKE) && $(MAKE) install
|
||||
|
||||
clean:
|
||||
@echo Cleaning newlib
|
||||
|
@ -34,5 +40,6 @@ clean:
|
|||
|
||||
veryclean:
|
||||
@echo Propper cleaning newlib
|
||||
$Q$(MAKE) -C pte veryclean
|
||||
$Q$(MAKE) -C examples veryclean
|
||||
$Q$(RM) $(TOPDIR)/$(ARCH)
|
||||
|
|
|
@ -1,16 +1,27 @@
|
|||
ARCH = x86
|
||||
NEWLIB = ../x86/x86_64-hermit-elf64
|
||||
TARGET=x86_64-hermit
|
||||
MAKE = make
|
||||
STRIP_DEBUG = --strip-debug
|
||||
KEEP_DEBUG = --only-keep-debug
|
||||
|
||||
override LDFLAGS += -T link.ld
|
||||
# Set your own cross compiler tool chain prefix here
|
||||
override CROSSCOMPREFIX = ../$(ARCH)/bin/$(TARGET)-
|
||||
|
||||
# Default section offsets in x86-64 ELF files are aligned to the page-size.
|
||||
# For x86-64 the pagesize is huge (2 MB) with the consquence of large sparse
|
||||
# ELF files (which lead to a huge initrd). To solve this, we manually set the page-size to 4 KB.
|
||||
# Furthermore, we use a large memory model to deal with real 64bit application.
|
||||
override LDFLAGS += -Wl,-n,-z,max-page-size=0x1000
|
||||
override CC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
|
||||
override CXX_FOR_TARGET = $(CROSSCOMPREFIX)g++
|
||||
override GCC_FOR_TARGET = $(CROSSCOMPREFIX)gcc
|
||||
override CPP_FOR_TARGET = $(CROSSCOMPREFIX)cpp
|
||||
override AR_FOR_TARGET = $(CROSSCOMPREFIX)ar
|
||||
override AS_FOR_TARGET = $(CROSSCOMPREFIX)as
|
||||
override LD_FOR_TARGET = $(CROSSCOMPREFIX)ld
|
||||
override NM_FOR_TARGET = $(CROSSCOMPREFIX)nm
|
||||
override OBJDUMP_FOR_TARGET = $(CROSSCOMPREFIX)objdump
|
||||
override OBJCOPY_FOR_TARGET = $(CROSSCOMPREFIX)objcopy
|
||||
override RANLIB_FOR_TARGET = $(CROSSCOMPREFIX)ranlib
|
||||
override STRIP_FOR_TARGET = $(CROSSCOMPREFIX)strip
|
||||
override READELF_FOR_TARGET = $(CROSSCOMPREFIX)readelf
|
||||
|
||||
override CFLAGS=-O3 -mtune=native
|
||||
|
||||
# Prettify output
|
||||
V = 0
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 103e1454982e711374d12cac05d48238f982a4ea
|
||||
Subproject commit 04ee6b97699cdc73d040eb202cf607666103ac82
|
|
@ -1 +1 @@
|
|||
Subproject commit dd62610a3d3ca59b1034e73286a7d3f5903b0bee
|
||||
Subproject commit a4ea10a709d75839c0ae34b0fef2bed51a97c5fc
|
Loading…
Add table
Reference in a new issue