From: darcagn <da...@us...> - 2023-03-11 21:41:08
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b7799950e6f7672881fdaf2779ae0607e6499c73 (commit) via 50d2cf79af631d0761a1a4f7df128aa6a32ed85a (commit) from c9fa4c5069ee526714c941b9470fbc2b15c23888 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b7799950e6f7672881fdaf2779ae0607e6499c73 Merge: c9fa4c5 50d2cf7 Author: darcagn <da...@pr...> Date: Sat Mar 11 15:40:18 2023 -0600 Merge pull request #129 from KallistiOS/macos-chain Change arm-Darwin patches to run in addition to standard patches commit 50d2cf79af631d0761a1a4f7df128aa6a32ed85a Author: darc <da...@pr...> Date: Sat Mar 11 15:33:23 2023 -0600 Change arm-Darwin patches to run in addition to standard patches instead of exclusively, bringing behavior in line with SiZiOUS's MinGW-w64 patches and eliminating duplication of labor. ----------------------------------------------------------------------- Summary of changes: .../patches/arm-Darwin/gcc-12.2.0-kos.diff | 1587 +------------------- .../dc-chain/patches/arm-Darwin/gcc-8.4.0-kos.diff | 44 +- .../dc-chain/patches/arm-Darwin/gcc-9.3.0-kos.diff | 1555 +------------------ utils/dc-chain/scripts/patch.mk | 2 +- 4 files changed, 35 insertions(+), 3153 deletions(-) diff --git a/utils/dc-chain/patches/arm-Darwin/gcc-12.2.0-kos.diff b/utils/dc-chain/patches/arm-Darwin/gcc-12.2.0-kos.diff index 9e6cf03..9d235b2 100644 --- a/utils/dc-chain/patches/arm-Darwin/gcc-12.2.0-kos.diff +++ b/utils/dc-chain/patches/arm-Darwin/gcc-12.2.0-kos.diff @@ -1,1597 +1,28 @@ diff --color -ruN gcc-12.2.0/gcc/config/host-darwin.cc gcc-12.2.0-kos/gcc/config/host-darwin.cc ---- gcc-12.2.0/gcc/config/host-darwin.cc 2023-02-03 23:24:26 -+++ gcc-12.2.0-kos/gcc/config/host-darwin.cc 2023-02-03 23:27:40 -@@ -24,6 +24,8 @@ +--- gcc-12.2.0/gcc/config/host-darwin.cc 2023-03-11 14:18:10 ++++ gcc-12.2.0-kos/gcc/config/host-darwin.cc 2023-03-11 14:22:40 +@@ -24,6 +24,10 @@ #include "diagnostic-core.h" #include "config/host-darwin.h" #include <errno.h> +#include "hosthooks.h" +#include "hosthooks-def.h" - - /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the - binaries, the following VM addresses are expected to be available. -@@ -181,3 +183,5 @@ - - return 1; - } + +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; -diff --color -ruN gcc-12.2.0/gcc/config/sh/sh-c.cc gcc-12.2.0-kos/gcc/config/sh/sh-c.cc ---- gcc-12.2.0/gcc/config/sh/sh-c.cc 2023-02-03 23:24:26 -+++ gcc-12.2.0-kos/gcc/config/sh/sh-c.cc 2023-02-03 23:25:16 -@@ -141,4 +141,11 @@ - - cpp_define_formatted (pfile, "__SH_ATOMIC_MODEL_%s__", - selected_atomic_model ().cdef_name); -+ -+ /* Custom built-in defines for KallistiOS */ -+ builtin_define ("__KOS_GCC_PATCHED__"); -+ cpp_define_formatted (pfile, "__KOS_GCC_PATCHLEVEL__=%d", -+ 2023010200); -+ /* Toolchain supports setting up stack for 32MB */ -+ builtin_define ("__KOS_GCC_32MB__"); - } -diff --color -ruN gcc-12.2.0/gcc/config/sh/sh_treg_combine.cc gcc-12.2.0-kos/gcc/config/sh/sh_treg_combine.cc ---- gcc-12.2.0/gcc/config/sh/sh_treg_combine.cc 2023-02-03 23:24:26 -+++ gcc-12.2.0-kos/gcc/config/sh/sh_treg_combine.cc 2023-02-03 23:25:16 -@@ -37,6 +37,7 @@ - #include "cfgrtl.h" - #include "tree-pass.h" - #include "expr.h" -+#include "tm-preds.h" - - /* - This pass tries to optimize for example this: -@@ -425,10 +426,6 @@ - rtx p = PATTERN (i); - return GET_CODE (p) == SET && GET_CODE (XEXP (p, 1)) == IF_THEN_ELSE; - } -- --// FIXME: Remove dependency on SH predicate function somehow. --extern int t_reg_operand (rtx, machine_mode); --extern int negt_reg_operand (rtx, machine_mode); - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // RTL pass class + /* For Darwin (macOS only) platforms, without ASLR (PIE) enabled on the + binaries, the following VM addresses are expected to be available. diff --color -ruN gcc-12.2.0/gcc/config.host gcc-12.2.0-kos/gcc/config.host ---- gcc-12.2.0/gcc/config.host 2023-02-03 23:24:42 -+++ gcc-12.2.0-kos/gcc/config.host 2023-02-03 23:28:17 +--- gcc-12.2.0/gcc/config.host 2023-03-11 14:18:26 ++++ gcc-12.2.0-kos/gcc/config.host 2023-03-11 14:23:01 @@ -93,8 +93,8 @@ case ${host} in *-darwin*) # Generic darwin host support. - out_host_hook_obj=host-darwin.o - host_xmake_file="${host_xmake_file} x-darwin" -+ #out_host_hook_obj=host-darwin.o -+ #host_xmake_file="${host_xmake_file} x-darwin" ++ # out_host_hook_obj=host-darwin.o ++ # host_xmake_file="${host_xmake_file} x-darwin" ;; esac -diff --color -ruN gcc-12.2.0/gcc/configure gcc-12.2.0-kos/gcc/configure ---- gcc-12.2.0/gcc/configure 2023-02-03 23:24:25 -+++ gcc-12.2.0-kos/gcc/configure 2023-02-03 23:25:16 -@@ -12885,7 +12885,7 @@ - target_thread_file='single' - ;; - aix | dce | lynx | mipssde | posix | rtems | \ -- single | tpf | vxworks | win32) -+ single | tpf | vxworks | win32 | kos) - target_thread_file=${enable_threads} - ;; - *) -diff --color -ruN gcc-12.2.0/libgcc/config/sh/crt1.S gcc-12.2.0-kos/libgcc/config/sh/crt1.S ---- gcc-12.2.0/libgcc/config/sh/crt1.S 2023-02-03 23:24:24 -+++ gcc-12.2.0-kos/libgcc/config/sh/crt1.S 2023-02-03 23:25:16 -@@ -1,724 +1,225 @@ --/* Copyright (C) 2000-2022 Free Software Foundation, Inc. -- This file was pretty much copied from newlib. -+! KallistiOS ##version## -+! -+! startup.s -+! (c)2000-2001 Dan Potter -+! -+! This file must appear FIRST in your linking order, or your program won't -+! work correctly as a raw binary. -+! -+! This is very loosely based on Marcus' crt0.s/startup.s -+! - --This file is part of GCC. -+.globl start -+.globl _start -+.globl _arch_real_exit -+.globl __arch_old_sr -+.globl __arch_old_vbr -+.globl __arch_old_stack -+.globl __arch_old_fpscr -+.globl __arch_mem_top - --GCC 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, or (at your option) any --later version. -- --GCC 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. -- --Under Section 7 of GPL version 3, you are granted additional --permissions described in the GCC Runtime Library Exception, version --3.1, as published by the Free Software Foundation. -- --You should have received a copy of the GNU General Public License and --a copy of the GCC Runtime Library Exception along with this program; --see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --<http://www.gnu.org/licenses/>. */ -- --#include "crt.h" -- --#ifdef MMU_SUPPORT -- /* Section used for exception/timer interrupt stack area */ -- .section .data.vbr.stack,"aw" -- .align 4 -- .global __ST_VBR --__ST_VBR: -- .zero 1024 * 2 /* ; 2k for VBR handlers */ --/* Label at the highest stack address where the stack grows from */ --__timer_stack: --#endif /* MMU_SUPPORT */ -- -- /* ;---------------------------------------- -- Normal newlib crt1.S */ -- -- ! make a place to keep any previous value of the vbr register -- ! this will only have a value if it has been set by redboot (for example) -- .section .bss --old_vbr: -- .long 0 --#ifdef PROFILE --profiling_enabled: -- .long 0 --#endif -- -- -- .section .text -- .global start -- .import ___rtos_profiler_start_timer -- .weak ___rtos_profiler_start_timer -+_start: - start: -- mov.l stack_k,r15 -+ ! Disable interrupts (if they're enabled) -+ mov.l old_sr_addr,r0 -+ stc sr,r1 -+ mov.l r1,@r0 -+ mov.l init_sr,r0 -+ ldc r0,sr - --#if defined (__SH3__) || (defined (__SH_FPU_ANY__) && ! defined (__SH2E__) && ! defined (__SH2A__)) || defined (__SH4_NOFPU__) --#define VBR_SETUP -- ! before zeroing the bss ... -- ! if the vbr is already set to vbr_start then the program has been restarted -- ! (i.e. it is not the first time the program has been run since reset) -- ! reset the vbr to its old value before old_vbr (in bss) is wiped -- ! this ensures that the later code does not create a circular vbr chain -- stc vbr, r1 -- mov.l vbr_start_k, r2 -- cmp/eq r1, r2 -- bf 0f -- ! reset the old vbr value -- mov.l old_vbr_k, r1 -- mov.l @r1, r2 -- ldc r2, vbr --0: --#endif /* VBR_SETUP */ -- -- ! zero out bss -- mov.l edata_k,r0 -- mov.l end_k,r1 -- mov #0,r2 --start_l: -- mov.l r2,@r0 -- add #4,r0 -- cmp/ge r0,r1 -- bt start_l -+ ! Run in the P2 area -+ mov.l setup_cache_addr,r0 -+ mov.l p2_mask,r1 -+ or r1,r0 -+ jmp @r0 -+ nop - --#if defined (__SH_FPU_ANY__) -- mov.l set_fpscr_k, r1 -- mov #4,r4 -- jsr @r1 -- shll16 r4 ! Set DN bit (flush denormal inputs to zero) -- lds r3,fpscr ! Switch to default precision --#endif /* defined (__SH_FPU_ANY__) */ -+setup_cache: -+ ! Now that we are in P2, it's safe to enable the cache -+ ! Check to see if we should enable OCRAM. -+ mov.l kos_init_flags_addr, r0 -+ add #2, r0 -+ mov.w @r0, r0 -+ tst #1, r0 -+ bf .L_setup_cache_L0 -+ mov.w ccr_data,r1 -+ bra .L_setup_cache_L1 -+ nop -+.L_setup_cache_L0: -+ mov.w ccr_data_ocram,r1 -+.L_setup_cache_L1: -+ mov.l ccr_addr,r0 -+ mov.l r1,@r0 - --#ifdef VBR_SETUP -- ! save the existing contents of the vbr -- ! there will only be a prior value when using something like redboot -- ! otherwise it will be zero -- stc vbr, r1 -- mov.l old_vbr_k, r2 -- mov.l r1, @r2 -- ! setup vbr -- mov.l vbr_start_k, r1 -- ldc r1,vbr --#endif /* VBR_SETUP */ -+ ! After changing CCR, eight instructions must be executed before -+ ! it's safe to enter a cached area such as P1 -+ nop ! 1 -+ nop ! 2 -+ nop ! 3 -+ nop ! 4 -+ nop ! 5 (d-cache now safe) -+ nop ! 6 -+ mov.l init_addr,r0 ! 7 -+ mov #0,r1 ! 8 -+ jmp @r0 ! go -+ mov r1,r0 -+ nop - -- ! if an rtos is exporting a timer start fn, -- ! then pick up an SR which does not enable ints -- ! (the rtos will take care of this) -- mov.l rtos_start_fn, r0 -- mov.l sr_initial_bare, r1 -- tst r0, r0 -- bt set_sr -+init: -+ ! Save old PR on old stack so we can get to it later -+ sts.l pr,@-r15 - -- mov.l sr_initial_rtos, r1 -+ ! Save the current stack, and set a new stack (higher up in RAM) -+ mov.l old_stack_addr,r0 -+ mov.l r15,@r0 -+ mov.l new_stack_16m,r15 - --set_sr: -- ! Set status register (sr) -- ldc r1, sr -+ ! Check if 0xadffffff is a mirror of 0xacffffff, or if unique -+ ! If unique, then memory is 32MB instead of 16MB, and we must -+ ! set up new stack even higher -+ mov.l p2_mask,r0 -+ mov r0,r2 -+ or r15,r2 -+ mov #0xba,r1 -+ mov.b r1,@-r2 ! Store 0xba to 0xacffffff -+ mov.l new_stack_32m,r1 -+ or r0,r1 -+ mov #0xab,r0 -+ mov.b r0,@-r1 ! Store 0xab in 0xadffffff -+ mov.b @r1,r0 -+ mov.b @r2,r1 ! Reloaded values -+ cmp/eq r0,r1 ! Check if values match -+ bt memchk_done ! If so, mirror - we're done, move on -+ mov.l new_stack_32m,r15 ! If not, unique - set higher stack -+memchk_done: -+ mov.l mem_top_addr,r0 -+ mov.l r15,@r0 ! Save address of top of memory - -- ! arrange for exit to call fini -- mov.l atexit_k,r0 -- mov.l fini_k,r4 -- jsr @r0 -- nop -+ ! Save VBR -+ mov.l old_vbr_addr,r0 -+ stc vbr,r1 -+ mov.l r1,@r0 - --#ifdef PROFILE -- ! arrange for exit to call _mcleanup (via stop_profiling) -- mova stop_profiling,r0 -- mov.l atexit_k,r1 -- jsr @r1 -- mov r0, r4 -+ ! Save FPSCR -+ mov.l old_fpscr_addr,r0 -+ sts fpscr,r1 -+ mov.l r1,@r0 - -- ! Call profiler startup code -- mov.l monstartup_k, r0 -- mov.l start_k, r4 -- mov.l etext_k, r5 -- jsr @r0 -- nop -- -- ! enable profiling trap -- ! until now any trap 33s will have been ignored -- ! This means that all library functions called before this point -- ! (directly or indirectly) may have the profiling trap at the start. -- ! Therefore, only mcount itself may not have the extra header. -- mov.l profiling_enabled_k2, r0 -- mov #1, r1 -- mov.l r1, @r0 --#endif /* PROFILE */ -- -- ! call init -- mov.l init_k,r0 -+ ! Reset FPSCR -+ mov #4,r4 ! Use 00040000 (DN=1) -+ mov.l fpscr_addr,r0 - jsr @r0 -- nop -+ shll16 r4 - -- ! call the mainline -- mov.l main_k,r0 -- jsr @r0 -- nop -+ ! Setup a sentinel value for frame pointer in case we're using -+ ! FRAME_POINTERS for stack tracing. -+ mov #-1,r14 - -- ! call exit -- mov r0,r4 -- mov.l exit_k,r0 -+ ! Jump to the kernel main -+ mov.l main_addr,r0 - jsr @r0 - nop -- -- .balign 4 --#ifdef PROFILE --stop_profiling: -- # stop mcount counting -- mov.l profiling_enabled_k2, r0 -- mov #0, r1 -- mov.l r1, @r0 - -- # call mcleanup -- mov.l mcleanup_k, r0 -- jmp @r0 -- nop -- -- .balign 4 --mcleanup_k: -- .long __mcleanup --monstartup_k: -- .long ___monstartup --profiling_enabled_k2: -- .long profiling_enabled --start_k: -- .long _start --etext_k: -- .long __etext --#endif /* PROFILE */ -+ ! Program can return here (not likely) or jump here directly -+ ! from anywhere in it to go straight back to the monitor -+_arch_real_exit: -+ ! Reset SR -+ mov.l old_sr,r0 -+ ldc r0,sr - -- .align 2 --#if defined (__SH_FPU_ANY__) --set_fpscr_k: -- .long ___set_fpscr --#endif /* defined (__SH_FPU_ANY__) */ -+ ! Disable MMU, invalidate TLB -+ mov #4,r0 -+ mov.l mmu_addr,r1 -+ mov.l r0,@r1 - --stack_k: -- .long _stack --edata_k: -- .long _edata --end_k: -- .long _end --main_k: -- .long ___setup_argv_and_call_main --exit_k: -- .long _exit --atexit_k: -- .long _atexit --init_k: -- .long GLOBAL(_init) --fini_k: -- .long GLOBAL(_fini) --#ifdef VBR_SETUP --old_vbr_k: -- .long old_vbr --vbr_start_k: -- .long vbr_start --#endif /* VBR_SETUP */ -- --sr_initial_rtos: -- ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work. -- ! Whether profiling or not, keep interrupts masked, -- ! the RTOS will enable these if required. -- .long 0x600000f1 -+ ! Wait (just in case) -+ nop ! 1 -+ nop ! 2 -+ nop ! 3 -+ nop ! 4 -+ nop ! 5 -+ nop ! 6 -+ nop ! 7 -+ nop ! 8 - --rtos_start_fn: -- .long ___rtos_profiler_start_timer -- --#ifdef PROFILE --sr_initial_bare: -- ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work. -- ! For bare machine, we need to enable interrupts to get profiling working -- .long 0x60000001 --#else -+ ! Restore VBR -+ mov.l old_vbr,r0 -+ ldc r0,vbr - --sr_initial_bare: -- ! Privileged mode RB 1 BL 0. Keep BL 0 to allow default trap handlers to work. -- ! Keep interrupts disabled - the application will enable as required. -- .long 0x600000f1 --#endif -+ ! If we're working under dcload, call its EXIT syscall -+ mov.l dcload_magic_addr,r0 -+ mov.l @r0,r0 -+ mov.l dcload_magic_value,r1 -+ cmp/eq r0,r1 -+ bf normal_exit - -- ! supplied for backward compatibility only, in case of linking -- ! code whose main() was compiled with an older version of GCC. -- .global ___main --___main: -+ mov.l dcload_syscall,r0 -+ mov.l @r0,r0 -+ jsr @r0 -+ mov #15,r4 -+ -+ ! Set back the stack and return (presumably to a serial debug) -+normal_exit: -+ mov.l old_stack,r15 -+ lds.l @r15+,pr - rts - nop --#ifdef VBR_SETUP --! Exception handlers -- .section .text.vbr, "ax" --vbr_start: - -- .org 0x100 --vbr_100: --#ifdef PROFILE -- ! Note on register usage. -- ! we use r0..r3 as scratch in this code. If we are here due to a trapa for profiling -- ! then this is OK as we are just before executing any function code. -- ! The other r4..r7 we save explicityl on the stack -- ! Remaining registers are saved by normal ABI conventions and we assert we do not -- ! use floating point registers. -- mov.l expevt_k1, r1 -- mov.l @r1, r1 -- mov.l event_mask, r0 ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |