support for shared libgcc in vhex

This commit is contained in:
Lephenixnoir 2021-11-07 18:05:33 +01:00
parent 164b33b26d
commit e71f9867e2
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
4 changed files with 42 additions and 6 deletions

View File

@ -20,14 +20,14 @@ if(FXLIBC_TARGET STREQUAL vhex-sh)
list(APPEND TARGET_FOLDERS vhex-generic sh-generic)
set(FXLIBC_ARCH sh)
add_definitions(-D__SUPPORT_VHEX_KERNEL)
set(FXLIBC_SHARED ON)
# set(FXLIBC_SHARED ON)
endif()
if(FXLIBC_TARGET STREQUAL vhex-x86)
list(APPEND TARGET_FOLDERS vhex-generic x86-generic)
set(FXLIBC_ARCH x86)
add_definitions(-D__SUPPORT_VHEX_KERNEL)
set(FXLIBC_SHARED ON)
# set(FXLIBC_SHARED ON)
# TODO: Maybe add -nostdinc (but that removes compiler-provided headers like
# <stddef.h>), or use another compiler than the system one?
endif()
@ -206,6 +206,7 @@ if(vhex-sh IN_LIST TARGET_FOLDERS)
list(APPEND SOURCES
src/libc/signal/target/vhex-sh/kill.S
src/libc/signal/target/vhex-sh/signal.S
src/libc/stdlib/target/vhex-sh/_Exit.S
src/libc/stdlib/target/vhex-sh/free.S
src/libc/stdlib/target/vhex-sh/malloc.S
src/libc/stdlib/target/vhex-sh/realloc.S

View File

@ -0,0 +1,27 @@
# Vhex toolchain file for chad Casio graphing calculators
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR sh)
set(CMAKE_C_COMPILER sh-elf-vhex-gcc)
set(CMAKE_CXX_COMPILER sh-elf-vhex-g++)
set(CMAKE_C_FLAGS_INIT "")
set(CMAKE_CXX_FLAGS_INIT "")
add_compile_options(-nostdlib)
add_link_options(-nostdlib)
link_libraries(-lgcc)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# Determine compiler install path
execute_process(
COMMAND ${CMAKE_C_COMPILER} --print-file-name=.
OUTPUT_VARIABLE FXSDK_COMPILER_INSTALL
OUTPUT_STRIP_TRAILING_WHITESPACE
)

View File

@ -3,8 +3,6 @@
#include <stdlib.h>
#include "signal_p.h"
#ifndef __SUPPORT_VHEX_KERNEL
int raise(int sig)
{
if(sig < 0 || sig >= _NSIG)
@ -31,5 +29,3 @@ int raise(int sig)
signal(sig, handler);
return 0;
}
#endif /*! __SUPPORT_VHEX_KERNEL*/

View File

@ -0,0 +1,12 @@
#include <bits/asm/unistd_32.h>
.text
.global __Exit
.type __Exit, @function
.align 2
__Exit:
trapa #__NR_exit
rts
nop
.end