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
2




3
4
5
6
7
8
9
#! /usr/bin/env bash





inFiles=(
	../../tcllib-fossil/modules/tcllibc.tcl
	../../tcllib-fossil/modules/md4/md4c.tcl
	../../tcllib-fossil/modules/struct/graph_c.tcl
	../../tcllib-fossil/modules/base32/base32_c.tcl
	../../tcllib-fossil/modules/struct/sets_c.tcl
	../../tcllib-fossil/modules/json/jsonc.tcl


>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
#! /usr/bin/env bash

cflags=(-DUSE_TCL_STUBS=1 -fPIC)
ldflags=()
libs=(-ltclstub8.6)

inFiles=(
	../../tcllib-fossil/modules/tcllibc.tcl
	../../tcllib-fossil/modules/md4/md4c.tcl
	../../tcllib-fossil/modules/struct/graph_c.tcl
	../../tcllib-fossil/modules/base32/base32_c.tcl
	../../tcllib-fossil/modules/struct/sets_c.tcl
	../../tcllib-fossil/modules/json/jsonc.tcl
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
rm -rf "${outDir}"
mkdir "${outDir}"

for input in "${inFiles[@]}"; do
	out="${outDir}/$(basename "${input}" .tcl)"

	./tcc-critcl-to-c.tcl --mode direct "${input}" > "${out}.c"
	cflags=($(awk '/^CLI:/{ gsub(/^CLI:/, ""); print; }' < "${out}.c"))

	"${CC:-cc}" -fPIC -Dinline= -o "${out}.o" "${cflags[@]}" -c "${out}.c" || continue
done

(
	cd "${outDir}" || exit 1

	cat << \_EOF_ > base.c
#include <tcl.h>







|

|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
rm -rf "${outDir}"
mkdir "${outDir}"

for input in "${inFiles[@]}"; do
	out="${outDir}/$(basename "${input}" .tcl)"

	./tcc-critcl-to-c.tcl --mode direct "${input}" > "${out}.c"
	input_cflags=($(awk '/^CLI:/{ gsub(/^CLI:/, ""); print; }' < "${out}.c"))

	"${CC:-cc}" "${cflags[@]}" -Dinline= -o "${out}.o" "${input_cflags[@]}" -c "${out}.c" || continue
done

(
	cd "${outDir}" || exit 1

	cat << \_EOF_ > base.c
#include <tcl.h>
97
98
99
100
101
102
103
104
105
106









107


108
109

	Tcl_PkgProvide(interp, "tcllibc", "0");

	return(TCL_OK);
}
_EOF_

	"${CC:-cc}" -fPIC -o base.o -c base.c
)










"${CC:-cc}" -fPIC -shared -o tcllibc.so "${outDir}"/*.o



exit 0







|


>
>
>
>
>
>
>
>
>
|
>
>


101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

	Tcl_PkgProvide(interp, "tcllibc", "0");

	return(TCL_OK);
}
_EOF_

	"${CC:-cc}" "${cflags[@]}" -o base.o -c base.c
)

cat << \_EOF_ > "${outDir}/version-script"
{
	global:
		Tcllibc_Init;
	local:
		*;
};
_EOF_

"${CC:-cc}" "${cflags[@]}" "${ldflags[@]}" -Wl,--version-script,"${outDir}/version-script" -shared -o tcllibc.so "${outDir}"/*.o "${libs[@]}"
"${OBJCOPY:-objcopy}" --keep-global-symbol Tcllibc_Init tcllibc.so
"${OBJCOPY:-objcopy}" --discard-all tcllibc.so

exit 0