agppcgas.pas 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. This unit the GAS asm writers for PowerPC/PowerPC64
  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. {****************************************************************************}
  18. { Helper routines for Instruction Writer }
  19. {****************************************************************************}
  20. unit agppcgas;
  21. {$i fpcdefs.inc}
  22. interface
  23. uses
  24. systems,aasmbase,
  25. aasmtai,aasmdata,
  26. assemble,aggas,
  27. cpubase,cgutils,
  28. globtype;
  29. type
  30. TPPCInstrWriter=class(TCPUInstrWriter)
  31. procedure WriteInstruction(hp : tai);override;
  32. end;
  33. TPPCGNUAssembler=class(TGNUassembler)
  34. constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
  35. function MakeCmdLine: TCmdStr; override;
  36. procedure WriteExtraHeader; override;
  37. end;
  38. TPPCAppleGNUAssembler=class(TAppleGNUassembler)
  39. constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
  40. function MakeCmdLine: TCmdStr; override;
  41. end;
  42. TPPCAIXAssembler=class(TPPCGNUAssembler)
  43. max_alignment : array[TAsmSectionType] of longint;
  44. constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
  45. protected
  46. function sectionname(atype: TAsmSectiontype; const aname: string; aorder: TAsmSectionOrder): string; override;
  47. procedure WriteSection(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder;secalign:longint); override;
  48. procedure WriteAsmList; override;
  49. procedure WriteExtraHeader; override;
  50. procedure WriteExtraFooter; override;
  51. procedure WriteDirectiveName(dir: TAsmDirective); override;
  52. end;
  53. topstr = string[4];
  54. function branchmode(o: tasmop): topstr;
  55. function cond2str(op: tasmop; c: tasmcond): string;
  56. implementation
  57. uses
  58. cutils,globals,verbose,
  59. cgbase,
  60. itcpugas,cpuinfo,
  61. aasmcpu;
  62. {$ifdef cpu64bitaddr}
  63. const
  64. refaddr2str: array[trefaddr] of string[9] = ('', '', '', '', '@l', '@h', '@higher', '@highest', '@ha', '@highera', '@highesta');
  65. verbose_refaddrs = [addr_low, addr_high, addr_higher, addr_highest, addr_higha, addr_highera, addr_highesta];
  66. refaddr2str_darwin: array[trefaddr] of string[4] = ('','','','','lo16', 'hi16', '@err', '@err', 'ha16', '@err', '@err');
  67. {$else cpu64bitaddr}
  68. const
  69. refaddr2str: array[trefaddr] of string[3] = ('','','','','@l','@h','@ha');
  70. refaddr2str_darwin: array[trefaddr] of string[4] = ('','','','','lo16','hi16','ha16');
  71. verbose_refaddrs = [addr_low,addr_high,addr_higha];
  72. {$endif cpu64bitaddr}
  73. function getreferencestring(asminfo: pasminfo; var ref : treference) : string;
  74. var
  75. s : string;
  76. begin
  77. with ref do
  78. begin
  79. if ((offset < -32768) or (offset > 32767)) and
  80. (refaddr = addr_no) then
  81. internalerror(2006052501);
  82. case refaddr of
  83. addr_no:
  84. s := '';
  85. addr_pic_no_got:
  86. begin
  87. { used for TOC-based loads }
  88. if (base<>NR_RTOC) or
  89. (index<>NR_NO) or
  90. (offset<>0) or
  91. not assigned(symbol) then
  92. internalerror(2011122701);
  93. if asminfo^.dollarsign<>'$' then
  94. getreferencestring:=ReplaceForbiddenAsmSymbolChars(symbol.name)+'('+gas_regname(NR_RTOC)+')'
  95. else
  96. getreferencestring:=symbol.name+'('+gas_regname(NR_RTOC)+')';
  97. exit;
  98. end
  99. else
  100. begin
  101. if target_info.system in [system_powerpc_darwin,system_powerpc64_darwin] then
  102. s := refaddr2str_darwin[refaddr]
  103. else
  104. s :='';
  105. s := s+'(';
  106. if assigned(symbol) then
  107. begin
  108. if asminfo^.dollarsign<>'$' then
  109. begin
  110. s:=s+ReplaceForbiddenAsmSymbolChars(symbol.name);
  111. if assigned(relsymbol) then
  112. s:=s+'-'+ReplaceForbiddenAsmSymbolChars(relsymbol.name)
  113. end
  114. else
  115. begin
  116. s:=s+symbol.name;
  117. if assigned(relsymbol) then
  118. s:=s+'-'+relsymbol.name;
  119. end;
  120. end;
  121. end;
  122. end;
  123. if offset<0 then
  124. s:=s+tostr(offset)
  125. else
  126. if (offset>0) then
  127. begin
  128. if assigned(symbol) then
  129. s:=s+'+'+tostr(offset)
  130. else
  131. s:=s+tostr(offset);
  132. end;
  133. if not(refaddr in [addr_no,addr_pic_no_got]) then
  134. begin
  135. s := s+')';
  136. if (refaddr in verbose_refaddrs) and
  137. not(target_info.system in [system_powerpc_darwin,system_powerpc64_darwin]) then
  138. s := s+refaddr2str[refaddr];
  139. end;
  140. {$ifdef cpu64bitaddr}
  141. if (refaddr=addr_pic) and
  142. (target_info.system=system_powerpc64_linux) then
  143. s := s + '@got';
  144. {$endif cpu64bitaddr}
  145. if (index=NR_NO) then
  146. begin
  147. if offset=0 then
  148. begin
  149. if not (assigned(symbol)) then
  150. s:=s+'0';
  151. end;
  152. if (base<>NR_NO) then
  153. s:=s+'('+gas_regname(base)+')'
  154. else if not assigned(symbol) and
  155. not(refaddr in verbose_refaddrs) then
  156. s:=s+'(0)';
  157. end
  158. else if (index<>NR_NO) and (base<>NR_NO) then
  159. begin
  160. if (offset=0) then
  161. s:=s+gas_regname(base)+','+gas_regname(index)
  162. else
  163. internalerror(2006052502);
  164. end;
  165. end;
  166. getreferencestring:=s;
  167. end;
  168. function getopstr_jmp(asminfo: pasminfo; const o:toper) : string;
  169. var
  170. hs : string;
  171. begin
  172. case o.typ of
  173. top_reg :
  174. getopstr_jmp:=gas_regname(o.reg);
  175. { no top_ref jumping for powerpc }
  176. top_const :
  177. getopstr_jmp:=tostr(o.val);
  178. top_ref :
  179. begin
  180. if o.ref^.refaddr<>addr_full then
  181. internalerror(200402267);
  182. hs:=o.ref^.symbol.name;
  183. if asminfo^.dollarsign<>'$' then
  184. hs:=ReplaceForbiddenAsmSymbolChars(hs);
  185. if o.ref^.offset>0 then
  186. hs:=hs+'+'+tostr(o.ref^.offset)
  187. else
  188. if o.ref^.offset<0 then
  189. hs:=hs+tostr(o.ref^.offset);
  190. getopstr_jmp:=hs;
  191. end;
  192. top_none:
  193. getopstr_jmp:='';
  194. else
  195. internalerror(2002070603);
  196. end;
  197. end;
  198. function getopstr(asminfo: pasminfo; const o:toper) : string;
  199. var
  200. hs : string;
  201. begin
  202. case o.typ of
  203. top_reg:
  204. getopstr:=gas_regname(o.reg);
  205. top_const:
  206. getopstr:=tostr(longint(o.val));
  207. top_ref:
  208. if o.ref^.refaddr=addr_full then
  209. begin
  210. hs:=o.ref^.symbol.name;
  211. if asminfo^.dollarsign<>'$' then
  212. hs:=ReplaceForbiddenAsmSymbolChars(hs);
  213. if o.ref^.offset>0 then
  214. hs:=hs+'+'+tostr(o.ref^.offset)
  215. else
  216. if o.ref^.offset<0 then
  217. hs:=hs+tostr(o.ref^.offset);
  218. getopstr:=hs;
  219. end
  220. else
  221. getopstr:=getreferencestring(asminfo,o.ref^);
  222. else
  223. internalerror(2002070604);
  224. end;
  225. end;
  226. function branchmode(o: tasmop): topstr;
  227. var tempstr: topstr;
  228. begin
  229. tempstr := '';
  230. case o of
  231. A_BCCTR,A_BCCTRL: tempstr := 'ctr';
  232. A_BCLR,A_BCLRL: tempstr := 'lr';
  233. end;
  234. case o of
  235. A_BL,A_BLA,A_BCL,A_BCLA,A_BCCTRL,A_BCLRL: tempstr := tempstr+'l';
  236. end;
  237. case o of
  238. A_BA,A_BLA,A_BCA,A_BCLA: tempstr:=tempstr+'a';
  239. end;
  240. branchmode := tempstr;
  241. end;
  242. function cond2str(op: tasmop; c: tasmcond): string;
  243. { note: no checking is performed whether the given combination of }
  244. { conditions is valid }
  245. var
  246. tempstr: string;
  247. begin
  248. tempstr:=#9;
  249. case c.simple of
  250. false:
  251. begin
  252. cond2str := tempstr+gas_op2str[op];
  253. case c.dirhint of
  254. DH_None:;
  255. DH_Minus:
  256. cond2str:=cond2str+'-';
  257. DH_Plus:
  258. cond2str:=cond2str+'+';
  259. else
  260. internalerror(2003112901);
  261. end;
  262. cond2str:=cond2str+#9+tostr(c.bo)+','+tostr(c.bi);
  263. end;
  264. true:
  265. if (op >= A_B) and (op <= A_BCLRL) then
  266. case c.cond of
  267. { unconditional branch }
  268. C_NONE:
  269. cond2str := tempstr+gas_op2str[op];
  270. { bdnzt etc }
  271. else
  272. begin
  273. tempstr := tempstr+'b'+asmcondflag2str[c.cond]+
  274. branchmode(op);
  275. case c.dirhint of
  276. DH_None:
  277. tempstr:=tempstr+#9;
  278. DH_Minus:
  279. tempstr:=tempstr+('-'+#9);
  280. DH_Plus:
  281. tempstr:=tempstr+('+'+#9);
  282. else
  283. internalerror(2003112901);
  284. end;
  285. case c.cond of
  286. C_LT..C_NU:
  287. cond2str := tempstr+gas_regname(newreg(R_SPECIALREGISTER,c.cr,R_SUBWHOLE));
  288. C_T,C_F,C_DNZT,C_DNZF,C_DZT,C_DZF:
  289. cond2str := tempstr+tostr(c.crbit);
  290. else
  291. cond2str := tempstr;
  292. end;
  293. end;
  294. end
  295. { we have a trap instruction }
  296. else
  297. begin
  298. internalerror(2002070601);
  299. { not yet implemented !!!!!!!!!!!!!!!!!!!!! }
  300. { case tempstr := 'tw';}
  301. end;
  302. end;
  303. end;
  304. {****************************************************************************}
  305. { PowerPC Instruction Writer }
  306. {****************************************************************************}
  307. Procedure TPPCInstrWriter.WriteInstruction(hp : tai);
  308. var op: TAsmOp;
  309. s: string;
  310. i: byte;
  311. sep: string[3];
  312. begin
  313. op:=taicpu(hp).opcode;
  314. if is_calljmp(op) then
  315. begin
  316. { direct BO/BI in op[0] and op[1] not supported, put them in condition! }
  317. case op of
  318. A_B,A_BA,A_BL,A_BLA:
  319. s:=#9+gas_op2str[op]+#9;
  320. A_BCTR,A_BCTRL,A_BLR,A_BLRL:
  321. s:=#9+gas_op2str[op]
  322. else
  323. begin
  324. s:=cond2str(op,taicpu(hp).condition);
  325. if (s[length(s)] <> #9) and
  326. (taicpu(hp).ops>0) then
  327. s := s + ',';
  328. end;
  329. end;
  330. if (taicpu(hp).ops>0) and (taicpu(hp).oper[0]^.typ<>top_none) then
  331. begin
  332. { first write the current contents of s, because the symbol }
  333. { may be 255 characters }
  334. owner.writer.AsmWrite(s);
  335. s:=getopstr_jmp(owner.asminfo,taicpu(hp).oper[0]^);
  336. end;
  337. end
  338. else
  339. { process operands }
  340. begin
  341. s:=#9+gas_op2str[op];
  342. if taicpu(hp).ops<>0 then
  343. begin
  344. {
  345. if not is_calljmp(op) then
  346. sep:=','
  347. else
  348. }
  349. sep:=#9;
  350. for i:=0 to taicpu(hp).ops-1 do
  351. begin
  352. // debug code
  353. // writeln(s);
  354. // writeln(taicpu(hp).fileinfo.line);
  355. s:=s+sep+getopstr(owner.asminfo,taicpu(hp).oper[i]^);
  356. sep:=',';
  357. end;
  358. end;
  359. end;
  360. owner.writer.AsmWriteLn(s);
  361. end;
  362. {****************************************************************************}
  363. { GNU PPC Assembler writer }
  364. {****************************************************************************}
  365. constructor TPPCGNUAssembler.CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean);
  366. begin
  367. inherited;
  368. InstrWriter := TPPCInstrWriter.create(self);
  369. end;
  370. function TPPCGNUAssembler.MakeCmdLine: TCmdStr;
  371. begin
  372. result := inherited MakeCmdLine;
  373. {$ifdef cpu64bitaddr}
  374. Replace(result,'$ARCH','-a64')
  375. {$else cpu64bitaddr}
  376. { MorphOS has an old 2.9.1 GNU AS, with a bunch of patches
  377. to support the system, and it doesn't know the -a32 argument }
  378. if target_info.system = system_powerpc_morphos then
  379. Replace(result,'$ARCH','')
  380. else
  381. Replace(result,'$ARCH','-a32');
  382. {$endif cpu64bitaddr}
  383. end;
  384. procedure TPPCGNUAssembler.WriteExtraHeader;
  385. var
  386. i : longint;
  387. begin
  388. if target_info.abi = abi_powerpc_elfv2 then
  389. writer.AsmWriteln(#9'.abiversion 2');
  390. for i:=0 to 31 do
  391. writer.AsmWriteln(#9'.set'#9'r'+tostr(i)+','+tostr(i));
  392. for i:=0 to 31 do
  393. writer.AsmWriteln(#9'.set'#9'f'+tostr(i)+','+tostr(i));
  394. end;
  395. {****************************************************************************}
  396. { GNU/Apple PPC Assembler writer }
  397. {****************************************************************************}
  398. constructor TPPCAppleGNUAssembler.CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean);
  399. begin
  400. inherited;
  401. InstrWriter := TPPCInstrWriter.create(self);
  402. end;
  403. function TPPCAppleGNUAssembler.MakeCmdLine: TCmdStr;
  404. begin
  405. result := inherited MakeCmdLine;
  406. {$ifdef cpu64bitaddr}
  407. Replace(result,'$ARCH','ppc64')
  408. {$else cpu64bitaddr}
  409. case current_settings.cputype of
  410. cpu_PPC7400:
  411. Replace(result,'$ARCH','ppc7400');
  412. cpu_PPC970:
  413. Replace(result,'$ARCH','ppc970');
  414. else
  415. Replace(result,'$ARCH','ppc')
  416. end;
  417. {$endif cpu64bitaddr}
  418. end;
  419. {****************************************************************************}
  420. { AIX PPC Assembler writer }
  421. {****************************************************************************}
  422. constructor TPPCAIXAssembler.CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean);
  423. var
  424. cur_sectype : TAsmSectionType;
  425. begin
  426. inherited;
  427. InstrWriter := TPPCInstrWriter.create(self);
  428. { Use 8-byte alignment as default for all sections }
  429. for cur_sectype:=low(TAsmSectionType) to high(TAsmSectionType) do
  430. max_alignment[cur_sectype]:=8;
  431. end;
  432. procedure TPPCAIXAssembler.WriteSection(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder;secalign:longint);
  433. begin
  434. secalign:=max_alignment[atype];
  435. Inherited WriteSection(atype,aname,aorder,secalign);
  436. end;
  437. procedure TPPCAIXAssembler.WriteAsmList;
  438. var
  439. cur_sectype : TAsmSectionType;
  440. cur_list : TAsmList;
  441. hal : tasmlisttype;
  442. hp : tai;
  443. max_al : longint;
  444. begin
  445. { Parse all asmlists to get maximum alignement used for all types }
  446. for hal:=low(TasmlistType) to high(TasmlistType) do
  447. begin
  448. if not (current_asmdata.asmlists[hal].empty) then
  449. begin
  450. cur_sectype:=sec_none;
  451. hp:=tai(current_asmdata.asmlists[hal].First);
  452. while assigned(hp) do
  453. begin
  454. case hp.typ of
  455. ait_align :
  456. begin
  457. if tai_align_abstract(hp).aligntype > max_alignment[cur_sectype] then
  458. begin
  459. max_alignment[cur_sectype]:=tai_align_abstract(hp).aligntype;
  460. current_asmdata.asmlists[hal].InsertAfter(tai_comment.Create(strpnew('Alignment put to '+tostr(tai_align_abstract(hp).aligntype))),hp);
  461. end;
  462. end;
  463. ait_section :
  464. begin
  465. cur_sectype:=tai_section(hp).sectype;
  466. if tai_section(hp).secalign > max_alignment[cur_sectype] then
  467. begin
  468. max_alignment[cur_sectype]:=tai_section(hp).secalign;
  469. current_asmdata.asmlists[hal].InsertAfter(tai_comment.Create(strpnew('Section '
  470. +sectionname(tai_section(hp).sectype,'',secorder_default)+' alignment put to '+tostr(tai_section(hp).secalign))),hp);
  471. end;
  472. end;
  473. end;
  474. hp:=tai(hp.next);
  475. end;
  476. end;
  477. end;
  478. { sec_data, sec_rodata and sec_bss all are converted into .data[RW],
  479. in WriteSection below,
  480. so we take the maximum alignment of the three }
  481. max_al:=max_alignment[sec_data];
  482. max_al:=max(max_al,max_alignment[sec_rodata]);
  483. max_al:=max(max_al,max_alignment[sec_bss]);
  484. max_alignment[sec_data]:=max_al;
  485. max_alignment[sec_rodata]:=max_al;
  486. max_alignment[sec_bss]:=max_al;
  487. Inherited WriteAsmList;
  488. end;
  489. procedure TPPCAIXAssembler.WriteExtraHeader;
  490. var
  491. i: longint;
  492. begin
  493. inherited WriteExtraHeader;
  494. { map cr registers to plain numbers }
  495. for i:=0 to 7 do
  496. writer.AsmWriteln(#9'.set'#9'cr'+tostr(i)+','+tostr(i));
  497. { Ensure .data and .rodata sections are aligned to 8-byte boundary,
  498. required for correct RTTI alignment.
  499. AIX assembler seems to only care for the first
  500. alignment value given }
  501. writer.AsmWriteln(#9'.csect .data[RW],'+sectionalignment_aix(sec_data,max_alignment[sec_data]));
  502. writer.AsmWriteln(#9'.csect _data.bss_[BS],'+sectionalignment_aix(sec_data,max_alignment[sec_data]));
  503. { .rodata is translated into .text[RO]
  504. see sectionname in aggas unit. }
  505. writer.AsmWriteln(#9'.csect .text[RO],'+sectionalignment_aix(sec_rodata_norel,max_alignment[sec_rodata_norel]));
  506. { make sure we always have a code and toc section,
  507. the linker expects that }
  508. writer.AsmWriteln(#9'.csect .text[PR],'+sectionalignment_aix(sec_code,max_alignment[sec_code]));
  509. { set _text_s, to be used by footer below }
  510. writer.AsmWriteln(#9'_text_s:');
  511. writer.AsmWriteln(#9'.toc');
  512. end;
  513. procedure TPPCAIXAssembler.WriteExtraFooter;
  514. begin
  515. inherited WriteExtraFooter;
  516. { link between data and text section }
  517. writer.AsmWriteln(#9'.csect .data[RW],3');
  518. {$ifdef cpu64bitaddr}
  519. writer.AsmWriteln('text_pos:'#9'.llong _text_s')
  520. {$else cpu64bitaddr}
  521. writer.AsmWriteln('text_pos:'#9'.long _text_s')
  522. {$endif cpu64bitaddr}
  523. end;
  524. procedure TPPCAIXAssembler.WriteDirectiveName(dir: TAsmDirective);
  525. begin
  526. case dir of
  527. asd_reference:
  528. writer.AsmWrite('.ref ');
  529. asd_weak_reference,
  530. asd_weak_definition:
  531. writer.AsmWrite('.weak ');
  532. else
  533. inherited WriteDirectiveName(dir);
  534. end;
  535. end;
  536. function TPPCAIXAssembler.sectionname(atype: TAsmSectiontype; const aname: string; aorder: TAsmSectionOrder): string;
  537. begin
  538. case atype of
  539. sec_code:
  540. result:='.csect .text[PR]';
  541. sec_data,
  542. sec_rodata,
  543. { don't use .bss[BS], causes relocation problems }
  544. sec_bss:
  545. result:='.csect .data[RW]';
  546. sec_rodata_norel:
  547. result:='.csect .text[RO]';
  548. sec_fpc:
  549. result:='.csect .fpc[RO]';
  550. sec_toc:
  551. result:='.toc';
  552. { automatically placed in the right section }
  553. sec_stab,
  554. sec_stabstr:
  555. result:='';
  556. else
  557. internalerror(2011122601);
  558. end;
  559. end;
  560. {*****************************************************************************
  561. Initialize
  562. *****************************************************************************}
  563. const
  564. as_ppc_gas_info : tasminfo =
  565. (
  566. id : as_gas;
  567. idtxt : 'AS';
  568. asmbin : 'as';
  569. {$ifdef cpu64bitaddr}
  570. asmcmd : '-a64 $ENDIAN -o $OBJ $EXTRAOPT $ASM';
  571. {$else cpu64bitaddr}
  572. asmcmd: '$ENDIAN -o $OBJ $EXTRAOPT $ARCH $ASM';
  573. {$endif cpu64bitaddr}
  574. supported_targets : [system_powerpc_linux,system_powerpc_netbsd,system_powerpc_openbsd,system_powerpc_MorphOS,system_powerpc_Amiga,system_powerpc64_linux,system_powerpc_embedded,system_powerpc64_embedded];
  575. flags : [af_needar,af_smartlink_sections];
  576. labelprefix : '.L';
  577. comment : '# ';
  578. dollarsign: '$';
  579. );
  580. as_ppc_gas_legacy_info : tasminfo =
  581. (
  582. id : as_powerpc_gas_legacy;
  583. idtxt : 'AS-LEGACY';
  584. asmbin : 'as';
  585. {$ifdef cpu64bitaddr}
  586. asmcmd : '-a64 $ENDIAN -o $OBJ $EXTRAOPT $ASM';
  587. {$else cpu64bitaddr}
  588. asmcmd: '$ENDIAN -o $OBJ $EXTRAOPT $ARCH $ASM';
  589. {$endif cpu64bitaddr}
  590. supported_targets : [system_powerpc_morphos];
  591. flags : [af_needar];
  592. labelprefix : '.L';
  593. comment : '# ';
  594. dollarsign: '$';
  595. );
  596. as_ppc_gas_darwin_powerpc_info : tasminfo =
  597. (
  598. id : as_darwin;
  599. idtxt : 'AS-DARWIN';
  600. asmbin : 'as';
  601. asmcmd : '-o $OBJ $EXTRAOPT $ASM -arch $ARCH';
  602. supported_targets : [system_powerpc_darwin,system_powerpc64_darwin];
  603. flags : [af_needar,af_smartlink_sections,af_supports_dwarf,af_stabs_use_function_absolute_addresses];
  604. labelprefix : 'L';
  605. comment : '# ';
  606. dollarsign : '$';
  607. );
  608. as_ppc_aix_powerpc_info : tasminfo =
  609. (
  610. id : as_powerpc_xcoff;
  611. idtxt : 'AS-AIX';
  612. asmbin : 'as';
  613. { -u: allow using symbols before they are defined (when using native
  614. AIX assembler, ignore by GNU assembler)
  615. -mpwr5: we actually support Power3 and higher, but the AIX assembler
  616. has no parameter to select that one (only -mpwr3 and -mpwr5) }
  617. {$ifdef cpu64bitaddr}
  618. asmcmd : '-a64 -u -o $OBJ $EXTRAOPT $ASM -mpwr5';
  619. {$else cpu64bitaddr}
  620. asmcmd : '-u -o $OBJ $EXTRAOPT $ASM -mpwr5';
  621. {$endif cpu64bitaddr}
  622. supported_targets : [system_powerpc_aix,system_powerpc64_aix];
  623. flags : [af_needar,af_smartlink_sections,af_stabs_use_function_absolute_addresses];
  624. labelprefix : 'L';
  625. comment : '# ';
  626. dollarsign : '.'
  627. );
  628. as_ppc_gas_aix_powerpc_info : tasminfo =
  629. (
  630. id : as_gas_powerpc_xcoff;
  631. idtxt : 'GAS';
  632. asmbin : 'gas';
  633. { -u: allow using symbols before they are defined (when using native
  634. AIX assembler, ignore by GNU assembler)
  635. -mpwr5: we actually support Power3 and higher, but the AIX assembler
  636. has no parameter to select that one (only -mpwr3 and -mpwr5) }
  637. {$ifdef cpu64bitaddr}
  638. asmcmd : '-a64 -u -o $OBJ $EXTRAOPT $ASM -mpwr5';
  639. {$else cpu64bitaddr}
  640. asmcmd : '-a32 -u -o $OBJ $EXTRAOPT $ASM -mpwr5';
  641. {$endif cpu64bitaddr}
  642. supported_targets : [system_powerpc_aix,system_powerpc64_aix];
  643. flags : [af_needar,af_smartlink_sections,af_stabs_use_function_absolute_addresses];
  644. labelprefix : 'L';
  645. comment : '# ';
  646. dollarsign : '.'
  647. );
  648. begin
  649. RegisterAssembler(as_ppc_gas_info,TPPCGNUAssembler);
  650. RegisterAssembler(as_ppc_gas_legacy_info,TPPCGNUAssembler);
  651. RegisterAssembler(as_ppc_gas_darwin_powerpc_info,TPPCAppleGNUAssembler);
  652. RegisterAssembler(as_ppc_aix_powerpc_info,TPPCAIXAssembler);
  653. RegisterAssembler(as_ppc_gas_aix_powerpc_info,TPPCAIXAssembler);
  654. end.