2017年9月15日 星期五

pascal 編譯/執行 (0) - 使用 free pascal 編譯出 x86_32 的執行檔

在 rust 大戰 c/c++ 時, 我們似乎忘了還有一個系統層級的語言 pascal, pascal 也沒有 gc, 也是編譯型語言, dos 時代的 turbo pascal, windows 時代的 delphi, 是 pascal 風光的時候, 為什麼突然沒落了, 真是奇怪。我突然對 pascal 有了興趣, 來把玩一下這個傳統的語言。

在談論 x86 32bit 模式之前, 先來看看預設的 x86 64bit 怎麼編譯。

environment:
linux 64bit/debian

在 linux 下有 free pascal 編譯器可用, x86 64bit 系統預設的 ppcx64 只能編譯出 x64 執行檔, 先來看看怎麼使用 free pascal 編譯器。

p1.pas
 1 {$CALLING PASCAL}
 2 Program h;
 3 (*Uses f1, Crt in '/usr/local/lib/fpc/3.1.1/units/i386-linux/rtl-console/crt.ppu';*)
 4 Uses f1, Crt;
 5 
 6 
 7 var x, v: integer;
 8 var str: string;
 9 begin
10 
11   str := 'abc';
12 
13 (*  x := max(5,6); *)
14   x := 7;
15   Writeln('hello free pascal, max: ', x, str);
16 end.

apt-get install fpc           # 安裝 free pascal 編譯器。
fpc p1.pas                    # 編譯 p1.pas
./p1                          # 執行
hello free pascal, max: 7abc  # 執行結果

p1.pas 很簡單的把 int, string 變數用 Writeln 印出來, 不需要像 c printf 用那些老是記不住的 %d, %u, %lld, 還蠻方便的, 這是怎麼做到的? 真令人好奇。

因為只看得懂 x86 32bit 組合語言, 所以我還是很需要可以建構出 32bit 環境的開發工具。

x86 64bit 系統預設的 ppcx64 無法編譯出 x86 32bit code 的程式, 需要自己編譯 32bit 的版本, 參考《From Linux x64 to Linux i386》建構可以 build x86 32bit code 的 pascal compiler。

下載 freepascal source code
https://github.com/graemeg/freepascal.git

還要先安裝 free pascal compiler, free pascal compiler 是用 pascal 寫的。
apt-get install fp-compiler

From Linux x64 to Linux i386
以下是參考《From Linux x64 to Linux i386》的內容

當然要先安裝 x86 32bit 開發工具, 請參考《在 debian 上安裝 x86 32bit gcc/g++

再來是建立 /usr/bin/i386-linux-as, /usr/bin/i386-linux-ld 這 2 個 script, 記得
chmod 755 /usr/bin/i386-linux-as /usr/bin/i386-linux-ld 
給他們執行權限。

/usr/bin/i386-linux-as
1 #!/bin/bash
2 as --32 $@

/usr/bin/i386-linux-ld
1 #!/bin/bash
2 ld -A elf32-i386 $@

以下指令分別是 "編譯" 以及 "安裝"
compile and install command
1 make all CPU_TARGET=i386
2 sudo make crossinstall CPU_TARGET=i386

會安裝到
/usr/local/lib/fpc/3.1.1/

h.pas
 1 Program h;
 2 Uses Crt in '/usr/local/lib/fpc/3.1.1/units/i386-linux/rtl-console/crt.ppu';
 3 
 4   var x, v: integer;
 5 begin
 6 
 7   x := 5;
 8   v := 6;
 9   Writeln('hello free pascal, max: ', x);
10   Writeln('hello free pascal, min: ', v);
11 end.

