i_linux.pas 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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_powerpc_sysv doesn't work yet }
  213. abi : abi_powerpc_aix;
  214. );
  215. system_alpha_linux_info : tsysteminfo =
  216. (
  217. system : system_alpha_LINUX;
  218. name : 'Linux for Alpha';
  219. shortname : 'linux';
  220. flags : [];
  221. cpu : cpu_alpha;
  222. unit_env : 'LINUXUNITS';
  223. extradefines : 'UNIX;HASUNIX';
  224. sourceext : '.pp';
  225. pasext : '.pas';
  226. exeext : '';
  227. defext : '.def';
  228. scriptext : '.sh';
  229. smartext : '.sl';
  230. unitext : '.ppu';
  231. unitlibext : '.ppl';
  232. asmext : '.s';
  233. objext : '.o';
  234. resext : '.res';
  235. resobjext : '.or';
  236. sharedlibext : '.so';
  237. staticlibext : '.a';
  238. staticlibprefix : 'libp';
  239. sharedlibprefix : 'lib';
  240. sharedClibext : '.so';
  241. staticClibext : '.a';
  242. staticClibprefix : 'lib';
  243. sharedClibprefix : 'lib';
  244. Cprefix : '';
  245. newline : #10;
  246. dirsep : '/';
  247. files_case_relevent : true;
  248. assem : as_gas;
  249. assemextern : as_gas;
  250. link : nil;
  251. linkextern : nil;
  252. ar : ar_gnu_ar;
  253. res : res_none;
  254. script : script_unix;
  255. endian : endian_little;
  256. alignment :
  257. (
  258. procalign : 4;
  259. loopalign : 4;
  260. jumpalign : 0;
  261. constalignmin : 0;
  262. constalignmax : 4;
  263. varalignmin : 0;
  264. varalignmax : 4;
  265. localalignmin : 0;
  266. localalignmax : 4;
  267. paraalign : 4;
  268. recordalignmin : 0;
  269. recordalignmax : 2;
  270. maxCrecordalign : 4
  271. );
  272. first_parm_offset : 8;
  273. heapsize : 256*1024;
  274. stacksize : 32*1024*1024;
  275. DllScanSupported:false;
  276. use_function_relative_addresses : true
  277. );
  278. system_x86_64_linux_info : tsysteminfo =
  279. (
  280. system : system_x86_64_LINUX;
  281. name : 'Linux for x86-64';
  282. shortname : 'linux';
  283. flags : [];
  284. cpu : cpu_x86_64;
  285. unit_env : 'LINUXUNITS';
  286. extradefines : 'UNIX;HASUNIX';
  287. sourceext : '.pp';
  288. pasext : '.pas';
  289. exeext : '';
  290. defext : '.def';
  291. scriptext : '.sh';
  292. smartext : '.sl';
  293. unitext : '.ppu';
  294. unitlibext : '.ppl';
  295. asmext : '.s';
  296. objext : '.o';
  297. resext : '.res';
  298. resobjext : '.or';
  299. sharedlibext : '.so';
  300. staticlibext : '.a';
  301. staticlibprefix : 'libp';
  302. sharedlibprefix : 'lib';
  303. sharedClibext : '.so';
  304. staticClibext : '.a';
  305. staticClibprefix : 'lib';
  306. sharedClibprefix : 'lib';
  307. Cprefix : '';
  308. newline : #10;
  309. dirsep : '/';
  310. files_case_relevent : true;
  311. assem : as_i386_elf32;
  312. assemextern : as_gas;
  313. link : nil;
  314. linkextern : nil;
  315. ar : ar_gnu_ar;
  316. res : res_none;
  317. script : script_unix;
  318. endian : endian_little;
  319. alignment :
  320. (
  321. procalign : 4;
  322. loopalign : 4;
  323. jumpalign : 0;
  324. constalignmin : 0;
  325. constalignmax : 1;
  326. varalignmin : 0;
  327. varalignmax : 1;
  328. localalignmin : 0;
  329. localalignmax : 1;
  330. paraalign : 4;
  331. recordalignmin : 0;
  332. recordalignmax : 2;
  333. maxCrecordalign : 4
  334. );
  335. first_parm_offset : 16;
  336. heapsize : 256*1024;
  337. stacksize : 16*1024;
  338. DllScanSupported:false;
  339. use_function_relative_addresses : true
  340. );
  341. system_SPARC_linux_info : tsysteminfo =
  342. (
  343. system : system_SPARC_Linux;
  344. name : 'Linux for SPARC';
  345. shortname : 'linux';
  346. flags : [];
  347. cpu : cpu_SPARC;
  348. unit_env : 'LINUXUNITS';
  349. extradefines : 'UNIX;HASUNIX';
  350. sourceext : '.pp';
  351. pasext : '.pas';
  352. exeext : '';
  353. defext : '.def';
  354. scriptext : '.sh';
  355. smartext : '.sl';
  356. unitext : '.ppu';
  357. unitlibext : '.ppl';
  358. asmext : '.s';
  359. objext : '.o';
  360. resext : '.res';
  361. resobjext : '.or';
  362. sharedlibext : '.so';
  363. staticlibext : '.a';
  364. staticlibprefix : 'libp';
  365. sharedlibprefix : 'lib';
  366. sharedClibext : '.so';
  367. staticClibext : '.a';
  368. staticClibprefix : 'lib';
  369. sharedClibprefix : 'lib';
  370. Cprefix : '';
  371. newline : #10;
  372. dirsep : '/';
  373. files_case_relevent : true;
  374. assem : as_gas;
  375. assemextern : as_gas;
  376. link : nil;
  377. linkextern : nil;
  378. ar : ar_gnu_ar;
  379. res : res_none;
  380. script : script_unix;
  381. endian : endian_big;
  382. alignment :
  383. (
  384. procalign : 4;
  385. loopalign : 4;
  386. jumpalign : 0;
  387. constalignmin : 0;
  388. constalignmax : 4;
  389. varalignmin : 0;
  390. varalignmax : 4;
  391. localalignmin : 0;
  392. localalignmax : 4;
  393. paraalign : 4;
  394. recordalignmin : 4;
  395. recordalignmax : 4;
  396. maxCrecordalign : 4
  397. );
  398. first_parm_offset : (16+1)*4;
  399. heapsize : 256*1024;
  400. stacksize : 262144;
  401. DllScanSupported:false;
  402. use_function_relative_addresses : true
  403. );
  404. implementation
  405. initialization
  406. {$ifdef CPU86}
  407. {$ifdef linux}
  408. { some FreeBSD versions define linux as well }
  409. {$ifndef FreeBSD}
  410. set_source_info(system_i386_linux_info);
  411. {$endif FreeBSD}
  412. {$endif}
  413. {$endif CPU86}
  414. {$ifdef CPU68}
  415. {$ifdef linux}
  416. set_source_info(system_m68k_linux_info);
  417. {$endif linux}
  418. {$endif CPU68}
  419. {$ifdef CPU86_64}
  420. {$ifdef linux}
  421. set_source_info(system_x86_64_linux_info);
  422. {$endif linux}
  423. {$endif CPU86_64}
  424. {$ifdef CPUALPHA}
  425. {$ifdef linux}
  426. set_source_info(system_alpha_linux_info);
  427. {$endif linux}
  428. {$endif CPUALPHA}
  429. {$ifdef CPUSPARC}
  430. {$ifdef linux}
  431. set_source_info(system_sparc_linux_info);
  432. {$endif linux}
  433. {$endif CPUSPARC}
  434. {$ifdef CPUPOWERPC}
  435. {$ifdef linux}
  436. set_source_info(system_powerpc_linux_info);
  437. {$endif linux}
  438. {$endif CPUPOWERPC}
  439. end.
  440. {
  441. $Log$
  442. Revision 1.9 2003-07-06 17:58:22 peter
  443. * framepointer fixes for sparc
  444. * parent framepointer code more generic
  445. Revision 1.8 2003/05/31 18:14:06 jonas
  446. * add default system for ppc
  447. Revision 1.7 2003/05/19 12:15:28 florian
  448. * fixed calling sequence for subroutines using the aix abi
  449. Revision 1.6 2003/05/18 15:15:59 florian
  450. + added abi field to tsysteminfo
  451. Revision 1.5 2003/04/30 15:45:35 florian
  452. * merged more x86-64/i386 code
  453. Revision 1.4 2003/02/06 22:36:55 mazen
  454. * fixing bug related to errornous program main entry stack frame
  455. Revision 1.3 2003/01/11 16:35:15 marco
  456. * HASUNIX defined for now.
  457. Revision 1.2 2002/10/04 21:57:42 mazen
  458. * 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
  459. Revision 1.1 2002/09/06 15:03:51 carl
  460. * moved files to systems directory
  461. Revision 1.3 2002/08/13 18:01:51 carl
  462. * rename swatoperands to swapoperands
  463. + m68k first compilable version (still needs a lot of testing):
  464. assembler generator, system information , inline
  465. assembler reader.
  466. Revision 1.2 2002/08/12 15:08:39 carl
  467. + stab register indexes for powerpc (moved from gdb to cpubase)
  468. + tprocessor enumeration moved to cpuinfo
  469. + linker in target_info is now a class
  470. * many many updates for m68k (will soon start to compile)
  471. - removed some ifdef or correct them for correct cpu
  472. Revision 1.1 2002/07/26 21:15:38 florian
  473. * rewrote the system handling
  474. }