diff --git a/Elf2Mac/LdScript.cc b/Elf2Mac/LdScript.cc index 146bfb3152..2e551a3900 100644 --- a/Elf2Mac/LdScript.cc +++ b/Elf2Mac/LdScript.cc @@ -55,6 +55,7 @@ const char * textSection = R"ld(/* ld script for Elf2Mac */ */libretrocrt.a:start.c.obj(.text*) */libretrocrt.a:relocate.c.obj(.text*) */libretrocrt.a:*(.text*) + */libInterface.a:*(.text*) *(.text*) *(.stub) diff --git a/Elf2Mac/SegmentMap.cc b/Elf2Mac/SegmentMap.cc index 838dc5275b..cdf7730e5b 100644 --- a/Elf2Mac/SegmentMap.cc +++ b/Elf2Mac/SegmentMap.cc @@ -35,7 +35,8 @@ SegmentMap::SegmentMap() "*/libretrocrt.a:MultiSegApp.c.obj", "*/libretrocrt.a:LoadSeg.s.obj", "*/libretrocrt.a:*", - "*/libgcc.a:*", + "*/libInterface.a:*", + "*/libgcc.a:*", "*/libc.a:*" ); segments.emplace_back(5, "libstdc++ locale", @@ -65,6 +66,7 @@ SegmentMap::SegmentMap(std::string filename) "*/libretrocrt.a:MultiSegApp.c.obj", "*/libretrocrt.a:LoadSeg.s.obj", "*/libretrocrt.a:*", + "*/libInterface.a:*", "*/libgcc.a:*", "*/libc.a:*" ); diff --git a/build-toolchain.bash b/build-toolchain.bash index 4ff7ada5ab..a1924b3311 100755 --- a/build-toolchain.bash +++ b/build-toolchain.bash @@ -238,7 +238,7 @@ fi if [ $BUILD_68K != false ]; then if locateInterfaceThing INTERFACE_O Interface.o; then - true + M68KLIBRARIES=`dirname "$INTERFACE_O"` else echo "Could not find Interface.o anywhere inside InterfaceAndLibraries/" echo "(This file is required for 68K support only)" @@ -264,7 +264,7 @@ if [ $BUILD_PPC != false ]; then else echo "Could not find OpenTransportAppPPC.o anywhere inside InterfaceAndLibraries/" echo "(This file is required for OpenTransport on PPC only)" -fi + fi fi @@ -487,6 +487,22 @@ if [ $BUILD_PPC != false ]; then linkheaders toolchain/powerpc-apple-macos/include fi +if [ $BUILD_68K != false ]; then + echo "Converting 68K static libraries..." + for macobj in "${M68KLIBRARIES}/"*.o; do + if [ -r $macobj ]; then + libname=`basename "$macobj"` + libname=${libname%.o} + printf " %30s => %-30s\n" ${libname}.o lib${libname}.a + obj="toolchain/m68k-apple-macos/lib/$libname.o" + lib="toolchain/m68k-apple-macos/lib/lib${libname}.a" + rm -f $lib + + (ConvertObj "$macobj" | m68k-apple-macos-as - -o $obj) && m68k-apple-macos-ar cqs $lib $obj + fi + done +fi + if [ $BUILD_PPC != false ]; then case `ResInfo -n "$INTERFACELIB" || echo 0` in 0) @@ -531,12 +547,9 @@ if [ $BUILD_68K != false ]; then mkdir -p build-target cd build-target - INTERFACE_O=`find "$SRC/InterfacesAndLibraries" -name ".*" -prune -o -name Interface.o -print` - cmake ${SRC} -DCMAKE_TOOLCHAIN_FILE=../build-host/cmake/intree.toolchain.cmake \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \ - "-DINTERFACE_O=${INTERFACE_O}" \ ${CMAKE_GENERATOR} cd .. cmake --build build-target --target install diff --git a/gcc/gcc/config/m68k/m68k-macos.h b/gcc/gcc/config/m68k/m68k-macos.h index 5a84ffce49..147be05868 100644 --- a/gcc/gcc/config/m68k/m68k-macos.h +++ b/gcc/gcc/config/m68k/m68k-macos.h @@ -1,11 +1,11 @@ -#define LIBGCC_SPEC "--start-group -lretrocrt -lgcc --end-group" +#define LIBGCC_SPEC "--start-group -lretrocrt -lgcc --end-group -lInterface" #define LINK_SPEC "-elf2mac -q -undefined=_consolewrite" #undef LIB_SPEC -#define LIB_SPEC "--start-group -lc -lretrocrt --end-group" +#define LIB_SPEC "--start-group -lc -lretrocrt --end-group -lInterface" -#define LINK_GCC_C_SEQUENCE_SPEC "--start-group -lgcc -lc -lretrocrt --end-group" +#define LINK_GCC_C_SEQUENCE_SPEC "--start-group -lgcc -lc -lretrocrt --end-group -lInterface" #undef STARTFILE_SPEC diff --git a/libretro/CMakeLists.txt b/libretro/CMakeLists.txt index ea46fdde5e..0a8a4bf2a0 100644 --- a/libretro/CMakeLists.txt +++ b/libretro/CMakeLists.txt @@ -22,16 +22,8 @@ # . if(CMAKE_SYSTEM_NAME MATCHES Retro68) - find_program(CONVERT_OBJ ConvertObj PATH "${CMAKE_INSTALL_PREFIX}/../bin/") - - set(INTERFACE_O InterfaceO_NOTFOUND CACHE STRING "path to MPW Interface.o file") - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Interface.s - COMMAND ${CONVERT_OBJ} ${INTERFACE_O} > ${CMAKE_CURRENT_BINARY_DIR}/Interface.s - ) - enable_language(ASM) - - set(ARCH_FILES + enable_language(ASM) + set(ARCH_FILES Retro68Runtime.h start.c relocate.c @@ -39,7 +31,6 @@ if(CMAKE_SYSTEM_NAME MATCHES Retro68) MultiSegApp.c LoadSeg.s # glue.c - ${CMAKE_CURRENT_BINARY_DIR}/Interface.s qdglobals.c Retro68.r Retro68APPL.r