編譯 h.pas 與執行
 1 descent@debian64:pascal$ /usr/local/lib/fpc/3.1.1/ppcross386 h.pas
 2 Free Pascal Compiler version 3.1.1 [2017/03/27] for i386
 3 Copyright (c) 1993-2017 by Florian Klaempfl and others
 4 Target OS: Linux for i386
 5 Compiling h.pas
 6 Linking h
 7 11 lines compiled, 0.3 sec
 8 descent@debian64:pascal$ ./h 
 9 hello free pascal, max: 5
10 hello free pascal, min: 6

That's it. Edit your /etc/fpc.cfg file if needed.

得到 h.s 的組合語言檔案
/usr/local/lib/fpc/3.1.1/ppcross386 -g -al -Cn h.pas

h.s L86, 87 是呼叫 min 這個 function, 可是卻不是用 pascal call convention 而是使用 register 傳遞參數, 但我加上 {$CALLING PASCAL} 卻沒有看到期待的 pascal call convention。






ModifierPushing orderStack cleaned byalignment





¡none¿Left-to-rightCalleedefault
registerLeft-to-rightCalleedefault
cdeclRight-to-leftCallerGCC alignment
interruptRight-to-leftCalleedefault
pascalLeft-to-rightCalleedefault
safecallRight-to-leftCalleedefault
stdcallRight-to-leftCalleeGCC alignment
oldfpccallRight-to-leftCalleedefault





h.s L58 ~ 60, free pascal compiler 也幫我們產生一個像 c main function 的組合語言。

h.s
  1  .file "h.pas"
  2 # Begin asmlist al_begin
  3 
  4 .section .text.b_DEBUGSTART_$P$H
  5  .balign 4,0x90
  6 .globl DEBUGSTART_$P$H
  7  .type DEBUGSTART_$P$H,@object
  8 DEBUGSTART_$P$H:
  9  .stabs "/media/work/git/progs/pascal/",100,0,0,.Lf2
 10  .stabs "h.pas",100,0,0,.Lf2
 11 .Lf2:
 12 # End asmlist al_begin
 13 # Begin asmlist al_stabs
 14 
 15 .section .data.n_H
 16  .balign 4
 17 .globl DEBUGINFO_$P$H
 18  .type DEBUGINFO_$P$H,@object
 19 DEBUGINFO_$P$H:
 20 # Defs - Begin unit SYSTEM has index 1
 21  .stabs "void:t2=2",128,0,0,0
 22  .stabs "SMALLINT:t1=@s16;r1;-32768;32767;",128,0,0,0
 23 # Defs - End unit SYSTEM has index 1
 24 # Defs - Begin unit FPINTRES has index 2
 25 # Defs - End unit FPINTRES has index 2
 26 # Defs - Begin unit F1 has index 3
 27 # Defs - End unit F1 has index 3
 28 # Defs - Begin unit UNIXTYPE has index 8
 29 # Defs - End unit UNIXTYPE has index 8
 30 # Defs - Begin unit BASEUNIX has index 5
 31 # Defs - End unit BASEUNIX has index 5
 32 # Defs - Begin unit UNIXUTIL has index 9
 33 # Defs - End unit UNIXUTIL has index 9
 34 # Defs - Begin unit SYSCALL has index 10
 35 # Defs - End unit SYSCALL has index 10
 36 # Defs - Begin unit UNIX has index 6
 37 # Defs - End unit UNIX has index 6
 38 # Defs - Begin unit TERMIO has index 7
 39 # Defs - End unit TERMIO has index 7
 40 # Defs - Begin unit CRT has index 4
 41 # Defs - End unit CRT has index 4
 42 # Defs - Begin unit SI_PRC has index 10
 43 # Defs - End unit SI_PRC has index 10
 44 # Defs - Begin Staticsymtable
 45 # Defs - End Staticsymtable
 46 # Syms - Begin Staticsymtable
 47  .stabs "X:S1",38,0,5,U_$P$H_$$_X
 48  .stabs "V:S1",38,0,5,U_$P$H_$$_V
 49 # Syms - End Staticsymtable
 50 # End asmlist al_stabs
 51 # Begin asmlist al_procedures
 52 
 53 .section .text.n_main
 54  .balign 16,0x90
 55 .globl PASCALMAIN
 56  .type PASCALMAIN,@function
 57 PASCALMAIN:
 58 .globl main
 59  .type main,@function
 60 main:
 61  .stabs "main:F2",36,0,5,main
 62 .Lc1:
 63  .stabs "h.pas",132,0,0,.Lf1
 64 .Lf1:
 65  .stabn 68,0,6,.Ll1 - main
 66 .Ll1:
 67 # [h.pas]
 68 # [6] begin
 69  pushl %ebp
 70 .Lc3:
 71 .Lc4:
 72  movl %esp,%ebp
 73 .Lc5:
 74  pushl %ebx
 75  call fpc_initializeunits
 76  .stabn 68,0,8,.Ll2 - main
 77 .Ll2:
 78 # [8] x := max(5,6);
 79  movw $6,%dx
 80  movw $5,%ax
 81  call F1_$$_MAX$SMALLINT$SMALLINT$$SMALLINT
 82  movw %ax,U_$P$H_$$_X
 83  .stabn 68,0,9,.Ll3 - main
 84 .Ll3:
 85 # [9] v := min(5,6);
 86  movw $6,%dx
 87  movw $5,%ax
 88  call F1_$$_MIN$SMALLINT$SMALLINT$$SMALLINT
 89  movw %ax,U_$P$H_$$_V
 90  .stabn 68,0,10,.Ll4 - main
 91 .Ll4:
 92 # [10] Writeln('hello free pascal, max: ', x);
 93  call fpc_get_output
 94  movl %eax,%ebx
 95  movl $_$H$_Ld1,%ecx
 96  movl %ebx,%edx
 97  movl $0,%eax
 98  call fpc_write_text_shortstr
 99  call fpc_iocheck
