1
0
mirror of https://gitlab.os-k.eu/os-k-team/cross-cc-builder.git synced 2023-08-25 14:03:10 +02:00

Adding patches for red-zone

This commit is contained in:
Adrien Bourmault 2020-06-01 20:49:17 +02:00
parent e69a394ed7
commit 35b91319f9
No known key found for this signature in database
GPG Key ID: AFEE5788AEE3F4EC
4 changed files with 75 additions and 11 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@ gcc*/*
binutils*/* binutils*/*
gcc* gcc*
binutils* binutils*
bin/*
build*

View File

@ -22,23 +22,26 @@
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. # # along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=# #=----------------------------------------------------------------------------=#
.PHONY: retrieve compile showenv .PHONY: retrieve compile showenv deflate configurebinutils binutils gcc clean
.DEFAULT_GOAL := compile .DEFAULT_GOAL := gcc
## VERSIONS ------------------------------------------------------------------ # ## VERSIONS ------------------------------------------------------------------ #
GCC_NAME = gcc-10.1.0
BINUTILS_NAME =binutils-2.34
# GCC 10.1.0 # GCC 10.1.0
GCC_SOURCES = https://ftp.gnu.org/gnu/gcc/gcc-10.1.0/gcc-10.1.0.tar.xz GCC_SOURCES = https://ftp.gnu.org/gnu/gcc/$(GCC_NAME)/$(GCC_NAME).tar.xz
# BINUTILS 2.34 # BINUTILS 2.34
BINUTILS_SOURCES = https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz BINUTILS_SOURCES = https://ftp.gnu.org/gnu/binutils/$(BINUTILS_NAME).tar.xz
## VARIABLES ----------------------------------------------------------------- # ## VARIABLES ----------------------------------------------------------------- #
#ENV #ENV
export NTHREADS := ${nproc} export NTHREADS := $(shell nproc)
export PREFIX := $(HOME)/opt/cross export PREFIX := $(shell pwd)/bin
export TARGET := x86_64-elf export TARGET := x86_64-elf
export PATH := $(PREFIX)/bin:$(PATH) export PATH := $(PREFIX)/bin:$(PATH)
export XZ_DEFAULTS := -T $(NTHREADS) export XZ_DEFAULTS := -T $(NTHREADS)
@ -73,15 +76,51 @@ retrieve: showenv
deflate: deflate:
@echo ${CL2}[$@] ${NC}Deflate GCC sources...${CL3} @echo ${CL2}[$@] ${NC}Deflate GCC sources...${CL3}
@tar -xaf $(GCCTARNAME) --threads NTHREADS @tar -xaf $(GCCTARNAME) --skip-old-files
@echo ${CL2}[$@] ${NC}Deflate BINUTILS sources...${CL3} @echo ${CL2}[$@] ${NC}Deflate $(BINUTILS_NAME) sources...${CL3}
@tar -xaf $(BINUTILSTARNAME) --threads NTHREADS @tar -xaf $(BINUTILSTARNAME) --skip-old-files
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
compile: retrieve deflate configurebinutils: retrieve deflate
@echo ${CL2}[$@] ${NC}Configuring $(BINUTILS_NAME)...${CL3}
@mkdir -p build-binutils
cd build-binutils && ../$(BINUTILS_NAME)/configure --target=$(TARGET) --prefix="$(PREFIX)" --with-sysroot --disable-nls --disable-werror
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}
binutils: configurebinutils
@echo ${CL2}[$@] ${NC}Compiling $(BINUTILS_NAME)...${CL3}
cd build-binutils && make -j $(NTHREADS)
@echo ${CL2}[$@] ${NC}Compiling $(BINUTILS_NAME)...${CL3}
@mkdir -p bin
cd build-binutils && make install -j $(NTHREADS)
@echo ${CL2}[$@] ${CL}Success.${CL3}
configuregcc:
@echo ${CL2}[$@] ${NC}Configuring $(GCC_NAME)...${CL3}
@cp multilib.opt $(GCC_NAME)/gcc/config/i386/t-x86_64-elf
@patch $(GCC_NAME)/gcc/config.gcc < patch-red-zone.diff
@mkdir -p build-gcc
cd build-gcc && ../$(GCC_NAME)/configure --target=$(TARGET) --prefix="$(PREFIX)" --disable-nls --enable-languages=c,c++ --without-headers
@echo ${CL2}[$@] ${CL}Success.${CL3}
gcc: binutils configuregcc
@echo ${CL2}[$@] ${NC}Compiling $(GCC_NAME)...${CL3}
cd build-gcc && make all-gcc -j $(NTHREADS)
cd build-gcc && make all-target-libgcc -j $(NTHREADS)
@mkdir -p bin
cd build-gcc && make install-gcc -j $(NTHREADS)
cd build-gcc && make install-target-libgcc -j $(NTHREADS)
@echo ${CL2}[$@] ${CL}Success.${CL3}
clean:
@mkdir -p build-gcc build-binutils
@cd build-gcc && rm -rf *
@cd build-binutils && rm -rf *
@rm -rf bin
@echo ${CL2}[$@] ${CL}Success.${CL3}
remove_all: remove_all:
@rm -rf gcc* @rm -rf gcc*
@rm -rf binutils* @rm -rf bin*
@echo ${CL2}[$@] ${CL}Success.${CL3} @echo ${CL2}[$@] ${CL}Success.${CL3}

4
multilib.opt Normal file
View File

@ -0,0 +1,4 @@
# Add libgcc multilib variant without red-zone requirement
MULTILIB_OPTIONS += mno-red-zone
MULTILIB_DIRNAMES += no-red-zone

19
patch-red-zone.diff Normal file
View File

@ -0,0 +1,19 @@
--- config.gcc 2020-06-01 20:40:52.562801089 +0200
+++ configm.gcc 2020-06-01 20:41:49.970576321 +0200
@@ -180,7 +180,7 @@
# the --with-sysroot configure option or the
# --sysroot command line option is used this
# will be relative to the sysroot.
-# target_type_format_char
+# target_type_format_char
# The default character to be used for formatting
# the attribute in a
# .type symbol_name, ${t_t_f_c}<property>
@@ -1865,6 +1865,7 @@
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
;;
x86_64-*-elf*)
+ tmake_file="${tmake_file} i386/t-x86_64-elf" # include the new multilib configuration to prevent red-zone
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h i386/x86-64.h"
;;
x86_64-*-rtems*)