From ca39be4e1d7d5bfe54609b7913e6afd7dd22a305 Mon Sep 17 00:00:00 2001
From: Stewart Brodie <sbrodie@gitlab.riscosopen.org>
Date: Fri, 11 Aug 2000 13:33:44 +0000
Subject: [PATCH] Added cut-down target which excludes RISC_OSLib.

Detail:
  This component now supports multiple TARGETs being passed in:
    Pass in CLib for a minimal C library excluding RISC_OSLib.
    Pass in RISC_OSLib to continue to build the full thing.
  BuildSys will be modified to make SharedCLibrary build ONLY
    the minimal library - this may mean that products that are
    to be updated may have to alter their components file to
    take the new SharedRISC_OSLib component instead of the
    SharedCLibrary target.
  syms.A_Entries is now automatically generated from C_Entries
    because this is the easiest way to generate the file.  If
    extra symbols are added to C_Entries, they will need to be
    removed by the egrep command which strips out _swi and _swix.
  Makefile tidied to be more careful about ${COMPONENT} and ${TARGET}
  clean_all rule improved to really clean things properly.
Admin:
  Tested in STB400-2M build and on desktop build.
  Requires BuildSys-2_41 or later.

Version 5.11. Tagged as 'RISC_OSLib-5_11'
---
 Makefile          |  72 ++++++++++----
 MkClean,fd7       |   1 +
 MkRomFull,fd7     |  18 ++++
 VersionASM        |  12 +--
 VersionNum        |  18 ++--
 clib/s/initmod_rm |  25 +++++
 syms/A_Entries    | 245 ----------------------------------------------
 7 files changed, 110 insertions(+), 281 deletions(-)
 create mode 100644 MkRomFull,fd7
 create mode 100644 clib/s/initmod_rm
 delete mode 100644 syms/A_Entries

diff --git a/Makefile b/Makefile
index 265d5a7..9667bcd 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,11 @@
 # 28-Sep-94  AMcC         Now exports some internal headers for Edit
 #
 
+# Set default component and target.
+# Alternative possible target is RISC_OSLib
+COMPONENT .= SharedCLibrary
+TARGET    .= CLib
+
 #
 # Paths
 #
@@ -240,8 +245,7 @@ EXPORTED_LIBS =\
 
 MODWRAP   = RISC_OSLib:s.modulewrap
 
-COMPONENT = RISC_OSLib
-TARGET    = aof.RISC_OSLib
+OBJECT    = aof.${TARGET}
 EXPORTS   = ${MODWRAP} \
             ${EXPORTED_LIBS} \
             ${HEADERS} \
@@ -282,6 +286,14 @@ RM_OBJS =\
 # Objects for lib.clib (relocatable module)
 #
 CLIB_MOD_OBJS =\
+ rm_o.cl_rmhdr \
+ o.initmodule \
+ ${RM_OBJS}
+
+#
+# Objects for a C library only ROM shared library
+#
+CLIB_ROM_OBJS =\
  rm_o.cl_rmhdr \
  rm_o.initmodule \
  ${RM_OBJS}
@@ -384,7 +396,7 @@ RLIB_MOD_OBJS =\
 #
 # Build rules:
 #
-rom: ${TARGET}
+rom: ${OBJECT}
 	@echo ${COMPONENT}: rom library built
 
 export: export_${PHASE}
@@ -394,8 +406,8 @@ export_hdrs: ${EXP_HDR}.SharedCLib; @
 
 export_libs: ${EXPORTS} dirs; @
 
-install_rom: ${TARGET}
-	${CP} ${TARGET} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
+install_rom: ${OBJECT}
+	${CP} ${OBJECT} ${INSTDIR}.${TARGET} ${CPFLAGS}
 	@echo ${COMPONENT}: rom library installed
 
 clean:
@@ -409,20 +421,19 @@ clean_all:
 	${WIPE} rm_o_rl.* ${WFLAGS}
 	${WIPE} linked.* ${WFLAGS}
 	${WIPE} map.* ${WFLAGS}
-	${RM} ${TARGET}
-	${RM} syms.RISC_OSLib
-	${RM} syms.Entries
-	${RM} syms.C_Entries
+	${WIPE} aof.* ${WFLAGS}
+	${WIPE} syms.* ${WFLAGS}
 	${RM} derived.swis
 	${RM} s.swioptions
 	${RM} s.abssym
 	${RM} s.c_abssym
 	${RM} s.a_abssym