100  movswl U_$P$H_$$_X,%ecx
101  movl %ebx,%edx
102  movl $0,%eax
103  call fpc_write_text_sint
104  call fpc_iocheck
105  movl %ebx,%eax
106  call fpc_writeln_end
107  call fpc_iocheck
108  .stabn 68,0,11,.Ll5 - main
109 .Ll5:
110 # [11] Writeln('hello free pascal, min: ', v);
111  call fpc_get_output
112  movl %eax,%ebx
113  movl $_$H$_Ld2,%ecx
114  movl %ebx,%edx
115  movl $0,%eax
116  call fpc_write_text_shortstr
117  call fpc_iocheck
118  movswl U_$P$H_$$_V,%ecx
119  movl %ebx,%edx
120  movl $0,%eax
121  call fpc_write_text_sint
122  call fpc_iocheck
123  movl %ebx,%eax
124  call fpc_writeln_end
125  call fpc_iocheck
126  .stabn 68,0,12,.Ll6 - main
127 .Ll6:
128 # [12] end.
129  call fpc_do_exit
130  popl %ebx
131  movl %ebp,%esp
132  popl %ebp
133  ret
134 .Lc2:
135 .Le0:
136  .size main, .Le0 - main
137  .stabn 192,0,0,0
138  .stabn 224,0,0,.Lt1-main
139 .Lt1:
140 
141 .section .text
142 
143 .section .fpc.n_links
144  .long DEBUGINFO_$P$H
145  .long DEBUGSTART_$P$H
146  .long DEBUGEND_$P$H
147 # End asmlist al_procedures
148 # Begin asmlist al_globals
149 
150 .section .bss
151  .balign 2
152 # [5] var x, v: integer;
153  .type U_$P$H_$$_X,@object
154  .size U_$P$H_$$_X,2
155 U_$P$H_$$_X:
156  .zero 2
157 
158 .section .bss
159  .balign 2
160  .type U_$P$H_$$_V,@object
161  .size U_$P$H_$$_V,2
162 U_$P$H_$$_V:
163  .zero 2
164 
165 .section .data.n_INITFINAL
166  .balign 4
167 .globl INITFINAL
168  .type INITFINAL,@object
169 INITFINAL:
170  .long 3,0
171  .long INIT$_$SYSTEM
172  .long 0
173  .long INIT$_$UNIX
174  .long FINALIZE$_$UNIX
175  .long INIT$_$CRT
176  .long FINALIZE$_$CRT
177 .Le1:
178  .size INITFINAL, .Le1 - INITFINAL
179 
180 .section .data.n_FPC_THREADVARTABLES
181  .balign 4
182 .globl FPC_THREADVARTABLES
183  .type FPC_THREADVARTABLES,@object
184 FPC_THREADVARTABLES:
185  .long 1
186  .long THREADVARLIST_$SYSTEM$indirect
187 .Le2:
188  .size FPC_THREADVARTABLES, .Le2 - FPC_THREADVARTABLES
189 
190 .section .data.n_FPC_RESOURCESTRINGTABLES
191  .balign 4
192 .globl FPC_RESOURCESTRINGTABLES
193  .type FPC_RESOURCESTRINGTABLES,@object
194 FPC_RESOURCESTRINGTABLES:
195  .long 0
196 .Le3:
197  .size FPC_RESOURCESTRINGTABLES, .Le3 - FPC_RESOURCESTRINGTABLES
198 
199 .section .data.n_FPC_WIDEINITTABLES
200  .balign 4
201 .globl FPC_WIDEINITTABLES
202  .type FPC_WIDEINITTABLES,@object
203 FPC_WIDEINITTABLES:
204  .long 0
205 .Le4:
206  .size FPC_WIDEINITTABLES, .Le4 - FPC_WIDEINITTABLES
207 
208 .section .data.n_FPC_RESSTRINITTABLES
209  .balign 4
210 .globl FPC_RESSTRINITTABLES
211  .type FPC_RESSTRINITTABLES,@object
212 FPC_RESSTRINITTABLES:
213  .long 0
214 .Le5:
215  .size FPC_RESSTRINITTABLES, .Le5 - FPC_RESSTRINITTABLES
216 
217 .section .fpc.n_version
218  .balign 8
219  .type __fpc_ident,@object
220 __fpc_ident:
221  .ascii "FPC 3.1.1 [2017/03/27] for i386 - Linux"
222 .Le6:
223  .size __fpc_ident, .Le6 - __fpc_ident
224 
225 .section .data.n___stklen
226  .balign 4
227 .globl __stklen
228  .type __stklen,@object
229 __stklen:
230  .long 8388608
231 .Le7:
232  .size __stklen, .Le7 - __stklen
233 
234 .section .data.n___heapsize
235  .balign 4
236 .globl __heapsize
237  .type __heapsize,@object
238 __heapsize:
239  .long 0
240 .Le8:
241  .size __heapsize, .Le8 - __heapsize
242 
243 .section .data.n___fpc_valgrind
244  .balign 4
245 .globl __fpc_valgrind
246  .type __fpc_valgrind,@object
247 __fpc_valgrind:
248  .byte 0
249 .Le9:
250  .size __fpc_valgrind, .Le9 - __fpc_valgrind
251 
252 .section .data.n_FPC_RESLOCATION
253  .balign 4
254 .globl FPC_RESLOCATION
255  .type FPC_RESLOCATION,@object
256 FPC_RESLOCATION:
257  .long 0
258 .Le10:
259  .size FPC_RESLOCATION, .Le10 - FPC_RESLOCATION
260 # End asmlist al_globals
261 # Begin asmlist al_typedconsts
262 
263 .section .rodata.n__$H$_Ld1
264  .balign 4
265 .globl _$H$_Ld1
266 _$H$_Ld1:
267  .ascii "\030hello free pascal, max: \000"
268 .Le11:
269  .size _$H$_Ld1, .Le11 - _$H$_Ld1
270 
271 .section .rodata.n__$H$_Ld2
272  .balign 4
273 .globl _$H$_Ld2
274 _$H$_Ld2:
275  .ascii "\030hello free pascal, min: \000"
276 .Le12:
277  .size _$H$_Ld2, .Le12 - _$H$_Ld2
278 # End asmlist al_typedconsts
279 # Begin asmlist al_dwarf_frame
280 
281 .section .debug_frame
282 .Lc6:
283  .long .Lc8-.Lc7
284 .Lc7:
285  .long -1
286  .byte 1
287  .byte 0
288  .uleb128 1
289  .sleb128 -4
290  .byte 8
291  .byte 12
292  .uleb128 4
293  .uleb128 4
294  .byte 5
295  .uleb128 8
296  .uleb128 1
297  .balign 4,0
298 .Lc8:
299  .long .Lc10-.Lc9
300 .Lc9:
301  .long .Lc6
302  .long .Lc1
303  .long .Lc2-.Lc1
304  .byte 4
305  .long .Lc3-.Lc1
306  .byte 14
307  .uleb128 8
308  .byte 4
309  .long .Lc4-.Lc3
310  .byte 5
311  .uleb128 5
312  .uleb128 2
313  .byte 4
314  .long .Lc5-.Lc4
315  .byte 13
316  .uleb128 5
317  .balign 4,0
318 .Lc10:
319 # End asmlist al_dwarf_frame
320 # Begin asmlist al_end
321 
322 .section .text.z_DEBUGEND_$P$H
323  .balign 4,0x90
324 .globl DEBUGEND_$P$H
325  .type DEBUGEND_$P$H,@object
326 DEBUGEND_$P$H:
327  .stabs "",100,0,0,.Lf3
328 .Lf3:
329 # End asmlist al_end
330 .section .note.GNU-stack,"",%progbits

