i_linux.pas 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  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. paraalign : 4;
  77. recordalignmin : 0;
  78. recordalignmax : 2;
  79. maxCrecordalign : 4
  80. );
  81. first_parm_offset : 8;
  82. heapsize : 256*1024;
  83. stacksize : 262144;
  84. DllScanSupported:false;
  85. use_function_relative_addresses : true
  86. );
  87. system_m68k_linux_info : tsysteminfo =
  88. (
  89. system : system_m68k_linux;
  90. name : 'Linux for m68k';
  91. shortname : 'linux';
  92. flags : [];
  93. cpu : cpu_m68k;
  94. unit_env : 'LINUXUNITS';
  95. extradefines : 'UNIX;HASUNIX';
  96. sourceext : '.pp';
  97. pasext : '.pas';
  98. exeext : '';
  99. defext : '';
  100. scriptext : '.sh';
  101. smartext : '.sl';
  102. unitext : '.ppu';
  103. unitlibext : '.ppl';
  104. asmext : '.s';
  105. objext : '.o';
  106. resext : '.res';
  107. resobjext : '.or';
  108. sharedlibext : '.so';
  109. staticlibext : '.a';
  110. staticlibprefix : 'libp';
  111. sharedlibprefix : 'lib';
  112. sharedClibext : '.so';
  113. staticClibext : '.a';
  114. staticClibprefix : 'lib';
  115. sharedClibprefix : 'lib';
  116. Cprefix : '';
  117. newline : #10;
  118. dirsep : '/';
  119. files_case_relevent : true;
  120. assem : as_gas;
  121. assemextern : as_gas;
  122. link : nil;
  123. linkextern : nil;
  124. ar : ar_gnu_ar;
  125. res : res_none;
  126. script : script_unix;
  127. endian : endian_big;
  128. alignment :
  129. (
  130. procalign : 4;
  131. loopalign : 4;
  132. jumpalign : 0;
  133. constalignmin : 0;
  134. constalignmax : 4;
  135. varalignmin : 0;
  136. varalignmax : 4;
  137. localalignmin : 0;
  138. localalignmax : 4;
  139. paraalign : 4;
  140. recordalignmin : 0;
  141. recordalignmax : 2;
  142. maxCrecordalign : 4
  143. );
  144. first_parm_offset : 8;
  145. heapsize : 128*1024;
  146. stacksize : 32*1024*1024;
  147. DllScanSupported:false;
  148. use_function_relative_addresses : true
  149. );
  150. system_powerpc_linux_info : tsysteminfo =
  151. (
  152. system : system_powerpc_LINUX;
  153. name : 'Linux for PowerPC';
  154. shortname : 'linux';
  155. flags : [];
  156. cpu : cpu_powerpc;
  157. unit_env : '';
  158. extradefines : 'UNIX;HASUNIX';
  159. sourceext : '.pp';
  160. pasext : '.pas';
  161. exeext : '';
  162. defext : '.def';
  163. scriptext : '.sh';
  164. smartext : '.sl';
  165. unitext : '.ppu';
  166. unitlibext : '.ppl';
  167. asmext : '.s';
  168. objext : '.o';
  169. resext : '.res';
  170. resobjext : '.or';
  171. sharedlibext : '.so';
  172. staticlibext : '.s';
  173. staticlibprefix : 'libp';
  174. sharedlibprefix : 'lib';
  175. sharedClibext : '.so';
  176. staticClibext : '.a';
  177. staticClibprefix : 'lib';
  178. sharedClibprefix : 'lib';
  179. Cprefix : '';
  180. newline : #10;
  181. dirsep : '/';
  182. files_case_relevent : true;
  183. assem : as_gas;
  184. assemextern : as_gas;
  185. link : nil;
  186. linkextern : nil;
  187. ar : ar_gnu_ar;
  188. res : res_none;
  189. script : script_unix;
  190. endian : endian_big;
  191. alignment :
  192. (
  193. procalign : 4;
  194. loopalign : 4;
  195. jumpalign : 0;
  196. constalignmin : 0;
  197. constalignmax : 4;
  198. varalignmin : 0;
  199. varalignmax : 4;
  200. localalignmin : 0;
  201. localalignmax : 4;
  202. paraalign : 4;
  203. recordalignmin : 0;
  204. recordalignmax : 2;
  205. maxCrecordalign : 4
  206. );
  207. first_parm_offset : 8;
  208. heapsize : 256*1024;
  209. stacksize : 32*1024*1024;
  210. DllScanSupported:false;
  211. use_function_relative_addresses : true;
  212. abi : abi_powerpc_sysv;
  213. );
  214. system_alpha_linux_info : tsysteminfo =
  215. (
  216. system : system_alpha_LINUX;
  217. name : 'Linux for Alpha';
  218. shortname : 'linux';
  219. flags : [];
  220. cpu : cpu_alpha;
  221. unit_env : 'LINUXUNITS';
  222. extradefines : 'UNIX;HASUNIX';
  223. sourceext : '.pp';
  224. pasext : '.pas';
  225. exeext : '';
  226. defext : '.def';
  227. scriptext : '.sh';
  228. smartext : '.sl';
  229. unitext : '.ppu';
  230. unitlibext : '.ppl';
  231. asmext : '.s';
  232. objext : '.o';
  233. resext : '.res';
  234. resobjext : '.or';
  235. sharedlibext : '.so';
  236. staticlibext : '.a';
  237. staticlibprefix : 'libp';
  238. sharedlibprefix : 'lib';
  239. sharedClibext : '.so';
  240. staticClibext : '.a';
  241. staticClibprefix : 'lib';
  242. sharedClibprefix : 'lib';
  243. Cprefix : '';
  244. newline : #10;
  245. dirsep : '/';
  246. files_case_relevent : true;
  247. assem : as_gas;
  248. assemextern : as_gas;
  249. link : nil;
  250. linkextern : nil;
  251. ar : ar_gnu_ar;
  252. res : res_none;
  253. script : script_unix;
  254. endian : endian_little;
  255. alignment :
  256. (
  257. procalign : 4;
  258. loopalign : 4;
  259. jumpalign : 0;
  260. constalignmin : 0;
  261. constalignmax : 4;
  262. varalignmin : 0;
  263. varalignmax : 4;
  264. localalignmin : 0;
  265. localalignmax : 4;
  266. paraalign : 4;
  267. recordalignmin : 0;
  268. recordalignmax : 2;
  269. maxCrecordalign : 4
  270. );
  271. first_parm_offset : 8;
  272. heapsize : 256*1024;
  273. stacksize : 32*1024*1024;
  274. DllScanSupported:false;
  275. use_function_relative_addresses : true
  276. );
  277. system_x86_64_linux_info : tsysteminfo =
  278. (
  279. system : system_x86_64_LINUX;
  280. name : 'Linux for x86-64';
  281. shortname : 'linux';
  282. flags : [];
  283. cpu : cpu_x86_64;
  284. unit_env : 'LINUXUNITS';
  285. extradefines : 'UNIX;HASUNIX';
  286. sourceext : '.pp';
  287. pasext : '.pas';
  288. exeext : '';
  289. defext : '.def';
  290. scriptext : '.sh';
  291. smartext : '.sl';
  292. unitext : '.ppu';
  293. unitlibext : '.ppl';
  294. asmext : '.s';
  295. objext : '.o';
  296. resext : '.res';
  297. resobjext : '.or';
  298. sharedlibext : '.so';
  299. staticlibext : '.a';
  300. staticlibprefix : 'libp';
  301. sharedlibprefix : 'lib';
  302. sharedClibext : '.so';
  303. staticClibext : '.a';
  304. staticClibprefix : 'lib';
  305. sharedClibprefix : 'lib';
  306. Cprefix : '';
  307. newline : #10;
  308. dirsep : '/';
  309. files_case_relevent : true;
  310. assem : as_i386_elf32;
  311. assemextern : as_gas;
  312. link : nil;
  313. linkextern : nil;
  314. ar : ar_gnu_ar;
  315. res : res_none;
  316. script : script_unix;
  317. endian : endian_little;
  318. alignment :
  319. (
  320. procalign : 4;
  321. loopalign : 4;
  322. jumpalign : 0;
  323. constalignmin : 0;
  324. constalignmax : 1;
  325. varalignmin : 0;
  326. varalignmax : 1;
  327. localalignmin : 0;
  328. localalignmax : 1;
  329. paraalign : 4;
  330. recordalignmin : 0;
  331. recordalignmax : 2;
  332. maxCrecordalign : 4
  333. );
  334. first_parm_offset : 16;
  335. heapsize : 256*1024;
  336. stacksize : 16*1024;
  337. DllScanSupported:false;
  338. use_function_relative_addresses : true
  339. );
  340. system_SPARC_linux_info : tsysteminfo =
  341. (
  342. system : system_SPARC_Linux;
  343. name : 'Linux for SPARC';
  344. shortname : 'linux';
  345. flags : [];
  346. cpu : cpu_SPARC;
  347. unit_env : 'LINUXUNITS';
  348. extradefines : 'UNIX;HASUNIX';
  349. sourceext : '.pp';
  350. pasext : '.pas';
  351. exeext : '';
  352. defext : '.def';
  353. scriptext : '.sh';
  354. smartext : '.sl';
  355. unitext : '.ppu';
  356. unitlibext : '.ppl';
  357. asmext : '.s';
  358. objext : '.o';
  359. resext : '.res';
  360. resobjext : '.or';
  361. sharedlibext : '.so';
  362. staticlibext : '.a';
  363. staticlibprefix : 'libp';
  364. sharedlibprefix : 'lib';
  365. sharedClibext : '.so';
  366. staticClibext : '.a';
  367. staticClibprefix : 'lib';
  368. sharedClibprefix : 'lib';
  369. Cprefix : '';
  370. newline : #10;
  371. dirsep : '/';
  372. files_case_relevent : true;
  373. assem : as_gas;
  374. assemextern : as_gas;
  375. link : nil;
  376. linkextern : nil;
  377. ar : ar_gnu_ar;
  378. res : res_none;
  379. script : script_unix;
  380. endian : endian_big;
  381. alignment :
  382. (
  383. procalign : 4;
  384. loopalign : 4;
  385. jumpalign : 0;
  386. constalignmin : 0;
  387. constalignmax : 4;
  388. varalignmin : 0;
  389. varalignmax : 4;
  390. localalignmin : 0;
  391. localalignmax : 4;
  392. paraalign : 4;
  393. recordalignmin : 4;
  394. recordalignmax : 4;
  395. maxCrecordalign : 4
  396. );
  397. first_parm_offset : (16+1)*4;
  398. heapsize : 256*1024;
  399. stacksize : 262144;
  400. DllScanSupported:false;
  401. use_function_relative_addresses : true
  402. );
  403. system_arm_linux_info : tsysteminfo =
  404. (
  405. system : system_arm_Linux;
  406. name : 'Linux for ARM';
  407. shortname : 'linux';
  408. flags : [];
  409. cpu : cpu_arm;
  410. unit_env : 'LINUXUNITS';
  411. extradefines : 'UNIX;HASUNIX';
  412. sourceext : '.pp';
  413. pasext : '.pas';
  414. exeext : '';
  415. defext : '.def';
  416. scriptext : '.sh';
  417. smartext : '.sl';
  418. unitext : '.ppu';
  419. unitlibext : '.ppl';
  420. asmext : '.s';
  421. objext : '.o';
  422. resext : '.res';
  423. resobjext : '.or';
  424. sharedlibext : '.so';
  425. staticlibext : '.a';
  426. staticlibprefix : 'libp';
  427. sharedlibprefix : 'lib';
  428. sharedClibext : '.so';
  429. staticClibext : '.a';
  430. staticClibprefix : 'lib';
  431. sharedClibprefix : 'lib';
  432. Cprefix : '';
  433. newline : #10;
  434. dirsep : '/';
  435. files_case_relevent : true;
  436. assem : as_gas;
  437. assemextern : as_gas;
  438. link : nil;
  439. linkextern : nil;
  440. ar : ar_gnu_ar;
  441. res : res_none;
  442. script : script_unix;
  443. endian : endian_little;
  444. alignment :
  445. (
  446. procalign : 4;
  447. loopalign : 4;
  448. jumpalign : 0;
  449. constalignmin : 0;
  450. constalignmax : 4;
  451. varalignmin : 0;
  452. varalignmax : 4;
  453. localalignmin : 0;
  454. localalignmax : 4;
  455. paraalign : 4;
  456. recordalignmin : 4;
  457. recordalignmax : 4;
  458. maxCrecordalign : 4
  459. );
  460. first_parm_offset : 8;
  461. heapsize : 256*1024;
  462. stacksize : 262144;
  463. DllScanSupported:false;
  464. use_function_relative_addresses : true
  465. );
  466. implementation
  467. initialization
  468. {$ifdef CPU86}
  469. {$ifdef linux}
  470. { some FreeBSD versions define linux as well }
  471. {$ifndef FreeBSD}
  472. set_source_info(system_i386_linux_info);
  473. {$endif FreeBSD}
  474. {$endif}
  475. {$endif CPU86}
  476. {$ifdef CPU68}
  477. {$ifdef linux}
  478. set_source_info(system_m68k_linux_info);
  479. {$endif linux}
  480. {$endif CPU68}
  481. {$ifdef CPU86_64}
  482. {$ifdef linux}
  483. set_source_info(system_x86_64_linux_info);
  484. {$endif linux}
  485. {$endif CPU86_64}
  486. {$ifdef CPUALPHA}
  487. {$ifdef linux}
  488. set_source_info(system_alpha_linux_info);
  489. {$endif linux}
  490. {$endif CPUALPHA}
  491. {$ifdef CPUSPARC}
  492. {$ifdef linux}
  493. set_source_info(system_sparc_linux_info);
  494. {$endif linux}
  495. {$endif CPUSPARC}
  496. {$ifdef CPUPOWERPC}
  497. {$ifdef linux}
  498. set_source_info(system_powerpc_linux_info);
  499. {$endif linux}
  500. {$endif CPUPOWERPC}
  501. {$ifdef CPUARM}
  502. {$ifdef linux}
  503. set_source_info(system_arm_linux_info);
  504. {$endif linux}
  505. {$endif CPUARM}
  506. end.
  507. {
  508. $Log$
  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. }