Check-in [c1a5de894b]
Overview
Comment:Better symbol handling
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c1a5de894bd47d134a5be1b522d31a56629627c6
User & Date: rkeene on 2019-06-05 01:41:08
Other Links: manifest | tags
Context
2019-09-05
02:24
Updated autoconf macros check-in: 47f89c20cb user: rkeene tags: trunk
2019-06-05
01:41
Better symbol handling check-in: c1a5de894b user: rkeene tags: trunk
00:38
Minor updates check-in: 6443047afb user: rkeene tags: trunk
Changes

Modified build/tcllibc.sh from [9735996eb3] to [582b3fb82f].

     1      1   #! /usr/bin/env bash
     2      2   
            3  +cflags=(-DUSE_TCL_STUBS=1 -fPIC)
            4  +ldflags=()
            5  +libs=(-ltclstub8.6)
            6  +
     3      7   inFiles=(
     4      8   	../../tcllib-fossil/modules/tcllibc.tcl
     5      9   	../../tcllib-fossil/modules/md4/md4c.tcl
     6     10   	../../tcllib-fossil/modules/struct/graph_c.tcl
     7     11   	../../tcllib-fossil/modules/base32/base32_c.tcl
     8     12   	../../tcllib-fossil/modules/struct/sets_c.tcl
     9     13   	../../tcllib-fossil/modules/json/jsonc.tcl
................................................................................
    47     51   rm -rf "${outDir}"
    48     52   mkdir "${outDir}"
    49     53   
    50     54   for input in "${inFiles[@]}"; do
    51     55   	out="${outDir}/$(basename "${input}" .tcl)"
    52     56   
    53     57   	./tcc-critcl-to-c.tcl --mode direct "${input}" > "${out}.c"
    54         -	cflags=($(awk '/^CLI:/{ gsub(/^CLI:/, ""); print; }' < "${out}.c"))
           58  +	input_cflags=($(awk '/^CLI:/{ gsub(/^CLI:/, ""); print; }' < "${out}.c"))
    55     59   
    56         -	"${CC:-cc}" -fPIC -Dinline= -o "${out}.o" "${cflags[@]}" -c "${out}.c" || continue
           60  +	"${CC:-cc}" "${cflags[@]}" -Dinline= -o "${out}.o" "${input_cflags[@]}" -c "${out}.c" || continue
    57     61   done
    58     62   
    59     63   (
    60     64   	cd "${outDir}" || exit 1
    61     65   
    62     66   	cat << \_EOF_ > base.c
    63     67   #include <tcl.h>
................................................................................
    97    101   
    98    102   	Tcl_PkgProvide(interp, "tcllibc", "0");
    99    103   
   100    104   	return(TCL_OK);
   101    105   }
   102    106   _EOF_
   103    107   
   104         -	"${CC:-cc}" -fPIC -o base.o -c base.c
          108  +	"${CC:-cc}" "${cflags[@]}" -o base.o -c base.c
   105    109   )
   106    110   
   107         -"${CC:-cc}" -fPIC -shared -o tcllibc.so "${outDir}"/*.o
          111  +cat << \_EOF_ > "${outDir}/version-script"
          112  +{
          113  +	global:
          114  +		Tcllibc_Init;
          115  +	local:
          116  +		*;
          117  +};
          118  +_EOF_
          119  +
          120  +"${CC:-cc}" "${cflags[@]}" "${ldflags[@]}" -Wl,--version-script,"${outDir}/version-script" -shared -o tcllibc.so "${outDir}"/*.o "${libs[@]}"
          121  +"${OBJCOPY:-objcopy}" --keep-global-symbol Tcllibc_Init tcllibc.so
          122  +"${OBJCOPY:-objcopy}" --discard-all tcllibc.so
   108    123   
   109    124   exit 0