從 h.s L92 可以得知, Writeln 被換成很多 call XXX, 直到 call fpc_writeln_end 時, 才會在終端機印出字串。

我不知道 Writeln 是不是被稱為 function, 但至少和 c function 是完全不同的概念, 有點類似語言內建的 '指令'。而我寫的 function max, 被換成 F1_$$_MAX$SMALLINT$SMALLINT$$SMALLINT 這樣的名稱, 呼叫 max 時, 也只有
call    F1_$$_MAX$SMALLINT$SMALLINT$$SMALLINT
符合想像的那樣。這就是語言內建 IO, 而 C 語言沒有內建 IO 的意思, C 的 IO 得靠 printf function 來完成, 語言不提供這樣的 '指令'。

free pascal compiler 在編譯時, 會產生 ppas.sh link.res。
ppas.sh - 編譯 script
link.res - linker script

 1 #!/bin/sh
 2 DoExitAsm ()
 3 { echo "An error occurred while assembling $1"; exit 1; }
 4 DoExitLink ()
 5 { echo "An error occurred while linking $1"; exit 1; }
 6 echo Linking h
 7 OFS=$IFS
 8 IFS="
 9 "
10 /usr/bin/ld -b elf32-i386 -m elf_i386      -L. -o h -T link.res -e _start
11 if [ $? != 0 ]; then DoExitLink h; fi
12 IFS=$OFS

