t_embed.pas 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081
  1. {
  2. Copyright (c) 2005-2017 by Free Pascal Compiler team
  3. This unit implements support import, export, link routines
  4. for the Embedded Target
  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. unit t_embed;
  19. {$i fpcdefs.inc}
  20. interface
  21. implementation
  22. uses
  23. SysUtils,
  24. cutils,cfileutl,cclasses,
  25. globtype,globals,systems,verbose,comphook,cscript,fmodule,i_embed,link,
  26. {$ifdef wasm32}
  27. t_wasi,import,export,
  28. {$endif wasm32}
  29. cpuinfo,aasmbase;
  30. type
  31. TlinkerEmbedded=class(texternallinker)
  32. private
  33. Function WriteResponseFile: Boolean;
  34. public
  35. constructor Create; override;
  36. procedure SetDefaultInfo; override;
  37. function MakeExecutable:boolean; override;
  38. function postprocessexecutable(const fn : string;isdll:boolean):boolean;
  39. end;
  40. { TlinkerEmbedded_SdccSdld - the sdld linker from the SDCC project ( http://sdcc.sourceforge.net/ ) }
  41. TlinkerEmbedded_SdccSdld=class(texternallinker)
  42. private
  43. Function WriteResponseFile: Boolean;
  44. public
  45. { constructor Create; override;}
  46. procedure SetDefaultInfo; override;
  47. function MakeExecutable:boolean; override;
  48. { function postprocessexecutable(const fn : string;isdll:boolean):boolean;}
  49. end;
  50. { TLinkerEmbedded_Wasm }
  51. TLinkerEmbedded_Wasm=class(texternallinker)
  52. public
  53. constructor Create;override;
  54. procedure SetDefaultInfo;override;
  55. //function MakeExecutable:boolean;override;
  56. function MakeSharedLibrary:boolean;override;
  57. end;
  58. {*****************************************************************************
  59. TlinkerEmbedded
  60. *****************************************************************************}
  61. Constructor TlinkerEmbedded.Create;
  62. begin
  63. Inherited Create;
  64. SharedLibFiles.doubles:=true;
  65. StaticLibFiles.doubles:=true;
  66. end;
  67. procedure TlinkerEmbedded.SetDefaultInfo;
  68. const
  69. {$ifdef mips}
  70. {$ifdef mipsel}
  71. platform_select='-EL';
  72. {$else}
  73. platform_select='-EB';
  74. {$endif}
  75. {$else}
  76. platform_select='';
  77. {$endif}
  78. begin
  79. with Info do
  80. begin
  81. ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
  82. end;
  83. end;
  84. Function TlinkerEmbedded.WriteResponseFile: Boolean;
  85. Var
  86. linkres : TLinkRes;
  87. i : longint;
  88. HPath : TCmdStrListItem;
  89. s,s1,s2 : TCmdStr;
  90. prtobj,
  91. cprtobj : string[80];
  92. linklibc : boolean;
  93. found1,
  94. found2 : boolean;
  95. {$if defined(ARM)}
  96. LinkStr : string;
  97. {$endif}
  98. begin
  99. WriteResponseFile:=False;
  100. linklibc:=(SharedLibFiles.Find('c')<>nil);
  101. {$if defined(ARM) or defined(i386) or defined(x86_64) or defined(AVR) or defined(MIPSEL) or defined(RISCV32) or defined(XTENSA)}
  102. prtobj:='';
  103. {$else}
  104. prtobj:='prt0';
  105. {$endif}
  106. cprtobj:='cprt0';
  107. if linklibc then
  108. prtobj:=cprtobj;
  109. { Open link.res file }
  110. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
  111. { Write path to search libraries }
  112. HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
  113. while assigned(HPath) do
  114. begin
  115. s:=HPath.Str;
  116. if (cs_link_on_target in current_settings.globalswitches) then
  117. s:=ScriptFixFileName(s);
  118. LinkRes.Add('-L'+s);
  119. HPath:=TCmdStrListItem(HPath.Next);
  120. end;
  121. HPath:=TCmdStrListItem(LibrarySearchPath.First);
  122. while assigned(HPath) do
  123. begin
  124. s:=HPath.Str;
  125. if s<>'' then
  126. LinkRes.Add('SEARCH_DIR("'+s+'")');
  127. HPath:=TCmdStrListItem(HPath.Next);
  128. end;
  129. LinkRes.Add('INPUT (');
  130. { add objectfiles, start with prt0 always }
  131. //s:=FindObjectFile('prt0','',false);
  132. if prtobj<>'' then
  133. begin
  134. s:=FindObjectFile(prtobj,'',false);
  135. LinkRes.AddFileName(s);
  136. end;
  137. { try to add crti and crtbegin if linking to C }
  138. if linklibc then
  139. begin
  140. if librarysearchpath.FindFile('crtbegin.o',false,s) then
  141. LinkRes.AddFileName(s);
  142. if librarysearchpath.FindFile('crti.o',false,s) then
  143. LinkRes.AddFileName(s);
  144. end;
  145. while not ObjectFiles.Empty do
  146. begin
  147. s:=ObjectFiles.GetFirst;
  148. if s<>'' then
  149. begin
  150. { vlink doesn't use SEARCH_DIR for object files }
  151. if not(cs_link_on_target in current_settings.globalswitches) then
  152. s:=FindObjectFile(s,'',false);
  153. LinkRes.AddFileName((maybequoted(s)));
  154. end;
  155. end;
  156. { Write staticlibraries }
  157. if not StaticLibFiles.Empty then
  158. begin
  159. { vlink doesn't need, and doesn't support GROUP }
  160. if (cs_link_on_target in current_settings.globalswitches) then
  161. begin
  162. LinkRes.Add(')');
  163. LinkRes.Add('GROUP(');
  164. end;
  165. while not StaticLibFiles.Empty do
  166. begin
  167. S:=StaticLibFiles.GetFirst;
  168. LinkRes.AddFileName((maybequoted(s)));
  169. end;
  170. end;
  171. if (cs_link_on_target in current_settings.globalswitches) then
  172. begin
  173. LinkRes.Add(')');
  174. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  175. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  176. linklibc:=false;
  177. while not SharedLibFiles.Empty do
  178. begin
  179. S:=SharedLibFiles.GetFirst;
  180. if s<>'c' then
  181. begin
  182. i:=Pos(target_info.sharedlibext,S);
  183. if i>0 then
  184. Delete(S,i,255);
  185. LinkRes.Add('-l'+s);
  186. end
  187. else
  188. begin
  189. LinkRes.Add('-l'+s);
  190. linklibc:=true;
  191. end;
  192. end;
  193. { be sure that libc&libgcc is the last lib }
  194. if linklibc then
  195. begin
  196. LinkRes.Add('-lc');
  197. LinkRes.Add('-lgcc');
  198. end;
  199. end
  200. else
  201. begin
  202. while not SharedLibFiles.Empty do
  203. begin
  204. S:=SharedLibFiles.GetFirst;
  205. LinkRes.Add('lib'+s+target_info.staticlibext);
  206. end;
  207. LinkRes.Add(')');
  208. end;
  209. { objects which must be at the end }
  210. if linklibc then
  211. begin
  212. found1:=librarysearchpath.FindFile('crtend.o',false,s1);
  213. found2:=librarysearchpath.FindFile('crtn.o',false,s2);
  214. if found1 or found2 then
  215. begin
  216. LinkRes.Add('INPUT(');
  217. if found1 then
  218. LinkRes.AddFileName(s1);
  219. if found2 then
  220. LinkRes.AddFileName(s2);
  221. LinkRes.Add(')');
  222. end;
  223. end;
  224. {$ifdef ARM}
  225. case current_settings.controllertype of
  226. ct_none:
  227. begin
  228. end;
  229. ct_lpc810m021fn8,
  230. ct_lpc811m001fdh16,
  231. ct_lpc812m101fdh16,
  232. ct_lpc812m101fd20,
  233. ct_lpc812m101fdh20,
  234. ct_lpc1110fd20,
  235. ct_lpc1111fdh20_002,
  236. ct_lpc1111fhn33_101,
  237. ct_lpc1111fhn33_102,
  238. ct_lpc1111fhn33_103,
  239. ct_lpc1111fhn33_201,
  240. ct_lpc1111fhn33_202,
  241. ct_lpc1111fhn33_203,
  242. ct_lpc1112fd20_102,
  243. ct_lpc1112fdh20_102,
  244. ct_lpc1112fdh28_102,
  245. ct_lpc1112fhn33_101,
  246. ct_lpc1112fhn33_102,
  247. ct_lpc1112fhn33_103,
  248. ct_lpc1112fhn33_201,
  249. ct_lpc1112fhn24_202,
  250. ct_lpc1112fhn33_202,
  251. ct_lpc1112fhn33_203,
  252. ct_lpc1112fhi33_202,
  253. ct_lpc1112fhi33_203,
  254. ct_lpc1113fhn33_201,
  255. ct_lpc1113fhn33_202,
  256. ct_lpc1113fhn33_203,
  257. ct_lpc1113fhn33_301,
  258. ct_lpc1113fhn33_302,
  259. ct_lpc1113fhn33_303,
  260. ct_lpc1113bfd48_301,
  261. ct_lpc1113bfd48_302,
  262. ct_lpc1113bfd48_303,
  263. ct_lpc1114fdh28_102,
  264. ct_lpc1114fn28_102,
  265. ct_lpc1114fhn33_201,
  266. ct_lpc1114fhn33_202,
  267. ct_lpc1114fhn33_203,
  268. ct_lpc1114fhn33_301,
  269. ct_lpc1114fhn33_302,
  270. ct_lpc1114fhn33_303,
  271. ct_lpc1114fhn33_333,
  272. ct_lpc1114fhi33_302,
  273. ct_lpc1114fhi33_303,
  274. ct_lpc1114bfd48_301,
  275. ct_lpc1114bfd48_302,
  276. ct_lpc1114bfd48_303,
  277. ct_lpc1114bfd48_323,
  278. ct_lpc1114bfd48_333,
  279. ct_lpc1115bfd48_303,
  280. ct_lpc11c12fd48_301,
  281. ct_lpc11c14fd48_301,
  282. ct_lpc11c22fd48_301,
  283. ct_lpc11c24fd48_301,
  284. ct_lpc11d24fd48_301,
  285. ct_lpc1224fbd48_101,
  286. ct_lpc1224fbd48_121,
  287. ct_lpc1224fbd64_101,
  288. ct_lpc1224fbd64_121,
  289. ct_lpc1225fbd48_301,
  290. ct_lpc1225fbd48_321,
  291. ct_lpc1225fbd64_301,
  292. ct_lpc1225fbd64_321,
  293. ct_lpc1226fbd48_301,
  294. ct_lpc1226fbd64_301,
  295. ct_lpc1227fbd48_301,
  296. ct_lpc1227fbd64_301,
  297. ct_lpc12d27fbd100_301,
  298. ct_lpc1311fhn33,
  299. ct_lpc1311fhn33_01,
  300. ct_lpc1313fhn33,
  301. ct_lpc1313fhn33_01,
  302. ct_lpc1313fbd48,
  303. ct_lpc1313fbd48_01,
  304. ct_lpc1315fhn33,
  305. ct_lpc1315fbd48,
  306. ct_lpc1316fhn33,
  307. ct_lpc1316fbd48,
  308. ct_lpc1317fhn33,
  309. ct_lpc1317fbd48,
  310. ct_lpc1317fbd64,
  311. ct_lpc1342fhn33,
  312. ct_lpc1342fbd48,
  313. ct_lpc1343fhn33,
  314. ct_lpc1343fbd48,
  315. ct_lpc1345fhn33,
  316. ct_lpc1345fbd48,
  317. ct_lpc1346fhn33,
  318. ct_lpc1346fbd48,
  319. ct_lpc1347fhn33,
  320. ct_lpc1347fbd48,
  321. ct_lpc1347fbd64,
  322. ct_lpc2114,
  323. ct_lpc2124,
  324. ct_lpc2194,
  325. ct_lpc1768,
  326. ct_at91sam7s256,
  327. ct_at91sam7se256,
  328. ct_at91sam7x256,
  329. ct_at91sam7xc256,
  330. ct_stm32f030c6,
  331. ct_stm32f030c8,
  332. ct_stm32f030f4,
  333. ct_stm32f030k6,
  334. ct_stm32f030r8,
  335. ct_stm32f050c4,
  336. ct_stm32f050c6,
  337. ct_stm32f050f4,
  338. ct_stm32f050f6,
  339. ct_stm32f050g4,
  340. ct_stm32f050g6,
  341. ct_stm32f050k4,
  342. ct_stm32f050k6,
  343. ct_stm32f051c4,
  344. ct_stm32f051c6,
  345. ct_stm32f051c8,
  346. ct_stm32f051k4,
  347. ct_stm32f051k6,
  348. ct_stm32f051k8,
  349. ct_stm32f051r4,
  350. ct_stm32f051r6,
  351. ct_stm32f051r8,
  352. ct_stm32f091cc,
  353. ct_stm32f091cb,
  354. ct_stm32f091rc,
  355. ct_stm32f091rb,
  356. ct_stm32f091vc,
  357. ct_stm32f091vb,
  358. ct_stm32f100x4,
  359. ct_stm32f100x6,
  360. ct_stm32f100x8,
  361. ct_stm32f100xB,
  362. ct_stm32f100xC,
  363. ct_stm32f100xD,
  364. ct_stm32f100xE,
  365. ct_stm32f101x4,
  366. ct_stm32f101x6,
  367. ct_stm32f101x8,
  368. ct_stm32f101xB,
  369. ct_stm32f101xC,
  370. ct_stm32f101xD,
  371. ct_stm32f101xE,
  372. ct_stm32f101xF,
  373. ct_stm32f101xG,
  374. ct_stm32f102x4,
  375. ct_stm32f102x6,
  376. ct_stm32f102x8,
  377. ct_stm32f102xB,
  378. ct_stm32f103x4,
  379. ct_stm32f103x6,
  380. ct_stm32f103x8,
  381. ct_stm32f103xB,
  382. ct_stm32f103xC,
  383. ct_stm32f103xD,
  384. ct_stm32f103xE,
  385. ct_stm32f103xF,
  386. ct_stm32f103xG,
  387. ct_stm32f107x8,
  388. ct_stm32f107xB,
  389. ct_stm32f107xC,
  390. ct_stm32f105r8,
  391. ct_stm32f105rb,
  392. ct_stm32f105rc,
  393. ct_stm32f105v8,
  394. ct_stm32f105vb,
  395. ct_stm32f105vc,
  396. ct_stm32f107rb,
  397. ct_stm32f107rc,
  398. ct_stm32f107vb,
  399. ct_stm32f107vc,
  400. ct_stm32f401cb,
  401. ct_stm32f401rb,
  402. ct_stm32f401vb,
  403. ct_stm32f401cc,
  404. ct_stm32f401rc,
  405. ct_stm32f401vc,
  406. ct_discoveryf401vc,
  407. ct_stm32f401cd,
  408. ct_stm32f401rd,
  409. ct_stm32f401vd,
  410. ct_stm32f401ce,
  411. ct_stm32f401re,
  412. ct_nucleof401re,
  413. ct_stm32f401ve,
  414. ct_stm32f407vg,
  415. ct_discoveryf407vg,
  416. ct_stm32f407ig,
  417. ct_stm32f407zg,
  418. ct_stm32f407ve,
  419. ct_stm32f407ze,
  420. ct_stm32f407ie,
  421. ct_stm32f411cc,
  422. ct_stm32f411rc,
  423. ct_stm32f411vc,
  424. ct_stm32f411ce,
  425. ct_stm32f411re,
  426. ct_nucleof411re,
  427. ct_stm32f411ve,
  428. ct_discoveryf411ve,
  429. ct_stm32f429vg,
  430. ct_stm32f429zg,
  431. ct_stm32f429ig,
  432. ct_stm32f429vi,
  433. ct_stm32f429zi,
  434. ct_discoveryf429zi,
  435. ct_stm32f429ii,
  436. ct_stm32f429ve,
  437. ct_stm32f429ze,
  438. ct_stm32f429ie,
  439. ct_stm32f429bg,
  440. ct_stm32f429bi,
  441. ct_stm32f429be,
  442. ct_stm32f429ng,
  443. ct_stm32f429ni,
  444. ct_stm32f429ne,
  445. ct_stm32f446mc,
  446. ct_stm32f446rc,
  447. ct_stm32f446vc,
  448. ct_stm32f446zc,
  449. ct_stm32f446me,
  450. ct_stm32f446re,
  451. ct_nucleof446re,
  452. ct_stm32f446ve,
  453. ct_stm32f446ze,
  454. ct_stm32f745xe,
  455. ct_stm32f745xg,
  456. ct_stm32f746xe,
  457. ct_stm32f746xg,
  458. ct_stm32f756xe,
  459. ct_stm32f756xg,
  460. ct_stm32g071rb,
  461. ct_nucleog071rb,
  462. { TI - 64 K Flash, 16 K SRAM Devices }
  463. ct_lm3s1110,
  464. ct_lm3s1133,
  465. ct_lm3s1138,
  466. ct_lm3s1150,
  467. ct_lm3s1162,
  468. ct_lm3s1165,
  469. ct_lm3s1166,
  470. ct_lm3s2110,
  471. ct_lm3s2139,
  472. ct_lm3s6100,
  473. ct_lm3s6110,
  474. { TI 128 K Flash, 32 K SRAM devices - Fury Class }
  475. ct_lm3s1601,
  476. ct_lm3s1608,
  477. ct_lm3s1620,
  478. ct_lm3s1635,
  479. ct_lm3s1636,
  480. ct_lm3s1637,
  481. ct_lm3s1651,
  482. ct_lm3s2601,
  483. ct_lm3s2608,
  484. ct_lm3s2620,
  485. ct_lm3s2637,
  486. ct_lm3s2651,
  487. ct_lm3s6610,
  488. ct_lm3s6611,
  489. ct_lm3s6618,
  490. ct_lm3s6633,
  491. ct_lm3s6637,
  492. ct_lm3s8630,
  493. { TI 256 K Flase, 32 K SRAM devices - Fury Class }
  494. ct_lm3s1911,
  495. ct_lm3s1918,
  496. ct_lm3s1937,
  497. ct_lm3s1958,
  498. ct_lm3s1960,
  499. ct_lm3s1968,
  500. ct_lm3s1969,
  501. ct_lm3s2911,
  502. ct_lm3s2918,
  503. ct_lm3s2919,
  504. ct_lm3s2939,
  505. ct_lm3s2948,
  506. ct_lm3s2950,
  507. ct_lm3s2965,
  508. ct_lm3s6911,
  509. ct_lm3s6918,
  510. ct_lm3s6938,
  511. ct_lm3s6950,
  512. ct_lm3s6952,
  513. ct_lm3s6965,
  514. ct_lm3s8930,
  515. ct_lm3s8933,
  516. ct_lm3s8938,
  517. ct_lm3s8962,
  518. ct_lm3s8970,
  519. ct_lm3s8971,
  520. { TI - Tempest Tempest - 256 K Flash, 64 K SRAM }
  521. ct_lm3s5951,
  522. ct_lm3s5956,
  523. ct_lm3s1b21,
  524. ct_lm3s2b93,
  525. ct_lm3s5b91,
  526. ct_lm3s9b81,
  527. ct_lm3s9b90,
  528. ct_lm3s9b92,
  529. ct_lm3s9b95,
  530. ct_lm3s9b96,
  531. ct_lm3s5d51,
  532. { TI - Stellaris something }
  533. ct_lm4f120h5,
  534. { Infineon }
  535. ct_xmc4500x1024,
  536. ct_xmc4500x768,
  537. ct_xmc4502x768,
  538. ct_xmc4504x512,
  539. { Allwinner }
  540. ct_allwinner_a20,
  541. { Freescale }
  542. ct_mk20dx128vfm5,
  543. ct_mk20dx128vft5,
  544. ct_mk20dx128vlf5,
  545. ct_mk20dx128vlh5,
  546. ct_teensy30,
  547. ct_mk20dx128vmp5,
  548. ct_mk20dx32vfm5,
  549. ct_mk20dx32vft5,
  550. ct_mk20dx32vlf5,
  551. ct_mk20dx32vlh5,
  552. ct_mk20dx32vmp5,
  553. ct_mk20dx64vfm5,
  554. ct_mk20dx64vft5,
  555. ct_mk20dx64vlf5,
  556. ct_mk20dx64vlh5,
  557. ct_mk20dx64vmp5,
  558. ct_mk20dx128vlh7,
  559. ct_mk20dx128vlk7,
  560. ct_mk20dx128vll7,
  561. ct_mk20dx128vmc7,
  562. ct_mk20dx256vlh7,
  563. ct_mk20dx256vlk7,
  564. ct_mk20dx256vll7,
  565. ct_mk20dx256vmc7,
  566. ct_teensy31,
  567. ct_teensy32,
  568. ct_mk20dx64vlh7,
  569. ct_mk20dx64vlk7,
  570. ct_mk20dx64vmc7,
  571. ct_mk22fn512cap12,
  572. ct_mk22fn512cbp12,
  573. ct_mk22fn512vdc12,
  574. ct_mk22fn512vlh12,
  575. ct_mk22fn512vll12,
  576. ct_mk22fn512vmp12,
  577. ct_freedom_k22f,
  578. { Atmel }
  579. ct_sam3x8e,
  580. ct_arduino_due,
  581. ct_flip_n_click,
  582. { Nordic Semiconductor }
  583. ct_nrf51422_xxaa,
  584. ct_nrf51422_xxab,
  585. ct_nrf51422_xxac,
  586. ct_nrf51822_xxaa,
  587. ct_nrf51822_xxab,
  588. ct_nrf51822_xxac,
  589. ct_nrf52832_xxaa,
  590. ct_nrf52840_xxaa,
  591. ct_sc32442b,
  592. { Raspberry Pi 2 }
  593. ct_raspi2,
  594. ct_thumb2bare:
  595. begin
  596. with embedded_controllers[current_settings.controllertype] do
  597. with linkres do
  598. begin
  599. if (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D5')
  600. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D7')
  601. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK22F51212')
  602. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK64F12') then
  603. Add('ENTRY(_LOWLEVELSTART)')
  604. else
  605. Add('ENTRY(_START)');
  606. Add('MEMORY');
  607. Add('{');
  608. if flashsize<>0 then
  609. begin
  610. LinkStr := ' flash : ORIGIN = 0x' + IntToHex(flashbase,8)
  611. + ', LENGTH = 0x' + IntToHex(flashsize,8);
  612. Add(LinkStr);
  613. end;
  614. LinkStr := ' ram : ORIGIN = 0x' + IntToHex(srambase,8)
  615. + ', LENGTH = 0x' + IntToHex(sramsize,8);
  616. Add(LinkStr);
  617. Add('}');
  618. Add('_stack_top = 0x' + IntToHex(sramsize+srambase,8) + ';');
  619. // Add Checksum Calculation for LPC Controllers so that the bootloader starts the uploaded binary
  620. writeln(controllerunitstr);
  621. if (controllerunitstr = 'LPC8xx') or (controllerunitstr = 'LPC11XX') or (controllerunitstr = 'LPC122X') then
  622. Add('Startup_Checksum = 0 - (_stack_top + _START + 1 + NonMaskableInt_interrupt + 1 + Hardfault_interrupt + 1);');
  623. if (controllerunitstr = 'LPC13XX') then
  624. Add('Startup_Checksum = 0 - (_stack_top + _START + 1 + NonMaskableInt_interrupt + 1 + MemoryManagement_interrupt + 1 + BusFault_interrupt + 1 + UsageFault_interrupt + 1);');
  625. end;
  626. end
  627. else
  628. if not (cs_link_nolink in current_settings.globalswitches) then
  629. internalerror(200902011);
  630. end;
  631. with linkres do
  632. begin
  633. Add('SECTIONS');
  634. Add('{');
  635. Add(' .text :');
  636. Add(' {');
  637. Add(' _text_start = .;');
  638. Add(' KEEP(*(.init .init.*))');
  639. if (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D5')
  640. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D7')
  641. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK22F51212')
  642. or (embedded_controllers[current_settings.controllertype].controllerunitstr='MK64F12') then
  643. begin
  644. Add(' . = 0x400;');
  645. Add(' KEEP(*(.flash_config *.flash_config.*))');
  646. end;
  647. Add(' *(.text .text.*)');
  648. Add(' *(.strings)');
  649. Add(' *(.rodata .rodata.*)');
  650. Add(' *(.comment)');
  651. Add(' . = ALIGN(4);');
  652. Add(' _etext = .;');
  653. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  654. begin
  655. Add(' } >flash');
  656. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >flash ');
  657. end
  658. else
  659. begin
  660. Add(' } >ram');
  661. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >ram ');
  662. end;
  663. Add(' .data :');
  664. Add(' {');
  665. Add(' _data = .;');
  666. Add(' *(.data .data.*)');
  667. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  668. Add(' _edata = .;');
  669. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  670. begin
  671. Add(' } >ram AT >flash');
  672. end
  673. else
  674. begin
  675. Add(' } >ram');
  676. end;
  677. Add(' .bss :');
  678. Add(' {');
  679. Add(' _bss_start = .;');
  680. Add(' *(.bss .bss.*)');
  681. Add(' *(COMMON)');
  682. Add(' } >ram');
  683. Add('. = ALIGN(4);');
  684. Add('_bss_end = . ;');
  685. Add('}');
  686. Add('_end = .;');
  687. end;
  688. {$endif ARM}
  689. {$ifdef i386}
  690. with linkres do
  691. begin
  692. Add('ENTRY(_START)');
  693. Add('SECTIONS');
  694. Add('{');
  695. Add(' . = 0x100000;');
  696. Add(' .text ALIGN (0x1000) :');
  697. Add(' {');
  698. Add(' _text = .;');
  699. Add(' KEEP(*(.init .init.*))');
  700. Add(' *(.text .text.*)');
  701. Add(' *(.strings)');
  702. Add(' *(.rodata .rodata.*)');
  703. Add(' *(.comment)');
  704. Add(' _etext = .;');
  705. Add(' }');
  706. Add(' .data ALIGN (0x1000) :');
  707. Add(' {');
  708. Add(' _data = .;');
  709. Add(' *(.data .data.*)');
  710. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  711. Add(' _edata = .;');
  712. Add(' }');
  713. Add(' . = ALIGN(4);');
  714. Add(' .bss :');
  715. Add(' {');
  716. Add(' _bss_start = .;');
  717. Add(' *(.bss .bss.*)');
  718. Add(' *(COMMON)');
  719. Add(' }');
  720. Add('_bss_end = . ;');
  721. Add('}');
  722. Add('_end = .;');
  723. end;
  724. {$endif i386}
  725. {$ifdef x86_64}
  726. with linkres do
  727. begin
  728. Add('ENTRY(_START)');
  729. Add('SECTIONS');
  730. Add('{');
  731. Add(' . = 0x100000;');
  732. Add(' .text ALIGN (0x1000) :');
  733. Add(' {');
  734. Add(' _text = .;');
  735. Add(' KEEP(*(.init .init.*))');
  736. Add(' *(.text .text.*)');
  737. Add(' *(.strings)');
  738. Add(' *(.rodata .rodata.*)');
  739. Add(' *(.comment)');
  740. Add(' _etext = .;');
  741. Add(' }');
  742. Add(' .data ALIGN (0x1000) :');
  743. Add(' {');
  744. Add(' _data = .;');
  745. Add(' *(.data .data.*)');
  746. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  747. Add(' _edata = .;');
  748. Add(' }');
  749. Add(' . = ALIGN(4);');
  750. Add(' .bss :');
  751. Add(' {');
  752. Add(' _bss_start = .;');
  753. Add(' *(.bss .bss.*)');
  754. Add(' *(COMMON)');
  755. Add(' }');
  756. Add('_bss_end = . ;');
  757. Add('}');
  758. Add('_end = .;');
  759. end;
  760. {$endif x86_64}
  761. {$ifdef AVR}
  762. with linkres do
  763. begin
  764. { linker script from ld 2.19 }
  765. Add('ENTRY(_START)');
  766. Add('OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")');
  767. case current_settings.cputype of
  768. cpu_avr1:
  769. Add('OUTPUT_ARCH(avr:1)');
  770. cpu_avr2:
  771. Add('OUTPUT_ARCH(avr:2)');
  772. cpu_avr25:
  773. Add('OUTPUT_ARCH(avr:25)');
  774. cpu_avr3:
  775. Add('OUTPUT_ARCH(avr:3)');
  776. cpu_avr31:
  777. Add('OUTPUT_ARCH(avr:31)');
  778. cpu_avr35:
  779. Add('OUTPUT_ARCH(avr:35)');
  780. cpu_avr4:
  781. Add('OUTPUT_ARCH(avr:4)');
  782. cpu_avr5:
  783. Add('OUTPUT_ARCH(avr:5)');
  784. cpu_avr51:
  785. Add('OUTPUT_ARCH(avr:51)');
  786. cpu_avr6:
  787. Add('OUTPUT_ARCH(avr:6)');
  788. cpu_avrxmega3:
  789. Add('OUTPUT_ARCH(avr:103)');
  790. cpu_avrtiny:
  791. Add('OUTPUT_ARCH(avr:100)');
  792. else
  793. Internalerror(2015072701);
  794. end;
  795. Add('MEMORY');
  796. with embedded_controllers[current_settings.controllertype] do
  797. begin
  798. Add('{');
  799. Add(' text (rx) : ORIGIN = 0, LENGTH = 0x'+IntToHex(flashsize,6));
  800. Add(' data (rw!x) : ORIGIN = 0x'+IntToHex($800000+srambase,6)+', LENGTH = 0x'+IntToHex(sramsize,6));
  801. Add(' eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 0x'+IntToHex(eepromsize,6));
  802. Add(' fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K');
  803. Add(' lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K');
  804. Add(' signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K');
  805. Add('}');
  806. Add('_stack_top = 0x' + IntToHex(srambase+sramsize-1,4) + ';');
  807. end;
  808. Add('SECTIONS');
  809. Add('{');
  810. Add(' /* Read-only sections, merged into text segment: */');
  811. Add(' .hash : { *(.hash) }');
  812. Add(' .dynsym : { *(.dynsym) }');
  813. Add(' .dynstr : { *(.dynstr) }');
  814. Add(' .gnu.version : { *(.gnu.version) }');
  815. Add(' .gnu.version_d : { *(.gnu.version_d) }');
  816. Add(' .gnu.version_r : { *(.gnu.version_r) }');
  817. Add(' .rel.init : { *(.rel.init) }');
  818. Add(' .rela.init : { *(.rela.init) }');
  819. Add(' .rel.text :');
  820. Add(' {');
  821. Add(' *(.rel.text)');
  822. Add(' *(.rel.text.*)');
  823. Add(' *(.rel.gnu.linkonce.t*)');
  824. Add(' }');
  825. Add(' .rela.text :');
  826. Add(' {');
  827. Add(' *(.rela.text)');
  828. Add(' *(.rela.text.*)');
  829. Add(' *(.rela.gnu.linkonce.t*)');
  830. Add(' }');
  831. Add(' .rel.fini : { *(.rel.fini) }');
  832. Add(' .rela.fini : { *(.rela.fini) }');
  833. Add(' .rel.rodata :');
  834. Add(' {');
  835. Add(' *(.rel.rodata)');
  836. Add(' *(.rel.rodata.*)');
  837. Add(' *(.rel.gnu.linkonce.r*)');
  838. Add(' }');
  839. Add(' .rela.rodata :');
  840. Add(' {');
  841. Add(' *(.rela.rodata)');
  842. Add(' *(.rela.rodata.*)');
  843. Add(' *(.rela.gnu.linkonce.r*)');
  844. Add(' }');
  845. Add(' .rel.data :');
  846. Add(' {');
  847. Add(' *(.rel.data)');
  848. Add(' *(.rel.data.*)');
  849. Add(' *(.rel.gnu.linkonce.d*)');
  850. Add(' }');
  851. Add(' .rela.data :');
  852. Add(' {');
  853. Add(' *(.rela.data)');
  854. Add(' *(.rela.data.*)');
  855. Add(' *(.rela.gnu.linkonce.d*)');
  856. Add(' }');
  857. Add(' .rel.ctors : { *(.rel.ctors) }');
  858. Add(' .rela.ctors : { *(.rela.ctors) }');
  859. Add(' .rel.dtors : { *(.rel.dtors) }');
  860. Add(' .rela.dtors : { *(.rela.dtors) }');
  861. Add(' .rel.got : { *(.rel.got) }');
  862. Add(' .rela.got : { *(.rela.got) }');
  863. Add(' .rel.bss : { *(.rel.bss) }');
  864. Add(' .rela.bss : { *(.rela.bss) }');
  865. Add(' .rel.plt : { *(.rel.plt) }');
  866. Add(' .rela.plt : { *(.rela.plt) }');
  867. Add(' /* Internal text space or external memory. */');
  868. Add(' .text :');
  869. Add(' {');
  870. Add(' KEEP(*(.init .init.*))');
  871. Add(' /* For data that needs to reside in the lower 64k of progmem. */');
  872. Add(' *(.progmem.gcc*)');
  873. Add(' *(.progmem*)');
  874. Add(' . = ALIGN(2);');
  875. Add(' __trampolines_start = . ;');
  876. Add(' /* The jump trampolines for the 16-bit limited relocs will reside here. */');
  877. Add(' *(.trampolines)');
  878. Add(' *(.trampolines*)');
  879. Add(' __trampolines_end = . ;');
  880. Add(' /* For future tablejump instruction arrays for 3 byte pc devices.');
  881. Add(' We don''t relax jump/call instructions within these sections. */');
  882. Add(' *(.jumptables)');
  883. Add(' *(.jumptables*)');
  884. Add(' /* For code that needs to reside in the lower 128k progmem. */');
  885. Add(' *(.lowtext)');
  886. Add(' *(.lowtext*)');
  887. Add(' __ctors_start = . ;');
  888. Add(' *(.ctors)');
  889. Add(' __ctors_end = . ;');
  890. Add(' __dtors_start = . ;');
  891. Add(' *(.dtors)');
  892. Add(' __dtors_end = . ;');
  893. Add(' KEEP(SORT(*)(.ctors))');
  894. Add(' KEEP(SORT(*)(.dtors))');
  895. Add(' /* From this point on, we don''t bother about wether the insns are');
  896. Add(' below or above the 16 bits boundary. */');
  897. Add(' *(.init0) /* Start here after reset. */');
  898. Add(' KEEP (*(.init0))');
  899. Add(' *(.init1)');
  900. Add(' KEEP (*(.init1))');
  901. Add(' *(.init2) /* Clear __zero_reg__, set up stack pointer. */');
  902. Add(' KEEP (*(.init2))');
  903. Add(' *(.init3)');
  904. Add(' KEEP (*(.init3))');
  905. Add(' *(.init4) /* Initialize data and BSS. */');
  906. Add(' KEEP (*(.init4))');
  907. Add(' *(.init5)');
  908. Add(' KEEP (*(.init5))');
  909. Add(' *(.init6) /* C++ constructors. */');
  910. Add(' KEEP (*(.init6))');
  911. Add(' *(.init7)');
  912. Add(' KEEP (*(.init7))');
  913. Add(' *(.init8)');
  914. Add(' KEEP (*(.init8))');
  915. Add(' *(.init9) /* Call main(). */');
  916. Add(' KEEP (*(.init9))');
  917. Add(' *(.text)');
  918. Add(' . = ALIGN(2);');
  919. Add(' *(.text.*)');
  920. Add(' . = ALIGN(2);');
  921. Add(' *(.fini9) /* _exit() starts here. */');
  922. Add(' KEEP (*(.fini9))');
  923. Add(' *(.fini8)');
  924. Add(' KEEP (*(.fini8))');
  925. Add(' *(.fini7)');
  926. Add(' KEEP (*(.fini7))');
  927. Add(' *(.fini6) /* C++ destructors. */');
  928. Add(' KEEP (*(.fini6))');
  929. Add(' *(.fini5)');
  930. Add(' KEEP (*(.fini5))');
  931. Add(' *(.fini4)');
  932. Add(' KEEP (*(.fini4))');
  933. Add(' *(.fini3)');
  934. Add(' KEEP (*(.fini3))');
  935. Add(' *(.fini2)');
  936. Add(' KEEP (*(.fini2))');
  937. Add(' *(.fini1)');
  938. Add(' KEEP (*(.fini1))');
  939. Add(' *(.fini0) /* Infinite loop after program termination. */');
  940. Add(' KEEP (*(.fini0))');
  941. Add(' _etext = . ;');
  942. Add(' } > text');
  943. Add(' .data : AT (ADDR (.text) + SIZEOF (.text))');
  944. Add(' {');
  945. Add(' PROVIDE (__data_start = .) ;');
  946. Add(' *(.data)');
  947. Add(' *(.data*)');
  948. Add(' *(.rodata) /* We need to include .rodata here if gcc is used */');
  949. Add(' *(.rodata*) /* with -fdata-sections. */');
  950. Add(' *(.gnu.linkonce.d*)');
  951. Add(' . = ALIGN(2);');
  952. Add(' _edata = . ;');
  953. Add(' PROVIDE (__data_end = .) ;');
  954. Add(' } > data');
  955. Add(' .bss : AT (ADDR (.bss))');
  956. Add(' {');
  957. Add(' PROVIDE (__bss_start = .) ;');
  958. Add(' *(.bss)');
  959. Add(' *(.bss*)');
  960. Add(' *(COMMON)');
  961. Add(' PROVIDE (__bss_end = .) ;');
  962. Add(' } > data');
  963. Add(' __data_load_start = LOADADDR(.data);');
  964. Add(' __data_load_end = __data_load_start + SIZEOF(.data);');
  965. Add(' /* Global data not cleared after reset. */');
  966. Add(' .noinit :');
  967. Add(' {');
  968. Add(' PROVIDE (__noinit_start = .) ;');
  969. Add(' *(.noinit*)');
  970. Add(' PROVIDE (__noinit_end = .) ;');
  971. Add(' _end = . ;');
  972. Add(' PROVIDE (__heap_start = .) ;');
  973. Add(' } > data');
  974. Add(' .eeprom :');
  975. Add(' {');
  976. Add(' *(.eeprom*)');
  977. Add(' __eeprom_end = . ;');
  978. Add(' } > eeprom');
  979. Add(' .fuse :');
  980. Add(' {');
  981. Add(' KEEP(*(.fuse))');
  982. Add(' KEEP(*(.lfuse))');
  983. Add(' KEEP(*(.hfuse))');
  984. Add(' KEEP(*(.efuse))');
  985. Add(' } > fuse');
  986. Add(' .lock :');
  987. Add(' {');
  988. Add(' KEEP(*(.lock*))');
  989. Add(' } > lock');
  990. Add(' .signature :');
  991. Add(' {');
  992. Add(' KEEP(*(.signature*))');
  993. Add(' } > signature');
  994. Add(' /* Stabs debugging sections. */');
  995. Add(' .stab 0 : { *(.stab) }');
  996. Add(' .stabstr 0 : { *(.stabstr) }');
  997. Add(' .stab.excl 0 : { *(.stab.excl) }');
  998. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  999. Add(' .stab.index 0 : { *(.stab.index) }');
  1000. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1001. Add(' .comment 0 : { *(.comment) }');
  1002. Add(' /* DWARF debug sections.');
  1003. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1004. Add(' of the section so we begin them at 0. */');
  1005. Add(' /* DWARF 1 */');
  1006. Add(' .debug 0 : { *(.debug) }');
  1007. Add(' .line 0 : { *(.line) }');
  1008. Add(' /* GNU DWARF 1 extensions */');
  1009. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1010. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1011. Add(' /* DWARF 1.1 and DWARF 2 */');
  1012. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1013. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1014. Add(' /* DWARF 2 */');
  1015. Add(' .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }');
  1016. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1017. Add(' .debug_line 0 : { *(.debug_line) }');
  1018. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1019. Add(' .debug_str 0 : { *(.debug_str) }');
  1020. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1021. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1022. Add('}');
  1023. end;
  1024. {$endif AVR}
  1025. {$ifdef MIPSEL}
  1026. case current_settings.controllertype of
  1027. ct_none:
  1028. begin
  1029. end;
  1030. ct_pic32mx110f016b,
  1031. ct_pic32mx110f016c,
  1032. ct_pic32mx110f016d,
  1033. ct_pic32mx120f032b,
  1034. ct_pic32mx120f032c,
  1035. ct_pic32mx120f032d,
  1036. ct_pic32mx130f064b,
  1037. ct_pic32mx130f064c,
  1038. ct_pic32mx130f064d,
  1039. ct_pic32mx150f128b,
  1040. ct_pic32mx150f128c,
  1041. ct_pic32mx150f128d,
  1042. ct_pic32mx210f016b,
  1043. ct_pic32mx210f016c,
  1044. ct_pic32mx210f016d,
  1045. ct_pic32mx220f032b,
  1046. ct_pic32mx220f032c,
  1047. ct_pic32mx220f032d,
  1048. ct_pic32mx230f064b,
  1049. ct_pic32mx230f064c,
  1050. ct_pic32mx230f064d,
  1051. ct_pic32mx250f128b,
  1052. ct_pic32mx250f128c,
  1053. ct_pic32mx250f128d,
  1054. ct_pic32mx775f256h,
  1055. ct_pic32mx775f256l,
  1056. ct_pic32mx775f512h,
  1057. ct_pic32mx775f512l,
  1058. ct_pic32mx795f512h,
  1059. ct_pic32mx795f512l:
  1060. begin
  1061. with embedded_controllers[current_settings.controllertype] do
  1062. with linkres do
  1063. begin
  1064. Add('OUTPUT_FORMAT("elf32-tradlittlemips")');
  1065. Add('OUTPUT_ARCH(pic32mx)');
  1066. Add('ENTRY(_reset)');
  1067. Add('PROVIDE(_vector_spacing = 0x00000001);');
  1068. Add('_ebase_address = 0x'+IntToHex(flashbase,8)+';');
  1069. Add('_RESET_ADDR = 0xBFC00000;');
  1070. Add('_BEV_EXCPT_ADDR = 0xBFC00380;');
  1071. Add('_DBG_EXCPT_ADDR = 0xBFC00480;');
  1072. Add('_GEN_EXCPT_ADDR = _ebase_address + 0x180;');
  1073. Add('MEMORY');
  1074. Add('{');
  1075. if flashsize<>0 then
  1076. begin
  1077. Add(' kseg0_program_mem : ORIGIN = 0x'+IntToHex(flashbase,8)+', LENGTH = 0x'+IntToHex(flashsize,8));
  1078. //TODO This should better be placed into the controllertype records
  1079. Add(' kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0xbef');
  1080. Add(' config3 : ORIGIN = 0xBFC00BF0, LENGTH = 0x4');
  1081. Add(' config2 : ORIGIN = 0xBFC00BF4, LENGTH = 0x4');
  1082. Add(' config1 : ORIGIN = 0xBFC00BF8, LENGTH = 0x4');
  1083. Add(' config0 : ORIGIN = 0xBFC00BFC, LENGTH = 0x4');
  1084. end;
  1085. Add(' ram : ORIGIN = 0x' + IntToHex(srambase,8)
  1086. + ', LENGTH = 0x' + IntToHex(sramsize,8));
  1087. Add('}');
  1088. Add('_stack_top = 0x' + IntToHex(sramsize+srambase,8) + ';');
  1089. end;
  1090. end
  1091. end;
  1092. with linkres do
  1093. begin
  1094. Add('SECTIONS');
  1095. Add('{');
  1096. Add(' .reset _RESET_ADDR :');
  1097. Add(' {');
  1098. Add(' KEEP(*(.reset .reset.*))');
  1099. Add(' KEEP(*(.startup .startup.*))');
  1100. Add(' } > kseg1_boot_mem');
  1101. Add(' .bev_excpt _BEV_EXCPT_ADDR :');
  1102. Add(' {');
  1103. Add(' KEEP(*(.bev_handler))');
  1104. Add(' } > kseg1_boot_mem');
  1105. Add(' .text :');
  1106. Add(' {');
  1107. Add(' _text_start = .;');
  1108. Add(' . = _text_start + 0x180;');
  1109. Add(' KEEP(*(.gen_handler))');
  1110. Add(' . = _text_start + 0x200;');
  1111. Add(' KEEP(*(.init .init.*))');
  1112. Add(' *(.text .text.*)');
  1113. Add(' *(.strings)');
  1114. Add(' *(.rodata .rodata.*)');
  1115. Add(' *(.comment)');
  1116. Add(' _etext = .;');
  1117. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1118. begin
  1119. Add(' } >kseg0_program_mem');
  1120. end
  1121. else
  1122. begin
  1123. Add(' } >ram');
  1124. end;
  1125. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) }');
  1126. Add(' .data :');
  1127. Add(' {');
  1128. Add(' _data = .;');
  1129. Add(' *(.data .data.*)');
  1130. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1131. Add(' . = .;');
  1132. Add(' _gp = ALIGN(16) + 0x7ff0;');
  1133. Add(' _edata = .;');
  1134. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1135. begin
  1136. Add(' } >ram AT >kseg0_program_mem');
  1137. end
  1138. else
  1139. begin
  1140. Add(' } >ram');
  1141. end;
  1142. Add(' .config_BFC00BF0 : {');
  1143. Add(' KEEP(*(.config_BFC00BF0))');
  1144. Add(' } > config3');
  1145. Add(' .config_BFC00BF4 : {');
  1146. Add(' KEEP(*(.config_BFC00BF4))');
  1147. Add(' } > config2');
  1148. Add(' .config_BFC00BF8 : {');
  1149. Add(' KEEP(*(.config_BFC00BF8))');
  1150. Add(' } > config1');
  1151. Add(' .config_BFC00BFC : {');
  1152. Add(' KEEP(*(.config_BFC00BFC))');
  1153. Add(' } > config0');
  1154. Add(' .bss :');
  1155. Add(' {');
  1156. Add(' _bss_start = .;');
  1157. Add(' *(.bss .bss.*)');
  1158. Add(' *(COMMON)');
  1159. Add(' } >ram');
  1160. Add('. = ALIGN(4);');
  1161. Add('_bss_end = . ;');
  1162. Add(' .comment 0 : { *(.comment) }');
  1163. Add(' /* DWARF debug sections.');
  1164. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1165. Add(' of the section so we begin them at 0. */');
  1166. Add(' /* DWARF 1 */');
  1167. Add(' .debug 0 : { *(.debug) }');
  1168. Add(' .line 0 : { *(.line) }');
  1169. Add(' /* GNU DWARF 1 extensions */');
  1170. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1171. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1172. Add(' /* DWARF 1.1 and DWARF 2 */');
  1173. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1174. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1175. Add(' /* DWARF 2 */');
  1176. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1177. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1178. Add(' /DISCARD/ : { *(.debug_line) }');
  1179. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1180. Add(' .debug_str 0 : { *(.debug_str) }');
  1181. Add(' /DISCARD/ : { *(.debug_loc) }');
  1182. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1183. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1184. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1185. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1186. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1187. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1188. Add(' /* DWARF 3 */');
  1189. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1190. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1191. Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
  1192. Add(' .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }');
  1193. Add(' .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }');
  1194. Add(' .mdebug.abi32 : { KEEP(*(.mdebug.abi32)) }');
  1195. Add(' .mdebug.abiN32 : { KEEP(*(.mdebug.abiN32)) }');
  1196. Add(' .mdebug.abi64 : { KEEP(*(.mdebug.abi64)) }');
  1197. Add(' .mdebug.abiO64 : { KEEP(*(.mdebug.abiO64)) }');
  1198. Add(' .mdebug.eabi32 : { KEEP(*(.mdebug.eabi32)) }');
  1199. Add(' .mdebug.eabi64 : { KEEP(*(.mdebug.eabi64)) }');
  1200. Add(' /DISCARD/ : { *(.rel.dyn) }');
  1201. Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
  1202. Add('}');
  1203. Add('_end = .;');
  1204. end;
  1205. {$endif MIPSEL}
  1206. {$ifdef RISCV32}
  1207. with linkres do
  1208. begin
  1209. Add('OUTPUT_ARCH("riscv")');
  1210. Add('ENTRY(_START)');
  1211. Add('MEMORY');
  1212. with embedded_controllers[current_settings.controllertype] do
  1213. begin
  1214. Add('{');
  1215. Add(' flash (rx) : ORIGIN = 0x'+IntToHex(flashbase,6)+', LENGTH = 0x'+IntToHex(flashsize,6));
  1216. Add(' ram (rw!x) : ORIGIN = 0x'+IntToHex(srambase,6)+', LENGTH = 0x'+IntToHex(sramsize,6));
  1217. Add('}');
  1218. Add('_stack_top = 0x' + IntToHex(srambase+sramsize-1,4) + ';');
  1219. end;
  1220. Add('SECTIONS');
  1221. Add('{');
  1222. Add(' .text :');
  1223. Add(' {');
  1224. Add(' _text_start = .;');
  1225. Add(' KEEP(*(.init .init.*))');
  1226. Add(' *(.text .text.*)');
  1227. Add(' *(.strings)');
  1228. Add(' *(.rodata .rodata.*)');
  1229. Add(' *(.comment)');
  1230. Add(' . = ALIGN(4);');
  1231. Add(' _etext = .;');
  1232. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1233. begin
  1234. Add(' } >flash');
  1235. //Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >flash ');
  1236. end
  1237. else
  1238. begin
  1239. Add(' } >ram');
  1240. //Add(' .note.gnu.build-id : { *(.note.gnu.build-id) } >ram ');
  1241. end;
  1242. Add(' .data :');
  1243. Add(' {');
  1244. Add(' _data = .;');
  1245. Add(' *(.data .data.*)');
  1246. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1247. Add(' _edata = .;');
  1248. if embedded_controllers[current_settings.controllertype].flashsize<>0 then
  1249. begin
  1250. Add(' } >ram AT >flash');
  1251. end
  1252. else
  1253. begin
  1254. Add(' } >ram');
  1255. end;
  1256. Add(' .bss :');
  1257. Add(' {');
  1258. Add(' _bss_start = .;');
  1259. Add(' *(.bss .bss.*)');
  1260. Add(' *(COMMON)');
  1261. Add(' } >ram');
  1262. Add(' . = ALIGN(4);');
  1263. Add(' _bss_end = . ;');
  1264. Add(' /* Stabs debugging sections. */');
  1265. Add(' .stab 0 : { *(.stab) }');
  1266. Add(' .stabstr 0 : { *(.stabstr) }');
  1267. Add(' .stab.excl 0 : { *(.stab.excl) }');
  1268. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  1269. Add(' .stab.index 0 : { *(.stab.index) }');
  1270. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1271. Add(' .comment 0 : { *(.comment) }');
  1272. Add(' /* DWARF debug sections.');
  1273. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1274. Add(' of the section so we begin them at 0. */');
  1275. Add(' /* DWARF 1 */');
  1276. Add(' .debug 0 : { *(.debug) }');
  1277. Add(' .line 0 : { *(.line) }');
  1278. Add(' /* GNU DWARF 1 extensions */');
  1279. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1280. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1281. Add(' /* DWARF 1.1 and DWARF 2 */');
  1282. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1283. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1284. Add(' /* DWARF 2 */');
  1285. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1286. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1287. Add(' .debug_line 0 : { *(.debug_line) }');
  1288. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1289. Add(' .debug_str 0 : { *(.debug_str) }');
  1290. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1291. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1292. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1293. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1294. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1295. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1296. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1297. Add(' /* DWARF 3 */');
  1298. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1299. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1300. Add('}');
  1301. Add('_end = .;');
  1302. end;
  1303. {$endif RISCV32}
  1304. {$ifdef XTENSA}
  1305. with linkres do
  1306. begin
  1307. Add('/* Script for -z combreloc: combine and sort reloc sections */');
  1308. Add('/* Copyright (C) 2014-2018 Free Software Foundation, Inc.');
  1309. Add(' Copying and distribution of this script, with or without modification,');
  1310. Add(' are permitted in any medium without royalty provided the copyright');
  1311. Add(' notice and this notice are preserved. */');
  1312. Add('ENTRY(_start)');
  1313. Add('SEARCH_DIR("=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/lib"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");');
  1314. Add('SECTIONS');
  1315. Add('{');
  1316. Add(' /* Read-only sections, merged into text segment: */');
  1317. Add(' PROVIDE (__executable_start = 0x400000); . = 0x400000 + SIZEOF_HEADERS;');
  1318. Add(' .interp : { *(.interp) }');
  1319. Add(' .note.gnu.build-id : { *(.note.gnu.build-id) }');
  1320. Add(' .hash : { *(.hash) }');
  1321. Add(' .gnu.hash : { *(.gnu.hash) }');
  1322. Add(' .dynsym : { *(.dynsym) }');
  1323. Add(' .dynstr : { *(.dynstr) }');
  1324. Add(' .gnu.version : { *(.gnu.version) }');
  1325. Add(' .gnu.version_d : { *(.gnu.version_d) }');
  1326. Add(' .gnu.version_r : { *(.gnu.version_r) }');
  1327. Add(' .rela.dyn :');
  1328. Add(' {');
  1329. Add(' *(.rela.init)');
  1330. Add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)');
  1331. Add(' *(.rela.fini)');
  1332. Add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)');
  1333. Add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)');
  1334. Add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)');
  1335. Add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)');
  1336. Add(' *(.rela.ctors)');
  1337. Add(' *(.rela.dtors)');
  1338. Add(' *(.rela.got)');
  1339. Add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)');
  1340. Add(' }');
  1341. Add(' .rela.plt : { *(.rela.plt) }');
  1342. Add(' /* .plt* sections are embedded in .text */');
  1343. Add(' .text :');
  1344. Add(' {');
  1345. Add(' *(.got.plt* .plt*)');
  1346. Add(' KEEP (*(.init.literal))');
  1347. Add(' KEEP (*(SORT_NONE(.init)))');
  1348. Add(' *(.literal .text .stub .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)');
  1349. Add(' /* .gnu.warning sections are handled specially by elf32.em. */');
  1350. Add(' *(.gnu.warning)');
  1351. Add(' KEEP (*(.fini.literal))');
  1352. Add(' KEEP (*(SORT_NONE(.fini)))');
  1353. Add(' } =0');
  1354. Add(' PROVIDE (__etext = .);');
  1355. Add(' PROVIDE (_etext = .);');
  1356. Add(' PROVIDE (etext = .);');
  1357. Add(' .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }');
  1358. Add(' .rodata1 : { *(.rodata1) }');
  1359. Add(' .got.loc : { *(.got.loc) }');
  1360. Add(' .xt_except_table : ONLY_IF_RO { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
  1361. Add(' .eh_frame_hdr : { *(.eh_frame_hdr) }');
  1362. Add(' .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }');
  1363. Add(' .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }');
  1364. Add(' /* Adjust the address for the data segment. We want to adjust up to');
  1365. Add(' the same address within the page on the next page up. */');
  1366. Add(' . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));');
  1367. Add(' /* Exception handling */');
  1368. Add(' .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }');
  1369. Add(' .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }');
  1370. Add(' /* Thread Local Storage sections */');
  1371. Add(' .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }');
  1372. Add(' .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }');
  1373. Add(' .preinit_array :');
  1374. Add(' {');
  1375. Add(' PROVIDE_HIDDEN (__preinit_array_start = .);');
  1376. Add(' KEEP (*(.preinit_array))');
  1377. Add(' PROVIDE_HIDDEN (__preinit_array_end = .);');
  1378. Add(' }');
  1379. Add(' .init_array :');
  1380. Add(' {');
  1381. Add(' PROVIDE_HIDDEN (__init_array_start = .);');
  1382. Add(' KEEP (*(SORT(.init_array.*)))');
  1383. Add(' KEEP (*(.init_array))');
  1384. Add(' PROVIDE_HIDDEN (__init_array_end = .);');
  1385. Add(' }');
  1386. Add(' .fini_array :');
  1387. Add(' {');
  1388. Add(' PROVIDE_HIDDEN (__fini_array_start = .);');
  1389. Add(' KEEP (*(SORT(.fini_array.*)))');
  1390. Add(' KEEP (*(.fini_array))');
  1391. Add(' PROVIDE_HIDDEN (__fini_array_end = .);');
  1392. Add(' }');
  1393. Add(' .ctors :');
  1394. Add(' {');
  1395. Add(' /* gcc uses crtbegin.o to find the start of');
  1396. Add(' the constructors, so we make sure it is');
  1397. Add(' first. Because this is a wildcard, it');
  1398. Add(' doesn''t matter if the user does not');
  1399. Add(' actually link against crtbegin.o; the');
  1400. Add(' linker won''t look for a file to match a');
  1401. Add(' wildcard. The wildcard also means that it');
  1402. Add(' doesn''t matter which directory crtbegin.o');
  1403. Add(' is in. */');
  1404. Add(' KEEP (*crtbegin.o(.ctors))');
  1405. Add(' KEEP (*crtbegin?.o(.ctors))');
  1406. Add(' /* We don''t want to include the .ctor section from');
  1407. Add(' the crtend.o file until after the sorted ctors.');
  1408. Add(' The .ctor section from the crtend file contains the');
  1409. Add(' end of ctors marker and it must be last */');
  1410. Add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))');
  1411. Add(' KEEP (*(SORT(.ctors.*)))');
  1412. Add(' KEEP (*(.ctors))');
  1413. Add(' }');
  1414. Add(' .dtors :');
  1415. Add(' {');
  1416. Add(' KEEP (*crtbegin.o(.dtors))');
  1417. Add(' KEEP (*crtbegin?.o(.dtors))');
  1418. Add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))');
  1419. Add(' KEEP (*(SORT(.dtors.*)))');
  1420. Add(' KEEP (*(.dtors))');
  1421. Add(' }');
  1422. Add(' .jcr : { KEEP (*(.jcr)) }');
  1423. Add(' .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }');
  1424. Add(' .xt_except_table : ONLY_IF_RW { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
  1425. Add(' .dynamic : { *(.dynamic) }');
  1426. Add(' .got : { *(.got) }');
  1427. Add(' .data :');
  1428. Add(' {');
  1429. Add(' *(.data .data.* .gnu.linkonce.d.*)');
  1430. Add(' SORT(CONSTRUCTORS)');
  1431. Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
  1432. Add(' }');
  1433. Add(' .data1 : { *(.data1) }');
  1434. Add(' .xt_except_desc :');
  1435. Add(' {');
  1436. Add(' *(.xt_except_desc .xt_except_desc.* .gnu.linkonce.h.*)');
  1437. Add(' *(.xt_except_desc_end)');
  1438. Add(' }');
  1439. Add(' .lit4 :');
  1440. Add(' {');
  1441. Add(' PROVIDE (_lit4_start = .);');
  1442. Add(' *(.lit4 .lit4.* .gnu.linkonce.lit4.*)');
  1443. Add(' PROVIDE (_lit4_end = .);');
  1444. Add(' }');
  1445. Add(' _edata = .; PROVIDE (edata = .);');
  1446. Add(' __bss_start = .;');
  1447. Add(' .bss :');
  1448. Add(' {');
  1449. Add(' *(.dynbss)');
  1450. Add(' *(.bss .bss.* .gnu.linkonce.b.*)');
  1451. Add(' *(COMMON)');
  1452. Add(' /* Align here to ensure that the .bss section occupies space up to');
  1453. Add(' _end. Align after .bss to ensure correct alignment even if the');
  1454. Add(' .bss section disappears because there are no input sections.');
  1455. Add(' FIXME: Why do we need it? When there is no .bss section, we don''t');
  1456. Add(' pad the .data section. */');
  1457. Add(' . = ALIGN(. != 0 ? 32 / 8 : 1);');
  1458. Add(' }');
  1459. Add(' . = ALIGN(32 / 8);');
  1460. Add(' . = ALIGN(32 / 8);');
  1461. Add(' _end = .; PROVIDE (end = .);');
  1462. Add(' /* Stabs debugging sections. */');
  1463. Add(' .stab 0 : { *(.stab) }');
  1464. Add(' .stabstr 0 : { *(.stabstr) }');
  1465. Add(' .stab.excl 0 : { *(.stab.excl) }');
  1466. Add(' .stab.exclstr 0 : { *(.stab.exclstr) }');
  1467. Add(' .stab.index 0 : { *(.stab.index) }');
  1468. Add(' .stab.indexstr 0 : { *(.stab.indexstr) }');
  1469. Add(' .comment 0 : { *(.comment) }');
  1470. Add(' /* DWARF debug sections.');
  1471. Add(' Symbols in the DWARF debugging sections are relative to the beginning');
  1472. Add(' of the section so we begin them at 0. */');
  1473. Add(' /* DWARF 1 */');
  1474. Add(' .debug 0 : { *(.debug) }');
  1475. Add(' .line 0 : { *(.line) }');
  1476. Add(' /* GNU DWARF 1 extensions */');
  1477. Add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }');
  1478. Add(' .debug_sfnames 0 : { *(.debug_sfnames) }');
  1479. Add(' /* DWARF 1.1 and DWARF 2 */');
  1480. Add(' .debug_aranges 0 : { *(.debug_aranges) }');
  1481. Add(' .debug_pubnames 0 : { *(.debug_pubnames) }');
  1482. Add(' /* DWARF 2 */');
  1483. Add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }');
  1484. Add(' .debug_abbrev 0 : { *(.debug_abbrev) }');
  1485. Add(' .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }');
  1486. Add(' .debug_frame 0 : { *(.debug_frame) }');
  1487. Add(' .debug_str 0 : { *(.debug_str) }');
  1488. Add(' .debug_loc 0 : { *(.debug_loc) }');
  1489. Add(' .debug_macinfo 0 : { *(.debug_macinfo) }');
  1490. Add(' /* SGI/MIPS DWARF 2 extensions */');
  1491. Add(' .debug_weaknames 0 : { *(.debug_weaknames) }');
  1492. Add(' .debug_funcnames 0 : { *(.debug_funcnames) }');
  1493. Add(' .debug_typenames 0 : { *(.debug_typenames) }');
  1494. Add(' .debug_varnames 0 : { *(.debug_varnames) }');
  1495. Add(' /* DWARF 3 */');
  1496. Add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }');
  1497. Add(' .debug_ranges 0 : { *(.debug_ranges) }');
  1498. Add(' /* DWARF Extension. */');
  1499. Add(' .debug_macro 0 : { *(.debug_macro) }');
  1500. Add(' .debug_addr 0 : { *(.debug_addr) }');
  1501. Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
  1502. Add(' .xt.lit 0 : { KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*)) }');
  1503. Add(' .xt.insn 0 : { KEEP (*(.xt.insn .gnu.linkonce.x.*)) }');
  1504. Add(' .xt.prop 0 : { KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }');
  1505. Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
  1506. Add('}');
  1507. end;
  1508. {$endif XTENSA}
  1509. { Write and Close response }
  1510. linkres.writetodisk;
  1511. linkres.free;
  1512. WriteResponseFile:=True;
  1513. end;
  1514. function TlinkerEmbedded.MakeExecutable:boolean;
  1515. var
  1516. binstr,
  1517. cmdstr,
  1518. mapstr: TCmdStr;
  1519. success : boolean;
  1520. StaticStr,
  1521. GCSectionsStr,
  1522. DynLinkStr,
  1523. StripStr,
  1524. FixedExeFileName: string;
  1525. begin
  1526. { for future use }
  1527. StaticStr:='';
  1528. StripStr:='';
  1529. mapstr:='';
  1530. DynLinkStr:='';
  1531. FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.elf')));
  1532. GCSectionsStr:='--gc-sections';
  1533. //if not(cs_link_extern in current_settings.globalswitches) then
  1534. if not(cs_link_nolink in current_settings.globalswitches) then
  1535. Message1(exec_i_linking,current_module.exefilename);
  1536. if (cs_link_map in current_settings.globalswitches) then
  1537. mapstr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename,'.map'));
  1538. { Write used files and libraries }
  1539. WriteResponseFile();
  1540. { Call linker }
  1541. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  1542. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1543. if not(cs_link_on_target in current_settings.globalswitches) then
  1544. begin
  1545. Replace(cmdstr,'$EXE',FixedExeFileName);
  1546. Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
  1547. Replace(cmdstr,'$STATIC',StaticStr);
  1548. Replace(cmdstr,'$STRIP',StripStr);
  1549. Replace(cmdstr,'$MAP',mapstr);
  1550. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1551. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1552. end
  1553. else
  1554. begin
  1555. Replace(cmdstr,'$EXE',FixedExeFileName);
  1556. Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
  1557. Replace(cmdstr,'$STATIC',StaticStr);
  1558. Replace(cmdstr,'$STRIP',StripStr);
  1559. Replace(cmdstr,'$MAP',mapstr);
  1560. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1561. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1562. end;
  1563. success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
  1564. { Remove ReponseFile }
  1565. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1566. DeleteFile(outputexedir+Info.ResName);
  1567. { Post process }
  1568. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1569. success:=PostProcessExecutable(FixedExeFileName,false);
  1570. if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
  1571. begin
  1572. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
  1573. FixedExeFileName+' '+
  1574. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
  1575. if success then
  1576. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
  1577. FixedExeFileName+' '+
  1578. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
  1579. {$ifdef ARM}
  1580. if success and (current_settings.controllertype = ct_raspi2) then
  1581. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+ FixedExeFileName + ' kernel7.img',true,false);
  1582. {$endif ARM}
  1583. end;
  1584. MakeExecutable:=success; { otherwise a recursive call to link method }
  1585. end;
  1586. function TLinkerEmbedded.postprocessexecutable(const fn : string;isdll:boolean):boolean;
  1587. begin
  1588. Result:=PostProcessELFExecutable(fn,isdll);
  1589. end;
  1590. {*****************************************************************************
  1591. TlinkerEmbedded_SdccSdld
  1592. *****************************************************************************}
  1593. function TlinkerEmbedded_SdccSdld.WriteResponseFile: Boolean;
  1594. Var
  1595. linkres : TLinkRes;
  1596. i : longint;
  1597. HPath : TCmdStrListItem;
  1598. s,s1,s2 : TCmdStr;
  1599. prtobj,
  1600. cprtobj : string[80];
  1601. linklibc : boolean;
  1602. found1,
  1603. found2 : boolean;
  1604. {$if defined(ARM)}
  1605. LinkStr : string;
  1606. {$endif}
  1607. begin
  1608. WriteResponseFile:=False;
  1609. linklibc:=(SharedLibFiles.Find('c')<>nil);
  1610. prtobj:='prt0';
  1611. cprtobj:='cprt0';
  1612. if linklibc then
  1613. prtobj:=cprtobj;
  1614. { Open link.res file }
  1615. LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true);
  1616. { Write path to search libraries }
  1617. (* HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First);
  1618. while assigned(HPath) do
  1619. begin
  1620. s:=HPath.Str;
  1621. if (cs_link_on_target in current_settings.globalswitches) then
  1622. s:=ScriptFixFileName(s);
  1623. LinkRes.Add('-L'+s);
  1624. HPath:=TCmdStrListItem(HPath.Next);
  1625. end;
  1626. HPath:=TCmdStrListItem(LibrarySearchPath.First);
  1627. while assigned(HPath) do
  1628. begin
  1629. s:=HPath.Str;
  1630. if s<>'' then
  1631. LinkRes.Add('SEARCH_DIR("'+s+'")');
  1632. HPath:=TCmdStrListItem(HPath.Next);
  1633. end;
  1634. LinkRes.Add('INPUT (');
  1635. { add objectfiles, start with prt0 always }*)
  1636. //s:=FindObjectFile('prt0','',false);
  1637. if prtobj<>'' then
  1638. begin
  1639. s:=FindObjectFile(prtobj,'',false);
  1640. LinkRes.AddFileName(s);
  1641. end;
  1642. { try to add crti and crtbegin if linking to C }
  1643. if linklibc then
  1644. begin
  1645. if librarysearchpath.FindFile('crtbegin.o',false,s) then
  1646. LinkRes.AddFileName(s);
  1647. if librarysearchpath.FindFile('crti.o',false,s) then
  1648. LinkRes.AddFileName(s);
  1649. end;
  1650. while not ObjectFiles.Empty do
  1651. begin
  1652. s:=ObjectFiles.GetFirst;
  1653. if s<>'' then
  1654. begin
  1655. { vlink doesn't use SEARCH_DIR for object files }
  1656. if not(cs_link_on_target in current_settings.globalswitches) then
  1657. s:=FindObjectFile(s,'',false);
  1658. LinkRes.AddFileName((maybequoted(s)));
  1659. end;
  1660. end;
  1661. { Write staticlibraries }
  1662. if not StaticLibFiles.Empty then
  1663. begin
  1664. { vlink doesn't need, and doesn't support GROUP }
  1665. { if (cs_link_on_target in current_settings.globalswitches) then
  1666. begin
  1667. LinkRes.Add(')');
  1668. LinkRes.Add('GROUP(');
  1669. end;}
  1670. while not StaticLibFiles.Empty do
  1671. begin
  1672. S:=StaticLibFiles.GetFirst;
  1673. LinkRes.Add('-l'+maybequoted(s));
  1674. end;
  1675. end;
  1676. (* if (cs_link_on_target in current_settings.globalswitches) then
  1677. begin
  1678. LinkRes.Add(')');
  1679. { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
  1680. here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
  1681. linklibc:=false;
  1682. while not SharedLibFiles.Empty do
  1683. begin
  1684. S:=SharedLibFiles.GetFirst;
  1685. if s<>'c' then
  1686. begin
  1687. i:=Pos(target_info.sharedlibext,S);
  1688. if i>0 then
  1689. Delete(S,i,255);
  1690. LinkRes.Add('-l'+s);
  1691. end
  1692. else
  1693. begin
  1694. LinkRes.Add('-l'+s);
  1695. linklibc:=true;
  1696. end;
  1697. end;
  1698. { be sure that libc&libgcc is the last lib }
  1699. if linklibc then
  1700. begin
  1701. LinkRes.Add('-lc');
  1702. LinkRes.Add('-lgcc');
  1703. end;
  1704. end
  1705. else
  1706. begin
  1707. while not SharedLibFiles.Empty do
  1708. begin
  1709. S:=SharedLibFiles.GetFirst;
  1710. LinkRes.Add('lib'+s+target_info.staticlibext);
  1711. end;
  1712. LinkRes.Add(')');
  1713. end;*)
  1714. { objects which must be at the end }
  1715. (*if linklibc then
  1716. begin
  1717. found1:=librarysearchpath.FindFile('crtend.o',false,s1);
  1718. found2:=librarysearchpath.FindFile('crtn.o',false,s2);
  1719. if found1 or found2 then
  1720. begin
  1721. LinkRes.Add('INPUT(');
  1722. if found1 then
  1723. LinkRes.AddFileName(s1);
  1724. if found2 then
  1725. LinkRes.AddFileName(s2);
  1726. LinkRes.Add(')');
  1727. end;
  1728. end;*)
  1729. { Write and Close response }
  1730. linkres.writetodisk;
  1731. linkres.free;
  1732. WriteResponseFile:=True;
  1733. end;
  1734. procedure TlinkerEmbedded_SdccSdld.SetDefaultInfo;
  1735. const
  1736. {$if defined(Z80)}
  1737. ExeName='sdldz80';
  1738. {$else}
  1739. ExeName='sdld';
  1740. {$endif}
  1741. begin
  1742. with Info do
  1743. begin
  1744. ExeCmd[1]:=ExeName+' -n $OPT -i $MAP $EXE -f $RES'
  1745. //-g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
  1746. end;
  1747. end;
  1748. function TlinkerEmbedded_SdccSdld.MakeExecutable: boolean;
  1749. var
  1750. binstr,
  1751. cmdstr,
  1752. mapstr: TCmdStr;
  1753. success : boolean;
  1754. StaticStr,
  1755. // GCSectionsStr,
  1756. DynLinkStr,
  1757. StripStr,
  1758. FixedExeFileName: string;
  1759. begin
  1760. { for future use }
  1761. StaticStr:='';
  1762. StripStr:='';
  1763. mapstr:='';
  1764. DynLinkStr:='';
  1765. FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.ihx')));
  1766. (* GCSectionsStr:='--gc-sections';
  1767. //if not(cs_link_extern in current_settings.globalswitches) then
  1768. if not(cs_link_nolink in current_settings.globalswitches) then
  1769. Message1(exec_i_linking,current_module.exefilename);*)
  1770. if (cs_link_map in current_settings.globalswitches) then
  1771. mapstr:='-mw';
  1772. { Write used files and libraries }
  1773. WriteResponseFile();
  1774. { Call linker }
  1775. SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
  1776. Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1777. if not(cs_link_on_target in current_settings.globalswitches) then
  1778. begin
  1779. Replace(cmdstr,'$EXE',FixedExeFileName);
  1780. Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
  1781. Replace(cmdstr,'$STATIC',StaticStr);
  1782. Replace(cmdstr,'$STRIP',StripStr);
  1783. Replace(cmdstr,'$MAP',mapstr);
  1784. // Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1785. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1786. end
  1787. else
  1788. begin
  1789. Replace(cmdstr,'$EXE',FixedExeFileName);
  1790. Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName)));
  1791. Replace(cmdstr,'$STATIC',StaticStr);
  1792. Replace(cmdstr,'$STRIP',StripStr);
  1793. Replace(cmdstr,'$MAP',mapstr);
  1794. // Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1795. Replace(cmdstr,'$DYNLINK',DynLinkStr);
  1796. end;
  1797. success:=DoExec(FindUtil(utilsprefix+BinStr),cmdstr,true,false);
  1798. { Remove ReponseFile }
  1799. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1800. DeleteFile(outputexedir+Info.ResName);
  1801. (* { Post process }
  1802. if success and not(cs_link_nolink in current_settings.globalswitches) then
  1803. success:=PostProcessExecutable(FixedExeFileName,false);
  1804. if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
  1805. begin
  1806. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
  1807. FixedExeFileName+' '+
  1808. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
  1809. if success then
  1810. success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
  1811. FixedExeFileName+' '+
  1812. maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
  1813. end;*)
  1814. MakeExecutable:=success; { otherwise a recursive call to link method }
  1815. end;
  1816. {*****************************************************************************
  1817. TlinkerEmbedded_Wasm
  1818. *****************************************************************************}
  1819. constructor TLinkerEmbedded_Wasm.Create;
  1820. begin
  1821. inherited Create;
  1822. end;
  1823. procedure TLinkerEmbedded_Wasm.SetDefaultInfo;
  1824. begin
  1825. Info.DllCmd[1] := 'wasm-ld $SONAME $GCSECTIONS -o $EXE';
  1826. //Info.DllCmd[2] := 'wasmtool --exportrename $INPUT $EXE';
  1827. end;
  1828. function TLinkerEmbedded_Wasm.MakeSharedLibrary: boolean;
  1829. var
  1830. GCSectionsStr : ansistring;
  1831. binstr, cmdstr : Tcmdstr;
  1832. InitStr,
  1833. FiniStr,
  1834. SoNameStr : string[80];
  1835. mapstr,ltostr : TCmdStr;
  1836. success : Boolean;
  1837. tmp : TCmdStrListItem;
  1838. tempFileName : ansistring;
  1839. begin
  1840. //Result := true;
  1841. //Result:=inherited MakeSharedLibrary;
  1842. if (cs_link_smart in current_settings.globalswitches) and
  1843. create_smartlink_sections then
  1844. GCSectionsStr:='--gc-sections'
  1845. else
  1846. GCSectionsStr:='';
  1847. SoNameStr:='';
  1848. SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
  1849. Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename));
  1850. tmp := TCmdStrListItem(ObjectFiles.First);
  1851. while Assigned(tmp) do begin
  1852. cmdstr := tmp.Str+ ' ' + cmdstr;
  1853. tmp := TCmdStrListItem(tmp.Next);
  1854. end;
  1855. if HasExports then
  1856. cmdstr := cmdstr + ' --export-dynamic'; //' --export-dynamic';
  1857. cmdstr := cmdstr + ' --no-entry --allow-undefined';
  1858. if (cs_link_strip in current_settings.globalswitches) then
  1859. begin
  1860. { only remove non global symbols and debugging info for a library }
  1861. cmdstr := cmdstr + ' --strip-all';
  1862. end;
  1863. //Replace(cmdstr,'$OPT',Info.ExtraOptions);
  1864. //Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
  1865. //Replace(cmdstr,'$INIT',InitStr);
  1866. //Replace(cmdstr,'$FINI',FiniStr);
  1867. Replace(cmdstr,'$SONAME',SoNameStr);
  1868. //Replace(cmdstr,'$MAP',mapstr);
  1869. //Replace(cmdstr,'$LTO',ltostr);
  1870. Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
  1871. writeln(utilsprefix+binstr,' ',cmdstr);
  1872. success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,false);
  1873. //SplitBinCmd(Info.DllCmd[2],binstr,cmdstr);
  1874. //Replace(cmdstr,'$INPUT',current_module.objfilename );
  1875. //Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename));
  1876. //DoExec(FindUtil(utilsprefix+binstr),cmdstr,false,false);
  1877. MakeSharedLibrary:=success;
  1878. end;
  1879. {*****************************************************************************
  1880. Initialize
  1881. *****************************************************************************}
  1882. initialization
  1883. {$ifdef arm}
  1884. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1885. RegisterTarget(system_arm_embedded_info);
  1886. {$endif arm}
  1887. {$ifdef avr}
  1888. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1889. RegisterTarget(system_avr_embedded_info);
  1890. {$endif avr}
  1891. {$ifdef i386}
  1892. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1893. RegisterTarget(system_i386_embedded_info);
  1894. {$endif i386}
  1895. {$ifdef x86_64}
  1896. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1897. RegisterTarget(system_x86_64_embedded_info);
  1898. {$endif x86_64}
  1899. {$ifdef i8086}
  1900. { no need to register linker ld_embedded, because i8086_embedded uses the
  1901. regular msdos linker. In case a flat binary, relocated for a specific
  1902. segment address is needed (e.g. for a BIOS or a real mode bootloader), it
  1903. can be produced post-compilation with exe2bin or a similar tool. }
  1904. RegisterTarget(system_i8086_embedded_info);
  1905. {$endif i8086}
  1906. {$ifdef mipsel}
  1907. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1908. RegisterTarget(system_mipsel_embedded_info);
  1909. {$endif mipsel}
  1910. {$ifdef m68k}
  1911. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1912. RegisterTarget(system_m68k_embedded_info);
  1913. {$endif m68k}
  1914. {$ifdef riscv32}
  1915. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1916. RegisterTarget(system_riscv32_embedded_info);
  1917. {$endif riscv32}
  1918. {$ifdef riscv64}
  1919. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1920. RegisterTarget(system_riscv64_embedded_info);
  1921. {$endif riscv64}
  1922. {$ifdef xtensa}
  1923. RegisterLinker(ld_embedded,TLinkerEmbedded);
  1924. RegisterTarget(system_xtensa_embedded_info);
  1925. {$endif xtensa}
  1926. {$ifdef z80}
  1927. RegisterLinker(ld_embedded,TlinkerEmbedded_SdccSdld);
  1928. RegisterTarget(system_z80_embedded_info);
  1929. {$endif z80}
  1930. {$ifdef wasm32}
  1931. RegisterTarget(system_wasm32_embedded_info);
  1932. RegisterImport(system_wasm32_embedded, timportlibwasi);
  1933. RegisterExport(system_wasm32_embedded, texportlibwasi);
  1934. RegisterLinker(ld_wasm, TLinkerEmbedded_Wasm);
  1935. {$endif wasm32}
  1936. end.