ag68kgas.pas 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. {
  2. $Id$
  3. Copyright (c) 1998 by the FPC development team
  4. This unit implements an asmoutput class for MOTOROLA syntax with
  5. Motorola 68000 (for GAS v2.52 AND HIGER)
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. What's to do:
  19. o Verify if this actually work as indirect mode with name of variables
  20. o write lines numbers and file names to output file
  21. o generate debugging informations
  22. }
  23. unit ag68kgas;
  24. interface
  25. uses aasm,assemble;
  26. type
  27. pm68kgasasmlist=^tm68kgasasmlist;
  28. tm68kgasasmlist = object(tasmlist)
  29. procedure WriteTree(p:paasmoutput);virtual;
  30. procedure WriteAsmList;virtual;
  31. end;
  32. implementation
  33. uses
  34. dos,globals,systems,cobjects,m68k,
  35. strings,files,verbose
  36. {$ifdef GDB}
  37. ,gdb
  38. {$endif GDB}
  39. ;
  40. const
  41. line_length = 70;
  42. var
  43. infile : pextfile;
  44. includecount,lastline : longint;
  45. function double2str(d : double) : string;
  46. var
  47. hs : string;
  48. begin
  49. str(d,hs);
  50. { replace space with + }
  51. if hs[1]=' ' then
  52. hs[1]:='+';
  53. double2str:='0d'+hs
  54. end;
  55. function comp2str(d : bestreal) : string;
  56. type
  57. pdouble = ^double;
  58. var
  59. c : comp;
  60. dd : pdouble;
  61. begin
  62. {$ifdef TP}
  63. c:=d;
  64. {$else}
  65. c:=comp(d);
  66. {$endif}
  67. dd:=pdouble(@c); { this makes a bitwise copy of c into a double }
  68. comp2str:=double2str(dd^);
  69. end;
  70. function getreferencestring(const ref : treference) : string;
  71. var
  72. s : string;
  73. begin
  74. s:='';
  75. if ref.isintvalue then
  76. s:='#'+tostr(ref.offset)
  77. else
  78. with ref do
  79. begin
  80. if assigned(symbol) then
  81. s:=s+symbol^;
  82. if offset<0 then s:=s+tostr(offset)
  83. else if (offset>0) then
  84. begin
  85. if (symbol=nil) then s:=tostr(offset)
  86. else s:=s+'+'+tostr(offset);
  87. end;
  88. if (index<>R_NO) and (base=R_NO) and (direction=dir_none) then
  89. begin
  90. if (scalefactor = 1) or (scalefactor = 0) then
  91. s:=s+'(,'+gas_reg2str[index]+'.l)'
  92. else
  93. s:=s+'(,'+gas_reg2str[index]+'.l*'+tostr(scalefactor)+')'
  94. end
  95. else if (index=R_NO) and (base<>R_NO) and (direction=dir_inc) then
  96. begin
  97. if (scalefactor = 1) or (scalefactor = 0) then
  98. s:=s+'('+gas_reg2str[base]+')+'
  99. else
  100. InternalError(10002);
  101. end
  102. else if (index=R_NO) and (base<>R_NO) and (direction=dir_dec) then
  103. begin
  104. if (scalefactor = 1) or (scalefactor = 0) then
  105. s:=s+'-('+gas_reg2str[base]+')'
  106. else
  107. InternalError(10003);
  108. end
  109. else if (index=R_NO) and (base<>R_NO) and (direction=dir_none) then
  110. begin
  111. s:=s+'('+gas_reg2str[base]+')'
  112. end
  113. else if (index<>R_NO) and (base<>R_NO) and (direction=dir_none) then
  114. begin
  115. if (scalefactor = 1) or (scalefactor = 0) then
  116. s:=s+'('+gas_reg2str[base]+','+gas_reg2str[index]+'.l)'
  117. else
  118. s:=s+'('+gas_reg2str[base]+','+gas_reg2str[index]+'.l*'+tostr(scalefactor)+')';
  119. end;
  120. end; { end with }
  121. getreferencestring:=s;
  122. end;
  123. function getopstr(t : byte;o : pointer) : string;
  124. var
  125. hs : string;
  126. i: tregister;
  127. begin
  128. case t of
  129. top_reg : getopstr:=gas_reg2str[tregister(o)];
  130. top_ref : getopstr:=getreferencestring(preference(o)^);
  131. top_reglist: begin
  132. hs:='';
  133. for i:=R_NO to R_FPSR do
  134. begin
  135. if i in tregisterlist(o^) then
  136. hs:=hs+gas_reg2str[i]+'/';
  137. end;
  138. delete(hs,length(hs),1);
  139. getopstr := hs;
  140. end;
  141. top_const : getopstr:='#'+tostr(longint(o));
  142. top_symbol :
  143. { compare with i386, where a symbol is considered }
  144. { a constant. }
  145. begin
  146. hs[0]:=chr(strlen(pchar(pcsymbol(o)^.symbol)));
  147. move(pchar(pcsymbol(o)^.symbol)^,hs[1],byte(hs[0]));
  148. { inc(byte(hs[0]));}
  149. if pcsymbol(o)^.offset>0 then
  150. hs:=hs+'+'+tostr(pcsymbol(o)^.offset)
  151. else if pcsymbol(o)^.offset<0 then
  152. hs:=hs+tostr(pcsymbol(o)^.offset);
  153. getopstr:=hs;
  154. end;
  155. else internalerror(10001);
  156. end;
  157. end;
  158. function getopstr_jmp(t : byte;o : pointer) : string;
  159. var
  160. hs : string;
  161. begin
  162. case t of
  163. top_reg : getopstr_jmp:=gas_reg2str[tregister(o)];
  164. top_ref : getopstr_jmp:=getreferencestring(preference(o)^);
  165. top_const : getopstr_jmp:=tostr(longint(o));
  166. top_symbol : begin
  167. hs[0]:=chr(strlen(pchar(pcsymbol(o)^.symbol)));
  168. move(pchar(pcsymbol(o)^.symbol)^,hs[1],byte(hs[0]));
  169. if pcsymbol(o)^.offset>0 then
  170. hs:=hs+'+'+tostr(pcsymbol(o)^.offset)
  171. else if pcsymbol(o)^.offset<0 then
  172. hs:=hs+tostr(pcsymbol(o)^.offset);
  173. getopstr_jmp:=hs;
  174. end;
  175. else internalerror(10001);
  176. end;
  177. end;
  178. {****************************************************************************
  179. T68kGASASMOUTPUT
  180. ****************************************************************************}
  181. var
  182. {$ifdef GDB}
  183. n_line : byte;
  184. {$endif}
  185. lastsec : tsection;
  186. const
  187. ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
  188. (#9'.long'#9,'',#9'.short'#9,#9'.byte'#9);
  189. ait_section2str : array[tsection] of string[6]=
  190. ('','.text','.data','.bss','.idata');
  191. procedure tm68kgasasmlist.WriteTree(p:paasmoutput);
  192. var
  193. hp : pai;
  194. ch : char;
  195. consttyp : tait;
  196. s : string;
  197. pos,l,i : longint;
  198. found : boolean;
  199. {$ifdef GDB}
  200. funcname : pchar;
  201. linecount : longint;
  202. {$endif GDB}
  203. begin
  204. if not assigned(p) then
  205. exit;
  206. {$ifdef GDB}
  207. funcname:=nil;
  208. linecount:=1;
  209. {$endif GDB}
  210. hp:=pai(p^.first);
  211. while assigned(hp) do
  212. begin
  213. { write debugger informations }
  214. {$ifdef GDB}
  215. if cs_debuginfo in aktswitches then
  216. begin
  217. if not (hp^.typ in [ait_external,ait_stabn,ait_stabs,ait_stab_function_name]) then
  218. begin
  219. if assigned(hp^.infile) and (pextfile(hp^.infile)<>infile) then
  220. begin
  221. infile:=hp^.infile;
  222. inc(includecount);
  223. if (hp^.infile^.path^<>'') then
  224. begin
  225. AsmWriteLn(#9'.stabs "'+FixPath(hp^.infile^.path^)+'",'+tostr(n_includefile)+
  226. ',0,0,Ltext'+ToStr(IncludeCount));
  227. end;
  228. AsmWriteLn(#9'.stabs "'+FixFileName(hp^.infile^.name^+hp^.infile^.ext^)+'",'+tostr(n_includefile)+
  229. ',0,0,Ltext'+ToStr(IncludeCount));
  230. AsmWriteLn('Ltext'+ToStr(IncludeCount)+':');
  231. end;
  232. { file name must be there before line number ! }
  233. if (hp^.line<>lastline) and (hp^.line<>0) then
  234. begin
  235. if (n_line = n_textline) and assigned(funcname) and
  236. (target_os.use_function_relative_addresses) then
  237. begin
  238. AsmWriteLn(target_asm.labelprefix+'l'+tostr(linecount)+':');
  239. AsmWriteLn(#9'.stabn '+tostr(n_line)+',0,'+tostr(hp^.line)+','+
  240. target_asm.labelprefix+'l'+tostr(linecount)+' - '+StrPas(FuncName));
  241. inc(linecount);
  242. end
  243. else
  244. AsmWriteLn(#9'.stabd'#9+tostr(n_line)+',0,'+tostr(hp^.line));
  245. lastline:=hp^.line;
  246. end;
  247. end;
  248. end;
  249. {$endif GDB}
  250. case hp^.typ of
  251. ait_external : ; { external is ignored }
  252. ait_comment : Begin
  253. AsmWrite(target_asm.comment);
  254. AsmWritePChar(pai_asm_comment(hp)^.str);
  255. AsmLn;
  256. End;
  257. {$ifdef DREGALLOC}
  258. ait_regalloc : AsmWriteLn(target_asm.comment+'Register '+att_reg2str[pairegalloc(hp)^.reg]+' allocated');
  259. ait_regdealloc : AsmWriteLn(target_asm.comment+'Register '+att_reg2str[pairegalloc(hp)^.reg]+' released');
  260. {$endif DREGALLOC}
  261. ait_align : AsmWriteLn(#9'.align '+tostr(pai_align(hp)^.aligntype));
  262. ait_section : begin
  263. if pai_section(hp)^.sec<>sec_none then
  264. begin
  265. AsmLn;
  266. AsmWrite(ait_section2str[pai_section(hp)^.sec]);
  267. if pai_section(hp)^.idataidx>0 then
  268. AsmWrite('$'+tostr(pai_section(hp)^.idataidx));
  269. AsmLn;
  270. {$ifdef GDB}
  271. case pai_section(hp)^.sec of
  272. sec_code : n_line:=n_textline;
  273. sec_data : n_line:=n_dataline;
  274. sec_bss : n_line:=n_bssline;
  275. end;
  276. {$endif GDB}
  277. end;
  278. LastSec:=pai_section(hp)^.sec;
  279. end;
  280. ait_datablock : begin
  281. { ------------------------------------------------------- }
  282. { ----------- ALIGNMENT FOR ANY NON-BYTE VALUE ---------- }
  283. { ------------- REQUIREMENT FOR 680x0 ------------------- }
  284. { ------------------------------------------------------- }
  285. if pai_datablock(hp)^.size <> 1 then
  286. begin
  287. if not(cs_littlesize in aktswitches) then
  288. AsmWriteLn(#9#9'.align 4')
  289. else
  290. AsmWriteLn(#9#9'.align 2');
  291. end;
  292. if pai_datablock(hp)^.is_global then
  293. AsmWrite(#9'.comm'#9)
  294. else
  295. AsmWrite(#9'.lcomm'#9);
  296. AsmWriteLn(StrPas(pai_datablock(hp)^.name)+','+tostr(pai_datablock(hp)^.size));
  297. end;
  298. ait_const_32bit, { alignment is required for 16/32 bit data! }
  299. ait_const_16bit: begin
  300. if not(cs_littlesize in aktswitches) then
  301. AsmWriteLn(#9#9'.align 4')
  302. else
  303. AsmWriteLn(#9#9'.align 2');
  304. AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  305. consttyp:=hp^.typ;
  306. l:=0;
  307. repeat
  308. found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  309. if found then
  310. begin
  311. hp:=Pai(hp^.next);
  312. s:=','+tostr(pai_const(hp)^.value);
  313. AsmWrite(s);
  314. inc(l,length(s));
  315. end;
  316. until (not found) or (l>line_length);
  317. AsmLn;
  318. end;
  319. ait_const_8bit : begin
  320. AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
  321. consttyp:=hp^.typ;
  322. l:=0;
  323. repeat
  324. found:=(not (Pai(hp^.next)=nil)) and (Pai(hp^.next)^.typ=consttyp);
  325. if found then
  326. begin
  327. hp:=Pai(hp^.next);
  328. s:=','+tostr(pai_const(hp)^.value);
  329. AsmWrite(s);
  330. inc(l,length(s));
  331. end;
  332. until (not found) or (l>line_length);
  333. AsmLn;
  334. end;
  335. ait_const_symbol : Begin
  336. if not(cs_littlesize in aktswitches) then
  337. AsmWriteLn(#9#9'.align 4')
  338. else
  339. AsmWriteLn(#9#9'.align 2');
  340. AsmWriteLn(#9'.long'#9+StrPas(pchar(pai_const(hp)^.value)));
  341. end;
  342. ait_real_64bit : Begin
  343. if not(cs_littlesize in aktswitches) then
  344. AsmWriteLn(#9#9'.align 4')
  345. else
  346. AsmWriteLn(#9#9'.align 2');
  347. AsmWriteLn(#9'.double'#9+double2str(pai_double(hp)^.value));
  348. end;
  349. ait_real_32bit : Begin
  350. if not(cs_littlesize in aktswitches) then
  351. AsmWriteLn(#9#9'.align 4')
  352. else
  353. AsmWriteLn(#9#9'.align 2');
  354. AsmWriteLn(#9'.single'#9+double2str(pai_single(hp)^.value));
  355. end;
  356. ait_real_extended : Begin
  357. if not(cs_littlesize in aktswitches) then
  358. AsmWriteLn(#9#9'.align 4')
  359. else
  360. AsmWriteLn(#9#9'.align 2');
  361. AsmWriteLn(#9'.extend'#9+double2str(pai_extended(hp)^.value));
  362. { comp type is difficult to write so use double }
  363. end;
  364. ait_comp : Begin
  365. if not(cs_littlesize in aktswitches) then
  366. AsmWriteLn(#9#9'.align 4')
  367. else
  368. AsmWriteLn(#9#9'.align 2');
  369. AsmWriteLn(#9'.double'#9+comp2str(pai_extended(hp)^.value));
  370. end;
  371. ait_direct : begin
  372. AsmWritePChar(pai_direct(hp)^.str);
  373. AsmLn;
  374. {$IfDef GDB}
  375. if strpos(pai_direct(hp)^.str,'.data')<>nil then
  376. n_line:=n_dataline
  377. else if strpos(pai_direct(hp)^.str,'.text')<>nil then
  378. n_line:=n_textline
  379. else if strpos(pai_direct(hp)^.str,'.bss')<>nil then
  380. n_line:=n_bssline;
  381. {$endif GDB}
  382. end;
  383. ait_string : begin
  384. pos:=0;
  385. for i:=1 to pai_string(hp)^.len do
  386. begin
  387. if pos=0 then
  388. begin
  389. AsmWrite(#9'.ascii'#9'"');
  390. pos:=20;
  391. end;
  392. ch:=pai_string(hp)^.str[i-1];
  393. case ch of
  394. #0, {This can't be done by range, because a bug in FPC}
  395. #1..#31,
  396. #128..#255 : s:='\'+tostr(ord(ch) shr 6)+tostr((ord(ch) and 63) shr 3)+tostr(ord(ch) and 7);
  397. '"' : s:='\"';
  398. '\' : s:='\\';
  399. else
  400. s:=ch;
  401. end;
  402. AsmWrite(s);
  403. inc(pos,length(s));
  404. if (pos>line_length) or (i=pai_string(hp)^.len) then
  405. begin
  406. AsmWriteLn('"');
  407. pos:=0;
  408. end;
  409. end;
  410. end;
  411. ait_label : begin
  412. if (pai_label(hp)^.l^.is_used) then
  413. AsmWriteLn(lab2str(pai_label(hp)^.l)+':');
  414. end;
  415. ait_labeled_instruction : begin
  416. { labeled operand }
  417. if pai_labeled(hp)^._op1 = R_NO then
  418. AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+lab2str(pai_labeled(hp)^.lab))
  419. else
  420. { labeled operand with register }
  421. AsmWriteLn(#9+mot_op2str[pai_labeled(hp)^._operator]+#9+
  422. reg2str(pai_labeled(hp)^._op1)+','+lab2str(pai_labeled(hp)^.lab))
  423. end;
  424. ait_symbol : begin
  425. { ------------------------------------------------------- }
  426. { ----------- ALIGNMENT FOR ANY NON-BYTE VALUE ---------- }
  427. { ------------- REQUIREMENT FOR 680x0 ------------------- }
  428. { ------------------------------------------------------- }
  429. if assigned(hp^.next) and (pai(hp^.next)^.typ in
  430. [ait_const_32bit,ait_const_16bit,ait_const_symbol,
  431. ait_real_64bit,ait_real_32bit,ait_string]) then
  432. begin
  433. if not(cs_littlesize in aktswitches) then
  434. AsmWriteLn(#9#9'.align 4')
  435. else
  436. AsmWriteLn(#9#9'.align 2');
  437. end;
  438. if pai_symbol(hp)^.is_global then
  439. AsmWriteLn('.globl '+StrPas(pai_symbol(hp)^.name));
  440. AsmWriteLn(StrPas(pai_symbol(hp)^.name)+':');
  441. end;
  442. ait_instruction : begin
  443. { old versions of GAS don't like PEA.L and LEA.L }
  444. if (pai68k(hp)^._operator <> A_LEA) and (pai68k(hp)^._operator<> A_PEA) then
  445. s:=#9+mot_op2str[pai68k(hp)^._operator]+gas_opsize2str[pai68k(hp)^.size]
  446. else
  447. s:=#9+mot_op2str[pai68k(hp)^._operator];
  448. if pai68k(hp)^.op1t<>top_none then
  449. begin
  450. { call and jmp need an extra handling }
  451. { this code is only callded if jmp isn't a labeled instruction }
  452. if pai68k(hp)^._operator in [A_JSR,A_JMP] then
  453. s:=s+#9+getopstr_jmp(pai68k(hp)^.op1t,pai68k(hp)^.op1)
  454. else
  455. if pai68k(hp)^.op1t = top_reglist then
  456. s:=s+#9+getopstr(pai68k(hp)^.op1t,@(pai68k(hp)^.reglist))
  457. else
  458. s:=s+#9+getopstr(pai68k(hp)^.op1t,pai68k(hp)^.op1);
  459. if pai68k(hp)^.op2t<>top_none then
  460. begin
  461. if pai68k(hp)^.op2t = top_reglist then
  462. s:=s+','+getopstr(pai68k(hp)^.op2t,@pai68k(hp)^.reglist)
  463. else
  464. s:=s+','+getopstr(pai68k(hp)^.op2t,pai68k(hp)^.op2);
  465. { three operands }
  466. if pai68k(hp)^.op3t<>top_none then
  467. begin
  468. if (pai68k(hp)^._operator = A_DIVSL) or
  469. (pai68k(hp)^._operator = A_DIVUL) or
  470. (pai68k(hp)^._operator = A_MULU) or
  471. (pai68k(hp)^._operator = A_MULS) or
  472. (pai68k(hp)^._operator = A_DIVS) or
  473. (pai68k(hp)^._operator = A_DIVU) then
  474. s:=s+':'+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3)
  475. else
  476. s:=s+','+getopstr(pai68k(hp)^.op3t,pai68k(hp)^.op3);
  477. end;
  478. end;
  479. end;
  480. AsmWriteLn(s);
  481. end;
  482. {$ifdef GDB}
  483. ait_stabs : begin
  484. AsmWrite(#9'.stabs ');
  485. AsmWritePChar(pai_stabs(hp)^.str);
  486. AsmLn;
  487. end;
  488. ait_stabn : begin
  489. AsmWrite(#9'.stabn ');
  490. AsmWritePChar(pai_stabn(hp)^.str);
  491. AsmLn;
  492. end;
  493. ait_stab_function_name : funcname:=pai_stab_function_name(hp)^.str;
  494. {$endif GDB}
  495. {$ifdef SMARTLINK}
  496. ait_cut : begin { used to split into tiny assembler files }
  497. if (cs_smartlink in aktswitches) then
  498. begin
  499. AsmClose;
  500. DoAssemble;
  501. AsmCreate;
  502. AsmWriteLn(ait_section2str[lastsec]);
  503. { avoid empty files }
  504. while assigned(hp^.next) and (pai(hp^.next)^.typ=ait_cut) do
  505. hp:=pai(hp^.next);
  506. end;
  507. end;
  508. {$endif SMARTLINK}
  509. else
  510. internalerror(10000);
  511. end;
  512. hp:=pai(hp^.next);
  513. end;
  514. end;
  515. procedure tm68kgasasmlist.WriteAsmList;
  516. {$ifdef GDB}
  517. var
  518. p:dirstr;
  519. n:namestr;
  520. e:extstr;
  521. {$endif}
  522. begin
  523. {$ifdef EXTDEBUG}
  524. if assigned(current_module^.mainsource) then
  525. comment(v_info,'Start writing gas-styled assembler output for '+current_module^.mainsource^);
  526. {$endif}
  527. infile:=nil;
  528. includecount:=0;
  529. {$ifdef GDB}
  530. if assigned(current_module^.mainsource) then
  531. fsplit(current_module^.mainsource^,p,n,e)
  532. else
  533. begin
  534. p:=inputdir;
  535. n:=inputfile;
  536. e:=inputextension;
  537. end;
  538. { to get symify to work }
  539. AsmWriteLn(#9'.file "'+FixFileName(n+e)+'"');
  540. { stabs }
  541. n_line:=n_bssline;
  542. if (cs_debuginfo in aktswitches) then
  543. begin
  544. if (p<>'') then
  545. AsmWriteLn(#9'.stabs "'+FixPath(p)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
  546. AsmWriteLn(#9'.stabs "'+FixFileName(n+e)+'",'+tostr(n_sourcefile)+',0,0,Ltext0');
  547. AsmWriteLn('Ltext0:');
  548. end;
  549. infile:=current_module^.sourcefiles.files;
  550. { main source file is last in list }
  551. while assigned(infile^._next) do
  552. infile:=infile^._next;
  553. lastline:=0;
  554. {$endif GDB}
  555. { there should be nothing but externals so we don't need to process
  556. WriteTree(externals); }
  557. WriteTree(debuglist);
  558. WriteTree(codesegment);
  559. WriteTree(datasegment);
  560. WriteTree(consts);
  561. WriteTree(rttilist);
  562. WriteTree(bsssegment);
  563. Writetree(importssection);
  564. Writetree(exportssection);
  565. Writetree(resourcesection);
  566. AsmLn;
  567. {$ifdef EXTDEBUG}
  568. if assigned(current_module^.mainsource) then
  569. comment(v_info,'Done writing gas-styled assembler output for '+current_module^.mainsource^);
  570. {$endif EXTDEBUG}
  571. end;
  572. end.
  573. {
  574. $Log$
  575. Revision 1.5 1998-06-05 17:46:04 peter
  576. * tp doesn't like comp() typecast
  577. Revision 1.4 1998/06/04 23:51:28 peter
  578. * m68k compiles
  579. + .def file creation moved to gendef.pas so it could also be used
  580. for win32
  581. }