link.res
  1 SEARCH_DIR("/usr/lib/i386-linux-gnu/")
  2 SEARCH_DIR("/lib/")
  3 SEARCH_DIR("/usr/lib/")
  4 SEARCH_DIR("/usr/lib/ruby/")
  5 SEARCH_DIR("/usr/lib/modules-load.d/")
  6 SEARCH_DIR("/usr/lib/ipxe/")
  7 SEARCH_DIR("/usr/lib/dbus-1.0/")
  8 SEARCH_DIR("/usr/lib/libgksu/")
  9 SEARCH_DIR("/usr/lib/pkgconfig/")
 10 SEARCH_DIR("/usr/lib/gcr/")
 11 SEARCH_DIR("/usr/lib/caja/")
 12 SEARCH_DIR("/usr/lib/exim4/")
 13 SEARCH_DIR("/usr/lib/apache2/")
 14 SEARCH_DIR("/usr/lib/graphviz/")
 15 SEARCH_DIR("/usr/lib/libblas/")
 16 SEARCH_DIR("/usr/lib/python3/")
 17 SEARCH_DIR("/usr/lib/pymodules/")
 18 SEARCH_DIR("/usr/lib/mate-utils/")
 19 SEARCH_DIR("/usr/lib/atril/")
 20 SEARCH_DIR("/usr/lib/python2.6/")
 21 SEARCH_DIR("/usr/lib/gpt/")
 22 SEARCH_DIR("/usr/lib/lognorm/")
 23 SEARCH_DIR("/usr/lib/arm-none-eabi/")
 24 SEARCH_DIR("/usr/lib/tc/")
 25 SEARCH_DIR("/usr/lib/vlc/")
 26 SEARCH_DIR("/usr/lib/udisks2/")
 27 SEARCH_DIR("/usr/lib/python2.7/")
 28 SEARCH_DIR("/usr/lib/locale/")
 29 SEARCH_DIR("/usr/lib/mate-applets/")
 30 SEARCH_DIR("/usr/lib/dconf/")
 31 SEARCH_DIR("/usr/lib/crash/")
 32 SEARCH_DIR("/usr/lib/wine/")
 33 SEARCH_DIR("/usr/lib/x86_64-linux-gnu/")
 34 SEARCH_DIR("/usr/lib/ghc/")
 35 SEARCH_DIR("/usr/lib/mime/")
 36 SEARCH_DIR("/usr/lib/man-db/")
 37 SEARCH_DIR("/usr/lib/glib-networking/")
 38 SEARCH_DIR("/usr/lib/locate/")
 39 SEARCH_DIR("/usr/lib/openssh/")
 40 SEARCH_DIR("/usr/lib/gvfs/")
 41 SEARCH_DIR("/usr/lib/mozilla/")
 42 SEARCH_DIR("/usr/lib/clang/")
 43 SEARCH_DIR("/usr/lib/gnome-keyring/")
 44 SEARCH_DIR("/usr/lib/gtags/")
 45 SEARCH_DIR("/usr/lib/iceweasel/")
 46 SEARCH_DIR("/usr/lib/libreoffice/")
 47 SEARCH_DIR("/usr/lib/utempter/")
 48 SEARCH_DIR("/usr/lib/os-prober/")
 49 SEARCH_DIR("/usr/lib/ghostscript/")
 50 SEARCH_DIR("/usr/lib/lazarus/")
 51 SEARCH_DIR("/usr/lib/node_modules/")
 52 SEARCH_DIR("/usr/lib/klibc/")
 53 SEARCH_DIR("/usr/lib/mate-panel/")
 54 SEARCH_DIR("/usr/lib/gnome-shell/")
 55 SEARCH_DIR("/usr/lib/systemd/")
 56 SEARCH_DIR("/usr/lib/grub/")
 57 SEARCH_DIR("/usr/lib/ssl/")
 58 SEARCH_DIR("/usr/lib/at-spi2-core/")
 59 SEARCH_DIR("/usr/lib/gjs/")
 60 SEARCH_DIR("/usr/lib/accountsservice/")
 61 SEARCH_DIR("/usr/lib/odbc/")
 62 SEARCH_DIR("/usr/lib/mpage/")
 63 SEARCH_DIR("/usr/lib/menu-cache/")
 64 SEARCH_DIR("/usr/lib/gcc/")
 65 SEARCH_DIR("/usr/lib/p7zip/")
 66 SEARCH_DIR("/usr/lib/gcj/")
 67 SEARCH_DIR("/usr/lib/X11/")
 68 SEARCH_DIR("/usr/lib/python3.4/")
 69 SEARCH_DIR("/usr/lib/emacsen-common/")
 70 SEARCH_DIR("/usr/lib/gnupg2/")
 71 SEARCH_DIR("/usr/lib/jvm-exports/")
 72 SEARCH_DIR("/usr/lib/samba/")
 73 SEARCH_DIR("/usr/lib/groff/")
 74 SEARCH_DIR("/usr/lib/eject/")
 75 SEARCH_DIR("/usr/lib/policykit-1/")
 76 SEARCH_DIR("/usr/lib/os-probes/")
 77 SEARCH_DIR("/usr/lib/cdbs/")
 78 SEARCH_DIR("/usr/lib/traceevent_4.9/")
 79 SEARCH_DIR("/usr/lib/grub-legacy/")
 80 SEARCH_DIR("/usr/lib/pulse-10.0/")
 81 SEARCH_DIR("/usr/lib/mc/")
 82 SEARCH_DIR("/usr/lib/ldscripts/")
 83 SEARCH_DIR("/usr/lib/kexec-tools/")
 84 SEARCH_DIR("/usr/lib/apt/")
 85 SEARCH_DIR("/usr/lib/llvm-3.6/")
 86 SEARCH_DIR("/usr/lib/fpc/")
 87 SEARCH_DIR("/usr/lib/cli/")
 88 SEARCH_DIR("/usr/lib/lp_solve/")
 89 SEARCH_DIR("/usr/lib/xine/")
 90 SEARCH_DIR("/usr/lib/xorg/")
 91 SEARCH_DIR("/usr/lib/mutter/")
 92 SEARCH_DIR("/usr/lib/gettext/")
 93 SEARCH_DIR("/usr/lib/lmbench/")
 94 SEARCH_DIR("/usr/lib/libvte-2.91-0/")
 95 SEARCH_DIR("/usr/lib/emacs/")
 96 SEARCH_DIR("/usr/lib/gnome-settings-daemon-3.0/")
 97 SEARCH_DIR("/usr/lib/evolution-data-server/")
 98 SEARCH_DIR("/usr/lib/rtkit/")
 99 SEARCH_DIR("/usr/lib/ccache/")
