i_bsd.pas 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. {
  2. Copyright (c) 1998-2002 by Peter Vreman
  3. This unit implements support information structures for FreeBSD/NetBSD
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. { This unit implements support information structures for FreeBSD/NetBSD.
  18. OpenBSD is only added for i386 for now, though it exists for most
  19. other common CPU's too}
  20. unit i_bsd;
  21. {$i fpcdefs.inc}
  22. interface
  23. uses
  24. systems;
  25. const
  26. system_i386_freebsd_info : tsysteminfo =
  27. (
  28. system : system_i386_FreeBSD;
  29. name : 'FreeBSD/ELF for i386';
  30. shortname : 'FreeBSD';
  31. flags : [tf_pic_uses_got,tf_files_case_sensitive,tf_use_function_relative_addresses,
  32. {$ifdef segment_threadvars}
  33. tf_section_threadvars,
  34. {$endif segment_threadvars}
  35. tf_needs_symbol_type,tf_needs_symbol_size,tf_smartlink_library {,tf_smartlink_sections}];
  36. cpu : cpu_i386;
  37. unit_env : 'BSDUNITS';
  38. extradefines : 'UNIX;BSD;HASUNIX';
  39. exeext : '';
  40. defext : '.def';
  41. scriptext : '.sh';
  42. smartext : '.sl';
  43. unitext : '.ppu';
  44. unitlibext : '.ppl';
  45. asmext : '.s';
  46. objext : '.o';
  47. resext : '.res';
  48. resobjext : '.or';
  49. sharedlibext : '.so';
  50. staticlibext : '.a';
  51. staticlibprefix : 'libp';
  52. sharedlibprefix : 'lib';
  53. sharedClibext : '.so';
  54. staticClibext : '.a';
  55. staticClibprefix : 'lib';
  56. sharedClibprefix : 'lib';
  57. Cprefix : '';
  58. newline : #10;
  59. dirsep : '/';
  60. assem : as_i386_elf32;
  61. assemextern : as_gas;
  62. link : nil;
  63. linkextern : nil;
  64. ar : ar_gnu_ar;
  65. res : res_none;
  66. dbg : dbg_stabs;
  67. script : script_unix;
  68. endian : endian_little;
  69. alignment :
  70. (
  71. procalign : 4;
  72. loopalign : 4;
  73. jumpalign : 0;
  74. constalignmin : 0;
  75. constalignmax : 4;
  76. varalignmin : 0;
  77. varalignmax : 4;
  78. localalignmin : 0;
  79. localalignmax : 4;
  80. recordalignmin : 0;
  81. recordalignmax : 2;
  82. maxCrecordalign : 4
  83. );
  84. first_parm_offset : 8;
  85. stacksize : 262144;
  86. abi : abi_default;
  87. );
  88. system_x86_64_freebsd_info : tsysteminfo =
  89. (
  90. system : system_x86_64_freebsd;
  91. name : 'FreeBSD for x86-64';
  92. shortname : 'FreeBSD';
  93. flags : [tf_needs_symbol_size,tf_needs_dwarf_cfi,{Linux: tf_library_needs_pic,}tf_needs_symbol_type,
  94. tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library
  95. { tf_pic_uses_got,tf_smartlink_sections}];
  96. cpu : cpu_x86_64;
  97. unit_env : 'BSDUNITS';
  98. extradefines : 'UNIX;HASUNIX;BSD';
  99. exeext : '';
  100. defext : '.def';
  101. scriptext : '.sh';
  102. smartext : '.sl';
  103. unitext : '.ppu';
  104. unitlibext : '.ppl';
  105. asmext : '.s';
  106. objext : '.o';
  107. resext : '.res';
  108. resobjext : '.or';
  109. sharedlibext : '.so';
  110. staticlibext : '.a';
  111. staticlibprefix : 'libp';
  112. sharedlibprefix : 'lib';
  113. sharedClibext : '.so';
  114. staticClibext : '.a';
  115. staticClibprefix : 'lib';
  116. sharedClibprefix : 'lib';
  117. Cprefix : '';
  118. newline : #10;
  119. dirsep : '/';
  120. assem : as_x86_64_elf64;
  121. assemextern : as_gas;
  122. link : nil;
  123. linkextern : nil;
  124. ar : ar_gnu_ar;
  125. res : res_none;
  126. dbg : dbg_dwarf2; //dbg_stabs;
  127. script : script_unix;
  128. endian : endian_little;
  129. alignment :
  130. (
  131. procalign : 8;
  132. loopalign : 4;
  133. jumpalign : 0;
  134. constalignmin : 0;
  135. constalignmax : 8;
  136. varalignmin : 0;
  137. varalignmax : 16;
  138. localalignmin : 4;
  139. localalignmax : 16;
  140. recordalignmin : 0;
  141. recordalignmax : 16;
  142. maxCrecordalign : 8
  143. );
  144. first_parm_offset : 16;
  145. stacksize : 256*1024;
  146. abi : abi_default;
  147. );
  148. system_i386_netbsd_info : tsysteminfo =
  149. (
  150. system : system_i386_NetBSD;
  151. name : 'NetBSD for i386';
  152. shortname : 'NetBSD';
  153. flags : [tf_under_development,tf_files_case_sensitive,tf_smartlink_library,tf_use_function_relative_addresses];
  154. cpu : cpu_i386;
  155. unit_env : 'BSDUNITS';
  156. extradefines : 'UNIX;BSD;HASUNIX';
  157. exeext : '';
  158. defext : '.def';
  159. scriptext : '.sh';
  160. smartext : '.sl';
  161. unitext : '.ppu';
  162. unitlibext : '.ppl';
  163. asmext : '.s';
  164. objext : '.o';
  165. resext : '.res';
  166. resobjext : '.or';
  167. sharedlibext : '.so';
  168. staticlibext : '.a';
  169. staticlibprefix : 'libp';
  170. sharedlibprefix : 'lib';
  171. sharedClibext : '.so';
  172. staticClibext : '.a';
  173. staticClibprefix : 'lib';
  174. sharedClibprefix : 'lib';
  175. Cprefix : '_';
  176. newline : #10;
  177. dirsep : '/';
  178. assem : as_gas;
  179. assemextern : as_gas;
  180. link : nil;
  181. linkextern : nil;
  182. ar : ar_gnu_ar;
  183. res : res_none;
  184. dbg : dbg_stabs;
  185. script : script_unix;
  186. endian : endian_little;
  187. alignment :
  188. (
  189. procalign : 4;
  190. loopalign : 4;
  191. jumpalign : 0;
  192. constalignmin : 0;
  193. constalignmax : 1;
  194. varalignmin : 0;
  195. varalignmax : 1;
  196. localalignmin : 0;
  197. localalignmax : 1;
  198. recordalignmin : 0;
  199. recordalignmax : 2;
  200. maxCrecordalign : 4
  201. );
  202. first_parm_offset : 8;
  203. stacksize : 262144;
  204. abi : abi_default;
  205. );
  206. system_i386_openbsd_info : tsysteminfo =
  207. (
  208. system : system_i386_OpenBSD;
  209. name : 'OpenBSD for i386';
  210. shortname : 'OpenBSD';
  211. flags : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
  212. cpu : cpu_i386;
  213. unit_env : 'BSDUNITS';
  214. extradefines : 'UNIX;BSD;HASUNIX';
  215. exeext : '';
  216. defext : '.def';
  217. scriptext : '.sh';
  218. smartext : '.sl';
  219. unitext : '.ppu';
  220. unitlibext : '.ppl';
  221. asmext : '.s';
  222. objext : '.o';
  223. resext : '.res';
  224. resobjext : '.or';
  225. sharedlibext : '.so';
  226. staticlibext : '.a';
  227. staticlibprefix : 'libp';
  228. sharedlibprefix : 'lib';
  229. sharedClibext : '.so';
  230. staticClibext : '.a';
  231. staticClibprefix : 'lib';
  232. sharedClibprefix : 'lib';
  233. Cprefix : '_';
  234. newline : #10;
  235. dirsep : '/';
  236. assem : as_gas;
  237. assemextern : as_gas;
  238. link : nil;
  239. linkextern : nil;
  240. ar : ar_gnu_ar;
  241. res : res_none;
  242. dbg : dbg_stabs;
  243. script : script_unix;
  244. endian : endian_little;
  245. alignment :
  246. (
  247. procalign : 4;
  248. loopalign : 4;
  249. jumpalign : 0;
  250. constalignmin : 0;
  251. constalignmax : 1;
  252. varalignmin : 0;
  253. varalignmax : 1;
  254. localalignmin : 0;
  255. localalignmax : 1;
  256. recordalignmin : 0;
  257. recordalignmax : 2;
  258. maxCrecordalign : 4
  259. );
  260. first_parm_offset : 8;
  261. stacksize : 262144;
  262. abi : abi_default;
  263. );
  264. system_m68k_netbsd_info : tsysteminfo =
  265. (
  266. system : system_m68k_NetBSD;
  267. name : 'NetBSD for m68k';
  268. shortname : 'NetBSD';
  269. flags : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
  270. cpu : cpu_m68k;
  271. unit_env : 'BSDUNITS';
  272. extradefines : 'UNIX;BSD;HASUNIX';
  273. exeext : '';
  274. defext : '.def';
  275. scriptext : '.sh';
  276. smartext : '.sl';
  277. unitext : '.ppu';
  278. unitlibext : '.ppl';
  279. asmext : '.s';
  280. objext : '.o';
  281. resext : '.res';
  282. resobjext : '.or';
  283. sharedlibext : '.so';
  284. staticlibext : '.a';
  285. staticlibprefix : 'libp';
  286. sharedlibprefix : 'lib';
  287. sharedClibext : '.so';
  288. staticClibext : '.a';
  289. staticClibprefix : 'lib';
  290. sharedClibprefix : 'lib';
  291. Cprefix : '';
  292. newline : #10;
  293. dirsep : '/';
  294. assem : as_gas;
  295. assemextern : as_gas;
  296. link : nil;
  297. linkextern : nil;
  298. ar : ar_gnu_ar;
  299. res : res_none;
  300. dbg : dbg_stabs;
  301. script : script_unix;
  302. endian : endian_big;
  303. alignment :
  304. (
  305. procalign : 4;
  306. loopalign : 4;
  307. jumpalign : 0;
  308. constalignmin : 0;
  309. constalignmax : 1;
  310. varalignmin : 0;
  311. varalignmax : 1;
  312. localalignmin : 0;
  313. localalignmax : 1;
  314. recordalignmin : 0;
  315. recordalignmax : 2;
  316. maxCrecordalign : 4
  317. );
  318. first_parm_offset : 8;
  319. stacksize : 262144;
  320. abi : abi_default;
  321. );
  322. system_powerpc_netbsd_info : tsysteminfo =
  323. (
  324. system : system_powerpc_netbsd;
  325. name : 'NetBSD for PowerPC';
  326. shortname : 'NetBSD';
  327. flags : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
  328. cpu : cpu_powerpc;
  329. unit_env : '';
  330. extradefines : 'UNIX;BSD;HASUNIX';
  331. exeext : '';
  332. defext : '.def';
  333. scriptext : '.sh';
  334. smartext : '.sl';
  335. unitext : '.ppu';
  336. unitlibext : '.ppl';
  337. asmext : '.s';
  338. objext : '.o';
  339. resext : '.res';
  340. resobjext : '.or';
  341. sharedlibext : '.so';
  342. staticlibext : '.s';
  343. staticlibprefix : 'libp';
  344. sharedlibprefix : 'lib';
  345. sharedClibext : '.so';
  346. staticClibext : '.a';
  347. staticClibprefix : 'lib';
  348. sharedClibprefix : 'lib';
  349. Cprefix : '';
  350. newline : #10;
  351. dirsep : '/';
  352. assem : as_gas;
  353. assemextern : as_gas;
  354. link : nil;
  355. linkextern : nil;
  356. ar : ar_gnu_ar;
  357. res : res_none;
  358. dbg : dbg_stabs;
  359. script : script_unix;
  360. endian : endian_big;
  361. alignment :
  362. (
  363. procalign : 4;
  364. loopalign : 4;
  365. jumpalign : 0;
  366. constalignmin : 0;
  367. constalignmax : 4;
  368. varalignmin : 0;
  369. varalignmax : 4;
  370. localalignmin : 0;
  371. localalignmax : 4;
  372. recordalignmin : 0;
  373. recordalignmax : 2;
  374. maxCrecordalign : 4 // should be 8 probably
  375. );
  376. first_parm_offset : 8;
  377. stacksize : 32*1024*1024;
  378. { abi_powerpc_sysv doesn't work yet }
  379. abi : abi_powerpc_aix;
  380. );
  381. system_powerpc_darwin_info : tsysteminfo =
  382. (
  383. system : system_powerpc_darwin;
  384. name : 'Darwin for PowerPC';
  385. shortname : 'Darwin';
  386. flags : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
  387. cpu : cpu_powerpc;
  388. unit_env : 'BSDUNITS';
  389. extradefines : 'UNIX;BSD;HASUNIX';
  390. exeext : '';
  391. defext : '.def';
  392. scriptext : '.sh';
  393. smartext : '.sl';
  394. unitext : '.ppu';
  395. unitlibext : '.ppl';
  396. asmext : '.s';
  397. objext : '.o';
  398. resext : '.res';
  399. resobjext : '.or';
  400. sharedlibext : '.dylib';
  401. staticlibext : '.a';
  402. staticlibprefix : 'libp';
  403. sharedlibprefix : 'lib';
  404. sharedClibext : '.dylib';
  405. staticClibext : '.a';
  406. staticClibprefix : 'lib';
  407. sharedClibprefix : 'lib';
  408. Cprefix : '_';
  409. newline : #10;
  410. dirsep : '/';
  411. assem : as_darwin;
  412. assemextern : as_darwin;
  413. link : nil;
  414. linkextern : nil;
  415. ar : ar_gnu_ar;
  416. res : res_none;
  417. dbg : dbg_stabs;
  418. script : script_unix;
  419. endian : endian_big;
  420. alignment :
  421. (
  422. procalign : 16;
  423. loopalign : 4;
  424. jumpalign : 0;
  425. constalignmin : 0;
  426. constalignmax : 4;
  427. varalignmin : 0;
  428. varalignmax : 4;
  429. localalignmin : 0;
  430. localalignmax : 4;
  431. recordalignmin : 0;
  432. recordalignmax : 4;
  433. maxCrecordalign : 4
  434. );
  435. first_parm_offset : 24;
  436. stacksize : 262144;
  437. abi : abi_powerpc_aix;
  438. );
  439. system_i386_darwin_info : tsysteminfo =
  440. (
  441. system : system_i386_darwin;
  442. name : 'Darwin for i386';
  443. shortname : 'Darwin';
  444. flags : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_uses_got,tf_pic_default];
  445. cpu : cpu_i386;
  446. unit_env : 'BSDUNITS';
  447. extradefines : 'UNIX;BSD;HASUNIX';
  448. exeext : '';
  449. defext : '.def';
  450. scriptext : '.sh';
  451. smartext : '.sl';
  452. unitext : '.ppu';
  453. unitlibext : '.ppl';
  454. asmext : '.s';
  455. objext : '.o';
  456. resext : '.res';
  457. resobjext : '.or';
  458. sharedlibext : '.dylib';
  459. staticlibext : '.a';
  460. staticlibprefix : 'libp';
  461. sharedlibprefix : 'lib';
  462. sharedClibext : '.dylib';
  463. staticClibext : '.a';
  464. staticClibprefix : 'lib';
  465. sharedClibprefix : 'lib';
  466. Cprefix : '_';
  467. newline : #10;
  468. dirsep : '/';
  469. assem : as_darwin;
  470. assemextern : as_darwin;
  471. link : nil;
  472. linkextern : nil;
  473. ar : ar_gnu_ar;
  474. res : res_none;
  475. dbg : dbg_stabs;
  476. script : script_unix;
  477. endian : endian_little;
  478. alignment :
  479. (
  480. procalign : 16;
  481. loopalign : 4;
  482. jumpalign : 0;
  483. constalignmin : 0;
  484. constalignmax : 8;
  485. varalignmin : 0;
  486. varalignmax : 16;
  487. localalignmin : 0;
  488. localalignmax : 8;
  489. recordalignmin : 0;
  490. recordalignmax : 16;
  491. maxCrecordalign : 16
  492. );
  493. first_parm_offset : 8;
  494. stacksize : 262144;
  495. abi : abi_default;
  496. );
  497. system_powerpc64_darwin_info : tsysteminfo =
  498. (
  499. system : system_powerpc64_darwin;
  500. name : 'Darwin for PowerPC64';
  501. shortname : 'Darwin';
  502. flags : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
  503. cpu : cpu_powerpc64;
  504. unit_env : 'BSDUNITS';
  505. extradefines : 'UNIX;BSD;HASUNIX';
  506. exeext : '';
  507. defext : '.def';
  508. scriptext : '.sh';
  509. smartext : '.sl';
  510. unitext : '.ppu';
  511. unitlibext : '.ppl';
  512. asmext : '.s';
  513. objext : '.o';
  514. resext : '.res';
  515. resobjext : '.or';
  516. sharedlibext : '.dylib';
  517. staticlibext : '.a';
  518. staticlibprefix : 'libp';
  519. sharedlibprefix : 'lib';
  520. sharedClibext : '.dylib';
  521. staticClibext : '.a';
  522. staticClibprefix : 'lib';
  523. sharedClibprefix : 'lib';
  524. Cprefix : '_';
  525. newline : #10;
  526. dirsep : '/';
  527. assem : as_darwin;
  528. assemextern : as_darwin;
  529. link : nil;
  530. linkextern : nil;
  531. ar : ar_gnu_ar;
  532. res : res_none;
  533. dbg : dbg_dwarf2;
  534. script : script_unix;
  535. endian : endian_big;
  536. alignment :
  537. (
  538. procalign : 16;
  539. loopalign : 4;
  540. jumpalign : 0;
  541. constalignmin : 4;
  542. constalignmax : 8;
  543. varalignmin : 4;
  544. varalignmax : 8;
  545. localalignmin : 4;
  546. localalignmax : 8;
  547. recordalignmin : 0;
  548. recordalignmax : 8;
  549. maxCrecordalign : 8
  550. );
  551. first_parm_offset : 48;
  552. stacksize : 262144;
  553. abi : abi_powerpc_aix;
  554. );
  555. implementation
  556. initialization
  557. {$ifdef cpu86}
  558. {$ifdef FreeBSD}
  559. set_source_info(system_i386_FreeBSD_info);
  560. {$endif}
  561. {$ifdef NetBSD}
  562. set_source_info(system_i386_NetBSD_info);
  563. {$endif}
  564. {$ifdef OpenBSD}
  565. set_source_info(system_i386_NetBSD_info);
  566. {$endif}
  567. {$ifdef Darwin}
  568. set_source_info(system_i386_Darwin_info);
  569. {$endif Darwin}
  570. {$endif cpu86}
  571. {$ifdef cpux86_64}
  572. {$ifdef FreeBSD}
  573. set_source_info(system_x86_64_FreeBSD_info);
  574. {$endif}
  575. {$endif}
  576. {$ifdef cpu68}
  577. {$ifdef NetBSD}
  578. set_source_info(system_m68k_NetBSD_info);
  579. {$endif NetBSD}
  580. {$endif cpu68}
  581. {$ifdef cpupowerpc32}
  582. {$ifdef Darwin}
  583. set_source_info(system_powerpc_darwin_info);
  584. {$endif Darwin}
  585. {$ifdef NetBSD}
  586. set_source_info(system_powerpc_netbsd_info);
  587. {$endif}
  588. {$endif cpupowerpc32}
  589. {$ifdef cpupowerpc64}
  590. {$ifdef Darwin}
  591. set_source_info(system_powerpc64_darwin_info);
  592. {$endif Darwin}
  593. {$endif powerpc64}
  594. end.