+	${RM} rlib.s.asmdefs
 	${WIPE} lib.* ${WFLAGS}
 	@echo ${COMPONENT}: cleaned
 
 resources:
-	${MKDIR} ${RESDIR}.${COMPONENT}
+	${MKDIR} ${RESDIR}.RISC_OSLib
 	${MKDIR} ${RESDIR}.CLib
 	IfThere clib.Resources.${LOCALE}.<System>.Messages Then Set MessagesFile clib.Resources.${LOCALE}.<System>.Messages else Set MessagesFile clib.Resources.${LOCALE}.Messages
 	${CP} <MessagesFile> ${RESDIR}.CLib.Messages ${CPFLAGS}
@@ -444,27 +455,42 @@ dirs:
 #
 # ROM target {re-linked at ROM Image build time}
 #
-${TARGET}: ${ROM_OBJS}
+aof.RISC_OSLib: ${ROM_OBJS}
 	${LD} -o $@ -aof ${ROM_OBJS}
 
+aof.CLib: ${CLIB_ROM_OBJS}
+	${LD} -o $@ -aof ${CLIB_ROM_OBJS}
+
 #
 # Final link for the ROM Image {using given base address}
 #
-rom_link:
-	${LD} -o linked.RISC_OSLib ${ROM_OBJS} \
-              -symbols syms.RISC_OSLib \
+linked.RISC_OSLib: ${ROM_OBJS}
+	${LD} -o $@ ${ROM_OBJS} \
+              -symbols syms.${TARGET} \
+              -bin -base ${ADDRESS} \
+              -map > map.${TARGET}
+
+linked.CLib: ${CLIB_ROM_OBJS}
+	${LD} -o $@ ${CLIB_ROM_OBJS} \
+              -symbols syms.${TARGET} \
               -bin -base ${ADDRESS} \
-              -map > map.RISC_OSLib
-	${CP} linked.RISC_OSLib ${LINKDIR}.RISC_OSLib ${CPFLAGS}
+              -map > map.${TARGET}
+
+rom_link: linked.${TARGET}
+	${CP} linked.${TARGET} ${LINKDIR}.${TARGET} ${CPFLAGS}
 	|
-	xtentries syms.Entries kernel.s.k_entries clib.s.cl_entries rlib.s.rl_entries
+	if "${TARGET}"="RISC_OSLib" Then Set ExtraLibs$xtentries rlib.s.rl_entries Else Unset ExtraLibs$xtentries
+	do xtentries syms.Entries kernel.s.k_entries clib.s.cl_entries <ExtraLibs$xtentries>
+	unset ExtraLibs$xtentries
 	print rlib.swi { >> syms.Entries }
 	xtentries syms.C_Entries kernel.s.k_entries clib.s.cl_entries
 	print rlib.swi { >> syms.C_Entries }
+	| C_Entries *currently* only adds _swi/_swix to RO2 symbols.
+	egrep -v "^_swix?$" < syms.C_Entries > syms.A_Entries
 	|
-	symgen syms.Entries syms.RISC_OSLib s.abssym
-	symgen syms.C_Entries syms.RISC_OSLib s.c_abssym
-	symgen syms.A_Entries syms.RISC_OSLib s.a_abssym
+	symgen syms.Entries syms.${TARGET} s.abssym
+	symgen syms.C_Entries syms.${TARGET} s.c_abssym
+	symgen syms.A_Entries syms.${TARGET} s.a_abssym
 	|
 	${OBJASM} ${AFLAGS} -from s.abssym -to o.abssym
 	${OBJASM} ${AFLAGS} -from s.c_abssym -to o.c_abssym