100 SEARCH_DIR("/usr/lib/rsyslog/")
101 SEARCH_DIR("/usr/lib/gold-ld/")
102 SEARCH_DIR("/usr/lib/evolution/")
103 SEARCH_DIR("/usr/lib/python3.5/")
104 SEARCH_DIR("/usr/lib/libpeas-1.0/")
105 SEARCH_DIR("/usr/lib/git-core/")
106 SEARCH_DIR("/usr/lib/linux-kbuild-4.8/")
107 SEARCH_DIR("/usr/lib/ispell/")
108 SEARCH_DIR("/usr/lib/mono/")
109 SEARCH_DIR("/usr/lib/perf_4.9-core/")
110 SEARCH_DIR("/usr/lib/spice-protocol/")
111 SEARCH_DIR("/usr/lib/debug/")
112 SEARCH_DIR("/usr/lib/sudo/")
113 SEARCH_DIR("/usr/lib/rustlib/")
114 SEARCH_DIR("/usr/lib/stardict/")
115 SEARCH_DIR("/usr/lib/lapack/")
116 SEARCH_DIR("/usr/lib/upower/")
117 SEARCH_DIR("/usr/lib/coreutils/")
118 SEARCH_DIR("/usr/lib/tcltk/")
119 SEARCH_DIR("/usr/lib/linux-kbuild-4.9/")
120 SEARCH_DIR("/usr/lib/VBoxGuestAdditions/")
121 SEARCH_DIR("/usr/lib/bcc/")
122 SEARCH_DIR("/usr/lib/girepository-1.0/")
123 SEARCH_DIR("/usr/lib/sysctl.d/")
124 SEARCH_DIR("/usr/lib/cgi-bin/")
125 SEARCH_DIR("/usr/lib/qemu/")
126 SEARCH_DIR("/usr/lib/pyshared/")
127 SEARCH_DIR("/usr/lib/dpkg/")
128 SEARCH_DIR("/usr/lib/mate-screensaver/")
129 SEARCH_DIR("/usr/lib/compat-ld/")
130 SEARCH_DIR("/usr/lib/engrampa/")
131 SEARCH_DIR("/usr/lib/valgrind/")
132 SEARCH_DIR("/usr/lib/aspell/")
133 SEARCH_DIR("/usr/lib/llvm-3.8/")
134 SEARCH_DIR("/usr/lib/gnupg/")
135 SEARCH_DIR("/usr/lib/pluma/")
136 SEARCH_DIR("/usr/lib/tasksel/")
137 SEARCH_DIR("/usr/lib/security/")
138 SEARCH_DIR("/usr/lib/ogdi/")
139 SEARCH_DIR("/usr/lib/texinfo/")
140 SEARCH_DIR("/usr/lib/linux-boot-probes/")
141 SEARCH_DIR("/usr/lib/mate-power-manager/")
142 SEARCH_DIR("/usr/lib/gnome-settings-daemon/")
143 SEARCH_DIR("/usr/lib/sasl2/")
144 SEARCH_DIR("/usr/lib/tmpfiles.d/")
145 SEARCH_DIR("/usr/lib/qt/")
146 SEARCH_DIR("/usr/lib/binfmt.d/")
147 SEARCH_DIR("/usr/lib/bonobo/")
148 SEARCH_DIR("/usr/lib/w3m/")
149 SEARCH_DIR("/usr/lib/xserver-xorg-video-intel/")
150 SEARCH_DIR("/usr/lib/telepathy/")
151 SEARCH_DIR("/usr/lib/nautilus/")
152 SEARCH_DIR("/usr/lib/GraphicsMagick-1.3.23/")
153 SEARCH_DIR("/usr/lib/nodejs/")
154 SEARCH_DIR("/usr/lib/dkms/")
155 SEARCH_DIR("/usr/lib/perl5/")
156 SEARCH_DIR("/usr/lib/xscreensaver/")
157 SEARCH_DIR("/usr/lib/binfmt-support/")
158 SEARCH_DIR("/usr/lib/colord/")
159 SEARCH_DIR("/usr/lib/jvm/")
160 SEARCH_DIR("/usr/lib/tar/")
161 SEARCH_DIR("/usr/lib/policykit-1-gnome/")
162 SEARCH_DIR("/usr/lib/mate-notification-daemon/")
163 SEARCH_DIR("/usr/lib/gcc/x86_64-linux-gnu/5/32/")
164 SEARCH_DIR("/usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/")
165 SEARCH_DIR("/usr/local/lib/fpc/3.1.1/")
166 INPUT(
167 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/si_prc.o
168 h.o
169 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/system.o
170 f1.o
171 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl-console/crt.o
172 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/baseunix.o
173 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/unix.o
174 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/termio.o
175 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/unixtype.o
176 /usr/local/lib/fpc/3.1.1/units/i386-linux/rtl/unixutil.o
177 )
178 SECTIONS
179 {
180   .fpcdata           :
181   {
182     KEEP (*(.fpc .fpc.n_version .fpc.n_links))
183   }
184   .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }
185 }
186 INSERT AFTER .data;

link.res L167 ~ 176 連結了不少 .o 檔案。

來看看 benchmark Pascal Free Pascal programs versus Java, 還真的不怎麼樣。

ref:

沒有留言:

張貼留言

使用 google 的 reCAPTCHA 驗證碼, 總算可以輕鬆留言了。

我實在受不了 spam 了, 又不想讓大家的眼睛花掉, 只好放棄匿名留言。這是沒辦法中的辦法了。留言的朋友需要有 google 帳號。