support for shared libgcc in vhex

pull/2/head
Lephenixnoir 11 months ago
parent 164b33b26d
commit e71f9867e2
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
  1. 5
      CMakeLists.txt
  2. 27
      cmake/toolchain-vhex.cmake
  3. 4
      src/libc/signal/raise.c
  4. 12
      src/libc/stdlib/target/vhex-sh/_Exit.S

@ -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

@ -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
)

@ -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*/

@ -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
Loading…
Cancel
Save