Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

3 роки тому
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050
  1. This is ld.info, produced by makeinfo version 6.5 from ld.texi.
  2. This file documents the GNU linker LD (GNU Arm Embedded Toolchain
  3. 10-2020-q4-major) version 2.35.1.
  4. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3 or
  7. any later version published by the Free Software Foundation; with no
  8. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  9. Texts. A copy of the license is included in the section entitled "GNU
  10. Free Documentation License".
  11. INFO-DIR-SECTION Software development
  12. START-INFO-DIR-ENTRY
  13. * Ld: (ld). The GNU linker.
  14. END-INFO-DIR-ENTRY
  15. 
  16. File: ld.info, Node: Top, Next: Overview, Up: (dir)
  17. LD
  18. **
  19. This file documents the GNU linker ld (GNU Arm Embedded Toolchain
  20. 10-2020-q4-major) version 2.35.1.
  21. This document is distributed under the terms of the GNU Free
  22. Documentation License version 1.3. A copy of the license is included in
  23. the section entitled "GNU Free Documentation License".
  24. * Menu:
  25. * Overview:: Overview
  26. * Invocation:: Invocation
  27. * Scripts:: Linker Scripts
  28. * Machine Dependent:: Machine Dependent Features
  29. * BFD:: BFD
  30. * Reporting Bugs:: Reporting Bugs
  31. * MRI:: MRI Compatible Script Files
  32. * GNU Free Documentation License:: GNU Free Documentation License
  33. * LD Index:: LD Index
  34. 
  35. File: ld.info, Node: Overview, Next: Invocation, Prev: Top, Up: Top
  36. 1 Overview
  37. **********
  38. 'ld' combines a number of object and archive files, relocates their data
  39. and ties up symbol references. Usually the last step in compiling a
  40. program is to run 'ld'.
  41. 'ld' accepts Linker Command Language files written in a superset of
  42. AT&T's Link Editor Command Language syntax, to provide explicit and
  43. total control over the linking process.
  44. This version of 'ld' uses the general purpose BFD libraries to
  45. operate on object files. This allows 'ld' to read, combine, and write
  46. object files in many different formats--for example, COFF or 'a.out'.
  47. Different formats may be linked together to produce any available kind
  48. of object file. *Note BFD::, for more information.
  49. Aside from its flexibility, the GNU linker is more helpful than other
  50. linkers in providing diagnostic information. Many linkers abandon
  51. execution immediately upon encountering an error; whenever possible,
  52. 'ld' continues executing, allowing you to identify other errors (or, in
  53. some cases, to get an output file in spite of the error).
  54. 
  55. File: ld.info, Node: Invocation, Next: Scripts, Prev: Overview, Up: Top
  56. 2 Invocation
  57. ************
  58. The GNU linker 'ld' is meant to cover a broad range of situations, and
  59. to be as compatible as possible with other linkers. As a result, you
  60. have many choices to control its behavior.
  61. * Menu:
  62. * Options:: Command-line Options
  63. * Environment:: Environment Variables
  64. 
  65. File: ld.info, Node: Options, Next: Environment, Up: Invocation
  66. 2.1 Command-line Options
  67. ========================
  68. The linker supports a plethora of command-line options, but in actual
  69. practice few of them are used in any particular context. For instance,
  70. a frequent use of 'ld' is to link standard Unix object files on a
  71. standard, supported Unix system. On such a system, to link a file
  72. 'hello.o':
  73. ld -o OUTPUT /lib/crt0.o hello.o -lc
  74. This tells 'ld' to produce a file called OUTPUT as the result of
  75. linking the file '/lib/crt0.o' with 'hello.o' and the library 'libc.a',
  76. which will come from the standard search directories. (See the
  77. discussion of the '-l' option below.)
  78. Some of the command-line options to 'ld' may be specified at any
  79. point in the command line. However, options which refer to files, such
  80. as '-l' or '-T', cause the file to be read at the point at which the
  81. option appears in the command line, relative to the object files and
  82. other file options. Repeating non-file options with a different
  83. argument will either have no further effect, or override prior
  84. occurrences (those further to the left on the command line) of that
  85. option. Options which may be meaningfully specified more than once are
  86. noted in the descriptions below.
  87. Non-option arguments are object files or archives which are to be
  88. linked together. They may follow, precede, or be mixed in with
  89. command-line options, except that an object file argument may not be
  90. placed between an option and its argument.
  91. Usually the linker is invoked with at least one object file, but you
  92. can specify other forms of binary input files using '-l', '-R', and the
  93. script command language. If _no_ binary input files at all are
  94. specified, the linker does not produce any output, and issues the
  95. message 'No input files'.
  96. If the linker cannot recognize the format of an object file, it will
  97. assume that it is a linker script. A script specified in this way
  98. augments the main linker script used for the link (either the default
  99. linker script or the one specified by using '-T'). This feature permits
  100. the linker to link against a file which appears to be an object or an
  101. archive, but actually merely defines some symbol values, or uses 'INPUT'
  102. or 'GROUP' to load other objects. Specifying a script in this way
  103. merely augments the main linker script, with the extra commands placed
  104. after the main script; use the '-T' option to replace the default linker
  105. script entirely, but note the effect of the 'INSERT' command. *Note
  106. Scripts::.
  107. For options whose names are a single letter, option arguments must
  108. either follow the option letter without intervening whitespace, or be
  109. given as separate arguments immediately following the option that
  110. requires them.
  111. For options whose names are multiple letters, either one dash or two
  112. can precede the option name; for example, '-trace-symbol' and
  113. '--trace-symbol' are equivalent. Note--there is one exception to this
  114. rule. Multiple letter options that start with a lower case 'o' can only
  115. be preceded by two dashes. This is to reduce confusion with the '-o'
  116. option. So for example '-omagic' sets the output file name to 'magic'
  117. whereas '--omagic' sets the NMAGIC flag on the output.
  118. Arguments to multiple-letter options must either be separated from
  119. the option name by an equals sign, or be given as separate arguments
  120. immediately following the option that requires them. For example,
  121. '--trace-symbol foo' and '--trace-symbol=foo' are equivalent. Unique
  122. abbreviations of the names of multiple-letter options are accepted.
  123. Note--if the linker is being invoked indirectly, via a compiler
  124. driver (e.g. 'gcc') then all the linker command-line options should be
  125. prefixed by '-Wl,' (or whatever is appropriate for the particular
  126. compiler driver) like this:
  127. gcc -Wl,--start-group foo.o bar.o -Wl,--end-group
  128. This is important, because otherwise the compiler driver program may
  129. silently drop the linker options, resulting in a bad link. Confusion
  130. may also arise when passing options that require values through a
  131. driver, as the use of a space between option and argument acts as a
  132. separator, and causes the driver to pass only the option to the linker
  133. and the argument to the compiler. In this case, it is simplest to use
  134. the joined forms of both single- and multiple-letter options, such as:
  135. gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map
  136. Here is a table of the generic command-line switches accepted by the
  137. GNU linker:
  138. '@FILE'
  139. Read command-line options from FILE. The options read are inserted
  140. in place of the original @FILE option. If FILE does not exist, or
  141. cannot be read, then the option will be treated literally, and not
  142. removed.
  143. Options in FILE are separated by whitespace. A whitespace
  144. character may be included in an option by surrounding the entire
  145. option in either single or double quotes. Any character (including
  146. a backslash) may be included by prefixing the character to be
  147. included with a backslash. The FILE may itself contain additional
  148. @FILE options; any such options will be processed recursively.
  149. '-a KEYWORD'
  150. This option is supported for HP/UX compatibility. The KEYWORD
  151. argument must be one of the strings 'archive', 'shared', or
  152. 'default'. '-aarchive' is functionally equivalent to '-Bstatic',
  153. and the other two keywords are functionally equivalent to
  154. '-Bdynamic'. This option may be used any number of times.
  155. '--audit AUDITLIB'
  156. Adds AUDITLIB to the 'DT_AUDIT' entry of the dynamic section.
  157. AUDITLIB is not checked for existence, nor will it use the
  158. DT_SONAME specified in the library. If specified multiple times
  159. 'DT_AUDIT' will contain a colon separated list of audit interfaces
  160. to use. If the linker finds an object with an audit entry while
  161. searching for shared libraries, it will add a corresponding
  162. 'DT_DEPAUDIT' entry in the output file. This option is only
  163. meaningful on ELF platforms supporting the rtld-audit interface.
  164. '-b INPUT-FORMAT'
  165. '--format=INPUT-FORMAT'
  166. 'ld' may be configured to support more than one kind of object
  167. file. If your 'ld' is configured this way, you can use the '-b'
  168. option to specify the binary format for input object files that
  169. follow this option on the command line. Even when 'ld' is
  170. configured to support alternative object formats, you don't usually
  171. need to specify this, as 'ld' should be configured to expect as a
  172. default input format the most usual format on each machine.
  173. INPUT-FORMAT is a text string, the name of a particular format
  174. supported by the BFD libraries. (You can list the available binary
  175. formats with 'objdump -i'.) *Note BFD::.
  176. You may want to use this option if you are linking files with an
  177. unusual binary format. You can also use '-b' to switch formats
  178. explicitly (when linking object files of different formats), by
  179. including '-b INPUT-FORMAT' before each group of object files in a
  180. particular format.
  181. The default format is taken from the environment variable
  182. 'GNUTARGET'. *Note Environment::. You can also define the input
  183. format from a script, using the command 'TARGET'; see *note Format
  184. Commands::.
  185. '-c MRI-COMMANDFILE'
  186. '--mri-script=MRI-COMMANDFILE'
  187. For compatibility with linkers produced by MRI, 'ld' accepts script
  188. files written in an alternate, restricted command language,
  189. described in *note MRI Compatible Script Files: MRI. Introduce MRI
  190. script files with the option '-c'; use the '-T' option to run
  191. linker scripts written in the general-purpose 'ld' scripting
  192. language. If MRI-CMDFILE does not exist, 'ld' looks for it in the
  193. directories specified by any '-L' options.
  194. '-d'
  195. '-dc'
  196. '-dp'
  197. These three options are equivalent; multiple forms are supported
  198. for compatibility with other linkers. They assign space to common
  199. symbols even if a relocatable output file is specified (with '-r').
  200. The script command 'FORCE_COMMON_ALLOCATION' has the same effect.
  201. *Note Miscellaneous Commands::.
  202. '--depaudit AUDITLIB'
  203. '-P AUDITLIB'
  204. Adds AUDITLIB to the 'DT_DEPAUDIT' entry of the dynamic section.
  205. AUDITLIB is not checked for existence, nor will it use the
  206. DT_SONAME specified in the library. If specified multiple times
  207. 'DT_DEPAUDIT' will contain a colon separated list of audit
  208. interfaces to use. This option is only meaningful on ELF platforms
  209. supporting the rtld-audit interface. The -P option is provided for
  210. Solaris compatibility.
  211. '--enable-non-contiguous-regions'
  212. This option avoids generating an error if an input section does not
  213. fit a matching output section. The linker tries to allocate the
  214. input section to subseque nt matching output sections, and
  215. generates an error only if no output section is large enough. This
  216. is useful when several non-contiguous memory regions are available
  217. and the input section does not require a particular one. The order
  218. in which input sections are evaluated does not change, for
  219. instance:
  220. MEMORY {
  221. MEM1 (rwx) : ORIGIN : 0x1000, LENGTH = 0x14
  222. MEM2 (rwx) : ORIGIN : 0x1000, LENGTH = 0x40
  223. MEM3 (rwx) : ORIGIN : 0x2000, LENGTH = 0x40
  224. }
  225. SECTIONS {
  226. mem1 : { *(.data.*); } > MEM1
  227. mem2 : { *(.data.*); } > MEM2
  228. mem3 : { *(.data.*); } > MEM2
  229. }
  230. with input sections:
  231. .data.1: size 8
  232. .data.2: size 0x10
  233. .data.3: size 4
  234. results in .data.1 affected to mem1, and .data.2 and .data.3
  235. affected to mem2, even though .data.3 would fit in mem3.
  236. This option is incompatible with INSERT statements because it
  237. changes the way input sections are mapped to output sections.
  238. '--enable-non-contiguous-regions-warnings'
  239. This option enables warnings when '--enable-non-contiguous-regions'
  240. allows possibly unexpected matches in sections mapping, potentially
  241. leading to silently discarding a section instead of failing because
  242. it does not fit any output region.
  243. '-e ENTRY'
  244. '--entry=ENTRY'
  245. Use ENTRY as the explicit symbol for beginning execution of your
  246. program, rather than the default entry point. If there is no
  247. symbol named ENTRY, the linker will try to parse ENTRY as a number,
  248. and use that as the entry address (the number will be interpreted
  249. in base 10; you may use a leading '0x' for base 16, or a leading
  250. '0' for base 8). *Note Entry Point::, for a discussion of defaults
  251. and other ways of specifying the entry point.
  252. '--exclude-libs LIB,LIB,...'
  253. Specifies a list of archive libraries from which symbols should not
  254. be automatically exported. The library names may be delimited by
  255. commas or colons. Specifying '--exclude-libs ALL' excludes symbols
  256. in all archive libraries from automatic export. This option is
  257. available only for the i386 PE targeted port of the linker and for
  258. ELF targeted ports. For i386 PE, symbols explicitly listed in a
  259. .def file are still exported, regardless of this option. For ELF
  260. targeted ports, symbols affected by this option will be treated as
  261. hidden.
  262. '--exclude-modules-for-implib MODULE,MODULE,...'
  263. Specifies a list of object files or archive members, from which
  264. symbols should not be automatically exported, but which should be
  265. copied wholesale into the import library being generated during the
  266. link. The module names may be delimited by commas or colons, and
  267. must match exactly the filenames used by 'ld' to open the files;
  268. for archive members, this is simply the member name, but for object
  269. files the name listed must include and match precisely any path
  270. used to specify the input file on the linker's command-line. This
  271. option is available only for the i386 PE targeted port of the
  272. linker. Symbols explicitly listed in a .def file are still
  273. exported, regardless of this option.
  274. '-E'
  275. '--export-dynamic'
  276. '--no-export-dynamic'
  277. When creating a dynamically linked executable, using the '-E'
  278. option or the '--export-dynamic' option causes the linker to add
  279. all symbols to the dynamic symbol table. The dynamic symbol table
  280. is the set of symbols which are visible from dynamic objects at run
  281. time.
  282. If you do not use either of these options (or use the
  283. '--no-export-dynamic' option to restore the default behavior), the
  284. dynamic symbol table will normally contain only those symbols which
  285. are referenced by some dynamic object mentioned in the link.
  286. If you use 'dlopen' to load a dynamic object which needs to refer
  287. back to the symbols defined by the program, rather than some other
  288. dynamic object, then you will probably need to use this option when
  289. linking the program itself.
  290. You can also use the dynamic list to control what symbols should be
  291. added to the dynamic symbol table if the output format supports it.
  292. See the description of '--dynamic-list'.
  293. Note that this option is specific to ELF targeted ports. PE
  294. targets support a similar function to export all symbols from a DLL
  295. or EXE; see the description of '--export-all-symbols' below.
  296. '--export-dynamic-symbol=GLOB'
  297. When creating a dynamically linked executable, symbols matching
  298. GLOB will be added to the dynamic symbol table. When creating a
  299. shared library, references to symbols matching GLOB will not be
  300. bound to the definitions within the shared library. This option is
  301. a no-op when creating a shared library and '-Bsymbolic' or
  302. '--dynamic-list' are not specified. This option is only meaningful
  303. on ELF platforms which support shared libraries.
  304. '--export-dynamic-symbol-list=FILE'
  305. Specify a '--export-dynamic-symbol' for each pattern in the file.
  306. The format of the file is the same as the version node without
  307. scope and node name. See *note VERSION:: for more information.
  308. '-EB'
  309. Link big-endian objects. This affects the default output format.
  310. '-EL'
  311. Link little-endian objects. This affects the default output
  312. format.
  313. '-f NAME'
  314. '--auxiliary=NAME'
  315. When creating an ELF shared object, set the internal DT_AUXILIARY
  316. field to the specified name. This tells the dynamic linker that
  317. the symbol table of the shared object should be used as an
  318. auxiliary filter on the symbol table of the shared object NAME.
  319. If you later link a program against this filter object, then, when
  320. you run the program, the dynamic linker will see the DT_AUXILIARY
  321. field. If the dynamic linker resolves any symbols from the filter
  322. object, it will first check whether there is a definition in the
  323. shared object NAME. If there is one, it will be used instead of
  324. the definition in the filter object. The shared object NAME need
  325. not exist. Thus the shared object NAME may be used to provide an
  326. alternative implementation of certain functions, perhaps for
  327. debugging or for machine-specific performance.
  328. This option may be specified more than once. The DT_AUXILIARY
  329. entries will be created in the order in which they appear on the
  330. command line.
  331. '-F NAME'
  332. '--filter=NAME'
  333. When creating an ELF shared object, set the internal DT_FILTER
  334. field to the specified name. This tells the dynamic linker that
  335. the symbol table of the shared object which is being created should
  336. be used as a filter on the symbol table of the shared object NAME.
  337. If you later link a program against this filter object, then, when
  338. you run the program, the dynamic linker will see the DT_FILTER
  339. field. The dynamic linker will resolve symbols according to the
  340. symbol table of the filter object as usual, but it will actually
  341. link to the definitions found in the shared object NAME. Thus the
  342. filter object can be used to select a subset of the symbols
  343. provided by the object NAME.
  344. Some older linkers used the '-F' option throughout a compilation
  345. toolchain for specifying object-file format for both input and
  346. output object files. The GNU linker uses other mechanisms for this
  347. purpose: the '-b', '--format', '--oformat' options, the 'TARGET'
  348. command in linker scripts, and the 'GNUTARGET' environment
  349. variable. The GNU linker will ignore the '-F' option when not
  350. creating an ELF shared object.
  351. '-fini=NAME'
  352. When creating an ELF executable or shared object, call NAME when
  353. the executable or shared object is unloaded, by setting DT_FINI to
  354. the address of the function. By default, the linker uses '_fini'
  355. as the function to call.
  356. '-g'
  357. Ignored. Provided for compatibility with other tools.
  358. '-G VALUE'
  359. '--gpsize=VALUE'
  360. Set the maximum size of objects to be optimized using the GP
  361. register to SIZE. This is only meaningful for object file formats
  362. such as MIPS ELF that support putting large and small objects into
  363. different sections. This is ignored for other object file formats.
  364. '-h NAME'
  365. '-soname=NAME'
  366. When creating an ELF shared object, set the internal DT_SONAME
  367. field to the specified name. When an executable is linked with a
  368. shared object which has a DT_SONAME field, then when the executable
  369. is run the dynamic linker will attempt to load the shared object
  370. specified by the DT_SONAME field rather than the using the file
  371. name given to the linker.
  372. '-i'
  373. Perform an incremental link (same as option '-r').
  374. '-init=NAME'
  375. When creating an ELF executable or shared object, call NAME when
  376. the executable or shared object is loaded, by setting DT_INIT to
  377. the address of the function. By default, the linker uses '_init'
  378. as the function to call.
  379. '-l NAMESPEC'
  380. '--library=NAMESPEC'
  381. Add the archive or object file specified by NAMESPEC to the list of
  382. files to link. This option may be used any number of times. If
  383. NAMESPEC is of the form ':FILENAME', 'ld' will search the library
  384. path for a file called FILENAME, otherwise it will search the
  385. library path for a file called 'libNAMESPEC.a'.
  386. On systems which support shared libraries, 'ld' may also search for
  387. files other than 'libNAMESPEC.a'. Specifically, on ELF and SunOS
  388. systems, 'ld' will search a directory for a library called
  389. 'libNAMESPEC.so' before searching for one called 'libNAMESPEC.a'.
  390. (By convention, a '.so' extension indicates a shared library.)
  391. Note that this behavior does not apply to ':FILENAME', which always
  392. specifies a file called FILENAME.
  393. The linker will search an archive only once, at the location where
  394. it is specified on the command line. If the archive defines a
  395. symbol which was undefined in some object which appeared before the
  396. archive on the command line, the linker will include the
  397. appropriate file(s) from the archive. However, an undefined symbol
  398. in an object appearing later on the command line will not cause the
  399. linker to search the archive again.
  400. See the '-(' option for a way to force the linker to search
  401. archives multiple times.
  402. You may list the same archive multiple times on the command line.
  403. This type of archive searching is standard for Unix linkers.
  404. However, if you are using 'ld' on AIX, note that it is different
  405. from the behaviour of the AIX linker.
  406. '-L SEARCHDIR'
  407. '--library-path=SEARCHDIR'
  408. Add path SEARCHDIR to the list of paths that 'ld' will search for
  409. archive libraries and 'ld' control scripts. You may use this
  410. option any number of times. The directories are searched in the
  411. order in which they are specified on the command line. Directories
  412. specified on the command line are searched before the default
  413. directories. All '-L' options apply to all '-l' options,
  414. regardless of the order in which the options appear. '-L' options
  415. do not affect how 'ld' searches for a linker script unless '-T'
  416. option is specified.
  417. If SEARCHDIR begins with '=' or '$SYSROOT', then this prefix will
  418. be replaced by the "sysroot prefix", controlled by the '--sysroot'
  419. option, or specified when the linker is configured.
  420. The default set of paths searched (without being specified with
  421. '-L') depends on which emulation mode 'ld' is using, and in some
  422. cases also on how it was configured. *Note Environment::.
  423. The paths can also be specified in a link script with the
  424. 'SEARCH_DIR' command. Directories specified this way are searched
  425. at the point in which the linker script appears in the command
  426. line.
  427. '-m EMULATION'
  428. Emulate the EMULATION linker. You can list the available
  429. emulations with the '--verbose' or '-V' options.
  430. If the '-m' option is not used, the emulation is taken from the
  431. 'LDEMULATION' environment variable, if that is defined.
  432. Otherwise, the default emulation depends upon how the linker was
  433. configured.
  434. '-M'
  435. '--print-map'
  436. Print a link map to the standard output. A link map provides
  437. information about the link, including the following:
  438. * Where object files are mapped into memory.
  439. * How common symbols are allocated.
  440. * All archive members included in the link, with a mention of
  441. the symbol which caused the archive member to be brought in.
  442. * The values assigned to symbols.
  443. Note - symbols whose values are computed by an expression
  444. which involves a reference to a previous value of the same
  445. symbol may not have correct result displayed in the link map.
  446. This is because the linker discards intermediate results and
  447. only retains the final value of an expression. Under such
  448. circumstances the linker will display the final value enclosed
  449. by square brackets. Thus for example a linker script
  450. containing:
  451. foo = 1
  452. foo = foo * 4
  453. foo = foo + 8
  454. will produce the following output in the link map if the '-M'
  455. option is used:
  456. 0x00000001 foo = 0x1
  457. [0x0000000c] foo = (foo * 0x4)
  458. [0x0000000c] foo = (foo + 0x8)
  459. See *note Expressions:: for more information about expressions
  460. in linker scripts.
  461. * How GNU properties are merged.
  462. When the linker merges input .note.gnu.property sections into
  463. one output .note.gnu.property section, some properties are
  464. removed or updated. These actions are reported in the link
  465. map. For example:
  466. Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
  467. This indicates that property 0xc0000002 is removed from output
  468. when merging properties in 'foo.o', whose property 0xc0000002
  469. value is 0x1, and 'bar.o', which doesn't have property
  470. 0xc0000002.
  471. Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1)
  472. This indicates that property 0xc0010001 value is updated to
  473. 0x1 in output when merging properties in 'foo.o', whose
  474. 0xc0010001 property value is 0x1, and 'bar.o', whose
  475. 0xc0010001 property value is 0x1.
  476. '--print-map-discarded'
  477. '--no-print-map-discarded'
  478. Print (or do not print) the list of discarded and garbage collected
  479. sections in the link map. Enabled by default.
  480. '-n'
  481. '--nmagic'
  482. Turn off page alignment of sections, and disable linking against
  483. shared libraries. If the output format supports Unix style magic
  484. numbers, mark the output as 'NMAGIC'.
  485. '-N'
  486. '--omagic'
  487. Set the text and data sections to be readable and writable. Also,
  488. do not page-align the data segment, and disable linking against
  489. shared libraries. If the output format supports Unix style magic
  490. numbers, mark the output as 'OMAGIC'. Note: Although a writable
  491. text section is allowed for PE-COFF targets, it does not conform to
  492. the format specification published by Microsoft.
  493. '--no-omagic'
  494. This option negates most of the effects of the '-N' option. It
  495. sets the text section to be read-only, and forces the data segment
  496. to be page-aligned. Note - this option does not enable linking
  497. against shared libraries. Use '-Bdynamic' for this.
  498. '-o OUTPUT'
  499. '--output=OUTPUT'
  500. Use OUTPUT as the name for the program produced by 'ld'; if this
  501. option is not specified, the name 'a.out' is used by default. The
  502. script command 'OUTPUT' can also specify the output file name.
  503. '--dependency-file=DEPFILE'
  504. Write a "dependency file" to DEPFILE. This file contains a rule
  505. suitable for 'make' describing the output file and all the input
  506. files that were read to produce it. The output is similar to the
  507. compiler's output with '-M -MP' (*note Options Controlling the
  508. Preprocessor: (gcc.info)Preprocessor Options.). Note that there is
  509. no option like the compiler's '-MM', to exclude "system files"
  510. (which is not a well-specified concept in the linker, unlike
  511. "system headers" in the compiler). So the output from
  512. '--dependency-file' is always specific to the exact state of the
  513. installation where it was produced, and should not be copied into
  514. distributed makefiles without careful editing.
  515. '-O LEVEL'
  516. If LEVEL is a numeric values greater than zero 'ld' optimizes the
  517. output. This might take significantly longer and therefore
  518. probably should only be enabled for the final binary. At the
  519. moment this option only affects ELF shared library generation.
  520. Future releases of the linker may make more use of this option.
  521. Also currently there is no difference in the linker's behaviour for
  522. different non-zero values of this option. Again this may change
  523. with future releases.
  524. '-plugin NAME'
  525. Involve a plugin in the linking process. The NAME parameter is the
  526. absolute filename of the plugin. Usually this parameter is
  527. automatically added by the complier, when using link time
  528. optimization, but users can also add their own plugins if they so
  529. wish.
  530. Note that the location of the compiler originated plugins is
  531. different from the place where the 'ar', 'nm' and 'ranlib' programs
  532. search for their plugins. In order for those commands to make use
  533. of a compiler based plugin it must first be copied into the
  534. '${libdir}/bfd-plugins' directory. All gcc based linker plugins
  535. are backward compatible, so it is sufficient to just copy in the
  536. newest one.
  537. '--push-state'
  538. The '--push-state' allows to preserve the current state of the
  539. flags which govern the input file handling so that they can all be
  540. restored with one corresponding '--pop-state' option.
  541. The option which are covered are: '-Bdynamic', '-Bstatic', '-dn',
  542. '-dy', '-call_shared', '-non_shared', '-static', '-N', '-n',
  543. '--whole-archive', '--no-whole-archive', '-r', '-Ur',
  544. '--copy-dt-needed-entries', '--no-copy-dt-needed-entries',
  545. '--as-needed', '--no-as-needed', and '-a'.
  546. One target for this option are specifications for 'pkg-config'.
  547. When used with the '--libs' option all possibly needed libraries
  548. are listed and then possibly linked with all the time. It is
  549. better to return something as follows:
  550. -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state
  551. '--pop-state'
  552. Undoes the effect of -push-state, restores the previous values of
  553. the flags governing input file handling.
  554. '-q'
  555. '--emit-relocs'
  556. Leave relocation sections and contents in fully linked executables.
  557. Post link analysis and optimization tools may need this information
  558. in order to perform correct modifications of executables. This
  559. results in larger executables.
  560. This option is currently only supported on ELF platforms.
  561. '--force-dynamic'
  562. Force the output file to have dynamic sections. This option is
  563. specific to VxWorks targets.
  564. '-r'
  565. '--relocatable'
  566. Generate relocatable output--i.e., generate an output file that can
  567. in turn serve as input to 'ld'. This is often called "partial
  568. linking". As a side effect, in environments that support standard
  569. Unix magic numbers, this option also sets the output file's magic
  570. number to 'OMAGIC'. If this option is not specified, an absolute
  571. file is produced. When linking C++ programs, this option _will
  572. not_ resolve references to constructors; to do that, use '-Ur'.
  573. When an input file does not have the same format as the output
  574. file, partial linking is only supported if that input file does not
  575. contain any relocations. Different output formats can have further
  576. restrictions; for example some 'a.out'-based formats do not support
  577. partial linking with input files in other formats at all.
  578. This option does the same thing as '-i'.
  579. '-R FILENAME'
  580. '--just-symbols=FILENAME'
  581. Read symbol names and their addresses from FILENAME, but do not
  582. relocate it or include it in the output. This allows your output
  583. file to refer symbolically to absolute locations of memory defined
  584. in other programs. You may use this option more than once.
  585. For compatibility with other ELF linkers, if the '-R' option is
  586. followed by a directory name, rather than a file name, it is
  587. treated as the '-rpath' option.
  588. '-s'
  589. '--strip-all'
  590. Omit all symbol information from the output file.
  591. '-S'
  592. '--strip-debug'
  593. Omit debugger symbol information (but not all symbols) from the
  594. output file.
  595. '--strip-discarded'
  596. '--no-strip-discarded'
  597. Omit (or do not omit) global symbols defined in discarded sections.
  598. Enabled by default.
  599. '-t'
  600. '--trace'
  601. Print the names of the input files as 'ld' processes them. If '-t'
  602. is given twice then members within archives are also printed. '-t'
  603. output is useful to generate a list of all the object files and
  604. scripts involved in linking, for example, when packaging files for
  605. a linker bug report.
  606. '-T SCRIPTFILE'
  607. '--script=SCRIPTFILE'
  608. Use SCRIPTFILE as the linker script. This script replaces 'ld''s
  609. default linker script (rather than adding to it), so COMMANDFILE
  610. must specify everything necessary to describe the output file.
  611. *Note Scripts::. If SCRIPTFILE does not exist in the current
  612. directory, 'ld' looks for it in the directories specified by any
  613. preceding '-L' options. Multiple '-T' options accumulate.
  614. '-dT SCRIPTFILE'
  615. '--default-script=SCRIPTFILE'
  616. Use SCRIPTFILE as the default linker script. *Note Scripts::.
  617. This option is similar to the '--script' option except that
  618. processing of the script is delayed until after the rest of the
  619. command line has been processed. This allows options placed after
  620. the '--default-script' option on the command line to affect the
  621. behaviour of the linker script, which can be important when the
  622. linker command line cannot be directly controlled by the user. (eg
  623. because the command line is being constructed by another tool, such
  624. as 'gcc').
  625. '-u SYMBOL'
  626. '--undefined=SYMBOL'
  627. Force SYMBOL to be entered in the output file as an undefined
  628. symbol. Doing this may, for example, trigger linking of additional
  629. modules from standard libraries. '-u' may be repeated with
  630. different option arguments to enter additional undefined symbols.
  631. This option is equivalent to the 'EXTERN' linker script command.
  632. If this option is being used to force additional modules to be
  633. pulled into the link, and if it is an error for the symbol to
  634. remain undefined, then the option '--require-defined' should be
  635. used instead.
  636. '--require-defined=SYMBOL'
  637. Require that SYMBOL is defined in the output file. This option is
  638. the same as option '--undefined' except that if SYMBOL is not
  639. defined in the output file then the linker will issue an error and
  640. exit. The same effect can be achieved in a linker script by using
  641. 'EXTERN', 'ASSERT' and 'DEFINED' together. This option can be used
  642. multiple times to require additional symbols.
  643. '-Ur'
  644. For anything other than C++ programs, this option is equivalent to
  645. '-r': it generates relocatable output--i.e., an output file that
  646. can in turn serve as input to 'ld'. When linking C++ programs,
  647. '-Ur' _does_ resolve references to constructors, unlike '-r'. It
  648. does not work to use '-Ur' on files that were themselves linked
  649. with '-Ur'; once the constructor table has been built, it cannot be
  650. added to. Use '-Ur' only for the last partial link, and '-r' for
  651. the others.
  652. '--orphan-handling=MODE'
  653. Control how orphan sections are handled. An orphan section is one
  654. not specifically mentioned in a linker script. *Note Orphan
  655. Sections::.
  656. MODE can have any of the following values:
  657. 'place'
  658. Orphan sections are placed into a suitable output section
  659. following the strategy described in *note Orphan Sections::.
  660. The option '--unique' also affects how sections are placed.
  661. 'discard'
  662. All orphan sections are discarded, by placing them in the
  663. '/DISCARD/' section (*note Output Section Discarding::).
  664. 'warn'
  665. The linker will place the orphan section as for 'place' and
  666. also issue a warning.
  667. 'error'
  668. The linker will exit with an error if any orphan section is
  669. found.
  670. The default if '--orphan-handling' is not given is 'place'.
  671. '--unique[=SECTION]'
  672. Creates a separate output section for every input section matching
  673. SECTION, or if the optional wildcard SECTION argument is missing,
  674. for every orphan input section. An orphan section is one not
  675. specifically mentioned in a linker script. You may use this option
  676. multiple times on the command line; It prevents the normal merging
  677. of input sections with the same name, overriding output section
  678. assignments in a linker script.
  679. '-v'
  680. '--version'
  681. '-V'
  682. Display the version number for 'ld'. The '-V' option also lists
  683. the supported emulations.
  684. '-x'
  685. '--discard-all'
  686. Delete all local symbols.
  687. '-X'
  688. '--discard-locals'
  689. Delete all temporary local symbols. (These symbols start with
  690. system-specific local label prefixes, typically '.L' for ELF
  691. systems or 'L' for traditional a.out systems.)
  692. '-y SYMBOL'
  693. '--trace-symbol=SYMBOL'
  694. Print the name of each linked file in which SYMBOL appears. This
  695. option may be given any number of times. On many systems it is
  696. necessary to prepend an underscore.
  697. This option is useful when you have an undefined symbol in your
  698. link but don't know where the reference is coming from.
  699. '-Y PATH'
  700. Add PATH to the default library search path. This option exists
  701. for Solaris compatibility.
  702. '-z KEYWORD'
  703. The recognized keywords are:
  704. 'bndplt'
  705. Always generate BND prefix in PLT entries. Supported for
  706. Linux/x86_64.
  707. 'call-nop=prefix-addr'
  708. 'call-nop=suffix-nop'
  709. 'call-nop=prefix-BYTE'
  710. 'call-nop=suffix-BYTE'
  711. Specify the 1-byte 'NOP' padding when transforming indirect
  712. call to a locally defined function, foo, via its GOT slot.
  713. 'call-nop=prefix-addr' generates '0x67 call foo'.
  714. 'call-nop=suffix-nop' generates 'call foo 0x90'.
  715. 'call-nop=prefix-BYTE' generates 'BYTE call foo'.
  716. 'call-nop=suffix-BYTE' generates 'call foo BYTE'. Supported
  717. for i386 and x86_64.
  718. 'cet-report=none'
  719. 'cet-report=warning'
  720. 'cet-report=error'
  721. Specify how to report the missing
  722. GNU_PROPERTY_X86_FEATURE_1_IBT and
  723. GNU_PROPERTY_X86_FEATURE_1_SHSTK properties in input
  724. .note.gnu.property section. 'cet-report=none', which is the
  725. default, will make the linker not report missing properties in
  726. input files. 'cet-report=warning' will make the linker issue
  727. a warning for missing properties in input files.
  728. 'cet-report=error' will make the linker issue an error for
  729. missing properties in input files. Note that 'ibt' will turn
  730. off the missing GNU_PROPERTY_X86_FEATURE_1_IBT property report
  731. and 'shstk' will turn off the missing
  732. GNU_PROPERTY_X86_FEATURE_1_SHSTK property report. Supported
  733. for Linux/i386 and Linux/x86_64.
  734. 'combreloc'
  735. 'nocombreloc'
  736. Combine multiple dynamic relocation sections and sort to
  737. improve dynamic symbol lookup caching. Do not do this if
  738. 'nocombreloc'.
  739. 'common'
  740. 'nocommon'
  741. Generate common symbols with STT_COMMON type during a
  742. relocatable link. Use STT_OBJECT type if 'nocommon'.
  743. 'common-page-size=VALUE'
  744. Set the page size most commonly used to VALUE. Memory image
  745. layout will be optimized to minimize memory pages if the
  746. system is using pages of this size.
  747. 'defs'
  748. Report unresolved symbol references from regular object files.
  749. This is done even if the linker is creating a non-symbolic
  750. shared library. This option is the inverse of '-z undefs'.
  751. 'dynamic-undefined-weak'
  752. 'nodynamic-undefined-weak'
  753. Make undefined weak symbols dynamic when building a dynamic
  754. object, if they are referenced from a regular object file and
  755. not forced local by symbol visibility or versioning. Do not
  756. make them dynamic if 'nodynamic-undefined-weak'. If neither
  757. option is given, a target may default to either option being
  758. in force, or make some other selection of undefined weak
  759. symbols dynamic. Not all targets support these options.
  760. 'execstack'
  761. Marks the object as requiring executable stack.
  762. 'global'
  763. This option is only meaningful when building a shared object.
  764. It makes the symbols defined by this shared object available
  765. for symbol resolution of subsequently loaded libraries.
  766. 'globalaudit'
  767. This option is only meaningful when building a dynamic
  768. executable. This option marks the executable as requiring
  769. global auditing by setting the 'DF_1_GLOBAUDIT' bit in the
  770. 'DT_FLAGS_1' dynamic tag. Global auditing requires that any
  771. auditing library defined via the '--depaudit' or '-P'
  772. command-line options be run for all dynamic objects loaded by
  773. the application.
  774. 'ibtplt'
  775. Generate Intel Indirect Branch Tracking (IBT) enabled PLT
  776. entries. Supported for Linux/i386 and Linux/x86_64.
  777. 'ibt'
  778. Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property
  779. section to indicate compatibility with IBT. This also implies
  780. 'ibtplt'. Supported for Linux/i386 and Linux/x86_64.
  781. 'initfirst'
  782. This option is only meaningful when building a shared object.
  783. It marks the object so that its runtime initialization will
  784. occur before the runtime initialization of any other objects
  785. brought into the process at the same time. Similarly the
  786. runtime finalization of the object will occur after the
  787. runtime finalization of any other objects.
  788. 'interpose'
  789. Specify that the dynamic loader should modify its symbol
  790. search order so that symbols in this shared library interpose
  791. all other shared libraries not so marked.
  792. 'lazy'
  793. When generating an executable or shared library, mark it to
  794. tell the dynamic linker to defer function call resolution to
  795. the point when the function is called (lazy binding), rather
  796. than at load time. Lazy binding is the default.
  797. 'loadfltr'
  798. Specify that the object's filters be processed immediately at
  799. runtime.
  800. 'max-page-size=VALUE'
  801. Set the maximum memory page size supported to VALUE.
  802. 'muldefs'
  803. Allow multiple definitions.
  804. 'nocopyreloc'
  805. Disable linker generated .dynbss variables used in place of
  806. variables defined in shared libraries. May result in dynamic
  807. text relocations.
  808. 'nodefaultlib'
  809. Specify that the dynamic loader search for dependencies of
  810. this object should ignore any default library search paths.
  811. 'nodelete'
  812. Specify that the object shouldn't be unloaded at runtime.
  813. 'nodlopen'
  814. Specify that the object is not available to 'dlopen'.
  815. 'nodump'
  816. Specify that the object can not be dumped by 'dldump'.
  817. 'noexecstack'
  818. Marks the object as not requiring executable stack.
  819. 'noextern-protected-data'
  820. Don't treat protected data symbols as external when building a
  821. shared library. This option overrides the linker backend
  822. default. It can be used to work around incorrect relocations
  823. against protected data symbols generated by compiler. Updates
  824. on protected data symbols by another module aren't visible to
  825. the resulting shared library. Supported for i386 and x86-64.
  826. 'noreloc-overflow'
  827. Disable relocation overflow check. This can be used to
  828. disable relocation overflow check if there will be no dynamic
  829. relocation overflow at run-time. Supported for x86_64.
  830. 'now'
  831. When generating an executable or shared library, mark it to
  832. tell the dynamic linker to resolve all symbols when the
  833. program is started, or when the shared library is loaded by
  834. dlopen, instead of deferring function call resolution to the
  835. point when the function is first called.
  836. 'origin'
  837. Specify that the object requires '$ORIGIN' handling in paths.
  838. 'relro'
  839. 'norelro'
  840. Create an ELF 'PT_GNU_RELRO' segment header in the object.
  841. This specifies a memory segment that should be made read-only
  842. after relocation, if supported. Specifying 'common-page-size'
  843. smaller than the system page size will render this protection
  844. ineffective. Don't create an ELF 'PT_GNU_RELRO' segment if
  845. 'norelro'.
  846. 'separate-code'
  847. 'noseparate-code'
  848. Create separate code 'PT_LOAD' segment header in the object.
  849. This specifies a memory segment that should contain only
  850. instructions and must be in wholly disjoint pages from any
  851. other data. Don't create separate code 'PT_LOAD' segment if
  852. 'noseparate-code' is used.
  853. 'shstk'
  854. Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in
  855. .note.gnu.property section to indicate compatibility with
  856. Intel Shadow Stack. Supported for Linux/i386 and
  857. Linux/x86_64.
  858. 'stack-size=VALUE'
  859. Specify a stack size for an ELF 'PT_GNU_STACK' segment.
  860. Specifying zero will override any default non-zero sized
  861. 'PT_GNU_STACK' segment creation.
  862. 'start-stop-visibility=VALUE'
  863. Specify the ELF symbol visibility for synthesized
  864. '__start_SECNAME' and '__stop_SECNAME' symbols (*note Input
  865. Section Example::). VALUE must be exactly 'default',
  866. 'internal', 'hidden', or 'protected'. If no '-z
  867. start-stop-visibility' option is given, 'protected' is used
  868. for compatibility with historical practice. However, it's
  869. highly recommended to use '-z start-stop-visibility=hidden' in
  870. new programs and shared libraries so that these symbols are
  871. not exported between shared objects, which is not usually
  872. what's intended.
  873. 'text'
  874. 'notext'
  875. 'textoff'
  876. Report an error if DT_TEXTREL is set, i.e., if the
  877. position-independent or shared object has dynamic relocations
  878. in read-only sections. Don't report an error if 'notext' or
  879. 'textoff'.
  880. 'undefs'
  881. Do not report unresolved symbol references from regular object
  882. files, either when creating an executable, or when creating a
  883. shared library. This option is the inverse of '-z defs'.
  884. Other keywords are ignored for Solaris compatibility.
  885. '-( ARCHIVES -)'
  886. '--start-group ARCHIVES --end-group'
  887. The ARCHIVES should be a list of archive files. They may be either
  888. explicit file names, or '-l' options.
  889. The specified archives are searched repeatedly until no new
  890. undefined references are created. Normally, an archive is searched
  891. only once in the order that it is specified on the command line.
  892. If a symbol in that archive is needed to resolve an undefined
  893. symbol referred to by an object in an archive that appears later on
  894. the command line, the linker would not be able to resolve that
  895. reference. By grouping the archives, they will all be searched
  896. repeatedly until all possible references are resolved.
  897. Using this option has a significant performance cost. It is best
  898. to use it only when there are unavoidable circular references
  899. between two or more archives.
  900. '--accept-unknown-input-arch'
  901. '--no-accept-unknown-input-arch'
  902. Tells the linker to accept input files whose architecture cannot be
  903. recognised. The assumption is that the user knows what they are
  904. doing and deliberately wants to link in these unknown input files.
  905. This was the default behaviour of the linker, before release 2.14.
  906. The default behaviour from release 2.14 onwards is to reject such
  907. input files, and so the '--accept-unknown-input-arch' option has
  908. been added to restore the old behaviour.
  909. '--as-needed'
  910. '--no-as-needed'
  911. This option affects ELF DT_NEEDED tags for dynamic libraries
  912. mentioned on the command line after the '--as-needed' option.
  913. Normally the linker will add a DT_NEEDED tag for each dynamic
  914. library mentioned on the command line, regardless of whether the
  915. library is actually needed or not. '--as-needed' causes a
  916. DT_NEEDED tag to only be emitted for a library that _at that point
  917. in the link_ satisfies a non-weak undefined symbol reference from a
  918. regular object file or, if the library is not found in the
  919. DT_NEEDED lists of other needed libraries, a non-weak undefined
  920. symbol reference from another needed dynamic library. Object files
  921. or libraries appearing on the command line _after_ the library in
  922. question do not affect whether the library is seen as needed. This
  923. is similar to the rules for extraction of object files from
  924. archives. '--no-as-needed' restores the default behaviour.
  925. '--add-needed'
  926. '--no-add-needed'
  927. These two options have been deprecated because of the similarity of
  928. their names to the '--as-needed' and '--no-as-needed' options.
  929. They have been replaced by '--copy-dt-needed-entries' and
  930. '--no-copy-dt-needed-entries'.
  931. '-assert KEYWORD'
  932. This option is ignored for SunOS compatibility.
  933. '-Bdynamic'
  934. '-dy'
  935. '-call_shared'
  936. Link against dynamic libraries. This is only meaningful on
  937. platforms for which shared libraries are supported. This option is
  938. normally the default on such platforms. The different variants of
  939. this option are for compatibility with various systems. You may
  940. use this option multiple times on the command line: it affects
  941. library searching for '-l' options which follow it.
  942. '-Bgroup'
  943. Set the 'DF_1_GROUP' flag in the 'DT_FLAGS_1' entry in the dynamic
  944. section. This causes the runtime linker to handle lookups in this
  945. object and its dependencies to be performed only inside the group.
  946. '--unresolved-symbols=report-all' is implied. This option is only
  947. meaningful on ELF platforms which support shared libraries.
  948. '-Bstatic'
  949. '-dn'
  950. '-non_shared'
  951. '-static'
  952. Do not link against shared libraries. This is only meaningful on
  953. platforms for which shared libraries are supported. The different
  954. variants of this option are for compatibility with various systems.
  955. You may use this option multiple times on the command line: it
  956. affects library searching for '-l' options which follow it. This
  957. option also implies '--unresolved-symbols=report-all'. This option
  958. can be used with '-shared'. Doing so means that a shared library
  959. is being created but that all of the library's external references
  960. must be resolved by pulling in entries from static libraries.
  961. '-Bsymbolic'
  962. When creating a shared library, bind references to global symbols
  963. to the definition within the shared library, if any. Normally, it
  964. is possible for a program linked against a shared library to
  965. override the definition within the shared library. This option is
  966. only meaningful on ELF platforms which support shared libraries.
  967. '-Bsymbolic-functions'
  968. When creating a shared library, bind references to global function
  969. symbols to the definition within the shared library, if any. This
  970. option is only meaningful on ELF platforms which support shared
  971. libraries.
  972. '--dynamic-list=DYNAMIC-LIST-FILE'
  973. Specify the name of a dynamic list file to the linker. This is
  974. typically used when creating shared libraries to specify a list of
  975. global symbols whose references shouldn't be bound to the
  976. definition within the shared library, or creating dynamically
  977. linked executables to specify a list of symbols which should be
  978. added to the symbol table in the executable. This option is only
  979. meaningful on ELF platforms which support shared libraries.
  980. The format of the dynamic list is the same as the version node
  981. without scope and node name. See *note VERSION:: for more
  982. information.
  983. '--dynamic-list-data'
  984. Include all global data symbols to the dynamic list.
  985. '--dynamic-list-cpp-new'
  986. Provide the builtin dynamic list for C++ operator new and delete.
  987. It is mainly useful for building shared libstdc++.
  988. '--dynamic-list-cpp-typeinfo'
  989. Provide the builtin dynamic list for C++ runtime type
  990. identification.
  991. '--check-sections'
  992. '--no-check-sections'
  993. Asks the linker _not_ to check section addresses after they have
  994. been assigned to see if there are any overlaps. Normally the
  995. linker will perform this check, and if it finds any overlaps it
  996. will produce suitable error messages. The linker does know about,
  997. and does make allowances for sections in overlays. The default
  998. behaviour can be restored by using the command-line switch
  999. '--check-sections'. Section overlap is not usually checked for
  1000. relocatable links. You can force checking in that case by using
  1001. the '--check-sections' option.
  1002. '--copy-dt-needed-entries'
  1003. '--no-copy-dt-needed-entries'
  1004. This option affects the treatment of dynamic libraries referred to
  1005. by DT_NEEDED tags _inside_ ELF dynamic libraries mentioned on the
  1006. command line. Normally the linker won't add a DT_NEEDED tag to the
  1007. output binary for each library mentioned in a DT_NEEDED tag in an
  1008. input dynamic library. With '--copy-dt-needed-entries' specified
  1009. on the command line however any dynamic libraries that follow it
  1010. will have their DT_NEEDED entries added. The default behaviour can
  1011. be restored with '--no-copy-dt-needed-entries'.
  1012. This option also has an effect on the resolution of symbols in
  1013. dynamic libraries. With '--copy-dt-needed-entries' dynamic
  1014. libraries mentioned on the command line will be recursively
  1015. searched, following their DT_NEEDED tags to other libraries, in
  1016. order to resolve symbols required by the output binary. With the
  1017. default setting however the searching of dynamic libraries that
  1018. follow it will stop with the dynamic library itself. No DT_NEEDED
  1019. links will be traversed to resolve symbols.
  1020. '--cref'
  1021. Output a cross reference table. If a linker map file is being
  1022. generated, the cross reference table is printed to the map file.
  1023. Otherwise, it is printed on the standard output.
  1024. The format of the table is intentionally simple, so that it may be
  1025. easily processed by a script if necessary. The symbols are printed
  1026. out, sorted by name. For each symbol, a list of file names is
  1027. given. If the symbol is defined, the first file listed is the
  1028. location of the definition. If the symbol is defined as a common
  1029. value then any files where this happens appear next. Finally any
  1030. files that reference the symbol are listed.
  1031. '--no-define-common'
  1032. This option inhibits the assignment of addresses to common symbols.
  1033. The script command 'INHIBIT_COMMON_ALLOCATION' has the same effect.
  1034. *Note Miscellaneous Commands::.
  1035. The '--no-define-common' option allows decoupling the decision to
  1036. assign addresses to Common symbols from the choice of the output
  1037. file type; otherwise a non-Relocatable output type forces assigning
  1038. addresses to Common symbols. Using '--no-define-common' allows
  1039. Common symbols that are referenced from a shared library to be
  1040. assigned addresses only in the main program. This eliminates the
  1041. unused duplicate space in the shared library, and also prevents any
  1042. possible confusion over resolving to the wrong duplicate when there
  1043. are many dynamic modules with specialized search paths for runtime
  1044. symbol resolution.
  1045. '--force-group-allocation'
  1046. This option causes the linker to place section group members like
  1047. normal input sections, and to delete the section groups. This is
  1048. the default behaviour for a final link but this option can be used
  1049. to change the behaviour of a relocatable link ('-r'). The script
  1050. command 'FORCE_GROUP_ALLOCATION' has the same effect. *Note
  1051. Miscellaneous Commands::.
  1052. '--defsym=SYMBOL=EXPRESSION'
  1053. Create a global symbol in the output file, containing the absolute
  1054. address given by EXPRESSION. You may use this option as many times
  1055. as necessary to define multiple symbols in the command line. A
  1056. limited form of arithmetic is supported for the EXPRESSION in this
  1057. context: you may give a hexadecimal constant or the name of an
  1058. existing symbol, or use '+' and '-' to add or subtract hexadecimal
  1059. constants or symbols. If you need more elaborate expressions,
  1060. consider using the linker command language from a script (*note
  1061. Assignments::). _Note:_ there should be no white space between
  1062. SYMBOL, the equals sign ("<=>"), and EXPRESSION.
  1063. '--demangle[=STYLE]'
  1064. '--no-demangle'
  1065. These options control whether to demangle symbol names in error
  1066. messages and other output. When the linker is told to demangle, it
  1067. tries to present symbol names in a readable fashion: it strips
  1068. leading underscores if they are used by the object file format, and
  1069. converts C++ mangled symbol names into user readable names.
  1070. Different compilers have different mangling styles. The optional
  1071. demangling style argument can be used to choose an appropriate
  1072. demangling style for your compiler. The linker will demangle by
  1073. default unless the environment variable 'COLLECT_NO_DEMANGLE' is
  1074. set. These options may be used to override the default.
  1075. '-IFILE'
  1076. '--dynamic-linker=FILE'
  1077. Set the name of the dynamic linker. This is only meaningful when
  1078. generating dynamically linked ELF executables. The default dynamic
  1079. linker is normally correct; don't use this unless you know what you
  1080. are doing.
  1081. '--no-dynamic-linker'
  1082. When producing an executable file, omit the request for a dynamic
  1083. linker to be used at load-time. This is only meaningful for ELF
  1084. executables that contain dynamic relocations, and usually requires
  1085. entry point code that is capable of processing these relocations.
  1086. '--embedded-relocs'
  1087. This option is similar to the '--emit-relocs' option except that
  1088. the relocs are stored in a target-specific section. This option is
  1089. only supported by the 'BFIN', 'CR16' and _M68K_ targets.
  1090. '--disable-multiple-abs-defs'
  1091. Do not allow multiple definitions with symbols included in filename
  1092. invoked by -R or -just-symbols
  1093. '--fatal-warnings'
  1094. '--no-fatal-warnings'
  1095. Treat all warnings as errors. The default behaviour can be
  1096. restored with the option '--no-fatal-warnings'.
  1097. '--force-exe-suffix'
  1098. Make sure that an output file has a .exe suffix.
  1099. If a successfully built fully linked output file does not have a
  1100. '.exe' or '.dll' suffix, this option forces the linker to copy the
  1101. output file to one of the same name with a '.exe' suffix. This
  1102. option is useful when using unmodified Unix makefiles on a
  1103. Microsoft Windows host, since some versions of Windows won't run an
  1104. image unless it ends in a '.exe' suffix.
  1105. '--gc-sections'
  1106. '--no-gc-sections'
  1107. Enable garbage collection of unused input sections. It is ignored
  1108. on targets that do not support this option. The default behaviour
  1109. (of not performing this garbage collection) can be restored by
  1110. specifying '--no-gc-sections' on the command line. Note that
  1111. garbage collection for COFF and PE format targets is supported, but
  1112. the implementation is currently considered to be experimental.
  1113. '--gc-sections' decides which input sections are used by examining
  1114. symbols and relocations. The section containing the entry symbol
  1115. and all sections containing symbols undefined on the command-line
  1116. will be kept, as will sections containing symbols referenced by
  1117. dynamic objects. Note that when building shared libraries, the
  1118. linker must assume that any visible symbol is referenced. Once
  1119. this initial set of sections has been determined, the linker
  1120. recursively marks as used any section referenced by their
  1121. relocations. See '--entry', '--undefined', and
  1122. '--gc-keep-exported'.
  1123. This option can be set when doing a partial link (enabled with
  1124. option '-r'). In this case the root of symbols kept must be
  1125. explicitly specified either by one of the options '--entry',
  1126. '--undefined', or '--gc-keep-exported' or by a 'ENTRY' command in
  1127. the linker script.
  1128. '--print-gc-sections'
  1129. '--no-print-gc-sections'
  1130. List all sections removed by garbage collection. The listing is
  1131. printed on stderr. This option is only effective if garbage
  1132. collection has been enabled via the '--gc-sections') option. The
  1133. default behaviour (of not listing the sections that are removed)
  1134. can be restored by specifying '--no-print-gc-sections' on the
  1135. command line.
  1136. '--gc-keep-exported'
  1137. When '--gc-sections' is enabled, this option prevents garbage
  1138. collection of unused input sections that contain global symbols
  1139. having default or protected visibility. This option is intended to
  1140. be used for executables where unreferenced sections would otherwise
  1141. be garbage collected regardless of the external visibility of
  1142. contained symbols. Note that this option has no effect when
  1143. linking shared objects since it is already the default behaviour.
  1144. This option is only supported for ELF format targets.
  1145. '--print-output-format'
  1146. Print the name of the default output format (perhaps influenced by
  1147. other command-line options). This is the string that would appear
  1148. in an 'OUTPUT_FORMAT' linker script command (*note File
  1149. Commands::).
  1150. '--print-memory-usage'
  1151. Print used size, total size and used size of memory regions created
  1152. with the *note MEMORY:: command. This is useful on embedded
  1153. targets to have a quick view of amount of free memory. The format
  1154. of the output has one headline and one line per region. It is both
  1155. human readable and easily parsable by tools. Here is an example of
  1156. an output:
  1157. Memory region Used Size Region Size %age Used
  1158. ROM: 256 KB 1 MB 25.00%
  1159. RAM: 32 B 2 GB 0.00%
  1160. '--help'
  1161. Print a summary of the command-line options on the standard output
  1162. and exit.
  1163. '--target-help'
  1164. Print a summary of all target-specific options on the standard
  1165. output and exit.
  1166. '-Map=MAPFILE'
  1167. Print a link map to the file MAPFILE. See the description of the
  1168. '-M' option, above. Specifying a directory as MAPFILE causes the
  1169. linker map to be written into a file inside the directory. The
  1170. name of the file is based upon the OUTPUT filename with '.map'
  1171. appended.
  1172. '--no-keep-memory'
  1173. 'ld' normally optimizes for speed over memory usage by caching the
  1174. symbol tables of input files in memory. This option tells 'ld' to
  1175. instead optimize for memory usage, by rereading the symbol tables
  1176. as necessary. This may be required if 'ld' runs out of memory
  1177. space while linking a large executable.
  1178. '--no-undefined'
  1179. '-z defs'
  1180. Report unresolved symbol references from regular object files.
  1181. This is done even if the linker is creating a non-symbolic shared
  1182. library. The switch '--[no-]allow-shlib-undefined' controls the
  1183. behaviour for reporting unresolved references found in shared
  1184. libraries being linked in.
  1185. The effects of this option can be reverted by using '-z undefs'.
  1186. '--allow-multiple-definition'
  1187. '-z muldefs'
  1188. Normally when a symbol is defined multiple times, the linker will
  1189. report a fatal error. These options allow multiple definitions and
  1190. the first definition will be used.
  1191. '--allow-shlib-undefined'
  1192. '--no-allow-shlib-undefined'
  1193. Allows or disallows undefined symbols in shared libraries. This
  1194. switch is similar to '--no-undefined' except that it determines the
  1195. behaviour when the undefined symbols are in a shared library rather
  1196. than a regular object file. It does not affect how undefined
  1197. symbols in regular object files are handled.
  1198. The default behaviour is to report errors for any undefined symbols
  1199. referenced in shared libraries if the linker is being used to
  1200. create an executable, but to allow them if the linker is being used
  1201. to create a shared library.
  1202. The reasons for allowing undefined symbol references in shared
  1203. libraries specified at link time are that:
  1204. * A shared library specified at link time may not be the same as
  1205. the one that is available at load time, so the symbol might
  1206. actually be resolvable at load time.
  1207. * There are some operating systems, eg BeOS and HPPA, where
  1208. undefined symbols in shared libraries are normal.
  1209. The BeOS kernel for example patches shared libraries at load
  1210. time to select whichever function is most appropriate for the
  1211. current architecture. This is used, for example, to
  1212. dynamically select an appropriate memset function.
  1213. '--no-undefined-version'
  1214. Normally when a symbol has an undefined version, the linker will
  1215. ignore it. This option disallows symbols with undefined version
  1216. and a fatal error will be issued instead.
  1217. '--default-symver'
  1218. Create and use a default symbol version (the soname) for
  1219. unversioned exported symbols.
  1220. '--default-imported-symver'
  1221. Create and use a default symbol version (the soname) for
  1222. unversioned imported symbols.
  1223. '--no-warn-mismatch'
  1224. Normally 'ld' will give an error if you try to link together input
  1225. files that are mismatched for some reason, perhaps because they
  1226. have been compiled for different processors or for different
  1227. endiannesses. This option tells 'ld' that it should silently
  1228. permit such possible errors. This option should only be used with
  1229. care, in cases when you have taken some special action that ensures
  1230. that the linker errors are inappropriate.
  1231. '--no-warn-search-mismatch'
  1232. Normally 'ld' will give a warning if it finds an incompatible
  1233. library during a library search. This option silences the warning.
  1234. '--no-whole-archive'
  1235. Turn off the effect of the '--whole-archive' option for subsequent
  1236. archive files.
  1237. '--noinhibit-exec'
  1238. Retain the executable output file whenever it is still usable.
  1239. Normally, the linker will not produce an output file if it
  1240. encounters errors during the link process; it exits without writing
  1241. an output file when it issues any error whatsoever.
  1242. '-nostdlib'
  1243. Only search library directories explicitly specified on the command
  1244. line. Library directories specified in linker scripts (including
  1245. linker scripts specified on the command line) are ignored.
  1246. '--oformat=OUTPUT-FORMAT'
  1247. 'ld' may be configured to support more than one kind of object
  1248. file. If your 'ld' is configured this way, you can use the
  1249. '--oformat' option to specify the binary format for the output
  1250. object file. Even when 'ld' is configured to support alternative
  1251. object formats, you don't usually need to specify this, as 'ld'
  1252. should be configured to produce as a default output format the most
  1253. usual format on each machine. OUTPUT-FORMAT is a text string, the
  1254. name of a particular format supported by the BFD libraries. (You
  1255. can list the available binary formats with 'objdump -i'.) The
  1256. script command 'OUTPUT_FORMAT' can also specify the output format,
  1257. but this option overrides it. *Note BFD::.
  1258. '--out-implib FILE'
  1259. Create an import library in FILE corresponding to the executable
  1260. the linker is generating (eg. a DLL or ELF program). This import
  1261. library (which should be called '*.dll.a' or '*.a' for DLLs) may be
  1262. used to link clients against the generated executable; this
  1263. behaviour makes it possible to skip a separate import library
  1264. creation step (eg. 'dlltool' for DLLs). This option is only
  1265. available for the i386 PE and ELF targetted ports of the linker.
  1266. '-pie'
  1267. '--pic-executable'
  1268. Create a position independent executable. This is currently only
  1269. supported on ELF platforms. Position independent executables are
  1270. similar to shared libraries in that they are relocated by the
  1271. dynamic linker to the virtual address the OS chooses for them
  1272. (which can vary between invocations). Like normal dynamically
  1273. linked executables they can be executed and symbols defined in the
  1274. executable cannot be overridden by shared libraries.
  1275. '-qmagic'
  1276. This option is ignored for Linux compatibility.
  1277. '-Qy'
  1278. This option is ignored for SVR4 compatibility.
  1279. '--relax'
  1280. '--no-relax'
  1281. An option with machine dependent effects. This option is only
  1282. supported on a few targets. *Note 'ld' and the H8/300: H8/300.
  1283. *Note 'ld' and Xtensa Processors: Xtensa. *Note 'ld' and the
  1284. 68HC11 and 68HC12: M68HC11/68HC12. *Note 'ld' and the Altera Nios
  1285. II: Nios II. *Note 'ld' and PowerPC 32-bit ELF Support: PowerPC
  1286. ELF32.
  1287. On some platforms the '--relax' option performs target-specific,
  1288. global optimizations that become possible when the linker resolves
  1289. addressing in the program, such as relaxing address modes,
  1290. synthesizing new instructions, selecting shorter version of current
  1291. instructions, and combining constant values.
  1292. On some platforms these link time global optimizations may make
  1293. symbolic debugging of the resulting executable impossible. This is
  1294. known to be the case for the Matsushita MN10200 and MN10300 family
  1295. of processors.
  1296. On platforms where this is not supported, '--relax' is accepted,
  1297. but ignored.
  1298. On platforms where '--relax' is accepted the option '--no-relax'
  1299. can be used to disable the feature.
  1300. '--retain-symbols-file=FILENAME'
  1301. Retain _only_ the symbols listed in the file FILENAME, discarding
  1302. all others. FILENAME is simply a flat file, with one symbol name
  1303. per line. This option is especially useful in environments (such
  1304. as VxWorks) where a large global symbol table is accumulated
  1305. gradually, to conserve run-time memory.
  1306. '--retain-symbols-file' does _not_ discard undefined symbols, or
  1307. symbols needed for relocations.
  1308. You may only specify '--retain-symbols-file' once in the command
  1309. line. It overrides '-s' and '-S'.
  1310. '-rpath=DIR'
  1311. Add a directory to the runtime library search path. This is used
  1312. when linking an ELF executable with shared objects. All '-rpath'
  1313. arguments are concatenated and passed to the runtime linker, which
  1314. uses them to locate shared objects at runtime.
  1315. The '-rpath' option is also used when locating shared objects which
  1316. are needed by shared objects explicitly included in the link; see
  1317. the description of the '-rpath-link' option. Searching '-rpath' in
  1318. this way is only supported by native linkers and cross linkers
  1319. which have been configured with the '--with-sysroot' option.
  1320. If '-rpath' is not used when linking an ELF executable, the
  1321. contents of the environment variable 'LD_RUN_PATH' will be used if
  1322. it is defined.
  1323. The '-rpath' option may also be used on SunOS. By default, on
  1324. SunOS, the linker will form a runtime search path out of all the
  1325. '-L' options it is given. If a '-rpath' option is used, the
  1326. runtime search path will be formed exclusively using the '-rpath'
  1327. options, ignoring the '-L' options. This can be useful when using
  1328. gcc, which adds many '-L' options which may be on NFS mounted file
  1329. systems.
  1330. For compatibility with other ELF linkers, if the '-R' option is
  1331. followed by a directory name, rather than a file name, it is
  1332. treated as the '-rpath' option.
  1333. '-rpath-link=DIR'
  1334. When using ELF or SunOS, one shared library may require another.
  1335. This happens when an 'ld -shared' link includes a shared library as
  1336. one of the input files.
  1337. When the linker encounters such a dependency when doing a
  1338. non-shared, non-relocatable link, it will automatically try to
  1339. locate the required shared library and include it in the link, if
  1340. it is not included explicitly. In such a case, the '-rpath-link'
  1341. option specifies the first set of directories to search. The
  1342. '-rpath-link' option may specify a sequence of directory names
  1343. either by specifying a list of names separated by colons, or by
  1344. appearing multiple times.
  1345. The tokens $ORIGIN and $LIB can appear in these search directories.
  1346. They will be replaced by the full path to the directory containing
  1347. the program or shared object in the case of $ORIGIN and either
  1348. 'lib' - for 32-bit binaries - or 'lib64' - for 64-bit binaries - in
  1349. the case of $LIB.
  1350. The alternative form of these tokens - ${ORIGIN} and ${LIB} can
  1351. also be used. The token $PLATFORM is not supported.
  1352. This option should be used with caution as it overrides the search
  1353. path that may have been hard compiled into a shared library. In
  1354. such a case it is possible to use unintentionally a different
  1355. search path than the runtime linker would do.
  1356. The linker uses the following search paths to locate required
  1357. shared libraries:
  1358. 1. Any directories specified by '-rpath-link' options.
  1359. 2. Any directories specified by '-rpath' options. The difference
  1360. between '-rpath' and '-rpath-link' is that directories
  1361. specified by '-rpath' options are included in the executable
  1362. and used at runtime, whereas the '-rpath-link' option is only
  1363. effective at link time. Searching '-rpath' in this way is
  1364. only supported by native linkers and cross linkers which have
  1365. been configured with the '--with-sysroot' option.
  1366. 3. On an ELF system, for native linkers, if the '-rpath' and
  1367. '-rpath-link' options were not used, search the contents of
  1368. the environment variable 'LD_RUN_PATH'.
  1369. 4. On SunOS, if the '-rpath' option was not used, search any
  1370. directories specified using '-L' options.
  1371. 5. For a native linker, search the contents of the environment
  1372. variable 'LD_LIBRARY_PATH'.
  1373. 6. For a native ELF linker, the directories in 'DT_RUNPATH' or
  1374. 'DT_RPATH' of a shared library are searched for shared
  1375. libraries needed by it. The 'DT_RPATH' entries are ignored if
  1376. 'DT_RUNPATH' entries exist.
  1377. 7. The default directories, normally '/lib' and '/usr/lib'.
  1378. 8. For a linker for a Linux system, if the file '/etc/ld.so.conf'
  1379. exists, the list of directories found in that file. Note: the
  1380. path to this file is prefixed with the 'sysroot' value, if
  1381. that is defined, and then any 'prefix' string if the linker
  1382. was configured with the '--prefix=<path>' option.
  1383. 9. For a native linker on a FreeBSD system, any directories
  1384. specified by the '_PATH_ELF_HINTS' macro defined in the
  1385. 'elf-hints.h' header file.
  1386. 10. Any directories specifed by a 'SEARCH_DIR' command in the
  1387. linker script being used.
  1388. If the required shared library is not found, the linker will issue
  1389. a warning and continue with the link.
  1390. '-shared'
  1391. '-Bshareable'
  1392. Create a shared library. This is currently only supported on ELF,
  1393. XCOFF and SunOS platforms. On SunOS, the linker will automatically
  1394. create a shared library if the '-e' option is not used and there
  1395. are undefined symbols in the link.
  1396. '--sort-common'
  1397. '--sort-common=ascending'
  1398. '--sort-common=descending'
  1399. This option tells 'ld' to sort the common symbols by alignment in
  1400. ascending or descending order when it places them in the
  1401. appropriate output sections. The symbol alignments considered are
  1402. sixteen-byte or larger, eight-byte, four-byte, two-byte, and
  1403. one-byte. This is to prevent gaps between symbols due to alignment
  1404. constraints. If no sorting order is specified, then descending
  1405. order is assumed.
  1406. '--sort-section=name'
  1407. This option will apply 'SORT_BY_NAME' to all wildcard section
  1408. patterns in the linker script.
  1409. '--sort-section=alignment'
  1410. This option will apply 'SORT_BY_ALIGNMENT' to all wildcard section
  1411. patterns in the linker script.
  1412. '--spare-dynamic-tags=COUNT'
  1413. This option specifies the number of empty slots to leave in the
  1414. .dynamic section of ELF shared objects. Empty slots may be needed
  1415. by post processing tools, such as the prelinker. The default is 5.
  1416. '--split-by-file[=SIZE]'
  1417. Similar to '--split-by-reloc' but creates a new output section for
  1418. each input file when SIZE is reached. SIZE defaults to a size of 1
  1419. if not given.
  1420. '--split-by-reloc[=COUNT]'
  1421. Tries to creates extra sections in the output file so that no
  1422. single output section in the file contains more than COUNT
  1423. relocations. This is useful when generating huge relocatable files
  1424. for downloading into certain real time kernels with the COFF object
  1425. file format; since COFF cannot represent more than 65535
  1426. relocations in a single section. Note that this will fail to work
  1427. with object file formats which do not support arbitrary sections.
  1428. The linker will not split up individual input sections for
  1429. redistribution, so if a single input section contains more than
  1430. COUNT relocations one output section will contain that many
  1431. relocations. COUNT defaults to a value of 32768.
  1432. '--stats'
  1433. Compute and display statistics about the operation of the linker,
  1434. such as execution time and memory usage.
  1435. '--sysroot=DIRECTORY'
  1436. Use DIRECTORY as the location of the sysroot, overriding the
  1437. configure-time default. This option is only supported by linkers
  1438. that were configured using '--with-sysroot'.
  1439. '--task-link'
  1440. This is used by COFF/PE based targets to create a task-linked
  1441. object file where all of the global symbols have been converted to
  1442. statics.
  1443. '--traditional-format'
  1444. For some targets, the output of 'ld' is different in some ways from
  1445. the output of some existing linker. This switch requests 'ld' to
  1446. use the traditional format instead.
  1447. For example, on SunOS, 'ld' combines duplicate entries in the
  1448. symbol string table. This can reduce the size of an output file
  1449. with full debugging information by over 30 percent. Unfortunately,
  1450. the SunOS 'dbx' program can not read the resulting program ('gdb'
  1451. has no trouble). The '--traditional-format' switch tells 'ld' to
  1452. not combine duplicate entries.
  1453. '--section-start=SECTIONNAME=ORG'
  1454. Locate a section in the output file at the absolute address given
  1455. by ORG. You may use this option as many times as necessary to
  1456. locate multiple sections in the command line. ORG must be a single
  1457. hexadecimal integer; for compatibility with other linkers, you may
  1458. omit the leading '0x' usually associated with hexadecimal values.
  1459. _Note:_ there should be no white space between SECTIONNAME, the
  1460. equals sign ("<=>"), and ORG.
  1461. '-Tbss=ORG'
  1462. '-Tdata=ORG'
  1463. '-Ttext=ORG'
  1464. Same as '--section-start', with '.bss', '.data' or '.text' as the
  1465. SECTIONNAME.
  1466. '-Ttext-segment=ORG'
  1467. When creating an ELF executable, it will set the address of the
  1468. first byte of the text segment.
  1469. '-Trodata-segment=ORG'
  1470. When creating an ELF executable or shared object for a target where
  1471. the read-only data is in its own segment separate from the
  1472. executable text, it will set the address of the first byte of the
  1473. read-only data segment.
  1474. '-Tldata-segment=ORG'
  1475. When creating an ELF executable or shared object for x86-64 medium
  1476. memory model, it will set the address of the first byte of the
  1477. ldata segment.
  1478. '--unresolved-symbols=METHOD'
  1479. Determine how to handle unresolved symbols. There are four
  1480. possible values for 'method':
  1481. 'ignore-all'
  1482. Do not report any unresolved symbols.
  1483. 'report-all'
  1484. Report all unresolved symbols. This is the default.
  1485. 'ignore-in-object-files'
  1486. Report unresolved symbols that are contained in shared
  1487. libraries, but ignore them if they come from regular object
  1488. files.
  1489. 'ignore-in-shared-libs'
  1490. Report unresolved symbols that come from regular object files,
  1491. but ignore them if they come from shared libraries. This can
  1492. be useful when creating a dynamic binary and it is known that
  1493. all the shared libraries that it should be referencing are
  1494. included on the linker's command line.
  1495. The behaviour for shared libraries on their own can also be
  1496. controlled by the '--[no-]allow-shlib-undefined' option.
  1497. Normally the linker will generate an error message for each
  1498. reported unresolved symbol but the option
  1499. '--warn-unresolved-symbols' can change this to a warning.
  1500. '--dll-verbose'
  1501. '--verbose[=NUMBER]'
  1502. Display the version number for 'ld' and list the linker emulations
  1503. supported. Display which input files can and cannot be opened.
  1504. Display the linker script being used by the linker. If the
  1505. optional NUMBER argument > 1, plugin symbol status will also be
  1506. displayed.
  1507. '--version-script=VERSION-SCRIPTFILE'
  1508. Specify the name of a version script to the linker. This is
  1509. typically used when creating shared libraries to specify additional
  1510. information about the version hierarchy for the library being
  1511. created. This option is only fully supported on ELF platforms
  1512. which support shared libraries; see *note VERSION::. It is
  1513. partially supported on PE platforms, which can use version scripts
  1514. to filter symbol visibility in auto-export mode: any symbols marked
  1515. 'local' in the version script will not be exported. *Note WIN32::.
  1516. '--warn-common'
  1517. Warn when a common symbol is combined with another common symbol or
  1518. with a symbol definition. Unix linkers allow this somewhat sloppy
  1519. practice, but linkers on some other operating systems do not. This
  1520. option allows you to find potential problems from combining global
  1521. symbols. Unfortunately, some C libraries use this practice, so you
  1522. may get some warnings about symbols in the libraries as well as in
  1523. your programs.
  1524. There are three kinds of global symbols, illustrated here by C
  1525. examples:
  1526. 'int i = 1;'
  1527. A definition, which goes in the initialized data section of
  1528. the output file.
  1529. 'extern int i;'
  1530. An undefined reference, which does not allocate space. There
  1531. must be either a definition or a common symbol for the
  1532. variable somewhere.
  1533. 'int i;'
  1534. A common symbol. If there are only (one or more) common
  1535. symbols for a variable, it goes in the uninitialized data area
  1536. of the output file. The linker merges multiple common symbols
  1537. for the same variable into a single symbol. If they are of
  1538. different sizes, it picks the largest size. The linker turns
  1539. a common symbol into a declaration, if there is a definition
  1540. of the same variable.
  1541. The '--warn-common' option can produce five kinds of warnings.
  1542. Each warning consists of a pair of lines: the first describes the
  1543. symbol just encountered, and the second describes the previous
  1544. symbol encountered with the same name. One or both of the two
  1545. symbols will be a common symbol.
  1546. 1. Turning a common symbol into a reference, because there is
  1547. already a definition for the symbol.
  1548. FILE(SECTION): warning: common of `SYMBOL'
  1549. overridden by definition
  1550. FILE(SECTION): warning: defined here
  1551. 2. Turning a common symbol into a reference, because a later
  1552. definition for the symbol is encountered. This is the same as
  1553. the previous case, except that the symbols are encountered in
  1554. a different order.
  1555. FILE(SECTION): warning: definition of `SYMBOL'
  1556. overriding common
  1557. FILE(SECTION): warning: common is here
  1558. 3. Merging a common symbol with a previous same-sized common
  1559. symbol.
  1560. FILE(SECTION): warning: multiple common
  1561. of `SYMBOL'
  1562. FILE(SECTION): warning: previous common is here
  1563. 4. Merging a common symbol with a previous larger common symbol.
  1564. FILE(SECTION): warning: common of `SYMBOL'
  1565. overridden by larger common
  1566. FILE(SECTION): warning: larger common is here
  1567. 5. Merging a common symbol with a previous smaller common symbol.
  1568. This is the same as the previous case, except that the symbols
  1569. are encountered in a different order.
  1570. FILE(SECTION): warning: common of `SYMBOL'
  1571. overriding smaller common
  1572. FILE(SECTION): warning: smaller common is here
  1573. '--warn-constructors'
  1574. Warn if any global constructors are used. This is only useful for
  1575. a few object file formats. For formats like COFF or ELF, the
  1576. linker can not detect the use of global constructors.
  1577. '--warn-multiple-gp'
  1578. Warn if multiple global pointer values are required in the output
  1579. file. This is only meaningful for certain processors, such as the
  1580. Alpha. Specifically, some processors put large-valued constants in
  1581. a special section. A special register (the global pointer) points
  1582. into the middle of this section, so that constants can be loaded
  1583. efficiently via a base-register relative addressing mode. Since
  1584. the offset in base-register relative mode is fixed and relatively
  1585. small (e.g., 16 bits), this limits the maximum size of the constant
  1586. pool. Thus, in large programs, it is often necessary to use
  1587. multiple global pointer values in order to be able to address all
  1588. possible constants. This option causes a warning to be issued
  1589. whenever this case occurs.
  1590. '--warn-once'
  1591. Only warn once for each undefined symbol, rather than once per
  1592. module which refers to it.
  1593. '--warn-section-align'
  1594. Warn if the address of an output section is changed because of
  1595. alignment. Typically, the alignment will be set by an input
  1596. section. The address will only be changed if it not explicitly
  1597. specified; that is, if the 'SECTIONS' command does not specify a
  1598. start address for the section (*note SECTIONS::).
  1599. '--warn-textrel'
  1600. Warn if the linker adds DT_TEXTREL to a position-independent
  1601. executable or shared object.
  1602. '--warn-alternate-em'
  1603. Warn if an object has alternate ELF machine code.
  1604. '--warn-unresolved-symbols'
  1605. If the linker is going to report an unresolved symbol (see the
  1606. option '--unresolved-symbols') it will normally generate an error.
  1607. This option makes it generate a warning instead.
  1608. '--error-unresolved-symbols'
  1609. This restores the linker's default behaviour of generating errors
  1610. when it is reporting unresolved symbols.
  1611. '--whole-archive'
  1612. For each archive mentioned on the command line after the
  1613. '--whole-archive' option, include every object file in the archive
  1614. in the link, rather than searching the archive for the required
  1615. object files. This is normally used to turn an archive file into a
  1616. shared library, forcing every object to be included in the
  1617. resulting shared library. This option may be used more than once.
  1618. Two notes when using this option from gcc: First, gcc doesn't know
  1619. about this option, so you have to use '-Wl,-whole-archive'.
  1620. Second, don't forget to use '-Wl,-no-whole-archive' after your list
  1621. of archives, because gcc will add its own list of archives to your
  1622. link and you may not want this flag to affect those as well.
  1623. '--wrap=SYMBOL'
  1624. Use a wrapper function for SYMBOL. Any undefined reference to
  1625. SYMBOL will be resolved to '__wrap_SYMBOL'. Any undefined
  1626. reference to '__real_SYMBOL' will be resolved to SYMBOL.
  1627. This can be used to provide a wrapper for a system function. The
  1628. wrapper function should be called '__wrap_SYMBOL'. If it wishes to
  1629. call the system function, it should call '__real_SYMBOL'.
  1630. Here is a trivial example:
  1631. void *
  1632. __wrap_malloc (size_t c)
  1633. {
  1634. printf ("malloc called with %zu\n", c);
  1635. return __real_malloc (c);
  1636. }
  1637. If you link other code with this file using '--wrap malloc', then
  1638. all calls to 'malloc' will call the function '__wrap_malloc'
  1639. instead. The call to '__real_malloc' in '__wrap_malloc' will call
  1640. the real 'malloc' function.
  1641. You may wish to provide a '__real_malloc' function as well, so that
  1642. links without the '--wrap' option will succeed. If you do this,
  1643. you should not put the definition of '__real_malloc' in the same
  1644. file as '__wrap_malloc'; if you do, the assembler may resolve the
  1645. call before the linker has a chance to wrap it to 'malloc'.
  1646. Only undefined references are replaced by the linker. So,
  1647. translation unit internal references to SYMBOL are not resolved to
  1648. '__wrap_SYMBOL'. In the next example, the call to 'f' in 'g' is
  1649. not resolved to '__wrap_f'.
  1650. int
  1651. f (void)
  1652. {
  1653. return 123;
  1654. }
  1655. int
  1656. g (void)
  1657. {
  1658. return f();
  1659. }
  1660. '--eh-frame-hdr'
  1661. '--no-eh-frame-hdr'
  1662. Request ('--eh-frame-hdr') or suppress ('--no-eh-frame-hdr') the
  1663. creation of '.eh_frame_hdr' section and ELF 'PT_GNU_EH_FRAME'
  1664. segment header.
  1665. '--no-ld-generated-unwind-info'
  1666. Request creation of '.eh_frame' unwind info for linker generated
  1667. code sections like PLT. This option is on by default if linker
  1668. generated unwind info is supported.
  1669. '--enable-new-dtags'
  1670. '--disable-new-dtags'
  1671. This linker can create the new dynamic tags in ELF. But the older
  1672. ELF systems may not understand them. If you specify
  1673. '--enable-new-dtags', the new dynamic tags will be created as
  1674. needed and older dynamic tags will be omitted. If you specify
  1675. '--disable-new-dtags', no new dynamic tags will be created. By
  1676. default, the new dynamic tags are not created. Note that those
  1677. options are only available for ELF systems.
  1678. '--hash-size=NUMBER'
  1679. Set the default size of the linker's hash tables to a prime number
  1680. close to NUMBER. Increasing this value can reduce the length of
  1681. time it takes the linker to perform its tasks, at the expense of
  1682. increasing the linker's memory requirements. Similarly reducing
  1683. this value can reduce the memory requirements at the expense of
  1684. speed.
  1685. '--hash-style=STYLE'
  1686. Set the type of linker's hash table(s). STYLE can be either 'sysv'
  1687. for classic ELF '.hash' section, 'gnu' for new style GNU
  1688. '.gnu.hash' section or 'both' for both the classic ELF '.hash' and
  1689. new style GNU '.gnu.hash' hash tables. The default depends upon
  1690. how the linker was configured, but for most Linux based systems it
  1691. will be 'both'.
  1692. '--compress-debug-sections=none'
  1693. '--compress-debug-sections=zlib'
  1694. '--compress-debug-sections=zlib-gnu'
  1695. '--compress-debug-sections=zlib-gabi'
  1696. On ELF platforms, these options control how DWARF debug sections
  1697. are compressed using zlib.
  1698. '--compress-debug-sections=none' doesn't compress DWARF debug
  1699. sections. '--compress-debug-sections=zlib-gnu' compresses DWARF
  1700. debug sections and renames them to begin with '.zdebug' instead of
  1701. '.debug'. '--compress-debug-sections=zlib-gabi' also compresses
  1702. DWARF debug sections, but rather than renaming them it sets the
  1703. SHF_COMPRESSED flag in the sections' headers.
  1704. The '--compress-debug-sections=zlib' option is an alias for
  1705. '--compress-debug-sections=zlib-gabi'.
  1706. Note that this option overrides any compression in input debug
  1707. sections, so if a binary is linked with
  1708. '--compress-debug-sections=none' for example, then any compressed
  1709. debug sections in input files will be uncompressed before they are
  1710. copied into the output binary.
  1711. The default compression behaviour varies depending upon the target
  1712. involved and the configure options used to build the toolchain.
  1713. The default can be determined by examining the output from the
  1714. linker's '--help' option.
  1715. '--reduce-memory-overheads'
  1716. This option reduces memory requirements at ld runtime, at the
  1717. expense of linking speed. This was introduced to select the old
  1718. O(n^2) algorithm for link map file generation, rather than the new
  1719. O(n) algorithm which uses about 40% more memory for symbol storage.
  1720. Another effect of the switch is to set the default hash table size
  1721. to 1021, which again saves memory at the cost of lengthening the
  1722. linker's run time. This is not done however if the '--hash-size'
  1723. switch has been used.
  1724. The '--reduce-memory-overheads' switch may be also be used to
  1725. enable other tradeoffs in future versions of the linker.
  1726. '--build-id'
  1727. '--build-id=STYLE'
  1728. Request the creation of a '.note.gnu.build-id' ELF note section or
  1729. a '.buildid' COFF section. The contents of the note are unique
  1730. bits identifying this linked file. STYLE can be 'uuid' to use 128
  1731. random bits, 'sha1' to use a 160-bit SHA1 hash on the normative
  1732. parts of the output contents, 'md5' to use a 128-bit MD5 hash on
  1733. the normative parts of the output contents, or '0xHEXSTRING' to use
  1734. a chosen bit string specified as an even number of hexadecimal
  1735. digits ('-' and ':' characters between digit pairs are ignored).
  1736. If STYLE is omitted, 'sha1' is used.
  1737. The 'md5' and 'sha1' styles produces an identifier that is always
  1738. the same in an identical output file, but will be unique among all
  1739. nonidentical output files. It is not intended to be compared as a
  1740. checksum for the file's contents. A linked file may be changed
  1741. later by other tools, but the build ID bit string identifying the
  1742. original linked file does not change.
  1743. Passing 'none' for STYLE disables the setting from any '--build-id'
  1744. options earlier on the command line.
  1745. 2.1.1 Options Specific to i386 PE Targets
  1746. -----------------------------------------
  1747. The i386 PE linker supports the '-shared' option, which causes the
  1748. output to be a dynamically linked library (DLL) instead of a normal
  1749. executable. You should name the output '*.dll' when you use this
  1750. option. In addition, the linker fully supports the standard '*.def'
  1751. files, which may be specified on the linker command line like an object
  1752. file (in fact, it should precede archives it exports symbols from, to
  1753. ensure that they get linked in, just like a normal object file).
  1754. In addition to the options common to all targets, the i386 PE linker
  1755. support additional command-line options that are specific to the i386 PE
  1756. target. Options that take values may be separated from their values by
  1757. either a space or an equals sign.
  1758. '--add-stdcall-alias'
  1759. If given, symbols with a stdcall suffix (@NN) will be exported
  1760. as-is and also with the suffix stripped. [This option is specific
  1761. to the i386 PE targeted port of the linker]
  1762. '--base-file FILE'
  1763. Use FILE as the name of a file in which to save the base addresses
  1764. of all the relocations needed for generating DLLs with 'dlltool'.
  1765. [This is an i386 PE specific option]
  1766. '--dll'
  1767. Create a DLL instead of a regular executable. You may also use
  1768. '-shared' or specify a 'LIBRARY' in a given '.def' file. [This
  1769. option is specific to the i386 PE targeted port of the linker]
  1770. '--enable-long-section-names'
  1771. '--disable-long-section-names'
  1772. The PE variants of the COFF object format add an extension that
  1773. permits the use of section names longer than eight characters, the
  1774. normal limit for COFF. By default, these names are only allowed in
  1775. object files, as fully-linked executable images do not carry the
  1776. COFF string table required to support the longer names. As a GNU
  1777. extension, it is possible to allow their use in executable images
  1778. as well, or to (probably pointlessly!) disallow it in object
  1779. files, by using these two options. Executable images generated
  1780. with these long section names are slightly non-standard, carrying
  1781. as they do a string table, and may generate confusing output when
  1782. examined with non-GNU PE-aware tools, such as file viewers and
  1783. dumpers. However, GDB relies on the use of PE long section names
  1784. to find Dwarf-2 debug information sections in an executable image
  1785. at runtime, and so if neither option is specified on the
  1786. command-line, 'ld' will enable long section names, overriding the
  1787. default and technically correct behaviour, when it finds the
  1788. presence of debug information while linking an executable image and
  1789. not stripping symbols. [This option is valid for all PE targeted
  1790. ports of the linker]
  1791. '--enable-stdcall-fixup'
  1792. '--disable-stdcall-fixup'
  1793. If the link finds a symbol that it cannot resolve, it will attempt
  1794. to do "fuzzy linking" by looking for another defined symbol that
  1795. differs only in the format of the symbol name (cdecl vs stdcall)
  1796. and will resolve that symbol by linking to the match. For example,
  1797. the undefined symbol '_foo' might be linked to the function
  1798. '_foo@12', or the undefined symbol '_bar@16' might be linked to the
  1799. function '_bar'. When the linker does this, it prints a warning,
  1800. since it normally should have failed to link, but sometimes import
  1801. libraries generated from third-party dlls may need this feature to
  1802. be usable. If you specify '--enable-stdcall-fixup', this feature
  1803. is fully enabled and warnings are not printed. If you specify
  1804. '--disable-stdcall-fixup', this feature is disabled and such
  1805. mismatches are considered to be errors. [This option is specific
  1806. to the i386 PE targeted port of the linker]
  1807. '--leading-underscore'
  1808. '--no-leading-underscore'
  1809. For most targets default symbol-prefix is an underscore and is
  1810. defined in target's description. By this option it is possible to
  1811. disable/enable the default underscore symbol-prefix.
  1812. '--export-all-symbols'
  1813. If given, all global symbols in the objects used to build a DLL
  1814. will be exported by the DLL. Note that this is the default if there
  1815. otherwise wouldn't be any exported symbols. When symbols are
  1816. explicitly exported via DEF files or implicitly exported via
  1817. function attributes, the default is to not export anything else
  1818. unless this option is given. Note that the symbols 'DllMain@12',
  1819. 'DllEntryPoint@0', 'DllMainCRTStartup@12', and 'impure_ptr' will
  1820. not be automatically exported. Also, symbols imported from other
  1821. DLLs will not be re-exported, nor will symbols specifying the DLL's
  1822. internal layout such as those beginning with '_head_' or ending
  1823. with '_iname'. In addition, no symbols from 'libgcc', 'libstd++',
  1824. 'libmingw32', or 'crtX.o' will be exported. Symbols whose names
  1825. begin with '__rtti_' or '__builtin_' will not be exported, to help
  1826. with C++ DLLs. Finally, there is an extensive list of
  1827. cygwin-private symbols that are not exported (obviously, this
  1828. applies on when building DLLs for cygwin targets). These
  1829. cygwin-excludes are: '_cygwin_dll_entry@12',
  1830. '_cygwin_crt0_common@8', '_cygwin_noncygwin_dll_entry@12',
  1831. '_fmode', '_impure_ptr', 'cygwin_attach_dll', 'cygwin_premain0',
  1832. 'cygwin_premain1', 'cygwin_premain2', 'cygwin_premain3', and
  1833. 'environ'. [This option is specific to the i386 PE targeted port
  1834. of the linker]
  1835. '--exclude-symbols SYMBOL,SYMBOL,...'
  1836. Specifies a list of symbols which should not be automatically
  1837. exported. The symbol names may be delimited by commas or colons.
  1838. [This option is specific to the i386 PE targeted port of the
  1839. linker]
  1840. '--exclude-all-symbols'
  1841. Specifies no symbols should be automatically exported. [This
  1842. option is specific to the i386 PE targeted port of the linker]
  1843. '--file-alignment'
  1844. Specify the file alignment. Sections in the file will always begin
  1845. at file offsets which are multiples of this number. This defaults
  1846. to 512. [This option is specific to the i386 PE targeted port of
  1847. the linker]
  1848. '--heap RESERVE'
  1849. '--heap RESERVE,COMMIT'
  1850. Specify the number of bytes of memory to reserve (and optionally
  1851. commit) to be used as heap for this program. The default is 1MB
  1852. reserved, 4K committed. [This option is specific to the i386 PE
  1853. targeted port of the linker]
  1854. '--image-base VALUE'
  1855. Use VALUE as the base address of your program or dll. This is the
  1856. lowest memory location that will be used when your program or dll
  1857. is loaded. To reduce the need to relocate and improve performance
  1858. of your dlls, each should have a unique base address and not
  1859. overlap any other dlls. The default is 0x400000 for executables,
  1860. and 0x10000000 for dlls. [This option is specific to the i386 PE
  1861. targeted port of the linker]
  1862. '--kill-at'
  1863. If given, the stdcall suffixes (@NN) will be stripped from symbols
  1864. before they are exported. [This option is specific to the i386 PE
  1865. targeted port of the linker]
  1866. '--large-address-aware'
  1867. If given, the appropriate bit in the "Characteristics" field of the
  1868. COFF header is set to indicate that this executable supports
  1869. virtual addresses greater than 2 gigabytes. This should be used in
  1870. conjunction with the /3GB or /USERVA=VALUE megabytes switch in the
  1871. "[operating systems]" section of the BOOT.INI. Otherwise, this bit
  1872. has no effect. [This option is specific to PE targeted ports of
  1873. the linker]
  1874. '--disable-large-address-aware'
  1875. Reverts the effect of a previous '--large-address-aware' option.
  1876. This is useful if '--large-address-aware' is always set by the
  1877. compiler driver (e.g. Cygwin gcc) and the executable does not
  1878. support virtual addresses greater than 2 gigabytes. [This option
  1879. is specific to PE targeted ports of the linker]
  1880. '--major-image-version VALUE'
  1881. Sets the major number of the "image version". Defaults to 1.
  1882. [This option is specific to the i386 PE targeted port of the
  1883. linker]
  1884. '--major-os-version VALUE'
  1885. Sets the major number of the "os version". Defaults to 4. [This
  1886. option is specific to the i386 PE targeted port of the linker]
  1887. '--major-subsystem-version VALUE'
  1888. Sets the major number of the "subsystem version". Defaults to 4.
  1889. [This option is specific to the i386 PE targeted port of the
  1890. linker]
  1891. '--minor-image-version VALUE'
  1892. Sets the minor number of the "image version". Defaults to 0.
  1893. [This option is specific to the i386 PE targeted port of the
  1894. linker]
  1895. '--minor-os-version VALUE'
  1896. Sets the minor number of the "os version". Defaults to 0. [This
  1897. option is specific to the i386 PE targeted port of the linker]
  1898. '--minor-subsystem-version VALUE'
  1899. Sets the minor number of the "subsystem version". Defaults to 0.
  1900. [This option is specific to the i386 PE targeted port of the
  1901. linker]
  1902. '--output-def FILE'
  1903. The linker will create the file FILE which will contain a DEF file
  1904. corresponding to the DLL the linker is generating. This DEF file
  1905. (which should be called '*.def') may be used to create an import
  1906. library with 'dlltool' or may be used as a reference to
  1907. automatically or implicitly exported symbols. [This option is
  1908. specific to the i386 PE targeted port of the linker]
  1909. '--enable-auto-image-base'
  1910. '--enable-auto-image-base=VALUE'
  1911. Automatically choose the image base for DLLs, optionally starting
  1912. with base VALUE, unless one is specified using the '--image-base'
  1913. argument. By using a hash generated from the dllname to create
  1914. unique image bases for each DLL, in-memory collisions and
  1915. relocations which can delay program execution are avoided. [This
  1916. option is specific to the i386 PE targeted port of the linker]
  1917. '--disable-auto-image-base'
  1918. Do not automatically generate a unique image base. If there is no
  1919. user-specified image base ('--image-base') then use the platform
  1920. default. [This option is specific to the i386 PE targeted port of
  1921. the linker]
  1922. '--dll-search-prefix STRING'
  1923. When linking dynamically to a dll without an import library, search
  1924. for '<string><basename>.dll' in preference to 'lib<basename>.dll'.
  1925. This behaviour allows easy distinction between DLLs built for the
  1926. various "subplatforms": native, cygwin, uwin, pw, etc. For
  1927. instance, cygwin DLLs typically use '--dll-search-prefix=cyg'.
  1928. [This option is specific to the i386 PE targeted port of the
  1929. linker]
  1930. '--enable-auto-import'
  1931. Do sophisticated linking of '_symbol' to '__imp__symbol' for DATA
  1932. imports from DLLs, thus making it possible to bypass the dllimport
  1933. mechanism on the user side and to reference unmangled symbol names.
  1934. [This option is specific to the i386 PE targeted port of the
  1935. linker]
  1936. The following remarks pertain to the original implementation of the
  1937. feature and are obsolete nowadays for Cygwin and MinGW targets.
  1938. Note: Use of the 'auto-import' extension will cause the text
  1939. section of the image file to be made writable. This does not
  1940. conform to the PE-COFF format specification published by Microsoft.
  1941. Note - use of the 'auto-import' extension will also cause read only
  1942. data which would normally be placed into the .rdata section to be
  1943. placed into the .data section instead. This is in order to work
  1944. around a problem with consts that is described here:
  1945. http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
  1946. Using 'auto-import' generally will 'just work' - but sometimes you
  1947. may see this message:
  1948. "variable '<var>' can't be auto-imported. Please read the
  1949. documentation for ld's '--enable-auto-import' for details."
  1950. This message occurs when some (sub)expression accesses an address
  1951. ultimately given by the sum of two constants (Win32 import tables
  1952. only allow one). Instances where this may occur include accesses
  1953. to member fields of struct variables imported from a DLL, as well
  1954. as using a constant index into an array variable imported from a
  1955. DLL. Any multiword variable (arrays, structs, long long, etc) may
  1956. trigger this error condition. However, regardless of the exact
  1957. data type of the offending exported variable, ld will always detect
  1958. it, issue the warning, and exit.
  1959. There are several ways to address this difficulty, regardless of
  1960. the data type of the exported variable:
  1961. One way is to use -enable-runtime-pseudo-reloc switch. This leaves
  1962. the task of adjusting references in your client code for runtime
  1963. environment, so this method works only when runtime environment
  1964. supports this feature.
  1965. A second solution is to force one of the 'constants' to be a
  1966. variable - that is, unknown and un-optimizable at compile time.
  1967. For arrays, there are two possibilities: a) make the indexee (the
  1968. array's address) a variable, or b) make the 'constant' index a
  1969. variable. Thus:
  1970. extern type extern_array[];
  1971. extern_array[1] -->
  1972. { volatile type *t=extern_array; t[1] }
  1973. or
  1974. extern type extern_array[];
  1975. extern_array[1] -->
  1976. { volatile int t=1; extern_array[t] }
  1977. For structs (and most other multiword data types) the only option
  1978. is to make the struct itself (or the long long, or the ...)
  1979. variable:
  1980. extern struct s extern_struct;
  1981. extern_struct.field -->
  1982. { volatile struct s *t=&extern_struct; t->field }
  1983. or
  1984. extern long long extern_ll;
  1985. extern_ll -->
  1986. { volatile long long * local_ll=&extern_ll; *local_ll }
  1987. A third method of dealing with this difficulty is to abandon
  1988. 'auto-import' for the offending symbol and mark it with
  1989. '__declspec(dllimport)'. However, in practice that requires using
  1990. compile-time #defines to indicate whether you are building a DLL,
  1991. building client code that will link to the DLL, or merely
  1992. building/linking to a static library. In making the choice between
  1993. the various methods of resolving the 'direct address with constant
  1994. offset' problem, you should consider typical real-world usage:
  1995. Original:
  1996. --foo.h
  1997. extern int arr[];
  1998. --foo.c
  1999. #include "foo.h"
  2000. void main(int argc, char **argv){
  2001. printf("%d\n",arr[1]);
  2002. }
  2003. Solution 1:
  2004. --foo.h
  2005. extern int arr[];
  2006. --foo.c
  2007. #include "foo.h"
  2008. void main(int argc, char **argv){
  2009. /* This workaround is for win32 and cygwin; do not "optimize" */
  2010. volatile int *parr = arr;
  2011. printf("%d\n",parr[1]);
  2012. }
  2013. Solution 2:
  2014. --foo.h
  2015. /* Note: auto-export is assumed (no __declspec(dllexport)) */
  2016. #if (defined(_WIN32) || defined(__CYGWIN__)) && \
  2017. !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
  2018. #define FOO_IMPORT __declspec(dllimport)
  2019. #else
  2020. #define FOO_IMPORT
  2021. #endif
  2022. extern FOO_IMPORT int arr[];
  2023. --foo.c
  2024. #include "foo.h"
  2025. void main(int argc, char **argv){
  2026. printf("%d\n",arr[1]);
  2027. }
  2028. A fourth way to avoid this problem is to re-code your library to
  2029. use a functional interface rather than a data interface for the
  2030. offending variables (e.g. set_foo() and get_foo() accessor
  2031. functions).
  2032. '--disable-auto-import'
  2033. Do not attempt to do sophisticated linking of '_symbol' to
  2034. '__imp__symbol' for DATA imports from DLLs. [This option is
  2035. specific to the i386 PE targeted port of the linker]
  2036. '--enable-runtime-pseudo-reloc'
  2037. If your code contains expressions described in -enable-auto-import
  2038. section, that is, DATA imports from DLL with non-zero offset, this
  2039. switch will create a vector of 'runtime pseudo relocations' which
  2040. can be used by runtime environment to adjust references to such
  2041. data in your client code. [This option is specific to the i386 PE
  2042. targeted port of the linker]
  2043. '--disable-runtime-pseudo-reloc'
  2044. Do not create pseudo relocations for non-zero offset DATA imports
  2045. from DLLs. [This option is specific to the i386 PE targeted port
  2046. of the linker]
  2047. '--enable-extra-pe-debug'
  2048. Show additional debug info related to auto-import symbol thunking.
  2049. [This option is specific to the i386 PE targeted port of the
  2050. linker]
  2051. '--section-alignment'
  2052. Sets the section alignment. Sections in memory will always begin
  2053. at addresses which are a multiple of this number. Defaults to
  2054. 0x1000. [This option is specific to the i386 PE targeted port of
  2055. the linker]
  2056. '--stack RESERVE'
  2057. '--stack RESERVE,COMMIT'
  2058. Specify the number of bytes of memory to reserve (and optionally
  2059. commit) to be used as stack for this program. The default is 2MB
  2060. reserved, 4K committed. [This option is specific to the i386 PE
  2061. targeted port of the linker]
  2062. '--subsystem WHICH'
  2063. '--subsystem WHICH:MAJOR'
  2064. '--subsystem WHICH:MAJOR.MINOR'
  2065. Specifies the subsystem under which your program will execute. The
  2066. legal values for WHICH are 'native', 'windows', 'console', 'posix',
  2067. and 'xbox'. You may optionally set the subsystem version also.
  2068. Numeric values are also accepted for WHICH. [This option is
  2069. specific to the i386 PE targeted port of the linker]
  2070. The following options set flags in the 'DllCharacteristics' field
  2071. of the PE file header: [These options are specific to PE targeted
  2072. ports of the linker]
  2073. '--high-entropy-va'
  2074. Image is compatible with 64-bit address space layout randomization
  2075. (ASLR). This option also implies '--dynamicbase' and
  2076. '--enable-reloc-section'.
  2077. '--dynamicbase'
  2078. The image base address may be relocated using address space layout
  2079. randomization (ASLR). This feature was introduced with MS Windows
  2080. Vista for i386 PE targets. This option also implies
  2081. '--enable-reloc-section'.
  2082. '--forceinteg'
  2083. Code integrity checks are enforced.
  2084. '--nxcompat'
  2085. The image is compatible with the Data Execution Prevention. This
  2086. feature was introduced with MS Windows XP SP2 for i386 PE targets.
  2087. '--no-isolation'
  2088. Although the image understands isolation, do not isolate the image.
  2089. '--no-seh'
  2090. The image does not use SEH. No SE handler may be called from this
  2091. image.
  2092. '--no-bind'
  2093. Do not bind this image.
  2094. '--wdmdriver'
  2095. The driver uses the MS Windows Driver Model.
  2096. '--tsaware'
  2097. The image is Terminal Server aware.
  2098. '--insert-timestamp'
  2099. '--no-insert-timestamp'
  2100. Insert a real timestamp into the image. This is the default
  2101. behaviour as it matches legacy code and it means that the image
  2102. will work with other, proprietary tools. The problem with this
  2103. default is that it will result in slightly different images being
  2104. produced each time the same sources are linked. The option
  2105. '--no-insert-timestamp' can be used to insert a zero value for the
  2106. timestamp, this ensuring that binaries produced from identical
  2107. sources will compare identically.
  2108. '--enable-reloc-section'
  2109. Create the base relocation table, which is necessary if the image
  2110. is loaded at a different image base than specified in the PE
  2111. header.
  2112. 2.1.2 Options specific to C6X uClinux targets
  2113. ---------------------------------------------
  2114. The C6X uClinux target uses a binary format called DSBT to support
  2115. shared libraries. Each shared library in the system needs to have a
  2116. unique index; all executables use an index of 0.
  2117. '--dsbt-size SIZE'
  2118. This option sets the number of entries in the DSBT of the current
  2119. executable or shared library to SIZE. The default is to create a
  2120. table with 64 entries.
  2121. '--dsbt-index INDEX'
  2122. This option sets the DSBT index of the current executable or shared
  2123. library to INDEX. The default is 0, which is appropriate for
  2124. generating executables. If a shared library is generated with a
  2125. DSBT index of 0, the 'R_C6000_DSBT_INDEX' relocs are copied into
  2126. the output file.
  2127. The '--no-merge-exidx-entries' switch disables the merging of
  2128. adjacent exidx entries in frame unwind info.
  2129. 2.1.3 Options specific to C-SKY targets
  2130. ---------------------------------------
  2131. '--branch-stub'
  2132. This option enables linker branch relaxation by inserting branch
  2133. stub sections when needed to extend the range of branches. This
  2134. option is usually not required since C-SKY supports branch and call
  2135. instructions that can access the full memory range and branch
  2136. relaxation is normally handled by the compiler or assembler.
  2137. '--stub-group-size=N'
  2138. This option allows finer control of linker branch stub creation.
  2139. It sets the maximum size of a group of input sections that can be
  2140. handled by one stub section. A negative value of N locates stub
  2141. sections after their branches, while a positive value allows stub
  2142. sections to appear either before or after the branches. Values of
  2143. '1' or '-1' indicate that the linker should choose suitable
  2144. defaults.
  2145. 2.1.4 Options specific to Motorola 68HC11 and 68HC12 targets
  2146. ------------------------------------------------------------
  2147. The 68HC11 and 68HC12 linkers support specific options to control the
  2148. memory bank switching mapping and trampoline code generation.
  2149. '--no-trampoline'
  2150. This option disables the generation of trampoline. By default a
  2151. trampoline is generated for each far function which is called using
  2152. a 'jsr' instruction (this happens when a pointer to a far function
  2153. is taken).
  2154. '--bank-window NAME'
  2155. This option indicates to the linker the name of the memory region
  2156. in the 'MEMORY' specification that describes the memory bank
  2157. window. The definition of such region is then used by the linker
  2158. to compute paging and addresses within the memory window.
  2159. 2.1.5 Options specific to Motorola 68K target
  2160. ---------------------------------------------
  2161. The following options are supported to control handling of GOT
  2162. generation when linking for 68K targets.
  2163. '--got=TYPE'
  2164. This option tells the linker which GOT generation scheme to use.
  2165. TYPE should be one of 'single', 'negative', 'multigot' or 'target'.
  2166. For more information refer to the Info entry for 'ld'.
  2167. 2.1.6 Options specific to MIPS targets
  2168. --------------------------------------
  2169. The following options are supported to control microMIPS instruction
  2170. generation and branch relocation checks for ISA mode transitions when
  2171. linking for MIPS targets.
  2172. '--insn32'
  2173. '--no-insn32'
  2174. These options control the choice of microMIPS instructions used in
  2175. code generated by the linker, such as that in the PLT or lazy
  2176. binding stubs, or in relaxation. If '--insn32' is used, then the
  2177. linker only uses 32-bit instruction encodings. By default or if
  2178. '--no-insn32' is used, all instruction encodings are used,
  2179. including 16-bit ones where possible.
  2180. '--ignore-branch-isa'
  2181. '--no-ignore-branch-isa'
  2182. These options control branch relocation checks for invalid ISA mode
  2183. transitions. If '--ignore-branch-isa' is used, then the linker
  2184. accepts any branch relocations and any ISA mode transition required
  2185. is lost in relocation calculation, except for some cases of 'BAL'
  2186. instructions which meet relaxation conditions and are converted to
  2187. equivalent 'JALX' instructions as the associated relocation is
  2188. calculated. By default or if '--no-ignore-branch-isa' is used a
  2189. check is made causing the loss of an ISA mode transition to produce
  2190. an error.
  2191. '--compact-branches'
  2192. '--no-compact-branches'
  2193. These options control the generation of compact instructions by the
  2194. linker in the PLT entries for MIPS R6.
  2195. 2.1.7 Options specific to PDP11 targets
  2196. ---------------------------------------
  2197. For the pdp11-aout target, three variants of the output format can be
  2198. produced as selected by the following options. The default variant for
  2199. pdp11-aout is the '--omagic' option, whereas for other targets
  2200. '--nmagic' is the default. The '--imagic' option is defined only for
  2201. the pdp11-aout target, while the others are described here as they apply
  2202. to the pdp11-aout target.
  2203. '-N'
  2204. '--omagic'
  2205. Mark the output as 'OMAGIC' (0407) in the 'a.out' header to
  2206. indicate that the text segment is not to be write-protected and
  2207. shared. Since the text and data sections are both readable and
  2208. writable, the data section is allocated immediately contiguous
  2209. after the text segment. This is the oldest format for PDP11
  2210. executable programs and is the default for 'ld' on PDP11 Unix
  2211. systems from the beginning through 2.11BSD.
  2212. '-n'
  2213. '--nmagic'
  2214. Mark the output as 'NMAGIC' (0410) in the 'a.out' header to
  2215. indicate that when the output file is executed, the text portion
  2216. will be read-only and shareable among all processes executing the
  2217. same file. This involves moving the data areas up to the first
  2218. possible 8K byte page boundary following the end of the text. This
  2219. option creates a _pure executable_ format.
  2220. '-z'
  2221. '--imagic'
  2222. Mark the output as 'IMAGIC' (0411) in the 'a.out' header to
  2223. indicate that when the output file is executed, the program text
  2224. and data areas will be loaded into separate address spaces using
  2225. the split instruction and data space feature of the memory
  2226. management unit in larger models of the PDP11. This doubles the
  2227. address space available to the program. The text segment is again
  2228. pure, write-protected, and shareable. The only difference in the
  2229. output format between this option and the others, besides the magic
  2230. number, is that both the text and data sections start at location
  2231. 0. The '-z' option selected this format in 2.11BSD. This option
  2232. creates a _separate executable_ format.
  2233. '--no-omagic'
  2234. Equivalent to '--nmagic' for pdp11-aout.
  2235. 
  2236. File: ld.info, Node: Environment, Prev: Options, Up: Invocation
  2237. 2.2 Environment Variables
  2238. =========================
  2239. You can change the behaviour of 'ld' with the environment variables
  2240. 'GNUTARGET', 'LDEMULATION' and 'COLLECT_NO_DEMANGLE'.
  2241. 'GNUTARGET' determines the input-file object format if you don't use
  2242. '-b' (or its synonym '--format'). Its value should be one of the BFD
  2243. names for an input format (*note BFD::). If there is no 'GNUTARGET' in
  2244. the environment, 'ld' uses the natural format of the target. If
  2245. 'GNUTARGET' is set to 'default' then BFD attempts to discover the input
  2246. format by examining binary input files; this method often succeeds, but
  2247. there are potential ambiguities, since there is no method of ensuring
  2248. that the magic number used to specify object-file formats is unique.
  2249. However, the configuration procedure for BFD on each system places the
  2250. conventional format for that system first in the search-list, so
  2251. ambiguities are resolved in favor of convention.
  2252. 'LDEMULATION' determines the default emulation if you don't use the
  2253. '-m' option. The emulation can affect various aspects of linker
  2254. behaviour, particularly the default linker script. You can list the
  2255. available emulations with the '--verbose' or '-V' options. If the '-m'
  2256. option is not used, and the 'LDEMULATION' environment variable is not
  2257. defined, the default emulation depends upon how the linker was
  2258. configured.
  2259. Normally, the linker will default to demangling symbols. However, if
  2260. 'COLLECT_NO_DEMANGLE' is set in the environment, then it will default to
  2261. not demangling symbols. This environment variable is used in a similar
  2262. fashion by the 'gcc' linker wrapper program. The default may be
  2263. overridden by the '--demangle' and '--no-demangle' options.
  2264. 
  2265. File: ld.info, Node: Scripts, Next: Machine Dependent, Prev: Invocation, Up: Top
  2266. 3 Linker Scripts
  2267. ****************
  2268. Every link is controlled by a "linker script". This script is written
  2269. in the linker command language.
  2270. The main purpose of the linker script is to describe how the sections
  2271. in the input files should be mapped into the output file, and to control
  2272. the memory layout of the output file. Most linker scripts do nothing
  2273. more than this. However, when necessary, the linker script can also
  2274. direct the linker to perform many other operations, using the commands
  2275. described below.
  2276. The linker always uses a linker script. If you do not supply one
  2277. yourself, the linker will use a default script that is compiled into the
  2278. linker executable. You can use the '--verbose' command-line option to
  2279. display the default linker script. Certain command-line options, such
  2280. as '-r' or '-N', will affect the default linker script.
  2281. You may supply your own linker script by using the '-T' command line
  2282. option. When you do this, your linker script will replace the default
  2283. linker script.
  2284. You may also use linker scripts implicitly by naming them as input
  2285. files to the linker, as though they were files to be linked. *Note
  2286. Implicit Linker Scripts::.
  2287. * Menu:
  2288. * Basic Script Concepts:: Basic Linker Script Concepts
  2289. * Script Format:: Linker Script Format
  2290. * Simple Example:: Simple Linker Script Example
  2291. * Simple Commands:: Simple Linker Script Commands
  2292. * Assignments:: Assigning Values to Symbols
  2293. * SECTIONS:: SECTIONS Command
  2294. * MEMORY:: MEMORY Command
  2295. * PHDRS:: PHDRS Command
  2296. * VERSION:: VERSION Command
  2297. * Expressions:: Expressions in Linker Scripts
  2298. * Implicit Linker Scripts:: Implicit Linker Scripts
  2299. 
  2300. File: ld.info, Node: Basic Script Concepts, Next: Script Format, Up: Scripts
  2301. 3.1 Basic Linker Script Concepts
  2302. ================================
  2303. We need to define some basic concepts and vocabulary in order to
  2304. describe the linker script language.
  2305. The linker combines input files into a single output file. The
  2306. output file and each input file are in a special data format known as an
  2307. "object file format". Each file is called an "object file". The output
  2308. file is often called an "executable", but for our purposes we will also
  2309. call it an object file. Each object file has, among other things, a
  2310. list of "sections". We sometimes refer to a section in an input file as
  2311. an "input section"; similarly, a section in the output file is an
  2312. "output section".
  2313. Each section in an object file has a name and a size. Most sections
  2314. also have an associated block of data, known as the "section contents".
  2315. A section may be marked as "loadable", which means that the contents
  2316. should be loaded into memory when the output file is run. A section
  2317. with no contents may be "allocatable", which means that an area in
  2318. memory should be set aside, but nothing in particular should be loaded
  2319. there (in some cases this memory must be zeroed out). A section which
  2320. is neither loadable nor allocatable typically contains some sort of
  2321. debugging information.
  2322. Every loadable or allocatable output section has two addresses. The
  2323. first is the "VMA", or virtual memory address. This is the address the
  2324. section will have when the output file is run. The second is the "LMA",
  2325. or load memory address. This is the address at which the section will
  2326. be loaded. In most cases the two addresses will be the same. An
  2327. example of when they might be different is when a data section is loaded
  2328. into ROM, and then copied into RAM when the program starts up (this
  2329. technique is often used to initialize global variables in a ROM based
  2330. system). In this case the ROM address would be the LMA, and the RAM
  2331. address would be the VMA.
  2332. You can see the sections in an object file by using the 'objdump'
  2333. program with the '-h' option.
  2334. Every object file also has a list of "symbols", known as the "symbol
  2335. table". A symbol may be defined or undefined. Each symbol has a name,
  2336. and each defined symbol has an address, among other information. If you
  2337. compile a C or C++ program into an object file, you will get a defined
  2338. symbol for every defined function and global or static variable. Every
  2339. undefined function or global variable which is referenced in the input
  2340. file will become an undefined symbol.
  2341. You can see the symbols in an object file by using the 'nm' program,
  2342. or by using the 'objdump' program with the '-t' option.
  2343. 
  2344. File: ld.info, Node: Script Format, Next: Simple Example, Prev: Basic Script Concepts, Up: Scripts
  2345. 3.2 Linker Script Format
  2346. ========================
  2347. Linker scripts are text files.
  2348. You write a linker script as a series of commands. Each command is
  2349. either a keyword, possibly followed by arguments, or an assignment to a
  2350. symbol. You may separate commands using semicolons. Whitespace is
  2351. generally ignored.
  2352. Strings such as file or format names can normally be entered
  2353. directly. If the file name contains a character such as a comma which
  2354. would otherwise serve to separate file names, you may put the file name
  2355. in double quotes. There is no way to use a double quote character in a
  2356. file name.
  2357. You may include comments in linker scripts just as in C, delimited by
  2358. '/*' and '*/'. As in C, comments are syntactically equivalent to
  2359. whitespace.
  2360. 
  2361. File: ld.info, Node: Simple Example, Next: Simple Commands, Prev: Script Format, Up: Scripts
  2362. 3.3 Simple Linker Script Example
  2363. ================================
  2364. Many linker scripts are fairly simple.
  2365. The simplest possible linker script has just one command: 'SECTIONS'.
  2366. You use the 'SECTIONS' command to describe the memory layout of the
  2367. output file.
  2368. The 'SECTIONS' command is a powerful command. Here we will describe
  2369. a simple use of it. Let's assume your program consists only of code,
  2370. initialized data, and uninitialized data. These will be in the '.text',
  2371. '.data', and '.bss' sections, respectively. Let's assume further that
  2372. these are the only sections which appear in your input files.
  2373. For this example, let's say that the code should be loaded at address
  2374. 0x10000, and that the data should start at address 0x8000000. Here is a
  2375. linker script which will do that:
  2376. SECTIONS
  2377. {
  2378. . = 0x10000;
  2379. .text : { *(.text) }
  2380. . = 0x8000000;
  2381. .data : { *(.data) }
  2382. .bss : { *(.bss) }
  2383. }
  2384. You write the 'SECTIONS' command as the keyword 'SECTIONS', followed
  2385. by a series of symbol assignments and output section descriptions
  2386. enclosed in curly braces.
  2387. The first line inside the 'SECTIONS' command of the above example
  2388. sets the value of the special symbol '.', which is the location counter.
  2389. If you do not specify the address of an output section in some other way
  2390. (other ways are described later), the address is set from the current
  2391. value of the location counter. The location counter is then incremented
  2392. by the size of the output section. At the start of the 'SECTIONS'
  2393. command, the location counter has the value '0'.
  2394. The second line defines an output section, '.text'. The colon is
  2395. required syntax which may be ignored for now. Within the curly braces
  2396. after the output section name, you list the names of the input sections
  2397. which should be placed into this output section. The '*' is a wildcard
  2398. which matches any file name. The expression '*(.text)' means all
  2399. '.text' input sections in all input files.
  2400. Since the location counter is '0x10000' when the output section
  2401. '.text' is defined, the linker will set the address of the '.text'
  2402. section in the output file to be '0x10000'.
  2403. The remaining lines define the '.data' and '.bss' sections in the
  2404. output file. The linker will place the '.data' output section at
  2405. address '0x8000000'. After the linker places the '.data' output
  2406. section, the value of the location counter will be '0x8000000' plus the
  2407. size of the '.data' output section. The effect is that the linker will
  2408. place the '.bss' output section immediately after the '.data' output
  2409. section in memory.
  2410. The linker will ensure that each output section has the required
  2411. alignment, by increasing the location counter if necessary. In this
  2412. example, the specified addresses for the '.text' and '.data' sections
  2413. will probably satisfy any alignment constraints, but the linker may have
  2414. to create a small gap between the '.data' and '.bss' sections.
  2415. That's it! That's a simple and complete linker script.
  2416. 
  2417. File: ld.info, Node: Simple Commands, Next: Assignments, Prev: Simple Example, Up: Scripts
  2418. 3.4 Simple Linker Script Commands
  2419. =================================
  2420. In this section we describe the simple linker script commands.
  2421. * Menu:
  2422. * Entry Point:: Setting the entry point
  2423. * File Commands:: Commands dealing with files
  2424. * Format Commands:: Commands dealing with object file formats
  2425. * REGION_ALIAS:: Assign alias names to memory regions
  2426. * Miscellaneous Commands:: Other linker script commands
  2427. 
  2428. File: ld.info, Node: Entry Point, Next: File Commands, Up: Simple Commands
  2429. 3.4.1 Setting the Entry Point
  2430. -----------------------------
  2431. The first instruction to execute in a program is called the "entry
  2432. point". You can use the 'ENTRY' linker script command to set the entry
  2433. point. The argument is a symbol name:
  2434. ENTRY(SYMBOL)
  2435. There are several ways to set the entry point. The linker will set
  2436. the entry point by trying each of the following methods in order, and
  2437. stopping when one of them succeeds:
  2438. * the '-e' ENTRY command-line option;
  2439. * the 'ENTRY(SYMBOL)' command in a linker script;
  2440. * the value of a target-specific symbol, if it is defined; For many
  2441. targets this is 'start', but PE- and BeOS-based systems for example
  2442. check a list of possible entry symbols, matching the first one
  2443. found.
  2444. * the address of the first byte of the '.text' section, if present;
  2445. * The address '0'.
  2446. 
  2447. File: ld.info, Node: File Commands, Next: Format Commands, Prev: Entry Point, Up: Simple Commands
  2448. 3.4.2 Commands Dealing with Files
  2449. ---------------------------------
  2450. Several linker script commands deal with files.
  2451. 'INCLUDE FILENAME'
  2452. Include the linker script FILENAME at this point. The file will be
  2453. searched for in the current directory, and in any directory
  2454. specified with the '-L' option. You can nest calls to 'INCLUDE' up
  2455. to 10 levels deep.
  2456. You can place 'INCLUDE' directives at the top level, in 'MEMORY' or
  2457. 'SECTIONS' commands, or in output section descriptions.
  2458. 'INPUT(FILE, FILE, ...)'
  2459. 'INPUT(FILE FILE ...)'
  2460. The 'INPUT' command directs the linker to include the named files
  2461. in the link, as though they were named on the command line.
  2462. For example, if you always want to include 'subr.o' any time you do
  2463. a link, but you can't be bothered to put it on every link command
  2464. line, then you can put 'INPUT (subr.o)' in your linker script.
  2465. In fact, if you like, you can list all of your input files in the
  2466. linker script, and then invoke the linker with nothing but a '-T'
  2467. option.
  2468. In case a "sysroot prefix" is configured, and the filename starts
  2469. with the '/' character, and the script being processed was located
  2470. inside the "sysroot prefix", the filename will be looked for in the
  2471. "sysroot prefix". The "sysroot prefix" can also be forced by
  2472. specifying '=' as the first character in the filename path, or
  2473. prefixing the filename path with '$SYSROOT'. See also the
  2474. description of '-L' in *note Command-line Options: Options.
  2475. If a "sysroot prefix" is not used then the linker will try to open
  2476. the file in the directory containing the linker script. If it is
  2477. not found the linker will then search the current directory. If it
  2478. is still not found the linker will search through the archive
  2479. library search path.
  2480. If you use 'INPUT (-lFILE)', 'ld' will transform the name to
  2481. 'libFILE.a', as with the command-line argument '-l'.
  2482. When you use the 'INPUT' command in an implicit linker script, the
  2483. files will be included in the link at the point at which the linker
  2484. script file is included. This can affect archive searching.
  2485. 'GROUP(FILE, FILE, ...)'
  2486. 'GROUP(FILE FILE ...)'
  2487. The 'GROUP' command is like 'INPUT', except that the named files
  2488. should all be archives, and they are searched repeatedly until no
  2489. new undefined references are created. See the description of '-('
  2490. in *note Command-line Options: Options.
  2491. 'AS_NEEDED(FILE, FILE, ...)'
  2492. 'AS_NEEDED(FILE FILE ...)'
  2493. This construct can appear only inside of the 'INPUT' or 'GROUP'
  2494. commands, among other filenames. The files listed will be handled
  2495. as if they appear directly in the 'INPUT' or 'GROUP' commands, with
  2496. the exception of ELF shared libraries, that will be added only when
  2497. they are actually needed. This construct essentially enables
  2498. '--as-needed' option for all the files listed inside of it and
  2499. restores previous '--as-needed' resp. '--no-as-needed' setting
  2500. afterwards.
  2501. 'OUTPUT(FILENAME)'
  2502. The 'OUTPUT' command names the output file. Using
  2503. 'OUTPUT(FILENAME)' in the linker script is exactly like using '-o
  2504. FILENAME' on the command line (*note Command Line Options:
  2505. Options.). If both are used, the command-line option takes
  2506. precedence.
  2507. You can use the 'OUTPUT' command to define a default name for the
  2508. output file other than the usual default of 'a.out'.
  2509. 'SEARCH_DIR(PATH)'
  2510. The 'SEARCH_DIR' command adds PATH to the list of paths where 'ld'
  2511. looks for archive libraries. Using 'SEARCH_DIR(PATH)' is exactly
  2512. like using '-L PATH' on the command line (*note Command-line
  2513. Options: Options.). If both are used, then the linker will search
  2514. both paths. Paths specified using the command-line option are
  2515. searched first.
  2516. 'STARTUP(FILENAME)'
  2517. The 'STARTUP' command is just like the 'INPUT' command, except that
  2518. FILENAME will become the first input file to be linked, as though
  2519. it were specified first on the command line. This may be useful
  2520. when using a system in which the entry point is always the start of
  2521. the first file.
  2522. 
  2523. File: ld.info, Node: Format Commands, Next: REGION_ALIAS, Prev: File Commands, Up: Simple Commands
  2524. 3.4.3 Commands Dealing with Object File Formats
  2525. -----------------------------------------------
  2526. A couple of linker script commands deal with object file formats.
  2527. 'OUTPUT_FORMAT(BFDNAME)'
  2528. 'OUTPUT_FORMAT(DEFAULT, BIG, LITTLE)'
  2529. The 'OUTPUT_FORMAT' command names the BFD format to use for the
  2530. output file (*note BFD::). Using 'OUTPUT_FORMAT(BFDNAME)' is
  2531. exactly like using '--oformat BFDNAME' on the command line (*note
  2532. Command-line Options: Options.). If both are used, the command
  2533. line option takes precedence.
  2534. You can use 'OUTPUT_FORMAT' with three arguments to use different
  2535. formats based on the '-EB' and '-EL' command-line options. This
  2536. permits the linker script to set the output format based on the
  2537. desired endianness.
  2538. If neither '-EB' nor '-EL' are used, then the output format will be
  2539. the first argument, DEFAULT. If '-EB' is used, the output format
  2540. will be the second argument, BIG. If '-EL' is used, the output
  2541. format will be the third argument, LITTLE.
  2542. For example, the default linker script for the MIPS ELF target uses
  2543. this command:
  2544. OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
  2545. This says that the default format for the output file is
  2546. 'elf32-bigmips', but if the user uses the '-EL' command-line
  2547. option, the output file will be created in the 'elf32-littlemips'
  2548. format.
  2549. 'TARGET(BFDNAME)'
  2550. The 'TARGET' command names the BFD format to use when reading input
  2551. files. It affects subsequent 'INPUT' and 'GROUP' commands. This
  2552. command is like using '-b BFDNAME' on the command line (*note
  2553. Command-line Options: Options.). If the 'TARGET' command is used
  2554. but 'OUTPUT_FORMAT' is not, then the last 'TARGET' command is also
  2555. used to set the format for the output file. *Note BFD::.
  2556. 
  2557. File: ld.info, Node: REGION_ALIAS, Next: Miscellaneous Commands, Prev: Format Commands, Up: Simple Commands
  2558. 3.4.4 Assign alias names to memory regions
  2559. ------------------------------------------
  2560. Alias names can be added to existing memory regions created with the
  2561. *note MEMORY:: command. Each name corresponds to at most one memory
  2562. region.
  2563. REGION_ALIAS(ALIAS, REGION)
  2564. The 'REGION_ALIAS' function creates an alias name ALIAS for the
  2565. memory region REGION. This allows a flexible mapping of output sections
  2566. to memory regions. An example follows.
  2567. Suppose we have an application for embedded systems which come with
  2568. various memory storage devices. All have a general purpose, volatile
  2569. memory 'RAM' that allows code execution or data storage. Some may have
  2570. a read-only, non-volatile memory 'ROM' that allows code execution and
  2571. read-only data access. The last variant is a read-only, non-volatile
  2572. memory 'ROM2' with read-only data access and no code execution
  2573. capability. We have four output sections:
  2574. * '.text' program code;
  2575. * '.rodata' read-only data;
  2576. * '.data' read-write initialized data;
  2577. * '.bss' read-write zero initialized data.
  2578. The goal is to provide a linker command file that contains a system
  2579. independent part defining the output sections and a system dependent
  2580. part mapping the output sections to the memory regions available on the
  2581. system. Our embedded systems come with three different memory setups
  2582. 'A', 'B' and 'C':
  2583. Section Variant A Variant B Variant C
  2584. .text RAM ROM ROM
  2585. .rodata RAM ROM ROM2
  2586. .data RAM RAM/ROM RAM/ROM2
  2587. .bss RAM RAM RAM
  2588. The notation 'RAM/ROM' or 'RAM/ROM2' means that this section is
  2589. loaded into region 'ROM' or 'ROM2' respectively. Please note that the
  2590. load address of the '.data' section starts in all three variants at the
  2591. end of the '.rodata' section.
  2592. The base linker script that deals with the output sections follows.
  2593. It includes the system dependent 'linkcmds.memory' file that describes
  2594. the memory layout:
  2595. INCLUDE linkcmds.memory
  2596. SECTIONS
  2597. {
  2598. .text :
  2599. {
  2600. *(.text)
  2601. } > REGION_TEXT
  2602. .rodata :
  2603. {
  2604. *(.rodata)
  2605. rodata_end = .;
  2606. } > REGION_RODATA
  2607. .data : AT (rodata_end)
  2608. {
  2609. data_start = .;
  2610. *(.data)
  2611. } > REGION_DATA
  2612. data_size = SIZEOF(.data);
  2613. data_load_start = LOADADDR(.data);
  2614. .bss :
  2615. {
  2616. *(.bss)
  2617. } > REGION_BSS
  2618. }
  2619. Now we need three different 'linkcmds.memory' files to define memory
  2620. regions and alias names. The content of 'linkcmds.memory' for the three
  2621. variants 'A', 'B' and 'C':
  2622. 'A'
  2623. Here everything goes into the 'RAM'.
  2624. MEMORY
  2625. {
  2626. RAM : ORIGIN = 0, LENGTH = 4M
  2627. }
  2628. REGION_ALIAS("REGION_TEXT", RAM);
  2629. REGION_ALIAS("REGION_RODATA", RAM);
  2630. REGION_ALIAS("REGION_DATA", RAM);
  2631. REGION_ALIAS("REGION_BSS", RAM);
  2632. 'B'
  2633. Program code and read-only data go into the 'ROM'. Read-write data
  2634. goes into the 'RAM'. An image of the initialized data is loaded
  2635. into the 'ROM' and will be copied during system start into the
  2636. 'RAM'.
  2637. MEMORY
  2638. {
  2639. ROM : ORIGIN = 0, LENGTH = 3M
  2640. RAM : ORIGIN = 0x10000000, LENGTH = 1M
  2641. }
  2642. REGION_ALIAS("REGION_TEXT", ROM);
  2643. REGION_ALIAS("REGION_RODATA", ROM);
  2644. REGION_ALIAS("REGION_DATA", RAM);
  2645. REGION_ALIAS("REGION_BSS", RAM);
  2646. 'C'
  2647. Program code goes into the 'ROM'. Read-only data goes into the
  2648. 'ROM2'. Read-write data goes into the 'RAM'. An image of the
  2649. initialized data is loaded into the 'ROM2' and will be copied
  2650. during system start into the 'RAM'.
  2651. MEMORY
  2652. {
  2653. ROM : ORIGIN = 0, LENGTH = 2M
  2654. ROM2 : ORIGIN = 0x10000000, LENGTH = 1M
  2655. RAM : ORIGIN = 0x20000000, LENGTH = 1M
  2656. }
  2657. REGION_ALIAS("REGION_TEXT", ROM);
  2658. REGION_ALIAS("REGION_RODATA", ROM2);
  2659. REGION_ALIAS("REGION_DATA", RAM);
  2660. REGION_ALIAS("REGION_BSS", RAM);
  2661. It is possible to write a common system initialization routine to
  2662. copy the '.data' section from 'ROM' or 'ROM2' into the 'RAM' if
  2663. necessary:
  2664. #include <string.h>
  2665. extern char data_start [];
  2666. extern char data_size [];
  2667. extern char data_load_start [];
  2668. void copy_data(void)
  2669. {
  2670. if (data_start != data_load_start)
  2671. {
  2672. memcpy(data_start, data_load_start, (size_t) data_size);
  2673. }
  2674. }
  2675. 
  2676. File: ld.info, Node: Miscellaneous Commands, Prev: REGION_ALIAS, Up: Simple Commands
  2677. 3.4.5 Other Linker Script Commands
  2678. ----------------------------------
  2679. There are a few other linker scripts commands.
  2680. 'ASSERT(EXP, MESSAGE)'
  2681. Ensure that EXP is non-zero. If it is zero, then exit the linker
  2682. with an error code, and print MESSAGE.
  2683. Note that assertions are checked before the final stages of linking
  2684. take place. This means that expressions involving symbols PROVIDEd
  2685. inside section definitions will fail if the user has not set values
  2686. for those symbols. The only exception to this rule is PROVIDEd
  2687. symbols that just reference dot. Thus an assertion like this:
  2688. .stack :
  2689. {
  2690. PROVIDE (__stack = .);
  2691. PROVIDE (__stack_size = 0x100);
  2692. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2693. }
  2694. will fail if '__stack_size' is not defined elsewhere. Symbols
  2695. PROVIDEd outside of section definitions are evaluated earlier, so
  2696. they can be used inside ASSERTions. Thus:
  2697. PROVIDE (__stack_size = 0x100);
  2698. .stack :
  2699. {
  2700. PROVIDE (__stack = .);
  2701. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2702. }
  2703. will work.
  2704. 'EXTERN(SYMBOL SYMBOL ...)'
  2705. Force SYMBOL to be entered in the output file as an undefined
  2706. symbol. Doing this may, for example, trigger linking of additional
  2707. modules from standard libraries. You may list several SYMBOLs for
  2708. each 'EXTERN', and you may use 'EXTERN' multiple times. This
  2709. command has the same effect as the '-u' command-line option.
  2710. 'FORCE_COMMON_ALLOCATION'
  2711. This command has the same effect as the '-d' command-line option:
  2712. to make 'ld' assign space to common symbols even if a relocatable
  2713. output file is specified ('-r').
  2714. 'INHIBIT_COMMON_ALLOCATION'
  2715. This command has the same effect as the '--no-define-common'
  2716. command-line option: to make 'ld' omit the assignment of addresses
  2717. to common symbols even for a non-relocatable output file.
  2718. 'FORCE_GROUP_ALLOCATION'
  2719. This command has the same effect as the '--force-group-allocation'
  2720. command-line option: to make 'ld' place section group members like
  2721. normal input sections, and to delete the section groups even if a
  2722. relocatable output file is specified ('-r').
  2723. 'INSERT [ AFTER | BEFORE ] OUTPUT_SECTION'
  2724. This command is typically used in a script specified by '-T' to
  2725. augment the default 'SECTIONS' with, for example, overlays. It
  2726. inserts all prior linker script statements after (or before)
  2727. OUTPUT_SECTION, and also causes '-T' to not override the default
  2728. linker script. The exact insertion point is as for orphan
  2729. sections. *Note Location Counter::. The insertion happens after
  2730. the linker has mapped input sections to output sections. Prior to
  2731. the insertion, since '-T' scripts are parsed before the default
  2732. linker script, statements in the '-T' script occur before the
  2733. default linker script statements in the internal linker
  2734. representation of the script. In particular, input section
  2735. assignments will be made to '-T' output sections before those in
  2736. the default script. Here is an example of how a '-T' script using
  2737. 'INSERT' might look:
  2738. SECTIONS
  2739. {
  2740. OVERLAY :
  2741. {
  2742. .ov1 { ov1*(.text) }
  2743. .ov2 { ov2*(.text) }
  2744. }
  2745. }
  2746. INSERT AFTER .text;
  2747. 'NOCROSSREFS(SECTION SECTION ...)'
  2748. This command may be used to tell 'ld' to issue an error about any
  2749. references among certain output sections.
  2750. In certain types of programs, particularly on embedded systems when
  2751. using overlays, when one section is loaded into memory, another
  2752. section will not be. Any direct references between the two
  2753. sections would be errors. For example, it would be an error if
  2754. code in one section called a function defined in the other section.
  2755. The 'NOCROSSREFS' command takes a list of output section names. If
  2756. 'ld' detects any cross references between the sections, it reports
  2757. an error and returns a non-zero exit status. Note that the
  2758. 'NOCROSSREFS' command uses output section names, not input section
  2759. names.
  2760. 'NOCROSSREFS_TO(TOSECTION FROMSECTION ...)'
  2761. This command may be used to tell 'ld' to issue an error about any
  2762. references to one section from a list of other sections.
  2763. The 'NOCROSSREFS' command is useful when ensuring that two or more
  2764. output sections are entirely independent but there are situations
  2765. where a one-way dependency is needed. For example, in a multi-core
  2766. application there may be shared code that can be called from each
  2767. core but for safety must never call back.
  2768. The 'NOCROSSREFS_TO' command takes a list of output section names.
  2769. The first section can not be referenced from any of the other
  2770. sections. If 'ld' detects any references to the first section from
  2771. any of the other sections, it reports an error and returns a
  2772. non-zero exit status. Note that the 'NOCROSSREFS_TO' command uses
  2773. output section names, not input section names.
  2774. 'OUTPUT_ARCH(BFDARCH)'
  2775. Specify a particular output machine architecture. The argument is
  2776. one of the names used by the BFD library (*note BFD::). You can
  2777. see the architecture of an object file by using the 'objdump'
  2778. program with the '-f' option.
  2779. 'LD_FEATURE(STRING)'
  2780. This command may be used to modify 'ld' behavior. If STRING is
  2781. '"SANE_EXPR"' then absolute symbols and numbers in a script are
  2782. simply treated as numbers everywhere. *Note Expression Section::.
  2783. 
  2784. File: ld.info, Node: Assignments, Next: SECTIONS, Prev: Simple Commands, Up: Scripts
  2785. 3.5 Assigning Values to Symbols
  2786. ===============================
  2787. You may assign a value to a symbol in a linker script. This will define
  2788. the symbol and place it into the symbol table with a global scope.
  2789. * Menu:
  2790. * Simple Assignments:: Simple Assignments
  2791. * HIDDEN:: HIDDEN
  2792. * PROVIDE:: PROVIDE
  2793. * PROVIDE_HIDDEN:: PROVIDE_HIDDEN
  2794. * Source Code Reference:: How to use a linker script defined symbol in source code
  2795. 
  2796. File: ld.info, Node: Simple Assignments, Next: HIDDEN, Up: Assignments
  2797. 3.5.1 Simple Assignments
  2798. ------------------------
  2799. You may assign to a symbol using any of the C assignment operators:
  2800. 'SYMBOL = EXPRESSION ;'
  2801. 'SYMBOL += EXPRESSION ;'
  2802. 'SYMBOL -= EXPRESSION ;'
  2803. 'SYMBOL *= EXPRESSION ;'
  2804. 'SYMBOL /= EXPRESSION ;'
  2805. 'SYMBOL <<= EXPRESSION ;'
  2806. 'SYMBOL >>= EXPRESSION ;'
  2807. 'SYMBOL &= EXPRESSION ;'
  2808. 'SYMBOL |= EXPRESSION ;'
  2809. The first case will define SYMBOL to the value of EXPRESSION. In the
  2810. other cases, SYMBOL must already be defined, and the value will be
  2811. adjusted accordingly.
  2812. The special symbol name '.' indicates the location counter. You may
  2813. only use this within a 'SECTIONS' command. *Note Location Counter::.
  2814. The semicolon after EXPRESSION is required.
  2815. Expressions are defined below; see *note Expressions::.
  2816. You may write symbol assignments as commands in their own right, or
  2817. as statements within a 'SECTIONS' command, or as part of an output
  2818. section description in a 'SECTIONS' command.
  2819. The section of the symbol will be set from the section of the
  2820. expression; for more information, see *note Expression Section::.
  2821. Here is an example showing the three different places that symbol
  2822. assignments may be used:
  2823. floating_point = 0;
  2824. SECTIONS
  2825. {
  2826. .text :
  2827. {
  2828. *(.text)
  2829. _etext = .;
  2830. }
  2831. _bdata = (. + 3) & ~ 3;
  2832. .data : { *(.data) }
  2833. }
  2834. In this example, the symbol 'floating_point' will be defined as zero.
  2835. The symbol '_etext' will be defined as the address following the last
  2836. '.text' input section. The symbol '_bdata' will be defined as the
  2837. address following the '.text' output section aligned upward to a 4 byte
  2838. boundary.
  2839. 
  2840. File: ld.info, Node: HIDDEN, Next: PROVIDE, Prev: Simple Assignments, Up: Assignments
  2841. 3.5.2 HIDDEN
  2842. ------------
  2843. For ELF targeted ports, define a symbol that will be hidden and won't be
  2844. exported. The syntax is 'HIDDEN(SYMBOL = EXPRESSION)'.
  2845. Here is the example from *note Simple Assignments::, rewritten to use
  2846. 'HIDDEN':
  2847. HIDDEN(floating_point = 0);
  2848. SECTIONS
  2849. {
  2850. .text :
  2851. {
  2852. *(.text)
  2853. HIDDEN(_etext = .);
  2854. }
  2855. HIDDEN(_bdata = (. + 3) & ~ 3);
  2856. .data : { *(.data) }
  2857. }
  2858. In this case none of the three symbols will be visible outside this
  2859. module.
  2860. 
  2861. File: ld.info, Node: PROVIDE, Next: PROVIDE_HIDDEN, Prev: HIDDEN, Up: Assignments
  2862. 3.5.3 PROVIDE
  2863. -------------
  2864. In some cases, it is desirable for a linker script to define a symbol
  2865. only if it is referenced and is not defined by any object included in
  2866. the link. For example, traditional linkers defined the symbol 'etext'.
  2867. However, ANSI C requires that the user be able to use 'etext' as a
  2868. function name without encountering an error. The 'PROVIDE' keyword may
  2869. be used to define a symbol, such as 'etext', only if it is referenced
  2870. but not defined. The syntax is 'PROVIDE(SYMBOL = EXPRESSION)'.
  2871. Here is an example of using 'PROVIDE' to define 'etext':
  2872. SECTIONS
  2873. {
  2874. .text :
  2875. {
  2876. *(.text)
  2877. _etext = .;
  2878. PROVIDE(etext = .);
  2879. }
  2880. }
  2881. In this example, if the program defines '_etext' (with a leading
  2882. underscore), the linker will give a multiple definition error. If, on
  2883. the other hand, the program defines 'etext' (with no leading
  2884. underscore), the linker will silently use the definition in the program.
  2885. If the program references 'etext' but does not define it, the linker
  2886. will use the definition in the linker script.
  2887. Note - the 'PROVIDE' directive considers a common symbol to be
  2888. defined, even though such a symbol could be combined with the symbol
  2889. that the 'PROVIDE' would create. This is particularly important when
  2890. considering constructor and destructor list symbols such as
  2891. '__CTOR_LIST__' as these are often defined as common symbols.
  2892. 
  2893. File: ld.info, Node: PROVIDE_HIDDEN, Next: Source Code Reference, Prev: PROVIDE, Up: Assignments
  2894. 3.5.4 PROVIDE_HIDDEN
  2895. --------------------
  2896. Similar to 'PROVIDE'. For ELF targeted ports, the symbol will be hidden
  2897. and won't be exported.
  2898. 
  2899. File: ld.info, Node: Source Code Reference, Prev: PROVIDE_HIDDEN, Up: Assignments
  2900. 3.5.5 Source Code Reference
  2901. ---------------------------
  2902. Accessing a linker script defined variable from source code is not
  2903. intuitive. In particular a linker script symbol is not equivalent to a
  2904. variable declaration in a high level language, it is instead a symbol
  2905. that does not have a value.
  2906. Before going further, it is important to note that compilers often
  2907. transform names in the source code into different names when they are
  2908. stored in the symbol table. For example, Fortran compilers commonly
  2909. prepend or append an underscore, and C++ performs extensive 'name
  2910. mangling'. Therefore there might be a discrepancy between the name of a
  2911. variable as it is used in source code and the name of the same variable
  2912. as it is defined in a linker script. For example in C a linker script
  2913. variable might be referred to as:
  2914. extern int foo;
  2915. But in the linker script it might be defined as:
  2916. _foo = 1000;
  2917. In the remaining examples however it is assumed that no name
  2918. transformation has taken place.
  2919. When a symbol is declared in a high level language such as C, two
  2920. things happen. The first is that the compiler reserves enough space in
  2921. the program's memory to hold the _value_ of the symbol. The second is
  2922. that the compiler creates an entry in the program's symbol table which
  2923. holds the symbol's _address_. ie the symbol table contains the address
  2924. of the block of memory holding the symbol's value. So for example the
  2925. following C declaration, at file scope:
  2926. int foo = 1000;
  2927. creates an entry called 'foo' in the symbol table. This entry holds
  2928. the address of an 'int' sized block of memory where the number 1000 is
  2929. initially stored.
  2930. When a program references a symbol the compiler generates code that
  2931. first accesses the symbol table to find the address of the symbol's
  2932. memory block and then code to read the value from that memory block.
  2933. So:
  2934. foo = 1;
  2935. looks up the symbol 'foo' in the symbol table, gets the address
  2936. associated with this symbol and then writes the value 1 into that
  2937. address. Whereas:
  2938. int * a = & foo;
  2939. looks up the symbol 'foo' in the symbol table, gets its address and
  2940. then copies this address into the block of memory associated with the
  2941. variable 'a'.
  2942. Linker scripts symbol declarations, by contrast, create an entry in
  2943. the symbol table but do not assign any memory to them. Thus they are an
  2944. address without a value. So for example the linker script definition:
  2945. foo = 1000;
  2946. creates an entry in the symbol table called 'foo' which holds the
  2947. address of memory location 1000, but nothing special is stored at
  2948. address 1000. This means that you cannot access the _value_ of a linker
  2949. script defined symbol - it has no value - all you can do is access the
  2950. _address_ of a linker script defined symbol.
  2951. Hence when you are using a linker script defined symbol in source
  2952. code you should always take the address of the symbol, and never attempt
  2953. to use its value. For example suppose you want to copy the contents of
  2954. a section of memory called .ROM into a section called .FLASH and the
  2955. linker script contains these declarations:
  2956. start_of_ROM = .ROM;
  2957. end_of_ROM = .ROM + sizeof (.ROM);
  2958. start_of_FLASH = .FLASH;
  2959. Then the C source code to perform the copy would be:
  2960. extern char start_of_ROM, end_of_ROM, start_of_FLASH;
  2961. memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM);
  2962. Note the use of the '&' operators. These are correct. Alternatively
  2963. the symbols can be treated as the names of vectors or arrays and then
  2964. the code will again work as expected:
  2965. extern char start_of_ROM[], end_of_ROM[], start_of_FLASH[];
  2966. memcpy (start_of_FLASH, start_of_ROM, end_of_ROM - start_of_ROM);
  2967. Note how using this method does not require the use of '&' operators.
  2968. 
  2969. File: ld.info, Node: SECTIONS, Next: MEMORY, Prev: Assignments, Up: Scripts
  2970. 3.6 SECTIONS Command
  2971. ====================
  2972. The 'SECTIONS' command tells the linker how to map input sections into
  2973. output sections, and how to place the output sections in memory.
  2974. The format of the 'SECTIONS' command is:
  2975. SECTIONS
  2976. {
  2977. SECTIONS-COMMAND
  2978. SECTIONS-COMMAND
  2979. ...
  2980. }
  2981. Each SECTIONS-COMMAND may of be one of the following:
  2982. * an 'ENTRY' command (*note Entry command: Entry Point.)
  2983. * a symbol assignment (*note Assignments::)
  2984. * an output section description
  2985. * an overlay description
  2986. The 'ENTRY' command and symbol assignments are permitted inside the
  2987. 'SECTIONS' command for convenience in using the location counter in
  2988. those commands. This can also make the linker script easier to
  2989. understand because you can use those commands at meaningful points in
  2990. the layout of the output file.
  2991. Output section descriptions and overlay descriptions are described
  2992. below.
  2993. If you do not use a 'SECTIONS' command in your linker script, the
  2994. linker will place each input section into an identically named output
  2995. section in the order that the sections are first encountered in the
  2996. input files. If all input sections are present in the first file, for
  2997. example, the order of sections in the output file will match the order
  2998. in the first input file. The first section will be at address zero.
  2999. * Menu:
  3000. * Output Section Description:: Output section description
  3001. * Output Section Name:: Output section name
  3002. * Output Section Address:: Output section address
  3003. * Input Section:: Input section description
  3004. * Output Section Data:: Output section data
  3005. * Output Section Keywords:: Output section keywords
  3006. * Output Section Discarding:: Output section discarding
  3007. * Output Section Attributes:: Output section attributes
  3008. * Overlay Description:: Overlay description
  3009. 
  3010. File: ld.info, Node: Output Section Description, Next: Output Section Name, Up: SECTIONS
  3011. 3.6.1 Output Section Description
  3012. --------------------------------
  3013. The full description of an output section looks like this:
  3014. SECTION [ADDRESS] [(TYPE)] :
  3015. [AT(LMA)]
  3016. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3017. [SUBALIGN(SUBSECTION_ALIGN)]
  3018. [CONSTRAINT]
  3019. {
  3020. OUTPUT-SECTION-COMMAND
  3021. OUTPUT-SECTION-COMMAND
  3022. ...
  3023. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP] [,]
  3024. Most output sections do not use most of the optional section
  3025. attributes.
  3026. The whitespace around SECTION is required, so that the section name
  3027. is unambiguous. The colon and the curly braces are also required. The
  3028. comma at the end may be required if a FILLEXP is used and the next
  3029. SECTIONS-COMMAND looks like a continuation of the expression. The line
  3030. breaks and other white space are optional.
  3031. Each OUTPUT-SECTION-COMMAND may be one of the following:
  3032. * a symbol assignment (*note Assignments::)
  3033. * an input section description (*note Input Section::)
  3034. * data values to include directly (*note Output Section Data::)
  3035. * a special output section keyword (*note Output Section Keywords::)
  3036. 
  3037. File: ld.info, Node: Output Section Name, Next: Output Section Address, Prev: Output Section Description, Up: SECTIONS
  3038. 3.6.2 Output Section Name
  3039. -------------------------
  3040. The name of the output section is SECTION. SECTION must meet the
  3041. constraints of your output format. In formats which only support a
  3042. limited number of sections, such as 'a.out', the name must be one of the
  3043. names supported by the format ('a.out', for example, allows only
  3044. '.text', '.data' or '.bss'). If the output format supports any number
  3045. of sections, but with numbers and not names (as is the case for Oasys),
  3046. the name should be supplied as a quoted numeric string. A section name
  3047. may consist of any sequence of characters, but a name which contains any
  3048. unusual characters such as commas must be quoted.
  3049. The output section name '/DISCARD/' is special; *note Output Section
  3050. Discarding::.
  3051. 
  3052. File: ld.info, Node: Output Section Address, Next: Input Section, Prev: Output Section Name, Up: SECTIONS
  3053. 3.6.3 Output Section Address
  3054. ----------------------------
  3055. The ADDRESS is an expression for the VMA (the virtual memory address) of
  3056. the output section. This address is optional, but if it is provided
  3057. then the output address will be set exactly as specified.
  3058. If the output address is not specified then one will be chosen for
  3059. the section, based on the heuristic below. This address will be
  3060. adjusted to fit the alignment requirement of the output section. The
  3061. alignment requirement is the strictest alignment of any input section
  3062. contained within the output section.
  3063. The output section address heuristic is as follows:
  3064. * If an output memory REGION is set for the section then it is added
  3065. to this region and its address will be the next free address in
  3066. that region.
  3067. * If the MEMORY command has been used to create a list of memory
  3068. regions then the first region which has attributes compatible with
  3069. the section is selected to contain it. The section's output
  3070. address will be the next free address in that region; *note
  3071. MEMORY::.
  3072. * If no memory regions were specified, or none match the section then
  3073. the output address will be based on the current value of the
  3074. location counter.
  3075. For example:
  3076. .text . : { *(.text) }
  3077. and
  3078. .text : { *(.text) }
  3079. are subtly different. The first will set the address of the '.text'
  3080. output section to the current value of the location counter. The second
  3081. will set it to the current value of the location counter aligned to the
  3082. strictest alignment of any of the '.text' input sections.
  3083. The ADDRESS may be an arbitrary expression; *note Expressions::. For
  3084. example, if you want to align the section on a 0x10 byte boundary, so
  3085. that the lowest four bits of the section address are zero, you could do
  3086. something like this:
  3087. .text ALIGN(0x10) : { *(.text) }
  3088. This works because 'ALIGN' returns the current location counter aligned
  3089. upward to the specified value.
  3090. Specifying ADDRESS for a section will change the value of the
  3091. location counter, provided that the section is non-empty. (Empty
  3092. sections are ignored).
  3093. 
  3094. File: ld.info, Node: Input Section, Next: Output Section Data, Prev: Output Section Address, Up: SECTIONS
  3095. 3.6.4 Input Section Description
  3096. -------------------------------
  3097. The most common output section command is an input section description.
  3098. The input section description is the most basic linker script
  3099. operation. You use output sections to tell the linker how to lay out
  3100. your program in memory. You use input section descriptions to tell the
  3101. linker how to map the input files into your memory layout.
  3102. * Menu:
  3103. * Input Section Basics:: Input section basics
  3104. * Input Section Wildcards:: Input section wildcard patterns
  3105. * Input Section Common:: Input section for common symbols
  3106. * Input Section Keep:: Input section and garbage collection
  3107. * Input Section Example:: Input section example
  3108. 
  3109. File: ld.info, Node: Input Section Basics, Next: Input Section Wildcards, Up: Input Section
  3110. 3.6.4.1 Input Section Basics
  3111. ............................
  3112. An input section description consists of a file name optionally followed
  3113. by a list of section names in parentheses.
  3114. The file name and the section name may be wildcard patterns, which we
  3115. describe further below (*note Input Section Wildcards::).
  3116. The most common input section description is to include all input
  3117. sections with a particular name in the output section. For example, to
  3118. include all input '.text' sections, you would write:
  3119. *(.text)
  3120. Here the '*' is a wildcard which matches any file name. To exclude a
  3121. list of files from matching the file name wildcard, EXCLUDE_FILE may be
  3122. used to match all files except the ones specified in the EXCLUDE_FILE
  3123. list. For example:
  3124. EXCLUDE_FILE (*crtend.o *otherfile.o) *(.ctors)
  3125. will cause all .ctors sections from all files except 'crtend.o' and
  3126. 'otherfile.o' to be included. The EXCLUDE_FILE can also be placed
  3127. inside the section list, for example:
  3128. *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)
  3129. The result of this is identically to the previous example. Supporting
  3130. two syntaxes for EXCLUDE_FILE is useful if the section list contains
  3131. more than one section, as described below.
  3132. There are two ways to include more than one section:
  3133. *(.text .rdata)
  3134. *(.text) *(.rdata)
  3135. The difference between these is the order in which the '.text' and
  3136. '.rdata' input sections will appear in the output section. In the first
  3137. example, they will be intermingled, appearing in the same order as they
  3138. are found in the linker input. In the second example, all '.text' input
  3139. sections will appear first, followed by all '.rdata' input sections.
  3140. When using EXCLUDE_FILE with more than one section, if the exclusion
  3141. is within the section list then the exclusion only applies to the
  3142. immediately following section, for example:
  3143. *(EXCLUDE_FILE (*somefile.o) .text .rdata)
  3144. will cause all '.text' sections from all files except 'somefile.o' to be
  3145. included, while all '.rdata' sections from all files, including
  3146. 'somefile.o', will be included. To exclude the '.rdata' sections from
  3147. 'somefile.o' the example could be modified to:
  3148. *(EXCLUDE_FILE (*somefile.o) .text EXCLUDE_FILE (*somefile.o) .rdata)
  3149. Alternatively, placing the EXCLUDE_FILE outside of the section list,
  3150. before the input file selection, will cause the exclusion to apply for
  3151. all sections. Thus the previous example can be rewritten as:
  3152. EXCLUDE_FILE (*somefile.o) *(.text .rdata)
  3153. You can specify a file name to include sections from a particular
  3154. file. You would do this if one or more of your files contain special
  3155. data that needs to be at a particular location in memory. For example:
  3156. data.o(.data)
  3157. To refine the sections that are included based on the section flags
  3158. of an input section, INPUT_SECTION_FLAGS may be used.
  3159. Here is a simple example for using Section header flags for ELF
  3160. sections:
  3161. SECTIONS {
  3162. .text : { INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS) *(.text) }
  3163. .text2 : { INPUT_SECTION_FLAGS (!SHF_WRITE) *(.text) }
  3164. }
  3165. In this example, the output section '.text' will be comprised of any
  3166. input section matching the name *(.text) whose section header flags
  3167. 'SHF_MERGE' and 'SHF_STRINGS' are set. The output section '.text2' will
  3168. be comprised of any input section matching the name *(.text) whose
  3169. section header flag 'SHF_WRITE' is clear.
  3170. You can also specify files within archives by writing a pattern
  3171. matching the archive, a colon, then the pattern matching the file, with
  3172. no whitespace around the colon.
  3173. 'archive:file'
  3174. matches file within archive
  3175. 'archive:'
  3176. matches the whole archive
  3177. ':file'
  3178. matches file but not one in an archive
  3179. Either one or both of 'archive' and 'file' can contain shell
  3180. wildcards. On DOS based file systems, the linker will assume that a
  3181. single letter followed by a colon is a drive specifier, so 'c:myfile.o'
  3182. is a simple file specification, not 'myfile.o' within an archive called
  3183. 'c'. 'archive:file' filespecs may also be used within an 'EXCLUDE_FILE'
  3184. list, but may not appear in other linker script contexts. For instance,
  3185. you cannot extract a file from an archive by using 'archive:file' in an
  3186. 'INPUT' command.
  3187. If you use a file name without a list of sections, then all sections
  3188. in the input file will be included in the output section. This is not
  3189. commonly done, but it may by useful on occasion. For example:
  3190. data.o
  3191. When you use a file name which is not an 'archive:file' specifier and
  3192. does not contain any wild card characters, the linker will first see if
  3193. you also specified the file name on the linker command line or in an
  3194. 'INPUT' command. If you did not, the linker will attempt to open the
  3195. file as an input file, as though it appeared on the command line. Note
  3196. that this differs from an 'INPUT' command, because the linker will not
  3197. search for the file in the archive search path.
  3198. 
  3199. File: ld.info, Node: Input Section Wildcards, Next: Input Section Common, Prev: Input Section Basics, Up: Input Section
  3200. 3.6.4.2 Input Section Wildcard Patterns
  3201. .......................................
  3202. In an input section description, either the file name or the section
  3203. name or both may be wildcard patterns.
  3204. The file name of '*' seen in many examples is a simple wildcard
  3205. pattern for the file name.
  3206. The wildcard patterns are like those used by the Unix shell.
  3207. '*'
  3208. matches any number of characters
  3209. '?'
  3210. matches any single character
  3211. '[CHARS]'
  3212. matches a single instance of any of the CHARS; the '-' character
  3213. may be used to specify a range of characters, as in '[a-z]' to
  3214. match any lower case letter
  3215. '\'
  3216. quotes the following character
  3217. When a file name is matched with a wildcard, the wildcard characters
  3218. will not match a '/' character (used to separate directory names on
  3219. Unix). A pattern consisting of a single '*' character is an exception;
  3220. it will always match any file name, whether it contains a '/' or not.
  3221. In a section name, the wildcard characters will match a '/' character.
  3222. File name wildcard patterns only match files which are explicitly
  3223. specified on the command line or in an 'INPUT' command. The linker does
  3224. not search directories to expand wildcards.
  3225. If a file name matches more than one wildcard pattern, or if a file
  3226. name appears explicitly and is also matched by a wildcard pattern, the
  3227. linker will use the first match in the linker script. For example, this
  3228. sequence of input section descriptions is probably in error, because the
  3229. 'data.o' rule will not be used:
  3230. .data : { *(.data) }
  3231. .data1 : { data.o(.data) }
  3232. Normally, the linker will place files and sections matched by
  3233. wildcards in the order in which they are seen during the link. You can
  3234. change this by using the 'SORT_BY_NAME' keyword, which appears before a
  3235. wildcard pattern in parentheses (e.g., 'SORT_BY_NAME(.text*)'). When
  3236. the 'SORT_BY_NAME' keyword is used, the linker will sort the files or
  3237. sections into ascending order by name before placing them in the output
  3238. file.
  3239. 'SORT_BY_ALIGNMENT' is similar to 'SORT_BY_NAME'.
  3240. 'SORT_BY_ALIGNMENT' will sort sections into descending order of
  3241. alignment before placing them in the output file. Placing larger
  3242. alignments before smaller alignments can reduce the amount of padding
  3243. needed.
  3244. 'SORT_BY_INIT_PRIORITY' is also similar to 'SORT_BY_NAME'.
  3245. 'SORT_BY_INIT_PRIORITY' will sort sections into ascending numerical
  3246. order of the GCC init_priority attribute encoded in the section name
  3247. before placing them in the output file. In '.init_array.NNNNN' and
  3248. '.fini_array.NNNNN', 'NNNNN' is the init_priority. In '.ctors.NNNNN'
  3249. and '.dtors.NNNNN', 'NNNNN' is 65535 minus the init_priority.
  3250. 'SORT' is an alias for 'SORT_BY_NAME'.
  3251. When there are nested section sorting commands in linker script,
  3252. there can be at most 1 level of nesting for section sorting commands.
  3253. 1. 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT' (wildcard section pattern)).
  3254. It will sort the input sections by name first, then by alignment if
  3255. two sections have the same name.
  3256. 2. 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME' (wildcard section pattern)).
  3257. It will sort the input sections by alignment first, then by name if
  3258. two sections have the same alignment.
  3259. 3. 'SORT_BY_NAME' ('SORT_BY_NAME' (wildcard section pattern)) is
  3260. treated the same as 'SORT_BY_NAME' (wildcard section pattern).
  3261. 4. 'SORT_BY_ALIGNMENT' ('SORT_BY_ALIGNMENT' (wildcard section
  3262. pattern)) is treated the same as 'SORT_BY_ALIGNMENT' (wildcard
  3263. section pattern).
  3264. 5. All other nested section sorting commands are invalid.
  3265. When both command-line section sorting option and linker script
  3266. section sorting command are used, section sorting command always takes
  3267. precedence over the command-line option.
  3268. If the section sorting command in linker script isn't nested, the
  3269. command-line option will make the section sorting command to be treated
  3270. as nested sorting command.
  3271. 1. 'SORT_BY_NAME' (wildcard section pattern ) with '--sort-sections
  3272. alignment' is equivalent to 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT'
  3273. (wildcard section pattern)).
  3274. 2. 'SORT_BY_ALIGNMENT' (wildcard section pattern) with '--sort-section
  3275. name' is equivalent to 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME'
  3276. (wildcard section pattern)).
  3277. If the section sorting command in linker script is nested, the
  3278. command-line option will be ignored.
  3279. 'SORT_NONE' disables section sorting by ignoring the command-line
  3280. section sorting option.
  3281. If you ever get confused about where input sections are going, use
  3282. the '-M' linker option to generate a map file. The map file shows
  3283. precisely how input sections are mapped to output sections.
  3284. This example shows how wildcard patterns might be used to partition
  3285. files. This linker script directs the linker to place all '.text'
  3286. sections in '.text' and all '.bss' sections in '.bss'. The linker will
  3287. place the '.data' section from all files beginning with an upper case
  3288. character in '.DATA'; for all other files, the linker will place the
  3289. '.data' section in '.data'.
  3290. SECTIONS {
  3291. .text : { *(.text) }
  3292. .DATA : { [A-Z]*(.data) }
  3293. .data : { *(.data) }
  3294. .bss : { *(.bss) }
  3295. }
  3296. 
  3297. File: ld.info, Node: Input Section Common, Next: Input Section Keep, Prev: Input Section Wildcards, Up: Input Section
  3298. 3.6.4.3 Input Section for Common Symbols
  3299. ........................................
  3300. A special notation is needed for common symbols, because in many object
  3301. file formats common symbols do not have a particular input section. The
  3302. linker treats common symbols as though they are in an input section
  3303. named 'COMMON'.
  3304. You may use file names with the 'COMMON' section just as with any
  3305. other input sections. You can use this to place common symbols from a
  3306. particular input file in one section while common symbols from other
  3307. input files are placed in another section.
  3308. In most cases, common symbols in input files will be placed in the
  3309. '.bss' section in the output file. For example:
  3310. .bss { *(.bss) *(COMMON) }
  3311. Some object file formats have more than one type of common symbol.
  3312. For example, the MIPS ELF object file format distinguishes standard
  3313. common symbols and small common symbols. In this case, the linker will
  3314. use a different special section name for other types of common symbols.
  3315. In the case of MIPS ELF, the linker uses 'COMMON' for standard common
  3316. symbols and '.scommon' for small common symbols. This permits you to
  3317. map the different types of common symbols into memory at different
  3318. locations.
  3319. You will sometimes see '[COMMON]' in old linker scripts. This
  3320. notation is now considered obsolete. It is equivalent to '*(COMMON)'.
  3321. 
  3322. File: ld.info, Node: Input Section Keep, Next: Input Section Example, Prev: Input Section Common, Up: Input Section
  3323. 3.6.4.4 Input Section and Garbage Collection
  3324. ............................................
  3325. When link-time garbage collection is in use ('--gc-sections'), it is
  3326. often useful to mark sections that should not be eliminated. This is
  3327. accomplished by surrounding an input section's wildcard entry with
  3328. 'KEEP()', as in 'KEEP(*(.init))' or 'KEEP(SORT_BY_NAME(*)(.ctors))'.
  3329. 
  3330. File: ld.info, Node: Input Section Example, Prev: Input Section Keep, Up: Input Section
  3331. 3.6.4.5 Input Section Example
  3332. .............................
  3333. The following example is a complete linker script. It tells the linker
  3334. to read all of the sections from file 'all.o' and place them at the
  3335. start of output section 'outputa' which starts at location '0x10000'.
  3336. All of section '.input1' from file 'foo.o' follows immediately, in the
  3337. same output section. All of section '.input2' from 'foo.o' goes into
  3338. output section 'outputb', followed by section '.input1' from 'foo1.o'.
  3339. All of the remaining '.input1' and '.input2' sections from any files are
  3340. written to output section 'outputc'.
  3341. SECTIONS {
  3342. outputa 0x10000 :
  3343. {
  3344. all.o
  3345. foo.o (.input1)
  3346. }
  3347. outputb :
  3348. {
  3349. foo.o (.input2)
  3350. foo1.o (.input1)
  3351. }
  3352. outputc :
  3353. {
  3354. *(.input1)
  3355. *(.input2)
  3356. }
  3357. }
  3358. If an output section's name is the same as the input section's name
  3359. and is representable as a C identifier, then the linker will
  3360. automatically *note PROVIDE:: two symbols: __start_SECNAME and
  3361. __stop_SECNAME, where SECNAME is the name of the section. These
  3362. indicate the start address and end address of the output section
  3363. respectively. Note: most section names are not representable as C
  3364. identifiers because they contain a '.' character.
  3365. 
  3366. File: ld.info, Node: Output Section Data, Next: Output Section Keywords, Prev: Input Section, Up: SECTIONS
  3367. 3.6.5 Output Section Data
  3368. -------------------------
  3369. You can include explicit bytes of data in an output section by using
  3370. 'BYTE', 'SHORT', 'LONG', 'QUAD', or 'SQUAD' as an output section
  3371. command. Each keyword is followed by an expression in parentheses
  3372. providing the value to store (*note Expressions::). The value of the
  3373. expression is stored at the current value of the location counter.
  3374. The 'BYTE', 'SHORT', 'LONG', and 'QUAD' commands store one, two,
  3375. four, and eight bytes (respectively). After storing the bytes, the
  3376. location counter is incremented by the number of bytes stored.
  3377. For example, this will store the byte 1 followed by the four byte
  3378. value of the symbol 'addr':
  3379. BYTE(1)
  3380. LONG(addr)
  3381. When using a 64 bit host or target, 'QUAD' and 'SQUAD' are the same;
  3382. they both store an 8 byte, or 64 bit, value. When both host and target
  3383. are 32 bits, an expression is computed as 32 bits. In this case 'QUAD'
  3384. stores a 32 bit value zero extended to 64 bits, and 'SQUAD' stores a 32
  3385. bit value sign extended to 64 bits.
  3386. If the object file format of the output file has an explicit
  3387. endianness, which is the normal case, the value will be stored in that
  3388. endianness. When the object file format does not have an explicit
  3389. endianness, as is true of, for example, S-records, the value will be
  3390. stored in the endianness of the first input object file.
  3391. Note--these commands only work inside a section description and not
  3392. between them, so the following will produce an error from the linker:
  3393. SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }
  3394. whereas this will work:
  3395. SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }
  3396. You may use the 'FILL' command to set the fill pattern for the
  3397. current section. It is followed by an expression in parentheses. Any
  3398. otherwise unspecified regions of memory within the section (for example,
  3399. gaps left due to the required alignment of input sections) are filled
  3400. with the value of the expression, repeated as necessary. A 'FILL'
  3401. statement covers memory locations after the point at which it occurs in
  3402. the section definition; by including more than one 'FILL' statement, you
  3403. can have different fill patterns in different parts of an output
  3404. section.
  3405. This example shows how to fill unspecified regions of memory with the
  3406. value '0x90':
  3407. FILL(0x90909090)
  3408. The 'FILL' command is similar to the '=FILLEXP' output section
  3409. attribute, but it only affects the part of the section following the
  3410. 'FILL' command, rather than the entire section. If both are used, the
  3411. 'FILL' command takes precedence. *Note Output Section Fill::, for
  3412. details on the fill expression.
  3413. 
  3414. File: ld.info, Node: Output Section Keywords, Next: Output Section Discarding, Prev: Output Section Data, Up: SECTIONS
  3415. 3.6.6 Output Section Keywords
  3416. -----------------------------
  3417. There are a couple of keywords which can appear as output section
  3418. commands.
  3419. 'CREATE_OBJECT_SYMBOLS'
  3420. The command tells the linker to create a symbol for each input
  3421. file. The name of each symbol will be the name of the
  3422. corresponding input file. The section of each symbol will be the
  3423. output section in which the 'CREATE_OBJECT_SYMBOLS' command
  3424. appears.
  3425. This is conventional for the a.out object file format. It is not
  3426. normally used for any other object file format.
  3427. 'CONSTRUCTORS'
  3428. When linking using the a.out object file format, the linker uses an
  3429. unusual set construct to support C++ global constructors and
  3430. destructors. When linking object file formats which do not support
  3431. arbitrary sections, such as ECOFF and XCOFF, the linker will
  3432. automatically recognize C++ global constructors and destructors by
  3433. name. For these object file formats, the 'CONSTRUCTORS' command
  3434. tells the linker to place constructor information in the output
  3435. section where the 'CONSTRUCTORS' command appears. The
  3436. 'CONSTRUCTORS' command is ignored for other object file formats.
  3437. The symbol '__CTOR_LIST__' marks the start of the global
  3438. constructors, and the symbol '__CTOR_END__' marks the end.
  3439. Similarly, '__DTOR_LIST__' and '__DTOR_END__' mark the start and
  3440. end of the global destructors. The first word in the list is the
  3441. number of entries, followed by the address of each constructor or
  3442. destructor, followed by a zero word. The compiler must arrange to
  3443. actually run the code. For these object file formats GNU C++
  3444. normally calls constructors from a subroutine '__main'; a call to
  3445. '__main' is automatically inserted into the startup code for
  3446. 'main'. GNU C++ normally runs destructors either by using
  3447. 'atexit', or directly from the function 'exit'.
  3448. For object file formats such as 'COFF' or 'ELF' which support
  3449. arbitrary section names, GNU C++ will normally arrange to put the
  3450. addresses of global constructors and destructors into the '.ctors'
  3451. and '.dtors' sections. Placing the following sequence into your
  3452. linker script will build the sort of table which the GNU C++
  3453. runtime code expects to see.
  3454. __CTOR_LIST__ = .;
  3455. LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  3456. *(.ctors)
  3457. LONG(0)
  3458. __CTOR_END__ = .;
  3459. __DTOR_LIST__ = .;
  3460. LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
  3461. *(.dtors)
  3462. LONG(0)
  3463. __DTOR_END__ = .;
  3464. If you are using the GNU C++ support for initialization priority,
  3465. which provides some control over the order in which global
  3466. constructors are run, you must sort the constructors at link time
  3467. to ensure that they are executed in the correct order. When using
  3468. the 'CONSTRUCTORS' command, use 'SORT_BY_NAME(CONSTRUCTORS)'
  3469. instead. When using the '.ctors' and '.dtors' sections, use
  3470. '*(SORT_BY_NAME(.ctors))' and '*(SORT_BY_NAME(.dtors))' instead of
  3471. just '*(.ctors)' and '*(.dtors)'.
  3472. Normally the compiler and linker will handle these issues
  3473. automatically, and you will not need to concern yourself with them.
  3474. However, you may need to consider this if you are using C++ and
  3475. writing your own linker scripts.
  3476. 
  3477. File: ld.info, Node: Output Section Discarding, Next: Output Section Attributes, Prev: Output Section Keywords, Up: SECTIONS
  3478. 3.6.7 Output Section Discarding
  3479. -------------------------------
  3480. The linker will not normally create output sections with no contents.
  3481. This is for convenience when referring to input sections that may or may
  3482. not be present in any of the input files. For example:
  3483. .foo : { *(.foo) }
  3484. will only create a '.foo' section in the output file if there is a
  3485. '.foo' section in at least one input file, and if the input sections are
  3486. not all empty. Other link script directives that allocate space in an
  3487. output section will also create the output section. So too will
  3488. assignments to dot even if the assignment does not create space, except
  3489. for '. = 0', '. = . + 0', '. = sym', '. = . + sym' and '. = ALIGN (. !=
  3490. 0, expr, 1)' when 'sym' is an absolute symbol of value 0 defined in the
  3491. script. This allows you to force output of an empty section with '. =
  3492. .'.
  3493. The linker will ignore address assignments (*note Output Section
  3494. Address::) on discarded output sections, except when the linker script
  3495. defines symbols in the output section. In that case the linker will
  3496. obey the address assignments, possibly advancing dot even though the
  3497. section is discarded.
  3498. The special output section name '/DISCARD/' may be used to discard
  3499. input sections. Any input sections which are assigned to an output
  3500. section named '/DISCARD/' are not included in the output file.
  3501. Note, sections that match the '/DISCARD/' output section will be
  3502. discarded even if they are in an ELF section group which has other
  3503. members which are not being discarded. This is deliberate. Discarding
  3504. takes precedence over grouping.
  3505. 
  3506. File: ld.info, Node: Output Section Attributes, Next: Overlay Description, Prev: Output Section Discarding, Up: SECTIONS
  3507. 3.6.8 Output Section Attributes
  3508. -------------------------------
  3509. We showed above that the full description of an output section looked
  3510. like this:
  3511. SECTION [ADDRESS] [(TYPE)] :
  3512. [AT(LMA)]
  3513. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3514. [SUBALIGN(SUBSECTION_ALIGN)]
  3515. [CONSTRAINT]
  3516. {
  3517. OUTPUT-SECTION-COMMAND
  3518. OUTPUT-SECTION-COMMAND
  3519. ...
  3520. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP]
  3521. We've already described SECTION, ADDRESS, and OUTPUT-SECTION-COMMAND.
  3522. In this section we will describe the remaining section attributes.
  3523. * Menu:
  3524. * Output Section Type:: Output section type
  3525. * Output Section LMA:: Output section LMA
  3526. * Forced Output Alignment:: Forced Output Alignment
  3527. * Forced Input Alignment:: Forced Input Alignment
  3528. * Output Section Constraint:: Output section constraint
  3529. * Output Section Region:: Output section region
  3530. * Output Section Phdr:: Output section phdr
  3531. * Output Section Fill:: Output section fill
  3532. 
  3533. File: ld.info, Node: Output Section Type, Next: Output Section LMA, Up: Output Section Attributes
  3534. 3.6.8.1 Output Section Type
  3535. ...........................
  3536. Each output section may have a type. The type is a keyword in
  3537. parentheses. The following types are defined:
  3538. 'NOLOAD'
  3539. The section should be marked as not loadable, so that it will not
  3540. be loaded into memory when the program is run.
  3541. 'DSECT'
  3542. 'COPY'
  3543. 'INFO'
  3544. 'OVERLAY'
  3545. These type names are supported for backward compatibility, and are
  3546. rarely used. They all have the same effect: the section should be
  3547. marked as not allocatable, so that no memory is allocated for the
  3548. section when the program is run.
  3549. The linker normally sets the attributes of an output section based on
  3550. the input sections which map into it. You can override this by using
  3551. the section type. For example, in the script sample below, the 'ROM'
  3552. section is addressed at memory location '0' and does not need to be
  3553. loaded when the program is run.
  3554. SECTIONS {
  3555. ROM 0 (NOLOAD) : { ... }
  3556. ...
  3557. }
  3558. 
  3559. File: ld.info, Node: Output Section LMA, Next: Forced Output Alignment, Prev: Output Section Type, Up: Output Section Attributes
  3560. 3.6.8.2 Output Section LMA
  3561. ..........................
  3562. Every section has a virtual address (VMA) and a load address (LMA); see
  3563. *note Basic Script Concepts::. The virtual address is specified by the
  3564. *note Output Section Address:: described earlier. The load address is
  3565. specified by the 'AT' or 'AT>' keywords. Specifying a load address is
  3566. optional.
  3567. The 'AT' keyword takes an expression as an argument. This specifies
  3568. the exact load address of the section. The 'AT>' keyword takes the name
  3569. of a memory region as an argument. *Note MEMORY::. The load address of
  3570. the section is set to the next free address in the region, aligned to
  3571. the section's alignment requirements.
  3572. If neither 'AT' nor 'AT>' is specified for an allocatable section,
  3573. the linker will use the following heuristic to determine the load
  3574. address:
  3575. * If the section has a specific VMA address, then this is used as the
  3576. LMA address as well.
  3577. * If the section is not allocatable then its LMA is set to its VMA.
  3578. * Otherwise if a memory region can be found that is compatible with
  3579. the current section, and this region contains at least one section,
  3580. then the LMA is set so the difference between the VMA and LMA is
  3581. the same as the difference between the VMA and LMA of the last
  3582. section in the located region.
  3583. * If no memory regions have been declared then a default region that
  3584. covers the entire address space is used in the previous step.
  3585. * If no suitable region could be found, or there was no previous
  3586. section then the LMA is set equal to the VMA.
  3587. This feature is designed to make it easy to build a ROM image. For
  3588. example, the following linker script creates three output sections: one
  3589. called '.text', which starts at '0x1000', one called '.mdata', which is
  3590. loaded at the end of the '.text' section even though its VMA is
  3591. '0x2000', and one called '.bss' to hold uninitialized data at address
  3592. '0x3000'. The symbol '_data' is defined with the value '0x2000', which
  3593. shows that the location counter holds the VMA value, not the LMA value.
  3594. SECTIONS
  3595. {
  3596. .text 0x1000 : { *(.text) _etext = . ; }
  3597. .mdata 0x2000 :
  3598. AT ( ADDR (.text) + SIZEOF (.text) )
  3599. { _data = . ; *(.data); _edata = . ; }
  3600. .bss 0x3000 :
  3601. { _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;}
  3602. }
  3603. The run-time initialization code for use with a program generated
  3604. with this linker script would include something like the following, to
  3605. copy the initialized data from the ROM image to its runtime address.
  3606. Notice how this code takes advantage of the symbols defined by the
  3607. linker script.
  3608. extern char _etext, _data, _edata, _bstart, _bend;
  3609. char *src = &_etext;
  3610. char *dst = &_data;
  3611. /* ROM has data at end of text; copy it. */
  3612. while (dst < &_edata)
  3613. *dst++ = *src++;
  3614. /* Zero bss. */
  3615. for (dst = &_bstart; dst< &_bend; dst++)
  3616. *dst = 0;
  3617. 
  3618. File: ld.info, Node: Forced Output Alignment, Next: Forced Input Alignment, Prev: Output Section LMA, Up: Output Section Attributes
  3619. 3.6.8.3 Forced Output Alignment
  3620. ...............................
  3621. You can increase an output section's alignment by using ALIGN. As an
  3622. alternative you can enforce that the difference between the VMA and LMA
  3623. remains intact throughout this output section with the ALIGN_WITH_INPUT
  3624. attribute.
  3625. 
  3626. File: ld.info, Node: Forced Input Alignment, Next: Output Section Constraint, Prev: Forced Output Alignment, Up: Output Section Attributes
  3627. 3.6.8.4 Forced Input Alignment
  3628. ..............................
  3629. You can force input section alignment within an output section by using
  3630. SUBALIGN. The value specified overrides any alignment given by input
  3631. sections, whether larger or smaller.
  3632. 
  3633. File: ld.info, Node: Output Section Constraint, Next: Output Section Region, Prev: Forced Input Alignment, Up: Output Section Attributes
  3634. 3.6.8.5 Output Section Constraint
  3635. .................................
  3636. You can specify that an output section should only be created if all of
  3637. its input sections are read-only or all of its input sections are
  3638. read-write by using the keyword 'ONLY_IF_RO' and 'ONLY_IF_RW'
  3639. respectively.
  3640. 
  3641. File: ld.info, Node: Output Section Region, Next: Output Section Phdr, Prev: Output Section Constraint, Up: Output Section Attributes
  3642. 3.6.8.6 Output Section Region
  3643. .............................
  3644. You can assign a section to a previously defined region of memory by
  3645. using '>REGION'. *Note MEMORY::.
  3646. Here is a simple example:
  3647. MEMORY { rom : ORIGIN = 0x1000, LENGTH = 0x1000 }
  3648. SECTIONS { ROM : { *(.text) } >rom }
  3649. 
  3650. File: ld.info, Node: Output Section Phdr, Next: Output Section Fill, Prev: Output Section Region, Up: Output Section Attributes
  3651. 3.6.8.7 Output Section Phdr
  3652. ...........................
  3653. You can assign a section to a previously defined program segment by
  3654. using ':PHDR'. *Note PHDRS::. If a section is assigned to one or more
  3655. segments, then all subsequent allocated sections will be assigned to
  3656. those segments as well, unless they use an explicitly ':PHDR' modifier.
  3657. You can use ':NONE' to tell the linker to not put the section in any
  3658. segment at all.
  3659. Here is a simple example:
  3660. PHDRS { text PT_LOAD ; }
  3661. SECTIONS { .text : { *(.text) } :text }
  3662. 
  3663. File: ld.info, Node: Output Section Fill, Prev: Output Section Phdr, Up: Output Section Attributes
  3664. 3.6.8.8 Output Section Fill
  3665. ...........................
  3666. You can set the fill pattern for an entire section by using '=FILLEXP'.
  3667. FILLEXP is an expression (*note Expressions::). Any otherwise
  3668. unspecified regions of memory within the output section (for example,
  3669. gaps left due to the required alignment of input sections) will be
  3670. filled with the value, repeated as necessary. If the fill expression is
  3671. a simple hex number, ie. a string of hex digit starting with '0x' and
  3672. without a trailing 'k' or 'M', then an arbitrarily long sequence of hex
  3673. digits can be used to specify the fill pattern; Leading zeros become
  3674. part of the pattern too. For all other cases, including extra
  3675. parentheses or a unary '+', the fill pattern is the four least
  3676. significant bytes of the value of the expression. In all cases, the
  3677. number is big-endian.
  3678. You can also change the fill value with a 'FILL' command in the
  3679. output section commands; (*note Output Section Data::).
  3680. Here is a simple example:
  3681. SECTIONS { .text : { *(.text) } =0x90909090 }
  3682. 
  3683. File: ld.info, Node: Overlay Description, Prev: Output Section Attributes, Up: SECTIONS
  3684. 3.6.9 Overlay Description
  3685. -------------------------
  3686. An overlay description provides an easy way to describe sections which
  3687. are to be loaded as part of a single memory image but are to be run at
  3688. the same memory address. At run time, some sort of overlay manager will
  3689. copy the overlaid sections in and out of the runtime memory address as
  3690. required, perhaps by simply manipulating addressing bits. This approach
  3691. can be useful, for example, when a certain region of memory is faster
  3692. than another.
  3693. Overlays are described using the 'OVERLAY' command. The 'OVERLAY'
  3694. command is used within a 'SECTIONS' command, like an output section
  3695. description. The full syntax of the 'OVERLAY' command is as follows:
  3696. OVERLAY [START] : [NOCROSSREFS] [AT ( LDADDR )]
  3697. {
  3698. SECNAME1
  3699. {
  3700. OUTPUT-SECTION-COMMAND
  3701. OUTPUT-SECTION-COMMAND
  3702. ...
  3703. } [:PHDR...] [=FILL]
  3704. SECNAME2
  3705. {
  3706. OUTPUT-SECTION-COMMAND
  3707. OUTPUT-SECTION-COMMAND
  3708. ...
  3709. } [:PHDR...] [=FILL]
  3710. ...
  3711. } [>REGION] [:PHDR...] [=FILL] [,]
  3712. Everything is optional except 'OVERLAY' (a keyword), and each section
  3713. must have a name (SECNAME1 and SECNAME2 above). The section definitions
  3714. within the 'OVERLAY' construct are identical to those within the general
  3715. 'SECTIONS' construct (*note SECTIONS::), except that no addresses and no
  3716. memory regions may be defined for sections within an 'OVERLAY'.
  3717. The comma at the end may be required if a FILL is used and the next
  3718. SECTIONS-COMMAND looks like a continuation of the expression.
  3719. The sections are all defined with the same starting address. The
  3720. load addresses of the sections are arranged such that they are
  3721. consecutive in memory starting at the load address used for the
  3722. 'OVERLAY' as a whole (as with normal section definitions, the load
  3723. address is optional, and defaults to the start address; the start
  3724. address is also optional, and defaults to the current value of the
  3725. location counter).
  3726. If the 'NOCROSSREFS' keyword is used, and there are any references
  3727. among the sections, the linker will report an error. Since the sections
  3728. all run at the same address, it normally does not make sense for one
  3729. section to refer directly to another. *Note NOCROSSREFS: Miscellaneous
  3730. Commands.
  3731. For each section within the 'OVERLAY', the linker automatically
  3732. provides two symbols. The symbol '__load_start_SECNAME' is defined as
  3733. the starting load address of the section. The symbol
  3734. '__load_stop_SECNAME' is defined as the final load address of the
  3735. section. Any characters within SECNAME which are not legal within C
  3736. identifiers are removed. C (or assembler) code may use these symbols to
  3737. move the overlaid sections around as necessary.
  3738. At the end of the overlay, the value of the location counter is set
  3739. to the start address of the overlay plus the size of the largest
  3740. section.
  3741. Here is an example. Remember that this would appear inside a
  3742. 'SECTIONS' construct.
  3743. OVERLAY 0x1000 : AT (0x4000)
  3744. {
  3745. .text0 { o1/*.o(.text) }
  3746. .text1 { o2/*.o(.text) }
  3747. }
  3748. This will define both '.text0' and '.text1' to start at address 0x1000.
  3749. '.text0' will be loaded at address 0x4000, and '.text1' will be loaded
  3750. immediately after '.text0'. The following symbols will be defined if
  3751. referenced: '__load_start_text0', '__load_stop_text0',
  3752. '__load_start_text1', '__load_stop_text1'.
  3753. C code to copy overlay '.text1' into the overlay area might look like
  3754. the following.
  3755. extern char __load_start_text1, __load_stop_text1;
  3756. memcpy ((char *) 0x1000, &__load_start_text1,
  3757. &__load_stop_text1 - &__load_start_text1);
  3758. Note that the 'OVERLAY' command is just syntactic sugar, since
  3759. everything it does can be done using the more basic commands. The above
  3760. example could have been written identically as follows.
  3761. .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
  3762. PROVIDE (__load_start_text0 = LOADADDR (.text0));
  3763. PROVIDE (__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0));
  3764. .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
  3765. PROVIDE (__load_start_text1 = LOADADDR (.text1));
  3766. PROVIDE (__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1));
  3767. . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
  3768. 
  3769. File: ld.info, Node: MEMORY, Next: PHDRS, Prev: SECTIONS, Up: Scripts
  3770. 3.7 MEMORY Command
  3771. ==================
  3772. The linker's default configuration permits allocation of all available
  3773. memory. You can override this by using the 'MEMORY' command.
  3774. The 'MEMORY' command describes the location and size of blocks of
  3775. memory in the target. You can use it to describe which memory regions
  3776. may be used by the linker, and which memory regions it must avoid. You
  3777. can then assign sections to particular memory regions. The linker will
  3778. set section addresses based on the memory regions, and will warn about
  3779. regions that become too full. The linker will not shuffle sections
  3780. around to fit into the available regions.
  3781. A linker script may contain many uses of the 'MEMORY' command,
  3782. however, all memory blocks defined are treated as if they were specified
  3783. inside a single 'MEMORY' command. The syntax for 'MEMORY' is:
  3784. MEMORY
  3785. {
  3786. NAME [(ATTR)] : ORIGIN = ORIGIN, LENGTH = LEN
  3787. ...
  3788. }
  3789. The NAME is a name used in the linker script to refer to the region.
  3790. The region name has no meaning outside of the linker script. Region
  3791. names are stored in a separate name space, and will not conflict with
  3792. symbol names, file names, or section names. Each memory region must
  3793. have a distinct name within the 'MEMORY' command. However you can add
  3794. later alias names to existing memory regions with the *note
  3795. REGION_ALIAS:: command.
  3796. The ATTR string is an optional list of attributes that specify
  3797. whether to use a particular memory region for an input section which is
  3798. not explicitly mapped in the linker script. As described in *note
  3799. SECTIONS::, if you do not specify an output section for some input
  3800. section, the linker will create an output section with the same name as
  3801. the input section. If you define region attributes, the linker will use
  3802. them to select the memory region for the output section that it creates.
  3803. The ATTR string must consist only of the following characters:
  3804. 'R'
  3805. Read-only section
  3806. 'W'
  3807. Read/write section
  3808. 'X'
  3809. Executable section
  3810. 'A'
  3811. Allocatable section
  3812. 'I'
  3813. Initialized section
  3814. 'L'
  3815. Same as 'I'
  3816. '!'
  3817. Invert the sense of any of the attributes that follow
  3818. If an unmapped section matches any of the listed attributes other
  3819. than '!', it will be placed in the memory region. The '!' attribute
  3820. reverses the test for the characters that follow, so that an unmapped
  3821. section will be placed in the memory region only if it does not match
  3822. any of the attributes listed afterwards. Thus an attribute string of
  3823. 'RW!X' will match any unmapped section that has either or both of the
  3824. 'R' and 'W' attributes, but only as long as the section does not also
  3825. have the 'X' attribute.
  3826. The ORIGIN is an numerical expression for the start address of the
  3827. memory region. The expression must evaluate to a constant and it cannot
  3828. involve any symbols. The keyword 'ORIGIN' may be abbreviated to 'org'
  3829. or 'o' (but not, for example, 'ORG').
  3830. The LEN is an expression for the size in bytes of the memory region.
  3831. As with the ORIGIN expression, the expression must be numerical only and
  3832. must evaluate to a constant. The keyword 'LENGTH' may be abbreviated to
  3833. 'len' or 'l'.
  3834. In the following example, we specify that there are two memory
  3835. regions available for allocation: one starting at '0' for 256 kilobytes,
  3836. and the other starting at '0x40000000' for four megabytes. The linker
  3837. will place into the 'rom' memory region every section which is not
  3838. explicitly mapped into a memory region, and is either read-only or
  3839. executable. The linker will place other sections which are not
  3840. explicitly mapped into a memory region into the 'ram' memory region.
  3841. MEMORY
  3842. {
  3843. rom (rx) : ORIGIN = 0, LENGTH = 256K
  3844. ram (!rx) : org = 0x40000000, l = 4M
  3845. }
  3846. Once you define a memory region, you can direct the linker to place
  3847. specific output sections into that memory region by using the '>REGION'
  3848. output section attribute. For example, if you have a memory region
  3849. named 'mem', you would use '>mem' in the output section definition.
  3850. *Note Output Section Region::. If no address was specified for the
  3851. output section, the linker will set the address to the next available
  3852. address within the memory region. If the combined output sections
  3853. directed to a memory region are too large for the region, the linker
  3854. will issue an error message.
  3855. It is possible to access the origin and length of a memory in an
  3856. expression via the 'ORIGIN(MEMORY)' and 'LENGTH(MEMORY)' functions:
  3857. _fstack = ORIGIN(ram) + LENGTH(ram) - 4;
  3858. 
  3859. File: ld.info, Node: PHDRS, Next: VERSION, Prev: MEMORY, Up: Scripts
  3860. 3.8 PHDRS Command
  3861. =================
  3862. The ELF object file format uses "program headers", also knows as
  3863. "segments". The program headers describe how the program should be
  3864. loaded into memory. You can print them out by using the 'objdump'
  3865. program with the '-p' option.
  3866. When you run an ELF program on a native ELF system, the system loader
  3867. reads the program headers in order to figure out how to load the
  3868. program. This will only work if the program headers are set correctly.
  3869. This manual does not describe the details of how the system loader
  3870. interprets program headers; for more information, see the ELF ABI.
  3871. The linker will create reasonable program headers by default.
  3872. However, in some cases, you may need to specify the program headers more
  3873. precisely. You may use the 'PHDRS' command for this purpose. When the
  3874. linker sees the 'PHDRS' command in the linker script, it will not create
  3875. any program headers other than the ones specified.
  3876. The linker only pays attention to the 'PHDRS' command when generating
  3877. an ELF output file. In other cases, the linker will simply ignore
  3878. 'PHDRS'.
  3879. This is the syntax of the 'PHDRS' command. The words 'PHDRS',
  3880. 'FILEHDR', 'AT', and 'FLAGS' are keywords.
  3881. PHDRS
  3882. {
  3883. NAME TYPE [ FILEHDR ] [ PHDRS ] [ AT ( ADDRESS ) ]
  3884. [ FLAGS ( FLAGS ) ] ;
  3885. }
  3886. The NAME is used only for reference in the 'SECTIONS' command of the
  3887. linker script. It is not put into the output file. Program header
  3888. names are stored in a separate name space, and will not conflict with
  3889. symbol names, file names, or section names. Each program header must
  3890. have a distinct name. The headers are processed in order and it is
  3891. usual for them to map to sections in ascending load address order.
  3892. Certain program header types describe segments of memory which the
  3893. system loader will load from the file. In the linker script, you
  3894. specify the contents of these segments by placing allocatable output
  3895. sections in the segments. You use the ':PHDR' output section attribute
  3896. to place a section in a particular segment. *Note Output Section
  3897. Phdr::.
  3898. It is normal to put certain sections in more than one segment. This
  3899. merely implies that one segment of memory contains another. You may
  3900. repeat ':PHDR', using it once for each segment which should contain the
  3901. section.
  3902. If you place a section in one or more segments using ':PHDR', then
  3903. the linker will place all subsequent allocatable sections which do not
  3904. specify ':PHDR' in the same segments. This is for convenience, since
  3905. generally a whole set of contiguous sections will be placed in a single
  3906. segment. You can use ':NONE' to override the default segment and tell
  3907. the linker to not put the section in any segment at all.
  3908. You may use the 'FILEHDR' and 'PHDRS' keywords after the program
  3909. header type to further describe the contents of the segment. The
  3910. 'FILEHDR' keyword means that the segment should include the ELF file
  3911. header. The 'PHDRS' keyword means that the segment should include the
  3912. ELF program headers themselves. If applied to a loadable segment
  3913. ('PT_LOAD'), all prior loadable segments must have one of these
  3914. keywords.
  3915. The TYPE may be one of the following. The numbers indicate the value
  3916. of the keyword.
  3917. 'PT_NULL' (0)
  3918. Indicates an unused program header.
  3919. 'PT_LOAD' (1)
  3920. Indicates that this program header describes a segment to be loaded
  3921. from the file.
  3922. 'PT_DYNAMIC' (2)
  3923. Indicates a segment where dynamic linking information can be found.
  3924. 'PT_INTERP' (3)
  3925. Indicates a segment where the name of the program interpreter may
  3926. be found.
  3927. 'PT_NOTE' (4)
  3928. Indicates a segment holding note information.
  3929. 'PT_SHLIB' (5)
  3930. A reserved program header type, defined but not specified by the
  3931. ELF ABI.
  3932. 'PT_PHDR' (6)
  3933. Indicates a segment where the program headers may be found.
  3934. 'PT_TLS' (7)
  3935. Indicates a segment containing thread local storage.
  3936. EXPRESSION
  3937. An expression giving the numeric type of the program header. This
  3938. may be used for types not defined above.
  3939. You can specify that a segment should be loaded at a particular
  3940. address in memory by using an 'AT' expression. This is identical to the
  3941. 'AT' command used as an output section attribute (*note Output Section
  3942. LMA::). The 'AT' command for a program header overrides the output
  3943. section attribute.
  3944. The linker will normally set the segment flags based on the sections
  3945. which comprise the segment. You may use the 'FLAGS' keyword to
  3946. explicitly specify the segment flags. The value of FLAGS must be an
  3947. integer. It is used to set the 'p_flags' field of the program header.
  3948. Here is an example of 'PHDRS'. This shows a typical set of program
  3949. headers used on a native ELF system.
  3950. PHDRS
  3951. {
  3952. headers PT_PHDR PHDRS ;
  3953. interp PT_INTERP ;
  3954. text PT_LOAD FILEHDR PHDRS ;
  3955. data PT_LOAD ;
  3956. dynamic PT_DYNAMIC ;
  3957. }
  3958. SECTIONS
  3959. {
  3960. . = SIZEOF_HEADERS;
  3961. .interp : { *(.interp) } :text :interp
  3962. .text : { *(.text) } :text
  3963. .rodata : { *(.rodata) } /* defaults to :text */
  3964. ...
  3965. . = . + 0x1000; /* move to a new page in memory */
  3966. .data : { *(.data) } :data
  3967. .dynamic : { *(.dynamic) } :data :dynamic
  3968. ...
  3969. }
  3970. 
  3971. File: ld.info, Node: VERSION, Next: Expressions, Prev: PHDRS, Up: Scripts
  3972. 3.9 VERSION Command
  3973. ===================
  3974. The linker supports symbol versions when using ELF. Symbol versions are
  3975. only useful when using shared libraries. The dynamic linker can use
  3976. symbol versions to select a specific version of a function when it runs
  3977. a program that may have been linked against an earlier version of the
  3978. shared library.
  3979. You can include a version script directly in the main linker script,
  3980. or you can supply the version script as an implicit linker script. You
  3981. can also use the '--version-script' linker option.
  3982. The syntax of the 'VERSION' command is simply
  3983. VERSION { version-script-commands }
  3984. The format of the version script commands is identical to that used
  3985. by Sun's linker in Solaris 2.5. The version script defines a tree of
  3986. version nodes. You specify the node names and interdependencies in the
  3987. version script. You can specify which symbols are bound to which
  3988. version nodes, and you can reduce a specified set of symbols to local
  3989. scope so that they are not globally visible outside of the shared
  3990. library.
  3991. The easiest way to demonstrate the version script language is with a
  3992. few examples.
  3993. VERS_1.1 {
  3994. global:
  3995. foo1;
  3996. local:
  3997. old*;
  3998. original*;
  3999. new*;
  4000. };
  4001. VERS_1.2 {
  4002. foo2;
  4003. } VERS_1.1;
  4004. VERS_2.0 {
  4005. bar1; bar2;
  4006. extern "C++" {
  4007. ns::*;
  4008. "f(int, double)";
  4009. };
  4010. } VERS_1.2;
  4011. This example version script defines three version nodes. The first
  4012. version node defined is 'VERS_1.1'; it has no other dependencies. The
  4013. script binds the symbol 'foo1' to 'VERS_1.1'. It reduces a number of
  4014. symbols to local scope so that they are not visible outside of the
  4015. shared library; this is done using wildcard patterns, so that any symbol
  4016. whose name begins with 'old', 'original', or 'new' is matched. The
  4017. wildcard patterns available are the same as those used in the shell when
  4018. matching filenames (also known as "globbing"). However, if you specify
  4019. the symbol name inside double quotes, then the name is treated as
  4020. literal, rather than as a glob pattern.
  4021. Next, the version script defines node 'VERS_1.2'. This node depends
  4022. upon 'VERS_1.1'. The script binds the symbol 'foo2' to the version node
  4023. 'VERS_1.2'.
  4024. Finally, the version script defines node 'VERS_2.0'. This node
  4025. depends upon 'VERS_1.2'. The scripts binds the symbols 'bar1' and
  4026. 'bar2' are bound to the version node 'VERS_2.0'.
  4027. When the linker finds a symbol defined in a library which is not
  4028. specifically bound to a version node, it will effectively bind it to an
  4029. unspecified base version of the library. You can bind all otherwise
  4030. unspecified symbols to a given version node by using 'global: *;'
  4031. somewhere in the version script. Note that it's slightly crazy to use
  4032. wildcards in a global spec except on the last version node. Global
  4033. wildcards elsewhere run the risk of accidentally adding symbols to the
  4034. set exported for an old version. That's wrong since older versions
  4035. ought to have a fixed set of symbols.
  4036. The names of the version nodes have no specific meaning other than
  4037. what they might suggest to the person reading them. The '2.0' version
  4038. could just as well have appeared in between '1.1' and '1.2'. However,
  4039. this would be a confusing way to write a version script.
  4040. Node name can be omitted, provided it is the only version node in the
  4041. version script. Such version script doesn't assign any versions to
  4042. symbols, only selects which symbols will be globally visible out and
  4043. which won't.
  4044. { global: foo; bar; local: *; };
  4045. When you link an application against a shared library that has
  4046. versioned symbols, the application itself knows which version of each
  4047. symbol it requires, and it also knows which version nodes it needs from
  4048. each shared library it is linked against. Thus at runtime, the dynamic
  4049. loader can make a quick check to make sure that the libraries you have
  4050. linked against do in fact supply all of the version nodes that the
  4051. application will need to resolve all of the dynamic symbols. In this
  4052. way it is possible for the dynamic linker to know with certainty that
  4053. all external symbols that it needs will be resolvable without having to
  4054. search for each symbol reference.
  4055. The symbol versioning is in effect a much more sophisticated way of
  4056. doing minor version checking that SunOS does. The fundamental problem
  4057. that is being addressed here is that typically references to external
  4058. functions are bound on an as-needed basis, and are not all bound when
  4059. the application starts up. If a shared library is out of date, a
  4060. required interface may be missing; when the application tries to use
  4061. that interface, it may suddenly and unexpectedly fail. With symbol
  4062. versioning, the user will get a warning when they start their program if
  4063. the libraries being used with the application are too old.
  4064. There are several GNU extensions to Sun's versioning approach. The
  4065. first of these is the ability to bind a symbol to a version node in the
  4066. source file where the symbol is defined instead of in the versioning
  4067. script. This was done mainly to reduce the burden on the library
  4068. maintainer. You can do this by putting something like:
  4069. __asm__(".symver original_foo,foo@VERS_1.1");
  4070. in the C source file. This renames the function 'original_foo' to be an
  4071. alias for 'foo' bound to the version node 'VERS_1.1'. The 'local:'
  4072. directive can be used to prevent the symbol 'original_foo' from being
  4073. exported. A '.symver' directive takes precedence over a version script.
  4074. The second GNU extension is to allow multiple versions of the same
  4075. function to appear in a given shared library. In this way you can make
  4076. an incompatible change to an interface without increasing the major
  4077. version number of the shared library, while still allowing applications
  4078. linked against the old interface to continue to function.
  4079. To do this, you must use multiple '.symver' directives in the source
  4080. file. Here is an example:
  4081. __asm__(".symver original_foo,foo@");
  4082. __asm__(".symver old_foo,foo@VERS_1.1");
  4083. __asm__(".symver old_foo1,foo@VERS_1.2");
  4084. __asm__(".symver new_foo,foo@@VERS_2.0");
  4085. In this example, 'foo@' represents the symbol 'foo' bound to the
  4086. unspecified base version of the symbol. The source file that contains
  4087. this example would define 4 C functions: 'original_foo', 'old_foo',
  4088. 'old_foo1', and 'new_foo'.
  4089. When you have multiple definitions of a given symbol, there needs to
  4090. be some way to specify a default version to which external references to
  4091. this symbol will be bound. You can do this with the 'foo@@VERS_2.0'
  4092. type of '.symver' directive. You can only declare one version of a
  4093. symbol as the default in this manner; otherwise you would effectively
  4094. have multiple definitions of the same symbol.
  4095. If you wish to bind a reference to a specific version of the symbol
  4096. within the shared library, you can use the aliases of convenience (i.e.,
  4097. 'old_foo'), or you can use the '.symver' directive to specifically bind
  4098. to an external version of the function in question.
  4099. You can also specify the language in the version script:
  4100. VERSION extern "lang" { version-script-commands }
  4101. The supported 'lang's are 'C', 'C++', and 'Java'. The linker will
  4102. iterate over the list of symbols at the link time and demangle them
  4103. according to 'lang' before matching them to the patterns specified in
  4104. 'version-script-commands'. The default 'lang' is 'C'.
  4105. Demangled names may contains spaces and other special characters. As
  4106. described above, you can use a glob pattern to match demangled names, or
  4107. you can use a double-quoted string to match the string exactly. In the
  4108. latter case, be aware that minor differences (such as differing
  4109. whitespace) between the version script and the demangler output will
  4110. cause a mismatch. As the exact string generated by the demangler might
  4111. change in the future, even if the mangled name does not, you should
  4112. check that all of your version directives are behaving as you expect
  4113. when you upgrade.
  4114. 
  4115. File: ld.info, Node: Expressions, Next: Implicit Linker Scripts, Prev: VERSION, Up: Scripts
  4116. 3.10 Expressions in Linker Scripts
  4117. ==================================
  4118. The syntax for expressions in the linker script language is identical to
  4119. that of C expressions. All expressions are evaluated as integers. All
  4120. expressions are evaluated in the same size, which is 32 bits if both the
  4121. host and target are 32 bits, and is otherwise 64 bits.
  4122. You can use and set symbol values in expressions.
  4123. The linker defines several special purpose builtin functions for use
  4124. in expressions.
  4125. * Menu:
  4126. * Constants:: Constants
  4127. * Symbolic Constants:: Symbolic constants
  4128. * Symbols:: Symbol Names
  4129. * Orphan Sections:: Orphan Sections
  4130. * Location Counter:: The Location Counter
  4131. * Operators:: Operators
  4132. * Evaluation:: Evaluation
  4133. * Expression Section:: The Section of an Expression
  4134. * Builtin Functions:: Builtin Functions
  4135. 
  4136. File: ld.info, Node: Constants, Next: Symbolic Constants, Up: Expressions
  4137. 3.10.1 Constants
  4138. ----------------
  4139. All constants are integers.
  4140. As in C, the linker considers an integer beginning with '0' to be
  4141. octal, and an integer beginning with '0x' or '0X' to be hexadecimal.
  4142. Alternatively the linker accepts suffixes of 'h' or 'H' for hexadecimal,
  4143. 'o' or 'O' for octal, 'b' or 'B' for binary and 'd' or 'D' for decimal.
  4144. Any integer value without a prefix or a suffix is considered to be
  4145. decimal.
  4146. In addition, you can use the suffixes 'K' and 'M' to scale a constant
  4147. by '1024' or '1024*1024' respectively. For example, the following all
  4148. refer to the same quantity:
  4149. _fourk_1 = 4K;
  4150. _fourk_2 = 4096;
  4151. _fourk_3 = 0x1000;
  4152. _fourk_4 = 10000o;
  4153. Note - the 'K' and 'M' suffixes cannot be used in conjunction with
  4154. the base suffixes mentioned above.
  4155. 
  4156. File: ld.info, Node: Symbolic Constants, Next: Symbols, Prev: Constants, Up: Expressions
  4157. 3.10.2 Symbolic Constants
  4158. -------------------------
  4159. It is possible to refer to target-specific constants via the use of the
  4160. 'CONSTANT(NAME)' operator, where NAME is one of:
  4161. 'MAXPAGESIZE'
  4162. The target's maximum page size.
  4163. 'COMMONPAGESIZE'
  4164. The target's default page size.
  4165. So for example:
  4166. .text ALIGN (CONSTANT (MAXPAGESIZE)) : { *(.text) }
  4167. will create a text section aligned to the largest page boundary
  4168. supported by the target.
  4169. 
  4170. File: ld.info, Node: Symbols, Next: Orphan Sections, Prev: Symbolic Constants, Up: Expressions
  4171. 3.10.3 Symbol Names
  4172. -------------------
  4173. Unless quoted, symbol names start with a letter, underscore, or period
  4174. and may include letters, digits, underscores, periods, and hyphens.
  4175. Unquoted symbol names must not conflict with any keywords. You can
  4176. specify a symbol which contains odd characters or has the same name as a
  4177. keyword by surrounding the symbol name in double quotes:
  4178. "SECTION" = 9;
  4179. "with a space" = "also with a space" + 10;
  4180. Since symbols can contain many non-alphabetic characters, it is
  4181. safest to delimit symbols with spaces. For example, 'A-B' is one
  4182. symbol, whereas 'A - B' is an expression involving subtraction.
  4183. 
  4184. File: ld.info, Node: Orphan Sections, Next: Location Counter, Prev: Symbols, Up: Expressions
  4185. 3.10.4 Orphan Sections
  4186. ----------------------
  4187. Orphan sections are sections present in the input files which are not
  4188. explicitly placed into the output file by the linker script. The linker
  4189. will still copy these sections into the output file by either finding,
  4190. or creating a suitable output section in which to place the orphaned
  4191. input section.
  4192. If the name of an orphaned input section exactly matches the name of
  4193. an existing output section, then the orphaned input section will be
  4194. placed at the end of that output section.
  4195. If there is no output section with a matching name then new output
  4196. sections will be created. Each new output section will have the same
  4197. name as the orphan section placed within it. If there are multiple
  4198. orphan sections with the same name, these will all be combined into one
  4199. new output section.
  4200. If new output sections are created to hold orphaned input sections,
  4201. then the linker must decide where to place these new output sections in
  4202. relation to existing output sections. On most modern targets, the
  4203. linker attempts to place orphan sections after sections of the same
  4204. attribute, such as code vs data, loadable vs non-loadable, etc. If no
  4205. sections with matching attributes are found, or your target lacks this
  4206. support, the orphan section is placed at the end of the file.
  4207. The command-line options '--orphan-handling' and '--unique' (*note
  4208. Command-line Options: Options.) can be used to control which output
  4209. sections an orphan is placed in.
  4210. 
  4211. File: ld.info, Node: Location Counter, Next: Operators, Prev: Orphan Sections, Up: Expressions
  4212. 3.10.5 The Location Counter
  4213. ---------------------------
  4214. The special linker variable "dot" '.' always contains the current output
  4215. location counter. Since the '.' always refers to a location in an
  4216. output section, it may only appear in an expression within a 'SECTIONS'
  4217. command. The '.' symbol may appear anywhere that an ordinary symbol is
  4218. allowed in an expression.
  4219. Assigning a value to '.' will cause the location counter to be moved.
  4220. This may be used to create holes in the output section. The location
  4221. counter may not be moved backwards inside an output section, and may not
  4222. be moved backwards outside of an output section if so doing creates
  4223. areas with overlapping LMAs.
  4224. SECTIONS
  4225. {
  4226. output :
  4227. {
  4228. file1(.text)
  4229. . = . + 1000;
  4230. file2(.text)
  4231. . += 1000;
  4232. file3(.text)
  4233. } = 0x12345678;
  4234. }
  4235. In the previous example, the '.text' section from 'file1' is located at
  4236. the beginning of the output section 'output'. It is followed by a 1000
  4237. byte gap. Then the '.text' section from 'file2' appears, also with a
  4238. 1000 byte gap following before the '.text' section from 'file3'. The
  4239. notation '= 0x12345678' specifies what data to write in the gaps (*note
  4240. Output Section Fill::).
  4241. Note: '.' actually refers to the byte offset from the start of the
  4242. current containing object. Normally this is the 'SECTIONS' statement,
  4243. whose start address is 0, hence '.' can be used as an absolute address.
  4244. If '.' is used inside a section description however, it refers to the
  4245. byte offset from the start of that section, not an absolute address.
  4246. Thus in a script like this:
  4247. SECTIONS
  4248. {
  4249. . = 0x100
  4250. .text: {
  4251. *(.text)
  4252. . = 0x200
  4253. }
  4254. . = 0x500
  4255. .data: {
  4256. *(.data)
  4257. . += 0x600
  4258. }
  4259. }
  4260. The '.text' section will be assigned a starting address of 0x100 and
  4261. a size of exactly 0x200 bytes, even if there is not enough data in the
  4262. '.text' input sections to fill this area. (If there is too much data,
  4263. an error will be produced because this would be an attempt to move '.'
  4264. backwards). The '.data' section will start at 0x500 and it will have an
  4265. extra 0x600 bytes worth of space after the end of the values from the
  4266. '.data' input sections and before the end of the '.data' output section
  4267. itself.
  4268. Setting symbols to the value of the location counter outside of an
  4269. output section statement can result in unexpected values if the linker
  4270. needs to place orphan sections. For example, given the following:
  4271. SECTIONS
  4272. {
  4273. start_of_text = . ;
  4274. .text: { *(.text) }
  4275. end_of_text = . ;
  4276. start_of_data = . ;
  4277. .data: { *(.data) }
  4278. end_of_data = . ;
  4279. }
  4280. If the linker needs to place some input section, e.g. '.rodata', not
  4281. mentioned in the script, it might choose to place that section between
  4282. '.text' and '.data'. You might think the linker should place '.rodata'
  4283. on the blank line in the above script, but blank lines are of no
  4284. particular significance to the linker. As well, the linker doesn't
  4285. associate the above symbol names with their sections. Instead, it
  4286. assumes that all assignments or other statements belong to the previous
  4287. output section, except for the special case of an assignment to '.'.
  4288. I.e., the linker will place the orphan '.rodata' section as if the
  4289. script was written as follows:
  4290. SECTIONS
  4291. {
  4292. start_of_text = . ;
  4293. .text: { *(.text) }
  4294. end_of_text = . ;
  4295. start_of_data = . ;
  4296. .rodata: { *(.rodata) }
  4297. .data: { *(.data) }
  4298. end_of_data = . ;
  4299. }
  4300. This may or may not be the script author's intention for the value of
  4301. 'start_of_data'. One way to influence the orphan section placement is
  4302. to assign the location counter to itself, as the linker assumes that an
  4303. assignment to '.' is setting the start address of a following output
  4304. section and thus should be grouped with that section. So you could
  4305. write:
  4306. SECTIONS
  4307. {
  4308. start_of_text = . ;
  4309. .text: { *(.text) }
  4310. end_of_text = . ;
  4311. . = . ;
  4312. start_of_data = . ;
  4313. .data: { *(.data) }
  4314. end_of_data = . ;
  4315. }
  4316. Now, the orphan '.rodata' section will be placed between
  4317. 'end_of_text' and 'start_of_data'.
  4318. 
  4319. File: ld.info, Node: Operators, Next: Evaluation, Prev: Location Counter, Up: Expressions
  4320. 3.10.6 Operators
  4321. ----------------
  4322. The linker recognizes the standard C set of arithmetic operators, with
  4323. the standard bindings and precedence levels:
  4324. precedence associativity Operators Notes
  4325. (highest)
  4326. 1 left ! - ~ (1)
  4327. 2 left * / %
  4328. 3 left + -
  4329. 4 left >> <<
  4330. 5 left == != > < <= >=
  4331. 6 left &
  4332. 7 left |
  4333. 8 left &&
  4334. 9 left ||
  4335. 10 right ? :
  4336. 11 right &= += -= *= /= (2)
  4337. (lowest)
  4338. Notes: (1) Prefix operators (2) *Note Assignments::.
  4339. 
  4340. File: ld.info, Node: Evaluation, Next: Expression Section, Prev: Operators, Up: Expressions
  4341. 3.10.7 Evaluation
  4342. -----------------
  4343. The linker evaluates expressions lazily. It only computes the value of
  4344. an expression when absolutely necessary.
  4345. The linker needs some information, such as the value of the start
  4346. address of the first section, and the origins and lengths of memory
  4347. regions, in order to do any linking at all. These values are computed
  4348. as soon as possible when the linker reads in the linker script.
  4349. However, other values (such as symbol values) are not known or needed
  4350. until after storage allocation. Such values are evaluated later, when
  4351. other information (such as the sizes of output sections) is available
  4352. for use in the symbol assignment expression.
  4353. The sizes of sections cannot be known until after allocation, so
  4354. assignments dependent upon these are not performed until after
  4355. allocation.
  4356. Some expressions, such as those depending upon the location counter
  4357. '.', must be evaluated during section allocation.
  4358. If the result of an expression is required, but the value is not
  4359. available, then an error results. For example, a script like the
  4360. following
  4361. SECTIONS
  4362. {
  4363. .text 9+this_isnt_constant :
  4364. { *(.text) }
  4365. }
  4366. will cause the error message 'non constant expression for initial
  4367. address'.
  4368. 
  4369. File: ld.info, Node: Expression Section, Next: Builtin Functions, Prev: Evaluation, Up: Expressions
  4370. 3.10.8 The Section of an Expression
  4371. -----------------------------------
  4372. Addresses and symbols may be section relative, or absolute. A section
  4373. relative symbol is relocatable. If you request relocatable output using
  4374. the '-r' option, a further link operation may change the value of a
  4375. section relative symbol. On the other hand, an absolute symbol will
  4376. retain the same value throughout any further link operations.
  4377. Some terms in linker expressions are addresses. This is true of
  4378. section relative symbols and for builtin functions that return an
  4379. address, such as 'ADDR', 'LOADADDR', 'ORIGIN' and 'SEGMENT_START'.
  4380. Other terms are simply numbers, or are builtin functions that return a
  4381. non-address value, such as 'LENGTH'. One complication is that unless
  4382. you set 'LD_FEATURE ("SANE_EXPR")' (*note Miscellaneous Commands::),
  4383. numbers and absolute symbols are treated differently depending on their
  4384. location, for compatibility with older versions of 'ld'. Expressions
  4385. appearing outside an output section definition treat all numbers as
  4386. absolute addresses. Expressions appearing inside an output section
  4387. definition treat absolute symbols as numbers. If 'LD_FEATURE
  4388. ("SANE_EXPR")' is given, then absolute symbols and numbers are simply
  4389. treated as numbers everywhere.
  4390. In the following simple example,
  4391. SECTIONS
  4392. {
  4393. . = 0x100;
  4394. __executable_start = 0x100;
  4395. .data :
  4396. {
  4397. . = 0x10;
  4398. __data_start = 0x10;
  4399. *(.data)
  4400. }
  4401. ...
  4402. }
  4403. both '.' and '__executable_start' are set to the absolute address
  4404. 0x100 in the first two assignments, then both '.' and '__data_start' are
  4405. set to 0x10 relative to the '.data' section in the second two
  4406. assignments.
  4407. For expressions involving numbers, relative addresses and absolute
  4408. addresses, ld follows these rules to evaluate terms:
  4409. * Unary operations on an absolute address or number, and binary
  4410. operations on two absolute addresses or two numbers, or between one
  4411. absolute address and a number, apply the operator to the value(s).
  4412. * Unary operations on a relative address, and binary operations on
  4413. two relative addresses in the same section or between one relative
  4414. address and a number, apply the operator to the offset part of the
  4415. address(es).
  4416. * Other binary operations, that is, between two relative addresses
  4417. not in the same section, or between a relative address and an
  4418. absolute address, first convert any non-absolute term to an
  4419. absolute address before applying the operator.
  4420. The result section of each sub-expression is as follows:
  4421. * An operation involving only numbers results in a number.
  4422. * The result of comparisons, '&&' and '||' is also a number.
  4423. * The result of other binary arithmetic and logical operations on two
  4424. relative addresses in the same section or two absolute addresses
  4425. (after above conversions) is also a number when 'LD_FEATURE
  4426. ("SANE_EXPR")' or inside an output section definition but an
  4427. absolute address otherwise.
  4428. * The result of other operations on relative addresses or one
  4429. relative address and a number, is a relative address in the same
  4430. section as the relative operand(s).
  4431. * The result of other operations on absolute addresses (after above
  4432. conversions) is an absolute address.
  4433. You can use the builtin function 'ABSOLUTE' to force an expression to
  4434. be absolute when it would otherwise be relative. For example, to create
  4435. an absolute symbol set to the address of the end of the output section
  4436. '.data':
  4437. SECTIONS
  4438. {
  4439. .data : { *(.data) _edata = ABSOLUTE(.); }
  4440. }
  4441. If 'ABSOLUTE' were not used, '_edata' would be relative to the '.data'
  4442. section.
  4443. Using 'LOADADDR' also forces an expression absolute, since this
  4444. particular builtin function returns an absolute address.
  4445. 
  4446. File: ld.info, Node: Builtin Functions, Prev: Expression Section, Up: Expressions
  4447. 3.10.9 Builtin Functions
  4448. ------------------------
  4449. The linker script language includes a number of builtin functions for
  4450. use in linker script expressions.
  4451. 'ABSOLUTE(EXP)'
  4452. Return the absolute (non-relocatable, as opposed to non-negative)
  4453. value of the expression EXP. Primarily useful to assign an
  4454. absolute value to a symbol within a section definition, where
  4455. symbol values are normally section relative. *Note Expression
  4456. Section::.
  4457. 'ADDR(SECTION)'
  4458. Return the address (VMA) of the named SECTION. Your script must
  4459. previously have defined the location of that section. In the
  4460. following example, 'start_of_output_1', 'symbol_1' and 'symbol_2'
  4461. are assigned equivalent values, except that 'symbol_1' will be
  4462. relative to the '.output1' section while the other two will be
  4463. absolute:
  4464. SECTIONS { ...
  4465. .output1 :
  4466. {
  4467. start_of_output_1 = ABSOLUTE(.);
  4468. ...
  4469. }
  4470. .output :
  4471. {
  4472. symbol_1 = ADDR(.output1);
  4473. symbol_2 = start_of_output_1;
  4474. }
  4475. ... }
  4476. 'ALIGN(ALIGN)'
  4477. 'ALIGN(EXP,ALIGN)'
  4478. Return the location counter ('.') or arbitrary expression aligned
  4479. to the next ALIGN boundary. The single operand 'ALIGN' doesn't
  4480. change the value of the location counter--it just does arithmetic
  4481. on it. The two operand 'ALIGN' allows an arbitrary expression to
  4482. be aligned upwards ('ALIGN(ALIGN)' is equivalent to
  4483. 'ALIGN(ABSOLUTE(.), ALIGN)').
  4484. Here is an example which aligns the output '.data' section to the
  4485. next '0x2000' byte boundary after the preceding section and sets a
  4486. variable within the section to the next '0x8000' boundary after the
  4487. input sections:
  4488. SECTIONS { ...
  4489. .data ALIGN(0x2000): {
  4490. *(.data)
  4491. variable = ALIGN(0x8000);
  4492. }
  4493. ... }
  4494. The first use of 'ALIGN' in this example specifies the location of
  4495. a section because it is used as the optional ADDRESS attribute of a
  4496. section definition (*note Output Section Address::). The second
  4497. use of 'ALIGN' is used to defines the value of a symbol.
  4498. The builtin function 'NEXT' is closely related to 'ALIGN'.
  4499. 'ALIGNOF(SECTION)'
  4500. Return the alignment in bytes of the named SECTION, if that section
  4501. has been allocated. If the section has not been allocated when
  4502. this is evaluated, the linker will report an error. In the
  4503. following example, the alignment of the '.output' section is stored
  4504. as the first value in that section.
  4505. SECTIONS{ ...
  4506. .output {
  4507. LONG (ALIGNOF (.output))
  4508. ...
  4509. }
  4510. ... }
  4511. 'BLOCK(EXP)'
  4512. This is a synonym for 'ALIGN', for compatibility with older linker
  4513. scripts. It is most often seen when setting the address of an
  4514. output section.
  4515. 'DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE)'
  4516. This is equivalent to either
  4517. (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1)))
  4518. or
  4519. (ALIGN(MAXPAGESIZE)
  4520. + ((. + COMMONPAGESIZE - 1) & (MAXPAGESIZE - COMMONPAGESIZE)))
  4521. depending on whether the latter uses fewer COMMONPAGESIZE sized
  4522. pages for the data segment (area between the result of this
  4523. expression and 'DATA_SEGMENT_END') than the former or not. If the
  4524. latter form is used, it means COMMONPAGESIZE bytes of runtime
  4525. memory will be saved at the expense of up to COMMONPAGESIZE wasted
  4526. bytes in the on-disk file.
  4527. This expression can only be used directly in 'SECTIONS' commands,
  4528. not in any output section descriptions and only once in the linker
  4529. script. COMMONPAGESIZE should be less or equal to MAXPAGESIZE and
  4530. should be the system page size the object wants to be optimized for
  4531. while still running on system page sizes up to MAXPAGESIZE. Note
  4532. however that '-z relro' protection will not be effective if the
  4533. system page size is larger than COMMONPAGESIZE.
  4534. Example:
  4535. . = DATA_SEGMENT_ALIGN(0x10000, 0x2000);
  4536. 'DATA_SEGMENT_END(EXP)'
  4537. This defines the end of data segment for 'DATA_SEGMENT_ALIGN'
  4538. evaluation purposes.
  4539. . = DATA_SEGMENT_END(.);
  4540. 'DATA_SEGMENT_RELRO_END(OFFSET, EXP)'
  4541. This defines the end of the 'PT_GNU_RELRO' segment when '-z relro'
  4542. option is used. When '-z relro' option is not present,
  4543. 'DATA_SEGMENT_RELRO_END' does nothing, otherwise
  4544. 'DATA_SEGMENT_ALIGN' is padded so that EXP + OFFSET is aligned to
  4545. the COMMONPAGESIZE argument given to 'DATA_SEGMENT_ALIGN'. If
  4546. present in the linker script, it must be placed between
  4547. 'DATA_SEGMENT_ALIGN' and 'DATA_SEGMENT_END'. Evaluates to the
  4548. second argument plus any padding needed at the end of the
  4549. 'PT_GNU_RELRO' segment due to section alignment.
  4550. . = DATA_SEGMENT_RELRO_END(24, .);
  4551. 'DEFINED(SYMBOL)'
  4552. Return 1 if SYMBOL is in the linker global symbol table and is
  4553. defined before the statement using DEFINED in the script, otherwise
  4554. return 0. You can use this function to provide default values for
  4555. symbols. For example, the following script fragment shows how to
  4556. set a global symbol 'begin' to the first location in the '.text'
  4557. section--but if a symbol called 'begin' already existed, its value
  4558. is preserved:
  4559. SECTIONS { ...
  4560. .text : {
  4561. begin = DEFINED(begin) ? begin : . ;
  4562. ...
  4563. }
  4564. ...
  4565. }
  4566. 'LENGTH(MEMORY)'
  4567. Return the length of the memory region named MEMORY.
  4568. 'LOADADDR(SECTION)'
  4569. Return the absolute LMA of the named SECTION. (*note Output
  4570. Section LMA::).
  4571. 'LOG2CEIL(EXP)'
  4572. Return the binary logarithm of EXP rounded towards infinity.
  4573. 'LOG2CEIL(0)' returns 0.
  4574. 'MAX(EXP1, EXP2)'
  4575. Returns the maximum of EXP1 and EXP2.
  4576. 'MIN(EXP1, EXP2)'
  4577. Returns the minimum of EXP1 and EXP2.
  4578. 'NEXT(EXP)'
  4579. Return the next unallocated address that is a multiple of EXP.
  4580. This function is closely related to 'ALIGN(EXP)'; unless you use
  4581. the 'MEMORY' command to define discontinuous memory for the output
  4582. file, the two functions are equivalent.
  4583. 'ORIGIN(MEMORY)'
  4584. Return the origin of the memory region named MEMORY.
  4585. 'SEGMENT_START(SEGMENT, DEFAULT)'
  4586. Return the base address of the named SEGMENT. If an explicit value
  4587. has already been given for this segment (with a command-line '-T'
  4588. option) then that value will be returned otherwise the value will
  4589. be DEFAULT. At present, the '-T' command-line option can only be
  4590. used to set the base address for the "text", "data", and "bss"
  4591. sections, but you can use 'SEGMENT_START' with any segment name.
  4592. 'SIZEOF(SECTION)'
  4593. Return the size in bytes of the named SECTION, if that section has
  4594. been allocated. If the section has not been allocated when this is
  4595. evaluated, the linker will report an error. In the following
  4596. example, 'symbol_1' and 'symbol_2' are assigned identical values:
  4597. SECTIONS{ ...
  4598. .output {
  4599. .start = . ;
  4600. ...
  4601. .end = . ;
  4602. }
  4603. symbol_1 = .end - .start ;
  4604. symbol_2 = SIZEOF(.output);
  4605. ... }
  4606. 'SIZEOF_HEADERS'
  4607. 'sizeof_headers'
  4608. Return the size in bytes of the output file's headers. This is
  4609. information which appears at the start of the output file. You can
  4610. use this number when setting the start address of the first
  4611. section, if you choose, to facilitate paging.
  4612. When producing an ELF output file, if the linker script uses the
  4613. 'SIZEOF_HEADERS' builtin function, the linker must compute the
  4614. number of program headers before it has determined all the section
  4615. addresses and sizes. If the linker later discovers that it needs
  4616. additional program headers, it will report an error 'not enough
  4617. room for program headers'. To avoid this error, you must avoid
  4618. using the 'SIZEOF_HEADERS' function, or you must rework your linker
  4619. script to avoid forcing the linker to use additional program
  4620. headers, or you must define the program headers yourself using the
  4621. 'PHDRS' command (*note PHDRS::).
  4622. 
  4623. File: ld.info, Node: Implicit Linker Scripts, Prev: Expressions, Up: Scripts
  4624. 3.11 Implicit Linker Scripts
  4625. ============================
  4626. If you specify a linker input file which the linker can not recognize as
  4627. an object file or an archive file, it will try to read the file as a
  4628. linker script. If the file can not be parsed as a linker script, the
  4629. linker will report an error.
  4630. An implicit linker script will not replace the default linker script.
  4631. Typically an implicit linker script would contain only symbol
  4632. assignments, or the 'INPUT', 'GROUP', or 'VERSION' commands.
  4633. Any input files read because of an implicit linker script will be
  4634. read at the position in the command line where the implicit linker
  4635. script was read. This can affect archive searching.
  4636. 
  4637. File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Scripts, Up: Top
  4638. 4 Machine Dependent Features
  4639. ****************************
  4640. 'ld' has additional features on some platforms; the following sections
  4641. describe them. Machines where 'ld' has no additional functionality are
  4642. not listed.
  4643. * Menu:
  4644. * H8/300:: 'ld' and the H8/300
  4645. * M68HC11/68HC12:: 'ld' and the Motorola 68HC11 and 68HC12 families
  4646. * ARM:: 'ld' and the ARM family
  4647. * HPPA ELF32:: 'ld' and HPPA 32-bit ELF
  4648. * M68K:: 'ld' and the Motorola 68K family
  4649. * MIPS:: 'ld' and the MIPS family
  4650. * MMIX:: 'ld' and MMIX
  4651. * MSP430:: 'ld' and MSP430
  4652. * NDS32:: 'ld' and NDS32
  4653. * Nios II:: 'ld' and the Altera Nios II
  4654. * PowerPC ELF32:: 'ld' and PowerPC 32-bit ELF Support
  4655. * PowerPC64 ELF64:: 'ld' and PowerPC64 64-bit ELF Support
  4656. * S/390 ELF:: 'ld' and S/390 ELF Support
  4657. * SPU ELF:: 'ld' and SPU ELF Support
  4658. * TI COFF:: 'ld' and TI COFF
  4659. * WIN32:: 'ld' and WIN32 (cygwin/mingw)
  4660. * Xtensa:: 'ld' and Xtensa Processors
  4661. 
  4662. File: ld.info, Node: H8/300, Next: M68HC11/68HC12, Up: Machine Dependent
  4663. 4.1 'ld' and the H8/300
  4664. =======================
  4665. For the H8/300, 'ld' can perform these global optimizations when you
  4666. specify the '--relax' command-line option.
  4667. _relaxing address modes_
  4668. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4669. within eight bits, and turns them into eight-bit program-counter
  4670. relative 'bsr' and 'bra' instructions, respectively.
  4671. _synthesizing instructions_
  4672. 'ld' finds all 'mov.b' instructions which use the sixteen-bit
  4673. absolute address form, but refer to the top page of memory, and
  4674. changes them to use the eight-bit address form. (That is: the
  4675. linker turns 'mov.b '@'AA:16' into 'mov.b '@'AA:8' whenever the
  4676. address AA is in the top page of memory).
  4677. 'ld' finds all 'mov' instructions which use the register indirect
  4678. with 32-bit displacement addressing mode, but use a small
  4679. displacement inside 16-bit displacement range, and changes them to
  4680. use the 16-bit displacement form. (That is: the linker turns
  4681. 'mov.b '@'D:32,ERx' into 'mov.b '@'D:16,ERx' whenever the
  4682. displacement D is in the 16 bit signed integer range. Only
  4683. implemented in ELF-format ld).
  4684. _bit manipulation instructions_
  4685. 'ld' finds all bit manipulation instructions like 'band, bclr,
  4686. biand, bild, bior, bist, bixor, bld, bnot, bor, bset, bst, btst,
  4687. bxor' which use 32 bit and 16 bit absolute address form, but refer
  4688. to the top page of memory, and changes them to use the 8 bit
  4689. address form. (That is: the linker turns 'bset #xx:3,'@'AA:32'
  4690. into 'bset #xx:3,'@'AA:8' whenever the address AA is in the top
  4691. page of memory).
  4692. _system control instructions_
  4693. 'ld' finds all 'ldc.w, stc.w' instructions which use the 32 bit
  4694. absolute address form, but refer to the top page of memory, and
  4695. changes them to use 16 bit address form. (That is: the linker
  4696. turns 'ldc.w '@'AA:32,ccr' into 'ldc.w '@'AA:16,ccr' whenever the
  4697. address AA is in the top page of memory).
  4698. 
  4699. File: ld.info, Node: M68HC11/68HC12, Next: ARM, Prev: H8/300, Up: Machine Dependent
  4700. 4.2 'ld' and the Motorola 68HC11 and 68HC12 families
  4701. ====================================================
  4702. 4.2.1 Linker Relaxation
  4703. -----------------------
  4704. For the Motorola 68HC11, 'ld' can perform these global optimizations
  4705. when you specify the '--relax' command-line option.
  4706. _relaxing address modes_
  4707. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4708. within eight bits, and turns them into eight-bit program-counter
  4709. relative 'bsr' and 'bra' instructions, respectively.
  4710. 'ld' also looks at all 16-bit extended addressing modes and
  4711. transforms them in a direct addressing mode when the address is in
  4712. page 0 (between 0 and 0x0ff).
  4713. _relaxing gcc instruction group_
  4714. When 'gcc' is called with '-mrelax', it can emit group of
  4715. instructions that the linker can optimize to use a 68HC11 direct
  4716. addressing mode. These instructions consists of 'bclr' or 'bset'
  4717. instructions.
  4718. 4.2.2 Trampoline Generation
  4719. ---------------------------
  4720. For 68HC11 and 68HC12, 'ld' can generate trampoline code to call a far
  4721. function using a normal 'jsr' instruction. The linker will also change
  4722. the relocation to some far function to use the trampoline address
  4723. instead of the function address. This is typically the case when a
  4724. pointer to a function is taken. The pointer will in fact point to the
  4725. function trampoline.
  4726. 
  4727. File: ld.info, Node: ARM, Next: HPPA ELF32, Prev: M68HC11/68HC12, Up: Machine Dependent
  4728. 4.3 'ld' and the ARM family
  4729. ===========================
  4730. For the ARM, 'ld' will generate code stubs to allow functions calls
  4731. between ARM and Thumb code. These stubs only work with code that has
  4732. been compiled and assembled with the '-mthumb-interwork' command line
  4733. option. If it is necessary to link with old ARM object files or
  4734. libraries, which have not been compiled with the -mthumb-interwork
  4735. option then the '--support-old-code' command-line switch should be given
  4736. to the linker. This will make it generate larger stub functions which
  4737. will work with non-interworking aware ARM code. Note, however, the
  4738. linker does not support generating stubs for function calls to
  4739. non-interworking aware Thumb code.
  4740. The '--thumb-entry' switch is a duplicate of the generic '--entry'
  4741. switch, in that it sets the program's starting address. But it also
  4742. sets the bottom bit of the address, so that it can be branched to using
  4743. a BX instruction, and the program will start executing in Thumb mode
  4744. straight away.
  4745. The '--use-nul-prefixed-import-tables' switch is specifying, that the
  4746. import tables idata4 and idata5 have to be generated with a zero element
  4747. prefix for import libraries. This is the old style to generate import
  4748. tables. By default this option is turned off.
  4749. The '--be8' switch instructs 'ld' to generate BE8 format executables.
  4750. This option is only valid when linking big-endian objects - ie ones
  4751. which have been assembled with the '-EB' option. The resulting image
  4752. will contain big-endian data and little-endian code.
  4753. The 'R_ARM_TARGET1' relocation is typically used for entries in the
  4754. '.init_array' section. It is interpreted as either 'R_ARM_REL32' or
  4755. 'R_ARM_ABS32', depending on the target. The '--target1-rel' and
  4756. '--target1-abs' switches override the default.
  4757. The '--target2=type' switch overrides the default definition of the
  4758. 'R_ARM_TARGET2' relocation. Valid values for 'type', their meanings,
  4759. and target defaults are as follows:
  4760. 'rel'
  4761. 'R_ARM_REL32' (arm*-*-elf, arm*-*-eabi)
  4762. 'abs'
  4763. 'R_ARM_ABS32' (arm*-*-symbianelf)
  4764. 'got-rel'
  4765. 'R_ARM_GOT_PREL' (arm*-*-linux, arm*-*-*bsd)
  4766. The 'R_ARM_V4BX' relocation (defined by the ARM AAELF specification)
  4767. enables objects compiled for the ARMv4 architecture to be
  4768. interworking-safe when linked with other objects compiled for ARMv4t,
  4769. but also allows pure ARMv4 binaries to be built from the same ARMv4
  4770. objects.
  4771. In the latter case, the switch '--fix-v4bx' must be passed to the
  4772. linker, which causes v4t 'BX rM' instructions to be rewritten as 'MOV
  4773. PC,rM', since v4 processors do not have a 'BX' instruction.
  4774. In the former case, the switch should not be used, and 'R_ARM_V4BX'
  4775. relocations are ignored.
  4776. Replace 'BX rM' instructions identified by 'R_ARM_V4BX' relocations
  4777. with a branch to the following veneer:
  4778. TST rM, #1
  4779. MOVEQ PC, rM
  4780. BX Rn
  4781. This allows generation of libraries/applications that work on ARMv4
  4782. cores and are still interworking safe. Note that the above veneer
  4783. clobbers the condition flags, so may cause incorrect program behavior in
  4784. rare cases.
  4785. The '--use-blx' switch enables the linker to use ARM/Thumb BLX
  4786. instructions (available on ARMv5t and above) in various situations.
  4787. Currently it is used to perform calls via the PLT from Thumb code using
  4788. BLX rather than using BX and a mode-switching stub before each PLT
  4789. entry. This should lead to such calls executing slightly faster.
  4790. This option is enabled implicitly for SymbianOS, so there is no need
  4791. to specify it if you are using that target.
  4792. The '--vfp11-denorm-fix' switch enables a link-time workaround for a
  4793. bug in certain VFP11 coprocessor hardware, which sometimes allows
  4794. instructions with denorm operands (which must be handled by support
  4795. code) to have those operands overwritten by subsequent instructions
  4796. before the support code can read the intended values.
  4797. The bug may be avoided in scalar mode if you allow at least one
  4798. intervening instruction between a VFP11 instruction which uses a
  4799. register and another instruction which writes to the same register, or
  4800. at least two intervening instructions if vector mode is in use. The bug
  4801. only affects full-compliance floating-point mode: you do not need this
  4802. workaround if you are using "runfast" mode. Please contact ARM for
  4803. further details.
  4804. If you know you are using buggy VFP11 hardware, you can enable this
  4805. workaround by specifying the linker option '--vfp-denorm-fix=scalar' if
  4806. you are using the VFP11 scalar mode only, or '--vfp-denorm-fix=vector'
  4807. if you are using vector mode (the latter also works for scalar code).
  4808. The default is '--vfp-denorm-fix=none'.
  4809. If the workaround is enabled, instructions are scanned for
  4810. potentially-troublesome sequences, and a veneer is created for each such
  4811. sequence which may trigger the erratum. The veneer consists of the
  4812. first instruction of the sequence and a branch back to the subsequent
  4813. instruction. The original instruction is then replaced with a branch to
  4814. the veneer. The extra cycles required to call and return from the
  4815. veneer are sufficient to avoid the erratum in both the scalar and vector
  4816. cases.
  4817. The '--fix-arm1176' switch enables a link-time workaround for an
  4818. erratum in certain ARM1176 processors. The workaround is enabled by
  4819. default if you are targeting ARM v6 (excluding ARM v6T2) or earlier. It
  4820. can be disabled unconditionally by specifying '--no-fix-arm1176'.
  4821. Further information is available in the "ARM1176JZ-S and ARM1176JZF-S
  4822. Programmer Advice Notice" available on the ARM documentation website at:
  4823. http://infocenter.arm.com/.
  4824. The '--fix-stm32l4xx-629360' switch enables a link-time workaround
  4825. for a bug in the bus matrix / memory controller for some of the STM32
  4826. Cortex-M4 based products (STM32L4xx). When accessing off-chip memory
  4827. via the affected bus for bus reads of 9 words or more, the bus can
  4828. generate corrupt data and/or abort. These are only core-initiated
  4829. accesses (not DMA), and might affect any access: integer loads such as
  4830. LDM, POP and floating-point loads such as VLDM, VPOP. Stores are not
  4831. affected.
  4832. The bug can be avoided by splitting memory accesses into the
  4833. necessary chunks to keep bus reads below 8 words.
  4834. The workaround is not enabled by default, this is equivalent to use
  4835. '--fix-stm32l4xx-629360=none'. If you know you are using buggy
  4836. STM32L4xx hardware, you can enable the workaround by specifying the
  4837. linker option '--fix-stm32l4xx-629360', or the equivalent
  4838. '--fix-stm32l4xx-629360=default'.
  4839. If the workaround is enabled, instructions are scanned for
  4840. potentially-troublesome sequences, and a veneer is created for each such
  4841. sequence which may trigger the erratum. The veneer consists in a
  4842. replacement sequence emulating the behaviour of the original one and a
  4843. branch back to the subsequent instruction. The original instruction is
  4844. then replaced with a branch to the veneer.
  4845. The workaround does not always preserve the memory access order for
  4846. the LDMDB instruction, when the instruction loads the PC.
  4847. The workaround is not able to handle problematic instructions when
  4848. they are in the middle of an IT block, since a branch is not allowed
  4849. there. In that case, the linker reports a warning and no replacement
  4850. occurs.
  4851. The workaround is not able to replace problematic instructions with a
  4852. PC-relative branch instruction if the '.text' section is too large. In
  4853. that case, when the branch that replaces the original code cannot be
  4854. encoded, the linker reports a warning and no replacement occurs.
  4855. The '--no-enum-size-warning' switch prevents the linker from warning
  4856. when linking object files that specify incompatible EABI enumeration
  4857. size attributes. For example, with this switch enabled, linking of an
  4858. object file using 32-bit enumeration values with another using
  4859. enumeration values fitted into the smallest possible space will not be
  4860. diagnosed.
  4861. The '--no-wchar-size-warning' switch prevents the linker from warning
  4862. when linking object files that specify incompatible EABI 'wchar_t' size
  4863. attributes. For example, with this switch enabled, linking of an object
  4864. file using 32-bit 'wchar_t' values with another using 16-bit 'wchar_t'
  4865. values will not be diagnosed.
  4866. The '--pic-veneer' switch makes the linker use PIC sequences for
  4867. ARM/Thumb interworking veneers, even if the rest of the binary is not
  4868. PIC. This avoids problems on uClinux targets where '--emit-relocs' is
  4869. used to generate relocatable binaries.
  4870. The linker will automatically generate and insert small sequences of
  4871. code into a linked ARM ELF executable whenever an attempt is made to
  4872. perform a function call to a symbol that is too far away. The placement
  4873. of these sequences of instructions - called stubs - is controlled by the
  4874. command-line option '--stub-group-size=N'. The placement is important
  4875. because a poor choice can create a need for duplicate stubs, increasing
  4876. the code size. The linker will try to group stubs together in order to
  4877. reduce interruptions to the flow of code, but it needs guidance as to
  4878. how big these groups should be and where they should be placed.
  4879. The value of 'N', the parameter to the '--stub-group-size=' option
  4880. controls where the stub groups are placed. If it is negative then all
  4881. stubs are placed after the first branch that needs them. If it is
  4882. positive then the stubs can be placed either before or after the
  4883. branches that need them. If the value of 'N' is 1 (either +1 or -1)
  4884. then the linker will choose exactly where to place groups of stubs,
  4885. using its built in heuristics. A value of 'N' greater than 1 (or
  4886. smaller than -1) tells the linker that a single group of stubs can
  4887. service at most 'N' bytes from the input sections.
  4888. The default, if '--stub-group-size=' is not specified, is 'N = +1'.
  4889. Farcalls stubs insertion is fully supported for the ARM-EABI target
  4890. only, because it relies on object files properties not present
  4891. otherwise.
  4892. The '--fix-cortex-a8' switch enables a link-time workaround for an
  4893. erratum in certain Cortex-A8 processors. The workaround is enabled by
  4894. default if you are targeting the ARM v7-A architecture profile. It can
  4895. be enabled otherwise by specifying '--fix-cortex-a8', or disabled
  4896. unconditionally by specifying '--no-fix-cortex-a8'.
  4897. The erratum only affects Thumb-2 code. Please contact ARM for
  4898. further details.
  4899. The '--fix-cortex-a53-835769' switch enables a link-time workaround
  4900. for erratum 835769 present on certain early revisions of Cortex-A53
  4901. processors. The workaround is disabled by default. It can be enabled
  4902. by specifying '--fix-cortex-a53-835769', or disabled unconditionally by
  4903. specifying '--no-fix-cortex-a53-835769'.
  4904. Please contact ARM for further details.
  4905. The '--no-merge-exidx-entries' switch disables the merging of
  4906. adjacent exidx entries in debuginfo.
  4907. The '--long-plt' option enables the use of 16 byte PLT entries which
  4908. support up to 4Gb of code. The default is to use 12 byte PLT entries
  4909. which only support 512Mb of code.
  4910. The '--no-apply-dynamic-relocs' option makes AArch64 linker do not
  4911. apply link-time values for dynamic relocations.
  4912. All SG veneers are placed in the special output section
  4913. '.gnu.sgstubs'. Its start address must be set, either with the
  4914. command-line option '--section-start' or in a linker script, to indicate
  4915. where to place these veneers in memory.
  4916. The '--cmse-implib' option requests that the import libraries
  4917. specified by the '--out-implib' and '--in-implib' options are secure
  4918. gateway import libraries, suitable for linking a non-secure executable
  4919. against secure code as per ARMv8-M Security Extensions.
  4920. The '--in-implib=file' specifies an input import library whose
  4921. symbols must keep the same address in the executable being produced. A
  4922. warning is given if no '--out-implib' is given but new symbols have been
  4923. introduced in the executable that should be listed in its import
  4924. library. Otherwise, if '--out-implib' is specified, the symbols are
  4925. added to the output import library. A warning is also given if some
  4926. symbols present in the input import library have disappeared from the
  4927. executable. This option is only effective for Secure Gateway import
  4928. libraries, ie. when '--cmse-implib' is specified.
  4929. 
  4930. File: ld.info, Node: HPPA ELF32, Next: M68K, Prev: ARM, Up: Machine Dependent
  4931. 4.4 'ld' and HPPA 32-bit ELF Support
  4932. ====================================
  4933. When generating a shared library, 'ld' will by default generate import
  4934. stubs suitable for use with a single sub-space application. The
  4935. '--multi-subspace' switch causes 'ld' to generate export stubs, and
  4936. different (larger) import stubs suitable for use with multiple
  4937. sub-spaces.
  4938. Long branch stubs and import/export stubs are placed by 'ld' in stub
  4939. sections located between groups of input sections. '--stub-group-size'
  4940. specifies the maximum size of a group of input sections handled by one
  4941. stub section. Since branch offsets are signed, a stub section may serve
  4942. two groups of input sections, one group before the stub section, and one
  4943. group after it. However, when using conditional branches that require
  4944. stubs, it may be better (for branch prediction) that stub sections only
  4945. serve one group of input sections. A negative value for 'N' chooses
  4946. this scheme, ensuring that branches to stubs always use a negative
  4947. offset. Two special values of 'N' are recognized, '1' and '-1'. These
  4948. both instruct 'ld' to automatically size input section groups for the
  4949. branch types detected, with the same behaviour regarding stub placement
  4950. as other positive or negative values of 'N' respectively.
  4951. Note that '--stub-group-size' does not split input sections. A
  4952. single input section larger than the group size specified will of course
  4953. create a larger group (of one section). If input sections are too
  4954. large, it may not be possible for a branch to reach its stub.
  4955. 
  4956. File: ld.info, Node: M68K, Next: MIPS, Prev: HPPA ELF32, Up: Machine Dependent
  4957. 4.5 'ld' and the Motorola 68K family
  4958. ====================================
  4959. The '--got=TYPE' option lets you choose the GOT generation scheme. The
  4960. choices are 'single', 'negative', 'multigot' and 'target'. When
  4961. 'target' is selected the linker chooses the default GOT generation
  4962. scheme for the current target. 'single' tells the linker to generate a
  4963. single GOT with entries only at non-negative offsets. 'negative'
  4964. instructs the linker to generate a single GOT with entries at both
  4965. negative and positive offsets. Not all environments support such GOTs.
  4966. 'multigot' allows the linker to generate several GOTs in the output
  4967. file. All GOT references from a single input object file access the
  4968. same GOT, but references from different input object files might access
  4969. different GOTs. Not all environments support such GOTs.
  4970. 
  4971. File: ld.info, Node: MIPS, Next: MMIX, Prev: M68K, Up: Machine Dependent
  4972. 4.6 'ld' and the MIPS family
  4973. ============================
  4974. The '--insn32' and '--no-insn32' options control the choice of microMIPS
  4975. instructions used in code generated by the linker, such as that in the
  4976. PLT or lazy binding stubs, or in relaxation. If '--insn32' is used,
  4977. then the linker only uses 32-bit instruction encodings. By default or
  4978. if '--no-insn32' is used, all instruction encodings are used, including
  4979. 16-bit ones where possible.
  4980. The '--ignore-branch-isa' and '--no-ignore-branch-isa' options
  4981. control branch relocation checks for invalid ISA mode transitions. If
  4982. '--ignore-branch-isa' is used, then the linker accepts any branch
  4983. relocations and any ISA mode transition required is lost in relocation
  4984. calculation, except for some cases of 'BAL' instructions which meet
  4985. relaxation conditions and are converted to equivalent 'JALX'
  4986. instructions as the associated relocation is calculated. By default or
  4987. if '--no-ignore-branch-isa' is used a check is made causing the loss of
  4988. an ISA mode transition to produce an error.
  4989. 
  4990. File: ld.info, Node: MMIX, Next: MSP430, Prev: MIPS, Up: Machine Dependent
  4991. 4.7 'ld' and MMIX
  4992. =================
  4993. For MMIX, there is a choice of generating 'ELF' object files or 'mmo'
  4994. object files when linking. The simulator 'mmix' understands the 'mmo'
  4995. format. The binutils 'objcopy' utility can translate between the two
  4996. formats.
  4997. There is one special section, the '.MMIX.reg_contents' section.
  4998. Contents in this section is assumed to correspond to that of global
  4999. registers, and symbols referring to it are translated to special
  5000. symbols, equal to registers. In a final link, the start address of the
  5001. '.MMIX.reg_contents' section corresponds to the first allocated global
  5002. register multiplied by 8. Register '$255' is not included in this
  5003. section; it is always set to the program entry, which is at the symbol
  5004. 'Main' for 'mmo' files.
  5005. Global symbols with the prefix '__.MMIX.start.', for example
  5006. '__.MMIX.start..text' and '__.MMIX.start..data' are special. The
  5007. default linker script uses these to set the default start address of a
  5008. section.
  5009. Initial and trailing multiples of zero-valued 32-bit words in a
  5010. section, are left out from an mmo file.
  5011. 
  5012. File: ld.info, Node: MSP430, Next: NDS32, Prev: MMIX, Up: Machine Dependent
  5013. 4.8 'ld' and MSP430
  5014. ===================
  5015. For the MSP430 it is possible to select the MPU architecture. The flag
  5016. '-m [mpu type]' will select an appropriate linker script for selected
  5017. MPU type. (To get a list of known MPUs just pass '-m help' option to
  5018. the linker).
  5019. The linker will recognize some extra sections which are MSP430
  5020. specific:
  5021. ''.vectors''
  5022. Defines a portion of ROM where interrupt vectors located.
  5023. ''.bootloader''
  5024. Defines the bootloader portion of the ROM (if applicable). Any
  5025. code in this section will be uploaded to the MPU.
  5026. ''.infomem''
  5027. Defines an information memory section (if applicable). Any code in
  5028. this section will be uploaded to the MPU.
  5029. ''.infomemnobits''
  5030. This is the same as the '.infomem' section except that any code in
  5031. this section will not be uploaded to the MPU.
  5032. ''.noinit''
  5033. Denotes a portion of RAM located above '.bss' section.
  5034. The last two sections are used by gcc.
  5035. '--code-region=[either,lower,upper,none]'
  5036. This will transform .text* sections to [either,lower,upper].text*
  5037. sections. The argument passed to GCC for -mcode-region is
  5038. propagated to the linker using this option.
  5039. '--data-region=[either,lower,upper,none]'
  5040. This will transform .data*, .bss* and .rodata* sections to
  5041. [either,lower,upper].[data,bss,rodata]* sections. The argument
  5042. passed to GCC for -mdata-region is propagated to the linker using
  5043. this option.
  5044. '--disable-sec-transformation'
  5045. Prevent the transformation of sections as specified by the
  5046. '--code-region' and '--data-region' options. This is useful if you
  5047. are compiling and linking using a single call to the GCC wrapper,
  5048. and want to compile the source files using -m[code,data]-region but
  5049. not transform the sections for prebuilt libraries and objects.
  5050. 
  5051. File: ld.info, Node: NDS32, Next: Nios II, Prev: MSP430, Up: Machine Dependent
  5052. 4.9 'ld' and NDS32
  5053. ==================
  5054. For NDS32, there are some options to select relaxation behavior. The
  5055. linker relaxes objects according to these options.
  5056. ''--m[no-]fp-as-gp''
  5057. Disable/enable fp-as-gp relaxation.
  5058. ''--mexport-symbols=FILE''
  5059. Exporting symbols and their address into FILE as linker script.
  5060. ''--m[no-]ex9''
  5061. Disable/enable link-time EX9 relaxation.
  5062. ''--mexport-ex9=FILE''
  5063. Export the EX9 table after linking.
  5064. ''--mimport-ex9=FILE''
  5065. Import the Ex9 table for EX9 relaxation.
  5066. ''--mupdate-ex9''
  5067. Update the existing EX9 table.
  5068. ''--mex9-limit=NUM''
  5069. Maximum number of entries in the ex9 table.
  5070. ''--mex9-loop-aware''
  5071. Avoid generating the EX9 instruction inside the loop.
  5072. ''--m[no-]ifc''
  5073. Disable/enable the link-time IFC optimization.
  5074. ''--mifc-loop-aware''
  5075. Avoid generating the IFC instruction inside the loop.
  5076. 
  5077. File: ld.info, Node: Nios II, Next: PowerPC ELF32, Prev: NDS32, Up: Machine Dependent
  5078. 4.10 'ld' and the Altera Nios II
  5079. ================================
  5080. Call and immediate jump instructions on Nios II processors are limited
  5081. to transferring control to addresses in the same 256MB memory segment,
  5082. which may result in 'ld' giving 'relocation truncated to fit' errors
  5083. with very large programs. The command-line option '--relax' enables the
  5084. generation of trampolines that can access the entire 32-bit address
  5085. space for calls outside the normal 'call' and 'jmpi' address range.
  5086. These trampolines are inserted at section boundaries, so may not
  5087. themselves be reachable if an input section and its associated call
  5088. trampolines are larger than 256MB.
  5089. The '--relax' option is enabled by default unless '-r' is also
  5090. specified. You can disable trampoline generation by using the
  5091. '--no-relax' linker option. You can also disable this optimization
  5092. locally by using the 'set .noat' directive in assembly-language source
  5093. files, as the linker-inserted trampolines use the 'at' register as a
  5094. temporary.
  5095. Note that the linker '--relax' option is independent of assembler
  5096. relaxation options, and that using the GNU assembler's '-relax-all'
  5097. option interferes with the linker's more selective call instruction
  5098. relaxation.
  5099. 
  5100. File: ld.info, Node: PowerPC ELF32, Next: PowerPC64 ELF64, Prev: Nios II, Up: Machine Dependent
  5101. 4.11 'ld' and PowerPC 32-bit ELF Support
  5102. ========================================
  5103. Branches on PowerPC processors are limited to a signed 26-bit
  5104. displacement, which may result in 'ld' giving 'relocation truncated to
  5105. fit' errors with very large programs. '--relax' enables the generation
  5106. of trampolines that can access the entire 32-bit address space. These
  5107. trampolines are inserted at section boundaries, so may not themselves be
  5108. reachable if an input section exceeds 33M in size. You may combine '-r'
  5109. and '--relax' to add trampolines in a partial link. In that case both
  5110. branches to undefined symbols and inter-section branches are also
  5111. considered potentially out of range, and trampolines inserted.
  5112. '--bss-plt'
  5113. Current PowerPC GCC accepts a '-msecure-plt' option that generates
  5114. code capable of using a newer PLT and GOT layout that has the
  5115. security advantage of no executable section ever needing to be
  5116. writable and no writable section ever being executable. PowerPC
  5117. 'ld' will generate this layout, including stubs to access the PLT,
  5118. if all input files (including startup and static libraries) were
  5119. compiled with '-msecure-plt'. '--bss-plt' forces the old BSS PLT
  5120. (and GOT layout) which can give slightly better performance.
  5121. '--secure-plt'
  5122. 'ld' will use the new PLT and GOT layout if it is linking new
  5123. '-fpic' or '-fPIC' code, but does not do so automatically when
  5124. linking non-PIC code. This option requests the new PLT and GOT
  5125. layout. A warning will be given if some object file requires the
  5126. old style BSS PLT.
  5127. '--sdata-got'
  5128. The new secure PLT and GOT are placed differently relative to other
  5129. sections compared to older BSS PLT and GOT placement. The location
  5130. of '.plt' must change because the new secure PLT is an initialized
  5131. section while the old PLT is uninitialized. The reason for the
  5132. '.got' change is more subtle: The new placement allows '.got' to be
  5133. read-only in applications linked with '-z relro -z now'. However,
  5134. this placement means that '.sdata' cannot always be used in shared
  5135. libraries, because the PowerPC ABI accesses '.sdata' in shared
  5136. libraries from the GOT pointer. '--sdata-got' forces the old GOT
  5137. placement. PowerPC GCC doesn't use '.sdata' in shared libraries,
  5138. so this option is really only useful for other compilers that may
  5139. do so.
  5140. '--emit-stub-syms'
  5141. This option causes 'ld' to label linker stubs with a local symbol
  5142. that encodes the stub type and destination.
  5143. '--no-tls-optimize'
  5144. PowerPC 'ld' normally performs some optimization of code sequences
  5145. used to access Thread-Local Storage. Use this option to disable
  5146. the optimization.
  5147. 
  5148. File: ld.info, Node: PowerPC64 ELF64, Next: S/390 ELF, Prev: PowerPC ELF32, Up: Machine Dependent
  5149. 4.12 'ld' and PowerPC64 64-bit ELF Support
  5150. ==========================================
  5151. '--stub-group-size'
  5152. Long branch stubs, PLT call stubs and TOC adjusting stubs are
  5153. placed by 'ld' in stub sections located between groups of input
  5154. sections. '--stub-group-size' specifies the maximum size of a
  5155. group of input sections handled by one stub section. Since branch
  5156. offsets are signed, a stub section may serve two groups of input
  5157. sections, one group before the stub section, and one group after
  5158. it. However, when using conditional branches that require stubs,
  5159. it may be better (for branch prediction) that stub sections only
  5160. serve one group of input sections. A negative value for 'N'
  5161. chooses this scheme, ensuring that branches to stubs always use a
  5162. negative offset. Two special values of 'N' are recognized, '1' and
  5163. '-1'. These both instruct 'ld' to automatically size input section
  5164. groups for the branch types detected, with the same behaviour
  5165. regarding stub placement as other positive or negative values of
  5166. 'N' respectively.
  5167. Note that '--stub-group-size' does not split input sections. A
  5168. single input section larger than the group size specified will of
  5169. course create a larger group (of one section). If input sections
  5170. are too large, it may not be possible for a branch to reach its
  5171. stub.
  5172. '--emit-stub-syms'
  5173. This option causes 'ld' to label linker stubs with a local symbol
  5174. that encodes the stub type and destination.
  5175. '--dotsyms'
  5176. '--no-dotsyms'
  5177. These two options control how 'ld' interprets version patterns in a
  5178. version script. Older PowerPC64 compilers emitted both a function
  5179. descriptor symbol with the same name as the function, and a code
  5180. entry symbol with the name prefixed by a dot ('.'). To properly
  5181. version a function 'foo', the version script thus needs to control
  5182. both 'foo' and '.foo'. The option '--dotsyms', on by default,
  5183. automatically adds the required dot-prefixed patterns. Use
  5184. '--no-dotsyms' to disable this feature.
  5185. '--save-restore-funcs'
  5186. '--no-save-restore-funcs'
  5187. These two options control whether PowerPC64 'ld' automatically
  5188. provides out-of-line register save and restore functions used by
  5189. '-Os' code. The default is to provide any such referenced function
  5190. for a normal final link, and to not do so for a relocatable link.
  5191. '--no-tls-optimize'
  5192. PowerPC64 'ld' normally performs some optimization of code
  5193. sequences used to access Thread-Local Storage. Use this option to
  5194. disable the optimization.
  5195. '--tls-get-addr-optimize'
  5196. '--no-tls-get-addr-optimize'
  5197. These options control how PowerPC64 'ld' uses a special stub to
  5198. call __tls_get_addr. PowerPC64 glibc 2.22 and later support an
  5199. optimization that allows the second and subsequent calls to
  5200. '__tls_get_addr' for a given symbol to be resolved by the special
  5201. stub without calling in to glibc. By default the linker enables
  5202. generation of the stub when glibc advertises the availability of
  5203. __tls_get_addr_opt. Using '--tls-get-addr-optimize' with an older
  5204. glibc won't do much besides slow down your applications, but may be
  5205. useful if linking an application against an older glibc with the
  5206. expectation that it will normally be used on systems having a newer
  5207. glibc. '--tls-get-addr-regsave' forces generation of a stub that
  5208. saves and restores volatile registers around the call into glibc.
  5209. Normally, this is done when the linker detects a call to
  5210. __tls_get_addr_desc. Such calls then go via the register saving
  5211. stub to __tls_get_addr_opt. '--no-tls-get-addr-regsave' disables
  5212. generation of the register saves.
  5213. '--no-opd-optimize'
  5214. PowerPC64 'ld' normally removes '.opd' section entries
  5215. corresponding to deleted link-once functions, or functions removed
  5216. by the action of '--gc-sections' or linker script '/DISCARD/'. Use
  5217. this option to disable '.opd' optimization.
  5218. '--non-overlapping-opd'
  5219. Some PowerPC64 compilers have an option to generate compressed
  5220. '.opd' entries spaced 16 bytes apart, overlapping the third word,
  5221. the static chain pointer (unused in C) with the first word of the
  5222. next entry. This option expands such entries to the full 24 bytes.
  5223. '--no-toc-optimize'
  5224. PowerPC64 'ld' normally removes unused '.toc' section entries.
  5225. Such entries are detected by examining relocations that reference
  5226. the TOC in code sections. A reloc in a deleted code section marks
  5227. a TOC word as unneeded, while a reloc in a kept code section marks
  5228. a TOC word as needed. Since the TOC may reference itself, TOC
  5229. relocs are also examined. TOC words marked as both needed and
  5230. unneeded will of course be kept. TOC words without any referencing
  5231. reloc are assumed to be part of a multi-word entry, and are kept or
  5232. discarded as per the nearest marked preceding word. This works
  5233. reliably for compiler generated code, but may be incorrect if
  5234. assembly code is used to insert TOC entries. Use this option to
  5235. disable the optimization.
  5236. '--no-inline-optimize'
  5237. PowerPC64 'ld' normally replaces inline PLT call sequences marked
  5238. with 'R_PPC64_PLTSEQ', 'R_PPC64_PLTCALL', 'R_PPC64_PLT16_HA' and
  5239. 'R_PPC64_PLT16_LO_DS' relocations by a number of 'nop's and a
  5240. direct call when the function is defined locally and can't be
  5241. overridden by some other definition. This option disables that
  5242. optimization.
  5243. '--no-multi-toc'
  5244. If given any toc option besides '-mcmodel=medium' or
  5245. '-mcmodel=large', PowerPC64 GCC generates code for a TOC model
  5246. where TOC entries are accessed with a 16-bit offset from r2. This
  5247. limits the total TOC size to 64K. PowerPC64 'ld' extends this limit
  5248. by grouping code sections such that each group uses less than 64K
  5249. for its TOC entries, then inserts r2 adjusting stubs between
  5250. inter-group calls. 'ld' does not split apart input sections, so
  5251. cannot help if a single input file has a '.toc' section that
  5252. exceeds 64K, most likely from linking multiple files with 'ld -r'.
  5253. Use this option to turn off this feature.
  5254. '--no-toc-sort'
  5255. By default, 'ld' sorts TOC sections so that those whose file
  5256. happens to have a section called '.init' or '.fini' are placed
  5257. first, followed by TOC sections referenced by code generated with
  5258. PowerPC64 gcc's '-mcmodel=small', and lastly TOC sections
  5259. referenced only by code generated with PowerPC64 gcc's
  5260. '-mcmodel=medium' or '-mcmodel=large' options. Doing this results
  5261. in better TOC grouping for multi-TOC. Use this option to turn off
  5262. this feature.
  5263. '--plt-align'
  5264. '--no-plt-align'
  5265. Use these options to control whether individual PLT call stubs are
  5266. aligned to a 32-byte boundary, or to the specified power of two
  5267. boundary when using '--plt-align='. A negative value may be
  5268. specified to pad PLT call stubs so that they do not cross the
  5269. specified power of two boundary (or the minimum number of
  5270. boundaries if a PLT stub is so large that it must cross a
  5271. boundary). By default PLT call stubs are aligned to 32-byte
  5272. boundaries.
  5273. '--plt-static-chain'
  5274. '--no-plt-static-chain'
  5275. Use these options to control whether PLT call stubs load the static
  5276. chain pointer (r11). 'ld' defaults to not loading the static chain
  5277. since there is never any need to do so on a PLT call.
  5278. '--plt-thread-safe'
  5279. '--no-plt-thread-safe'
  5280. With power7's weakly ordered memory model, it is possible when
  5281. using lazy binding for ld.so to update a plt entry in one thread
  5282. and have another thread see the individual plt entry words update
  5283. in the wrong order, despite ld.so carefully writing in the correct
  5284. order and using memory write barriers. To avoid this we need some
  5285. sort of read barrier in the call stub, or use LD_BIND_NOW=1. By
  5286. default, 'ld' looks for calls to commonly used functions that
  5287. create threads, and if seen, adds the necessary barriers. Use
  5288. these options to change the default behaviour.
  5289. '--plt-localentry'
  5290. '--no-localentry'
  5291. ELFv2 functions with localentry:0 are those with a single entry
  5292. point, ie. global entry == local entry, and that have no
  5293. requirement on r2 (the TOC/GOT pointer) or r12, and guarantee r2 is
  5294. unchanged on return. Such an external function can be called via
  5295. the PLT without saving r2 or restoring it on return, avoiding a
  5296. common load-hit-store for small functions. The optimization is
  5297. attractive, with up to 40% reduction in execution time for a small
  5298. function, but can result in symbol interposition failures. Also,
  5299. minor changes in a shared library, including system libraries, can
  5300. cause a function that was localentry:0 to become localentry:8.
  5301. This will result in a dynamic loader complaint and failure to run.
  5302. The option is experimental, use with care. '--no-plt-localentry'
  5303. is the default.
  5304. '--power10-stubs'
  5305. '--no-power10-stubs'
  5306. When PowerPC64 'ld' links input object files containing relocations
  5307. used on power10 prefixed instructions it normally creates linkage
  5308. stubs (PLT call and long branch) using power10 instructions for
  5309. '@notoc' PLT calls where 'r2' is not known. The power10 notoc
  5310. stubs are smaller and faster, so are preferred for power10.
  5311. '--power10-stubs' and '--no-power10-stubs' allow you to override
  5312. the linker's selection of stub instructions.
  5313. '--power10-stubs=auto' allows the user to select the default auto
  5314. mode.
  5315. 
  5316. File: ld.info, Node: S/390 ELF, Next: SPU ELF, Prev: PowerPC64 ELF64, Up: Machine Dependent
  5317. 4.13 'ld' and S/390 ELF Support
  5318. ===============================
  5319. '--s390-pgste'
  5320. This option marks the result file with a 'PT_S390_PGSTE' segment.
  5321. The Linux kernel is supposed to allocate 4k page tables for
  5322. binaries marked that way.
  5323. 
  5324. File: ld.info, Node: SPU ELF, Next: TI COFF, Prev: S/390 ELF, Up: Machine Dependent
  5325. 4.14 'ld' and SPU ELF Support
  5326. =============================
  5327. '--plugin'
  5328. This option marks an executable as a PIC plugin module.
  5329. '--no-overlays'
  5330. Normally, 'ld' recognizes calls to functions within overlay
  5331. regions, and redirects such calls to an overlay manager via a stub.
  5332. 'ld' also provides a built-in overlay manager. This option turns
  5333. off all this special overlay handling.
  5334. '--emit-stub-syms'
  5335. This option causes 'ld' to label overlay stubs with a local symbol
  5336. that encodes the stub type and destination.
  5337. '--extra-overlay-stubs'
  5338. This option causes 'ld' to add overlay call stubs on all function
  5339. calls out of overlay regions. Normally stubs are not added on
  5340. calls to non-overlay regions.
  5341. '--local-store=lo:hi'
  5342. 'ld' usually checks that a final executable for SPU fits in the
  5343. address range 0 to 256k. This option may be used to change the
  5344. range. Disable the check entirely with '--local-store=0:0'.
  5345. '--stack-analysis'
  5346. SPU local store space is limited. Over-allocation of stack space
  5347. unnecessarily limits space available for code and data, while
  5348. under-allocation results in runtime failures. If given this
  5349. option, 'ld' will provide an estimate of maximum stack usage. 'ld'
  5350. does this by examining symbols in code sections to determine the
  5351. extents of functions, and looking at function prologues for stack
  5352. adjusting instructions. A call-graph is created by looking for
  5353. relocations on branch instructions. The graph is then searched for
  5354. the maximum stack usage path. Note that this analysis does not
  5355. find calls made via function pointers, and does not handle
  5356. recursion and other cycles in the call graph. Stack usage may be
  5357. under-estimated if your code makes such calls. Also, stack usage
  5358. for dynamic allocation, e.g. alloca, will not be detected. If a
  5359. link map is requested, detailed information about each function's
  5360. stack usage and calls will be given.
  5361. '--emit-stack-syms'
  5362. This option, if given along with '--stack-analysis' will result in
  5363. 'ld' emitting stack sizing symbols for each function. These take
  5364. the form '__stack_<function_name>' for global functions, and
  5365. '__stack_<number>_<function_name>' for static functions.
  5366. '<number>' is the section id in hex. The value of such symbols is
  5367. the stack requirement for the corresponding function. The symbol
  5368. size will be zero, type 'STT_NOTYPE', binding 'STB_LOCAL', and
  5369. section 'SHN_ABS'.
  5370. 
  5371. File: ld.info, Node: TI COFF, Next: WIN32, Prev: SPU ELF, Up: Machine Dependent
  5372. 4.15 'ld''s Support for Various TI COFF Versions
  5373. ================================================
  5374. The '--format' switch allows selection of one of the various TI COFF
  5375. versions. The latest of this writing is 2; versions 0 and 1 are also
  5376. supported. The TI COFF versions also vary in header byte-order format;
  5377. 'ld' will read any version or byte order, but the output header format
  5378. depends on the default specified by the specific target.
  5379. 
  5380. File: ld.info, Node: WIN32, Next: Xtensa, Prev: TI COFF, Up: Machine Dependent
  5381. 4.16 'ld' and WIN32 (cygwin/mingw)
  5382. ==================================
  5383. This section describes some of the win32 specific 'ld' issues. See
  5384. *note Command-line Options: Options. for detailed description of the
  5385. command-line options mentioned here.
  5386. _import libraries_
  5387. The standard Windows linker creates and uses so-called import
  5388. libraries, which contains information for linking to dll's. They
  5389. are regular static archives and are handled as any other static
  5390. archive. The cygwin and mingw ports of 'ld' have specific support
  5391. for creating such libraries provided with the '--out-implib'
  5392. command-line option.
  5393. _exporting DLL symbols_
  5394. The cygwin/mingw 'ld' has several ways to export symbols for dll's.
  5395. _using auto-export functionality_
  5396. By default 'ld' exports symbols with the auto-export
  5397. functionality, which is controlled by the following
  5398. command-line options:
  5399. * -export-all-symbols [This is the default]
  5400. * -exclude-symbols
  5401. * -exclude-libs
  5402. * -exclude-modules-for-implib
  5403. * -version-script
  5404. When auto-export is in operation, 'ld' will export all the
  5405. non-local (global and common) symbols it finds in a DLL, with
  5406. the exception of a few symbols known to belong to the system's
  5407. runtime and libraries. As it will often not be desirable to
  5408. export all of a DLL's symbols, which may include private
  5409. functions that are not part of any public interface, the
  5410. command-line options listed above may be used to filter
  5411. symbols out from the list for exporting. The '--output-def'
  5412. option can be used in order to see the final list of exported
  5413. symbols with all exclusions taken into effect.
  5414. If '--export-all-symbols' is not given explicitly on the
  5415. command line, then the default auto-export behavior will be
  5416. _disabled_ if either of the following are true:
  5417. * A DEF file is used.
  5418. * Any symbol in any object file was marked with the
  5419. __declspec(dllexport) attribute.
  5420. _using a DEF file_
  5421. Another way of exporting symbols is using a DEF file. A DEF
  5422. file is an ASCII file containing definitions of symbols which
  5423. should be exported when a dll is created. Usually it is named
  5424. '<dll name>.def' and is added as any other object file to the
  5425. linker's command line. The file's name must end in '.def' or
  5426. '.DEF'.
  5427. gcc -o <output> <objectfiles> <dll name>.def
  5428. Using a DEF file turns off the normal auto-export behavior,
  5429. unless the '--export-all-symbols' option is also used.
  5430. Here is an example of a DEF file for a shared library called
  5431. 'xyz.dll':
  5432. LIBRARY "xyz.dll" BASE=0x20000000
  5433. EXPORTS
  5434. foo
  5435. bar
  5436. _bar = bar
  5437. another_foo = abc.dll.afoo
  5438. var1 DATA
  5439. doo = foo == foo2
  5440. eoo DATA == var1
  5441. This example defines a DLL with a non-default base address and
  5442. seven symbols in the export table. The third exported symbol
  5443. '_bar' is an alias for the second. The fourth symbol,
  5444. 'another_foo' is resolved by "forwarding" to another module
  5445. and treating it as an alias for 'afoo' exported from the DLL
  5446. 'abc.dll'. The final symbol 'var1' is declared to be a data
  5447. object. The 'doo' symbol in export library is an alias of
  5448. 'foo', which gets the string name in export table 'foo2'. The
  5449. 'eoo' symbol is an data export symbol, which gets in export
  5450. table the name 'var1'.
  5451. The optional 'LIBRARY <name>' command indicates the _internal_
  5452. name of the output DLL. If '<name>' does not include a suffix,
  5453. the default library suffix, '.DLL' is appended.
  5454. When the .DEF file is used to build an application, rather
  5455. than a library, the 'NAME <name>' command should be used
  5456. instead of 'LIBRARY'. If '<name>' does not include a suffix,
  5457. the default executable suffix, '.EXE' is appended.
  5458. With either 'LIBRARY <name>' or 'NAME <name>' the optional
  5459. specification 'BASE = <number>' may be used to specify a
  5460. non-default base address for the image.
  5461. If neither 'LIBRARY <name>' nor 'NAME <name>' is specified, or
  5462. they specify an empty string, the internal name is the same as
  5463. the filename specified on the command line.
  5464. The complete specification of an export symbol is:
  5465. EXPORTS
  5466. ( ( ( <name1> [ = <name2> ] )
  5467. | ( <name1> = <module-name> . <external-name>))
  5468. [ @ <integer> ] [NONAME] [DATA] [CONSTANT] [PRIVATE] [== <name3>] ) *
  5469. Declares '<name1>' as an exported symbol from the DLL, or
  5470. declares '<name1>' as an exported alias for '<name2>'; or
  5471. declares '<name1>' as a "forward" alias for the symbol
  5472. '<external-name>' in the DLL '<module-name>'. Optionally, the
  5473. symbol may be exported by the specified ordinal '<integer>'
  5474. alias. The optional '<name3>' is the to be used string in
  5475. import/export table for the symbol.
  5476. The optional keywords that follow the declaration indicate:
  5477. 'NONAME': Do not put the symbol name in the DLL's export
  5478. table. It will still be exported by its ordinal alias (either
  5479. the value specified by the .def specification or, otherwise,
  5480. the value assigned by the linker). The symbol name, however,
  5481. does remain visible in the import library (if any), unless
  5482. 'PRIVATE' is also specified.
  5483. 'DATA': The symbol is a variable or object, rather than a
  5484. function. The import lib will export only an indirect
  5485. reference to 'foo' as the symbol '_imp__foo' (ie, 'foo' must
  5486. be resolved as '*_imp__foo').
  5487. 'CONSTANT': Like 'DATA', but put the undecorated 'foo' as well
  5488. as '_imp__foo' into the import library. Both refer to the
  5489. read-only import address table's pointer to the variable, not
  5490. to the variable itself. This can be dangerous. If the user
  5491. code fails to add the 'dllimport' attribute and also fails to
  5492. explicitly add the extra indirection that the use of the
  5493. attribute enforces, the application will behave unexpectedly.
  5494. 'PRIVATE': Put the symbol in the DLL's export table, but do
  5495. not put it into the static import library used to resolve
  5496. imports at link time. The symbol can still be imported using
  5497. the 'LoadLibrary/GetProcAddress' API at runtime or by using
  5498. the GNU ld extension of linking directly to the DLL without an
  5499. import library.
  5500. See ld/deffilep.y in the binutils sources for the full
  5501. specification of other DEF file statements
  5502. While linking a shared dll, 'ld' is able to create a DEF file
  5503. with the '--output-def <file>' command-line option.
  5504. _Using decorations_
  5505. Another way of marking symbols for export is to modify the
  5506. source code itself, so that when building the DLL each symbol
  5507. to be exported is declared as:
  5508. __declspec(dllexport) int a_variable
  5509. __declspec(dllexport) void a_function(int with_args)
  5510. All such symbols will be exported from the DLL. If, however,
  5511. any of the object files in the DLL contain symbols decorated
  5512. in this way, then the normal auto-export behavior is disabled,
  5513. unless the '--export-all-symbols' option is also used.
  5514. Note that object files that wish to access these symbols must
  5515. _not_ decorate them with dllexport. Instead, they should use
  5516. dllimport, instead:
  5517. __declspec(dllimport) int a_variable
  5518. __declspec(dllimport) void a_function(int with_args)
  5519. This complicates the structure of library header files,
  5520. because when included by the library itself the header must
  5521. declare the variables and functions as dllexport, but when
  5522. included by client code the header must declare them as
  5523. dllimport. There are a number of idioms that are typically
  5524. used to do this; often client code can omit the __declspec()
  5525. declaration completely. See '--enable-auto-import' and
  5526. 'automatic data imports' for more information.
  5527. _automatic data imports_
  5528. The standard Windows dll format supports data imports from dlls
  5529. only by adding special decorations (dllimport/dllexport), which let
  5530. the compiler produce specific assembler instructions to deal with
  5531. this issue. This increases the effort necessary to port existing
  5532. Un*x code to these platforms, especially for large c++ libraries
  5533. and applications. The auto-import feature, which was initially
  5534. provided by Paul Sokolovsky, allows one to omit the decorations to
  5535. achieve a behavior that conforms to that on POSIX/Un*x platforms.
  5536. This feature is enabled with the '--enable-auto-import'
  5537. command-line option, although it is enabled by default on
  5538. cygwin/mingw. The '--enable-auto-import' option itself now serves
  5539. mainly to suppress any warnings that are ordinarily emitted when
  5540. linked objects trigger the feature's use.
  5541. auto-import of variables does not always work flawlessly without
  5542. additional assistance. Sometimes, you will see this message
  5543. "variable '<var>' can't be auto-imported. Please read the
  5544. documentation for ld's '--enable-auto-import' for details."
  5545. The '--enable-auto-import' documentation explains why this error
  5546. occurs, and several methods that can be used to overcome this
  5547. difficulty. One of these methods is the _runtime pseudo-relocs_
  5548. feature, described below.
  5549. For complex variables imported from DLLs (such as structs or
  5550. classes), object files typically contain a base address for the
  5551. variable and an offset (_addend_) within the variable-to specify a
  5552. particular field or public member, for instance. Unfortunately,
  5553. the runtime loader used in win32 environments is incapable of
  5554. fixing these references at runtime without the additional
  5555. information supplied by dllimport/dllexport decorations. The
  5556. standard auto-import feature described above is unable to resolve
  5557. these references.
  5558. The '--enable-runtime-pseudo-relocs' switch allows these references
  5559. to be resolved without error, while leaving the task of adjusting
  5560. the references themselves (with their non-zero addends) to
  5561. specialized code provided by the runtime environment. Recent
  5562. versions of the cygwin and mingw environments and compilers provide
  5563. this runtime support; older versions do not. However, the support
  5564. is only necessary on the developer's platform; the compiled result
  5565. will run without error on an older system.
  5566. '--enable-runtime-pseudo-relocs' is not the default; it must be
  5567. explicitly enabled as needed.
  5568. _direct linking to a dll_
  5569. The cygwin/mingw ports of 'ld' support the direct linking,
  5570. including data symbols, to a dll without the usage of any import
  5571. libraries. This is much faster and uses much less memory than does
  5572. the traditional import library method, especially when linking
  5573. large libraries or applications. When 'ld' creates an import lib,
  5574. each function or variable exported from the dll is stored in its
  5575. own bfd, even though a single bfd could contain many exports. The
  5576. overhead involved in storing, loading, and processing so many bfd's
  5577. is quite large, and explains the tremendous time, memory, and
  5578. storage needed to link against particularly large or complex
  5579. libraries when using import libs.
  5580. Linking directly to a dll uses no extra command-line switches other
  5581. than '-L' and '-l', because 'ld' already searches for a number of
  5582. names to match each library. All that is needed from the
  5583. developer's perspective is an understanding of this search, in
  5584. order to force ld to select the dll instead of an import library.
  5585. For instance, when ld is called with the argument '-lxxx' it will
  5586. attempt to find, in the first directory of its search path,
  5587. libxxx.dll.a
  5588. xxx.dll.a
  5589. libxxx.a
  5590. xxx.lib
  5591. libxxx.lib
  5592. cygxxx.dll (*)
  5593. libxxx.dll
  5594. xxx.dll
  5595. before moving on to the next directory in the search path.
  5596. (*) Actually, this is not 'cygxxx.dll' but in fact is
  5597. '<prefix>xxx.dll', where '<prefix>' is set by the 'ld' option
  5598. '--dll-search-prefix=<prefix>'. In the case of cygwin, the
  5599. standard gcc spec file includes '--dll-search-prefix=cyg', so in
  5600. effect we actually search for 'cygxxx.dll'.
  5601. Other win32-based unix environments, such as mingw or pw32, may use
  5602. other '<prefix>'es, although at present only cygwin makes use of
  5603. this feature. It was originally intended to help avoid name
  5604. conflicts among dll's built for the various win32/un*x
  5605. environments, so that (for example) two versions of a zlib dll
  5606. could coexist on the same machine.
  5607. The generic cygwin/mingw path layout uses a 'bin' directory for
  5608. applications and dll's and a 'lib' directory for the import
  5609. libraries (using cygwin nomenclature):
  5610. bin/
  5611. cygxxx.dll
  5612. lib/
  5613. libxxx.dll.a (in case of dll's)
  5614. libxxx.a (in case of static archive)
  5615. Linking directly to a dll without using the import library can be
  5616. done two ways:
  5617. 1. Use the dll directly by adding the 'bin' path to the link line
  5618. gcc -Wl,-verbose -o a.exe -L../bin/ -lxxx
  5619. However, as the dll's often have version numbers appended to their
  5620. names ('cygncurses-5.dll') this will often fail, unless one
  5621. specifies '-L../bin -lncurses-5' to include the version. Import
  5622. libs are generally not versioned, and do not have this difficulty.
  5623. 2. Create a symbolic link from the dll to a file in the 'lib'
  5624. directory according to the above mentioned search pattern. This
  5625. should be used to avoid unwanted changes in the tools needed for
  5626. making the app/dll.
  5627. ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a]
  5628. Then you can link without any make environment changes.
  5629. gcc -Wl,-verbose -o a.exe -L../lib/ -lxxx
  5630. This technique also avoids the version number problems, because the
  5631. following is perfectly legal
  5632. bin/
  5633. cygxxx-5.dll
  5634. lib/
  5635. libxxx.dll.a -> ../bin/cygxxx-5.dll
  5636. Linking directly to a dll without using an import lib will work
  5637. even when auto-import features are exercised, and even when
  5638. '--enable-runtime-pseudo-relocs' is used.
  5639. Given the improvements in speed and memory usage, one might
  5640. justifiably wonder why import libraries are used at all. There are
  5641. three reasons:
  5642. 1. Until recently, the link-directly-to-dll functionality did
  5643. _not_ work with auto-imported data.
  5644. 2. Sometimes it is necessary to include pure static objects within
  5645. the import library (which otherwise contains only bfd's for
  5646. indirection symbols that point to the exports of a dll). Again,
  5647. the import lib for the cygwin kernel makes use of this ability, and
  5648. it is not possible to do this without an import lib.
  5649. 3. Symbol aliases can only be resolved using an import lib. This
  5650. is critical when linking against OS-supplied dll's (eg, the win32
  5651. API) in which symbols are usually exported as undecorated aliases
  5652. of their stdcall-decorated assembly names.
  5653. So, import libs are not going away. But the ability to replace
  5654. true import libs with a simple symbolic link to (or a copy of) a
  5655. dll, in many cases, is a useful addition to the suite of tools
  5656. binutils makes available to the win32 developer. Given the massive
  5657. improvements in memory requirements during linking, storage
  5658. requirements, and linking speed, we expect that many developers
  5659. will soon begin to use this feature whenever possible.
  5660. _symbol aliasing_
  5661. _adding additional names_
  5662. Sometimes, it is useful to export symbols with additional
  5663. names. A symbol 'foo' will be exported as 'foo', but it can
  5664. also be exported as '_foo' by using special directives in the
  5665. DEF file when creating the dll. This will affect also the
  5666. optional created import library. Consider the following DEF
  5667. file:
  5668. LIBRARY "xyz.dll" BASE=0x61000000
  5669. EXPORTS
  5670. foo
  5671. _foo = foo
  5672. The line '_foo = foo' maps the symbol 'foo' to '_foo'.
  5673. Another method for creating a symbol alias is to create it in
  5674. the source code using the "weak" attribute:
  5675. void foo () { /* Do something. */; }
  5676. void _foo () __attribute__ ((weak, alias ("foo")));
  5677. See the gcc manual for more information about attributes and
  5678. weak symbols.
  5679. _renaming symbols_
  5680. Sometimes it is useful to rename exports. For instance, the
  5681. cygwin kernel does this regularly. A symbol '_foo' can be
  5682. exported as 'foo' but not as '_foo' by using special
  5683. directives in the DEF file. (This will also affect the import
  5684. library, if it is created). In the following example:
  5685. LIBRARY "xyz.dll" BASE=0x61000000
  5686. EXPORTS
  5687. _foo = foo
  5688. The line '_foo = foo' maps the exported symbol 'foo' to
  5689. '_foo'.
  5690. Note: using a DEF file disables the default auto-export behavior,
  5691. unless the '--export-all-symbols' command-line option is used. If,
  5692. however, you are trying to rename symbols, then you should list
  5693. _all_ desired exports in the DEF file, including the symbols that
  5694. are not being renamed, and do _not_ use the '--export-all-symbols'
  5695. option. If you list only the renamed symbols in the DEF file, and
  5696. use '--export-all-symbols' to handle the other symbols, then the
  5697. both the new names _and_ the original names for the renamed symbols
  5698. will be exported. In effect, you'd be aliasing those symbols, not
  5699. renaming them, which is probably not what you wanted.
  5700. _weak externals_
  5701. The Windows object format, PE, specifies a form of weak symbols
  5702. called weak externals. When a weak symbol is linked and the symbol
  5703. is not defined, the weak symbol becomes an alias for some other
  5704. symbol. There are three variants of weak externals:
  5705. * Definition is searched for in objects and libraries,
  5706. historically called lazy externals.
  5707. * Definition is searched for only in other objects, not in
  5708. libraries. This form is not presently implemented.
  5709. * No search; the symbol is an alias. This form is not presently
  5710. implemented.
  5711. As a GNU extension, weak symbols that do not specify an alternate
  5712. symbol are supported. If the symbol is undefined when linking, the
  5713. symbol uses a default value.
  5714. _aligned common symbols_
  5715. As a GNU extension to the PE file format, it is possible to specify
  5716. the desired alignment for a common symbol. This information is
  5717. conveyed from the assembler or compiler to the linker by means of
  5718. GNU-specific commands carried in the object file's '.drectve'
  5719. section, which are recognized by 'ld' and respected when laying out
  5720. the common symbols. Native tools will be able to process object
  5721. files employing this GNU extension, but will fail to respect the
  5722. alignment instructions, and may issue noisy warnings about unknown
  5723. linker directives.
  5724. 
  5725. File: ld.info, Node: Xtensa, Prev: WIN32, Up: Machine Dependent
  5726. 4.17 'ld' and Xtensa Processors
  5727. ===============================
  5728. The default 'ld' behavior for Xtensa processors is to interpret
  5729. 'SECTIONS' commands so that lists of explicitly named sections in a
  5730. specification with a wildcard file will be interleaved when necessary to
  5731. keep literal pools within the range of PC-relative load offsets. For
  5732. example, with the command:
  5733. SECTIONS
  5734. {
  5735. .text : {
  5736. *(.literal .text)
  5737. }
  5738. }
  5739. 'ld' may interleave some of the '.literal' and '.text' sections from
  5740. different object files to ensure that the literal pools are within the
  5741. range of PC-relative load offsets. A valid interleaving might place the
  5742. '.literal' sections from an initial group of files followed by the
  5743. '.text' sections of that group of files. Then, the '.literal' sections
  5744. from the rest of the files and the '.text' sections from the rest of the
  5745. files would follow.
  5746. Relaxation is enabled by default for the Xtensa version of 'ld' and
  5747. provides two important link-time optimizations. The first optimization
  5748. is to combine identical literal values to reduce code size. A redundant
  5749. literal will be removed and all the 'L32R' instructions that use it will
  5750. be changed to reference an identical literal, as long as the location of
  5751. the replacement literal is within the offset range of all the 'L32R'
  5752. instructions. The second optimization is to remove unnecessary overhead
  5753. from assembler-generated "longcall" sequences of 'L32R'/'CALLXN' when
  5754. the target functions are within range of direct 'CALLN' instructions.
  5755. For each of these cases where an indirect call sequence can be
  5756. optimized to a direct call, the linker will change the 'CALLXN'
  5757. instruction to a 'CALLN' instruction, remove the 'L32R' instruction, and
  5758. remove the literal referenced by the 'L32R' instruction if it is not
  5759. used for anything else. Removing the 'L32R' instruction always reduces
  5760. code size but can potentially hurt performance by changing the alignment
  5761. of subsequent branch targets. By default, the linker will always
  5762. preserve alignments, either by switching some instructions between
  5763. 24-bit encodings and the equivalent density instructions or by inserting
  5764. a no-op in place of the 'L32R' instruction that was removed. If code
  5765. size is more important than performance, the '--size-opt' option can be
  5766. used to prevent the linker from widening density instructions or
  5767. inserting no-ops, except in a few cases where no-ops are required for
  5768. correctness.
  5769. The following Xtensa-specific command-line options can be used to
  5770. control the linker:
  5771. '--size-opt'
  5772. When optimizing indirect calls to direct calls, optimize for code
  5773. size more than performance. With this option, the linker will not
  5774. insert no-ops or widen density instructions to preserve branch
  5775. target alignment. There may still be some cases where no-ops are
  5776. required to preserve the correctness of the code.
  5777. '--abi-windowed'
  5778. '--abi-call0'
  5779. Choose ABI for the output object and for the generated PLT code.
  5780. PLT code inserted by the linker must match ABI of the output object
  5781. because windowed and call0 ABI use incompatible function call
  5782. conventions. Default ABI is chosen by the ABI tag in the
  5783. '.xtensa.info' section of the first input object. A warning is
  5784. issued if ABI tags of input objects do not match each other or the
  5785. chosen output object ABI.
  5786. 
  5787. File: ld.info, Node: BFD, Next: Reporting Bugs, Prev: Machine Dependent, Up: Top
  5788. 5 BFD
  5789. *****
  5790. The linker accesses object and archive files using the BFD libraries.
  5791. These libraries allow the linker to use the same routines to operate on
  5792. object files whatever the object file format. A different object file
  5793. format can be supported simply by creating a new BFD back end and adding
  5794. it to the library. To conserve runtime memory, however, the linker and
  5795. associated tools are usually configured to support only a subset of the
  5796. object file formats available. You can use 'objdump -i' (*note objdump:
  5797. (binutils.info)objdump.) to list all the formats available for your
  5798. configuration.
  5799. As with most implementations, BFD is a compromise between several
  5800. conflicting requirements. The major factor influencing BFD design was
  5801. efficiency: any time used converting between formats is time which would
  5802. not have been spent had BFD not been involved. This is partly offset by
  5803. abstraction payback; since BFD simplifies applications and back ends,
  5804. more time and care may be spent optimizing algorithms for a greater
  5805. speed.
  5806. One minor artifact of the BFD solution which you should bear in mind
  5807. is the potential for information loss. There are two places where
  5808. useful information can be lost using the BFD mechanism: during
  5809. conversion and during output. *Note BFD information loss::.
  5810. * Menu:
  5811. * BFD outline:: How it works: an outline of BFD
  5812. 
  5813. File: ld.info, Node: BFD outline, Up: BFD
  5814. 5.1 How It Works: An Outline of BFD
  5815. ===================================
  5816. When an object file is opened, BFD subroutines automatically determine
  5817. the format of the input object file. They then build a descriptor in
  5818. memory with pointers to routines that will be used to access elements of
  5819. the object file's data structures.
  5820. As different information from the object files is required, BFD reads
  5821. from different sections of the file and processes them. For example, a
  5822. very common operation for the linker is processing symbol tables. Each
  5823. BFD back end provides a routine for converting between the object file's
  5824. representation of symbols and an internal canonical format. When the
  5825. linker asks for the symbol table of an object file, it calls through a
  5826. memory pointer to the routine from the relevant BFD back end which reads
  5827. and converts the table into a canonical form. The linker then operates
  5828. upon the canonical form. When the link is finished and the linker
  5829. writes the output file's symbol table, another BFD back end routine is
  5830. called to take the newly created symbol table and convert it into the
  5831. chosen output format.
  5832. * Menu:
  5833. * BFD information loss:: Information Loss
  5834. * Canonical format:: The BFD canonical object-file format
  5835. 
  5836. File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline
  5837. 5.1.1 Information Loss
  5838. ----------------------
  5839. _Information can be lost during output._ The output formats supported
  5840. by BFD do not provide identical facilities, and information which can be
  5841. described in one form has nowhere to go in another format. One example
  5842. of this is alignment information in 'b.out'. There is nowhere in an
  5843. 'a.out' format file to store alignment information on the contained
  5844. data, so when a file is linked from 'b.out' and an 'a.out' image is
  5845. produced, alignment information will not propagate to the output file.
  5846. (The linker will still use the alignment information internally, so the
  5847. link is performed correctly).
  5848. Another example is COFF section names. COFF files may contain an
  5849. unlimited number of sections, each one with a textual section name. If
  5850. the target of the link is a format which does not have many sections
  5851. (e.g., 'a.out') or has sections without names (e.g., the Oasys format),
  5852. the link cannot be done simply. You can circumvent this problem by
  5853. describing the desired input-to-output section mapping with the linker
  5854. command language.
  5855. _Information can be lost during canonicalization._ The BFD internal
  5856. canonical form of the external formats is not exhaustive; there are
  5857. structures in input formats for which there is no direct representation
  5858. internally. This means that the BFD back ends cannot maintain all
  5859. possible data richness through the transformation between external to
  5860. internal and back to external formats.
  5861. This limitation is only a problem when an application reads one
  5862. format and writes another. Each BFD back end is responsible for
  5863. maintaining as much data as possible, and the internal BFD canonical
  5864. form has structures which are opaque to the BFD core, and exported only
  5865. to the back ends. When a file is read in one format, the canonical form
  5866. is generated for BFD and the application. At the same time, the back
  5867. end saves away any information which may otherwise be lost. If the data
  5868. is then written back in the same format, the back end routine will be
  5869. able to use the canonical form provided by the BFD core as well as the
  5870. information it prepared earlier. Since there is a great deal of
  5871. commonality between back ends, there is no information lost when linking
  5872. or copying big endian COFF to little endian COFF, or 'a.out' to 'b.out'.
  5873. When a mixture of formats is linked, the information is only lost from
  5874. the files whose format differs from the destination.
  5875. 
  5876. File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline
  5877. 5.1.2 The BFD canonical object-file format
  5878. ------------------------------------------
  5879. The greatest potential for loss of information occurs when there is the
  5880. least overlap between the information provided by the source format,
  5881. that stored by the canonical format, and that needed by the destination
  5882. format. A brief description of the canonical form may help you
  5883. understand which kinds of data you can count on preserving across
  5884. conversions.
  5885. _files_
  5886. Information stored on a per-file basis includes target machine
  5887. architecture, particular implementation format type, a demand
  5888. pageable bit, and a write protected bit. Information like Unix
  5889. magic numbers is not stored here--only the magic numbers' meaning,
  5890. so a 'ZMAGIC' file would have both the demand pageable bit and the
  5891. write protected text bit set. The byte order of the target is
  5892. stored on a per-file basis, so that big- and little-endian object
  5893. files may be used with one another.
  5894. _sections_
  5895. Each section in the input file contains the name of the section,
  5896. the section's original address in the object file, size and
  5897. alignment information, various flags, and pointers into other BFD
  5898. data structures.
  5899. _symbols_
  5900. Each symbol contains a pointer to the information for the object
  5901. file which originally defined it, its name, its value, and various
  5902. flag bits. When a BFD back end reads in a symbol table, it
  5903. relocates all symbols to make them relative to the base of the
  5904. section where they were defined. Doing this ensures that each
  5905. symbol points to its containing section. Each symbol also has a
  5906. varying amount of hidden private data for the BFD back end. Since
  5907. the symbol points to the original file, the private data format for
  5908. that symbol is accessible. 'ld' can operate on a collection of
  5909. symbols of wildly different formats without problems.
  5910. Normal global and simple local symbols are maintained on output, so
  5911. an output file (no matter its format) will retain symbols pointing
  5912. to functions and to global, static, and common variables. Some
  5913. symbol information is not worth retaining; in 'a.out', type
  5914. information is stored in the symbol table as long symbol names.
  5915. This information would be useless to most COFF debuggers; the
  5916. linker has command-line switches to allow users to throw it away.
  5917. There is one word of type information within the symbol, so if the
  5918. format supports symbol type information within symbols (for
  5919. example, COFF, Oasys) and the type is simple enough to fit within
  5920. one word (nearly everything but aggregates), the information will
  5921. be preserved.
  5922. _relocation level_
  5923. Each canonical BFD relocation record contains a pointer to the
  5924. symbol to relocate to, the offset of the data to relocate, the
  5925. section the data is in, and a pointer to a relocation type
  5926. descriptor. Relocation is performed by passing messages through
  5927. the relocation type descriptor and the symbol pointer. Therefore,
  5928. relocations can be performed on output data using a relocation
  5929. method that is only available in one of the input formats. For
  5930. instance, Oasys provides a byte relocation format. A relocation
  5931. record requesting this relocation type would point indirectly to a
  5932. routine to perform this, so the relocation may be performed on a
  5933. byte being written to a 68k COFF file, even though 68k COFF has no
  5934. such relocation type.
  5935. _line numbers_
  5936. Object formats can contain, for debugging purposes, some form of
  5937. mapping between symbols, source line numbers, and addresses in the
  5938. output file. These addresses have to be relocated along with the
  5939. symbol information. Each symbol with an associated list of line
  5940. number records points to the first record of the list. The head of
  5941. a line number list consists of a pointer to the symbol, which
  5942. allows finding out the address of the function whose line number is
  5943. being described. The rest of the list is made up of pairs: offsets
  5944. into the section and line numbers. Any format which can simply
  5945. derive this information can pass it successfully between formats.
  5946. 
  5947. File: ld.info, Node: Reporting Bugs, Next: MRI, Prev: BFD, Up: Top
  5948. 6 Reporting Bugs
  5949. ****************
  5950. Your bug reports play an essential role in making 'ld' reliable.
  5951. Reporting a bug may help you by bringing a solution to your problem,
  5952. or it may not. But in any case the principal function of a bug report
  5953. is to help the entire community by making the next version of 'ld' work
  5954. better. Bug reports are your contribution to the maintenance of 'ld'.
  5955. In order for a bug report to serve its purpose, you must include the
  5956. information that enables us to fix the bug.
  5957. * Menu:
  5958. * Bug Criteria:: Have you found a bug?
  5959. * Bug Reporting:: How to report bugs
  5960. 
  5961. File: ld.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs
  5962. 6.1 Have You Found a Bug?
  5963. =========================
  5964. If you are not sure whether you have found a bug, here are some
  5965. guidelines:
  5966. * If the linker gets a fatal signal, for any input whatever, that is
  5967. a 'ld' bug. Reliable linkers never crash.
  5968. * If 'ld' produces an error message for valid input, that is a bug.
  5969. * If 'ld' does not produce an error message for invalid input, that
  5970. may be a bug. In the general case, the linker can not verify that
  5971. object files are correct.
  5972. * If you are an experienced user of linkers, your suggestions for
  5973. improvement of 'ld' are welcome in any case.
  5974. 
  5975. File: ld.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs
  5976. 6.2 How to Report Bugs
  5977. ======================
  5978. A number of companies and individuals offer support for GNU products.
  5979. If you obtained 'ld' from a support organization, we recommend you
  5980. contact that organization first.
  5981. You can find contact information for many support companies and
  5982. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  5983. Otherwise, send bug reports for 'ld' to
  5984. <http://www.sourceware.org/bugzilla/>.
  5985. The fundamental principle of reporting bugs usefully is this: *report
  5986. all the facts*. If you are not sure whether to state a fact or leave it
  5987. out, state it!
  5988. Often people omit facts because they think they know what causes the
  5989. problem and assume that some details do not matter. Thus, you might
  5990. assume that the name of a symbol you use in an example does not matter.
  5991. Well, probably it does not, but one cannot be sure. Perhaps the bug is
  5992. a stray memory reference which happens to fetch from the location where
  5993. that name is stored in memory; perhaps, if the name were different, the
  5994. contents of that location would fool the linker into doing the right
  5995. thing despite the bug. Play it safe and give a specific, complete
  5996. example. That is the easiest thing for you to do, and the most helpful.
  5997. Keep in mind that the purpose of a bug report is to enable us to fix
  5998. the bug if it is new to us. Therefore, always write your bug reports on
  5999. the assumption that the bug has not been reported previously.
  6000. Sometimes people give a few sketchy facts and ask, "Does this ring a
  6001. bell?" This cannot help us fix a bug, so it is basically useless. We
  6002. respond by asking for enough details to enable us to investigate. You
  6003. might as well expedite matters by sending them to begin with.
  6004. To enable us to fix the bug, you should include all these things:
  6005. * The version of 'ld'. 'ld' announces it if you start it with the
  6006. '--version' argument.
  6007. Without this, we will not know whether there is any point in
  6008. looking for the bug in the current version of 'ld'.
  6009. * Any patches you may have applied to the 'ld' source, including any
  6010. patches made to the 'BFD' library.
  6011. * The type of machine you are using, and the operating system name
  6012. and version number.
  6013. * What compiler (and its version) was used to compile 'ld'--e.g.
  6014. "'gcc-2.7'".
  6015. * The command arguments you gave the linker to link your example and
  6016. observe the bug. To guarantee you will not omit something
  6017. important, list them all. A copy of the Makefile (or the output
  6018. from make) is sufficient.
  6019. If we were to try to guess the arguments, we would probably guess
  6020. wrong and then we might not encounter the bug.
  6021. * A complete input file, or set of input files, that will reproduce
  6022. the bug. It is generally most helpful to send the actual object
  6023. files provided that they are reasonably small. Say no more than
  6024. 10K. For bigger files you can either make them available by FTP or
  6025. HTTP or else state that you are willing to send the object file(s)
  6026. to whomever requests them. (Note - your email will be going to a
  6027. mailing list, so we do not want to clog it up with large
  6028. attachments). But small attachments are best.
  6029. If the source files were assembled using 'gas' or compiled using
  6030. 'gcc', then it may be OK to send the source files rather than the
  6031. object files. In this case, be sure to say exactly what version of
  6032. 'gas' or 'gcc' was used to produce the object files. Also say how
  6033. 'gas' or 'gcc' were configured.
  6034. * A description of what behavior you observe that you believe is
  6035. incorrect. For example, "It gets a fatal signal."
  6036. Of course, if the bug is that 'ld' gets a fatal signal, then we
  6037. will certainly notice it. But if the bug is incorrect output, we
  6038. might not notice unless it is glaringly wrong. You might as well
  6039. not give us a chance to make a mistake.
  6040. Even if the problem you experience is a fatal signal, you should
  6041. still say so explicitly. Suppose something strange is going on,
  6042. such as, your copy of 'ld' is out of sync, or you have encountered
  6043. a bug in the C library on your system. (This has happened!) Your
  6044. copy might crash and ours would not. If you told us to expect a
  6045. crash, then when ours fails to crash, we would know that the bug
  6046. was not happening for us. If you had not told us to expect a
  6047. crash, then we would not be able to draw any conclusion from our
  6048. observations.
  6049. * If you wish to suggest changes to the 'ld' source, send us context
  6050. diffs, as generated by 'diff' with the '-u', '-c', or '-p' option.
  6051. Always send diffs from the old file to the new file. If you even
  6052. discuss something in the 'ld' source, refer to it by context, not
  6053. by line number.
  6054. The line numbers in our development sources will not match those in
  6055. your sources. Your line numbers would convey no useful information
  6056. to us.
  6057. Here are some things that are not necessary:
  6058. * A description of the envelope of the bug.
  6059. Often people who encounter a bug spend a lot of time investigating
  6060. which changes to the input file will make the bug go away and which
  6061. changes will not affect it.
  6062. This is often time consuming and not very useful, because the way
  6063. we will find the bug is by running a single example under the
  6064. debugger with breakpoints, not by pure deduction from a series of
  6065. examples. We recommend that you save your time for something else.
  6066. Of course, if you can find a simpler example to report _instead_ of
  6067. the original one, that is a convenience for us. Errors in the
  6068. output will be easier to spot, running under the debugger will take
  6069. less time, and so on.
  6070. However, simplification is not vital; if you do not want to do
  6071. this, report the bug anyway and send us the entire test case you
  6072. used.
  6073. * A patch for the bug.
  6074. A patch for the bug does help us if it is a good one. But do not
  6075. omit the necessary information, such as the test case, on the
  6076. assumption that a patch is all we need. We might see problems with
  6077. your patch and decide to fix the problem another way, or we might
  6078. not understand it at all.
  6079. Sometimes with a program as complicated as 'ld' it is very hard to
  6080. construct an example that will make the program follow a certain
  6081. path through the code. If you do not send us the example, we will
  6082. not be able to construct one, so we will not be able to verify that
  6083. the bug is fixed.
  6084. And if we cannot understand what bug you are trying to fix, or why
  6085. your patch should be an improvement, we will not install it. A
  6086. test case will help us to understand.
  6087. * A guess about what the bug is or what it depends on.
  6088. Such guesses are usually wrong. Even we cannot guess right about
  6089. such things without first using the debugger to find the facts.
  6090. 
  6091. File: ld.info, Node: MRI, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top
  6092. Appendix A MRI Compatible Script Files
  6093. **************************************
  6094. To aid users making the transition to GNU 'ld' from the MRI linker, 'ld'
  6095. can use MRI compatible linker scripts as an alternative to the more
  6096. general-purpose linker scripting language described in *note Scripts::.
  6097. MRI compatible linker scripts have a much simpler command set than the
  6098. scripting language otherwise used with 'ld'. GNU 'ld' supports the most
  6099. commonly used MRI linker commands; these commands are described here.
  6100. In general, MRI scripts aren't of much use with the 'a.out' object
  6101. file format, since it only has three sections and MRI scripts lack some
  6102. features to make use of them.
  6103. You can specify a file containing an MRI-compatible script using the
  6104. '-c' command-line option.
  6105. Each command in an MRI-compatible script occupies its own line; each
  6106. command line starts with the keyword that identifies the command (though
  6107. blank lines are also allowed for punctuation). If a line of an
  6108. MRI-compatible script begins with an unrecognized keyword, 'ld' issues a
  6109. warning message, but continues processing the script.
  6110. Lines beginning with '*' are comments.
  6111. You can write these commands using all upper-case letters, or all
  6112. lower case; for example, 'chip' is the same as 'CHIP'. The following
  6113. list shows only the upper-case form of each command.
  6114. 'ABSOLUTE SECNAME'
  6115. 'ABSOLUTE SECNAME, SECNAME, ... SECNAME'
  6116. Normally, 'ld' includes in the output file all sections from all
  6117. the input files. However, in an MRI-compatible script, you can use
  6118. the 'ABSOLUTE' command to restrict the sections that will be
  6119. present in your output program. If the 'ABSOLUTE' command is used
  6120. at all in a script, then only the sections named explicitly in
  6121. 'ABSOLUTE' commands will appear in the linker output. You can
  6122. still use other input sections (whatever you select on the command
  6123. line, or using 'LOAD') to resolve addresses in the output file.
  6124. 'ALIAS OUT-SECNAME, IN-SECNAME'
  6125. Use this command to place the data from input section IN-SECNAME in
  6126. a section called OUT-SECNAME in the linker output file.
  6127. IN-SECNAME may be an integer.
  6128. 'ALIGN SECNAME = EXPRESSION'
  6129. Align the section called SECNAME to EXPRESSION. The EXPRESSION
  6130. should be a power of two.
  6131. 'BASE EXPRESSION'
  6132. Use the value of EXPRESSION as the lowest address (other than
  6133. absolute addresses) in the output file.
  6134. 'CHIP EXPRESSION'
  6135. 'CHIP EXPRESSION, EXPRESSION'
  6136. This command does nothing; it is accepted only for compatibility.
  6137. 'END'
  6138. This command does nothing whatever; it's only accepted for
  6139. compatibility.
  6140. 'FORMAT OUTPUT-FORMAT'
  6141. Similar to the 'OUTPUT_FORMAT' command in the more general linker
  6142. language, but restricted to S-records, if OUTPUT-FORMAT is 'S'
  6143. 'LIST ANYTHING...'
  6144. Print (to the standard output file) a link map, as produced by the
  6145. 'ld' command-line option '-M'.
  6146. The keyword 'LIST' may be followed by anything on the same line,
  6147. with no change in its effect.
  6148. 'LOAD FILENAME'
  6149. 'LOAD FILENAME, FILENAME, ... FILENAME'
  6150. Include one or more object file FILENAME in the link; this has the
  6151. same effect as specifying FILENAME directly on the 'ld' command
  6152. line.
  6153. 'NAME OUTPUT-NAME'
  6154. OUTPUT-NAME is the name for the program produced by 'ld'; the
  6155. MRI-compatible command 'NAME' is equivalent to the command-line
  6156. option '-o' or the general script language command 'OUTPUT'.
  6157. 'ORDER SECNAME, SECNAME, ... SECNAME'
  6158. 'ORDER SECNAME SECNAME SECNAME'
  6159. Normally, 'ld' orders the sections in its output file in the order
  6160. in which they first appear in the input files. In an
  6161. MRI-compatible script, you can override this ordering with the
  6162. 'ORDER' command. The sections you list with 'ORDER' will appear
  6163. first in your output file, in the order specified.
  6164. 'PUBLIC NAME=EXPRESSION'
  6165. 'PUBLIC NAME,EXPRESSION'
  6166. 'PUBLIC NAME EXPRESSION'
  6167. Supply a value (EXPRESSION) for external symbol NAME used in the
  6168. linker input files.
  6169. 'SECT SECNAME, EXPRESSION'
  6170. 'SECT SECNAME=EXPRESSION'
  6171. 'SECT SECNAME EXPRESSION'
  6172. You can use any of these three forms of the 'SECT' command to
  6173. specify the start address (EXPRESSION) for section SECNAME. If you
  6174. have more than one 'SECT' statement for the same SECNAME, only the
  6175. _first_ sets the start address.
  6176. 
  6177. File: ld.info, Node: GNU Free Documentation License, Next: LD Index, Prev: MRI, Up: Top
  6178. Appendix B GNU Free Documentation License
  6179. *****************************************
  6180. Version 1.3, 3 November 2008
  6181. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  6182. <http://fsf.org/>
  6183. Everyone is permitted to copy and distribute verbatim copies
  6184. of this license document, but changing it is not allowed.
  6185. 0. PREAMBLE
  6186. The purpose of this License is to make a manual, textbook, or other
  6187. functional and useful document "free" in the sense of freedom: to
  6188. assure everyone the effective freedom to copy and redistribute it,
  6189. with or without modifying it, either commercially or
  6190. noncommercially. Secondarily, this License preserves for the
  6191. author and publisher a way to get credit for their work, while not
  6192. being considered responsible for modifications made by others.
  6193. This License is a kind of "copyleft", which means that derivative
  6194. works of the document must themselves be free in the same sense.
  6195. It complements the GNU General Public License, which is a copyleft
  6196. license designed for free software.
  6197. We have designed this License in order to use it for manuals for
  6198. free software, because free software needs free documentation: a
  6199. free program should come with manuals providing the same freedoms
  6200. that the software does. But this License is not limited to
  6201. software manuals; it can be used for any textual work, regardless
  6202. of subject matter or whether it is published as a printed book. We
  6203. recommend this License principally for works whose purpose is
  6204. instruction or reference.
  6205. 1. APPLICABILITY AND DEFINITIONS
  6206. This License applies to any manual or other work, in any medium,
  6207. that contains a notice placed by the copyright holder saying it can
  6208. be distributed under the terms of this License. Such a notice
  6209. grants a world-wide, royalty-free license, unlimited in duration,
  6210. to use that work under the conditions stated herein. The
  6211. "Document", below, refers to any such manual or work. Any member
  6212. of the public is a licensee, and is addressed as "you". You accept
  6213. the license if you copy, modify or distribute the work in a way
  6214. requiring permission under copyright law.
  6215. A "Modified Version" of the Document means any work containing the
  6216. Document or a portion of it, either copied verbatim, or with
  6217. modifications and/or translated into another language.
  6218. A "Secondary Section" is a named appendix or a front-matter section
  6219. of the Document that deals exclusively with the relationship of the
  6220. publishers or authors of the Document to the Document's overall
  6221. subject (or to related matters) and contains nothing that could
  6222. fall directly within that overall subject. (Thus, if the Document
  6223. is in part a textbook of mathematics, a Secondary Section may not
  6224. explain any mathematics.) The relationship could be a matter of
  6225. historical connection with the subject or with related matters, or
  6226. of legal, commercial, philosophical, ethical or political position
  6227. regarding them.
  6228. The "Invariant Sections" are certain Secondary Sections whose
  6229. titles are designated, as being those of Invariant Sections, in the
  6230. notice that says that the Document is released under this License.
  6231. If a section does not fit the above definition of Secondary then it
  6232. is not allowed to be designated as Invariant. The Document may
  6233. contain zero Invariant Sections. If the Document does not identify
  6234. any Invariant Sections then there are none.
  6235. The "Cover Texts" are certain short passages of text that are
  6236. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  6237. that says that the Document is released under this License. A
  6238. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  6239. be at most 25 words.
  6240. A "Transparent" copy of the Document means a machine-readable copy,
  6241. represented in a format whose specification is available to the
  6242. general public, that is suitable for revising the document
  6243. straightforwardly with generic text editors or (for images composed
  6244. of pixels) generic paint programs or (for drawings) some widely
  6245. available drawing editor, and that is suitable for input to text
  6246. formatters or for automatic translation to a variety of formats
  6247. suitable for input to text formatters. A copy made in an otherwise
  6248. Transparent file format whose markup, or absence of markup, has
  6249. been arranged to thwart or discourage subsequent modification by
  6250. readers is not Transparent. An image format is not Transparent if
  6251. used for any substantial amount of text. A copy that is not
  6252. "Transparent" is called "Opaque".
  6253. Examples of suitable formats for Transparent copies include plain
  6254. ASCII without markup, Texinfo input format, LaTeX input format,
  6255. SGML or XML using a publicly available DTD, and standard-conforming
  6256. simple HTML, PostScript or PDF designed for human modification.
  6257. Examples of transparent image formats include PNG, XCF and JPG.
  6258. Opaque formats include proprietary formats that can be read and
  6259. edited only by proprietary word processors, SGML or XML for which
  6260. the DTD and/or processing tools are not generally available, and
  6261. the machine-generated HTML, PostScript or PDF produced by some word
  6262. processors for output purposes only.
  6263. The "Title Page" means, for a printed book, the title page itself,
  6264. plus such following pages as are needed to hold, legibly, the
  6265. material this License requires to appear in the title page. For
  6266. works in formats which do not have any title page as such, "Title
  6267. Page" means the text near the most prominent appearance of the
  6268. work's title, preceding the beginning of the body of the text.
  6269. The "publisher" means any person or entity that distributes copies
  6270. of the Document to the public.
  6271. A section "Entitled XYZ" means a named subunit of the Document
  6272. whose title either is precisely XYZ or contains XYZ in parentheses
  6273. following text that translates XYZ in another language. (Here XYZ
  6274. stands for a specific section name mentioned below, such as
  6275. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  6276. To "Preserve the Title" of such a section when you modify the
  6277. Document means that it remains a section "Entitled XYZ" according
  6278. to this definition.
  6279. The Document may include Warranty Disclaimers next to the notice
  6280. which states that this License applies to the Document. These
  6281. Warranty Disclaimers are considered to be included by reference in
  6282. this License, but only as regards disclaiming warranties: any other
  6283. implication that these Warranty Disclaimers may have is void and
  6284. has no effect on the meaning of this License.
  6285. 2. VERBATIM COPYING
  6286. You may copy and distribute the Document in any medium, either
  6287. commercially or noncommercially, provided that this License, the
  6288. copyright notices, and the license notice saying this License
  6289. applies to the Document are reproduced in all copies, and that you
  6290. add no other conditions whatsoever to those of this License. You
  6291. may not use technical measures to obstruct or control the reading
  6292. or further copying of the copies you make or distribute. However,
  6293. you may accept compensation in exchange for copies. If you
  6294. distribute a large enough number of copies you must also follow the
  6295. conditions in section 3.
  6296. You may also lend copies, under the same conditions stated above,
  6297. and you may publicly display copies.
  6298. 3. COPYING IN QUANTITY
  6299. If you publish printed copies (or copies in media that commonly
  6300. have printed covers) of the Document, numbering more than 100, and
  6301. the Document's license notice requires Cover Texts, you must
  6302. enclose the copies in covers that carry, clearly and legibly, all
  6303. these Cover Texts: Front-Cover Texts on the front cover, and
  6304. Back-Cover Texts on the back cover. Both covers must also clearly
  6305. and legibly identify you as the publisher of these copies. The
  6306. front cover must present the full title with all words of the title
  6307. equally prominent and visible. You may add other material on the
  6308. covers in addition. Copying with changes limited to the covers, as
  6309. long as they preserve the title of the Document and satisfy these
  6310. conditions, can be treated as verbatim copying in other respects.
  6311. If the required texts for either cover are too voluminous to fit
  6312. legibly, you should put the first ones listed (as many as fit
  6313. reasonably) on the actual cover, and continue the rest onto
  6314. adjacent pages.
  6315. If you publish or distribute Opaque copies of the Document
  6316. numbering more than 100, you must either include a machine-readable
  6317. Transparent copy along with each Opaque copy, or state in or with
  6318. each Opaque copy a computer-network location from which the general
  6319. network-using public has access to download using public-standard
  6320. network protocols a complete Transparent copy of the Document, free
  6321. of added material. If you use the latter option, you must take
  6322. reasonably prudent steps, when you begin distribution of Opaque
  6323. copies in quantity, to ensure that this Transparent copy will
  6324. remain thus accessible at the stated location until at least one
  6325. year after the last time you distribute an Opaque copy (directly or
  6326. through your agents or retailers) of that edition to the public.
  6327. It is requested, but not required, that you contact the authors of
  6328. the Document well before redistributing any large number of copies,
  6329. to give them a chance to provide you with an updated version of the
  6330. Document.
  6331. 4. MODIFICATIONS
  6332. You may copy and distribute a Modified Version of the Document
  6333. under the conditions of sections 2 and 3 above, provided that you
  6334. release the Modified Version under precisely this License, with the
  6335. Modified Version filling the role of the Document, thus licensing
  6336. distribution and modification of the Modified Version to whoever
  6337. possesses a copy of it. In addition, you must do these things in
  6338. the Modified Version:
  6339. A. Use in the Title Page (and on the covers, if any) a title
  6340. distinct from that of the Document, and from those of previous
  6341. versions (which should, if there were any, be listed in the
  6342. History section of the Document). You may use the same title
  6343. as a previous version if the original publisher of that
  6344. version gives permission.
  6345. B. List on the Title Page, as authors, one or more persons or
  6346. entities responsible for authorship of the modifications in
  6347. the Modified Version, together with at least five of the
  6348. principal authors of the Document (all of its principal
  6349. authors, if it has fewer than five), unless they release you
  6350. from this requirement.
  6351. C. State on the Title page the name of the publisher of the
  6352. Modified Version, as the publisher.
  6353. D. Preserve all the copyright notices of the Document.
  6354. E. Add an appropriate copyright notice for your modifications
  6355. adjacent to the other copyright notices.
  6356. F. Include, immediately after the copyright notices, a license
  6357. notice giving the public permission to use the Modified
  6358. Version under the terms of this License, in the form shown in
  6359. the Addendum below.
  6360. G. Preserve in that license notice the full lists of Invariant
  6361. Sections and required Cover Texts given in the Document's
  6362. license notice.
  6363. H. Include an unaltered copy of this License.
  6364. I. Preserve the section Entitled "History", Preserve its Title,
  6365. and add to it an item stating at least the title, year, new
  6366. authors, and publisher of the Modified Version as given on the
  6367. Title Page. If there is no section Entitled "History" in the
  6368. Document, create one stating the title, year, authors, and
  6369. publisher of the Document as given on its Title Page, then add
  6370. an item describing the Modified Version as stated in the
  6371. previous sentence.
  6372. J. Preserve the network location, if any, given in the Document
  6373. for public access to a Transparent copy of the Document, and
  6374. likewise the network locations given in the Document for
  6375. previous versions it was based on. These may be placed in the
  6376. "History" section. You may omit a network location for a work
  6377. that was published at least four years before the Document
  6378. itself, or if the original publisher of the version it refers
  6379. to gives permission.
  6380. K. For any section Entitled "Acknowledgements" or "Dedications",
  6381. Preserve the Title of the section, and preserve in the section
  6382. all the substance and tone of each of the contributor
  6383. acknowledgements and/or dedications given therein.
  6384. L. Preserve all the Invariant Sections of the Document, unaltered
  6385. in their text and in their titles. Section numbers or the
  6386. equivalent are not considered part of the section titles.
  6387. M. Delete any section Entitled "Endorsements". Such a section
  6388. may not be included in the Modified Version.
  6389. N. Do not retitle any existing section to be Entitled
  6390. "Endorsements" or to conflict in title with any Invariant
  6391. Section.
  6392. O. Preserve any Warranty Disclaimers.
  6393. If the Modified Version includes new front-matter sections or
  6394. appendices that qualify as Secondary Sections and contain no
  6395. material copied from the Document, you may at your option designate
  6396. some or all of these sections as invariant. To do this, add their
  6397. titles to the list of Invariant Sections in the Modified Version's
  6398. license notice. These titles must be distinct from any other
  6399. section titles.
  6400. You may add a section Entitled "Endorsements", provided it contains
  6401. nothing but endorsements of your Modified Version by various
  6402. parties--for example, statements of peer review or that the text
  6403. has been approved by an organization as the authoritative
  6404. definition of a standard.
  6405. You may add a passage of up to five words as a Front-Cover Text,
  6406. and a passage of up to 25 words as a Back-Cover Text, to the end of
  6407. the list of Cover Texts in the Modified Version. Only one passage
  6408. of Front-Cover Text and one of Back-Cover Text may be added by (or
  6409. through arrangements made by) any one entity. If the Document
  6410. already includes a cover text for the same cover, previously added
  6411. by you or by arrangement made by the same entity you are acting on
  6412. behalf of, you may not add another; but you may replace the old
  6413. one, on explicit permission from the previous publisher that added
  6414. the old one.
  6415. The author(s) and publisher(s) of the Document do not by this
  6416. License give permission to use their names for publicity for or to
  6417. assert or imply endorsement of any Modified Version.
  6418. 5. COMBINING DOCUMENTS
  6419. You may combine the Document with other documents released under
  6420. this License, under the terms defined in section 4 above for
  6421. modified versions, provided that you include in the combination all
  6422. of the Invariant Sections of all of the original documents,
  6423. unmodified, and list them all as Invariant Sections of your
  6424. combined work in its license notice, and that you preserve all
  6425. their Warranty Disclaimers.
  6426. The combined work need only contain one copy of this License, and
  6427. multiple identical Invariant Sections may be replaced with a single
  6428. copy. If there are multiple Invariant Sections with the same name
  6429. but different contents, make the title of each such section unique
  6430. by adding at the end of it, in parentheses, the name of the
  6431. original author or publisher of that section if known, or else a
  6432. unique number. Make the same adjustment to the section titles in
  6433. the list of Invariant Sections in the license notice of the
  6434. combined work.
  6435. In the combination, you must combine any sections Entitled
  6436. "History" in the various original documents, forming one section
  6437. Entitled "History"; likewise combine any sections Entitled
  6438. "Acknowledgements", and any sections Entitled "Dedications". You
  6439. must delete all sections Entitled "Endorsements."
  6440. 6. COLLECTIONS OF DOCUMENTS
  6441. You may make a collection consisting of the Document and other
  6442. documents released under this License, and replace the individual
  6443. copies of this License in the various documents with a single copy
  6444. that is included in the collection, provided that you follow the
  6445. rules of this License for verbatim copying of each of the documents
  6446. in all other respects.
  6447. You may extract a single document from such a collection, and
  6448. distribute it individually under this License, provided you insert
  6449. a copy of this License into the extracted document, and follow this
  6450. License in all other respects regarding verbatim copying of that
  6451. document.
  6452. 7. AGGREGATION WITH INDEPENDENT WORKS
  6453. A compilation of the Document or its derivatives with other
  6454. separate and independent documents or works, in or on a volume of a
  6455. storage or distribution medium, is called an "aggregate" if the
  6456. copyright resulting from the compilation is not used to limit the
  6457. legal rights of the compilation's users beyond what the individual
  6458. works permit. When the Document is included in an aggregate, this
  6459. License does not apply to the other works in the aggregate which
  6460. are not themselves derivative works of the Document.
  6461. If the Cover Text requirement of section 3 is applicable to these
  6462. copies of the Document, then if the Document is less than one half
  6463. of the entire aggregate, the Document's Cover Texts may be placed
  6464. on covers that bracket the Document within the aggregate, or the
  6465. electronic equivalent of covers if the Document is in electronic
  6466. form. Otherwise they must appear on printed covers that bracket
  6467. the whole aggregate.
  6468. 8. TRANSLATION
  6469. Translation is considered a kind of modification, so you may
  6470. distribute translations of the Document under the terms of section
  6471. 4. Replacing Invariant Sections with translations requires special
  6472. permission from their copyright holders, but you may include
  6473. translations of some or all Invariant Sections in addition to the
  6474. original versions of these Invariant Sections. You may include a
  6475. translation of this License, and all the license notices in the
  6476. Document, and any Warranty Disclaimers, provided that you also
  6477. include the original English version of this License and the
  6478. original versions of those notices and disclaimers. In case of a
  6479. disagreement between the translation and the original version of
  6480. this License or a notice or disclaimer, the original version will
  6481. prevail.
  6482. If a section in the Document is Entitled "Acknowledgements",
  6483. "Dedications", or "History", the requirement (section 4) to
  6484. Preserve its Title (section 1) will typically require changing the
  6485. actual title.
  6486. 9. TERMINATION
  6487. You may not copy, modify, sublicense, or distribute the Document
  6488. except as expressly provided under this License. Any attempt
  6489. otherwise to copy, modify, sublicense, or distribute it is void,
  6490. and will automatically terminate your rights under this License.
  6491. However, if you cease all violation of this License, then your
  6492. license from a particular copyright holder is reinstated (a)
  6493. provisionally, unless and until the copyright holder explicitly and
  6494. finally terminates your license, and (b) permanently, if the
  6495. copyright holder fails to notify you of the violation by some
  6496. reasonable means prior to 60 days after the cessation.
  6497. Moreover, your license from a particular copyright holder is
  6498. reinstated permanently if the copyright holder notifies you of the
  6499. violation by some reasonable means, this is the first time you have
  6500. received notice of violation of this License (for any work) from
  6501. that copyright holder, and you cure the violation prior to 30 days
  6502. after your receipt of the notice.
  6503. Termination of your rights under this section does not terminate
  6504. the licenses of parties who have received copies or rights from you
  6505. under this License. If your rights have been terminated and not
  6506. permanently reinstated, receipt of a copy of some or all of the
  6507. same material does not give you any rights to use it.
  6508. 10. FUTURE REVISIONS OF THIS LICENSE
  6509. The Free Software Foundation may publish new, revised versions of
  6510. the GNU Free Documentation License from time to time. Such new
  6511. versions will be similar in spirit to the present version, but may
  6512. differ in detail to address new problems or concerns. See
  6513. <http://www.gnu.org/copyleft/>.
  6514. Each version of the License is given a distinguishing version
  6515. number. If the Document specifies that a particular numbered
  6516. version of this License "or any later version" applies to it, you
  6517. have the option of following the terms and conditions either of
  6518. that specified version or of any later version that has been
  6519. published (not as a draft) by the Free Software Foundation. If the
  6520. Document does not specify a version number of this License, you may
  6521. choose any version ever published (not as a draft) by the Free
  6522. Software Foundation. If the Document specifies that a proxy can
  6523. decide which future versions of this License can be used, that
  6524. proxy's public statement of acceptance of a version permanently
  6525. authorizes you to choose that version for the Document.
  6526. 11. RELICENSING
  6527. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  6528. World Wide Web server that publishes copyrightable works and also
  6529. provides prominent facilities for anybody to edit those works. A
  6530. public wiki that anybody can edit is an example of such a server.
  6531. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  6532. site means any set of copyrightable works thus published on the MMC
  6533. site.
  6534. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  6535. license published by Creative Commons Corporation, a not-for-profit
  6536. corporation with a principal place of business in San Francisco,
  6537. California, as well as future copyleft versions of that license
  6538. published by that same organization.
  6539. "Incorporate" means to publish or republish a Document, in whole or
  6540. in part, as part of another Document.
  6541. An MMC is "eligible for relicensing" if it is licensed under this
  6542. License, and if all works that were first published under this
  6543. License somewhere other than this MMC, and subsequently
  6544. incorporated in whole or in part into the MMC, (1) had no cover
  6545. texts or invariant sections, and (2) were thus incorporated prior
  6546. to November 1, 2008.
  6547. The operator of an MMC Site may republish an MMC contained in the
  6548. site under CC-BY-SA on the same site at any time before August 1,
  6549. 2009, provided the MMC is eligible for relicensing.
  6550. ADDENDUM: How to use this License for your documents
  6551. ====================================================
  6552. To use this License in a document you have written, include a copy of
  6553. the License in the document and put the following copyright and license
  6554. notices just after the title page:
  6555. Copyright (C) YEAR YOUR NAME.
  6556. Permission is granted to copy, distribute and/or modify this document
  6557. under the terms of the GNU Free Documentation License, Version 1.3
  6558. or any later version published by the Free Software Foundation;
  6559. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  6560. Texts. A copy of the license is included in the section entitled ``GNU
  6561. Free Documentation License''.
  6562. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  6563. Texts, replace the "with...Texts." line with this:
  6564. with the Invariant Sections being LIST THEIR TITLES, with
  6565. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  6566. being LIST.
  6567. If you have Invariant Sections without Cover Texts, or some other
  6568. combination of the three, merge those two alternatives to suit the
  6569. situation.
  6570. If your document contains nontrivial examples of program code, we
  6571. recommend releasing these examples in parallel under your choice of free
  6572. software license, such as the GNU General Public License, to permit
  6573. their use in free software.
  6574. 
  6575. File: ld.info, Node: LD Index, Prev: GNU Free Documentation License, Up: Top
  6576. LD Index
  6577. ********
  6578. �[index�]
  6579. * Menu:
  6580. * ": Symbols. (line 6)
  6581. * -(: Options. (line 989)
  6582. * --accept-unknown-input-arch: Options. (line 1007)
  6583. * --add-needed: Options. (line 1034)
  6584. * --add-stdcall-alias: Options. (line 2025)
  6585. * --allow-multiple-definition: Options. (line 1338)
  6586. * --allow-shlib-undefined: Options. (line 1344)
  6587. * --as-needed: Options. (line 1017)
  6588. * --audit AUDITLIB: Options. (line 111)
  6589. * --auxiliary=NAME: Options. (line 294)
  6590. * --bank-window: Options. (line 2498)
  6591. * --base-file: Options. (line 2030)
  6592. * --be8: ARM. (line 28)
  6593. * --branch-stub on C-SKY: Options. (line 2470)
  6594. * --bss-plt: PowerPC ELF32. (line 16)
  6595. * --build-id: Options. (line 1987)
  6596. * --build-id=STYLE: Options. (line 1987)
  6597. * --check-sections: Options. (line 1112)
  6598. * --cmse-implib: ARM. (line 234)
  6599. * --code-region: MSP430. (line 34)
  6600. * --compact-branches: Options. (line 2543)
  6601. * --compress-debug-sections=none: Options. (line 1945)
  6602. * --compress-debug-sections=zlib: Options. (line 1945)
  6603. * --compress-debug-sections=zlib-gabi: Options. (line 1945)
  6604. * --compress-debug-sections=zlib-gnu: Options. (line 1945)
  6605. * --copy-dt-needed-entries: Options. (line 1124)
  6606. * --cref: Options. (line 1144)
  6607. * --data-region: MSP430. (line 39)
  6608. * --default-imported-symver: Options. (line 1380)
  6609. * --default-script=SCRIPT: Options. (line 660)
  6610. * --default-symver: Options. (line 1376)
  6611. * --defsym=SYMBOL=EXP: Options. (line 1181)
  6612. * --demangle[=STYLE]: Options. (line 1193)
  6613. * --depaudit AUDITLIB: Options. (line 164)
  6614. * --dependency-file=DEPFILE: Options. (line 527)
  6615. * --disable-auto-image-base: Options. (line 2207)
  6616. * --disable-auto-import: Options. (line 2346)
  6617. * --disable-large-address-aware: Options. (line 2155)
  6618. * --disable-long-section-names: Options. (line 2040)
  6619. * --disable-multiple-abs-defs: Options. (line 1224)
  6620. * --disable-new-dtags: Options. (line 1919)
  6621. * --disable-runtime-pseudo-reloc: Options. (line 2359)
  6622. * --disable-sec-transformation: MSP430. (line 45)
  6623. * --disable-stdcall-fixup: Options. (line 2062)
  6624. * --discard-all: Options. (line 745)
  6625. * --discard-locals: Options. (line 749)
  6626. * --dll: Options. (line 2035)
  6627. * --dll-search-prefix: Options. (line 2213)
  6628. * --dotsyms: PowerPC64 ELF64. (line 33)
  6629. * --dsbt-index: Options. (line 2457)
  6630. * --dsbt-size: Options. (line 2452)
  6631. * --dynamic-linker=FILE: Options. (line 1206)
  6632. * --dynamic-list-cpp-new: Options. (line 1104)
  6633. * --dynamic-list-cpp-typeinfo: Options. (line 1108)
  6634. * --dynamic-list-data: Options. (line 1101)
  6635. * --dynamic-list=DYNAMIC-LIST-FILE: Options. (line 1088)
  6636. * --dynamicbase: Options. (line 2400)
  6637. * --eh-frame-hdr: Options. (line 1908)
  6638. * --embedded-relocs: Options. (line 1219)
  6639. * --emit-relocs: Options. (line 587)
  6640. * --emit-stack-syms: SPU ELF. (line 46)
  6641. * --emit-stub-syms: PowerPC ELF32. (line 47)
  6642. * --emit-stub-syms <1>: PowerPC64 ELF64. (line 29)
  6643. * --emit-stub-syms <2>: SPU ELF. (line 15)
  6644. * --enable-auto-image-base: Options. (line 2198)
  6645. * --enable-auto-import: Options. (line 2222)
  6646. * --enable-extra-pe-debug: Options. (line 2364)
  6647. * --enable-long-section-names: Options. (line 2040)
  6648. * --enable-new-dtags: Options. (line 1919)
  6649. * --enable-non-contiguous-regions: Options. (line 174)
  6650. * --enable-non-contiguous-regions-warnings: Options. (line 206)
  6651. * --enable-reloc-section: Options. (line 2440)
  6652. * --enable-runtime-pseudo-reloc: Options. (line 2351)
  6653. * --enable-stdcall-fixup: Options. (line 2062)
  6654. * --entry=ENTRY: Options. (line 212)
  6655. * --error-unresolved-symbols: Options. (line 1844)
  6656. * --exclude-all-symbols: Options. (line 2115)
  6657. * --exclude-libs: Options. (line 222)
  6658. * --exclude-modules-for-implib: Options. (line 233)
  6659. * --exclude-symbols: Options. (line 2109)
  6660. * --export-all-symbols: Options. (line 2085)
  6661. * --export-dynamic: Options. (line 246)
  6662. * --export-dynamic-symbol-list=FILE: Options. (line 282)
  6663. * --export-dynamic-symbol=GLOB: Options. (line 273)
  6664. * --extra-overlay-stubs: SPU ELF. (line 19)
  6665. * --fatal-warnings: Options. (line 1228)
  6666. * --file-alignment: Options. (line 2119)
  6667. * --filter=NAME: Options. (line 315)
  6668. * --fix-arm1176: ARM. (line 111)
  6669. * --fix-cortex-a53-835769: ARM. (line 211)
  6670. * --fix-cortex-a8: ARM. (line 202)
  6671. * --fix-stm32l4xx-629360: ARM. (line 120)
  6672. * --fix-v4bx: ARM. (line 48)
  6673. * --fix-v4bx-interworking: ARM. (line 61)
  6674. * --force-dynamic: Options. (line 596)
  6675. * --force-exe-suffix: Options. (line 1233)
  6676. * --force-group-allocation: Options. (line 1173)
  6677. * --forceinteg: Options. (line 2406)
  6678. * --format=FORMAT: Options. (line 121)
  6679. * --format=VERSION: TI COFF. (line 6)
  6680. * --gc-keep-exported: Options. (line 1278)
  6681. * --gc-sections: Options. (line 1243)
  6682. * --got: Options. (line 2510)
  6683. * --got=TYPE: M68K. (line 6)
  6684. * --gpsize=VALUE: Options. (line 347)
  6685. * --hash-size=NUMBER: Options. (line 1929)
  6686. * --hash-style=STYLE: Options. (line 1937)
  6687. * --heap: Options. (line 2125)
  6688. * --help: Options. (line 1306)
  6689. * --high-entropy-va: Options. (line 2395)
  6690. * --ignore-branch-isa: Options. (line 2531)
  6691. * --ignore-branch-isa <1>: MIPS. (line 13)
  6692. * --image-base: Options. (line 2132)
  6693. * --imagic: Options. (line 2580)
  6694. * --in-implib=FILE: ARM. (line 239)
  6695. * --insert-timestamp: Options. (line 2429)
  6696. * --insn32: Options. (line 2522)
  6697. * --insn32 <1>: MIPS. (line 6)
  6698. * --just-symbols=FILE: Options. (line 618)
  6699. * --kill-at: Options. (line 2141)
  6700. * --large-address-aware: Options. (line 2146)
  6701. * --ld-generated-unwind-info: Options. (line 1914)
  6702. * --leading-underscore: Options. (line 2079)
  6703. * --library-path=DIR: Options. (line 405)
  6704. * --library=NAMESPEC: Options. (line 372)
  6705. * --local-store=lo:hi: SPU ELF. (line 24)
  6706. * --long-plt: ARM. (line 222)
  6707. * --major-image-version: Options. (line 2162)
  6708. * --major-os-version: Options. (line 2167)
  6709. * --major-subsystem-version: Options. (line 2171)
  6710. * --merge-exidx-entries: ARM. (line 219)
  6711. * --minor-image-version: Options. (line 2176)
  6712. * --minor-os-version: Options. (line 2181)
  6713. * --minor-subsystem-version: Options. (line 2185)
  6714. * --mri-script=MRI-CMDFILE: Options. (line 145)
  6715. * --multi-subspace: HPPA ELF32. (line 6)
  6716. * --nmagic: Options. (line 500)
  6717. * --nmagic <1>: Options. (line 2570)
  6718. * --no-accept-unknown-input-arch: Options. (line 1007)
  6719. * --no-add-needed: Options. (line 1034)
  6720. * --no-allow-shlib-undefined: Options. (line 1344)
  6721. * --no-apply-dynamic-relocs: ARM. (line 226)
  6722. * --no-as-needed: Options. (line 1017)
  6723. * --no-bind: Options. (line 2420)
  6724. * --no-check-sections: Options. (line 1112)
  6725. * --no-compact-branches: Options. (line 2544)
  6726. * --no-copy-dt-needed-entries: Options. (line 1124)
  6727. * --no-define-common: Options. (line 1157)
  6728. * --no-demangle: Options. (line 1193)
  6729. * --no-dotsyms: PowerPC64 ELF64. (line 33)
  6730. * --no-dynamic-linker: Options. (line 1213)
  6731. * --no-eh-frame-hdr: Options. (line 1908)
  6732. * --no-enum-size-warning: ARM. (line 158)
  6733. * --no-export-dynamic: Options. (line 246)
  6734. * --no-fatal-warnings: Options. (line 1228)
  6735. * --no-fix-arm1176: ARM. (line 111)
  6736. * --no-fix-cortex-a53-835769: ARM. (line 211)
  6737. * --no-fix-cortex-a8: ARM. (line 202)
  6738. * --no-gc-sections: Options. (line 1243)
  6739. * --no-ignore-branch-isa: Options. (line 2532)
  6740. * --no-ignore-branch-isa <1>: MIPS. (line 13)
  6741. * --no-inline-optimize: PowerPC64 ELF64. (line 101)
  6742. * --no-insn32: Options. (line 2523)
  6743. * --no-insn32 <1>: MIPS. (line 6)
  6744. * --no-isolation: Options. (line 2413)
  6745. * --no-keep-memory: Options. (line 1321)
  6746. * --no-leading-underscore: Options. (line 2079)
  6747. * --no-merge-exidx-entries: Options. (line 2464)
  6748. * --no-merge-exidx-entries <1>: ARM. (line 219)
  6749. * --no-multi-toc: PowerPC64 ELF64. (line 109)
  6750. * --no-omagic: Options. (line 515)
  6751. * --no-omagic <1>: Options. (line 2594)
  6752. * --no-opd-optimize: PowerPC64 ELF64. (line 75)
  6753. * --no-overlays: SPU ELF. (line 9)
  6754. * --no-plt-align: PowerPC64 ELF64. (line 131)
  6755. * --no-plt-localentry: PowerPC64 ELF64. (line 160)
  6756. * --no-plt-static-chain: PowerPC64 ELF64. (line 142)
  6757. * --no-plt-thread-safe: PowerPC64 ELF64. (line 148)
  6758. * --no-power10-stubs: PowerPC64 ELF64. (line 176)
  6759. * --no-print-gc-sections: Options. (line 1269)
  6760. * --no-print-map-discarded: Options. (line 495)
  6761. * --no-save-restore-funcs: PowerPC64 ELF64. (line 44)
  6762. * --no-seh: Options. (line 2416)
  6763. * --no-strip-discarded: Options. (line 638)
  6764. * --no-tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  6765. * --no-tls-get-addr-regsave: PowerPC64 ELF64. (line 56)
  6766. * --no-tls-optimize: PowerPC ELF32. (line 51)
  6767. * --no-tls-optimize <1>: PowerPC64 ELF64. (line 51)
  6768. * --no-toc-optimize: PowerPC64 ELF64. (line 87)
  6769. * --no-toc-sort: PowerPC64 ELF64. (line 121)
  6770. * --no-trampoline: Options. (line 2492)
  6771. * --no-undefined: Options. (line 1328)
  6772. * --no-undefined-version: Options. (line 1371)
  6773. * --no-warn-mismatch: Options. (line 1384)
  6774. * --no-warn-search-mismatch: Options. (line 1393)
  6775. * --no-wchar-size-warning: ARM. (line 165)
  6776. * --no-whole-archive: Options. (line 1397)
  6777. * --noinhibit-exec: Options. (line 1401)
  6778. * --non-overlapping-opd: PowerPC64 ELF64. (line 81)
  6779. * --nxcompat: Options. (line 2409)
  6780. * --oformat=OUTPUT-FORMAT: Options. (line 1412)
  6781. * --omagic: Options. (line 506)
  6782. * --omagic <1>: Options. (line 2559)
  6783. * --orphan-handling=MODE: Options. (line 704)
  6784. * --out-implib: Options. (line 1425)
  6785. * --output-def: Options. (line 2190)
  6786. * --output=OUTPUT: Options. (line 521)
  6787. * --pic-executable: Options. (line 1434)
  6788. * --pic-veneer: ARM. (line 171)
  6789. * --plt-align: PowerPC64 ELF64. (line 131)
  6790. * --plt-localentry: PowerPC64 ELF64. (line 160)
  6791. * --plt-static-chain: PowerPC64 ELF64. (line 142)
  6792. * --plt-thread-safe: PowerPC64 ELF64. (line 148)
  6793. * --plugin: SPU ELF. (line 6)
  6794. * --pop-state: Options. (line 583)
  6795. * --power10-stubs: PowerPC64 ELF64. (line 176)
  6796. * --print-gc-sections: Options. (line 1269)
  6797. * --print-map: Options. (line 440)
  6798. * --print-map-discarded: Options. (line 495)
  6799. * --print-memory-usage: Options. (line 1294)
  6800. * --print-output-format: Options. (line 1288)
  6801. * --push-state: Options. (line 565)
  6802. * --reduce-memory-overheads: Options. (line 1973)
  6803. * --relax: Options. (line 1450)
  6804. * --relax on Nios II: Nios II. (line 6)
  6805. * --relax on PowerPC: PowerPC ELF32. (line 6)
  6806. * --relax on Xtensa: Xtensa. (line 27)
  6807. * --relocatable: Options. (line 600)
  6808. * --require-defined=SYMBOL: Options. (line 686)
  6809. * --retain-symbols-file=FILENAME: Options. (line 1476)
  6810. * --s390-pgste: S/390 ELF. (line 6)
  6811. * --save-restore-funcs: PowerPC64 ELF64. (line 44)
  6812. * --script=SCRIPT: Options. (line 651)
  6813. * --sdata-got: PowerPC ELF32. (line 33)
  6814. * --section-alignment: Options. (line 2369)
  6815. * --section-start=SECTIONNAME=ORG: Options. (line 1657)
  6816. * --secure-plt: PowerPC ELF32. (line 26)
  6817. * --sort-common: Options. (line 1589)
  6818. * --sort-section=alignment: Options. (line 1604)
  6819. * --sort-section=name: Options. (line 1600)
  6820. * --spare-dynamic-tags: Options. (line 1608)
  6821. * --split-by-file: Options. (line 1613)
  6822. * --split-by-reloc: Options. (line 1618)
  6823. * --stack: Options. (line 2375)
  6824. * --stack-analysis: SPU ELF. (line 29)
  6825. * --stats: Options. (line 1631)
  6826. * --strip-all: Options. (line 629)
  6827. * --strip-debug: Options. (line 633)
  6828. * --strip-discarded: Options. (line 638)
  6829. * --stub-group-size: PowerPC64 ELF64. (line 6)
  6830. * --stub-group-size on C-SKY: Options. (line 2477)
  6831. * --stub-group-size=N: ARM. (line 176)
  6832. * --stub-group-size=N <1>: HPPA ELF32. (line 12)
  6833. * --subsystem: Options. (line 2382)
  6834. * --support-old-code: ARM. (line 6)
  6835. * --sysroot=DIRECTORY: Options. (line 1635)
  6836. * --target-help: Options. (line 1310)
  6837. * --target1-abs: ARM. (line 33)
  6838. * --target1-rel: ARM. (line 33)
  6839. * --target2=TYPE: ARM. (line 38)
  6840. * --task-link: Options. (line 1640)
  6841. * --thumb-entry=ENTRY: ARM. (line 17)
  6842. * --tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  6843. * --tls-get-addr-regsave: PowerPC64 ELF64. (line 56)
  6844. * --trace: Options. (line 643)
  6845. * --trace-symbol=SYMBOL: Options. (line 755)
  6846. * --traditional-format: Options. (line 1645)
  6847. * --tsaware: Options. (line 2426)
  6848. * --undefined=SYMBOL: Options. (line 673)
  6849. * --unique[=SECTION]: Options. (line 730)
  6850. * --unresolved-symbols: Options. (line 1687)
  6851. * --use-blx: ARM. (line 73)
  6852. * --use-nul-prefixed-import-tables: ARM. (line 23)
  6853. * --verbose[=NUMBER]: Options. (line 1716)
  6854. * --version: Options. (line 739)
  6855. * --version-script=VERSION-SCRIPTFILE: Options. (line 1724)
  6856. * --vfp11-denorm-fix: ARM. (line 82)
  6857. * --warn-alternate-em: Options. (line 1836)
  6858. * --warn-common: Options. (line 1734)
  6859. * --warn-constructors: Options. (line 1802)
  6860. * --warn-multiple-gp: Options. (line 1807)
  6861. * --warn-once: Options. (line 1821)
  6862. * --warn-section-align: Options. (line 1825)
  6863. * --warn-textrel: Options. (line 1832)
  6864. * --warn-unresolved-symbols: Options. (line 1839)
  6865. * --wdmdriver: Options. (line 2423)
  6866. * --whole-archive: Options. (line 1848)
  6867. * --wrap=SYMBOL: Options. (line 1862)
  6868. * -a KEYWORD: Options. (line 104)
  6869. * -assert KEYWORD: Options. (line 1041)
  6870. * -b FORMAT: Options. (line 121)
  6871. * -Bdynamic: Options. (line 1044)
  6872. * -Bgroup: Options. (line 1054)
  6873. * -Bshareable: Options. (line 1582)
  6874. * -Bstatic: Options. (line 1061)
  6875. * -Bsymbolic: Options. (line 1075)
  6876. * -Bsymbolic-functions: Options. (line 1082)
  6877. * -c MRI-CMDFILE: Options. (line 145)
  6878. * -call_shared: Options. (line 1044)
  6879. * -d: Options. (line 155)
  6880. * -dc: Options. (line 155)
  6881. * -dn: Options. (line 1061)
  6882. * -dp: Options. (line 155)
  6883. * -dT SCRIPT: Options. (line 660)
  6884. * -dy: Options. (line 1044)
  6885. * -E: Options. (line 246)
  6886. * -e ENTRY: Options. (line 212)
  6887. * -EB: Options. (line 287)
  6888. * -EL: Options. (line 290)
  6889. * -f NAME: Options. (line 294)
  6890. * -F NAME: Options. (line 315)
  6891. * -fini=NAME: Options. (line 338)
  6892. * -g: Options. (line 344)
  6893. * -G VALUE: Options. (line 347)
  6894. * -h NAME: Options. (line 354)
  6895. * -i: Options. (line 363)
  6896. * -IFILE: Options. (line 1206)
  6897. * -init=NAME: Options. (line 366)
  6898. * -L DIR: Options. (line 405)
  6899. * -l NAMESPEC: Options. (line 372)
  6900. * -M: Options. (line 440)
  6901. * -m EMULATION: Options. (line 430)
  6902. * -Map=MAPFILE: Options. (line 1314)
  6903. * -n: Options. (line 500)
  6904. * -N: Options. (line 506)
  6905. * -N <1>: Options. (line 2558)
  6906. * -n <1>: Options. (line 2569)
  6907. * -no-relax: Options. (line 1450)
  6908. * -non_shared: Options. (line 1061)
  6909. * -nostdlib: Options. (line 1407)
  6910. * -O LEVEL: Options. (line 540)
  6911. * -o OUTPUT: Options. (line 521)
  6912. * -P AUDITLIB: Options. (line 164)
  6913. * -pie: Options. (line 1434)
  6914. * -plugin NAME: Options. (line 550)
  6915. * -q: Options. (line 587)
  6916. * -qmagic: Options. (line 1444)
  6917. * -Qy: Options. (line 1447)
  6918. * -r: Options. (line 600)
  6919. * -R FILE: Options. (line 618)
  6920. * -rpath-link=DIR: Options. (line 1517)
  6921. * -rpath=DIR: Options. (line 1490)
  6922. * -s: Options. (line 629)
  6923. * -S: Options. (line 633)
  6924. * -shared: Options. (line 1582)
  6925. * -soname=NAME: Options. (line 354)
  6926. * -static: Options. (line 1061)
  6927. * -t: Options. (line 643)
  6928. * -T SCRIPT: Options. (line 651)
  6929. * -Tbss=ORG: Options. (line 1666)
  6930. * -Tdata=ORG: Options. (line 1666)
  6931. * -Tldata-segment=ORG: Options. (line 1682)
  6932. * -Trodata-segment=ORG: Options. (line 1676)
  6933. * -Ttext-segment=ORG: Options. (line 1672)
  6934. * -Ttext=ORG: Options. (line 1666)
  6935. * -u SYMBOL: Options. (line 673)
  6936. * -Ur: Options. (line 694)
  6937. * -v: Options. (line 739)
  6938. * -V: Options. (line 739)
  6939. * -x: Options. (line 745)
  6940. * -X: Options. (line 749)
  6941. * -Y PATH: Options. (line 764)
  6942. * -y SYMBOL: Options. (line 755)
  6943. * -z: Options. (line 2579)
  6944. * -z defs: Options. (line 1328)
  6945. * -z KEYWORD: Options. (line 768)
  6946. * -z muldefs: Options. (line 1338)
  6947. * -z undefs: Options. (line 1328)
  6948. * .: Location Counter. (line 6)
  6949. * /DISCARD/: Output Section Discarding.
  6950. (line 26)
  6951. * 32-bit PLT entries: ARM. (line 222)
  6952. * :PHDR: Output Section Phdr.
  6953. (line 6)
  6954. * =FILLEXP: Output Section Fill.
  6955. (line 6)
  6956. * >REGION: Output Section Region.
  6957. (line 6)
  6958. * [COMMON]: Input Section Common.
  6959. (line 29)
  6960. * AArch64 rela addend: ARM. (line 226)
  6961. * ABSOLUTE (MRI): MRI. (line 32)
  6962. * absolute and relocatable symbols: Expression Section. (line 6)
  6963. * absolute expressions: Expression Section. (line 6)
  6964. * ABSOLUTE(EXP): Builtin Functions. (line 10)
  6965. * ADDR(SECTION): Builtin Functions. (line 17)
  6966. * address, section: Output Section Address.
  6967. (line 6)
  6968. * ALIAS (MRI): MRI. (line 43)
  6969. * ALIGN (MRI): MRI. (line 49)
  6970. * align expression: Builtin Functions. (line 38)
  6971. * align location counter: Builtin Functions. (line 38)
  6972. * ALIGN(ALIGN): Builtin Functions. (line 38)
  6973. * ALIGN(EXP,ALIGN): Builtin Functions. (line 38)
  6974. * ALIGN(SECTION_ALIGN): Forced Output Alignment.
  6975. (line 6)
  6976. * aligned common symbols: WIN32. (line 416)
  6977. * ALIGNOF(SECTION): Builtin Functions. (line 63)
  6978. * allocating memory: MEMORY. (line 6)
  6979. * architecture: Miscellaneous Commands.
  6980. (line 121)
  6981. * archive files, from cmd line: Options. (line 372)
  6982. * archive search path in linker script: File Commands. (line 80)
  6983. * arithmetic: Expressions. (line 6)
  6984. * arithmetic operators: Operators. (line 6)
  6985. * ARM interworking support: ARM. (line 6)
  6986. * ARM1176 erratum workaround: ARM. (line 111)
  6987. * ASSERT: Miscellaneous Commands.
  6988. (line 9)
  6989. * assertion in linker script: Miscellaneous Commands.
  6990. (line 9)
  6991. * assignment in scripts: Assignments. (line 6)
  6992. * AS_NEEDED(FILES): File Commands. (line 60)
  6993. * AT(LMA): Output Section LMA. (line 6)
  6994. * AT>LMA_REGION: Output Section LMA. (line 6)
  6995. * automatic data imports: WIN32. (line 185)
  6996. * back end: BFD. (line 6)
  6997. * BASE (MRI): MRI. (line 53)
  6998. * BE8: ARM. (line 28)
  6999. * BFD canonical format: Canonical format. (line 11)
  7000. * BFD requirements: BFD. (line 16)
  7001. * big-endian objects: Options. (line 287)
  7002. * binary input format: Options. (line 121)
  7003. * BLOCK(EXP): Builtin Functions. (line 76)
  7004. * bug criteria: Bug Criteria. (line 6)
  7005. * bug reports: Bug Reporting. (line 6)
  7006. * bugs in ld: Reporting Bugs. (line 6)
  7007. * BYTE(EXPRESSION): Output Section Data.
  7008. (line 6)
  7009. * C++ constructors, arranging in link: Output Section Keywords.
  7010. (line 19)
  7011. * CHIP (MRI): MRI. (line 57)
  7012. * COLLECT_NO_DEMANGLE: Environment. (line 29)
  7013. * combining symbols, warnings on: Options. (line 1734)
  7014. * COMDAT: Options. (line 1173)
  7015. * COMDAT <1>: Miscellaneous Commands.
  7016. (line 56)
  7017. * command files: Scripts. (line 6)
  7018. * command line: Options. (line 6)
  7019. * common allocation: Options. (line 155)
  7020. * common allocation <1>: Options. (line 1157)
  7021. * common allocation in linker script: Miscellaneous Commands.
  7022. (line 46)
  7023. * common allocation in linker script <1>: Miscellaneous Commands.
  7024. (line 51)
  7025. * common symbol placement: Input Section Common.
  7026. (line 6)
  7027. * COMMONPAGESIZE: Symbolic Constants. (line 13)
  7028. * compatibility, MRI: Options. (line 145)
  7029. * CONSTANT: Symbolic Constants. (line 6)
  7030. * constants in linker scripts: Constants. (line 6)
  7031. * constraints on output sections: Output Section Constraint.
  7032. (line 6)
  7033. * constructors: Options. (line 694)
  7034. * CONSTRUCTORS: Output Section Keywords.
  7035. (line 19)
  7036. * constructors, arranging in link: Output Section Keywords.
  7037. (line 19)
  7038. * Cortex-A53 erratum 835769 workaround: ARM. (line 211)
  7039. * Cortex-A8 erratum workaround: ARM. (line 202)
  7040. * crash of linker: Bug Criteria. (line 9)
  7041. * CREATE_OBJECT_SYMBOLS: Output Section Keywords.
  7042. (line 9)
  7043. * creating a DEF file: WIN32. (line 153)
  7044. * cross reference table: Options. (line 1144)
  7045. * cross references: Miscellaneous Commands.
  7046. (line 88)
  7047. * cross references <1>: Miscellaneous Commands.
  7048. (line 104)
  7049. * current output location: Location Counter. (line 6)
  7050. * data: Output Section Data.
  7051. (line 6)
  7052. * DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE): Builtin Functions.
  7053. (line 81)
  7054. * DATA_SEGMENT_END(EXP): Builtin Functions. (line 105)
  7055. * DATA_SEGMENT_RELRO_END(OFFSET, EXP): Builtin Functions. (line 111)
  7056. * dbx: Options. (line 1650)
  7057. * DEF files, creating: Options. (line 2190)
  7058. * default emulation: Environment. (line 21)
  7059. * default input format: Environment. (line 9)
  7060. * defined symbol: Options. (line 686)
  7061. * DEFINED(SYMBOL): Builtin Functions. (line 124)
  7062. * deleting local symbols: Options. (line 745)
  7063. * demangling, default: Environment. (line 29)
  7064. * demangling, from command line: Options. (line 1193)
  7065. * dependency file: Options. (line 527)
  7066. * direct linking to a dll: WIN32. (line 233)
  7067. * discarding sections: Output Section Discarding.
  7068. (line 6)
  7069. * discontinuous memory: MEMORY. (line 6)
  7070. * DLLs, creating: Options. (line 2085)
  7071. * DLLs, creating <1>: Options. (line 2190)
  7072. * DLLs, creating <2>: Options. (line 2198)
  7073. * DLLs, linking to: Options. (line 2213)
  7074. * dot: Location Counter. (line 6)
  7075. * dot inside sections: Location Counter. (line 36)
  7076. * dot outside sections: Location Counter. (line 66)
  7077. * dynamic linker, from command line: Options. (line 1206)
  7078. * dynamic symbol table: Options. (line 246)
  7079. * ELF program headers: PHDRS. (line 6)
  7080. * ELF symbol visibility: Options. (line 963)
  7081. * emulation: Options. (line 430)
  7082. * emulation, default: Environment. (line 21)
  7083. * END (MRI): MRI. (line 61)
  7084. * endianness: Options. (line 287)
  7085. * entry point: Entry Point. (line 6)
  7086. * entry point, from command line: Options. (line 212)
  7087. * entry point, thumb: ARM. (line 17)
  7088. * ENTRY(SYMBOL): Entry Point. (line 6)
  7089. * error on valid input: Bug Criteria. (line 12)
  7090. * example of linker script: Simple Example. (line 6)
  7091. * EXCLUDE_FILE: Input Section Basics.
  7092. (line 17)
  7093. * export dynamic symbol: Options. (line 273)
  7094. * export dynamic symbol list: Options. (line 282)
  7095. * exporting DLL symbols: WIN32. (line 19)
  7096. * expression evaluation order: Evaluation. (line 6)
  7097. * expression sections: Expression Section. (line 6)
  7098. * expression, absolute: Builtin Functions. (line 10)
  7099. * expressions: Expressions. (line 6)
  7100. * EXTERN: Miscellaneous Commands.
  7101. (line 39)
  7102. * fatal signal: Bug Criteria. (line 9)
  7103. * file name wildcard patterns: Input Section Wildcards.
  7104. (line 6)
  7105. * FILEHDR: PHDRS. (line 62)
  7106. * filename symbols: Output Section Keywords.
  7107. (line 9)
  7108. * fill pattern, entire section: Output Section Fill.
  7109. (line 6)
  7110. * FILL(EXPRESSION): Output Section Data.
  7111. (line 39)
  7112. * finalization function: Options. (line 338)
  7113. * first input file: File Commands. (line 88)
  7114. * first instruction: Entry Point. (line 6)
  7115. * FIX_V4BX: ARM. (line 48)
  7116. * FIX_V4BX_INTERWORKING: ARM. (line 61)
  7117. * FORCE_COMMON_ALLOCATION: Miscellaneous Commands.
  7118. (line 46)
  7119. * FORCE_GROUP_ALLOCATION: Miscellaneous Commands.
  7120. (line 56)
  7121. * forcing input section alignment: Forced Input Alignment.
  7122. (line 6)
  7123. * forcing output section alignment: Forced Output Alignment.
  7124. (line 6)
  7125. * forcing the creation of dynamic sections: Options. (line 596)
  7126. * FORMAT (MRI): MRI. (line 65)
  7127. * functions in expressions: Builtin Functions. (line 6)
  7128. * garbage collection: Options. (line 1243)
  7129. * garbage collection <1>: Options. (line 1269)
  7130. * garbage collection <2>: Options. (line 1278)
  7131. * garbage collection <3>: Input Section Keep. (line 6)
  7132. * generating optimized output: Options. (line 540)
  7133. * GNU linker: Overview. (line 6)
  7134. * GNUTARGET: Environment. (line 9)
  7135. * group allocation in linker script: Options. (line 1173)
  7136. * group allocation in linker script <1>: Miscellaneous Commands.
  7137. (line 56)
  7138. * GROUP(FILES): File Commands. (line 53)
  7139. * grouping input files: File Commands. (line 53)
  7140. * groups of archives: Options. (line 989)
  7141. * H8/300 support: H8/300. (line 6)
  7142. * header size: Builtin Functions. (line 191)
  7143. * heap size: Options. (line 2125)
  7144. * help: Options. (line 1306)
  7145. * HIDDEN: HIDDEN. (line 6)
  7146. * holes: Location Counter. (line 12)
  7147. * holes, filling: Output Section Data.
  7148. (line 39)
  7149. * HPPA multiple sub-space stubs: HPPA ELF32. (line 6)
  7150. * HPPA stub grouping: HPPA ELF32. (line 12)
  7151. * image base: Options. (line 2132)
  7152. * implicit linker scripts: Implicit Linker Scripts.
  7153. (line 6)
  7154. * import libraries: WIN32. (line 10)
  7155. * INCLUDE FILENAME: File Commands. (line 9)
  7156. * including a linker script: File Commands. (line 9)
  7157. * including an entire archive: Options. (line 1848)
  7158. * incremental link: Options. (line 363)
  7159. * INHIBIT_COMMON_ALLOCATION: Miscellaneous Commands.
  7160. (line 51)
  7161. * initialization function: Options. (line 366)
  7162. * initialized data in ROM: Output Section LMA. (line 39)
  7163. * input file format in linker script: Format Commands. (line 35)
  7164. * input filename symbols: Output Section Keywords.
  7165. (line 9)
  7166. * input files in linker scripts: File Commands. (line 19)
  7167. * input files, displaying: Options. (line 643)
  7168. * input format: Options. (line 121)
  7169. * input format <1>: Options. (line 121)
  7170. * Input import library: ARM. (line 239)
  7171. * input object files in linker scripts: File Commands. (line 19)
  7172. * input section alignment: Forced Input Alignment.
  7173. (line 6)
  7174. * input section basics: Input Section Basics.
  7175. (line 6)
  7176. * input section wildcards: Input Section Wildcards.
  7177. (line 6)
  7178. * input sections: Input Section. (line 6)
  7179. * INPUT(FILES): File Commands. (line 19)
  7180. * INSERT: Miscellaneous Commands.
  7181. (line 62)
  7182. * insert user script into default script: Miscellaneous Commands.
  7183. (line 62)
  7184. * integer notation: Constants. (line 6)
  7185. * integer suffixes: Constants. (line 15)
  7186. * internal object-file format: Canonical format. (line 11)
  7187. * invalid input: Bug Criteria. (line 14)
  7188. * K and M integer suffixes: Constants. (line 15)
  7189. * KEEP: Input Section Keep. (line 6)
  7190. * l =: MEMORY. (line 72)
  7191. * lazy evaluation: Evaluation. (line 6)
  7192. * ld bugs, reporting: Bug Reporting. (line 6)
  7193. * ldata segment origin, cmd line: Options. (line 1683)
  7194. * LDEMULATION: Environment. (line 21)
  7195. * LD_FEATURE(STRING): Miscellaneous Commands.
  7196. (line 127)
  7197. * len =: MEMORY. (line 72)
  7198. * LENGTH =: MEMORY. (line 72)
  7199. * LENGTH(MEMORY): Builtin Functions. (line 141)
  7200. * library search path in linker script: File Commands. (line 80)
  7201. * link map: Options. (line 440)
  7202. * link map discarded: Options. (line 495)
  7203. * link-time runtime library search path: Options. (line 1517)
  7204. * linker crash: Bug Criteria. (line 9)
  7205. * linker script concepts: Basic Script Concepts.
  7206. (line 6)
  7207. * linker script example: Simple Example. (line 6)
  7208. * linker script file commands: File Commands. (line 6)
  7209. * linker script format: Script Format. (line 6)
  7210. * linker script input object files: File Commands. (line 19)
  7211. * linker script simple commands: Simple Commands. (line 6)
  7212. * linker scripts: Scripts. (line 6)
  7213. * LIST (MRI): MRI. (line 69)
  7214. * little-endian objects: Options. (line 290)
  7215. * LOAD (MRI): MRI. (line 76)
  7216. * load address: Output Section LMA. (line 6)
  7217. * LOADADDR(SECTION): Builtin Functions. (line 144)
  7218. * loading, preventing: Output Section Type.
  7219. (line 21)
  7220. * local symbols, deleting: Options. (line 749)
  7221. * location counter: Location Counter. (line 6)
  7222. * LOG2CEIL(EXP): Builtin Functions. (line 148)
  7223. * LONG(EXPRESSION): Output Section Data.
  7224. (line 6)
  7225. * M and K integer suffixes: Constants. (line 15)
  7226. * M68HC11 and 68HC12 support: M68HC11/68HC12. (line 5)
  7227. * machine architecture: Miscellaneous Commands.
  7228. (line 121)
  7229. * machine dependencies: Machine Dependent. (line 6)
  7230. * mapping input sections to output sections: Input Section. (line 6)
  7231. * MAX: Builtin Functions. (line 151)
  7232. * MAXPAGESIZE: Symbolic Constants. (line 10)
  7233. * MEMORY: MEMORY. (line 6)
  7234. * memory region attributes: MEMORY. (line 34)
  7235. * memory regions: MEMORY. (line 6)
  7236. * memory regions and sections: Output Section Region.
  7237. (line 6)
  7238. * memory usage: Options. (line 1294)
  7239. * memory usage <1>: Options. (line 1321)
  7240. * Merging exidx entries: ARM. (line 219)
  7241. * MIN: Builtin Functions. (line 154)
  7242. * MIPS branch relocation check control: MIPS. (line 13)
  7243. * MIPS microMIPS instruction choice selection: MIPS. (line 6)
  7244. * Motorola 68K GOT generation: M68K. (line 6)
  7245. * MRI compatibility: MRI. (line 6)
  7246. * MSP430 extra sections: MSP430. (line 11)
  7247. * MSP430 Options: MSP430. (line 34)
  7248. * NAME (MRI): MRI. (line 82)
  7249. * name, section: Output Section Name.
  7250. (line 6)
  7251. * names: Symbols. (line 6)
  7252. * naming the output file: Options. (line 521)
  7253. * NEXT(EXP): Builtin Functions. (line 158)
  7254. * Nios II call relaxation: Nios II. (line 6)
  7255. * NMAGIC: Options. (line 500)
  7256. * NOCROSSREFS(SECTIONS): Miscellaneous Commands.
  7257. (line 88)
  7258. * NOCROSSREFS_TO(TOSECTION FROMSECTIONS): Miscellaneous Commands.
  7259. (line 104)
  7260. * NOLOAD: Output Section Type.
  7261. (line 21)
  7262. * not enough room for program headers: Builtin Functions. (line 196)
  7263. * NO_ENUM_SIZE_WARNING: ARM. (line 158)
  7264. * NO_WCHAR_SIZE_WARNING: ARM. (line 165)
  7265. * o =: MEMORY. (line 67)
  7266. * objdump -i: BFD. (line 6)
  7267. * object file management: BFD. (line 6)
  7268. * object files: Options. (line 29)
  7269. * object formats available: BFD. (line 6)
  7270. * object size: Options. (line 347)
  7271. * OMAGIC: Options. (line 506)
  7272. * OMAGIC <1>: Options. (line 515)
  7273. * ONLY_IF_RO: Output Section Constraint.
  7274. (line 6)
  7275. * ONLY_IF_RW: Output Section Constraint.
  7276. (line 6)
  7277. * opening object files: BFD outline. (line 6)
  7278. * operators for arithmetic: Operators. (line 6)
  7279. * options: Options. (line 6)
  7280. * ORDER (MRI): MRI. (line 87)
  7281. * org =: MEMORY. (line 67)
  7282. * ORIGIN =: MEMORY. (line 67)
  7283. * ORIGIN(MEMORY): Builtin Functions. (line 164)
  7284. * orphan: Orphan Sections. (line 6)
  7285. * orphan sections: Options. (line 704)
  7286. * output file after errors: Options. (line 1401)
  7287. * output file format in linker script: Format Commands. (line 10)
  7288. * output file name in linker script: File Commands. (line 70)
  7289. * output format: Options. (line 1288)
  7290. * output section alignment: Forced Output Alignment.
  7291. (line 6)
  7292. * output section attributes: Output Section Attributes.
  7293. (line 6)
  7294. * output section data: Output Section Data.
  7295. (line 6)
  7296. * OUTPUT(FILENAME): File Commands. (line 70)
  7297. * OUTPUT_ARCH(BFDARCH): Miscellaneous Commands.
  7298. (line 121)
  7299. * OUTPUT_FORMAT(BFDNAME): Format Commands. (line 10)
  7300. * OVERLAY: Overlay Description.
  7301. (line 6)
  7302. * overlays: Overlay Description.
  7303. (line 6)
  7304. * partial link: Options. (line 600)
  7305. * PE import table prefixing: ARM. (line 23)
  7306. * PHDRS: PHDRS. (line 6)
  7307. * PHDRS <1>: PHDRS. (line 62)
  7308. * PIC_VENEER: ARM. (line 171)
  7309. * Placement of SG veneers: ARM. (line 229)
  7310. * pop state governing input file handling: Options. (line 583)
  7311. * position independent executables: Options. (line 1436)
  7312. * PowerPC ELF32 options: PowerPC ELF32. (line 16)
  7313. * PowerPC GOT: PowerPC ELF32. (line 33)
  7314. * PowerPC long branches: PowerPC ELF32. (line 6)
  7315. * PowerPC PLT: PowerPC ELF32. (line 16)
  7316. * PowerPC stub symbols: PowerPC ELF32. (line 47)
  7317. * PowerPC TLS optimization: PowerPC ELF32. (line 51)
  7318. * PowerPC64 dot symbols: PowerPC64 ELF64. (line 33)
  7319. * PowerPC64 ELF64 options: PowerPC64 ELF64. (line 6)
  7320. * PowerPC64 ELFv2 PLT localentry optimization: PowerPC64 ELF64.
  7321. (line 160)
  7322. * PowerPC64 inline PLT call optimization: PowerPC64 ELF64. (line 101)
  7323. * PowerPC64 multi-TOC: PowerPC64 ELF64. (line 109)
  7324. * PowerPC64 OPD optimization: PowerPC64 ELF64. (line 75)
  7325. * PowerPC64 OPD spacing: PowerPC64 ELF64. (line 81)
  7326. * PowerPC64 PLT call stub static chain: PowerPC64 ELF64. (line 142)
  7327. * PowerPC64 PLT call stub thread safety: PowerPC64 ELF64. (line 148)
  7328. * PowerPC64 PLT stub alignment: PowerPC64 ELF64. (line 131)
  7329. * PowerPC64 Power10 stubs: PowerPC64 ELF64. (line 176)
  7330. * PowerPC64 register save/restore functions: PowerPC64 ELF64.
  7331. (line 44)
  7332. * PowerPC64 stub grouping: PowerPC64 ELF64. (line 6)
  7333. * PowerPC64 stub symbols: PowerPC64 ELF64. (line 29)
  7334. * PowerPC64 TLS optimization: PowerPC64 ELF64. (line 51)
  7335. * PowerPC64 TOC optimization: PowerPC64 ELF64. (line 87)
  7336. * PowerPC64 TOC sorting: PowerPC64 ELF64. (line 121)
  7337. * PowerPC64 __tls_get_addr optimization: PowerPC64 ELF64. (line 56)
  7338. * precedence in expressions: Operators. (line 6)
  7339. * prevent unnecessary loading: Output Section Type.
  7340. (line 21)
  7341. * program headers: PHDRS. (line 6)
  7342. * program headers and sections: Output Section Phdr.
  7343. (line 6)
  7344. * program headers, not enough room: Builtin Functions. (line 196)
  7345. * program segments: PHDRS. (line 6)
  7346. * PROVIDE: PROVIDE. (line 6)
  7347. * PROVIDE_HIDDEN: PROVIDE_HIDDEN. (line 6)
  7348. * PUBLIC (MRI): MRI. (line 95)
  7349. * push state governing input file handling: Options. (line 565)
  7350. * QUAD(EXPRESSION): Output Section Data.
  7351. (line 6)
  7352. * quoted symbol names: Symbols. (line 6)
  7353. * read-only text: Options. (line 500)
  7354. * read/write from cmd line: Options. (line 506)
  7355. * region alias: REGION_ALIAS. (line 6)
  7356. * region names: REGION_ALIAS. (line 6)
  7357. * regions of memory: MEMORY. (line 6)
  7358. * REGION_ALIAS(ALIAS, REGION): REGION_ALIAS. (line 6)
  7359. * relative expressions: Expression Section. (line 6)
  7360. * relaxing addressing modes: Options. (line 1450)
  7361. * relaxing on H8/300: H8/300. (line 9)
  7362. * relaxing on M68HC11: M68HC11/68HC12. (line 12)
  7363. * relaxing on NDS32: NDS32. (line 6)
  7364. * relaxing on Xtensa: Xtensa. (line 27)
  7365. * relocatable and absolute symbols: Expression Section. (line 6)
  7366. * relocatable output: Options. (line 600)
  7367. * removing sections: Output Section Discarding.
  7368. (line 6)
  7369. * reporting bugs in ld: Reporting Bugs. (line 6)
  7370. * requirements for BFD: BFD. (line 16)
  7371. * retain relocations in final executable: Options. (line 587)
  7372. * retaining specified symbols: Options. (line 1476)
  7373. * rodata segment origin, cmd line: Options. (line 1677)
  7374. * ROM initialized data: Output Section LMA. (line 39)
  7375. * round up expression: Builtin Functions. (line 38)
  7376. * round up location counter: Builtin Functions. (line 38)
  7377. * runtime library name: Options. (line 354)
  7378. * runtime library search path: Options. (line 1490)
  7379. * runtime pseudo-relocation: WIN32. (line 211)
  7380. * S/390: S/390 ELF. (line 6)
  7381. * S/390 ELF options: S/390 ELF. (line 6)
  7382. * scaled integers: Constants. (line 15)
  7383. * scommon section: Input Section Common.
  7384. (line 20)
  7385. * script files: Options. (line 651)
  7386. * script files <1>: Options. (line 660)
  7387. * scripts: Scripts. (line 6)
  7388. * search directory, from cmd line: Options. (line 405)
  7389. * search path in linker script: File Commands. (line 80)
  7390. * SEARCH_DIR(PATH): File Commands. (line 80)
  7391. * SECT (MRI): MRI. (line 101)
  7392. * section address: Output Section Address.
  7393. (line 6)
  7394. * section address in expression: Builtin Functions. (line 17)
  7395. * section alignment: Builtin Functions. (line 63)
  7396. * section alignment, warnings on: Options. (line 1825)
  7397. * section data: Output Section Data.
  7398. (line 6)
  7399. * section fill pattern: Output Section Fill.
  7400. (line 6)
  7401. * section groups: Options. (line 1173)
  7402. * section groups <1>: Miscellaneous Commands.
  7403. (line 56)
  7404. * section load address: Output Section LMA. (line 6)
  7405. * section load address in expression: Builtin Functions. (line 144)
  7406. * section name: Output Section Name.
  7407. (line 6)
  7408. * section name wildcard patterns: Input Section Wildcards.
  7409. (line 6)
  7410. * section size: Builtin Functions. (line 175)
  7411. * section, assigning to memory region: Output Section Region.
  7412. (line 6)
  7413. * section, assigning to program header: Output Section Phdr.
  7414. (line 6)
  7415. * SECTIONS: SECTIONS. (line 6)
  7416. * sections, discarding: Output Section Discarding.
  7417. (line 6)
  7418. * sections, orphan: Options. (line 704)
  7419. * Secure gateway import library: ARM. (line 234)
  7420. * segment origins, cmd line: Options. (line 1666)
  7421. * segments, ELF: PHDRS. (line 6)
  7422. * SEGMENT_START(SEGMENT, DEFAULT): Builtin Functions. (line 167)
  7423. * shared libraries: Options. (line 1584)
  7424. * SHORT(EXPRESSION): Output Section Data.
  7425. (line 6)
  7426. * SIZEOF(SECTION): Builtin Functions. (line 175)
  7427. * SIZEOF_HEADERS: Builtin Functions. (line 191)
  7428. * small common symbols: Input Section Common.
  7429. (line 20)
  7430. * SORT: Input Section Wildcards.
  7431. (line 64)
  7432. * SORT_BY_ALIGNMENT: Input Section Wildcards.
  7433. (line 51)
  7434. * SORT_BY_INIT_PRIORITY: Input Section Wildcards.
  7435. (line 57)
  7436. * SORT_BY_NAME: Input Section Wildcards.
  7437. (line 43)
  7438. * SORT_NONE: Input Section Wildcards.
  7439. (line 100)
  7440. * SPU: SPU ELF. (line 29)
  7441. * SPU <1>: SPU ELF. (line 46)
  7442. * SPU ELF options: SPU ELF. (line 6)
  7443. * SPU extra overlay stubs: SPU ELF. (line 19)
  7444. * SPU local store size: SPU ELF. (line 24)
  7445. * SPU overlay stub symbols: SPU ELF. (line 15)
  7446. * SPU overlays: SPU ELF. (line 9)
  7447. * SPU plugins: SPU ELF. (line 6)
  7448. * SQUAD(EXPRESSION): Output Section Data.
  7449. (line 6)
  7450. * stack size: Options. (line 2375)
  7451. * standard Unix system: Options. (line 7)
  7452. * start of execution: Entry Point. (line 6)
  7453. * STARTUP(FILENAME): File Commands. (line 88)
  7454. * STM32L4xx erratum workaround: ARM. (line 120)
  7455. * strip all symbols: Options. (line 629)
  7456. * strip debugger symbols: Options. (line 633)
  7457. * stripping all but some symbols: Options. (line 1476)
  7458. * STUB_GROUP_SIZE: ARM. (line 176)
  7459. * SUBALIGN(SUBSECTION_ALIGN): Forced Input Alignment.
  7460. (line 6)
  7461. * suffixes for integers: Constants. (line 15)
  7462. * symbol defaults: Builtin Functions. (line 124)
  7463. * symbol definition, scripts: Assignments. (line 6)
  7464. * symbol names: Symbols. (line 6)
  7465. * symbol tracing: Options. (line 755)
  7466. * symbol versions: VERSION. (line 6)
  7467. * symbol-only input: Options. (line 618)
  7468. * symbolic constants: Symbolic Constants. (line 6)
  7469. * symbols, from command line: Options. (line 1181)
  7470. * symbols, relocatable and absolute: Expression Section. (line 6)
  7471. * symbols, require defined: Options. (line 686)
  7472. * symbols, retaining selectively: Options. (line 1476)
  7473. * synthesizing linker: Options. (line 1450)
  7474. * synthesizing on H8/300: H8/300. (line 14)
  7475. * TARGET(BFDNAME): Format Commands. (line 35)
  7476. * TARGET1: ARM. (line 33)
  7477. * TARGET2: ARM. (line 38)
  7478. * text segment origin, cmd line: Options. (line 1673)
  7479. * thumb entry point: ARM. (line 17)
  7480. * TI COFF versions: TI COFF. (line 6)
  7481. * traditional format: Options. (line 1645)
  7482. * trampoline generation on M68HC11: M68HC11/68HC12. (line 30)
  7483. * trampoline generation on M68HC12: M68HC11/68HC12. (line 30)
  7484. * unallocated address, next: Builtin Functions. (line 158)
  7485. * undefined symbol: Options. (line 673)
  7486. * undefined symbol in linker script: Miscellaneous Commands.
  7487. (line 39)
  7488. * undefined symbols, warnings on: Options. (line 1821)
  7489. * uninitialized data placement: Input Section Common.
  7490. (line 6)
  7491. * unspecified memory: Output Section Data.
  7492. (line 39)
  7493. * usage: Options. (line 1306)
  7494. * USE_BLX: ARM. (line 73)
  7495. * using a DEF file: WIN32. (line 52)
  7496. * using auto-export functionality: WIN32. (line 22)
  7497. * Using decorations: WIN32. (line 157)
  7498. * variables, defining: Assignments. (line 6)
  7499. * verbose[=NUMBER]: Options. (line 1716)
  7500. * version: Options. (line 739)
  7501. * version script: VERSION. (line 6)
  7502. * version script, symbol versions: Options. (line 1724)
  7503. * VERSION {script text}: VERSION. (line 6)
  7504. * versions of symbols: VERSION. (line 6)
  7505. * VFP11_DENORM_FIX: ARM. (line 82)
  7506. * visibility: Options. (line 963)
  7507. * warnings, on combining symbols: Options. (line 1734)
  7508. * warnings, on section alignment: Options. (line 1825)
  7509. * warnings, on undefined symbols: Options. (line 1821)
  7510. * weak externals: WIN32. (line 401)
  7511. * what is this?: Overview. (line 6)
  7512. * wildcard file name patterns: Input Section Wildcards.
  7513. (line 6)
  7514. * Xtensa options: Xtensa. (line 55)
  7515. * Xtensa processors: Xtensa. (line 6)
  7516. 
  7517. Tag Table:
  7518. Node: Top736
  7519. Node: Overview1550
  7520. Node: Invocation2666
  7521. Node: Options3074
  7522. Node: Environment121811
  7523. Node: Scripts123572
  7524. Node: Basic Script Concepts125306
  7525. Node: Script Format128014
  7526. Node: Simple Example128877
  7527. Node: Simple Commands131971
  7528. Node: Entry Point132476
  7529. Node: File Commands133405
  7530. Node: Format Commands137714
  7531. Node: REGION_ALIAS139670
  7532. Node: Miscellaneous Commands144497
  7533. Node: Assignments150328
  7534. Node: Simple Assignments150839
  7535. Node: HIDDEN152570
  7536. Node: PROVIDE153197
  7537. Node: PROVIDE_HIDDEN154718
  7538. Node: Source Code Reference154962
  7539. Node: SECTIONS158879
  7540. Node: Output Section Description160767
  7541. Node: Output Section Name162008
  7542. Node: Output Section Address162885
  7543. Node: Input Section165118
  7544. Node: Input Section Basics165919
  7545. Node: Input Section Wildcards170937
  7546. Node: Input Section Common176232
  7547. Node: Input Section Keep177714
  7548. Node: Input Section Example178204
  7549. Node: Output Section Data179615
  7550. Node: Output Section Keywords182394
  7551. Node: Output Section Discarding185961
  7552. Node: Output Section Attributes187691
  7553. Node: Output Section Type188810
  7554. Node: Output Section LMA189880
  7555. Node: Forced Output Alignment192951
  7556. Node: Forced Input Alignment193380
  7557. Node: Output Section Constraint193768
  7558. Node: Output Section Region194196
  7559. Node: Output Section Phdr194629
  7560. Node: Output Section Fill195293
  7561. Node: Overlay Description196435
  7562. Node: MEMORY200880
  7563. Node: PHDRS205486
  7564. Node: VERSION210812
  7565. Node: Expressions218903
  7566. Node: Constants219832
  7567. Node: Symbolic Constants220706
  7568. Node: Symbols221257
  7569. Node: Orphan Sections222004
  7570. Node: Location Counter223589
  7571. Node: Operators228023
  7572. Node: Evaluation228945
  7573. Node: Expression Section230309
  7574. Node: Builtin Functions234279
  7575. Node: Implicit Linker Scripts242630
  7576. Node: Machine Dependent243405
  7577. Node: H8/300244493
  7578. Node: M68HC11/68HC12246566
  7579. Node: ARM248013
  7580. Node: HPPA ELF32260260
  7581. Node: M68K261883
  7582. Node: MIPS262792
  7583. Node: MMIX263908
  7584. Node: MSP430265073
  7585. Node: NDS32266986
  7586. Node: Nios II267950
  7587. Node: PowerPC ELF32269266
  7588. Node: PowerPC64 ELF64272097
  7589. Node: S/390 ELF281855
  7590. Node: SPU ELF282202
  7591. Node: TI COFF284830
  7592. Node: WIN32285356
  7593. Node: Xtensa305503
  7594. Node: BFD308946
  7595. Node: BFD outline310404
  7596. Node: BFD information loss311692
  7597. Node: Canonical format314218
  7598. Node: Reporting Bugs318546
  7599. Node: Bug Criteria319240
  7600. Node: Bug Reporting319939
  7601. Node: MRI326977
  7602. Node: GNU Free Documentation License331448
  7603. Node: LD Index356585
  7604. 
  7605. End Tag Table