@@ -636,6 +662,7 @@ rm_o.clib:  clib.s.cl_obj_r
 	${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.cl_obj_r -to $@
 
 rm_o.cl_modbody: clib.s.cl_mod_r
+	${CP} rlib.s.rom_defs rlib.s.asmdefs ${CPFLAGS}
 	${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.cl_mod_r -to $@
 
 rm_o_rl.rl_modbody: rlib.s.rl_mod_r
@@ -647,9 +674,12 @@ rm_o.k_modbody: kernel.s.k_mod_r
 rm_o.memcpy: s.memcpy s.h_regs
 	${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from s.memcpy -to $@
 
-rm_o.initmodule: clib.s.initmod_r
+o.initmodule: clib.s.initmod_r
 	${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.initmod_r -to $@
 
+rm_o.initmodule: clib.s.initmod_rm
+	${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from clib.s.initmod_rm -to $@
+
 rm_o_rl.initmodule: rlib.s.initmod_r
 	${OBJASM} ${AFLAGS} ${ASFLAGS} ${OPTIONS} -from rlib.s.initmod_r -to $@
 
diff --git a/MkClean,fd7 b/MkClean,fd7
index c28ba1d..c327cb2 100644
--- a/MkClean,fd7
+++ b/MkClean,fd7
@@ -15,4 +15,5 @@
 Dir <Obey$Dir>
 echo amu_machine clean_all
 amu_machine clean_all
+stripdepnd Makefile
 echo MkClean: all done
\ No newline at end of file
diff --git a/MkRomFull,fd7 b/MkRomFull,fd7
new file mode 100644
index 0000000..082eb9b
--- /dev/null
+++ b/MkRomFull,fd7
@@ -0,0 +1,18 @@
+| Copyright 2000 Pace Micro Technology plc
+|
+| Licensed under the Apache License, Version 2.0 (the "License");
+| you may not use this file except in compliance with the License.
+| You may obtain a copy of the License at
+|
+|     http://www.apache.org/licenses/LICENSE-2.0
+|
+| Unless required by applicable law or agreed to in writing, software
+| distributed under the License is distributed on an "AS IS" BASIS,
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+| See the License for the specific language governing permissions and
+| limitations under the License.
+|
+Dir <Obey$Dir>
+wimpslot -min 1000k
+echo amu_machine rom TARGET=RISC_OSLib COMPONENT=SharedRISC_OSLib
+amu_machine rom TARGET=RISC_OSLib COMPONENT=SharedRISC_OSLib
diff --git a/VersionASM b/VersionASM
index 05d0352..c9b8f84 100644
--- a/VersionASM
+++ b/VersionASM
@@ -8,11 +8,11 @@
                         GBLS    Module_FullVersion
                         GBLS    Module_ApplicationDate2
                         GBLS    Module_ApplicationDate4
-Module_MajorVersion     SETS    "5.10"
-Module_Version          SETA    510
+Module_MajorVersion     SETS    "5.11"
+Module_Version          SETA    511
 Module_MinorVersion     SETS    ""
-Module_Date             SETS    "03 Jul 2000"
-Module_ApplicationDate2 SETS    "03-Jul-00"
-Module_ApplicationDate4 SETS    "03-Jul-2000"
-Module_FullVersion      SETS    "5.10"
+Module_Date             SETS    "11 Aug 2000"
+Module_ApplicationDate2 SETS    "11-Aug-00"
+Module_ApplicationDate4 SETS    "11-Aug-2000"
+Module_FullVersion      SETS    "5.11"
                         END
diff --git a/VersionNum b/VersionNum
index ae67bf9..81e027b 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,18 +1,18 @@
-/* (5.10)
+/* (5.11)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  *
  */
-#define Module_MajorVersion_CMHG        5.10
+#define Module_MajorVersion_CMHG        5.11
 #define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                03 Jul 2000
+#define Module_Date_CMHG                11 Aug 2000
 
-#define Module_MajorVersion             "5.10"
-#define Module_Version                  510
+#define Module_MajorVersion             "5.11"
+#define Module_Version                  511
 #define Module_MinorVersion             ""
-#define Module_Date                     "03 Jul 2000"
+#define Module_Date                     "11 Aug 2000"
 
-#define Module_ApplicationDate2         "03-Jul-00"
-#define Module_ApplicationDate4         "03-Jul-2000"
+#define Module_ApplicationDate2         "11-Aug-00"
+#define Module_ApplicationDate4         "11-Aug-2000"
 
-#define Module_FullVersion              "5.10"
+#define Module_FullVersion              "5.11"
diff --git a/clib/s/initmod_rm b/clib/s/initmod_rm
new file mode 100644
index 0000000..608527f
--- /dev/null
+++ b/clib/s/initmod_rm
@@ -0,0 +1,25 @@
+; Copyright 2000 Pace Micro Technology plc
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;     http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+        GBLL    Brazil_Compatible
+        GBLS    Calling_Standard
+        GBLL    ModeMayBeNonUser
+        GBLS    Code_Destination
+
+Brazil_Compatible  SETL  {FALSE}
+Calling_Standard   SETS  "APCS_U"
+ModeMayBeNonUser   SETL  {TRUE}
+Code_Destination   SETS  "ROM"
+
+        LNK     s.InitModule
diff --git a/syms/A_Entries b/syms/A_Entries
deleted file mode 100644
index b9e7962..0000000
--- a/syms/A_Entries
+++ /dev/null
@@ -1,245 +0,0 @@
-_kernel_init
-_kernel_exit
-_kernel_setreturncode
-_kernel_exittraphandler
-_kernel_unwind
-_kernel_procname
-_kernel_language
-_kernel_command_string
-_kernel_hostos
-_kernel_swi
-_kernel_osbyte
-_kernel_osrdch
-_kernel_oswrch
-_kernel_osbget
-_kernel_osbput
-_kernel_osgbpb
-_kernel_osword
-_kernel_osfind
-_kernel_osfile
-_kernel_osargs
-_kernel_oscli
-_kernel_last_oserror
-_kernel_system
-_kernel_getenv
-_kernel_setenv
-_kernel_register_allocs
-_kernel_alloc
-_kernel_stkovf_split_0frame
-_kernel_stkovf_split
-_kernel_stkovf_copyargs
-_kernel_stkovf_copy0args
-_kernel_udiv
-_kernel_urem
-_kernel_udiv10
-__rt_udiv10
-_kernel_sdiv
-_kernel_srem
-_kernel_sdiv10
-__rt_sdiv10
-_kernel_fpavailable
-_kernel_moduleinit
-_kernel_irqs_on
-_kernel_irqs_off
-_kernel_irqs_disabled
-_kernel_entermodule
-_kernel_escape_seen
-_kernel_current_stack_chunk
-_kernel_swi_c
-_kernel_register_slotextend
-_kernel_raise_error
-TrapHandler
-UncaughtTrapHandler
-EventHandler
-UnhandledEventHandler
-x$stack_overflow
-__rt_stkovf_split_small
-x$stack_overflow_1
-__rt_stkovf_split_big
-x$udivide
-__rt_udiv
-x$uremainder
-x$divide
-__rt_sdiv
-x$divtest
-__rt_divtest
-x$remainder
-x$multiply
-_rd1chk
-__rt_rd1chk
-_rd2chk
-__rt_rd2chk
-_rd4chk
-__rt_rd4chk
-_wr1chk
-__rt_wr1chk
-_wr2chk
-__rt_wr2chk
-_wr4chk
-__rt_wr4chk
-_main
-_exit
-_clib_initialise
-_backtrace
-_count
-_count1
-_stfp
-_ldfp
-_printf
-_fprintf
-_sprintf
-clock
-difftime
-mktime
-time
-asctime
-ctime
-gmtime
-localtime
-strftime
-memcpy
-memmove
-strcpy
-strncpy
-strcat
-strncat
-memcmp
-strcmp
-strncmp
-memchr
-strchr
-strcspn
-strpbrk
-strrchr
-strspn
-strstr
-strtok
-memset
-strerror
-strlen
-atof
-atoi
-atol
-strtod
-strtol
-strtoul
-rand
-srand
-calloc
-free
-malloc
-realloc
-abort
-atexit
-exit
-getenv
-system
-bsearch
-qsort
-abs
-div
-labs
-ldiv
-remove
-rename
-tmpfile
-__old_tmpnam
-fclose
-fflush
-fopen
-freopen
-setbuf
-setvbuf
-printf
-fprintf
-sprintf
-scanf
-fscanf
-sscanf
-vprintf
-vfprintf
-vsprintf
-_vfprintf
-fgetc
-fgets
-fputc
-fputs
-__filbuf
-getc
-getchar
-gets
-__flsbuf
-putc
-putchar
-puts
-ungetc
-fread
-fwrite
-fgetpos
-fseek
-fsetpos
-ftell
-rewind
-clearerr
-feof
-ferror
-perror
-__ignore_signal_handler
-__default_signal_handler
-__error_signal_marker
-signal
-raise
-setjmp
-longjmp
-acos
-asin
-atan
-atan2
-cos
-sin
-tan
-cosh
-sinh
-tanh
-exp
-frexp
-ldexp
-log
-log10
-modf
-pow
-sqrt
-ceil
-fabs
-floor
-fmod
-setlocale
-isalnum
-isalpha
-iscntrl
-isdigit
-isgraph
-islower
-isprint
-ispunct
-isspace
-isupper
-isxdigit
-tolower
-toupper
-__assert
-_memcpy
-_memset
-localeconv
-mblen
-mbtowc
-wctomb
-mbstowcs
-wcstombs
-strxfrm
-strcoll
-_clib_finalisemodule
-_clib_version
-_CLib_Finalise
-tmpnam
-_Shared_Lib_Module_SWI_Code
-- 
GitLab