i_linux.pas 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Peter Vreman
  4. This unit implements support information structures for linux
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. { This unit implements support information structures for linux. }
  19. unit i_linux;
  20. interface
  21. uses
  22. systems;
  23. const
  24. system_i386_linux_info : tsysteminfo =
  25. (
  26. system : system_i386_LINUX;
  27. name : 'Linux for i386';
  28. shortname : 'Linux';
  29. flags : [];
  30. cpu : cpu_i386;
  31. unit_env : 'LINUXUNITS';
  32. extradefines : 'UNIX;HASUNIX';
  33. sourceext : '.pp';
  34. pasext : '.pas';
  35. exeext : '';
  36. defext : '.def';
  37. scriptext : '.sh';
  38. smartext : '.sl';
  39. unitext : '.ppu';
  40. unitlibext : '.ppl';
  41. asmext : '.s';
  42. objext : '.o';
  43. resext : '.res';
  44. resobjext : '.or';
  45. sharedlibext : '.so';
  46. staticlibext : '.a';
  47. staticlibprefix : 'libp';
  48. sharedlibprefix : 'lib';
  49. sharedClibext : '.so';
  50. staticClibext : '.a';
  51. staticClibprefix : 'lib';
  52. sharedClibprefix : 'lib';
  53. Cprefix : '';
  54. newline : #10;
  55. dirsep : '/';
  56. files_case_relevent : true;
  57. assem : as_i386_elf32;
  58. assemextern : as_gas;
  59. link : nil;
  60. linkextern : nil;
  61. ar : ar_gnu_ar;
  62. res : res_none;
  63. script : script_unix;
  64. endian : endian_little;
  65. alignment :
  66. (
  67. procalign : 4;
  68. loopalign : 4;
  69. jumpalign : 0;
  70. constalignmin : 0;
  71. constalignmax : 4;
  72. varalignmin : 0;
  73. varalignmax : 4;
  74. localalignmin : 0;
  75. localalignmax : 4;
  76. recordalignmin : 0;
  77. recordalignmax : 2;
  78. maxCrecordalign : 4
  79. );
  80. first_parm_offset : 8;
  81. heapsize : 256*1024;
  82. stacksize : 262144;
  83. DllScanSupported:false;
  84. use_function_relative_addresses : true
  85. );
  86. system_m68k_linux_info : tsysteminfo =
  87. (
  88. system : system_m68k_linux;
  89. name : 'Linux for m68k';
  90. shortname : 'linux';
  91. flags : [];
  92. cpu : cpu_m68k;
  93. unit_env : 'LINUXUNITS';
  94. extradefines : 'UNIX;HASUNIX';
  95. sourceext : '.pp';
  96. pasext : '.pas';
  97. exeext : '';
  98. defext : '';
  99. scriptext : '.sh';
  100. smartext : '.sl';
  101. unitext : '.ppu';
  102. unitlibext : '.ppl';
  103. asmext : '.s';
  104. objext : '.o';
  105. resext : '.res';
  106. resobjext : '.or';
  107. sharedlibext : '.so';
  108. staticlibext : '.a';
  109. staticlibprefix : 'libp';
  110. sharedlibprefix : 'lib';
  111. sharedClibext : '.so';
  112. staticClibext : '.a';
  113. staticClibprefix : 'lib';
  114. sharedClibprefix : 'lib';
  115. Cprefix : '';
  116. newline : #10;
  117. dirsep : '/';
  118. files_case_relevent : true;
  119. assem : as_gas;
  120. assemextern : as_gas;
  121. link : nil;
  122. linkextern : nil;
  123. ar : ar_gnu_ar;
  124. res : res_none;
  125. script : script_unix;
  126. endian : endian_big;
  127. alignment :
  128. (
  129. procalign : 4;
  130. loopalign : 4;
  131. jumpalign : 0;
  132. constalignmin : 0;
  133. constalignmax : 4;
  134. varalignmin : 0;
  135. varalignmax : 4;
  136. localalignmin : 0;
  137. localalignmax : 4;
  138. recordalignmin : 0;
  139. recordalignmax : 2;
  140. maxCrecordalign : 4
  141. );
  142. first_parm_offset : 8;
  143. heapsize : 128*1024;
  144. stacksize : 32*1024*1024;
  145. DllScanSupported:false;
  146. use_function_relative_addresses : true
  147. );
  148. system_powerpc_linux_info : tsysteminfo =
  149. (
  150. system : system_powerpc_LINUX;
  151. name : 'Linux for PowerPC';
  152. shortname : 'linux';
  153. flags : [];
  154. cpu : cpu_powerpc;
  155. unit_env : '';
  156. extradefines : 'UNIX;HASUNIX';
  157. sourceext : '.pp';
  158. pasext : '.pas';
  159. exeext : '';
  160. defext : '.def';
  161. scriptext : '.sh';
  162. smartext : '.sl';
  163. unitext : '.ppu';
  164. unitlibext : '.ppl';
  165. asmext : '.s';
  166. objext : '.o';
  167. resext : '.res';
  168. resobjext : '.or';
  169. sharedlibext : '.so';
  170. staticlibext : '.s';
  171. staticlibprefix : 'libp';
  172. sharedlibprefix : 'lib';
  173. sharedClibext : '.so';
  174. staticClibext : '.a';
  175. staticClibprefix : 'lib';
  176. sharedClibprefix : 'lib';
  177. Cprefix : '';
  178. newline : #10;
  179. dirsep : '/';
  180. files_case_relevent : true;
  181. assem : as_gas;
  182. assemextern : as_gas;
  183. link : nil;
  184. linkextern : nil;
  185. ar : ar_gnu_ar;
  186. res : res_none;
  187. script : script_unix;
  188. endian : endian_big;
  189. alignment :
  190. (
  191. procalign : 4;
  192. loopalign : 4;
  193. jumpalign : 0;
  194. constalignmin : 0;
  195. constalignmax : 4;
  196. varalignmin : 0;
  197. varalignmax : 4;
  198. localalignmin : 0;
  199. localalignmax : 4;
  200. recordalignmin : 0;
  201. recordalignmax : 2;
  202. maxCrecordalign : 4
  203. );
  204. first_parm_offset : 8;
  205. heapsize : 256*1024;
  206. stacksize : 32*1024*1024;
  207. DllScanSupported:false;
  208. use_function_relative_addresses : true;
  209. { abi_powerpc_sysv doesn't work yet }
  210. abi : abi_powerpc_aix;
  211. );
  212. system_alpha_linux_info : tsysteminfo =
  213. (
  214. system : system_alpha_LINUX;
  215. name : 'Linux for Alpha';
  216. shortname : 'linux';
  217. flags : [];
  218. cpu : cpu_alpha;
  219. unit_env : 'LINUXUNITS';
  220. extradefines : 'UNIX;HASUNIX';
  221. sourceext : '.pp';
  222. pasext : '.pas';
  223. exeext : '';
  224. defext : '.def';
  225. scriptext : '.sh';
  226. smartext : '.sl';
  227. unitext : '.ppu';
  228. unitlibext : '.ppl';
  229. asmext : '.s';
  230. objext : '.o';
  231. resext : '.res';
  232. resobjext : '.or';
  233. sharedlibext : '.so';
  234. staticlibext : '.a';
  235. staticlibprefix : 'libp';
  236. sharedlibprefix : 'lib';
  237. sharedClibext : '.so';
  238. staticClibext : '.a';
  239. staticClibprefix : 'lib';
  240. sharedClibprefix : 'lib';
  241. Cprefix : '';
  242. newline : #10;
  243. dirsep : '/';
  244. files_case_relevent : true;
  245. assem : as_gas;
  246. assemextern : as_gas;
  247. link : nil;
  248. linkextern : nil;
  249. ar : ar_gnu_ar;
  250. res : res_none;
  251. script : script_unix;
  252. endian : endian_little;
  253. alignment :
  254. (
  255. procalign : 4;
  256. loopalign : 4;
  257. jumpalign : 0;
  258. constalignmin : 0;
  259. constalignmax : 4;
  260. varalignmin : 0;
  261. varalignmax : 4;
  262. localalignmin : 0;
  263. localalignmax : 4;
  264. recordalignmin : 0;
  265. recordalignmax : 2;
  266. maxCrecordalign : 4
  267. );
  268. first_parm_offset : 8;
  269. heapsize : 256*1024;
  270. stacksize : 32*1024*1024;
  271. DllScanSupported:false;
  272. use_function_relative_addresses : true
  273. );
  274. system_x86_64_linux_info : tsysteminfo =
  275. (
  276. system : system_x86_64_LINUX;
  277. name : 'Linux for x86-64';
  278. shortname : 'linux';
  279. flags : [];
  280. cpu : cpu_x86_64;
  281. unit_env : 'LINUXUNITS';
  282. extradefines : 'UNIX;HASUNIX';
  283. sourceext : '.pp';
  284. pasext : '.pas';
  285. exeext : '';
  286. defext : '.def';
  287. scriptext : '.sh';
  288. smartext : '.sl';
  289. unitext : '.ppu';
  290. unitlibext : '.ppl';
  291. asmext : '.s';
  292. objext : '.o';
  293. resext : '.res';
  294. resobjext : '.or';
  295. sharedlibext : '.so';
  296. staticlibext : '.a';
  297. staticlibprefix : 'libp';
  298. sharedlibprefix : 'lib';
  299. sharedClibext : '.so';
  300. staticClibext : '.a';
  301. staticClibprefix : 'lib';
  302. sharedClibprefix : 'lib';
  303. Cprefix : '';
  304. newline : #10;
  305. dirsep : '/';
  306. files_case_relevent : true;
  307. assem : as_i386_elf32;
  308. assemextern : as_gas;
  309. link : nil;
  310. linkextern : nil;
  311. ar : ar_gnu_ar;
  312. res : res_none;
  313. script : script_unix;
  314. endian : endian_little;
  315. alignment :
  316. (
  317. procalign : 4;
  318. loopalign : 4;
  319. jumpalign : 0;
  320. constalignmin : 0;
  321. constalignmax : 1;
  322. varalignmin : 0;
  323. varalignmax : 1;
  324. localalignmin : 0;
  325. localalignmax : 1;
  326. recordalignmin : 0;
  327. recordalignmax : 2;
  328. maxCrecordalign : 4
  329. );
  330. first_parm_offset : 16;
  331. heapsize : 256*1024;
  332. stacksize : 16*1024;
  333. DllScanSupported:false;
  334. use_function_relative_addresses : true
  335. );
  336. system_SPARC_linux_info : tsysteminfo =
  337. (
  338. system : system_SPARC_Linux;
  339. name : 'Linux for SPARC';
  340. shortname : 'linux';
  341. flags : [];
  342. cpu : cpu_SPARC;
  343. unit_env : 'LINUXUNITS';
  344. extradefines : 'UNIX;HASUNIX';
  345. sourceext : '.pp';
  346. pasext : '.pas';
  347. exeext : '';
  348. defext : '.def';
  349. scriptext : '.sh';
  350. smartext : '.sl';
  351. unitext : '.ppu';
  352. unitlibext : '.ppl';
  353. asmext : '.s';
  354. objext : '.o';
  355. resext : '.res';
  356. resobjext : '.or';
  357. sharedlibext : '.so';
  358. staticlibext : '.a';
  359. staticlibprefix : 'libp';
  360. sharedlibprefix : 'lib';
  361. sharedClibext : '.so';
  362. staticClibext : '.a';
  363. staticClibprefix : 'lib';
  364. sharedClibprefix : 'lib';
  365. Cprefix : '';
  366. newline : #10;
  367. dirsep : '/';
  368. files_case_relevent : true;
  369. assem : as_gas;
  370. assemextern : as_gas;
  371. link : nil;
  372. linkextern : nil;
  373. ar : ar_gnu_ar;
  374. res : res_none;
  375. script : script_unix;
  376. endian : endian_big;
  377. alignment :
  378. (
  379. procalign : 4;
  380. loopalign : 4;
  381. jumpalign : 0;
  382. constalignmin : 0;
  383. constalignmax : 4;
  384. varalignmin : 0;
  385. varalignmax : 4;
  386. localalignmin : 0;
  387. localalignmax : 4;
  388. recordalignmin : 0;
  389. recordalignmax : 4;
  390. maxCrecordalign : 4
  391. );
  392. first_parm_offset : (16+1)*4;
  393. heapsize : 256*1024;
  394. stacksize : 262144;
  395. DllScanSupported:false;
  396. use_function_relative_addresses : true
  397. );
  398. system_arm_linux_info : tsysteminfo =
  399. (
  400. system : system_arm_Linux;
  401. name : 'Linux for ARM';
  402. shortname : 'linux';
  403. flags : [];
  404. cpu : cpu_arm;
  405. unit_env : 'LINUXUNITS';
  406. extradefines : 'UNIX;HASUNIX';
  407. sourceext : '.pp';
  408. pasext : '.pas';
  409. exeext : '';
  410. defext : '.def';
  411. scriptext : '.sh';
  412. smartext : '.sl';
  413. unitext : '.ppu';
  414. unitlibext : '.ppl';
  415. asmext : '.s';
  416. objext : '.o';
  417. resext : '.res';
  418. resobjext : '.or';
  419. sharedlibext : '.so';
  420. staticlibext : '.a';
  421. staticlibprefix : 'libp';
  422. sharedlibprefix : 'lib';
  423. sharedClibext : '.so';
  424. staticClibext : '.a';
  425. staticClibprefix : 'lib';
  426. sharedClibprefix : 'lib';
  427. Cprefix : '';
  428. newline : #10;
  429. dirsep : '/';
  430. files_case_relevent : true;
  431. assem : as_gas;
  432. assemextern : as_gas;
  433. link : nil;
  434. linkextern : nil;
  435. ar : ar_gnu_ar;
  436. res : res_none;
  437. script : script_unix;
  438. endian : endian_little;
  439. alignment :
  440. (
  441. procalign : 4;
  442. loopalign : 4;
  443. jumpalign : 0;
  444. constalignmin : 0;
  445. constalignmax : 4;
  446. varalignmin : 0;
  447. varalignmax : 4;
  448. localalignmin : 0;
  449. localalignmax : 4;
  450. recordalignmin : 4;
  451. recordalignmax : 4;
  452. maxCrecordalign : 4
  453. );
  454. first_parm_offset : 8;
  455. heapsize : 256*1024;
  456. stacksize : 262144;
  457. DllScanSupported:false;
  458. use_function_relative_addresses : true
  459. );
  460. implementation
  461. initialization
  462. {$ifdef CPU86}
  463. {$ifdef linux}
  464. { some FreeBSD versions define linux as well }
  465. {$ifndef FreeBSD}
  466. set_source_info(system_i386_linux_info);
  467. {$endif FreeBSD}
  468. {$endif}
  469. {$endif CPU86}
  470. {$ifdef CPU68}
  471. {$ifdef linux}
  472. set_source_info(system_m68k_linux_info);
  473. {$endif linux}
  474. {$endif CPU68}
  475. {$ifdef CPU86_64}
  476. {$ifdef linux}
  477. set_source_info(system_x86_64_linux_info);
  478. {$endif linux}
  479. {$endif CPU86_64}
  480. {$ifdef CPUALPHA}
  481. {$ifdef linux}
  482. set_source_info(system_alpha_linux_info);
  483. {$endif linux}
  484. {$endif CPUALPHA}
  485. {$ifdef CPUSPARC}
  486. {$ifdef linux}
  487. set_source_info(system_sparc_linux_info);
  488. {$endif linux}
  489. {$endif CPUSPARC}
  490. {$ifdef CPUPOWERPC}
  491. {$ifdef linux}
  492. set_source_info(system_powerpc_linux_info);
  493. {$endif linux}
  494. {$endif CPUPOWERPC}
  495. {$ifdef CPUARM}
  496. {$ifdef linux}
  497. set_source_info(system_arm_linux_info);
  498. {$endif linux}
  499. {$endif CPUARM}
  500. end.
  501. {
  502. $Log$
  503. Revision 1.15 2003-10-03 22:09:49 peter
  504. * removed paraalign
  505. Revision 1.14 2003/09/23 17:58:38 peter
  506. * recordminalign for sparc 0
  507. Revision 1.13 2003/09/07 09:08:26 olle
  508. * reverted last change, linux on powerpc still uses aix abi
  509. Revision 1.12 2003/09/06 10:46:56 olle
  510. * linux on powerpc now uses sysv abi
  511. Revision 1.11 2003/09/03 11:18:37 florian
  512. * fixed arm concatcopy
  513. + arm support in the common compiler sources added
  514. * moved some generic cg code around
  515. + tfputype added
  516. * ...
  517. Revision 1.10 2003/07/21 11:52:57 florian
  518. * very basic stuff for the arm
  519. Revision 1.9 2003/07/06 17:58:22 peter
  520. * framepointer fixes for sparc
  521. * parent framepointer code more generic
  522. Revision 1.8 2003/05/31 18:14:06 jonas
  523. * add default system for ppc
  524. Revision 1.7 2003/05/19 12:15:28 florian
  525. * fixed calling sequence for subroutines using the aix abi
  526. Revision 1.6 2003/05/18 15:15:59 florian
  527. + added abi field to tsysteminfo
  528. Revision 1.5 2003/04/30 15:45:35 florian
  529. * merged more x86-64/i386 code
  530. Revision 1.4 2003/02/06 22:36:55 mazen
  531. * fixing bug related to errornous program main entry stack frame
  532. Revision 1.3 2003/01/11 16:35:15 marco
  533. * HASUNIX defined for now.
  534. Revision 1.2 2002/10/04 21:57:42 mazen
  535. * register allocation for parameters now done in cpupara, but InternalError(200109223) in cgcpu.pas:1053 is still not fixed du to location_force problem in ncgutils.pas:419
  536. Revision 1.1 2002/09/06 15:03:51 carl
  537. * moved files to systems directory
  538. Revision 1.3 2002/08/13 18:01:51 carl
  539. * rename swatoperands to swapoperands
  540. + m68k first compilable version (still needs a lot of testing):
  541. assembler generator, system information , inline
  542. assembler reader.
  543. Revision 1.2 2002/08/12 15:08:39 carl
  544. + stab register indexes for powerpc (moved from gdb to cpubase)
  545. + tprocessor enumeration moved to cpuinfo
  546. + linker in target_info is now a class
  547. * many many updates for m68k (will soon start to compile)
  548. - removed some ifdef or correct them for correct cpu
  549. Revision 1.1 2002/07/26 21:15:38 florian
  550. * rewrote the system handling
  551. }