blob: 06a7e0249fc9708647054dd7dfbe13fc0181ffa5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
#!/bin/sh
olib=/usr/lib
nlib=/usr/lib/aout
fixlib()
{
dir=$1
shift
crt=$1
shift
if [ ! -f $olib/$crt ]; then
if [ ! -f $nlib/$crt ]; then
echo "Warning: Can't find $crt" >&2
else
for i in "$@"
do
sed "s:$olib/$crt:$nlib/$crt:" $dir/$i >$dir/$i.tmp &&
mv -f $dir/$i.tmp $dir/$i || exit 1
done
fi
fi
}
#
# Update tcc common environment.
#
# Create $WRKSRC/src/lib/env/freebsd/common/80x86/pthread
cat >$WRKSRC/src/lib/env/freebsd/common/80x86/pthread <<EOF
/* Build with pthreads library */
+SYS_LIBC "-lc_r"
EOF
#
# Create tcc aout environment.
#
mkdir $WRKSRC/src/lib/env/freebsd/aout
mkdir $WRKSRC/src/lib/env/freebsd/aout/80x86
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-P5
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-P5 <<EOF
+FLAG_TRANS "-K5"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-aout
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-aout <<EOF
/* This is default */
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-PIC
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-PIC <<EOF
/* empty */
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-frame
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-frame <<EOF
+FLAG_TRANS "-a"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-i386
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-i386 <<EOF
+FLAG_TRANS "-K3"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-i486
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-i486 <<EOF
+FLAG_TRANS "-K4"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/K-noframe
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/K-noframe <<EOF
/* This is default */
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p <<EOF
+FLAG_TRANS "-Z1"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p1
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p1 <<EOF
+FLAG_TRANS "-Z1"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p2
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p2 <<EOF
+FLAG_TRANS "-Z2"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p4
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/Z-p4 <<EOF
+FLAG_TRANS "-Z4"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/default.extra
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/default.extra <<EOF
+MACHINE "freebsd-*-80x86"
+TRANS "-BINDIR-/trans -k0"
+AS "/usr/bin/as"
+LD "/usr/bin/ld -e start -dc -dp"
+CC "/usr/bin/cc"
+CRT0 "/usr/lib/crt0.o"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_diag
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_diag <<EOF
/* TCC ENVIRONMENT : DIAGNOSTICS FOR FreeBSD */
+CRT0 "/usr/lib/crt0.o"
<LINK "-L-LIBDIR-/diag"
>SYS_LIB "-static -lg"
EOF
# Create $WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_prof
cat >$WRKSRC/src/lib/env/freebsd/aout/80x86/tcc_prof <<EOF
/* TCC ENVIRONMENT : PROFILING FOR FreeBSD */
+CRT0 "/usr/lib/gcrt0.o"
<SYS_LINK "-static -lgmon -lc_p"
+FLAG_TRANS "-P"
+LINE_START "#pragma@preserve@*"
EOF
#
# Create tcc elf environment.
#
mkdir $WRKSRC/src/lib/env/freebsd/elf
mkdir $WRKSRC/src/lib/env/freebsd/elf/80x86
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-P5
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-P5 <<EOF
+FLAG_TRANS "-K5"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-aout
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-aout <<EOF
/* TCC ENVIRONMENT : producing old "a.out" for FreeBSD */
+FLAG_TRANS "-k0"
+AS "/usr/libexec/aout/as"
+LD "/usr/libexec/aout/ld"
+CRT0 "/usr/lib/aout/crt0.o"
+CRT1 ""
+CRTN ""
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-frame
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-frame <<EOF
+FLAG_TRANS "-a"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-i386
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-i386 <<EOF
+FLAG_TRANS "-K3"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-i486
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-i486 <<EOF
+FLAG_TRANS "-K4"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/K-noframe
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/K-noframe <<EOF
/* This is default */
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p <<EOF
+FLAG_TRANS "-Z1"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p1
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p1 <<EOF
+FLAG_TRANS "-Z1"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p2
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p2 <<EOF
+FLAG_TRANS "-Z2"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p4
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/Z-p4 <<EOF
+FLAG_TRANS "-Z4"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/default.extra
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/default.extra <<EOF
+MACHINE "freebsd-*-80x86"
+AS "/usr/bin/as"
+LD "/usr/bin/ld -m elf_i386"
+CC "/usr/bin/cc"
+CRT0 "-dynamic-linker /usr/libexec/ld-elf.so.1 /usr/lib/crt1.o"
+CRT1 "/usr/lib/crti.o /usr/lib/crtbegin.o"
+CRTN "/usr/lib/crtend.o /usr/lib/crtn.o"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/system
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/system <<EOF
/* tcc environment for system headers on unknown machine */
+INCL "-Nsystem1:-MACHDIR-/include -Nsystem:/usr/include"
+FLAG "-D__FREEBSD_USE_ELF"
+FLAG "-f-MACHDIR-/startup/system.h"
+FLAG "-Y32bit"
+FLAG_TRANS "-B0"
+API_NAME "-Asystem1 -Asystem"
+INFO "System@Headers"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/system+
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/system+ <<EOF
/* tcc environment for system headers on unknown machine */
>INCL "-Nsystem1:-MACHDIR-/include -Nsystem:/usr/include"
+FLAG "-D__FREEBSD_USE_ELF"
+FLAG "-f-MACHDIR-/startup/system.h"
+FLAG "-Y32bit"
+FLAG_TRANS "-B0"
>API_NAME "-Asystem1 -Asystem"
>INFO "System@Headers"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/tcc_diag
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/tcc_diag <<EOF
/* TCC ENVIRONMENT : DIAGNOSTICS FOR FreeBSD */
<LINK "-L-LIBDIR-/diag"
>SYS_LIB "-static -g"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/tcc_prof
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/tcc_prof <<EOF
/* TCC ENVIRONMENT : PROFILING FOR FreeBSD */
+CRT0 "-dynamic-linker /usr/libexec/ld-elf.so.1 /usr/lib/gcrt1.o"
<SYS_LINK "-lgmon"
+FLAG_TRANS "-P"
+LINE_START "#pragma@preserve@*"
EOF
# Create $WRKSRC/src/lib/env/freebsd/elf/80x86/tdf_ext
cat >$WRKSRC/src/lib/env/freebsd/elf/80x86/tdf_ext <<EOF
/* tcc environment for the TDF Spec 4.0 extensions */
<LIB "-ltarget_tok"
+FLAG_INSTALL "-Ytdf_ext"
>INFO "XANDF@Preliminary@Specification@(DRA-005@proposal)"
EOF
#
# Fix aout environment for /usr/lib or /usr/lib/aout.
#
fixlib $WRKSRC/src/lib/env/freebsd/aout/80x86 crt0.o default.extra tcc_diag
fixlib $WRKSRC/src/lib/env/freebsd/aout/80x86 gcrt0.o tcc_prof
|