ld.info 406 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840
  1. This is ld.info, produced by makeinfo version 6.6 from ld.texi.
  2. This file documents the GNU linker LD (xPack GNU Arm Embedded GCC\x2C
  3. 64-bit) version 2.33.1.
  4. Copyright (C) 1991-2019 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 (xPack GNU Arm Embedded GCC\x2C
  20. 64-bit) version 2.33.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. '-e ENTRY'
  212. '--entry=ENTRY'
  213. Use ENTRY as the explicit symbol for beginning execution of your
  214. program, rather than the default entry point. If there is no
  215. symbol named ENTRY, the linker will try to parse ENTRY as a number,
  216. and use that as the entry address (the number will be interpreted
  217. in base 10; you may use a leading '0x' for base 16, or a leading
  218. '0' for base 8). *Note Entry Point::, for a discussion of defaults
  219. and other ways of specifying the entry point.
  220. '--exclude-libs LIB,LIB,...'
  221. Specifies a list of archive libraries from which symbols should not
  222. be automatically exported. The library names may be delimited by
  223. commas or colons. Specifying '--exclude-libs ALL' excludes symbols
  224. in all archive libraries from automatic export. This option is
  225. available only for the i386 PE targeted port of the linker and for
  226. ELF targeted ports. For i386 PE, symbols explicitly listed in a
  227. .def file are still exported, regardless of this option. For ELF
  228. targeted ports, symbols affected by this option will be treated as
  229. hidden.
  230. '--exclude-modules-for-implib MODULE,MODULE,...'
  231. Specifies a list of object files or archive members, from which
  232. symbols should not be automatically exported, but which should be
  233. copied wholesale into the import library being generated during the
  234. link. The module names may be delimited by commas or colons, and
  235. must match exactly the filenames used by 'ld' to open the files;
  236. for archive members, this is simply the member name, but for object
  237. files the name listed must include and match precisely any path
  238. used to specify the input file on the linker's command-line. This
  239. option is available only for the i386 PE targeted port of the
  240. linker. Symbols explicitly listed in a .def file are still
  241. exported, regardless of this option.
  242. '-E'
  243. '--export-dynamic'
  244. '--no-export-dynamic'
  245. When creating a dynamically linked executable, using the '-E'
  246. option or the '--export-dynamic' option causes the linker to add
  247. all symbols to the dynamic symbol table. The dynamic symbol table
  248. is the set of symbols which are visible from dynamic objects at run
  249. time.
  250. If you do not use either of these options (or use the
  251. '--no-export-dynamic' option to restore the default behavior), the
  252. dynamic symbol table will normally contain only those symbols which
  253. are referenced by some dynamic object mentioned in the link.
  254. If you use 'dlopen' to load a dynamic object which needs to refer
  255. back to the symbols defined by the program, rather than some other
  256. dynamic object, then you will probably need to use this option when
  257. linking the program itself.
  258. You can also use the dynamic list to control what symbols should be
  259. added to the dynamic symbol table if the output format supports it.
  260. See the description of '--dynamic-list'.
  261. Note that this option is specific to ELF targeted ports. PE
  262. targets support a similar function to export all symbols from a DLL
  263. or EXE; see the description of '--export-all-symbols' below.
  264. '-EB'
  265. Link big-endian objects. This affects the default output format.
  266. '-EL'
  267. Link little-endian objects. This affects the default output
  268. format.
  269. '-f NAME'
  270. '--auxiliary=NAME'
  271. When creating an ELF shared object, set the internal DT_AUXILIARY
  272. field to the specified name. This tells the dynamic linker that
  273. the symbol table of the shared object should be used as an
  274. auxiliary filter on the symbol table of the shared object NAME.
  275. If you later link a program against this filter object, then, when
  276. you run the program, the dynamic linker will see the DT_AUXILIARY
  277. field. If the dynamic linker resolves any symbols from the filter
  278. object, it will first check whether there is a definition in the
  279. shared object NAME. If there is one, it will be used instead of
  280. the definition in the filter object. The shared object NAME need
  281. not exist. Thus the shared object NAME may be used to provide an
  282. alternative implementation of certain functions, perhaps for
  283. debugging or for machine-specific performance.
  284. This option may be specified more than once. The DT_AUXILIARY
  285. entries will be created in the order in which they appear on the
  286. command line.
  287. '-F NAME'
  288. '--filter=NAME'
  289. When creating an ELF shared object, set the internal DT_FILTER
  290. field to the specified name. This tells the dynamic linker that
  291. the symbol table of the shared object which is being created should
  292. be used as a filter on the symbol table of the shared object NAME.
  293. If you later link a program against this filter object, then, when
  294. you run the program, the dynamic linker will see the DT_FILTER
  295. field. The dynamic linker will resolve symbols according to the
  296. symbol table of the filter object as usual, but it will actually
  297. link to the definitions found in the shared object NAME. Thus the
  298. filter object can be used to select a subset of the symbols
  299. provided by the object NAME.
  300. Some older linkers used the '-F' option throughout a compilation
  301. toolchain for specifying object-file format for both input and
  302. output object files. The GNU linker uses other mechanisms for this
  303. purpose: the '-b', '--format', '--oformat' options, the 'TARGET'
  304. command in linker scripts, and the 'GNUTARGET' environment
  305. variable. The GNU linker will ignore the '-F' option when not
  306. creating an ELF shared object.
  307. '-fini=NAME'
  308. When creating an ELF executable or shared object, call NAME when
  309. the executable or shared object is unloaded, by setting DT_FINI to
  310. the address of the function. By default, the linker uses '_fini'
  311. as the function to call.
  312. '-g'
  313. Ignored. Provided for compatibility with other tools.
  314. '-G VALUE'
  315. '--gpsize=VALUE'
  316. Set the maximum size of objects to be optimized using the GP
  317. register to SIZE. This is only meaningful for object file formats
  318. such as MIPS ELF that support putting large and small objects into
  319. different sections. This is ignored for other object file formats.
  320. '-h NAME'
  321. '-soname=NAME'
  322. When creating an ELF shared object, set the internal DT_SONAME
  323. field to the specified name. When an executable is linked with a
  324. shared object which has a DT_SONAME field, then when the executable
  325. is run the dynamic linker will attempt to load the shared object
  326. specified by the DT_SONAME field rather than the using the file
  327. name given to the linker.
  328. '-i'
  329. Perform an incremental link (same as option '-r').
  330. '-init=NAME'
  331. When creating an ELF executable or shared object, call NAME when
  332. the executable or shared object is loaded, by setting DT_INIT to
  333. the address of the function. By default, the linker uses '_init'
  334. as the function to call.
  335. '-l NAMESPEC'
  336. '--library=NAMESPEC'
  337. Add the archive or object file specified by NAMESPEC to the list of
  338. files to link. This option may be used any number of times. If
  339. NAMESPEC is of the form ':FILENAME', 'ld' will search the library
  340. path for a file called FILENAME, otherwise it will search the
  341. library path for a file called 'libNAMESPEC.a'.
  342. On systems which support shared libraries, 'ld' may also search for
  343. files other than 'libNAMESPEC.a'. Specifically, on ELF and SunOS
  344. systems, 'ld' will search a directory for a library called
  345. 'libNAMESPEC.so' before searching for one called 'libNAMESPEC.a'.
  346. (By convention, a '.so' extension indicates a shared library.)
  347. Note that this behavior does not apply to ':FILENAME', which always
  348. specifies a file called FILENAME.
  349. The linker will search an archive only once, at the location where
  350. it is specified on the command line. If the archive defines a
  351. symbol which was undefined in some object which appeared before the
  352. archive on the command line, the linker will include the
  353. appropriate file(s) from the archive. However, an undefined symbol
  354. in an object appearing later on the command line will not cause the
  355. linker to search the archive again.
  356. See the '-(' option for a way to force the linker to search
  357. archives multiple times.
  358. You may list the same archive multiple times on the command line.
  359. This type of archive searching is standard for Unix linkers.
  360. However, if you are using 'ld' on AIX, note that it is different
  361. from the behaviour of the AIX linker.
  362. '-L SEARCHDIR'
  363. '--library-path=SEARCHDIR'
  364. Add path SEARCHDIR to the list of paths that 'ld' will search for
  365. archive libraries and 'ld' control scripts. You may use this
  366. option any number of times. The directories are searched in the
  367. order in which they are specified on the command line. Directories
  368. specified on the command line are searched before the default
  369. directories. All '-L' options apply to all '-l' options,
  370. regardless of the order in which the options appear. '-L' options
  371. do not affect how 'ld' searches for a linker script unless '-T'
  372. option is specified.
  373. If SEARCHDIR begins with '=' or '$SYSROOT', then this prefix will
  374. be replaced by the "sysroot prefix", controlled by the '--sysroot'
  375. option, or specified when the linker is configured.
  376. The default set of paths searched (without being specified with
  377. '-L') depends on which emulation mode 'ld' is using, and in some
  378. cases also on how it was configured. *Note Environment::.
  379. The paths can also be specified in a link script with the
  380. 'SEARCH_DIR' command. Directories specified this way are searched
  381. at the point in which the linker script appears in the command
  382. line.
  383. '-m EMULATION'
  384. Emulate the EMULATION linker. You can list the available
  385. emulations with the '--verbose' or '-V' options.
  386. If the '-m' option is not used, the emulation is taken from the
  387. 'LDEMULATION' environment variable, if that is defined.
  388. Otherwise, the default emulation depends upon how the linker was
  389. configured.
  390. '-M'
  391. '--print-map'
  392. Print a link map to the standard output. A link map provides
  393. information about the link, including the following:
  394. * Where object files are mapped into memory.
  395. * How common symbols are allocated.
  396. * All archive members included in the link, with a mention of
  397. the symbol which caused the archive member to be brought in.
  398. * The values assigned to symbols.
  399. Note - symbols whose values are computed by an expression
  400. which involves a reference to a previous value of the same
  401. symbol may not have correct result displayed in the link map.
  402. This is because the linker discards intermediate results and
  403. only retains the final value of an expression. Under such
  404. circumstances the linker will display the final value enclosed
  405. by square brackets. Thus for example a linker script
  406. containing:
  407. foo = 1
  408. foo = foo * 4
  409. foo = foo + 8
  410. will produce the following output in the link map if the '-M'
  411. option is used:
  412. 0x00000001 foo = 0x1
  413. [0x0000000c] foo = (foo * 0x4)
  414. [0x0000000c] foo = (foo + 0x8)
  415. See *note Expressions:: for more information about expressions
  416. in linker scripts.
  417. * How GNU properties are merged.
  418. When the linker merges input .note.gnu.property sections into
  419. one output .note.gnu.property section, some properties are
  420. removed or updated. These actions are reported in the link
  421. map. For example:
  422. Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
  423. This indicates that property 0xc0000002 is removed from output
  424. when merging properties in 'foo.o', whose property 0xc0000002
  425. value is 0x1, and 'bar.o', which doesn't have property
  426. 0xc0000002.
  427. Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1)
  428. This indicates that property 0xc0010001 value is updated to
  429. 0x1 in output when merging properties in 'foo.o', whose
  430. 0xc0010001 property value is 0x1, and 'bar.o', whose
  431. 0xc0010001 property value is 0x1.
  432. '--print-map-discarded'
  433. '--no-print-map-discarded'
  434. Print (or do not print) the list of discarded and garbage collected
  435. sections in the link map. Enabled by default.
  436. '-n'
  437. '--nmagic'
  438. Turn off page alignment of sections, and disable linking against
  439. shared libraries. If the output format supports Unix style magic
  440. numbers, mark the output as 'NMAGIC'.
  441. '-N'
  442. '--omagic'
  443. Set the text and data sections to be readable and writable. Also,
  444. do not page-align the data segment, and disable linking against
  445. shared libraries. If the output format supports Unix style magic
  446. numbers, mark the output as 'OMAGIC'. Note: Although a writable
  447. text section is allowed for PE-COFF targets, it does not conform to
  448. the format specification published by Microsoft.
  449. '--no-omagic'
  450. This option negates most of the effects of the '-N' option. It
  451. sets the text section to be read-only, and forces the data segment
  452. to be page-aligned. Note - this option does not enable linking
  453. against shared libraries. Use '-Bdynamic' for this.
  454. '-o OUTPUT'
  455. '--output=OUTPUT'
  456. Use OUTPUT as the name for the program produced by 'ld'; if this
  457. option is not specified, the name 'a.out' is used by default. The
  458. script command 'OUTPUT' can also specify the output file name.
  459. '-O LEVEL'
  460. If LEVEL is a numeric values greater than zero 'ld' optimizes the
  461. output. This might take significantly longer and therefore
  462. probably should only be enabled for the final binary. At the
  463. moment this option only affects ELF shared library generation.
  464. Future releases of the linker may make more use of this option.
  465. Also currently there is no difference in the linker's behaviour for
  466. different non-zero values of this option. Again this may change
  467. with future releases.
  468. '-plugin NAME'
  469. Involve a plugin in the linking process. The NAME parameter is the
  470. absolute filename of the plugin. Usually this parameter is
  471. automatically added by the complier, when using link time
  472. optimization, but users can also add their own plugins if they so
  473. wish.
  474. Note that the location of the compiler originated plugins is
  475. different from the place where the 'ar', 'nm' and 'ranlib' programs
  476. search for their plugins. In order for those commands to make use
  477. of a compiler based plugin it must first be copied into the
  478. '${libdir}/bfd-plugins' directory. All gcc based linker plugins
  479. are backward compatible, so it is sufficient to just copy in the
  480. newest one.
  481. '--push-state'
  482. The '--push-state' allows to preserve the current state of the
  483. flags which govern the input file handling so that they can all be
  484. restored with one corresponding '--pop-state' option.
  485. The option which are covered are: '-Bdynamic', '-Bstatic', '-dn',
  486. '-dy', '-call_shared', '-non_shared', '-static', '-N', '-n',
  487. '--whole-archive', '--no-whole-archive', '-r', '-Ur',
  488. '--copy-dt-needed-entries', '--no-copy-dt-needed-entries',
  489. '--as-needed', '--no-as-needed', and '-a'.
  490. One target for this option are specifications for 'pkg-config'.
  491. When used with the '--libs' option all possibly needed libraries
  492. are listed and then possibly linked with all the time. It is
  493. better to return something as follows:
  494. -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state
  495. '--pop-state'
  496. Undoes the effect of -push-state, restores the previous values of
  497. the flags governing input file handling.
  498. '-q'
  499. '--emit-relocs'
  500. Leave relocation sections and contents in fully linked executables.
  501. Post link analysis and optimization tools may need this information
  502. in order to perform correct modifications of executables. This
  503. results in larger executables.
  504. This option is currently only supported on ELF platforms.
  505. '--force-dynamic'
  506. Force the output file to have dynamic sections. This option is
  507. specific to VxWorks targets.
  508. '-r'
  509. '--relocatable'
  510. Generate relocatable output--i.e., generate an output file that can
  511. in turn serve as input to 'ld'. This is often called "partial
  512. linking". As a side effect, in environments that support standard
  513. Unix magic numbers, this option also sets the output file's magic
  514. number to 'OMAGIC'. If this option is not specified, an absolute
  515. file is produced. When linking C++ programs, this option _will
  516. not_ resolve references to constructors; to do that, use '-Ur'.
  517. When an input file does not have the same format as the output
  518. file, partial linking is only supported if that input file does not
  519. contain any relocations. Different output formats can have further
  520. restrictions; for example some 'a.out'-based formats do not support
  521. partial linking with input files in other formats at all.
  522. This option does the same thing as '-i'.
  523. '-R FILENAME'
  524. '--just-symbols=FILENAME'
  525. Read symbol names and their addresses from FILENAME, but do not
  526. relocate it or include it in the output. This allows your output
  527. file to refer symbolically to absolute locations of memory defined
  528. in other programs. You may use this option more than once.
  529. For compatibility with other ELF linkers, if the '-R' option is
  530. followed by a directory name, rather than a file name, it is
  531. treated as the '-rpath' option.
  532. '-s'
  533. '--strip-all'
  534. Omit all symbol information from the output file.
  535. '-S'
  536. '--strip-debug'
  537. Omit debugger symbol information (but not all symbols) from the
  538. output file.
  539. '--strip-discarded'
  540. '--no-strip-discarded'
  541. Omit (or do not omit) global symbols defined in discarded sections.
  542. Enabled by default.
  543. '-t'
  544. '--trace'
  545. Print the names of the input files as 'ld' processes them. If '-t'
  546. is given twice then members within archives are also printed. '-t'
  547. output is useful to generate a list of all the object files and
  548. scripts involved in linking, for example, when packaging files for
  549. a linker bug report.
  550. '-T SCRIPTFILE'
  551. '--script=SCRIPTFILE'
  552. Use SCRIPTFILE as the linker script. This script replaces 'ld''s
  553. default linker script (rather than adding to it), so COMMANDFILE
  554. must specify everything necessary to describe the output file.
  555. *Note Scripts::. If SCRIPTFILE does not exist in the current
  556. directory, 'ld' looks for it in the directories specified by any
  557. preceding '-L' options. Multiple '-T' options accumulate.
  558. '-dT SCRIPTFILE'
  559. '--default-script=SCRIPTFILE'
  560. Use SCRIPTFILE as the default linker script. *Note Scripts::.
  561. This option is similar to the '--script' option except that
  562. processing of the script is delayed until after the rest of the
  563. command line has been processed. This allows options placed after
  564. the '--default-script' option on the command line to affect the
  565. behaviour of the linker script, which can be important when the
  566. linker command line cannot be directly controlled by the user. (eg
  567. because the command line is being constructed by another tool, such
  568. as 'gcc').
  569. '-u SYMBOL'
  570. '--undefined=SYMBOL'
  571. Force SYMBOL to be entered in the output file as an undefined
  572. symbol. Doing this may, for example, trigger linking of additional
  573. modules from standard libraries. '-u' may be repeated with
  574. different option arguments to enter additional undefined symbols.
  575. This option is equivalent to the 'EXTERN' linker script command.
  576. If this option is being used to force additional modules to be
  577. pulled into the link, and if it is an error for the symbol to
  578. remain undefined, then the option '--require-defined' should be
  579. used instead.
  580. '--require-defined=SYMBOL'
  581. Require that SYMBOL is defined in the output file. This option is
  582. the same as option '--undefined' except that if SYMBOL is not
  583. defined in the output file then the linker will issue an error and
  584. exit. The same effect can be achieved in a linker script by using
  585. 'EXTERN', 'ASSERT' and 'DEFINED' together. This option can be used
  586. multiple times to require additional symbols.
  587. '-Ur'
  588. For anything other than C++ programs, this option is equivalent to
  589. '-r': it generates relocatable output--i.e., an output file that
  590. can in turn serve as input to 'ld'. When linking C++ programs,
  591. '-Ur' _does_ resolve references to constructors, unlike '-r'. It
  592. does not work to use '-Ur' on files that were themselves linked
  593. with '-Ur'; once the constructor table has been built, it cannot be
  594. added to. Use '-Ur' only for the last partial link, and '-r' for
  595. the others.
  596. '--orphan-handling=MODE'
  597. Control how orphan sections are handled. An orphan section is one
  598. not specifically mentioned in a linker script. *Note Orphan
  599. Sections::.
  600. MODE can have any of the following values:
  601. 'place'
  602. Orphan sections are placed into a suitable output section
  603. following the strategy described in *note Orphan Sections::.
  604. The option '--unique' also affects how sections are placed.
  605. 'discard'
  606. All orphan sections are discarded, by placing them in the
  607. '/DISCARD/' section (*note Output Section Discarding::).
  608. 'warn'
  609. The linker will place the orphan section as for 'place' and
  610. also issue a warning.
  611. 'error'
  612. The linker will exit with an error if any orphan section is
  613. found.
  614. The default if '--orphan-handling' is not given is 'place'.
  615. '--unique[=SECTION]'
  616. Creates a separate output section for every input section matching
  617. SECTION, or if the optional wildcard SECTION argument is missing,
  618. for every orphan input section. An orphan section is one not
  619. specifically mentioned in a linker script. You may use this option
  620. multiple times on the command line; It prevents the normal merging
  621. of input sections with the same name, overriding output section
  622. assignments in a linker script.
  623. '-v'
  624. '--version'
  625. '-V'
  626. Display the version number for 'ld'. The '-V' option also lists
  627. the supported emulations.
  628. '-x'
  629. '--discard-all'
  630. Delete all local symbols.
  631. '-X'
  632. '--discard-locals'
  633. Delete all temporary local symbols. (These symbols start with
  634. system-specific local label prefixes, typically '.L' for ELF
  635. systems or 'L' for traditional a.out systems.)
  636. '-y SYMBOL'
  637. '--trace-symbol=SYMBOL'
  638. Print the name of each linked file in which SYMBOL appears. This
  639. option may be given any number of times. On many systems it is
  640. necessary to prepend an underscore.
  641. This option is useful when you have an undefined symbol in your
  642. link but don't know where the reference is coming from.
  643. '-Y PATH'
  644. Add PATH to the default library search path. This option exists
  645. for Solaris compatibility.
  646. '-z KEYWORD'
  647. The recognized keywords are:
  648. 'bndplt'
  649. Always generate BND prefix in PLT entries. Supported for
  650. Linux/x86_64.
  651. 'call-nop=prefix-addr'
  652. 'call-nop=suffix-nop'
  653. 'call-nop=prefix-BYTE'
  654. 'call-nop=suffix-BYTE'
  655. Specify the 1-byte 'NOP' padding when transforming indirect
  656. call to a locally defined function, foo, via its GOT slot.
  657. 'call-nop=prefix-addr' generates '0x67 call foo'.
  658. 'call-nop=suffix-nop' generates 'call foo 0x90'.
  659. 'call-nop=prefix-BYTE' generates 'BYTE call foo'.
  660. 'call-nop=suffix-BYTE' generates 'call foo BYTE'. Supported
  661. for i386 and x86_64.
  662. 'cet-report=none'
  663. 'cet-report=warning'
  664. 'cet-report=error'
  665. Specify how to report the missing
  666. GNU_PROPERTY_X86_FEATURE_1_IBT and
  667. GNU_PROPERTY_X86_FEATURE_1_SHSTK properties in input
  668. .note.gnu.property section. 'cet-report=none', which is the
  669. default, will make the linker not report missing properties in
  670. input files. 'cet-report=warning' will make the linker issue
  671. a warning for missing properties in input files.
  672. 'cet-report=error' will make the linker issue an error for
  673. missing properties in input files. Note that 'ibt' will turn
  674. off the missing GNU_PROPERTY_X86_FEATURE_1_IBT property report
  675. and 'shstk' will turn off the missing
  676. GNU_PROPERTY_X86_FEATURE_1_SHSTK property report. Supported
  677. for Linux/i386 and Linux/x86_64.
  678. 'combreloc'
  679. 'nocombreloc'
  680. Combine multiple dynamic relocation sections and sort to
  681. improve dynamic symbol lookup caching. Do not do this if
  682. 'nocombreloc'.
  683. 'common'
  684. 'nocommon'
  685. Generate common symbols with STT_COMMON type during a
  686. relocatable link. Use STT_OBJECT type if 'nocommon'.
  687. 'common-page-size=VALUE'
  688. Set the page size most commonly used to VALUE. Memory image
  689. layout will be optimized to minimize memory pages if the
  690. system is using pages of this size.
  691. 'defs'
  692. Report unresolved symbol references from regular object files.
  693. This is done even if the linker is creating a non-symbolic
  694. shared library. This option is the inverse of '-z undefs'.
  695. 'dynamic-undefined-weak'
  696. 'nodynamic-undefined-weak'
  697. Make undefined weak symbols dynamic when building a dynamic
  698. object, if they are referenced from a regular object file and
  699. not forced local by symbol visibility or versioning. Do not
  700. make them dynamic if 'nodynamic-undefined-weak'. If neither
  701. option is given, a target may default to either option being
  702. in force, or make some other selection of undefined weak
  703. symbols dynamic. Not all targets support these options.
  704. 'execstack'
  705. Marks the object as requiring executable stack.
  706. 'global'
  707. This option is only meaningful when building a shared object.
  708. It makes the symbols defined by this shared object available
  709. for symbol resolution of subsequently loaded libraries.
  710. 'globalaudit'
  711. This option is only meaningful when building a dynamic
  712. executable. This option marks the executable as requiring
  713. global auditing by setting the 'DF_1_GLOBAUDIT' bit in the
  714. 'DT_FLAGS_1' dynamic tag. Global auditing requires that any
  715. auditing library defined via the '--depaudit' or '-P'
  716. command-line options be run for all dynamic objects loaded by
  717. the application.
  718. 'ibtplt'
  719. Generate Intel Indirect Branch Tracking (IBT) enabled PLT
  720. entries. Supported for Linux/i386 and Linux/x86_64.
  721. 'ibt'
  722. Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property
  723. section to indicate compatibility with IBT. This also implies
  724. 'ibtplt'. Supported for Linux/i386 and Linux/x86_64.
  725. 'initfirst'
  726. This option is only meaningful when building a shared object.
  727. It marks the object so that its runtime initialization will
  728. occur before the runtime initialization of any other objects
  729. brought into the process at the same time. Similarly the
  730. runtime finalization of the object will occur after the
  731. runtime finalization of any other objects.
  732. 'interpose'
  733. Specify that the dynamic loader should modify its symbol
  734. search order so that symbols in this shared library interpose
  735. all other shared libraries not so marked.
  736. 'lazy'
  737. When generating an executable or shared library, mark it to
  738. tell the dynamic linker to defer function call resolution to
  739. the point when the function is called (lazy binding), rather
  740. than at load time. Lazy binding is the default.
  741. 'loadfltr'
  742. Specify that the object's filters be processed immediately at
  743. runtime.
  744. 'max-page-size=VALUE'
  745. Set the maximum memory page size supported to VALUE.
  746. 'muldefs'
  747. Allow multiple definitions.
  748. 'nocopyreloc'
  749. Disable linker generated .dynbss variables used in place of
  750. variables defined in shared libraries. May result in dynamic
  751. text relocations.
  752. 'nodefaultlib'
  753. Specify that the dynamic loader search for dependencies of
  754. this object should ignore any default library search paths.
  755. 'nodelete'
  756. Specify that the object shouldn't be unloaded at runtime.
  757. 'nodlopen'
  758. Specify that the object is not available to 'dlopen'.
  759. 'nodump'
  760. Specify that the object can not be dumped by 'dldump'.
  761. 'noexecstack'
  762. Marks the object as not requiring executable stack.
  763. 'noextern-protected-data'
  764. Don't treat protected data symbols as external when building a
  765. shared library. This option overrides the linker backend
  766. default. It can be used to work around incorrect relocations
  767. against protected data symbols generated by compiler. Updates
  768. on protected data symbols by another module aren't visible to
  769. the resulting shared library. Supported for i386 and x86-64.
  770. 'noreloc-overflow'
  771. Disable relocation overflow check. This can be used to
  772. disable relocation overflow check if there will be no dynamic
  773. relocation overflow at run-time. Supported for x86_64.
  774. 'now'
  775. When generating an executable or shared library, mark it to
  776. tell the dynamic linker to resolve all symbols when the
  777. program is started, or when the shared library is loaded by
  778. dlopen, instead of deferring function call resolution to the
  779. point when the function is first called.
  780. 'origin'
  781. Specify that the object requires '$ORIGIN' handling in paths.
  782. 'relro'
  783. 'norelro'
  784. Create an ELF 'PT_GNU_RELRO' segment header in the object.
  785. This specifies a memory segment that should be made read-only
  786. after relocation, if supported. Specifying 'common-page-size'
  787. smaller than the system page size will render this protection
  788. ineffective. Don't create an ELF 'PT_GNU_RELRO' segment if
  789. 'norelro'.
  790. 'separate-code'
  791. 'noseparate-code'
  792. Create separate code 'PT_LOAD' segment header in the object.
  793. This specifies a memory segment that should contain only
  794. instructions and must be in wholly disjoint pages from any
  795. other data. Don't create separate code 'PT_LOAD' segment if
  796. 'noseparate-code' is used.
  797. 'shstk'
  798. Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in
  799. .note.gnu.property section to indicate compatibility with
  800. Intel Shadow Stack. Supported for Linux/i386 and
  801. Linux/x86_64.
  802. 'stack-size=VALUE'
  803. Specify a stack size for an ELF 'PT_GNU_STACK' segment.
  804. Specifying zero will override any default non-zero sized
  805. 'PT_GNU_STACK' segment creation.
  806. 'text'
  807. 'notext'
  808. 'textoff'
  809. Report an error if DT_TEXTREL is set, i.e., if the binary has
  810. dynamic relocations in read-only sections. Don't report an
  811. error if 'notext' or 'textoff'.
  812. 'undefs'
  813. Do not report unresolved symbol references from regular object
  814. files, either when creating an executable, or when creating a
  815. shared library. This option is the inverse of '-z defs'.
  816. Other keywords are ignored for Solaris compatibility.
  817. '-( ARCHIVES -)'
  818. '--start-group ARCHIVES --end-group'
  819. The ARCHIVES should be a list of archive files. They may be either
  820. explicit file names, or '-l' options.
  821. The specified archives are searched repeatedly until no new
  822. undefined references are created. Normally, an archive is searched
  823. only once in the order that it is specified on the command line.
  824. If a symbol in that archive is needed to resolve an undefined
  825. symbol referred to by an object in an archive that appears later on
  826. the command line, the linker would not be able to resolve that
  827. reference. By grouping the archives, they will all be searched
  828. repeatedly until all possible references are resolved.
  829. Using this option has a significant performance cost. It is best
  830. to use it only when there are unavoidable circular references
  831. between two or more archives.
  832. '--accept-unknown-input-arch'
  833. '--no-accept-unknown-input-arch'
  834. Tells the linker to accept input files whose architecture cannot be
  835. recognised. The assumption is that the user knows what they are
  836. doing and deliberately wants to link in these unknown input files.
  837. This was the default behaviour of the linker, before release 2.14.
  838. The default behaviour from release 2.14 onwards is to reject such
  839. input files, and so the '--accept-unknown-input-arch' option has
  840. been added to restore the old behaviour.
  841. '--as-needed'
  842. '--no-as-needed'
  843. This option affects ELF DT_NEEDED tags for dynamic libraries
  844. mentioned on the command line after the '--as-needed' option.
  845. Normally the linker will add a DT_NEEDED tag for each dynamic
  846. library mentioned on the command line, regardless of whether the
  847. library is actually needed or not. '--as-needed' causes a
  848. DT_NEEDED tag to only be emitted for a library that _at that point
  849. in the link_ satisfies a non-weak undefined symbol reference from a
  850. regular object file or, if the library is not found in the
  851. DT_NEEDED lists of other needed libraries, a non-weak undefined
  852. symbol reference from another needed dynamic library. Object files
  853. or libraries appearing on the command line _after_ the library in
  854. question do not affect whether the library is seen as needed. This
  855. is similar to the rules for extraction of object files from
  856. archives. '--no-as-needed' restores the default behaviour.
  857. '--add-needed'
  858. '--no-add-needed'
  859. These two options have been deprecated because of the similarity of
  860. their names to the '--as-needed' and '--no-as-needed' options.
  861. They have been replaced by '--copy-dt-needed-entries' and
  862. '--no-copy-dt-needed-entries'.
  863. '-assert KEYWORD'
  864. This option is ignored for SunOS compatibility.
  865. '-Bdynamic'
  866. '-dy'
  867. '-call_shared'
  868. Link against dynamic libraries. This is only meaningful on
  869. platforms for which shared libraries are supported. This option is
  870. normally the default on such platforms. The different variants of
  871. this option are for compatibility with various systems. You may
  872. use this option multiple times on the command line: it affects
  873. library searching for '-l' options which follow it.
  874. '-Bgroup'
  875. Set the 'DF_1_GROUP' flag in the 'DT_FLAGS_1' entry in the dynamic
  876. section. This causes the runtime linker to handle lookups in this
  877. object and its dependencies to be performed only inside the group.
  878. '--unresolved-symbols=report-all' is implied. This option is only
  879. meaningful on ELF platforms which support shared libraries.
  880. '-Bstatic'
  881. '-dn'
  882. '-non_shared'
  883. '-static'
  884. Do not link against shared libraries. This is only meaningful on
  885. platforms for which shared libraries are supported. The different
  886. variants of this option are for compatibility with various systems.
  887. You may use this option multiple times on the command line: it
  888. affects library searching for '-l' options which follow it. This
  889. option also implies '--unresolved-symbols=report-all'. This option
  890. can be used with '-shared'. Doing so means that a shared library
  891. is being created but that all of the library's external references
  892. must be resolved by pulling in entries from static libraries.
  893. '-Bsymbolic'
  894. When creating a shared library, bind references to global symbols
  895. to the definition within the shared library, if any. Normally, it
  896. is possible for a program linked against a shared library to
  897. override the definition within the shared library. This option can
  898. also be used with the '--export-dynamic' option, when creating a
  899. position independent executable, to bind references to global
  900. symbols to the definition within the executable. This option is
  901. only meaningful on ELF platforms which support shared libraries and
  902. position independent executables.
  903. '-Bsymbolic-functions'
  904. When creating a shared library, bind references to global function
  905. symbols to the definition within the shared library, if any. This
  906. option can also be used with the '--export-dynamic' option, when
  907. creating a position independent executable, to bind references to
  908. global function symbols to the definition within the executable.
  909. This option is only meaningful on ELF platforms which support
  910. shared libraries and position independent executables.
  911. '--dynamic-list=DYNAMIC-LIST-FILE'
  912. Specify the name of a dynamic list file to the linker. This is
  913. typically used when creating shared libraries to specify a list of
  914. global symbols whose references shouldn't be bound to the
  915. definition within the shared library, or creating dynamically
  916. linked executables to specify a list of symbols which should be
  917. added to the symbol table in the executable. This option is only
  918. meaningful on ELF platforms which support shared libraries.
  919. The format of the dynamic list is the same as the version node
  920. without scope and node name. See *note VERSION:: for more
  921. information.
  922. '--dynamic-list-data'
  923. Include all global data symbols to the dynamic list.
  924. '--dynamic-list-cpp-new'
  925. Provide the builtin dynamic list for C++ operator new and delete.
  926. It is mainly useful for building shared libstdc++.
  927. '--dynamic-list-cpp-typeinfo'
  928. Provide the builtin dynamic list for C++ runtime type
  929. identification.
  930. '--check-sections'
  931. '--no-check-sections'
  932. Asks the linker _not_ to check section addresses after they have
  933. been assigned to see if there are any overlaps. Normally the
  934. linker will perform this check, and if it finds any overlaps it
  935. will produce suitable error messages. The linker does know about,
  936. and does make allowances for sections in overlays. The default
  937. behaviour can be restored by using the command-line switch
  938. '--check-sections'. Section overlap is not usually checked for
  939. relocatable links. You can force checking in that case by using
  940. the '--check-sections' option.
  941. '--copy-dt-needed-entries'
  942. '--no-copy-dt-needed-entries'
  943. This option affects the treatment of dynamic libraries referred to
  944. by DT_NEEDED tags _inside_ ELF dynamic libraries mentioned on the
  945. command line. Normally the linker won't add a DT_NEEDED tag to the
  946. output binary for each library mentioned in a DT_NEEDED tag in an
  947. input dynamic library. With '--copy-dt-needed-entries' specified
  948. on the command line however any dynamic libraries that follow it
  949. will have their DT_NEEDED entries added. The default behaviour can
  950. be restored with '--no-copy-dt-needed-entries'.
  951. This option also has an effect on the resolution of symbols in
  952. dynamic libraries. With '--copy-dt-needed-entries' dynamic
  953. libraries mentioned on the command line will be recursively
  954. searched, following their DT_NEEDED tags to other libraries, in
  955. order to resolve symbols required by the output binary. With the
  956. default setting however the searching of dynamic libraries that
  957. follow it will stop with the dynamic library itself. No DT_NEEDED
  958. links will be traversed to resolve symbols.
  959. '--cref'
  960. Output a cross reference table. If a linker map file is being
  961. generated, the cross reference table is printed to the map file.
  962. Otherwise, it is printed on the standard output.
  963. The format of the table is intentionally simple, so that it may be
  964. easily processed by a script if necessary. The symbols are printed
  965. out, sorted by name. For each symbol, a list of file names is
  966. given. If the symbol is defined, the first file listed is the
  967. location of the definition. If the symbol is defined as a common
  968. value then any files where this happens appear next. Finally any
  969. files that reference the symbol are listed.
  970. '--no-define-common'
  971. This option inhibits the assignment of addresses to common symbols.
  972. The script command 'INHIBIT_COMMON_ALLOCATION' has the same effect.
  973. *Note Miscellaneous Commands::.
  974. The '--no-define-common' option allows decoupling the decision to
  975. assign addresses to Common symbols from the choice of the output
  976. file type; otherwise a non-Relocatable output type forces assigning
  977. addresses to Common symbols. Using '--no-define-common' allows
  978. Common symbols that are referenced from a shared library to be
  979. assigned addresses only in the main program. This eliminates the
  980. unused duplicate space in the shared library, and also prevents any
  981. possible confusion over resolving to the wrong duplicate when there
  982. are many dynamic modules with specialized search paths for runtime
  983. symbol resolution.
  984. '--force-group-allocation'
  985. This option causes the linker to place section group members like
  986. normal input sections, and to delete the section groups. This is
  987. the default behaviour for a final link but this option can be used
  988. to change the behaviour of a relocatable link ('-r'). The script
  989. command 'FORCE_GROUP_ALLOCATION' has the same effect. *Note
  990. Miscellaneous Commands::.
  991. '--defsym=SYMBOL=EXPRESSION'
  992. Create a global symbol in the output file, containing the absolute
  993. address given by EXPRESSION. You may use this option as many times
  994. as necessary to define multiple symbols in the command line. A
  995. limited form of arithmetic is supported for the EXPRESSION in this
  996. context: you may give a hexadecimal constant or the name of an
  997. existing symbol, or use '+' and '-' to add or subtract hexadecimal
  998. constants or symbols. If you need more elaborate expressions,
  999. consider using the linker command language from a script (*note
  1000. Assignments::). _Note:_ there should be no white space between
  1001. SYMBOL, the equals sign ("<=>"), and EXPRESSION.
  1002. '--demangle[=STYLE]'
  1003. '--no-demangle'
  1004. These options control whether to demangle symbol names in error
  1005. messages and other output. When the linker is told to demangle, it
  1006. tries to present symbol names in a readable fashion: it strips
  1007. leading underscores if they are used by the object file format, and
  1008. converts C++ mangled symbol names into user readable names.
  1009. Different compilers have different mangling styles. The optional
  1010. demangling style argument can be used to choose an appropriate
  1011. demangling style for your compiler. The linker will demangle by
  1012. default unless the environment variable 'COLLECT_NO_DEMANGLE' is
  1013. set. These options may be used to override the default.
  1014. '-IFILE'
  1015. '--dynamic-linker=FILE'
  1016. Set the name of the dynamic linker. This is only meaningful when
  1017. generating dynamically linked ELF executables. The default dynamic
  1018. linker is normally correct; don't use this unless you know what you
  1019. are doing.
  1020. '--no-dynamic-linker'
  1021. When producing an executable file, omit the request for a dynamic
  1022. linker to be used at load-time. This is only meaningful for ELF
  1023. executables that contain dynamic relocations, and usually requires
  1024. entry point code that is capable of processing these relocations.
  1025. '--embedded-relocs'
  1026. This option is similar to the '--emit-relocs' option except that
  1027. the relocs are stored in a target-specific section. This option is
  1028. only supported by the 'BFIN', 'CR16' and _M68K_ targets.
  1029. '--disable-multiple-abs-defs'
  1030. Do not allow multiple definitions with symbols included in filename
  1031. invoked by -R or -just-symbols
  1032. '--fatal-warnings'
  1033. '--no-fatal-warnings'
  1034. Treat all warnings as errors. The default behaviour can be
  1035. restored with the option '--no-fatal-warnings'.
  1036. '--force-exe-suffix'
  1037. Make sure that an output file has a .exe suffix.
  1038. If a successfully built fully linked output file does not have a
  1039. '.exe' or '.dll' suffix, this option forces the linker to copy the
  1040. output file to one of the same name with a '.exe' suffix. This
  1041. option is useful when using unmodified Unix makefiles on a
  1042. Microsoft Windows host, since some versions of Windows won't run an
  1043. image unless it ends in a '.exe' suffix.
  1044. '--gc-sections'
  1045. '--no-gc-sections'
  1046. Enable garbage collection of unused input sections. It is ignored
  1047. on targets that do not support this option. The default behaviour
  1048. (of not performing this garbage collection) can be restored by
  1049. specifying '--no-gc-sections' on the command line. Note that
  1050. garbage collection for COFF and PE format targets is supported, but
  1051. the implementation is currently considered to be experimental.
  1052. '--gc-sections' decides which input sections are used by examining
  1053. symbols and relocations. The section containing the entry symbol
  1054. and all sections containing symbols undefined on the command-line
  1055. will be kept, as will sections containing symbols referenced by
  1056. dynamic objects. Note that when building shared libraries, the
  1057. linker must assume that any visible symbol is referenced. Once
  1058. this initial set of sections has been determined, the linker
  1059. recursively marks as used any section referenced by their
  1060. relocations. See '--entry', '--undefined', and
  1061. '--gc-keep-exported'.
  1062. This option can be set when doing a partial link (enabled with
  1063. option '-r'). In this case the root of symbols kept must be
  1064. explicitly specified either by one of the options '--entry',
  1065. '--undefined', or '--gc-keep-exported' or by a 'ENTRY' command in
  1066. the linker script.
  1067. '--print-gc-sections'
  1068. '--no-print-gc-sections'
  1069. List all sections removed by garbage collection. The listing is
  1070. printed on stderr. This option is only effective if garbage
  1071. collection has been enabled via the '--gc-sections') option. The
  1072. default behaviour (of not listing the sections that are removed)
  1073. can be restored by specifying '--no-print-gc-sections' on the
  1074. command line.
  1075. '--gc-keep-exported'
  1076. When '--gc-sections' is enabled, this option prevents garbage
  1077. collection of unused input sections that contain global symbols
  1078. having default or protected visibility. This option is intended to
  1079. be used for executables where unreferenced sections would otherwise
  1080. be garbage collected regardless of the external visibility of
  1081. contained symbols. Note that this option has no effect when
  1082. linking shared objects since it is already the default behaviour.
  1083. This option is only supported for ELF format targets.
  1084. '--print-output-format'
  1085. Print the name of the default output format (perhaps influenced by
  1086. other command-line options). This is the string that would appear
  1087. in an 'OUTPUT_FORMAT' linker script command (*note File
  1088. Commands::).
  1089. '--print-memory-usage'
  1090. Print used size, total size and used size of memory regions created
  1091. with the *note MEMORY:: command. This is useful on embedded
  1092. targets to have a quick view of amount of free memory. The format
  1093. of the output has one headline and one line per region. It is both
  1094. human readable and easily parsable by tools. Here is an example of
  1095. an output:
  1096. Memory region Used Size Region Size %age Used
  1097. ROM: 256 KB 1 MB 25.00%
  1098. RAM: 32 B 2 GB 0.00%
  1099. '--help'
  1100. Print a summary of the command-line options on the standard output
  1101. and exit.
  1102. '--target-help'
  1103. Print a summary of all target-specific options on the standard
  1104. output and exit.
  1105. '-Map=MAPFILE'
  1106. Print a link map to the file MAPFILE. See the description of the
  1107. '-M' option, above.
  1108. '--no-keep-memory'
  1109. 'ld' normally optimizes for speed over memory usage by caching the
  1110. symbol tables of input files in memory. This option tells 'ld' to
  1111. instead optimize for memory usage, by rereading the symbol tables
  1112. as necessary. This may be required if 'ld' runs out of memory
  1113. space while linking a large executable.
  1114. '--no-undefined'
  1115. '-z defs'
  1116. Report unresolved symbol references from regular object files.
  1117. This is done even if the linker is creating a non-symbolic shared
  1118. library. The switch '--[no-]allow-shlib-undefined' controls the
  1119. behaviour for reporting unresolved references found in shared
  1120. libraries being linked in.
  1121. The effects of this option can be reverted by using '-z undefs'.
  1122. '--allow-multiple-definition'
  1123. '-z muldefs'
  1124. Normally when a symbol is defined multiple times, the linker will
  1125. report a fatal error. These options allow multiple definitions and
  1126. the first definition will be used.
  1127. '--allow-shlib-undefined'
  1128. '--no-allow-shlib-undefined'
  1129. Allows or disallows undefined symbols in shared libraries. This
  1130. switch is similar to '--no-undefined' except that it determines the
  1131. behaviour when the undefined symbols are in a shared library rather
  1132. than a regular object file. It does not affect how undefined
  1133. symbols in regular object files are handled.
  1134. The default behaviour is to report errors for any undefined symbols
  1135. referenced in shared libraries if the linker is being used to
  1136. create an executable, but to allow them if the linker is being used
  1137. to create a shared library.
  1138. The reasons for allowing undefined symbol references in shared
  1139. libraries specified at link time are that:
  1140. * A shared library specified at link time may not be the same as
  1141. the one that is available at load time, so the symbol might
  1142. actually be resolvable at load time.
  1143. * There are some operating systems, eg BeOS and HPPA, where
  1144. undefined symbols in shared libraries are normal.
  1145. The BeOS kernel for example patches shared libraries at load
  1146. time to select whichever function is most appropriate for the
  1147. current architecture. This is used, for example, to
  1148. dynamically select an appropriate memset function.
  1149. '--no-undefined-version'
  1150. Normally when a symbol has an undefined version, the linker will
  1151. ignore it. This option disallows symbols with undefined version
  1152. and a fatal error will be issued instead.
  1153. '--default-symver'
  1154. Create and use a default symbol version (the soname) for
  1155. unversioned exported symbols.
  1156. '--default-imported-symver'
  1157. Create and use a default symbol version (the soname) for
  1158. unversioned imported symbols.
  1159. '--no-warn-mismatch'
  1160. Normally 'ld' will give an error if you try to link together input
  1161. files that are mismatched for some reason, perhaps because they
  1162. have been compiled for different processors or for different
  1163. endiannesses. This option tells 'ld' that it should silently
  1164. permit such possible errors. This option should only be used with
  1165. care, in cases when you have taken some special action that ensures
  1166. that the linker errors are inappropriate.
  1167. '--no-warn-search-mismatch'
  1168. Normally 'ld' will give a warning if it finds an incompatible
  1169. library during a library search. This option silences the warning.
  1170. '--no-whole-archive'
  1171. Turn off the effect of the '--whole-archive' option for subsequent
  1172. archive files.
  1173. '--noinhibit-exec'
  1174. Retain the executable output file whenever it is still usable.
  1175. Normally, the linker will not produce an output file if it
  1176. encounters errors during the link process; it exits without writing
  1177. an output file when it issues any error whatsoever.
  1178. '-nostdlib'
  1179. Only search library directories explicitly specified on the command
  1180. line. Library directories specified in linker scripts (including
  1181. linker scripts specified on the command line) are ignored.
  1182. '--oformat=OUTPUT-FORMAT'
  1183. 'ld' may be configured to support more than one kind of object
  1184. file. If your 'ld' is configured this way, you can use the
  1185. '--oformat' option to specify the binary format for the output
  1186. object file. Even when 'ld' is configured to support alternative
  1187. object formats, you don't usually need to specify this, as 'ld'
  1188. should be configured to produce as a default output format the most
  1189. usual format on each machine. OUTPUT-FORMAT is a text string, the
  1190. name of a particular format supported by the BFD libraries. (You
  1191. can list the available binary formats with 'objdump -i'.) The
  1192. script command 'OUTPUT_FORMAT' can also specify the output format,
  1193. but this option overrides it. *Note BFD::.
  1194. '--out-implib FILE'
  1195. Create an import library in FILE corresponding to the executable
  1196. the linker is generating (eg. a DLL or ELF program). This import
  1197. library (which should be called '*.dll.a' or '*.a' for DLLs) may be
  1198. used to link clients against the generated executable; this
  1199. behaviour makes it possible to skip a separate import library
  1200. creation step (eg. 'dlltool' for DLLs). This option is only
  1201. available for the i386 PE and ELF targetted ports of the linker.
  1202. '-pie'
  1203. '--pic-executable'
  1204. Create a position independent executable. This is currently only
  1205. supported on ELF platforms. Position independent executables are
  1206. similar to shared libraries in that they are relocated by the
  1207. dynamic linker to the virtual address the OS chooses for them
  1208. (which can vary between invocations). Like normal dynamically
  1209. linked executables they can be executed and symbols defined in the
  1210. executable cannot be overridden by shared libraries.
  1211. '-qmagic'
  1212. This option is ignored for Linux compatibility.
  1213. '-Qy'
  1214. This option is ignored for SVR4 compatibility.
  1215. '--relax'
  1216. '--no-relax'
  1217. An option with machine dependent effects. This option is only
  1218. supported on a few targets. *Note 'ld' and the H8/300: H8/300.
  1219. *Note 'ld' and Xtensa Processors: Xtensa. *Note 'ld' and the
  1220. 68HC11 and 68HC12: M68HC11/68HC12. *Note 'ld' and the Altera Nios
  1221. II: Nios II. *Note 'ld' and PowerPC 32-bit ELF Support: PowerPC
  1222. ELF32.
  1223. On some platforms the '--relax' option performs target-specific,
  1224. global optimizations that become possible when the linker resolves
  1225. addressing in the program, such as relaxing address modes,
  1226. synthesizing new instructions, selecting shorter version of current
  1227. instructions, and combining constant values.
  1228. On some platforms these link time global optimizations may make
  1229. symbolic debugging of the resulting executable impossible. This is
  1230. known to be the case for the Matsushita MN10200 and MN10300 family
  1231. of processors.
  1232. On platforms where this is not supported, '--relax' is accepted,
  1233. but ignored.
  1234. On platforms where '--relax' is accepted the option '--no-relax'
  1235. can be used to disable the feature.
  1236. '--retain-symbols-file=FILENAME'
  1237. Retain _only_ the symbols listed in the file FILENAME, discarding
  1238. all others. FILENAME is simply a flat file, with one symbol name
  1239. per line. This option is especially useful in environments (such
  1240. as VxWorks) where a large global symbol table is accumulated
  1241. gradually, to conserve run-time memory.
  1242. '--retain-symbols-file' does _not_ discard undefined symbols, or
  1243. symbols needed for relocations.
  1244. You may only specify '--retain-symbols-file' once in the command
  1245. line. It overrides '-s' and '-S'.
  1246. '-rpath=DIR'
  1247. Add a directory to the runtime library search path. This is used
  1248. when linking an ELF executable with shared objects. All '-rpath'
  1249. arguments are concatenated and passed to the runtime linker, which
  1250. uses them to locate shared objects at runtime.
  1251. The '-rpath' option is also used when locating shared objects which
  1252. are needed by shared objects explicitly included in the link; see
  1253. the description of the '-rpath-link' option. Searching '-rpath' in
  1254. this way is only supported by native linkers and cross linkers
  1255. which have been configured with the '--with-sysroot' option.
  1256. If '-rpath' is not used when linking an ELF executable, the
  1257. contents of the environment variable 'LD_RUN_PATH' will be used if
  1258. it is defined.
  1259. The '-rpath' option may also be used on SunOS. By default, on
  1260. SunOS, the linker will form a runtime search path out of all the
  1261. '-L' options it is given. If a '-rpath' option is used, the
  1262. runtime search path will be formed exclusively using the '-rpath'
  1263. options, ignoring the '-L' options. This can be useful when using
  1264. gcc, which adds many '-L' options which may be on NFS mounted file
  1265. systems.
  1266. For compatibility with other ELF linkers, if the '-R' option is
  1267. followed by a directory name, rather than a file name, it is
  1268. treated as the '-rpath' option.
  1269. '-rpath-link=DIR'
  1270. When using ELF or SunOS, one shared library may require another.
  1271. This happens when an 'ld -shared' link includes a shared library as
  1272. one of the input files.
  1273. When the linker encounters such a dependency when doing a
  1274. non-shared, non-relocatable link, it will automatically try to
  1275. locate the required shared library and include it in the link, if
  1276. it is not included explicitly. In such a case, the '-rpath-link'
  1277. option specifies the first set of directories to search. The
  1278. '-rpath-link' option may specify a sequence of directory names
  1279. either by specifying a list of names separated by colons, or by
  1280. appearing multiple times.
  1281. The tokens $ORIGIN and $LIB can appear in these search directories.
  1282. They will be replaced by the full path to the directory containing
  1283. the program or shared object in the case of $ORIGIN and either
  1284. 'lib' - for 32-bit binaries - or 'lib64' - for 64-bit binaries - in
  1285. the case of $LIB.
  1286. The alternative form of these tokens - ${ORIGIN} and ${LIB} can
  1287. also be used. The token $PLATFORM is not supported.
  1288. This option should be used with caution as it overrides the search
  1289. path that may have been hard compiled into a shared library. In
  1290. such a case it is possible to use unintentionally a different
  1291. search path than the runtime linker would do.
  1292. The linker uses the following search paths to locate required
  1293. shared libraries:
  1294. 1. Any directories specified by '-rpath-link' options.
  1295. 2. Any directories specified by '-rpath' options. The difference
  1296. between '-rpath' and '-rpath-link' is that directories
  1297. specified by '-rpath' options are included in the executable
  1298. and used at runtime, whereas the '-rpath-link' option is only
  1299. effective at link time. Searching '-rpath' in this way is
  1300. only supported by native linkers and cross linkers which have
  1301. been configured with the '--with-sysroot' option.
  1302. 3. On an ELF system, for native linkers, if the '-rpath' and
  1303. '-rpath-link' options were not used, search the contents of
  1304. the environment variable 'LD_RUN_PATH'.
  1305. 4. On SunOS, if the '-rpath' option was not used, search any
  1306. directories specified using '-L' options.
  1307. 5. For a native linker, search the contents of the environment
  1308. variable 'LD_LIBRARY_PATH'.
  1309. 6. For a native ELF linker, the directories in 'DT_RUNPATH' or
  1310. 'DT_RPATH' of a shared library are searched for shared
  1311. libraries needed by it. The 'DT_RPATH' entries are ignored if
  1312. 'DT_RUNPATH' entries exist.
  1313. 7. The default directories, normally '/lib' and '/usr/lib'.
  1314. 8. For a native linker on an ELF system, if the file
  1315. '/etc/ld.so.conf' exists, the list of directories found in
  1316. that file.
  1317. If the required shared library is not found, the linker will issue
  1318. a warning and continue with the link.
  1319. '-shared'
  1320. '-Bshareable'
  1321. Create a shared library. This is currently only supported on ELF,
  1322. XCOFF and SunOS platforms. On SunOS, the linker will automatically
  1323. create a shared library if the '-e' option is not used and there
  1324. are undefined symbols in the link.
  1325. '--sort-common'
  1326. '--sort-common=ascending'
  1327. '--sort-common=descending'
  1328. This option tells 'ld' to sort the common symbols by alignment in
  1329. ascending or descending order when it places them in the
  1330. appropriate output sections. The symbol alignments considered are
  1331. sixteen-byte or larger, eight-byte, four-byte, two-byte, and
  1332. one-byte. This is to prevent gaps between symbols due to alignment
  1333. constraints. If no sorting order is specified, then descending
  1334. order is assumed.
  1335. '--sort-section=name'
  1336. This option will apply 'SORT_BY_NAME' to all wildcard section
  1337. patterns in the linker script.
  1338. '--sort-section=alignment'
  1339. This option will apply 'SORT_BY_ALIGNMENT' to all wildcard section
  1340. patterns in the linker script.
  1341. '--spare-dynamic-tags=COUNT'
  1342. This option specifies the number of empty slots to leave in the
  1343. .dynamic section of ELF shared objects. Empty slots may be needed
  1344. by post processing tools, such as the prelinker. The default is 5.
  1345. '--split-by-file[=SIZE]'
  1346. Similar to '--split-by-reloc' but creates a new output section for
  1347. each input file when SIZE is reached. SIZE defaults to a size of 1
  1348. if not given.
  1349. '--split-by-reloc[=COUNT]'
  1350. Tries to creates extra sections in the output file so that no
  1351. single output section in the file contains more than COUNT
  1352. relocations. This is useful when generating huge relocatable files
  1353. for downloading into certain real time kernels with the COFF object
  1354. file format; since COFF cannot represent more than 65535
  1355. relocations in a single section. Note that this will fail to work
  1356. with object file formats which do not support arbitrary sections.
  1357. The linker will not split up individual input sections for
  1358. redistribution, so if a single input section contains more than
  1359. COUNT relocations one output section will contain that many
  1360. relocations. COUNT defaults to a value of 32768.
  1361. '--stats'
  1362. Compute and display statistics about the operation of the linker,
  1363. such as execution time and memory usage.
  1364. '--sysroot=DIRECTORY'
  1365. Use DIRECTORY as the location of the sysroot, overriding the
  1366. configure-time default. This option is only supported by linkers
  1367. that were configured using '--with-sysroot'.
  1368. '--task-link'
  1369. This is used by COFF/PE based targets to create a task-linked
  1370. object file where all of the global symbols have been converted to
  1371. statics.
  1372. '--traditional-format'
  1373. For some targets, the output of 'ld' is different in some ways from
  1374. the output of some existing linker. This switch requests 'ld' to
  1375. use the traditional format instead.
  1376. For example, on SunOS, 'ld' combines duplicate entries in the
  1377. symbol string table. This can reduce the size of an output file
  1378. with full debugging information by over 30 percent. Unfortunately,
  1379. the SunOS 'dbx' program can not read the resulting program ('gdb'
  1380. has no trouble). The '--traditional-format' switch tells 'ld' to
  1381. not combine duplicate entries.
  1382. '--section-start=SECTIONNAME=ORG'
  1383. Locate a section in the output file at the absolute address given
  1384. by ORG. You may use this option as many times as necessary to
  1385. locate multiple sections in the command line. ORG must be a single
  1386. hexadecimal integer; for compatibility with other linkers, you may
  1387. omit the leading '0x' usually associated with hexadecimal values.
  1388. _Note:_ there should be no white space between SECTIONNAME, the
  1389. equals sign ("<=>"), and ORG.
  1390. '-Tbss=ORG'
  1391. '-Tdata=ORG'
  1392. '-Ttext=ORG'
  1393. Same as '--section-start', with '.bss', '.data' or '.text' as the
  1394. SECTIONNAME.
  1395. '-Ttext-segment=ORG'
  1396. When creating an ELF executable, it will set the address of the
  1397. first byte of the text segment.
  1398. '-Trodata-segment=ORG'
  1399. When creating an ELF executable or shared object for a target where
  1400. the read-only data is in its own segment separate from the
  1401. executable text, it will set the address of the first byte of the
  1402. read-only data segment.
  1403. '-Tldata-segment=ORG'
  1404. When creating an ELF executable or shared object for x86-64 medium
  1405. memory model, it will set the address of the first byte of the
  1406. ldata segment.
  1407. '--unresolved-symbols=METHOD'
  1408. Determine how to handle unresolved symbols. There are four
  1409. possible values for 'method':
  1410. 'ignore-all'
  1411. Do not report any unresolved symbols.
  1412. 'report-all'
  1413. Report all unresolved symbols. This is the default.
  1414. 'ignore-in-object-files'
  1415. Report unresolved symbols that are contained in shared
  1416. libraries, but ignore them if they come from regular object
  1417. files.
  1418. 'ignore-in-shared-libs'
  1419. Report unresolved symbols that come from regular object files,
  1420. but ignore them if they come from shared libraries. This can
  1421. be useful when creating a dynamic binary and it is known that
  1422. all the shared libraries that it should be referencing are
  1423. included on the linker's command line.
  1424. The behaviour for shared libraries on their own can also be
  1425. controlled by the '--[no-]allow-shlib-undefined' option.
  1426. Normally the linker will generate an error message for each
  1427. reported unresolved symbol but the option
  1428. '--warn-unresolved-symbols' can change this to a warning.
  1429. '--dll-verbose'
  1430. '--verbose[=NUMBER]'
  1431. Display the version number for 'ld' and list the linker emulations
  1432. supported. Display which input files can and cannot be opened.
  1433. Display the linker script being used by the linker. If the
  1434. optional NUMBER argument > 1, plugin symbol status will also be
  1435. displayed.
  1436. '--version-script=VERSION-SCRIPTFILE'
  1437. Specify the name of a version script to the linker. This is
  1438. typically used when creating shared libraries to specify additional
  1439. information about the version hierarchy for the library being
  1440. created. This option is only fully supported on ELF platforms
  1441. which support shared libraries; see *note VERSION::. It is
  1442. partially supported on PE platforms, which can use version scripts
  1443. to filter symbol visibility in auto-export mode: any symbols marked
  1444. 'local' in the version script will not be exported. *Note WIN32::.
  1445. '--warn-common'
  1446. Warn when a common symbol is combined with another common symbol or
  1447. with a symbol definition. Unix linkers allow this somewhat sloppy
  1448. practice, but linkers on some other operating systems do not. This
  1449. option allows you to find potential problems from combining global
  1450. symbols. Unfortunately, some C libraries use this practice, so you
  1451. may get some warnings about symbols in the libraries as well as in
  1452. your programs.
  1453. There are three kinds of global symbols, illustrated here by C
  1454. examples:
  1455. 'int i = 1;'
  1456. A definition, which goes in the initialized data section of
  1457. the output file.
  1458. 'extern int i;'
  1459. An undefined reference, which does not allocate space. There
  1460. must be either a definition or a common symbol for the
  1461. variable somewhere.
  1462. 'int i;'
  1463. A common symbol. If there are only (one or more) common
  1464. symbols for a variable, it goes in the uninitialized data area
  1465. of the output file. The linker merges multiple common symbols
  1466. for the same variable into a single symbol. If they are of
  1467. different sizes, it picks the largest size. The linker turns
  1468. a common symbol into a declaration, if there is a definition
  1469. of the same variable.
  1470. The '--warn-common' option can produce five kinds of warnings.
  1471. Each warning consists of a pair of lines: the first describes the
  1472. symbol just encountered, and the second describes the previous
  1473. symbol encountered with the same name. One or both of the two
  1474. symbols will be a common symbol.
  1475. 1. Turning a common symbol into a reference, because there is
  1476. already a definition for the symbol.
  1477. FILE(SECTION): warning: common of `SYMBOL'
  1478. overridden by definition
  1479. FILE(SECTION): warning: defined here
  1480. 2. Turning a common symbol into a reference, because a later
  1481. definition for the symbol is encountered. This is the same as
  1482. the previous case, except that the symbols are encountered in
  1483. a different order.
  1484. FILE(SECTION): warning: definition of `SYMBOL'
  1485. overriding common
  1486. FILE(SECTION): warning: common is here
  1487. 3. Merging a common symbol with a previous same-sized common
  1488. symbol.
  1489. FILE(SECTION): warning: multiple common
  1490. of `SYMBOL'
  1491. FILE(SECTION): warning: previous common is here
  1492. 4. Merging a common symbol with a previous larger common symbol.
  1493. FILE(SECTION): warning: common of `SYMBOL'
  1494. overridden by larger common
  1495. FILE(SECTION): warning: larger common is here
  1496. 5. Merging a common symbol with a previous smaller common symbol.
  1497. This is the same as the previous case, except that the symbols
  1498. are encountered in a different order.
  1499. FILE(SECTION): warning: common of `SYMBOL'
  1500. overriding smaller common
  1501. FILE(SECTION): warning: smaller common is here
  1502. '--warn-constructors'
  1503. Warn if any global constructors are used. This is only useful for
  1504. a few object file formats. For formats like COFF or ELF, the
  1505. linker can not detect the use of global constructors.
  1506. '--warn-multiple-gp'
  1507. Warn if multiple global pointer values are required in the output
  1508. file. This is only meaningful for certain processors, such as the
  1509. Alpha. Specifically, some processors put large-valued constants in
  1510. a special section. A special register (the global pointer) points
  1511. into the middle of this section, so that constants can be loaded
  1512. efficiently via a base-register relative addressing mode. Since
  1513. the offset in base-register relative mode is fixed and relatively
  1514. small (e.g., 16 bits), this limits the maximum size of the constant
  1515. pool. Thus, in large programs, it is often necessary to use
  1516. multiple global pointer values in order to be able to address all
  1517. possible constants. This option causes a warning to be issued
  1518. whenever this case occurs.
  1519. '--warn-once'
  1520. Only warn once for each undefined symbol, rather than once per
  1521. module which refers to it.
  1522. '--warn-section-align'
  1523. Warn if the address of an output section is changed because of
  1524. alignment. Typically, the alignment will be set by an input
  1525. section. The address will only be changed if it not explicitly
  1526. specified; that is, if the 'SECTIONS' command does not specify a
  1527. start address for the section (*note SECTIONS::).
  1528. '--warn-shared-textrel'
  1529. Warn if the linker adds a DT_TEXTREL to a shared object.
  1530. '--warn-alternate-em'
  1531. Warn if an object has alternate ELF machine code.
  1532. '--warn-unresolved-symbols'
  1533. If the linker is going to report an unresolved symbol (see the
  1534. option '--unresolved-symbols') it will normally generate an error.
  1535. This option makes it generate a warning instead.
  1536. '--error-unresolved-symbols'
  1537. This restores the linker's default behaviour of generating errors
  1538. when it is reporting unresolved symbols.
  1539. '--whole-archive'
  1540. For each archive mentioned on the command line after the
  1541. '--whole-archive' option, include every object file in the archive
  1542. in the link, rather than searching the archive for the required
  1543. object files. This is normally used to turn an archive file into a
  1544. shared library, forcing every object to be included in the
  1545. resulting shared library. This option may be used more than once.
  1546. Two notes when using this option from gcc: First, gcc doesn't know
  1547. about this option, so you have to use '-Wl,-whole-archive'.
  1548. Second, don't forget to use '-Wl,-no-whole-archive' after your list
  1549. of archives, because gcc will add its own list of archives to your
  1550. link and you may not want this flag to affect those as well.
  1551. '--wrap=SYMBOL'
  1552. Use a wrapper function for SYMBOL. Any undefined reference to
  1553. SYMBOL will be resolved to '__wrap_SYMBOL'. Any undefined
  1554. reference to '__real_SYMBOL' will be resolved to SYMBOL.
  1555. This can be used to provide a wrapper for a system function. The
  1556. wrapper function should be called '__wrap_SYMBOL'. If it wishes to
  1557. call the system function, it should call '__real_SYMBOL'.
  1558. Here is a trivial example:
  1559. void *
  1560. __wrap_malloc (size_t c)
  1561. {
  1562. printf ("malloc called with %zu\n", c);
  1563. return __real_malloc (c);
  1564. }
  1565. If you link other code with this file using '--wrap malloc', then
  1566. all calls to 'malloc' will call the function '__wrap_malloc'
  1567. instead. The call to '__real_malloc' in '__wrap_malloc' will call
  1568. the real 'malloc' function.
  1569. You may wish to provide a '__real_malloc' function as well, so that
  1570. links without the '--wrap' option will succeed. If you do this,
  1571. you should not put the definition of '__real_malloc' in the same
  1572. file as '__wrap_malloc'; if you do, the assembler may resolve the
  1573. call before the linker has a chance to wrap it to 'malloc'.
  1574. Only undefined references are replaced by the linker. So,
  1575. translation unit internal references to SYMBOL are not resolved to
  1576. '__wrap_SYMBOL'. In the next example, the call to 'f' in 'g' is
  1577. not resolved to '__wrap_f'.
  1578. int
  1579. f (void)
  1580. {
  1581. return 123;
  1582. }
  1583. int
  1584. g (void)
  1585. {
  1586. return f();
  1587. }
  1588. '--eh-frame-hdr'
  1589. '--no-eh-frame-hdr'
  1590. Request ('--eh-frame-hdr') or suppress ('--no-eh-frame-hdr') the
  1591. creation of '.eh_frame_hdr' section and ELF 'PT_GNU_EH_FRAME'
  1592. segment header.
  1593. '--no-ld-generated-unwind-info'
  1594. Request creation of '.eh_frame' unwind info for linker generated
  1595. code sections like PLT. This option is on by default if linker
  1596. generated unwind info is supported.
  1597. '--enable-new-dtags'
  1598. '--disable-new-dtags'
  1599. This linker can create the new dynamic tags in ELF. But the older
  1600. ELF systems may not understand them. If you specify
  1601. '--enable-new-dtags', the new dynamic tags will be created as
  1602. needed and older dynamic tags will be omitted. If you specify
  1603. '--disable-new-dtags', no new dynamic tags will be created. By
  1604. default, the new dynamic tags are not created. Note that those
  1605. options are only available for ELF systems.
  1606. '--hash-size=NUMBER'
  1607. Set the default size of the linker's hash tables to a prime number
  1608. close to NUMBER. Increasing this value can reduce the length of
  1609. time it takes the linker to perform its tasks, at the expense of
  1610. increasing the linker's memory requirements. Similarly reducing
  1611. this value can reduce the memory requirements at the expense of
  1612. speed.
  1613. '--hash-style=STYLE'
  1614. Set the type of linker's hash table(s). STYLE can be either 'sysv'
  1615. for classic ELF '.hash' section, 'gnu' for new style GNU
  1616. '.gnu.hash' section or 'both' for both the classic ELF '.hash' and
  1617. new style GNU '.gnu.hash' hash tables. The default depends upon
  1618. how the linker was configured, but for most Linux based systems it
  1619. will be 'both'.
  1620. '--compress-debug-sections=none'
  1621. '--compress-debug-sections=zlib'
  1622. '--compress-debug-sections=zlib-gnu'
  1623. '--compress-debug-sections=zlib-gabi'
  1624. On ELF platforms, these options control how DWARF debug sections
  1625. are compressed using zlib.
  1626. '--compress-debug-sections=none' doesn't compress DWARF debug
  1627. sections. '--compress-debug-sections=zlib-gnu' compresses DWARF
  1628. debug sections and renames them to begin with '.zdebug' instead of
  1629. '.debug'. '--compress-debug-sections=zlib-gabi' also compresses
  1630. DWARF debug sections, but rather than renaming them it sets the
  1631. SHF_COMPRESSED flag in the sections' headers.
  1632. The '--compress-debug-sections=zlib' option is an alias for
  1633. '--compress-debug-sections=zlib-gabi'.
  1634. Note that this option overrides any compression in input debug
  1635. sections, so if a binary is linked with
  1636. '--compress-debug-sections=none' for example, then any compressed
  1637. debug sections in input files will be uncompressed before they are
  1638. copied into the output binary.
  1639. The default compression behaviour varies depending upon the target
  1640. involved and the configure options used to build the toolchain.
  1641. The default can be determined by examining the output from the
  1642. linker's '--help' option.
  1643. '--reduce-memory-overheads'
  1644. This option reduces memory requirements at ld runtime, at the
  1645. expense of linking speed. This was introduced to select the old
  1646. O(n^2) algorithm for link map file generation, rather than the new
  1647. O(n) algorithm which uses about 40% more memory for symbol storage.
  1648. Another effect of the switch is to set the default hash table size
  1649. to 1021, which again saves memory at the cost of lengthening the
  1650. linker's run time. This is not done however if the '--hash-size'
  1651. switch has been used.
  1652. The '--reduce-memory-overheads' switch may be also be used to
  1653. enable other tradeoffs in future versions of the linker.
  1654. '--build-id'
  1655. '--build-id=STYLE'
  1656. Request the creation of a '.note.gnu.build-id' ELF note section or
  1657. a '.buildid' COFF section. The contents of the note are unique
  1658. bits identifying this linked file. STYLE can be 'uuid' to use 128
  1659. random bits, 'sha1' to use a 160-bit SHA1 hash on the normative
  1660. parts of the output contents, 'md5' to use a 128-bit MD5 hash on
  1661. the normative parts of the output contents, or '0xHEXSTRING' to use
  1662. a chosen bit string specified as an even number of hexadecimal
  1663. digits ('-' and ':' characters between digit pairs are ignored).
  1664. If STYLE is omitted, 'sha1' is used.
  1665. The 'md5' and 'sha1' styles produces an identifier that is always
  1666. the same in an identical output file, but will be unique among all
  1667. nonidentical output files. It is not intended to be compared as a
  1668. checksum for the file's contents. A linked file may be changed
  1669. later by other tools, but the build ID bit string identifying the
  1670. original linked file does not change.
  1671. Passing 'none' for STYLE disables the setting from any '--build-id'
  1672. options earlier on the command line.
  1673. 2.1.1 Options Specific to i386 PE Targets
  1674. -----------------------------------------
  1675. The i386 PE linker supports the '-shared' option, which causes the
  1676. output to be a dynamically linked library (DLL) instead of a normal
  1677. executable. You should name the output '*.dll' when you use this
  1678. option. In addition, the linker fully supports the standard '*.def'
  1679. files, which may be specified on the linker command line like an object
  1680. file (in fact, it should precede archives it exports symbols from, to
  1681. ensure that they get linked in, just like a normal object file).
  1682. In addition to the options common to all targets, the i386 PE linker
  1683. support additional command-line options that are specific to the i386 PE
  1684. target. Options that take values may be separated from their values by
  1685. either a space or an equals sign.
  1686. '--add-stdcall-alias'
  1687. If given, symbols with a stdcall suffix (@NN) will be exported
  1688. as-is and also with the suffix stripped. [This option is specific
  1689. to the i386 PE targeted port of the linker]
  1690. '--base-file FILE'
  1691. Use FILE as the name of a file in which to save the base addresses
  1692. of all the relocations needed for generating DLLs with 'dlltool'.
  1693. [This is an i386 PE specific option]
  1694. '--dll'
  1695. Create a DLL instead of a regular executable. You may also use
  1696. '-shared' or specify a 'LIBRARY' in a given '.def' file. [This
  1697. option is specific to the i386 PE targeted port of the linker]
  1698. '--enable-long-section-names'
  1699. '--disable-long-section-names'
  1700. The PE variants of the COFF object format add an extension that
  1701. permits the use of section names longer than eight characters, the
  1702. normal limit for COFF. By default, these names are only allowed in
  1703. object files, as fully-linked executable images do not carry the
  1704. COFF string table required to support the longer names. As a GNU
  1705. extension, it is possible to allow their use in executable images
  1706. as well, or to (probably pointlessly!) disallow it in object
  1707. files, by using these two options. Executable images generated
  1708. with these long section names are slightly non-standard, carrying
  1709. as they do a string table, and may generate confusing output when
  1710. examined with non-GNU PE-aware tools, such as file viewers and
  1711. dumpers. However, GDB relies on the use of PE long section names
  1712. to find Dwarf-2 debug information sections in an executable image
  1713. at runtime, and so if neither option is specified on the
  1714. command-line, 'ld' will enable long section names, overriding the
  1715. default and technically correct behaviour, when it finds the
  1716. presence of debug information while linking an executable image and
  1717. not stripping symbols. [This option is valid for all PE targeted
  1718. ports of the linker]
  1719. '--enable-stdcall-fixup'
  1720. '--disable-stdcall-fixup'
  1721. If the link finds a symbol that it cannot resolve, it will attempt
  1722. to do "fuzzy linking" by looking for another defined symbol that
  1723. differs only in the format of the symbol name (cdecl vs stdcall)
  1724. and will resolve that symbol by linking to the match. For example,
  1725. the undefined symbol '_foo' might be linked to the function
  1726. '_foo@12', or the undefined symbol '_bar@16' might be linked to the
  1727. function '_bar'. When the linker does this, it prints a warning,
  1728. since it normally should have failed to link, but sometimes import
  1729. libraries generated from third-party dlls may need this feature to
  1730. be usable. If you specify '--enable-stdcall-fixup', this feature
  1731. is fully enabled and warnings are not printed. If you specify
  1732. '--disable-stdcall-fixup', this feature is disabled and such
  1733. mismatches are considered to be errors. [This option is specific
  1734. to the i386 PE targeted port of the linker]
  1735. '--leading-underscore'
  1736. '--no-leading-underscore'
  1737. For most targets default symbol-prefix is an underscore and is
  1738. defined in target's description. By this option it is possible to
  1739. disable/enable the default underscore symbol-prefix.
  1740. '--export-all-symbols'
  1741. If given, all global symbols in the objects used to build a DLL
  1742. will be exported by the DLL. Note that this is the default if there
  1743. otherwise wouldn't be any exported symbols. When symbols are
  1744. explicitly exported via DEF files or implicitly exported via
  1745. function attributes, the default is to not export anything else
  1746. unless this option is given. Note that the symbols 'DllMain@12',
  1747. 'DllEntryPoint@0', 'DllMainCRTStartup@12', and 'impure_ptr' will
  1748. not be automatically exported. Also, symbols imported from other
  1749. DLLs will not be re-exported, nor will symbols specifying the DLL's
  1750. internal layout such as those beginning with '_head_' or ending
  1751. with '_iname'. In addition, no symbols from 'libgcc', 'libstd++',
  1752. 'libmingw32', or 'crtX.o' will be exported. Symbols whose names
  1753. begin with '__rtti_' or '__builtin_' will not be exported, to help
  1754. with C++ DLLs. Finally, there is an extensive list of
  1755. cygwin-private symbols that are not exported (obviously, this
  1756. applies on when building DLLs for cygwin targets). These
  1757. cygwin-excludes are: '_cygwin_dll_entry@12',
  1758. '_cygwin_crt0_common@8', '_cygwin_noncygwin_dll_entry@12',
  1759. '_fmode', '_impure_ptr', 'cygwin_attach_dll', 'cygwin_premain0',
  1760. 'cygwin_premain1', 'cygwin_premain2', 'cygwin_premain3', and
  1761. 'environ'. [This option is specific to the i386 PE targeted port
  1762. of the linker]
  1763. '--exclude-symbols SYMBOL,SYMBOL,...'
  1764. Specifies a list of symbols which should not be automatically
  1765. exported. The symbol names may be delimited by commas or colons.
  1766. [This option is specific to the i386 PE targeted port of the
  1767. linker]
  1768. '--exclude-all-symbols'
  1769. Specifies no symbols should be automatically exported. [This
  1770. option is specific to the i386 PE targeted port of the linker]
  1771. '--file-alignment'
  1772. Specify the file alignment. Sections in the file will always begin
  1773. at file offsets which are multiples of this number. This defaults
  1774. to 512. [This option is specific to the i386 PE targeted port of
  1775. the linker]
  1776. '--heap RESERVE'
  1777. '--heap RESERVE,COMMIT'
  1778. Specify the number of bytes of memory to reserve (and optionally
  1779. commit) to be used as heap for this program. The default is 1MB
  1780. reserved, 4K committed. [This option is specific to the i386 PE
  1781. targeted port of the linker]
  1782. '--image-base VALUE'
  1783. Use VALUE as the base address of your program or dll. This is the
  1784. lowest memory location that will be used when your program or dll
  1785. is loaded. To reduce the need to relocate and improve performance
  1786. of your dlls, each should have a unique base address and not
  1787. overlap any other dlls. The default is 0x400000 for executables,
  1788. and 0x10000000 for dlls. [This option is specific to the i386 PE
  1789. targeted port of the linker]
  1790. '--kill-at'
  1791. If given, the stdcall suffixes (@NN) will be stripped from symbols
  1792. before they are exported. [This option is specific to the i386 PE
  1793. targeted port of the linker]
  1794. '--large-address-aware'
  1795. If given, the appropriate bit in the "Characteristics" field of the
  1796. COFF header is set to indicate that this executable supports
  1797. virtual addresses greater than 2 gigabytes. This should be used in
  1798. conjunction with the /3GB or /USERVA=VALUE megabytes switch in the
  1799. "[operating systems]" section of the BOOT.INI. Otherwise, this bit
  1800. has no effect. [This option is specific to PE targeted ports of
  1801. the linker]
  1802. '--disable-large-address-aware'
  1803. Reverts the effect of a previous '--large-address-aware' option.
  1804. This is useful if '--large-address-aware' is always set by the
  1805. compiler driver (e.g. Cygwin gcc) and the executable does not
  1806. support virtual addresses greater than 2 gigabytes. [This option
  1807. is specific to PE targeted ports of the linker]
  1808. '--major-image-version VALUE'
  1809. Sets the major number of the "image version". Defaults to 1.
  1810. [This option is specific to the i386 PE targeted port of the
  1811. linker]
  1812. '--major-os-version VALUE'
  1813. Sets the major number of the "os version". Defaults to 4. [This
  1814. option is specific to the i386 PE targeted port of the linker]
  1815. '--major-subsystem-version VALUE'
  1816. Sets the major number of the "subsystem version". Defaults to 4.
  1817. [This option is specific to the i386 PE targeted port of the
  1818. linker]
  1819. '--minor-image-version VALUE'
  1820. Sets the minor number of the "image version". Defaults to 0.
  1821. [This option is specific to the i386 PE targeted port of the
  1822. linker]
  1823. '--minor-os-version VALUE'
  1824. Sets the minor number of the "os version". Defaults to 0. [This
  1825. option is specific to the i386 PE targeted port of the linker]
  1826. '--minor-subsystem-version VALUE'
  1827. Sets the minor number of the "subsystem version". Defaults to 0.
  1828. [This option is specific to the i386 PE targeted port of the
  1829. linker]
  1830. '--output-def FILE'
  1831. The linker will create the file FILE which will contain a DEF file
  1832. corresponding to the DLL the linker is generating. This DEF file
  1833. (which should be called '*.def') may be used to create an import
  1834. library with 'dlltool' or may be used as a reference to
  1835. automatically or implicitly exported symbols. [This option is
  1836. specific to the i386 PE targeted port of the linker]
  1837. '--enable-auto-image-base'
  1838. '--enable-auto-image-base=VALUE'
  1839. Automatically choose the image base for DLLs, optionally starting
  1840. with base VALUE, unless one is specified using the '--image-base'
  1841. argument. By using a hash generated from the dllname to create
  1842. unique image bases for each DLL, in-memory collisions and
  1843. relocations which can delay program execution are avoided. [This
  1844. option is specific to the i386 PE targeted port of the linker]
  1845. '--disable-auto-image-base'
  1846. Do not automatically generate a unique image base. If there is no
  1847. user-specified image base ('--image-base') then use the platform
  1848. default. [This option is specific to the i386 PE targeted port of
  1849. the linker]
  1850. '--dll-search-prefix STRING'
  1851. When linking dynamically to a dll without an import library, search
  1852. for '<string><basename>.dll' in preference to 'lib<basename>.dll'.
  1853. This behaviour allows easy distinction between DLLs built for the
  1854. various "subplatforms": native, cygwin, uwin, pw, etc. For
  1855. instance, cygwin DLLs typically use '--dll-search-prefix=cyg'.
  1856. [This option is specific to the i386 PE targeted port of the
  1857. linker]
  1858. '--enable-auto-import'
  1859. Do sophisticated linking of '_symbol' to '__imp__symbol' for DATA
  1860. imports from DLLs, thus making it possible to bypass the dllimport
  1861. mechanism on the user side and to reference unmangled symbol names.
  1862. [This option is specific to the i386 PE targeted port of the
  1863. linker]
  1864. The following remarks pertain to the original implementation of the
  1865. feature and are obsolete nowadays for Cygwin and MinGW targets.
  1866. Note: Use of the 'auto-import' extension will cause the text
  1867. section of the image file to be made writable. This does not
  1868. conform to the PE-COFF format specification published by Microsoft.
  1869. Note - use of the 'auto-import' extension will also cause read only
  1870. data which would normally be placed into the .rdata section to be
  1871. placed into the .data section instead. This is in order to work
  1872. around a problem with consts that is described here:
  1873. http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
  1874. Using 'auto-import' generally will 'just work' - but sometimes you
  1875. may see this message:
  1876. "variable '<var>' can't be auto-imported. Please read the
  1877. documentation for ld's '--enable-auto-import' for details."
  1878. This message occurs when some (sub)expression accesses an address
  1879. ultimately given by the sum of two constants (Win32 import tables
  1880. only allow one). Instances where this may occur include accesses
  1881. to member fields of struct variables imported from a DLL, as well
  1882. as using a constant index into an array variable imported from a
  1883. DLL. Any multiword variable (arrays, structs, long long, etc) may
  1884. trigger this error condition. However, regardless of the exact
  1885. data type of the offending exported variable, ld will always detect
  1886. it, issue the warning, and exit.
  1887. There are several ways to address this difficulty, regardless of
  1888. the data type of the exported variable:
  1889. One way is to use -enable-runtime-pseudo-reloc switch. This leaves
  1890. the task of adjusting references in your client code for runtime
  1891. environment, so this method works only when runtime environment
  1892. supports this feature.
  1893. A second solution is to force one of the 'constants' to be a
  1894. variable - that is, unknown and un-optimizable at compile time.
  1895. For arrays, there are two possibilities: a) make the indexee (the
  1896. array's address) a variable, or b) make the 'constant' index a
  1897. variable. Thus:
  1898. extern type extern_array[];
  1899. extern_array[1] -->
  1900. { volatile type *t=extern_array; t[1] }
  1901. or
  1902. extern type extern_array[];
  1903. extern_array[1] -->
  1904. { volatile int t=1; extern_array[t] }
  1905. For structs (and most other multiword data types) the only option
  1906. is to make the struct itself (or the long long, or the ...)
  1907. variable:
  1908. extern struct s extern_struct;
  1909. extern_struct.field -->
  1910. { volatile struct s *t=&extern_struct; t->field }
  1911. or
  1912. extern long long extern_ll;
  1913. extern_ll -->
  1914. { volatile long long * local_ll=&extern_ll; *local_ll }
  1915. A third method of dealing with this difficulty is to abandon
  1916. 'auto-import' for the offending symbol and mark it with
  1917. '__declspec(dllimport)'. However, in practice that requires using
  1918. compile-time #defines to indicate whether you are building a DLL,
  1919. building client code that will link to the DLL, or merely
  1920. building/linking to a static library. In making the choice between
  1921. the various methods of resolving the 'direct address with constant
  1922. offset' problem, you should consider typical real-world usage:
  1923. Original:
  1924. --foo.h
  1925. extern int arr[];
  1926. --foo.c
  1927. #include "foo.h"
  1928. void main(int argc, char **argv){
  1929. printf("%d\n",arr[1]);
  1930. }
  1931. Solution 1:
  1932. --foo.h
  1933. extern int arr[];
  1934. --foo.c
  1935. #include "foo.h"
  1936. void main(int argc, char **argv){
  1937. /* This workaround is for win32 and cygwin; do not "optimize" */
  1938. volatile int *parr = arr;
  1939. printf("%d\n",parr[1]);
  1940. }
  1941. Solution 2:
  1942. --foo.h
  1943. /* Note: auto-export is assumed (no __declspec(dllexport)) */
  1944. #if (defined(_WIN32) || defined(__CYGWIN__)) && \
  1945. !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
  1946. #define FOO_IMPORT __declspec(dllimport)
  1947. #else
  1948. #define FOO_IMPORT
  1949. #endif
  1950. extern FOO_IMPORT int arr[];
  1951. --foo.c
  1952. #include "foo.h"
  1953. void main(int argc, char **argv){
  1954. printf("%d\n",arr[1]);
  1955. }
  1956. A fourth way to avoid this problem is to re-code your library to
  1957. use a functional interface rather than a data interface for the
  1958. offending variables (e.g. set_foo() and get_foo() accessor
  1959. functions).
  1960. '--disable-auto-import'
  1961. Do not attempt to do sophisticated linking of '_symbol' to
  1962. '__imp__symbol' for DATA imports from DLLs. [This option is
  1963. specific to the i386 PE targeted port of the linker]
  1964. '--enable-runtime-pseudo-reloc'
  1965. If your code contains expressions described in -enable-auto-import
  1966. section, that is, DATA imports from DLL with non-zero offset, this
  1967. switch will create a vector of 'runtime pseudo relocations' which
  1968. can be used by runtime environment to adjust references to such
  1969. data in your client code. [This option is specific to the i386 PE
  1970. targeted port of the linker]
  1971. '--disable-runtime-pseudo-reloc'
  1972. Do not create pseudo relocations for non-zero offset DATA imports
  1973. from DLLs. [This option is specific to the i386 PE targeted port
  1974. of the linker]
  1975. '--enable-extra-pe-debug'
  1976. Show additional debug info related to auto-import symbol thunking.
  1977. [This option is specific to the i386 PE targeted port of the
  1978. linker]
  1979. '--section-alignment'
  1980. Sets the section alignment. Sections in memory will always begin
  1981. at addresses which are a multiple of this number. Defaults to
  1982. 0x1000. [This option is specific to the i386 PE targeted port of
  1983. the linker]
  1984. '--stack RESERVE'
  1985. '--stack RESERVE,COMMIT'
  1986. Specify the number of bytes of memory to reserve (and optionally
  1987. commit) to be used as stack for this program. The default is 2MB
  1988. reserved, 4K committed. [This option is specific to the i386 PE
  1989. targeted port of the linker]
  1990. '--subsystem WHICH'
  1991. '--subsystem WHICH:MAJOR'
  1992. '--subsystem WHICH:MAJOR.MINOR'
  1993. Specifies the subsystem under which your program will execute. The
  1994. legal values for WHICH are 'native', 'windows', 'console', 'posix',
  1995. and 'xbox'. You may optionally set the subsystem version also.
  1996. Numeric values are also accepted for WHICH. [This option is
  1997. specific to the i386 PE targeted port of the linker]
  1998. The following options set flags in the 'DllCharacteristics' field
  1999. of the PE file header: [These options are specific to PE targeted
  2000. ports of the linker]
  2001. '--high-entropy-va'
  2002. Image is compatible with 64-bit address space layout randomization
  2003. (ASLR).
  2004. '--dynamicbase'
  2005. The image base address may be relocated using address space layout
  2006. randomization (ASLR). This feature was introduced with MS Windows
  2007. Vista for i386 PE targets.
  2008. '--forceinteg'
  2009. Code integrity checks are enforced.
  2010. '--nxcompat'
  2011. The image is compatible with the Data Execution Prevention. This
  2012. feature was introduced with MS Windows XP SP2 for i386 PE targets.
  2013. '--no-isolation'
  2014. Although the image understands isolation, do not isolate the image.
  2015. '--no-seh'
  2016. The image does not use SEH. No SE handler may be called from this
  2017. image.
  2018. '--no-bind'
  2019. Do not bind this image.
  2020. '--wdmdriver'
  2021. The driver uses the MS Windows Driver Model.
  2022. '--tsaware'
  2023. The image is Terminal Server aware.
  2024. '--insert-timestamp'
  2025. '--no-insert-timestamp'
  2026. Insert a real timestamp into the image. This is the default
  2027. behaviour as it matches legacy code and it means that the image
  2028. will work with other, proprietary tools. The problem with this
  2029. default is that it will result in slightly different images being
  2030. produced each time the same sources are linked. The option
  2031. '--no-insert-timestamp' can be used to insert a zero value for the
  2032. timestamp, this ensuring that binaries produced from identical
  2033. sources will compare identically.
  2034. 2.1.2 Options specific to C6X uClinux targets
  2035. ---------------------------------------------
  2036. The C6X uClinux target uses a binary format called DSBT to support
  2037. shared libraries. Each shared library in the system needs to have a
  2038. unique index; all executables use an index of 0.
  2039. '--dsbt-size SIZE'
  2040. This option sets the number of entries in the DSBT of the current
  2041. executable or shared library to SIZE. The default is to create a
  2042. table with 64 entries.
  2043. '--dsbt-index INDEX'
  2044. This option sets the DSBT index of the current executable or shared
  2045. library to INDEX. The default is 0, which is appropriate for
  2046. generating executables. If a shared library is generated with a
  2047. DSBT index of 0, the 'R_C6000_DSBT_INDEX' relocs are copied into
  2048. the output file.
  2049. The '--no-merge-exidx-entries' switch disables the merging of
  2050. adjacent exidx entries in frame unwind info.
  2051. 2.1.3 Options specific to C-SKY targets
  2052. ---------------------------------------
  2053. '--branch-stub'
  2054. This option enables linker branch relaxation by inserting branch
  2055. stub sections when needed to extend the range of branches. This
  2056. option is usually not required since C-SKY supports branch and call
  2057. instructions that can access the full memory range and branch
  2058. relaxation is normally handled by the compiler or assembler.
  2059. '--stub-group-size=N'
  2060. This option allows finer control of linker branch stub creation.
  2061. It sets the maximum size of a group of input sections that can be
  2062. handled by one stub section. A negative value of N locates stub
  2063. sections after their branches, while a positive value allows stub
  2064. sections to appear either before or after the branches. Values of
  2065. '1' or '-1' indicate that the linker should choose suitable
  2066. defaults.
  2067. 2.1.4 Options specific to Motorola 68HC11 and 68HC12 targets
  2068. ------------------------------------------------------------
  2069. The 68HC11 and 68HC12 linkers support specific options to control the
  2070. memory bank switching mapping and trampoline code generation.
  2071. '--no-trampoline'
  2072. This option disables the generation of trampoline. By default a
  2073. trampoline is generated for each far function which is called using
  2074. a 'jsr' instruction (this happens when a pointer to a far function
  2075. is taken).
  2076. '--bank-window NAME'
  2077. This option indicates to the linker the name of the memory region
  2078. in the 'MEMORY' specification that describes the memory bank
  2079. window. The definition of such region is then used by the linker
  2080. to compute paging and addresses within the memory window.
  2081. 2.1.5 Options specific to Motorola 68K target
  2082. ---------------------------------------------
  2083. The following options are supported to control handling of GOT
  2084. generation when linking for 68K targets.
  2085. '--got=TYPE'
  2086. This option tells the linker which GOT generation scheme to use.
  2087. TYPE should be one of 'single', 'negative', 'multigot' or 'target'.
  2088. For more information refer to the Info entry for 'ld'.
  2089. 2.1.6 Options specific to MIPS targets
  2090. --------------------------------------
  2091. The following options are supported to control microMIPS instruction
  2092. generation and branch relocation checks for ISA mode transitions when
  2093. linking for MIPS targets.
  2094. '--insn32'
  2095. '--no-insn32'
  2096. These options control the choice of microMIPS instructions used in
  2097. code generated by the linker, such as that in the PLT or lazy
  2098. binding stubs, or in relaxation. If '--insn32' is used, then the
  2099. linker only uses 32-bit instruction encodings. By default or if
  2100. '--no-insn32' is used, all instruction encodings are used,
  2101. including 16-bit ones where possible.
  2102. '--ignore-branch-isa'
  2103. '--no-ignore-branch-isa'
  2104. These options control branch relocation checks for invalid ISA mode
  2105. transitions. If '--ignore-branch-isa' is used, then the linker
  2106. accepts any branch relocations and any ISA mode transition required
  2107. is lost in relocation calculation, except for some cases of 'BAL'
  2108. instructions which meet relaxation conditions and are converted to
  2109. equivalent 'JALX' instructions as the associated relocation is
  2110. calculated. By default or if '--no-ignore-branch-isa' is used a
  2111. check is made causing the loss of an ISA mode transition to produce
  2112. an error.
  2113. '--compact-branches'
  2114. '--compact-branches'
  2115. These options control the generation of compact instructions by the
  2116. linker in the PLT entries for MIPS R6.
  2117. 
  2118. File: ld.info, Node: Environment, Prev: Options, Up: Invocation
  2119. 2.2 Environment Variables
  2120. =========================
  2121. You can change the behaviour of 'ld' with the environment variables
  2122. 'GNUTARGET', 'LDEMULATION' and 'COLLECT_NO_DEMANGLE'.
  2123. 'GNUTARGET' determines the input-file object format if you don't use
  2124. '-b' (or its synonym '--format'). Its value should be one of the BFD
  2125. names for an input format (*note BFD::). If there is no 'GNUTARGET' in
  2126. the environment, 'ld' uses the natural format of the target. If
  2127. 'GNUTARGET' is set to 'default' then BFD attempts to discover the input
  2128. format by examining binary input files; this method often succeeds, but
  2129. there are potential ambiguities, since there is no method of ensuring
  2130. that the magic number used to specify object-file formats is unique.
  2131. However, the configuration procedure for BFD on each system places the
  2132. conventional format for that system first in the search-list, so
  2133. ambiguities are resolved in favor of convention.
  2134. 'LDEMULATION' determines the default emulation if you don't use the
  2135. '-m' option. The emulation can affect various aspects of linker
  2136. behaviour, particularly the default linker script. You can list the
  2137. available emulations with the '--verbose' or '-V' options. If the '-m'
  2138. option is not used, and the 'LDEMULATION' environment variable is not
  2139. defined, the default emulation depends upon how the linker was
  2140. configured.
  2141. Normally, the linker will default to demangling symbols. However, if
  2142. 'COLLECT_NO_DEMANGLE' is set in the environment, then it will default to
  2143. not demangling symbols. This environment variable is used in a similar
  2144. fashion by the 'gcc' linker wrapper program. The default may be
  2145. overridden by the '--demangle' and '--no-demangle' options.
  2146. 
  2147. File: ld.info, Node: Scripts, Next: Machine Dependent, Prev: Invocation, Up: Top
  2148. 3 Linker Scripts
  2149. ****************
  2150. Every link is controlled by a "linker script". This script is written
  2151. in the linker command language.
  2152. The main purpose of the linker script is to describe how the sections
  2153. in the input files should be mapped into the output file, and to control
  2154. the memory layout of the output file. Most linker scripts do nothing
  2155. more than this. However, when necessary, the linker script can also
  2156. direct the linker to perform many other operations, using the commands
  2157. described below.
  2158. The linker always uses a linker script. If you do not supply one
  2159. yourself, the linker will use a default script that is compiled into the
  2160. linker executable. You can use the '--verbose' command-line option to
  2161. display the default linker script. Certain command-line options, such
  2162. as '-r' or '-N', will affect the default linker script.
  2163. You may supply your own linker script by using the '-T' command line
  2164. option. When you do this, your linker script will replace the default
  2165. linker script.
  2166. You may also use linker scripts implicitly by naming them as input
  2167. files to the linker, as though they were files to be linked. *Note
  2168. Implicit Linker Scripts::.
  2169. * Menu:
  2170. * Basic Script Concepts:: Basic Linker Script Concepts
  2171. * Script Format:: Linker Script Format
  2172. * Simple Example:: Simple Linker Script Example
  2173. * Simple Commands:: Simple Linker Script Commands
  2174. * Assignments:: Assigning Values to Symbols
  2175. * SECTIONS:: SECTIONS Command
  2176. * MEMORY:: MEMORY Command
  2177. * PHDRS:: PHDRS Command
  2178. * VERSION:: VERSION Command
  2179. * Expressions:: Expressions in Linker Scripts
  2180. * Implicit Linker Scripts:: Implicit Linker Scripts
  2181. 
  2182. File: ld.info, Node: Basic Script Concepts, Next: Script Format, Up: Scripts
  2183. 3.1 Basic Linker Script Concepts
  2184. ================================
  2185. We need to define some basic concepts and vocabulary in order to
  2186. describe the linker script language.
  2187. The linker combines input files into a single output file. The
  2188. output file and each input file are in a special data format known as an
  2189. "object file format". Each file is called an "object file". The output
  2190. file is often called an "executable", but for our purposes we will also
  2191. call it an object file. Each object file has, among other things, a
  2192. list of "sections". We sometimes refer to a section in an input file as
  2193. an "input section"; similarly, a section in the output file is an
  2194. "output section".
  2195. Each section in an object file has a name and a size. Most sections
  2196. also have an associated block of data, known as the "section contents".
  2197. A section may be marked as "loadable", which means that the contents
  2198. should be loaded into memory when the output file is run. A section
  2199. with no contents may be "allocatable", which means that an area in
  2200. memory should be set aside, but nothing in particular should be loaded
  2201. there (in some cases this memory must be zeroed out). A section which
  2202. is neither loadable nor allocatable typically contains some sort of
  2203. debugging information.
  2204. Every loadable or allocatable output section has two addresses. The
  2205. first is the "VMA", or virtual memory address. This is the address the
  2206. section will have when the output file is run. The second is the "LMA",
  2207. or load memory address. This is the address at which the section will
  2208. be loaded. In most cases the two addresses will be the same. An
  2209. example of when they might be different is when a data section is loaded
  2210. into ROM, and then copied into RAM when the program starts up (this
  2211. technique is often used to initialize global variables in a ROM based
  2212. system). In this case the ROM address would be the LMA, and the RAM
  2213. address would be the VMA.
  2214. You can see the sections in an object file by using the 'objdump'
  2215. program with the '-h' option.
  2216. Every object file also has a list of "symbols", known as the "symbol
  2217. table". A symbol may be defined or undefined. Each symbol has a name,
  2218. and each defined symbol has an address, among other information. If you
  2219. compile a C or C++ program into an object file, you will get a defined
  2220. symbol for every defined function and global or static variable. Every
  2221. undefined function or global variable which is referenced in the input
  2222. file will become an undefined symbol.
  2223. You can see the symbols in an object file by using the 'nm' program,
  2224. or by using the 'objdump' program with the '-t' option.
  2225. 
  2226. File: ld.info, Node: Script Format, Next: Simple Example, Prev: Basic Script Concepts, Up: Scripts
  2227. 3.2 Linker Script Format
  2228. ========================
  2229. Linker scripts are text files.
  2230. You write a linker script as a series of commands. Each command is
  2231. either a keyword, possibly followed by arguments, or an assignment to a
  2232. symbol. You may separate commands using semicolons. Whitespace is
  2233. generally ignored.
  2234. Strings such as file or format names can normally be entered
  2235. directly. If the file name contains a character such as a comma which
  2236. would otherwise serve to separate file names, you may put the file name
  2237. in double quotes. There is no way to use a double quote character in a
  2238. file name.
  2239. You may include comments in linker scripts just as in C, delimited by
  2240. '/*' and '*/'. As in C, comments are syntactically equivalent to
  2241. whitespace.
  2242. 
  2243. File: ld.info, Node: Simple Example, Next: Simple Commands, Prev: Script Format, Up: Scripts
  2244. 3.3 Simple Linker Script Example
  2245. ================================
  2246. Many linker scripts are fairly simple.
  2247. The simplest possible linker script has just one command: 'SECTIONS'.
  2248. You use the 'SECTIONS' command to describe the memory layout of the
  2249. output file.
  2250. The 'SECTIONS' command is a powerful command. Here we will describe
  2251. a simple use of it. Let's assume your program consists only of code,
  2252. initialized data, and uninitialized data. These will be in the '.text',
  2253. '.data', and '.bss' sections, respectively. Let's assume further that
  2254. these are the only sections which appear in your input files.
  2255. For this example, let's say that the code should be loaded at address
  2256. 0x10000, and that the data should start at address 0x8000000. Here is a
  2257. linker script which will do that:
  2258. SECTIONS
  2259. {
  2260. . = 0x10000;
  2261. .text : { *(.text) }
  2262. . = 0x8000000;
  2263. .data : { *(.data) }
  2264. .bss : { *(.bss) }
  2265. }
  2266. You write the 'SECTIONS' command as the keyword 'SECTIONS', followed
  2267. by a series of symbol assignments and output section descriptions
  2268. enclosed in curly braces.
  2269. The first line inside the 'SECTIONS' command of the above example
  2270. sets the value of the special symbol '.', which is the location counter.
  2271. If you do not specify the address of an output section in some other way
  2272. (other ways are described later), the address is set from the current
  2273. value of the location counter. The location counter is then incremented
  2274. by the size of the output section. At the start of the 'SECTIONS'
  2275. command, the location counter has the value '0'.
  2276. The second line defines an output section, '.text'. The colon is
  2277. required syntax which may be ignored for now. Within the curly braces
  2278. after the output section name, you list the names of the input sections
  2279. which should be placed into this output section. The '*' is a wildcard
  2280. which matches any file name. The expression '*(.text)' means all
  2281. '.text' input sections in all input files.
  2282. Since the location counter is '0x10000' when the output section
  2283. '.text' is defined, the linker will set the address of the '.text'
  2284. section in the output file to be '0x10000'.
  2285. The remaining lines define the '.data' and '.bss' sections in the
  2286. output file. The linker will place the '.data' output section at
  2287. address '0x8000000'. After the linker places the '.data' output
  2288. section, the value of the location counter will be '0x8000000' plus the
  2289. size of the '.data' output section. The effect is that the linker will
  2290. place the '.bss' output section immediately after the '.data' output
  2291. section in memory.
  2292. The linker will ensure that each output section has the required
  2293. alignment, by increasing the location counter if necessary. In this
  2294. example, the specified addresses for the '.text' and '.data' sections
  2295. will probably satisfy any alignment constraints, but the linker may have
  2296. to create a small gap between the '.data' and '.bss' sections.
  2297. That's it! That's a simple and complete linker script.
  2298. 
  2299. File: ld.info, Node: Simple Commands, Next: Assignments, Prev: Simple Example, Up: Scripts
  2300. 3.4 Simple Linker Script Commands
  2301. =================================
  2302. In this section we describe the simple linker script commands.
  2303. * Menu:
  2304. * Entry Point:: Setting the entry point
  2305. * File Commands:: Commands dealing with files
  2306. * Format Commands:: Commands dealing with object file formats
  2307. * REGION_ALIAS:: Assign alias names to memory regions
  2308. * Miscellaneous Commands:: Other linker script commands
  2309. 
  2310. File: ld.info, Node: Entry Point, Next: File Commands, Up: Simple Commands
  2311. 3.4.1 Setting the Entry Point
  2312. -----------------------------
  2313. The first instruction to execute in a program is called the "entry
  2314. point". You can use the 'ENTRY' linker script command to set the entry
  2315. point. The argument is a symbol name:
  2316. ENTRY(SYMBOL)
  2317. There are several ways to set the entry point. The linker will set
  2318. the entry point by trying each of the following methods in order, and
  2319. stopping when one of them succeeds:
  2320. * the '-e' ENTRY command-line option;
  2321. * the 'ENTRY(SYMBOL)' command in a linker script;
  2322. * the value of a target-specific symbol, if it is defined; For many
  2323. targets this is 'start', but PE- and BeOS-based systems for example
  2324. check a list of possible entry symbols, matching the first one
  2325. found.
  2326. * the address of the first byte of the '.text' section, if present;
  2327. * The address '0'.
  2328. 
  2329. File: ld.info, Node: File Commands, Next: Format Commands, Prev: Entry Point, Up: Simple Commands
  2330. 3.4.2 Commands Dealing with Files
  2331. ---------------------------------
  2332. Several linker script commands deal with files.
  2333. 'INCLUDE FILENAME'
  2334. Include the linker script FILENAME at this point. The file will be
  2335. searched for in the current directory, and in any directory
  2336. specified with the '-L' option. You can nest calls to 'INCLUDE' up
  2337. to 10 levels deep.
  2338. You can place 'INCLUDE' directives at the top level, in 'MEMORY' or
  2339. 'SECTIONS' commands, or in output section descriptions.
  2340. 'INPUT(FILE, FILE, ...)'
  2341. 'INPUT(FILE FILE ...)'
  2342. The 'INPUT' command directs the linker to include the named files
  2343. in the link, as though they were named on the command line.
  2344. For example, if you always want to include 'subr.o' any time you do
  2345. a link, but you can't be bothered to put it on every link command
  2346. line, then you can put 'INPUT (subr.o)' in your linker script.
  2347. In fact, if you like, you can list all of your input files in the
  2348. linker script, and then invoke the linker with nothing but a '-T'
  2349. option.
  2350. In case a "sysroot prefix" is configured, and the filename starts
  2351. with the '/' character, and the script being processed was located
  2352. inside the "sysroot prefix", the filename will be looked for in the
  2353. "sysroot prefix". Otherwise, the linker will try to open the file
  2354. in the current directory. If it is not found, the linker will
  2355. search through the archive library search path. The "sysroot
  2356. prefix" can also be forced by specifying '=' as the first character
  2357. in the filename path, or prefixing the filename path with
  2358. '$SYSROOT'. See also the description of '-L' in *note Command-line
  2359. Options: Options.
  2360. If you use 'INPUT (-lFILE)', 'ld' will transform the name to
  2361. 'libFILE.a', as with the command-line argument '-l'.
  2362. When you use the 'INPUT' command in an implicit linker script, the
  2363. files will be included in the link at the point at which the linker
  2364. script file is included. This can affect archive searching.
  2365. 'GROUP(FILE, FILE, ...)'
  2366. 'GROUP(FILE FILE ...)'
  2367. The 'GROUP' command is like 'INPUT', except that the named files
  2368. should all be archives, and they are searched repeatedly until no
  2369. new undefined references are created. See the description of '-('
  2370. in *note Command-line Options: Options.
  2371. 'AS_NEEDED(FILE, FILE, ...)'
  2372. 'AS_NEEDED(FILE FILE ...)'
  2373. This construct can appear only inside of the 'INPUT' or 'GROUP'
  2374. commands, among other filenames. The files listed will be handled
  2375. as if they appear directly in the 'INPUT' or 'GROUP' commands, with
  2376. the exception of ELF shared libraries, that will be added only when
  2377. they are actually needed. This construct essentially enables
  2378. '--as-needed' option for all the files listed inside of it and
  2379. restores previous '--as-needed' resp. '--no-as-needed' setting
  2380. afterwards.
  2381. 'OUTPUT(FILENAME)'
  2382. The 'OUTPUT' command names the output file. Using
  2383. 'OUTPUT(FILENAME)' in the linker script is exactly like using '-o
  2384. FILENAME' on the command line (*note Command Line Options:
  2385. Options.). If both are used, the command-line option takes
  2386. precedence.
  2387. You can use the 'OUTPUT' command to define a default name for the
  2388. output file other than the usual default of 'a.out'.
  2389. 'SEARCH_DIR(PATH)'
  2390. The 'SEARCH_DIR' command adds PATH to the list of paths where 'ld'
  2391. looks for archive libraries. Using 'SEARCH_DIR(PATH)' is exactly
  2392. like using '-L PATH' on the command line (*note Command-line
  2393. Options: Options.). If both are used, then the linker will search
  2394. both paths. Paths specified using the command-line option are
  2395. searched first.
  2396. 'STARTUP(FILENAME)'
  2397. The 'STARTUP' command is just like the 'INPUT' command, except that
  2398. FILENAME will become the first input file to be linked, as though
  2399. it were specified first on the command line. This may be useful
  2400. when using a system in which the entry point is always the start of
  2401. the first file.
  2402. 
  2403. File: ld.info, Node: Format Commands, Next: REGION_ALIAS, Prev: File Commands, Up: Simple Commands
  2404. 3.4.3 Commands Dealing with Object File Formats
  2405. -----------------------------------------------
  2406. A couple of linker script commands deal with object file formats.
  2407. 'OUTPUT_FORMAT(BFDNAME)'
  2408. 'OUTPUT_FORMAT(DEFAULT, BIG, LITTLE)'
  2409. The 'OUTPUT_FORMAT' command names the BFD format to use for the
  2410. output file (*note BFD::). Using 'OUTPUT_FORMAT(BFDNAME)' is
  2411. exactly like using '--oformat BFDNAME' on the command line (*note
  2412. Command-line Options: Options.). If both are used, the command
  2413. line option takes precedence.
  2414. You can use 'OUTPUT_FORMAT' with three arguments to use different
  2415. formats based on the '-EB' and '-EL' command-line options. This
  2416. permits the linker script to set the output format based on the
  2417. desired endianness.
  2418. If neither '-EB' nor '-EL' are used, then the output format will be
  2419. the first argument, DEFAULT. If '-EB' is used, the output format
  2420. will be the second argument, BIG. If '-EL' is used, the output
  2421. format will be the third argument, LITTLE.
  2422. For example, the default linker script for the MIPS ELF target uses
  2423. this command:
  2424. OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
  2425. This says that the default format for the output file is
  2426. 'elf32-bigmips', but if the user uses the '-EL' command-line
  2427. option, the output file will be created in the 'elf32-littlemips'
  2428. format.
  2429. 'TARGET(BFDNAME)'
  2430. The 'TARGET' command names the BFD format to use when reading input
  2431. files. It affects subsequent 'INPUT' and 'GROUP' commands. This
  2432. command is like using '-b BFDNAME' on the command line (*note
  2433. Command-line Options: Options.). If the 'TARGET' command is used
  2434. but 'OUTPUT_FORMAT' is not, then the last 'TARGET' command is also
  2435. used to set the format for the output file. *Note BFD::.
  2436. 
  2437. File: ld.info, Node: REGION_ALIAS, Next: Miscellaneous Commands, Prev: Format Commands, Up: Simple Commands
  2438. 3.4.4 Assign alias names to memory regions
  2439. ------------------------------------------
  2440. Alias names can be added to existing memory regions created with the
  2441. *note MEMORY:: command. Each name corresponds to at most one memory
  2442. region.
  2443. REGION_ALIAS(ALIAS, REGION)
  2444. The 'REGION_ALIAS' function creates an alias name ALIAS for the
  2445. memory region REGION. This allows a flexible mapping of output sections
  2446. to memory regions. An example follows.
  2447. Suppose we have an application for embedded systems which come with
  2448. various memory storage devices. All have a general purpose, volatile
  2449. memory 'RAM' that allows code execution or data storage. Some may have
  2450. a read-only, non-volatile memory 'ROM' that allows code execution and
  2451. read-only data access. The last variant is a read-only, non-volatile
  2452. memory 'ROM2' with read-only data access and no code execution
  2453. capability. We have four output sections:
  2454. * '.text' program code;
  2455. * '.rodata' read-only data;
  2456. * '.data' read-write initialized data;
  2457. * '.bss' read-write zero initialized data.
  2458. The goal is to provide a linker command file that contains a system
  2459. independent part defining the output sections and a system dependent
  2460. part mapping the output sections to the memory regions available on the
  2461. system. Our embedded systems come with three different memory setups
  2462. 'A', 'B' and 'C':
  2463. Section Variant A Variant B Variant C
  2464. .text RAM ROM ROM
  2465. .rodata RAM ROM ROM2
  2466. .data RAM RAM/ROM RAM/ROM2
  2467. .bss RAM RAM RAM
  2468. The notation 'RAM/ROM' or 'RAM/ROM2' means that this section is
  2469. loaded into region 'ROM' or 'ROM2' respectively. Please note that the
  2470. load address of the '.data' section starts in all three variants at the
  2471. end of the '.rodata' section.
  2472. The base linker script that deals with the output sections follows.
  2473. It includes the system dependent 'linkcmds.memory' file that describes
  2474. the memory layout:
  2475. INCLUDE linkcmds.memory
  2476. SECTIONS
  2477. {
  2478. .text :
  2479. {
  2480. *(.text)
  2481. } > REGION_TEXT
  2482. .rodata :
  2483. {
  2484. *(.rodata)
  2485. rodata_end = .;
  2486. } > REGION_RODATA
  2487. .data : AT (rodata_end)
  2488. {
  2489. data_start = .;
  2490. *(.data)
  2491. } > REGION_DATA
  2492. data_size = SIZEOF(.data);
  2493. data_load_start = LOADADDR(.data);
  2494. .bss :
  2495. {
  2496. *(.bss)
  2497. } > REGION_BSS
  2498. }
  2499. Now we need three different 'linkcmds.memory' files to define memory
  2500. regions and alias names. The content of 'linkcmds.memory' for the three
  2501. variants 'A', 'B' and 'C':
  2502. 'A'
  2503. Here everything goes into the 'RAM'.
  2504. MEMORY
  2505. {
  2506. RAM : ORIGIN = 0, LENGTH = 4M
  2507. }
  2508. REGION_ALIAS("REGION_TEXT", RAM);
  2509. REGION_ALIAS("REGION_RODATA", RAM);
  2510. REGION_ALIAS("REGION_DATA", RAM);
  2511. REGION_ALIAS("REGION_BSS", RAM);
  2512. 'B'
  2513. Program code and read-only data go into the 'ROM'. Read-write data
  2514. goes into the 'RAM'. An image of the initialized data is loaded
  2515. into the 'ROM' and will be copied during system start into the
  2516. 'RAM'.
  2517. MEMORY
  2518. {
  2519. ROM : ORIGIN = 0, LENGTH = 3M
  2520. RAM : ORIGIN = 0x10000000, LENGTH = 1M
  2521. }
  2522. REGION_ALIAS("REGION_TEXT", ROM);
  2523. REGION_ALIAS("REGION_RODATA", ROM);
  2524. REGION_ALIAS("REGION_DATA", RAM);
  2525. REGION_ALIAS("REGION_BSS", RAM);
  2526. 'C'
  2527. Program code goes into the 'ROM'. Read-only data goes into the
  2528. 'ROM2'. Read-write data goes into the 'RAM'. An image of the
  2529. initialized data is loaded into the 'ROM2' and will be copied
  2530. during system start into the 'RAM'.
  2531. MEMORY
  2532. {
  2533. ROM : ORIGIN = 0, LENGTH = 2M
  2534. ROM2 : ORIGIN = 0x10000000, LENGTH = 1M
  2535. RAM : ORIGIN = 0x20000000, LENGTH = 1M
  2536. }
  2537. REGION_ALIAS("REGION_TEXT", ROM);
  2538. REGION_ALIAS("REGION_RODATA", ROM2);
  2539. REGION_ALIAS("REGION_DATA", RAM);
  2540. REGION_ALIAS("REGION_BSS", RAM);
  2541. It is possible to write a common system initialization routine to
  2542. copy the '.data' section from 'ROM' or 'ROM2' into the 'RAM' if
  2543. necessary:
  2544. #include <string.h>
  2545. extern char data_start [];
  2546. extern char data_size [];
  2547. extern char data_load_start [];
  2548. void copy_data(void)
  2549. {
  2550. if (data_start != data_load_start)
  2551. {
  2552. memcpy(data_start, data_load_start, (size_t) data_size);
  2553. }
  2554. }
  2555. 
  2556. File: ld.info, Node: Miscellaneous Commands, Prev: REGION_ALIAS, Up: Simple Commands
  2557. 3.4.5 Other Linker Script Commands
  2558. ----------------------------------
  2559. There are a few other linker scripts commands.
  2560. 'ASSERT(EXP, MESSAGE)'
  2561. Ensure that EXP is non-zero. If it is zero, then exit the linker
  2562. with an error code, and print MESSAGE.
  2563. Note that assertions are checked before the final stages of linking
  2564. take place. This means that expressions involving symbols PROVIDEd
  2565. inside section definitions will fail if the user has not set values
  2566. for those symbols. The only exception to this rule is PROVIDEd
  2567. symbols that just reference dot. Thus an assertion like this:
  2568. .stack :
  2569. {
  2570. PROVIDE (__stack = .);
  2571. PROVIDE (__stack_size = 0x100);
  2572. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2573. }
  2574. will fail if '__stack_size' is not defined elsewhere. Symbols
  2575. PROVIDEd outside of section definitions are evaluated earlier, so
  2576. they can be used inside ASSERTions. Thus:
  2577. PROVIDE (__stack_size = 0x100);
  2578. .stack :
  2579. {
  2580. PROVIDE (__stack = .);
  2581. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2582. }
  2583. will work.
  2584. 'EXTERN(SYMBOL SYMBOL ...)'
  2585. Force SYMBOL to be entered in the output file as an undefined
  2586. symbol. Doing this may, for example, trigger linking of additional
  2587. modules from standard libraries. You may list several SYMBOLs for
  2588. each 'EXTERN', and you may use 'EXTERN' multiple times. This
  2589. command has the same effect as the '-u' command-line option.
  2590. 'FORCE_COMMON_ALLOCATION'
  2591. This command has the same effect as the '-d' command-line option:
  2592. to make 'ld' assign space to common symbols even if a relocatable
  2593. output file is specified ('-r').
  2594. 'INHIBIT_COMMON_ALLOCATION'
  2595. This command has the same effect as the '--no-define-common'
  2596. command-line option: to make 'ld' omit the assignment of addresses
  2597. to common symbols even for a non-relocatable output file.
  2598. 'FORCE_GROUP_ALLOCATION'
  2599. This command has the same effect as the '--force-group-allocation'
  2600. command-line option: to make 'ld' place section group members like
  2601. normal input sections, and to delete the section groups even if a
  2602. relocatable output file is specified ('-r').
  2603. 'INSERT [ AFTER | BEFORE ] OUTPUT_SECTION'
  2604. This command is typically used in a script specified by '-T' to
  2605. augment the default 'SECTIONS' with, for example, overlays. It
  2606. inserts all prior linker script statements after (or before)
  2607. OUTPUT_SECTION, and also causes '-T' to not override the default
  2608. linker script. The exact insertion point is as for orphan
  2609. sections. *Note Location Counter::. The insertion happens after
  2610. the linker has mapped input sections to output sections. Prior to
  2611. the insertion, since '-T' scripts are parsed before the default
  2612. linker script, statements in the '-T' script occur before the
  2613. default linker script statements in the internal linker
  2614. representation of the script. In particular, input section
  2615. assignments will be made to '-T' output sections before those in
  2616. the default script. Here is an example of how a '-T' script using
  2617. 'INSERT' might look:
  2618. SECTIONS
  2619. {
  2620. OVERLAY :
  2621. {
  2622. .ov1 { ov1*(.text) }
  2623. .ov2 { ov2*(.text) }
  2624. }
  2625. }
  2626. INSERT AFTER .text;
  2627. 'NOCROSSREFS(SECTION SECTION ...)'
  2628. This command may be used to tell 'ld' to issue an error about any
  2629. references among certain output sections.
  2630. In certain types of programs, particularly on embedded systems when
  2631. using overlays, when one section is loaded into memory, another
  2632. section will not be. Any direct references between the two
  2633. sections would be errors. For example, it would be an error if
  2634. code in one section called a function defined in the other section.
  2635. The 'NOCROSSREFS' command takes a list of output section names. If
  2636. 'ld' detects any cross references between the sections, it reports
  2637. an error and returns a non-zero exit status. Note that the
  2638. 'NOCROSSREFS' command uses output section names, not input section
  2639. names.
  2640. 'NOCROSSREFS_TO(TOSECTION FROMSECTION ...)'
  2641. This command may be used to tell 'ld' to issue an error about any
  2642. references to one section from a list of other sections.
  2643. The 'NOCROSSREFS' command is useful when ensuring that two or more
  2644. output sections are entirely independent but there are situations
  2645. where a one-way dependency is needed. For example, in a multi-core
  2646. application there may be shared code that can be called from each
  2647. core but for safety must never call back.
  2648. The 'NOCROSSREFS_TO' command takes a list of output section names.
  2649. The first section can not be referenced from any of the other
  2650. sections. If 'ld' detects any references to the first section from
  2651. any of the other sections, it reports an error and returns a
  2652. non-zero exit status. Note that the 'NOCROSSREFS_TO' command uses
  2653. output section names, not input section names.
  2654. 'OUTPUT_ARCH(BFDARCH)'
  2655. Specify a particular output machine architecture. The argument is
  2656. one of the names used by the BFD library (*note BFD::). You can
  2657. see the architecture of an object file by using the 'objdump'
  2658. program with the '-f' option.
  2659. 'LD_FEATURE(STRING)'
  2660. This command may be used to modify 'ld' behavior. If STRING is
  2661. '"SANE_EXPR"' then absolute symbols and numbers in a script are
  2662. simply treated as numbers everywhere. *Note Expression Section::.
  2663. 
  2664. File: ld.info, Node: Assignments, Next: SECTIONS, Prev: Simple Commands, Up: Scripts
  2665. 3.5 Assigning Values to Symbols
  2666. ===============================
  2667. You may assign a value to a symbol in a linker script. This will define
  2668. the symbol and place it into the symbol table with a global scope.
  2669. * Menu:
  2670. * Simple Assignments:: Simple Assignments
  2671. * HIDDEN:: HIDDEN
  2672. * PROVIDE:: PROVIDE
  2673. * PROVIDE_HIDDEN:: PROVIDE_HIDDEN
  2674. * Source Code Reference:: How to use a linker script defined symbol in source code
  2675. 
  2676. File: ld.info, Node: Simple Assignments, Next: HIDDEN, Up: Assignments
  2677. 3.5.1 Simple Assignments
  2678. ------------------------
  2679. You may assign to a symbol using any of the C assignment operators:
  2680. 'SYMBOL = EXPRESSION ;'
  2681. 'SYMBOL += EXPRESSION ;'
  2682. 'SYMBOL -= EXPRESSION ;'
  2683. 'SYMBOL *= EXPRESSION ;'
  2684. 'SYMBOL /= EXPRESSION ;'
  2685. 'SYMBOL <<= EXPRESSION ;'
  2686. 'SYMBOL >>= EXPRESSION ;'
  2687. 'SYMBOL &= EXPRESSION ;'
  2688. 'SYMBOL |= EXPRESSION ;'
  2689. The first case will define SYMBOL to the value of EXPRESSION. In the
  2690. other cases, SYMBOL must already be defined, and the value will be
  2691. adjusted accordingly.
  2692. The special symbol name '.' indicates the location counter. You may
  2693. only use this within a 'SECTIONS' command. *Note Location Counter::.
  2694. The semicolon after EXPRESSION is required.
  2695. Expressions are defined below; see *note Expressions::.
  2696. You may write symbol assignments as commands in their own right, or
  2697. as statements within a 'SECTIONS' command, or as part of an output
  2698. section description in a 'SECTIONS' command.
  2699. The section of the symbol will be set from the section of the
  2700. expression; for more information, see *note Expression Section::.
  2701. Here is an example showing the three different places that symbol
  2702. assignments may be used:
  2703. floating_point = 0;
  2704. SECTIONS
  2705. {
  2706. .text :
  2707. {
  2708. *(.text)
  2709. _etext = .;
  2710. }
  2711. _bdata = (. + 3) & ~ 3;
  2712. .data : { *(.data) }
  2713. }
  2714. In this example, the symbol 'floating_point' will be defined as zero.
  2715. The symbol '_etext' will be defined as the address following the last
  2716. '.text' input section. The symbol '_bdata' will be defined as the
  2717. address following the '.text' output section aligned upward to a 4 byte
  2718. boundary.
  2719. 
  2720. File: ld.info, Node: HIDDEN, Next: PROVIDE, Prev: Simple Assignments, Up: Assignments
  2721. 3.5.2 HIDDEN
  2722. ------------
  2723. For ELF targeted ports, define a symbol that will be hidden and won't be
  2724. exported. The syntax is 'HIDDEN(SYMBOL = EXPRESSION)'.
  2725. Here is the example from *note Simple Assignments::, rewritten to use
  2726. 'HIDDEN':
  2727. HIDDEN(floating_point = 0);
  2728. SECTIONS
  2729. {
  2730. .text :
  2731. {
  2732. *(.text)
  2733. HIDDEN(_etext = .);
  2734. }
  2735. HIDDEN(_bdata = (. + 3) & ~ 3);
  2736. .data : { *(.data) }
  2737. }
  2738. In this case none of the three symbols will be visible outside this
  2739. module.
  2740. 
  2741. File: ld.info, Node: PROVIDE, Next: PROVIDE_HIDDEN, Prev: HIDDEN, Up: Assignments
  2742. 3.5.3 PROVIDE
  2743. -------------
  2744. In some cases, it is desirable for a linker script to define a symbol
  2745. only if it is referenced and is not defined by any object included in
  2746. the link. For example, traditional linkers defined the symbol 'etext'.
  2747. However, ANSI C requires that the user be able to use 'etext' as a
  2748. function name without encountering an error. The 'PROVIDE' keyword may
  2749. be used to define a symbol, such as 'etext', only if it is referenced
  2750. but not defined. The syntax is 'PROVIDE(SYMBOL = EXPRESSION)'.
  2751. Here is an example of using 'PROVIDE' to define 'etext':
  2752. SECTIONS
  2753. {
  2754. .text :
  2755. {
  2756. *(.text)
  2757. _etext = .;
  2758. PROVIDE(etext = .);
  2759. }
  2760. }
  2761. In this example, if the program defines '_etext' (with a leading
  2762. underscore), the linker will give a multiple definition error. If, on
  2763. the other hand, the program defines 'etext' (with no leading
  2764. underscore), the linker will silently use the definition in the program.
  2765. If the program references 'etext' but does not define it, the linker
  2766. will use the definition in the linker script.
  2767. Note - the 'PROVIDE' directive considers a common symbol to be
  2768. defined, even though such a symbol could be combined with the symbol
  2769. that the 'PROVIDE' would create. This is particularly important when
  2770. considering constructor and destructor list symbols such as
  2771. '__CTOR_LIST__' as these are often defined as common symbols.
  2772. 
  2773. File: ld.info, Node: PROVIDE_HIDDEN, Next: Source Code Reference, Prev: PROVIDE, Up: Assignments
  2774. 3.5.4 PROVIDE_HIDDEN
  2775. --------------------
  2776. Similar to 'PROVIDE'. For ELF targeted ports, the symbol will be hidden
  2777. and won't be exported.
  2778. 
  2779. File: ld.info, Node: Source Code Reference, Prev: PROVIDE_HIDDEN, Up: Assignments
  2780. 3.5.5 Source Code Reference
  2781. ---------------------------
  2782. Accessing a linker script defined variable from source code is not
  2783. intuitive. In particular a linker script symbol is not equivalent to a
  2784. variable declaration in a high level language, it is instead a symbol
  2785. that does not have a value.
  2786. Before going further, it is important to note that compilers often
  2787. transform names in the source code into different names when they are
  2788. stored in the symbol table. For example, Fortran compilers commonly
  2789. prepend or append an underscore, and C++ performs extensive 'name
  2790. mangling'. Therefore there might be a discrepancy between the name of a
  2791. variable as it is used in source code and the name of the same variable
  2792. as it is defined in a linker script. For example in C a linker script
  2793. variable might be referred to as:
  2794. extern int foo;
  2795. But in the linker script it might be defined as:
  2796. _foo = 1000;
  2797. In the remaining examples however it is assumed that no name
  2798. transformation has taken place.
  2799. When a symbol is declared in a high level language such as C, two
  2800. things happen. The first is that the compiler reserves enough space in
  2801. the program's memory to hold the _value_ of the symbol. The second is
  2802. that the compiler creates an entry in the program's symbol table which
  2803. holds the symbol's _address_. ie the symbol table contains the address
  2804. of the block of memory holding the symbol's value. So for example the
  2805. following C declaration, at file scope:
  2806. int foo = 1000;
  2807. creates an entry called 'foo' in the symbol table. This entry holds
  2808. the address of an 'int' sized block of memory where the number 1000 is
  2809. initially stored.
  2810. When a program references a symbol the compiler generates code that
  2811. first accesses the symbol table to find the address of the symbol's
  2812. memory block and then code to read the value from that memory block.
  2813. So:
  2814. foo = 1;
  2815. looks up the symbol 'foo' in the symbol table, gets the address
  2816. associated with this symbol and then writes the value 1 into that
  2817. address. Whereas:
  2818. int * a = & foo;
  2819. looks up the symbol 'foo' in the symbol table, gets its address and
  2820. then copies this address into the block of memory associated with the
  2821. variable 'a'.
  2822. Linker scripts symbol declarations, by contrast, create an entry in
  2823. the symbol table but do not assign any memory to them. Thus they are an
  2824. address without a value. So for example the linker script definition:
  2825. foo = 1000;
  2826. creates an entry in the symbol table called 'foo' which holds the
  2827. address of memory location 1000, but nothing special is stored at
  2828. address 1000. This means that you cannot access the _value_ of a linker
  2829. script defined symbol - it has no value - all you can do is access the
  2830. _address_ of a linker script defined symbol.
  2831. Hence when you are using a linker script defined symbol in source
  2832. code you should always take the address of the symbol, and never attempt
  2833. to use its value. For example suppose you want to copy the contents of
  2834. a section of memory called .ROM into a section called .FLASH and the
  2835. linker script contains these declarations:
  2836. start_of_ROM = .ROM;
  2837. end_of_ROM = .ROM + sizeof (.ROM);
  2838. start_of_FLASH = .FLASH;
  2839. Then the C source code to perform the copy would be:
  2840. extern char start_of_ROM, end_of_ROM, start_of_FLASH;
  2841. memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM);
  2842. Note the use of the '&' operators. These are correct. Alternatively
  2843. the symbols can be treated as the names of vectors or arrays and then
  2844. the code will again work as expected:
  2845. extern char start_of_ROM[], end_of_ROM[], start_of_FLASH[];
  2846. memcpy (start_of_FLASH, start_of_ROM, end_of_ROM - start_of_ROM);
  2847. Note how using this method does not require the use of '&' operators.
  2848. 
  2849. File: ld.info, Node: SECTIONS, Next: MEMORY, Prev: Assignments, Up: Scripts
  2850. 3.6 SECTIONS Command
  2851. ====================
  2852. The 'SECTIONS' command tells the linker how to map input sections into
  2853. output sections, and how to place the output sections in memory.
  2854. The format of the 'SECTIONS' command is:
  2855. SECTIONS
  2856. {
  2857. SECTIONS-COMMAND
  2858. SECTIONS-COMMAND
  2859. ...
  2860. }
  2861. Each SECTIONS-COMMAND may of be one of the following:
  2862. * an 'ENTRY' command (*note Entry command: Entry Point.)
  2863. * a symbol assignment (*note Assignments::)
  2864. * an output section description
  2865. * an overlay description
  2866. The 'ENTRY' command and symbol assignments are permitted inside the
  2867. 'SECTIONS' command for convenience in using the location counter in
  2868. those commands. This can also make the linker script easier to
  2869. understand because you can use those commands at meaningful points in
  2870. the layout of the output file.
  2871. Output section descriptions and overlay descriptions are described
  2872. below.
  2873. If you do not use a 'SECTIONS' command in your linker script, the
  2874. linker will place each input section into an identically named output
  2875. section in the order that the sections are first encountered in the
  2876. input files. If all input sections are present in the first file, for
  2877. example, the order of sections in the output file will match the order
  2878. in the first input file. The first section will be at address zero.
  2879. * Menu:
  2880. * Output Section Description:: Output section description
  2881. * Output Section Name:: Output section name
  2882. * Output Section Address:: Output section address
  2883. * Input Section:: Input section description
  2884. * Output Section Data:: Output section data
  2885. * Output Section Keywords:: Output section keywords
  2886. * Output Section Discarding:: Output section discarding
  2887. * Output Section Attributes:: Output section attributes
  2888. * Overlay Description:: Overlay description
  2889. 
  2890. File: ld.info, Node: Output Section Description, Next: Output Section Name, Up: SECTIONS
  2891. 3.6.1 Output Section Description
  2892. --------------------------------
  2893. The full description of an output section looks like this:
  2894. SECTION [ADDRESS] [(TYPE)] :
  2895. [AT(LMA)]
  2896. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  2897. [SUBALIGN(SUBSECTION_ALIGN)]
  2898. [CONSTRAINT]
  2899. {
  2900. OUTPUT-SECTION-COMMAND
  2901. OUTPUT-SECTION-COMMAND
  2902. ...
  2903. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP] [,]
  2904. Most output sections do not use most of the optional section
  2905. attributes.
  2906. The whitespace around SECTION is required, so that the section name
  2907. is unambiguous. The colon and the curly braces are also required. The
  2908. comma at the end may be required if a FILLEXP is used and the next
  2909. SECTIONS-COMMAND looks like a continuation of the expression. The line
  2910. breaks and other white space are optional.
  2911. Each OUTPUT-SECTION-COMMAND may be one of the following:
  2912. * a symbol assignment (*note Assignments::)
  2913. * an input section description (*note Input Section::)
  2914. * data values to include directly (*note Output Section Data::)
  2915. * a special output section keyword (*note Output Section Keywords::)
  2916. 
  2917. File: ld.info, Node: Output Section Name, Next: Output Section Address, Prev: Output Section Description, Up: SECTIONS
  2918. 3.6.2 Output Section Name
  2919. -------------------------
  2920. The name of the output section is SECTION. SECTION must meet the
  2921. constraints of your output format. In formats which only support a
  2922. limited number of sections, such as 'a.out', the name must be one of the
  2923. names supported by the format ('a.out', for example, allows only
  2924. '.text', '.data' or '.bss'). If the output format supports any number
  2925. of sections, but with numbers and not names (as is the case for Oasys),
  2926. the name should be supplied as a quoted numeric string. A section name
  2927. may consist of any sequence of characters, but a name which contains any
  2928. unusual characters such as commas must be quoted.
  2929. The output section name '/DISCARD/' is special; *note Output Section
  2930. Discarding::.
  2931. 
  2932. File: ld.info, Node: Output Section Address, Next: Input Section, Prev: Output Section Name, Up: SECTIONS
  2933. 3.6.3 Output Section Address
  2934. ----------------------------
  2935. The ADDRESS is an expression for the VMA (the virtual memory address) of
  2936. the output section. This address is optional, but if it is provided
  2937. then the output address will be set exactly as specified.
  2938. If the output address is not specified then one will be chosen for
  2939. the section, based on the heuristic below. This address will be
  2940. adjusted to fit the alignment requirement of the output section. The
  2941. alignment requirement is the strictest alignment of any input section
  2942. contained within the output section.
  2943. The output section address heuristic is as follows:
  2944. * If an output memory REGION is set for the section then it is added
  2945. to this region and its address will be the next free address in
  2946. that region.
  2947. * If the MEMORY command has been used to create a list of memory
  2948. regions then the first region which has attributes compatible with
  2949. the section is selected to contain it. The section's output
  2950. address will be the next free address in that region; *note
  2951. MEMORY::.
  2952. * If no memory regions were specified, or none match the section then
  2953. the output address will be based on the current value of the
  2954. location counter.
  2955. For example:
  2956. .text . : { *(.text) }
  2957. and
  2958. .text : { *(.text) }
  2959. are subtly different. The first will set the address of the '.text'
  2960. output section to the current value of the location counter. The second
  2961. will set it to the current value of the location counter aligned to the
  2962. strictest alignment of any of the '.text' input sections.
  2963. The ADDRESS may be an arbitrary expression; *note Expressions::. For
  2964. example, if you want to align the section on a 0x10 byte boundary, so
  2965. that the lowest four bits of the section address are zero, you could do
  2966. something like this:
  2967. .text ALIGN(0x10) : { *(.text) }
  2968. This works because 'ALIGN' returns the current location counter aligned
  2969. upward to the specified value.
  2970. Specifying ADDRESS for a section will change the value of the
  2971. location counter, provided that the section is non-empty. (Empty
  2972. sections are ignored).
  2973. 
  2974. File: ld.info, Node: Input Section, Next: Output Section Data, Prev: Output Section Address, Up: SECTIONS
  2975. 3.6.4 Input Section Description
  2976. -------------------------------
  2977. The most common output section command is an input section description.
  2978. The input section description is the most basic linker script
  2979. operation. You use output sections to tell the linker how to lay out
  2980. your program in memory. You use input section descriptions to tell the
  2981. linker how to map the input files into your memory layout.
  2982. * Menu:
  2983. * Input Section Basics:: Input section basics
  2984. * Input Section Wildcards:: Input section wildcard patterns
  2985. * Input Section Common:: Input section for common symbols
  2986. * Input Section Keep:: Input section and garbage collection
  2987. * Input Section Example:: Input section example
  2988. 
  2989. File: ld.info, Node: Input Section Basics, Next: Input Section Wildcards, Up: Input Section
  2990. 3.6.4.1 Input Section Basics
  2991. ............................
  2992. An input section description consists of a file name optionally followed
  2993. by a list of section names in parentheses.
  2994. The file name and the section name may be wildcard patterns, which we
  2995. describe further below (*note Input Section Wildcards::).
  2996. The most common input section description is to include all input
  2997. sections with a particular name in the output section. For example, to
  2998. include all input '.text' sections, you would write:
  2999. *(.text)
  3000. Here the '*' is a wildcard which matches any file name. To exclude a
  3001. list of files from matching the file name wildcard, EXCLUDE_FILE may be
  3002. used to match all files except the ones specified in the EXCLUDE_FILE
  3003. list. For example:
  3004. EXCLUDE_FILE (*crtend.o *otherfile.o) *(.ctors)
  3005. will cause all .ctors sections from all files except 'crtend.o' and
  3006. 'otherfile.o' to be included. The EXCLUDE_FILE can also be placed
  3007. inside the section list, for example:
  3008. *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)
  3009. The result of this is identically to the previous example. Supporting
  3010. two syntaxes for EXCLUDE_FILE is useful if the section list contains
  3011. more than one section, as described below.
  3012. There are two ways to include more than one section:
  3013. *(.text .rdata)
  3014. *(.text) *(.rdata)
  3015. The difference between these is the order in which the '.text' and
  3016. '.rdata' input sections will appear in the output section. In the first
  3017. example, they will be intermingled, appearing in the same order as they
  3018. are found in the linker input. In the second example, all '.text' input
  3019. sections will appear first, followed by all '.rdata' input sections.
  3020. When using EXCLUDE_FILE with more than one section, if the exclusion
  3021. is within the section list then the exclusion only applies to the
  3022. immediately following section, for example:
  3023. *(EXCLUDE_FILE (*somefile.o) .text .rdata)
  3024. will cause all '.text' sections from all files except 'somefile.o' to be
  3025. included, while all '.rdata' sections from all files, including
  3026. 'somefile.o', will be included. To exclude the '.rdata' sections from
  3027. 'somefile.o' the example could be modified to:
  3028. *(EXCLUDE_FILE (*somefile.o) .text EXCLUDE_FILE (*somefile.o) .rdata)
  3029. Alternatively, placing the EXCLUDE_FILE outside of the section list,
  3030. before the input file selection, will cause the exclusion to apply for
  3031. all sections. Thus the previous example can be rewritten as:
  3032. EXCLUDE_FILE (*somefile.o) *(.text .rdata)
  3033. You can specify a file name to include sections from a particular
  3034. file. You would do this if one or more of your files contain special
  3035. data that needs to be at a particular location in memory. For example:
  3036. data.o(.data)
  3037. To refine the sections that are included based on the section flags
  3038. of an input section, INPUT_SECTION_FLAGS may be used.
  3039. Here is a simple example for using Section header flags for ELF
  3040. sections:
  3041. SECTIONS {
  3042. .text : { INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS) *(.text) }
  3043. .text2 : { INPUT_SECTION_FLAGS (!SHF_WRITE) *(.text) }
  3044. }
  3045. In this example, the output section '.text' will be comprised of any
  3046. input section matching the name *(.text) whose section header flags
  3047. 'SHF_MERGE' and 'SHF_STRINGS' are set. The output section '.text2' will
  3048. be comprised of any input section matching the name *(.text) whose
  3049. section header flag 'SHF_WRITE' is clear.
  3050. You can also specify files within archives by writing a pattern
  3051. matching the archive, a colon, then the pattern matching the file, with
  3052. no whitespace around the colon.
  3053. 'archive:file'
  3054. matches file within archive
  3055. 'archive:'
  3056. matches the whole archive
  3057. ':file'
  3058. matches file but not one in an archive
  3059. Either one or both of 'archive' and 'file' can contain shell
  3060. wildcards. On DOS based file systems, the linker will assume that a
  3061. single letter followed by a colon is a drive specifier, so 'c:myfile.o'
  3062. is a simple file specification, not 'myfile.o' within an archive called
  3063. 'c'. 'archive:file' filespecs may also be used within an 'EXCLUDE_FILE'
  3064. list, but may not appear in other linker script contexts. For instance,
  3065. you cannot extract a file from an archive by using 'archive:file' in an
  3066. 'INPUT' command.
  3067. If you use a file name without a list of sections, then all sections
  3068. in the input file will be included in the output section. This is not
  3069. commonly done, but it may by useful on occasion. For example:
  3070. data.o
  3071. When you use a file name which is not an 'archive:file' specifier and
  3072. does not contain any wild card characters, the linker will first see if
  3073. you also specified the file name on the linker command line or in an
  3074. 'INPUT' command. If you did not, the linker will attempt to open the
  3075. file as an input file, as though it appeared on the command line. Note
  3076. that this differs from an 'INPUT' command, because the linker will not
  3077. search for the file in the archive search path.
  3078. 
  3079. File: ld.info, Node: Input Section Wildcards, Next: Input Section Common, Prev: Input Section Basics, Up: Input Section
  3080. 3.6.4.2 Input Section Wildcard Patterns
  3081. .......................................
  3082. In an input section description, either the file name or the section
  3083. name or both may be wildcard patterns.
  3084. The file name of '*' seen in many examples is a simple wildcard
  3085. pattern for the file name.
  3086. The wildcard patterns are like those used by the Unix shell.
  3087. '*'
  3088. matches any number of characters
  3089. '?'
  3090. matches any single character
  3091. '[CHARS]'
  3092. matches a single instance of any of the CHARS; the '-' character
  3093. may be used to specify a range of characters, as in '[a-z]' to
  3094. match any lower case letter
  3095. '\'
  3096. quotes the following character
  3097. When a file name is matched with a wildcard, the wildcard characters
  3098. will not match a '/' character (used to separate directory names on
  3099. Unix). A pattern consisting of a single '*' character is an exception;
  3100. it will always match any file name, whether it contains a '/' or not.
  3101. In a section name, the wildcard characters will match a '/' character.
  3102. File name wildcard patterns only match files which are explicitly
  3103. specified on the command line or in an 'INPUT' command. The linker does
  3104. not search directories to expand wildcards.
  3105. If a file name matches more than one wildcard pattern, or if a file
  3106. name appears explicitly and is also matched by a wildcard pattern, the
  3107. linker will use the first match in the linker script. For example, this
  3108. sequence of input section descriptions is probably in error, because the
  3109. 'data.o' rule will not be used:
  3110. .data : { *(.data) }
  3111. .data1 : { data.o(.data) }
  3112. Normally, the linker will place files and sections matched by
  3113. wildcards in the order in which they are seen during the link. You can
  3114. change this by using the 'SORT_BY_NAME' keyword, which appears before a
  3115. wildcard pattern in parentheses (e.g., 'SORT_BY_NAME(.text*)'). When
  3116. the 'SORT_BY_NAME' keyword is used, the linker will sort the files or
  3117. sections into ascending order by name before placing them in the output
  3118. file.
  3119. 'SORT_BY_ALIGNMENT' is very similar to 'SORT_BY_NAME'. The
  3120. difference is 'SORT_BY_ALIGNMENT' will sort sections into descending
  3121. order by alignment before placing them in the output file. Larger
  3122. alignments are placed before smaller alignments in order to reduce the
  3123. amount of padding necessary.
  3124. 'SORT_BY_INIT_PRIORITY' is very similar to 'SORT_BY_NAME'. The
  3125. difference is 'SORT_BY_INIT_PRIORITY' will sort sections into ascending
  3126. order by numerical value of the GCC init_priority attribute encoded in
  3127. the section name before placing them in the output file.
  3128. 'SORT' is an alias for 'SORT_BY_NAME'.
  3129. When there are nested section sorting commands in linker script,
  3130. there can be at most 1 level of nesting for section sorting commands.
  3131. 1. 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT' (wildcard section pattern)).
  3132. It will sort the input sections by name first, then by alignment if
  3133. two sections have the same name.
  3134. 2. 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME' (wildcard section pattern)).
  3135. It will sort the input sections by alignment first, then by name if
  3136. two sections have the same alignment.
  3137. 3. 'SORT_BY_NAME' ('SORT_BY_NAME' (wildcard section pattern)) is
  3138. treated the same as 'SORT_BY_NAME' (wildcard section pattern).
  3139. 4. 'SORT_BY_ALIGNMENT' ('SORT_BY_ALIGNMENT' (wildcard section
  3140. pattern)) is treated the same as 'SORT_BY_ALIGNMENT' (wildcard
  3141. section pattern).
  3142. 5. All other nested section sorting commands are invalid.
  3143. When both command-line section sorting option and linker script
  3144. section sorting command are used, section sorting command always takes
  3145. precedence over the command-line option.
  3146. If the section sorting command in linker script isn't nested, the
  3147. command-line option will make the section sorting command to be treated
  3148. as nested sorting command.
  3149. 1. 'SORT_BY_NAME' (wildcard section pattern ) with '--sort-sections
  3150. alignment' is equivalent to 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT'
  3151. (wildcard section pattern)).
  3152. 2. 'SORT_BY_ALIGNMENT' (wildcard section pattern) with '--sort-section
  3153. name' is equivalent to 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME'
  3154. (wildcard section pattern)).
  3155. If the section sorting command in linker script is nested, the
  3156. command-line option will be ignored.
  3157. 'SORT_NONE' disables section sorting by ignoring the command-line
  3158. section sorting option.
  3159. If you ever get confused about where input sections are going, use
  3160. the '-M' linker option to generate a map file. The map file shows
  3161. precisely how input sections are mapped to output sections.
  3162. This example shows how wildcard patterns might be used to partition
  3163. files. This linker script directs the linker to place all '.text'
  3164. sections in '.text' and all '.bss' sections in '.bss'. The linker will
  3165. place the '.data' section from all files beginning with an upper case
  3166. character in '.DATA'; for all other files, the linker will place the
  3167. '.data' section in '.data'.
  3168. SECTIONS {
  3169. .text : { *(.text) }
  3170. .DATA : { [A-Z]*(.data) }
  3171. .data : { *(.data) }
  3172. .bss : { *(.bss) }
  3173. }
  3174. 
  3175. File: ld.info, Node: Input Section Common, Next: Input Section Keep, Prev: Input Section Wildcards, Up: Input Section
  3176. 3.6.4.3 Input Section for Common Symbols
  3177. ........................................
  3178. A special notation is needed for common symbols, because in many object
  3179. file formats common symbols do not have a particular input section. The
  3180. linker treats common symbols as though they are in an input section
  3181. named 'COMMON'.
  3182. You may use file names with the 'COMMON' section just as with any
  3183. other input sections. You can use this to place common symbols from a
  3184. particular input file in one section while common symbols from other
  3185. input files are placed in another section.
  3186. In most cases, common symbols in input files will be placed in the
  3187. '.bss' section in the output file. For example:
  3188. .bss { *(.bss) *(COMMON) }
  3189. Some object file formats have more than one type of common symbol.
  3190. For example, the MIPS ELF object file format distinguishes standard
  3191. common symbols and small common symbols. In this case, the linker will
  3192. use a different special section name for other types of common symbols.
  3193. In the case of MIPS ELF, the linker uses 'COMMON' for standard common
  3194. symbols and '.scommon' for small common symbols. This permits you to
  3195. map the different types of common symbols into memory at different
  3196. locations.
  3197. You will sometimes see '[COMMON]' in old linker scripts. This
  3198. notation is now considered obsolete. It is equivalent to '*(COMMON)'.
  3199. 
  3200. File: ld.info, Node: Input Section Keep, Next: Input Section Example, Prev: Input Section Common, Up: Input Section
  3201. 3.6.4.4 Input Section and Garbage Collection
  3202. ............................................
  3203. When link-time garbage collection is in use ('--gc-sections'), it is
  3204. often useful to mark sections that should not be eliminated. This is
  3205. accomplished by surrounding an input section's wildcard entry with
  3206. 'KEEP()', as in 'KEEP(*(.init))' or 'KEEP(SORT_BY_NAME(*)(.ctors))'.
  3207. 
  3208. File: ld.info, Node: Input Section Example, Prev: Input Section Keep, Up: Input Section
  3209. 3.6.4.5 Input Section Example
  3210. .............................
  3211. The following example is a complete linker script. It tells the linker
  3212. to read all of the sections from file 'all.o' and place them at the
  3213. start of output section 'outputa' which starts at location '0x10000'.
  3214. All of section '.input1' from file 'foo.o' follows immediately, in the
  3215. same output section. All of section '.input2' from 'foo.o' goes into
  3216. output section 'outputb', followed by section '.input1' from 'foo1.o'.
  3217. All of the remaining '.input1' and '.input2' sections from any files are
  3218. written to output section 'outputc'.
  3219. SECTIONS {
  3220. outputa 0x10000 :
  3221. {
  3222. all.o
  3223. foo.o (.input1)
  3224. }
  3225. outputb :
  3226. {
  3227. foo.o (.input2)
  3228. foo1.o (.input1)
  3229. }
  3230. outputc :
  3231. {
  3232. *(.input1)
  3233. *(.input2)
  3234. }
  3235. }
  3236. If an output section's name is the same as the input section's name
  3237. and is representable as a C identifier, then the linker will
  3238. automatically *note PROVIDE:: two symbols: __start_SECNAME and
  3239. __stop_SECNAME, where SECNAME is the name of the section. These
  3240. indicate the start address and end address of the output section
  3241. respectively. Note: most section names are not representable as C
  3242. identifiers because they contain a '.' character.
  3243. 
  3244. File: ld.info, Node: Output Section Data, Next: Output Section Keywords, Prev: Input Section, Up: SECTIONS
  3245. 3.6.5 Output Section Data
  3246. -------------------------
  3247. You can include explicit bytes of data in an output section by using
  3248. 'BYTE', 'SHORT', 'LONG', 'QUAD', or 'SQUAD' as an output section
  3249. command. Each keyword is followed by an expression in parentheses
  3250. providing the value to store (*note Expressions::). The value of the
  3251. expression is stored at the current value of the location counter.
  3252. The 'BYTE', 'SHORT', 'LONG', and 'QUAD' commands store one, two,
  3253. four, and eight bytes (respectively). After storing the bytes, the
  3254. location counter is incremented by the number of bytes stored.
  3255. For example, this will store the byte 1 followed by the four byte
  3256. value of the symbol 'addr':
  3257. BYTE(1)
  3258. LONG(addr)
  3259. When using a 64 bit host or target, 'QUAD' and 'SQUAD' are the same;
  3260. they both store an 8 byte, or 64 bit, value. When both host and target
  3261. are 32 bits, an expression is computed as 32 bits. In this case 'QUAD'
  3262. stores a 32 bit value zero extended to 64 bits, and 'SQUAD' stores a 32
  3263. bit value sign extended to 64 bits.
  3264. If the object file format of the output file has an explicit
  3265. endianness, which is the normal case, the value will be stored in that
  3266. endianness. When the object file format does not have an explicit
  3267. endianness, as is true of, for example, S-records, the value will be
  3268. stored in the endianness of the first input object file.
  3269. Note--these commands only work inside a section description and not
  3270. between them, so the following will produce an error from the linker:
  3271. SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }
  3272. whereas this will work:
  3273. SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }
  3274. You may use the 'FILL' command to set the fill pattern for the
  3275. current section. It is followed by an expression in parentheses. Any
  3276. otherwise unspecified regions of memory within the section (for example,
  3277. gaps left due to the required alignment of input sections) are filled
  3278. with the value of the expression, repeated as necessary. A 'FILL'
  3279. statement covers memory locations after the point at which it occurs in
  3280. the section definition; by including more than one 'FILL' statement, you
  3281. can have different fill patterns in different parts of an output
  3282. section.
  3283. This example shows how to fill unspecified regions of memory with the
  3284. value '0x90':
  3285. FILL(0x90909090)
  3286. The 'FILL' command is similar to the '=FILLEXP' output section
  3287. attribute, but it only affects the part of the section following the
  3288. 'FILL' command, rather than the entire section. If both are used, the
  3289. 'FILL' command takes precedence. *Note Output Section Fill::, for
  3290. details on the fill expression.
  3291. 
  3292. File: ld.info, Node: Output Section Keywords, Next: Output Section Discarding, Prev: Output Section Data, Up: SECTIONS
  3293. 3.6.6 Output Section Keywords
  3294. -----------------------------
  3295. There are a couple of keywords which can appear as output section
  3296. commands.
  3297. 'CREATE_OBJECT_SYMBOLS'
  3298. The command tells the linker to create a symbol for each input
  3299. file. The name of each symbol will be the name of the
  3300. corresponding input file. The section of each symbol will be the
  3301. output section in which the 'CREATE_OBJECT_SYMBOLS' command
  3302. appears.
  3303. This is conventional for the a.out object file format. It is not
  3304. normally used for any other object file format.
  3305. 'CONSTRUCTORS'
  3306. When linking using the a.out object file format, the linker uses an
  3307. unusual set construct to support C++ global constructors and
  3308. destructors. When linking object file formats which do not support
  3309. arbitrary sections, such as ECOFF and XCOFF, the linker will
  3310. automatically recognize C++ global constructors and destructors by
  3311. name. For these object file formats, the 'CONSTRUCTORS' command
  3312. tells the linker to place constructor information in the output
  3313. section where the 'CONSTRUCTORS' command appears. The
  3314. 'CONSTRUCTORS' command is ignored for other object file formats.
  3315. The symbol '__CTOR_LIST__' marks the start of the global
  3316. constructors, and the symbol '__CTOR_END__' marks the end.
  3317. Similarly, '__DTOR_LIST__' and '__DTOR_END__' mark the start and
  3318. end of the global destructors. The first word in the list is the
  3319. number of entries, followed by the address of each constructor or
  3320. destructor, followed by a zero word. The compiler must arrange to
  3321. actually run the code. For these object file formats GNU C++
  3322. normally calls constructors from a subroutine '__main'; a call to
  3323. '__main' is automatically inserted into the startup code for
  3324. 'main'. GNU C++ normally runs destructors either by using
  3325. 'atexit', or directly from the function 'exit'.
  3326. For object file formats such as 'COFF' or 'ELF' which support
  3327. arbitrary section names, GNU C++ will normally arrange to put the
  3328. addresses of global constructors and destructors into the '.ctors'
  3329. and '.dtors' sections. Placing the following sequence into your
  3330. linker script will build the sort of table which the GNU C++
  3331. runtime code expects to see.
  3332. __CTOR_LIST__ = .;
  3333. LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  3334. *(.ctors)
  3335. LONG(0)
  3336. __CTOR_END__ = .;
  3337. __DTOR_LIST__ = .;
  3338. LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
  3339. *(.dtors)
  3340. LONG(0)
  3341. __DTOR_END__ = .;
  3342. If you are using the GNU C++ support for initialization priority,
  3343. which provides some control over the order in which global
  3344. constructors are run, you must sort the constructors at link time
  3345. to ensure that they are executed in the correct order. When using
  3346. the 'CONSTRUCTORS' command, use 'SORT_BY_NAME(CONSTRUCTORS)'
  3347. instead. When using the '.ctors' and '.dtors' sections, use
  3348. '*(SORT_BY_NAME(.ctors))' and '*(SORT_BY_NAME(.dtors))' instead of
  3349. just '*(.ctors)' and '*(.dtors)'.
  3350. Normally the compiler and linker will handle these issues
  3351. automatically, and you will not need to concern yourself with them.
  3352. However, you may need to consider this if you are using C++ and
  3353. writing your own linker scripts.
  3354. 
  3355. File: ld.info, Node: Output Section Discarding, Next: Output Section Attributes, Prev: Output Section Keywords, Up: SECTIONS
  3356. 3.6.7 Output Section Discarding
  3357. -------------------------------
  3358. The linker will not normally create output sections with no contents.
  3359. This is for convenience when referring to input sections that may or may
  3360. not be present in any of the input files. For example:
  3361. .foo : { *(.foo) }
  3362. will only create a '.foo' section in the output file if there is a
  3363. '.foo' section in at least one input file, and if the input sections are
  3364. not all empty. Other link script directives that allocate space in an
  3365. output section will also create the output section. So too will
  3366. assignments to dot even if the assignment does not create space, except
  3367. for '. = 0', '. = . + 0', '. = sym', '. = . + sym' and '. = ALIGN (. !=
  3368. 0, expr, 1)' when 'sym' is an absolute symbol of value 0 defined in the
  3369. script. This allows you to force output of an empty section with '. =
  3370. .'.
  3371. The linker will ignore address assignments (*note Output Section
  3372. Address::) on discarded output sections, except when the linker script
  3373. defines symbols in the output section. In that case the linker will
  3374. obey the address assignments, possibly advancing dot even though the
  3375. section is discarded.
  3376. The special output section name '/DISCARD/' may be used to discard
  3377. input sections. Any input sections which are assigned to an output
  3378. section named '/DISCARD/' are not included in the output file.
  3379. 
  3380. File: ld.info, Node: Output Section Attributes, Next: Overlay Description, Prev: Output Section Discarding, Up: SECTIONS
  3381. 3.6.8 Output Section Attributes
  3382. -------------------------------
  3383. We showed above that the full description of an output section looked
  3384. like this:
  3385. SECTION [ADDRESS] [(TYPE)] :
  3386. [AT(LMA)]
  3387. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3388. [SUBALIGN(SUBSECTION_ALIGN)]
  3389. [CONSTRAINT]
  3390. {
  3391. OUTPUT-SECTION-COMMAND
  3392. OUTPUT-SECTION-COMMAND
  3393. ...
  3394. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP]
  3395. We've already described SECTION, ADDRESS, and OUTPUT-SECTION-COMMAND.
  3396. In this section we will describe the remaining section attributes.
  3397. * Menu:
  3398. * Output Section Type:: Output section type
  3399. * Output Section LMA:: Output section LMA
  3400. * Forced Output Alignment:: Forced Output Alignment
  3401. * Forced Input Alignment:: Forced Input Alignment
  3402. * Output Section Constraint:: Output section constraint
  3403. * Output Section Region:: Output section region
  3404. * Output Section Phdr:: Output section phdr
  3405. * Output Section Fill:: Output section fill
  3406. 
  3407. File: ld.info, Node: Output Section Type, Next: Output Section LMA, Up: Output Section Attributes
  3408. 3.6.8.1 Output Section Type
  3409. ...........................
  3410. Each output section may have a type. The type is a keyword in
  3411. parentheses. The following types are defined:
  3412. 'NOLOAD'
  3413. The section should be marked as not loadable, so that it will not
  3414. be loaded into memory when the program is run.
  3415. 'DSECT'
  3416. 'COPY'
  3417. 'INFO'
  3418. 'OVERLAY'
  3419. These type names are supported for backward compatibility, and are
  3420. rarely used. They all have the same effect: the section should be
  3421. marked as not allocatable, so that no memory is allocated for the
  3422. section when the program is run.
  3423. The linker normally sets the attributes of an output section based on
  3424. the input sections which map into it. You can override this by using
  3425. the section type. For example, in the script sample below, the 'ROM'
  3426. section is addressed at memory location '0' and does not need to be
  3427. loaded when the program is run.
  3428. SECTIONS {
  3429. ROM 0 (NOLOAD) : { ... }
  3430. ...
  3431. }
  3432. 
  3433. File: ld.info, Node: Output Section LMA, Next: Forced Output Alignment, Prev: Output Section Type, Up: Output Section Attributes
  3434. 3.6.8.2 Output Section LMA
  3435. ..........................
  3436. Every section has a virtual address (VMA) and a load address (LMA); see
  3437. *note Basic Script Concepts::. The virtual address is specified by the
  3438. *note Output Section Address:: described earlier. The load address is
  3439. specified by the 'AT' or 'AT>' keywords. Specifying a load address is
  3440. optional.
  3441. The 'AT' keyword takes an expression as an argument. This specifies
  3442. the exact load address of the section. The 'AT>' keyword takes the name
  3443. of a memory region as an argument. *Note MEMORY::. The load address of
  3444. the section is set to the next free address in the region, aligned to
  3445. the section's alignment requirements.
  3446. If neither 'AT' nor 'AT>' is specified for an allocatable section,
  3447. the linker will use the following heuristic to determine the load
  3448. address:
  3449. * If the section has a specific VMA address, then this is used as the
  3450. LMA address as well.
  3451. * If the section is not allocatable then its LMA is set to its VMA.
  3452. * Otherwise if a memory region can be found that is compatible with
  3453. the current section, and this region contains at least one section,
  3454. then the LMA is set so the difference between the VMA and LMA is
  3455. the same as the difference between the VMA and LMA of the last
  3456. section in the located region.
  3457. * If no memory regions have been declared then a default region that
  3458. covers the entire address space is used in the previous step.
  3459. * If no suitable region could be found, or there was no previous
  3460. section then the LMA is set equal to the VMA.
  3461. This feature is designed to make it easy to build a ROM image. For
  3462. example, the following linker script creates three output sections: one
  3463. called '.text', which starts at '0x1000', one called '.mdata', which is
  3464. loaded at the end of the '.text' section even though its VMA is
  3465. '0x2000', and one called '.bss' to hold uninitialized data at address
  3466. '0x3000'. The symbol '_data' is defined with the value '0x2000', which
  3467. shows that the location counter holds the VMA value, not the LMA value.
  3468. SECTIONS
  3469. {
  3470. .text 0x1000 : { *(.text) _etext = . ; }
  3471. .mdata 0x2000 :
  3472. AT ( ADDR (.text) + SIZEOF (.text) )
  3473. { _data = . ; *(.data); _edata = . ; }
  3474. .bss 0x3000 :
  3475. { _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;}
  3476. }
  3477. The run-time initialization code for use with a program generated
  3478. with this linker script would include something like the following, to
  3479. copy the initialized data from the ROM image to its runtime address.
  3480. Notice how this code takes advantage of the symbols defined by the
  3481. linker script.
  3482. extern char _etext, _data, _edata, _bstart, _bend;
  3483. char *src = &_etext;
  3484. char *dst = &_data;
  3485. /* ROM has data at end of text; copy it. */
  3486. while (dst < &_edata)
  3487. *dst++ = *src++;
  3488. /* Zero bss. */
  3489. for (dst = &_bstart; dst< &_bend; dst++)
  3490. *dst = 0;
  3491. 
  3492. File: ld.info, Node: Forced Output Alignment, Next: Forced Input Alignment, Prev: Output Section LMA, Up: Output Section Attributes
  3493. 3.6.8.3 Forced Output Alignment
  3494. ...............................
  3495. You can increase an output section's alignment by using ALIGN. As an
  3496. alternative you can enforce that the difference between the VMA and LMA
  3497. remains intact throughout this output section with the ALIGN_WITH_INPUT
  3498. attribute.
  3499. 
  3500. File: ld.info, Node: Forced Input Alignment, Next: Output Section Constraint, Prev: Forced Output Alignment, Up: Output Section Attributes
  3501. 3.6.8.4 Forced Input Alignment
  3502. ..............................
  3503. You can force input section alignment within an output section by using
  3504. SUBALIGN. The value specified overrides any alignment given by input
  3505. sections, whether larger or smaller.
  3506. 
  3507. File: ld.info, Node: Output Section Constraint, Next: Output Section Region, Prev: Forced Input Alignment, Up: Output Section Attributes
  3508. 3.6.8.5 Output Section Constraint
  3509. .................................
  3510. You can specify that an output section should only be created if all of
  3511. its input sections are read-only or all of its input sections are
  3512. read-write by using the keyword 'ONLY_IF_RO' and 'ONLY_IF_RW'
  3513. respectively.
  3514. 
  3515. File: ld.info, Node: Output Section Region, Next: Output Section Phdr, Prev: Output Section Constraint, Up: Output Section Attributes
  3516. 3.6.8.6 Output Section Region
  3517. .............................
  3518. You can assign a section to a previously defined region of memory by
  3519. using '>REGION'. *Note MEMORY::.
  3520. Here is a simple example:
  3521. MEMORY { rom : ORIGIN = 0x1000, LENGTH = 0x1000 }
  3522. SECTIONS { ROM : { *(.text) } >rom }
  3523. 
  3524. File: ld.info, Node: Output Section Phdr, Next: Output Section Fill, Prev: Output Section Region, Up: Output Section Attributes
  3525. 3.6.8.7 Output Section Phdr
  3526. ...........................
  3527. You can assign a section to a previously defined program segment by
  3528. using ':PHDR'. *Note PHDRS::. If a section is assigned to one or more
  3529. segments, then all subsequent allocated sections will be assigned to
  3530. those segments as well, unless they use an explicitly ':PHDR' modifier.
  3531. You can use ':NONE' to tell the linker to not put the section in any
  3532. segment at all.
  3533. Here is a simple example:
  3534. PHDRS { text PT_LOAD ; }
  3535. SECTIONS { .text : { *(.text) } :text }
  3536. 
  3537. File: ld.info, Node: Output Section Fill, Prev: Output Section Phdr, Up: Output Section Attributes
  3538. 3.6.8.8 Output Section Fill
  3539. ...........................
  3540. You can set the fill pattern for an entire section by using '=FILLEXP'.
  3541. FILLEXP is an expression (*note Expressions::). Any otherwise
  3542. unspecified regions of memory within the output section (for example,
  3543. gaps left due to the required alignment of input sections) will be
  3544. filled with the value, repeated as necessary. If the fill expression is
  3545. a simple hex number, ie. a string of hex digit starting with '0x' and
  3546. without a trailing 'k' or 'M', then an arbitrarily long sequence of hex
  3547. digits can be used to specify the fill pattern; Leading zeros become
  3548. part of the pattern too. For all other cases, including extra
  3549. parentheses or a unary '+', the fill pattern is the four least
  3550. significant bytes of the value of the expression. In all cases, the
  3551. number is big-endian.
  3552. You can also change the fill value with a 'FILL' command in the
  3553. output section commands; (*note Output Section Data::).
  3554. Here is a simple example:
  3555. SECTIONS { .text : { *(.text) } =0x90909090 }
  3556. 
  3557. File: ld.info, Node: Overlay Description, Prev: Output Section Attributes, Up: SECTIONS
  3558. 3.6.9 Overlay Description
  3559. -------------------------
  3560. An overlay description provides an easy way to describe sections which
  3561. are to be loaded as part of a single memory image but are to be run at
  3562. the same memory address. At run time, some sort of overlay manager will
  3563. copy the overlaid sections in and out of the runtime memory address as
  3564. required, perhaps by simply manipulating addressing bits. This approach
  3565. can be useful, for example, when a certain region of memory is faster
  3566. than another.
  3567. Overlays are described using the 'OVERLAY' command. The 'OVERLAY'
  3568. command is used within a 'SECTIONS' command, like an output section
  3569. description. The full syntax of the 'OVERLAY' command is as follows:
  3570. OVERLAY [START] : [NOCROSSREFS] [AT ( LDADDR )]
  3571. {
  3572. SECNAME1
  3573. {
  3574. OUTPUT-SECTION-COMMAND
  3575. OUTPUT-SECTION-COMMAND
  3576. ...
  3577. } [:PHDR...] [=FILL]
  3578. SECNAME2
  3579. {
  3580. OUTPUT-SECTION-COMMAND
  3581. OUTPUT-SECTION-COMMAND
  3582. ...
  3583. } [:PHDR...] [=FILL]
  3584. ...
  3585. } [>REGION] [:PHDR...] [=FILL] [,]
  3586. Everything is optional except 'OVERLAY' (a keyword), and each section
  3587. must have a name (SECNAME1 and SECNAME2 above). The section definitions
  3588. within the 'OVERLAY' construct are identical to those within the general
  3589. 'SECTIONS' construct (*note SECTIONS::), except that no addresses and no
  3590. memory regions may be defined for sections within an 'OVERLAY'.
  3591. The comma at the end may be required if a FILL is used and the next
  3592. SECTIONS-COMMAND looks like a continuation of the expression.
  3593. The sections are all defined with the same starting address. The
  3594. load addresses of the sections are arranged such that they are
  3595. consecutive in memory starting at the load address used for the
  3596. 'OVERLAY' as a whole (as with normal section definitions, the load
  3597. address is optional, and defaults to the start address; the start
  3598. address is also optional, and defaults to the current value of the
  3599. location counter).
  3600. If the 'NOCROSSREFS' keyword is used, and there are any references
  3601. among the sections, the linker will report an error. Since the sections
  3602. all run at the same address, it normally does not make sense for one
  3603. section to refer directly to another. *Note NOCROSSREFS: Miscellaneous
  3604. Commands.
  3605. For each section within the 'OVERLAY', the linker automatically
  3606. provides two symbols. The symbol '__load_start_SECNAME' is defined as
  3607. the starting load address of the section. The symbol
  3608. '__load_stop_SECNAME' is defined as the final load address of the
  3609. section. Any characters within SECNAME which are not legal within C
  3610. identifiers are removed. C (or assembler) code may use these symbols to
  3611. move the overlaid sections around as necessary.
  3612. At the end of the overlay, the value of the location counter is set
  3613. to the start address of the overlay plus the size of the largest
  3614. section.
  3615. Here is an example. Remember that this would appear inside a
  3616. 'SECTIONS' construct.
  3617. OVERLAY 0x1000 : AT (0x4000)
  3618. {
  3619. .text0 { o1/*.o(.text) }
  3620. .text1 { o2/*.o(.text) }
  3621. }
  3622. This will define both '.text0' and '.text1' to start at address 0x1000.
  3623. '.text0' will be loaded at address 0x4000, and '.text1' will be loaded
  3624. immediately after '.text0'. The following symbols will be defined if
  3625. referenced: '__load_start_text0', '__load_stop_text0',
  3626. '__load_start_text1', '__load_stop_text1'.
  3627. C code to copy overlay '.text1' into the overlay area might look like
  3628. the following.
  3629. extern char __load_start_text1, __load_stop_text1;
  3630. memcpy ((char *) 0x1000, &__load_start_text1,
  3631. &__load_stop_text1 - &__load_start_text1);
  3632. Note that the 'OVERLAY' command is just syntactic sugar, since
  3633. everything it does can be done using the more basic commands. The above
  3634. example could have been written identically as follows.
  3635. .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
  3636. PROVIDE (__load_start_text0 = LOADADDR (.text0));
  3637. PROVIDE (__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0));
  3638. .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
  3639. PROVIDE (__load_start_text1 = LOADADDR (.text1));
  3640. PROVIDE (__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1));
  3641. . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
  3642. 
  3643. File: ld.info, Node: MEMORY, Next: PHDRS, Prev: SECTIONS, Up: Scripts
  3644. 3.7 MEMORY Command
  3645. ==================
  3646. The linker's default configuration permits allocation of all available
  3647. memory. You can override this by using the 'MEMORY' command.
  3648. The 'MEMORY' command describes the location and size of blocks of
  3649. memory in the target. You can use it to describe which memory regions
  3650. may be used by the linker, and which memory regions it must avoid. You
  3651. can then assign sections to particular memory regions. The linker will
  3652. set section addresses based on the memory regions, and will warn about
  3653. regions that become too full. The linker will not shuffle sections
  3654. around to fit into the available regions.
  3655. A linker script may contain many uses of the 'MEMORY' command,
  3656. however, all memory blocks defined are treated as if they were specified
  3657. inside a single 'MEMORY' command. The syntax for 'MEMORY' is:
  3658. MEMORY
  3659. {
  3660. NAME [(ATTR)] : ORIGIN = ORIGIN, LENGTH = LEN
  3661. ...
  3662. }
  3663. The NAME is a name used in the linker script to refer to the region.
  3664. The region name has no meaning outside of the linker script. Region
  3665. names are stored in a separate name space, and will not conflict with
  3666. symbol names, file names, or section names. Each memory region must
  3667. have a distinct name within the 'MEMORY' command. However you can add
  3668. later alias names to existing memory regions with the *note
  3669. REGION_ALIAS:: command.
  3670. The ATTR string is an optional list of attributes that specify
  3671. whether to use a particular memory region for an input section which is
  3672. not explicitly mapped in the linker script. As described in *note
  3673. SECTIONS::, if you do not specify an output section for some input
  3674. section, the linker will create an output section with the same name as
  3675. the input section. If you define region attributes, the linker will use
  3676. them to select the memory region for the output section that it creates.
  3677. The ATTR string must consist only of the following characters:
  3678. 'R'
  3679. Read-only section
  3680. 'W'
  3681. Read/write section
  3682. 'X'
  3683. Executable section
  3684. 'A'
  3685. Allocatable section
  3686. 'I'
  3687. Initialized section
  3688. 'L'
  3689. Same as 'I'
  3690. '!'
  3691. Invert the sense of any of the attributes that follow
  3692. If an unmapped section matches any of the listed attributes other
  3693. than '!', it will be placed in the memory region. The '!' attribute
  3694. reverses the test for the characters that follow, so that an unmapped
  3695. section will be placed in the memory region only if it does not match
  3696. any of the attributes listed afterwards. Thus an attribute string of
  3697. 'RW!X' will match any unmapped section that has either or both of the
  3698. 'R' and 'W' attributes, but only as long as the section does not also
  3699. have the 'X' attribute.
  3700. The ORIGIN is an numerical expression for the start address of the
  3701. memory region. The expression must evaluate to a constant and it cannot
  3702. involve any symbols. The keyword 'ORIGIN' may be abbreviated to 'org'
  3703. or 'o' (but not, for example, 'ORG').
  3704. The LEN is an expression for the size in bytes of the memory region.
  3705. As with the ORIGIN expression, the expression must be numerical only and
  3706. must evaluate to a constant. The keyword 'LENGTH' may be abbreviated to
  3707. 'len' or 'l'.
  3708. In the following example, we specify that there are two memory
  3709. regions available for allocation: one starting at '0' for 256 kilobytes,
  3710. and the other starting at '0x40000000' for four megabytes. The linker
  3711. will place into the 'rom' memory region every section which is not
  3712. explicitly mapped into a memory region, and is either read-only or
  3713. executable. The linker will place other sections which are not
  3714. explicitly mapped into a memory region into the 'ram' memory region.
  3715. MEMORY
  3716. {
  3717. rom (rx) : ORIGIN = 0, LENGTH = 256K
  3718. ram (!rx) : org = 0x40000000, l = 4M
  3719. }
  3720. Once you define a memory region, you can direct the linker to place
  3721. specific output sections into that memory region by using the '>REGION'
  3722. output section attribute. For example, if you have a memory region
  3723. named 'mem', you would use '>mem' in the output section definition.
  3724. *Note Output Section Region::. If no address was specified for the
  3725. output section, the linker will set the address to the next available
  3726. address within the memory region. If the combined output sections
  3727. directed to a memory region are too large for the region, the linker
  3728. will issue an error message.
  3729. It is possible to access the origin and length of a memory in an
  3730. expression via the 'ORIGIN(MEMORY)' and 'LENGTH(MEMORY)' functions:
  3731. _fstack = ORIGIN(ram) + LENGTH(ram) - 4;
  3732. 
  3733. File: ld.info, Node: PHDRS, Next: VERSION, Prev: MEMORY, Up: Scripts
  3734. 3.8 PHDRS Command
  3735. =================
  3736. The ELF object file format uses "program headers", also knows as
  3737. "segments". The program headers describe how the program should be
  3738. loaded into memory. You can print them out by using the 'objdump'
  3739. program with the '-p' option.
  3740. When you run an ELF program on a native ELF system, the system loader
  3741. reads the program headers in order to figure out how to load the
  3742. program. This will only work if the program headers are set correctly.
  3743. This manual does not describe the details of how the system loader
  3744. interprets program headers; for more information, see the ELF ABI.
  3745. The linker will create reasonable program headers by default.
  3746. However, in some cases, you may need to specify the program headers more
  3747. precisely. You may use the 'PHDRS' command for this purpose. When the
  3748. linker sees the 'PHDRS' command in the linker script, it will not create
  3749. any program headers other than the ones specified.
  3750. The linker only pays attention to the 'PHDRS' command when generating
  3751. an ELF output file. In other cases, the linker will simply ignore
  3752. 'PHDRS'.
  3753. This is the syntax of the 'PHDRS' command. The words 'PHDRS',
  3754. 'FILEHDR', 'AT', and 'FLAGS' are keywords.
  3755. PHDRS
  3756. {
  3757. NAME TYPE [ FILEHDR ] [ PHDRS ] [ AT ( ADDRESS ) ]
  3758. [ FLAGS ( FLAGS ) ] ;
  3759. }
  3760. The NAME is used only for reference in the 'SECTIONS' command of the
  3761. linker script. It is not put into the output file. Program header
  3762. names are stored in a separate name space, and will not conflict with
  3763. symbol names, file names, or section names. Each program header must
  3764. have a distinct name. The headers are processed in order and it is
  3765. usual for them to map to sections in ascending load address order.
  3766. Certain program header types describe segments of memory which the
  3767. system loader will load from the file. In the linker script, you
  3768. specify the contents of these segments by placing allocatable output
  3769. sections in the segments. You use the ':PHDR' output section attribute
  3770. to place a section in a particular segment. *Note Output Section
  3771. Phdr::.
  3772. It is normal to put certain sections in more than one segment. This
  3773. merely implies that one segment of memory contains another. You may
  3774. repeat ':PHDR', using it once for each segment which should contain the
  3775. section.
  3776. If you place a section in one or more segments using ':PHDR', then
  3777. the linker will place all subsequent allocatable sections which do not
  3778. specify ':PHDR' in the same segments. This is for convenience, since
  3779. generally a whole set of contiguous sections will be placed in a single
  3780. segment. You can use ':NONE' to override the default segment and tell
  3781. the linker to not put the section in any segment at all.
  3782. You may use the 'FILEHDR' and 'PHDRS' keywords after the program
  3783. header type to further describe the contents of the segment. The
  3784. 'FILEHDR' keyword means that the segment should include the ELF file
  3785. header. The 'PHDRS' keyword means that the segment should include the
  3786. ELF program headers themselves. If applied to a loadable segment
  3787. ('PT_LOAD'), all prior loadable segments must have one of these
  3788. keywords.
  3789. The TYPE may be one of the following. The numbers indicate the value
  3790. of the keyword.
  3791. 'PT_NULL' (0)
  3792. Indicates an unused program header.
  3793. 'PT_LOAD' (1)
  3794. Indicates that this program header describes a segment to be loaded
  3795. from the file.
  3796. 'PT_DYNAMIC' (2)
  3797. Indicates a segment where dynamic linking information can be found.
  3798. 'PT_INTERP' (3)
  3799. Indicates a segment where the name of the program interpreter may
  3800. be found.
  3801. 'PT_NOTE' (4)
  3802. Indicates a segment holding note information.
  3803. 'PT_SHLIB' (5)
  3804. A reserved program header type, defined but not specified by the
  3805. ELF ABI.
  3806. 'PT_PHDR' (6)
  3807. Indicates a segment where the program headers may be found.
  3808. 'PT_TLS' (7)
  3809. Indicates a segment containing thread local storage.
  3810. EXPRESSION
  3811. An expression giving the numeric type of the program header. This
  3812. may be used for types not defined above.
  3813. You can specify that a segment should be loaded at a particular
  3814. address in memory by using an 'AT' expression. This is identical to the
  3815. 'AT' command used as an output section attribute (*note Output Section
  3816. LMA::). The 'AT' command for a program header overrides the output
  3817. section attribute.
  3818. The linker will normally set the segment flags based on the sections
  3819. which comprise the segment. You may use the 'FLAGS' keyword to
  3820. explicitly specify the segment flags. The value of FLAGS must be an
  3821. integer. It is used to set the 'p_flags' field of the program header.
  3822. Here is an example of 'PHDRS'. This shows a typical set of program
  3823. headers used on a native ELF system.
  3824. PHDRS
  3825. {
  3826. headers PT_PHDR PHDRS ;
  3827. interp PT_INTERP ;
  3828. text PT_LOAD FILEHDR PHDRS ;
  3829. data PT_LOAD ;
  3830. dynamic PT_DYNAMIC ;
  3831. }
  3832. SECTIONS
  3833. {
  3834. . = SIZEOF_HEADERS;
  3835. .interp : { *(.interp) } :text :interp
  3836. .text : { *(.text) } :text
  3837. .rodata : { *(.rodata) } /* defaults to :text */
  3838. ...
  3839. . = . + 0x1000; /* move to a new page in memory */
  3840. .data : { *(.data) } :data
  3841. .dynamic : { *(.dynamic) } :data :dynamic
  3842. ...
  3843. }
  3844. 
  3845. File: ld.info, Node: VERSION, Next: Expressions, Prev: PHDRS, Up: Scripts
  3846. 3.9 VERSION Command
  3847. ===================
  3848. The linker supports symbol versions when using ELF. Symbol versions are
  3849. only useful when using shared libraries. The dynamic linker can use
  3850. symbol versions to select a specific version of a function when it runs
  3851. a program that may have been linked against an earlier version of the
  3852. shared library.
  3853. You can include a version script directly in the main linker script,
  3854. or you can supply the version script as an implicit linker script. You
  3855. can also use the '--version-script' linker option.
  3856. The syntax of the 'VERSION' command is simply
  3857. VERSION { version-script-commands }
  3858. The format of the version script commands is identical to that used
  3859. by Sun's linker in Solaris 2.5. The version script defines a tree of
  3860. version nodes. You specify the node names and interdependencies in the
  3861. version script. You can specify which symbols are bound to which
  3862. version nodes, and you can reduce a specified set of symbols to local
  3863. scope so that they are not globally visible outside of the shared
  3864. library.
  3865. The easiest way to demonstrate the version script language is with a
  3866. few examples.
  3867. VERS_1.1 {
  3868. global:
  3869. foo1;
  3870. local:
  3871. old*;
  3872. original*;
  3873. new*;
  3874. };
  3875. VERS_1.2 {
  3876. foo2;
  3877. } VERS_1.1;
  3878. VERS_2.0 {
  3879. bar1; bar2;
  3880. extern "C++" {
  3881. ns::*;
  3882. "f(int, double)";
  3883. };
  3884. } VERS_1.2;
  3885. This example version script defines three version nodes. The first
  3886. version node defined is 'VERS_1.1'; it has no other dependencies. The
  3887. script binds the symbol 'foo1' to 'VERS_1.1'. It reduces a number of
  3888. symbols to local scope so that they are not visible outside of the
  3889. shared library; this is done using wildcard patterns, so that any symbol
  3890. whose name begins with 'old', 'original', or 'new' is matched. The
  3891. wildcard patterns available are the same as those used in the shell when
  3892. matching filenames (also known as "globbing"). However, if you specify
  3893. the symbol name inside double quotes, then the name is treated as
  3894. literal, rather than as a glob pattern.
  3895. Next, the version script defines node 'VERS_1.2'. This node depends
  3896. upon 'VERS_1.1'. The script binds the symbol 'foo2' to the version node
  3897. 'VERS_1.2'.
  3898. Finally, the version script defines node 'VERS_2.0'. This node
  3899. depends upon 'VERS_1.2'. The scripts binds the symbols 'bar1' and
  3900. 'bar2' are bound to the version node 'VERS_2.0'.
  3901. When the linker finds a symbol defined in a library which is not
  3902. specifically bound to a version node, it will effectively bind it to an
  3903. unspecified base version of the library. You can bind all otherwise
  3904. unspecified symbols to a given version node by using 'global: *;'
  3905. somewhere in the version script. Note that it's slightly crazy to use
  3906. wildcards in a global spec except on the last version node. Global
  3907. wildcards elsewhere run the risk of accidentally adding symbols to the
  3908. set exported for an old version. That's wrong since older versions
  3909. ought to have a fixed set of symbols.
  3910. The names of the version nodes have no specific meaning other than
  3911. what they might suggest to the person reading them. The '2.0' version
  3912. could just as well have appeared in between '1.1' and '1.2'. However,
  3913. this would be a confusing way to write a version script.
  3914. Node name can be omitted, provided it is the only version node in the
  3915. version script. Such version script doesn't assign any versions to
  3916. symbols, only selects which symbols will be globally visible out and
  3917. which won't.
  3918. { global: foo; bar; local: *; };
  3919. When you link an application against a shared library that has
  3920. versioned symbols, the application itself knows which version of each
  3921. symbol it requires, and it also knows which version nodes it needs from
  3922. each shared library it is linked against. Thus at runtime, the dynamic
  3923. loader can make a quick check to make sure that the libraries you have
  3924. linked against do in fact supply all of the version nodes that the
  3925. application will need to resolve all of the dynamic symbols. In this
  3926. way it is possible for the dynamic linker to know with certainty that
  3927. all external symbols that it needs will be resolvable without having to
  3928. search for each symbol reference.
  3929. The symbol versioning is in effect a much more sophisticated way of
  3930. doing minor version checking that SunOS does. The fundamental problem
  3931. that is being addressed here is that typically references to external
  3932. functions are bound on an as-needed basis, and are not all bound when
  3933. the application starts up. If a shared library is out of date, a
  3934. required interface may be missing; when the application tries to use
  3935. that interface, it may suddenly and unexpectedly fail. With symbol
  3936. versioning, the user will get a warning when they start their program if
  3937. the libraries being used with the application are too old.
  3938. There are several GNU extensions to Sun's versioning approach. The
  3939. first of these is the ability to bind a symbol to a version node in the
  3940. source file where the symbol is defined instead of in the versioning
  3941. script. This was done mainly to reduce the burden on the library
  3942. maintainer. You can do this by putting something like:
  3943. __asm__(".symver original_foo,foo@VERS_1.1");
  3944. in the C source file. This renames the function 'original_foo' to be an
  3945. alias for 'foo' bound to the version node 'VERS_1.1'. The 'local:'
  3946. directive can be used to prevent the symbol 'original_foo' from being
  3947. exported. A '.symver' directive takes precedence over a version script.
  3948. The second GNU extension is to allow multiple versions of the same
  3949. function to appear in a given shared library. In this way you can make
  3950. an incompatible change to an interface without increasing the major
  3951. version number of the shared library, while still allowing applications
  3952. linked against the old interface to continue to function.
  3953. To do this, you must use multiple '.symver' directives in the source
  3954. file. Here is an example:
  3955. __asm__(".symver original_foo,foo@");
  3956. __asm__(".symver old_foo,foo@VERS_1.1");
  3957. __asm__(".symver old_foo1,foo@VERS_1.2");
  3958. __asm__(".symver new_foo,foo@@VERS_2.0");
  3959. In this example, 'foo@' represents the symbol 'foo' bound to the
  3960. unspecified base version of the symbol. The source file that contains
  3961. this example would define 4 C functions: 'original_foo', 'old_foo',
  3962. 'old_foo1', and 'new_foo'.
  3963. When you have multiple definitions of a given symbol, there needs to
  3964. be some way to specify a default version to which external references to
  3965. this symbol will be bound. You can do this with the 'foo@@VERS_2.0'
  3966. type of '.symver' directive. You can only declare one version of a
  3967. symbol as the default in this manner; otherwise you would effectively
  3968. have multiple definitions of the same symbol.
  3969. If you wish to bind a reference to a specific version of the symbol
  3970. within the shared library, you can use the aliases of convenience (i.e.,
  3971. 'old_foo'), or you can use the '.symver' directive to specifically bind
  3972. to an external version of the function in question.
  3973. You can also specify the language in the version script:
  3974. VERSION extern "lang" { version-script-commands }
  3975. The supported 'lang's are 'C', 'C++', and 'Java'. The linker will
  3976. iterate over the list of symbols at the link time and demangle them
  3977. according to 'lang' before matching them to the patterns specified in
  3978. 'version-script-commands'. The default 'lang' is 'C'.
  3979. Demangled names may contains spaces and other special characters. As
  3980. described above, you can use a glob pattern to match demangled names, or
  3981. you can use a double-quoted string to match the string exactly. In the
  3982. latter case, be aware that minor differences (such as differing
  3983. whitespace) between the version script and the demangler output will
  3984. cause a mismatch. As the exact string generated by the demangler might
  3985. change in the future, even if the mangled name does not, you should
  3986. check that all of your version directives are behaving as you expect
  3987. when you upgrade.
  3988. 
  3989. File: ld.info, Node: Expressions, Next: Implicit Linker Scripts, Prev: VERSION, Up: Scripts
  3990. 3.10 Expressions in Linker Scripts
  3991. ==================================
  3992. The syntax for expressions in the linker script language is identical to
  3993. that of C expressions. All expressions are evaluated as integers. All
  3994. expressions are evaluated in the same size, which is 32 bits if both the
  3995. host and target are 32 bits, and is otherwise 64 bits.
  3996. You can use and set symbol values in expressions.
  3997. The linker defines several special purpose builtin functions for use
  3998. in expressions.
  3999. * Menu:
  4000. * Constants:: Constants
  4001. * Symbolic Constants:: Symbolic constants
  4002. * Symbols:: Symbol Names
  4003. * Orphan Sections:: Orphan Sections
  4004. * Location Counter:: The Location Counter
  4005. * Operators:: Operators
  4006. * Evaluation:: Evaluation
  4007. * Expression Section:: The Section of an Expression
  4008. * Builtin Functions:: Builtin Functions
  4009. 
  4010. File: ld.info, Node: Constants, Next: Symbolic Constants, Up: Expressions
  4011. 3.10.1 Constants
  4012. ----------------
  4013. All constants are integers.
  4014. As in C, the linker considers an integer beginning with '0' to be
  4015. octal, and an integer beginning with '0x' or '0X' to be hexadecimal.
  4016. Alternatively the linker accepts suffixes of 'h' or 'H' for hexadecimal,
  4017. 'o' or 'O' for octal, 'b' or 'B' for binary and 'd' or 'D' for decimal.
  4018. Any integer value without a prefix or a suffix is considered to be
  4019. decimal.
  4020. In addition, you can use the suffixes 'K' and 'M' to scale a constant
  4021. by '1024' or '1024*1024' respectively. For example, the following all
  4022. refer to the same quantity:
  4023. _fourk_1 = 4K;
  4024. _fourk_2 = 4096;
  4025. _fourk_3 = 0x1000;
  4026. _fourk_4 = 10000o;
  4027. Note - the 'K' and 'M' suffixes cannot be used in conjunction with
  4028. the base suffixes mentioned above.
  4029. 
  4030. File: ld.info, Node: Symbolic Constants, Next: Symbols, Prev: Constants, Up: Expressions
  4031. 3.10.2 Symbolic Constants
  4032. -------------------------
  4033. It is possible to refer to target-specific constants via the use of the
  4034. 'CONSTANT(NAME)' operator, where NAME is one of:
  4035. 'MAXPAGESIZE'
  4036. The target's maximum page size.
  4037. 'COMMONPAGESIZE'
  4038. The target's default page size.
  4039. So for example:
  4040. .text ALIGN (CONSTANT (MAXPAGESIZE)) : { *(.text) }
  4041. will create a text section aligned to the largest page boundary
  4042. supported by the target.
  4043. 
  4044. File: ld.info, Node: Symbols, Next: Orphan Sections, Prev: Symbolic Constants, Up: Expressions
  4045. 3.10.3 Symbol Names
  4046. -------------------
  4047. Unless quoted, symbol names start with a letter, underscore, or period
  4048. and may include letters, digits, underscores, periods, and hyphens.
  4049. Unquoted symbol names must not conflict with any keywords. You can
  4050. specify a symbol which contains odd characters or has the same name as a
  4051. keyword by surrounding the symbol name in double quotes:
  4052. "SECTION" = 9;
  4053. "with a space" = "also with a space" + 10;
  4054. Since symbols can contain many non-alphabetic characters, it is
  4055. safest to delimit symbols with spaces. For example, 'A-B' is one
  4056. symbol, whereas 'A - B' is an expression involving subtraction.
  4057. 
  4058. File: ld.info, Node: Orphan Sections, Next: Location Counter, Prev: Symbols, Up: Expressions
  4059. 3.10.4 Orphan Sections
  4060. ----------------------
  4061. Orphan sections are sections present in the input files which are not
  4062. explicitly placed into the output file by the linker script. The linker
  4063. will still copy these sections into the output file by either finding,
  4064. or creating a suitable output section in which to place the orphaned
  4065. input section.
  4066. If the name of an orphaned input section exactly matches the name of
  4067. an existing output section, then the orphaned input section will be
  4068. placed at the end of that output section.
  4069. If there is no output section with a matching name then new output
  4070. sections will be created. Each new output section will have the same
  4071. name as the orphan section placed within it. If there are multiple
  4072. orphan sections with the same name, these will all be combined into one
  4073. new output section.
  4074. If new output sections are created to hold orphaned input sections,
  4075. then the linker must decide where to place these new output sections in
  4076. relation to existing output sections. On most modern targets, the
  4077. linker attempts to place orphan sections after sections of the same
  4078. attribute, such as code vs data, loadable vs non-loadable, etc. If no
  4079. sections with matching attributes are found, or your target lacks this
  4080. support, the orphan section is placed at the end of the file.
  4081. The command-line options '--orphan-handling' and '--unique' (*note
  4082. Command-line Options: Options.) can be used to control which output
  4083. sections an orphan is placed in.
  4084. 
  4085. File: ld.info, Node: Location Counter, Next: Operators, Prev: Orphan Sections, Up: Expressions
  4086. 3.10.5 The Location Counter
  4087. ---------------------------
  4088. The special linker variable "dot" '.' always contains the current output
  4089. location counter. Since the '.' always refers to a location in an
  4090. output section, it may only appear in an expression within a 'SECTIONS'
  4091. command. The '.' symbol may appear anywhere that an ordinary symbol is
  4092. allowed in an expression.
  4093. Assigning a value to '.' will cause the location counter to be moved.
  4094. This may be used to create holes in the output section. The location
  4095. counter may not be moved backwards inside an output section, and may not
  4096. be moved backwards outside of an output section if so doing creates
  4097. areas with overlapping LMAs.
  4098. SECTIONS
  4099. {
  4100. output :
  4101. {
  4102. file1(.text)
  4103. . = . + 1000;
  4104. file2(.text)
  4105. . += 1000;
  4106. file3(.text)
  4107. } = 0x12345678;
  4108. }
  4109. In the previous example, the '.text' section from 'file1' is located at
  4110. the beginning of the output section 'output'. It is followed by a 1000
  4111. byte gap. Then the '.text' section from 'file2' appears, also with a
  4112. 1000 byte gap following before the '.text' section from 'file3'. The
  4113. notation '= 0x12345678' specifies what data to write in the gaps (*note
  4114. Output Section Fill::).
  4115. Note: '.' actually refers to the byte offset from the start of the
  4116. current containing object. Normally this is the 'SECTIONS' statement,
  4117. whose start address is 0, hence '.' can be used as an absolute address.
  4118. If '.' is used inside a section description however, it refers to the
  4119. byte offset from the start of that section, not an absolute address.
  4120. Thus in a script like this:
  4121. SECTIONS
  4122. {
  4123. . = 0x100
  4124. .text: {
  4125. *(.text)
  4126. . = 0x200
  4127. }
  4128. . = 0x500
  4129. .data: {
  4130. *(.data)
  4131. . += 0x600
  4132. }
  4133. }
  4134. The '.text' section will be assigned a starting address of 0x100 and
  4135. a size of exactly 0x200 bytes, even if there is not enough data in the
  4136. '.text' input sections to fill this area. (If there is too much data,
  4137. an error will be produced because this would be an attempt to move '.'
  4138. backwards). The '.data' section will start at 0x500 and it will have an
  4139. extra 0x600 bytes worth of space after the end of the values from the
  4140. '.data' input sections and before the end of the '.data' output section
  4141. itself.
  4142. Setting symbols to the value of the location counter outside of an
  4143. output section statement can result in unexpected values if the linker
  4144. needs to place orphan sections. For example, given the following:
  4145. SECTIONS
  4146. {
  4147. start_of_text = . ;
  4148. .text: { *(.text) }
  4149. end_of_text = . ;
  4150. start_of_data = . ;
  4151. .data: { *(.data) }
  4152. end_of_data = . ;
  4153. }
  4154. If the linker needs to place some input section, e.g. '.rodata', not
  4155. mentioned in the script, it might choose to place that section between
  4156. '.text' and '.data'. You might think the linker should place '.rodata'
  4157. on the blank line in the above script, but blank lines are of no
  4158. particular significance to the linker. As well, the linker doesn't
  4159. associate the above symbol names with their sections. Instead, it
  4160. assumes that all assignments or other statements belong to the previous
  4161. output section, except for the special case of an assignment to '.'.
  4162. I.e., the linker will place the orphan '.rodata' section as if the
  4163. script was written as follows:
  4164. SECTIONS
  4165. {
  4166. start_of_text = . ;
  4167. .text: { *(.text) }
  4168. end_of_text = . ;
  4169. start_of_data = . ;
  4170. .rodata: { *(.rodata) }
  4171. .data: { *(.data) }
  4172. end_of_data = . ;
  4173. }
  4174. This may or may not be the script author's intention for the value of
  4175. 'start_of_data'. One way to influence the orphan section placement is
  4176. to assign the location counter to itself, as the linker assumes that an
  4177. assignment to '.' is setting the start address of a following output
  4178. section and thus should be grouped with that section. So you could
  4179. write:
  4180. SECTIONS
  4181. {
  4182. start_of_text = . ;
  4183. .text: { *(.text) }
  4184. end_of_text = . ;
  4185. . = . ;
  4186. start_of_data = . ;
  4187. .data: { *(.data) }
  4188. end_of_data = . ;
  4189. }
  4190. Now, the orphan '.rodata' section will be placed between
  4191. 'end_of_text' and 'start_of_data'.
  4192. 
  4193. File: ld.info, Node: Operators, Next: Evaluation, Prev: Location Counter, Up: Expressions
  4194. 3.10.6 Operators
  4195. ----------------
  4196. The linker recognizes the standard C set of arithmetic operators, with
  4197. the standard bindings and precedence levels:
  4198. precedence associativity Operators Notes
  4199. (highest)
  4200. 1 left ! - ~ (1)
  4201. 2 left * / %
  4202. 3 left + -
  4203. 4 left >> <<
  4204. 5 left == != > < <= >=
  4205. 6 left &
  4206. 7 left |
  4207. 8 left &&
  4208. 9 left ||
  4209. 10 right ? :
  4210. 11 right &= += -= *= /= (2)
  4211. (lowest)
  4212. Notes: (1) Prefix operators (2) *Note Assignments::.
  4213. 
  4214. File: ld.info, Node: Evaluation, Next: Expression Section, Prev: Operators, Up: Expressions
  4215. 3.10.7 Evaluation
  4216. -----------------
  4217. The linker evaluates expressions lazily. It only computes the value of
  4218. an expression when absolutely necessary.
  4219. The linker needs some information, such as the value of the start
  4220. address of the first section, and the origins and lengths of memory
  4221. regions, in order to do any linking at all. These values are computed
  4222. as soon as possible when the linker reads in the linker script.
  4223. However, other values (such as symbol values) are not known or needed
  4224. until after storage allocation. Such values are evaluated later, when
  4225. other information (such as the sizes of output sections) is available
  4226. for use in the symbol assignment expression.
  4227. The sizes of sections cannot be known until after allocation, so
  4228. assignments dependent upon these are not performed until after
  4229. allocation.
  4230. Some expressions, such as those depending upon the location counter
  4231. '.', must be evaluated during section allocation.
  4232. If the result of an expression is required, but the value is not
  4233. available, then an error results. For example, a script like the
  4234. following
  4235. SECTIONS
  4236. {
  4237. .text 9+this_isnt_constant :
  4238. { *(.text) }
  4239. }
  4240. will cause the error message 'non constant expression for initial
  4241. address'.
  4242. 
  4243. File: ld.info, Node: Expression Section, Next: Builtin Functions, Prev: Evaluation, Up: Expressions
  4244. 3.10.8 The Section of an Expression
  4245. -----------------------------------
  4246. Addresses and symbols may be section relative, or absolute. A section
  4247. relative symbol is relocatable. If you request relocatable output using
  4248. the '-r' option, a further link operation may change the value of a
  4249. section relative symbol. On the other hand, an absolute symbol will
  4250. retain the same value throughout any further link operations.
  4251. Some terms in linker expressions are addresses. This is true of
  4252. section relative symbols and for builtin functions that return an
  4253. address, such as 'ADDR', 'LOADADDR', 'ORIGIN' and 'SEGMENT_START'.
  4254. Other terms are simply numbers, or are builtin functions that return a
  4255. non-address value, such as 'LENGTH'. One complication is that unless
  4256. you set 'LD_FEATURE ("SANE_EXPR")' (*note Miscellaneous Commands::),
  4257. numbers and absolute symbols are treated differently depending on their
  4258. location, for compatibility with older versions of 'ld'. Expressions
  4259. appearing outside an output section definition treat all numbers as
  4260. absolute addresses. Expressions appearing inside an output section
  4261. definition treat absolute symbols as numbers. If 'LD_FEATURE
  4262. ("SANE_EXPR")' is given, then absolute symbols and numbers are simply
  4263. treated as numbers everywhere.
  4264. In the following simple example,
  4265. SECTIONS
  4266. {
  4267. . = 0x100;
  4268. __executable_start = 0x100;
  4269. .data :
  4270. {
  4271. . = 0x10;
  4272. __data_start = 0x10;
  4273. *(.data)
  4274. }
  4275. ...
  4276. }
  4277. both '.' and '__executable_start' are set to the absolute address
  4278. 0x100 in the first two assignments, then both '.' and '__data_start' are
  4279. set to 0x10 relative to the '.data' section in the second two
  4280. assignments.
  4281. For expressions involving numbers, relative addresses and absolute
  4282. addresses, ld follows these rules to evaluate terms:
  4283. * Unary operations on an absolute address or number, and binary
  4284. operations on two absolute addresses or two numbers, or between one
  4285. absolute address and a number, apply the operator to the value(s).
  4286. * Unary operations on a relative address, and binary operations on
  4287. two relative addresses in the same section or between one relative
  4288. address and a number, apply the operator to the offset part of the
  4289. address(es).
  4290. * Other binary operations, that is, between two relative addresses
  4291. not in the same section, or between a relative address and an
  4292. absolute address, first convert any non-absolute term to an
  4293. absolute address before applying the operator.
  4294. The result section of each sub-expression is as follows:
  4295. * An operation involving only numbers results in a number.
  4296. * The result of comparisons, '&&' and '||' is also a number.
  4297. * The result of other binary arithmetic and logical operations on two
  4298. relative addresses in the same section or two absolute addresses
  4299. (after above conversions) is also a number when 'LD_FEATURE
  4300. ("SANE_EXPR")' or inside an output section definition but an
  4301. absolute address otherwise.
  4302. * The result of other operations on relative addresses or one
  4303. relative address and a number, is a relative address in the same
  4304. section as the relative operand(s).
  4305. * The result of other operations on absolute addresses (after above
  4306. conversions) is an absolute address.
  4307. You can use the builtin function 'ABSOLUTE' to force an expression to
  4308. be absolute when it would otherwise be relative. For example, to create
  4309. an absolute symbol set to the address of the end of the output section
  4310. '.data':
  4311. SECTIONS
  4312. {
  4313. .data : { *(.data) _edata = ABSOLUTE(.); }
  4314. }
  4315. If 'ABSOLUTE' were not used, '_edata' would be relative to the '.data'
  4316. section.
  4317. Using 'LOADADDR' also forces an expression absolute, since this
  4318. particular builtin function returns an absolute address.
  4319. 
  4320. File: ld.info, Node: Builtin Functions, Prev: Expression Section, Up: Expressions
  4321. 3.10.9 Builtin Functions
  4322. ------------------------
  4323. The linker script language includes a number of builtin functions for
  4324. use in linker script expressions.
  4325. 'ABSOLUTE(EXP)'
  4326. Return the absolute (non-relocatable, as opposed to non-negative)
  4327. value of the expression EXP. Primarily useful to assign an
  4328. absolute value to a symbol within a section definition, where
  4329. symbol values are normally section relative. *Note Expression
  4330. Section::.
  4331. 'ADDR(SECTION)'
  4332. Return the address (VMA) of the named SECTION. Your script must
  4333. previously have defined the location of that section. In the
  4334. following example, 'start_of_output_1', 'symbol_1' and 'symbol_2'
  4335. are assigned equivalent values, except that 'symbol_1' will be
  4336. relative to the '.output1' section while the other two will be
  4337. absolute:
  4338. SECTIONS { ...
  4339. .output1 :
  4340. {
  4341. start_of_output_1 = ABSOLUTE(.);
  4342. ...
  4343. }
  4344. .output :
  4345. {
  4346. symbol_1 = ADDR(.output1);
  4347. symbol_2 = start_of_output_1;
  4348. }
  4349. ... }
  4350. 'ALIGN(ALIGN)'
  4351. 'ALIGN(EXP,ALIGN)'
  4352. Return the location counter ('.') or arbitrary expression aligned
  4353. to the next ALIGN boundary. The single operand 'ALIGN' doesn't
  4354. change the value of the location counter--it just does arithmetic
  4355. on it. The two operand 'ALIGN' allows an arbitrary expression to
  4356. be aligned upwards ('ALIGN(ALIGN)' is equivalent to
  4357. 'ALIGN(ABSOLUTE(.), ALIGN)').
  4358. Here is an example which aligns the output '.data' section to the
  4359. next '0x2000' byte boundary after the preceding section and sets a
  4360. variable within the section to the next '0x8000' boundary after the
  4361. input sections:
  4362. SECTIONS { ...
  4363. .data ALIGN(0x2000): {
  4364. *(.data)
  4365. variable = ALIGN(0x8000);
  4366. }
  4367. ... }
  4368. The first use of 'ALIGN' in this example specifies the location of
  4369. a section because it is used as the optional ADDRESS attribute of a
  4370. section definition (*note Output Section Address::). The second
  4371. use of 'ALIGN' is used to defines the value of a symbol.
  4372. The builtin function 'NEXT' is closely related to 'ALIGN'.
  4373. 'ALIGNOF(SECTION)'
  4374. Return the alignment in bytes of the named SECTION, if that section
  4375. has been allocated. If the section has not been allocated when
  4376. this is evaluated, the linker will report an error. In the
  4377. following example, the alignment of the '.output' section is stored
  4378. as the first value in that section.
  4379. SECTIONS{ ...
  4380. .output {
  4381. LONG (ALIGNOF (.output))
  4382. ...
  4383. }
  4384. ... }
  4385. 'BLOCK(EXP)'
  4386. This is a synonym for 'ALIGN', for compatibility with older linker
  4387. scripts. It is most often seen when setting the address of an
  4388. output section.
  4389. 'DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE)'
  4390. This is equivalent to either
  4391. (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1)))
  4392. or
  4393. (ALIGN(MAXPAGESIZE)
  4394. + ((. + COMMONPAGESIZE - 1) & (MAXPAGESIZE - COMMONPAGESIZE)))
  4395. depending on whether the latter uses fewer COMMONPAGESIZE sized
  4396. pages for the data segment (area between the result of this
  4397. expression and 'DATA_SEGMENT_END') than the former or not. If the
  4398. latter form is used, it means COMMONPAGESIZE bytes of runtime
  4399. memory will be saved at the expense of up to COMMONPAGESIZE wasted
  4400. bytes in the on-disk file.
  4401. This expression can only be used directly in 'SECTIONS' commands,
  4402. not in any output section descriptions and only once in the linker
  4403. script. COMMONPAGESIZE should be less or equal to MAXPAGESIZE and
  4404. should be the system page size the object wants to be optimized for
  4405. while still running on system page sizes up to MAXPAGESIZE. Note
  4406. however that '-z relro' protection will not be effective if the
  4407. system page size is larger than COMMONPAGESIZE.
  4408. Example:
  4409. . = DATA_SEGMENT_ALIGN(0x10000, 0x2000);
  4410. 'DATA_SEGMENT_END(EXP)'
  4411. This defines the end of data segment for 'DATA_SEGMENT_ALIGN'
  4412. evaluation purposes.
  4413. . = DATA_SEGMENT_END(.);
  4414. 'DATA_SEGMENT_RELRO_END(OFFSET, EXP)'
  4415. This defines the end of the 'PT_GNU_RELRO' segment when '-z relro'
  4416. option is used. When '-z relro' option is not present,
  4417. 'DATA_SEGMENT_RELRO_END' does nothing, otherwise
  4418. 'DATA_SEGMENT_ALIGN' is padded so that EXP + OFFSET is aligned to
  4419. the COMMONPAGESIZE argument given to 'DATA_SEGMENT_ALIGN'. If
  4420. present in the linker script, it must be placed between
  4421. 'DATA_SEGMENT_ALIGN' and 'DATA_SEGMENT_END'. Evaluates to the
  4422. second argument plus any padding needed at the end of the
  4423. 'PT_GNU_RELRO' segment due to section alignment.
  4424. . = DATA_SEGMENT_RELRO_END(24, .);
  4425. 'DEFINED(SYMBOL)'
  4426. Return 1 if SYMBOL is in the linker global symbol table and is
  4427. defined before the statement using DEFINED in the script, otherwise
  4428. return 0. You can use this function to provide default values for
  4429. symbols. For example, the following script fragment shows how to
  4430. set a global symbol 'begin' to the first location in the '.text'
  4431. section--but if a symbol called 'begin' already existed, its value
  4432. is preserved:
  4433. SECTIONS { ...
  4434. .text : {
  4435. begin = DEFINED(begin) ? begin : . ;
  4436. ...
  4437. }
  4438. ...
  4439. }
  4440. 'LENGTH(MEMORY)'
  4441. Return the length of the memory region named MEMORY.
  4442. 'LOADADDR(SECTION)'
  4443. Return the absolute LMA of the named SECTION. (*note Output
  4444. Section LMA::).
  4445. 'LOG2CEIL(EXP)'
  4446. Return the binary logarithm of EXP rounded towards infinity.
  4447. 'LOG2CEIL(0)' returns 0.
  4448. 'MAX(EXP1, EXP2)'
  4449. Returns the maximum of EXP1 and EXP2.
  4450. 'MIN(EXP1, EXP2)'
  4451. Returns the minimum of EXP1 and EXP2.
  4452. 'NEXT(EXP)'
  4453. Return the next unallocated address that is a multiple of EXP.
  4454. This function is closely related to 'ALIGN(EXP)'; unless you use
  4455. the 'MEMORY' command to define discontinuous memory for the output
  4456. file, the two functions are equivalent.
  4457. 'ORIGIN(MEMORY)'
  4458. Return the origin of the memory region named MEMORY.
  4459. 'SEGMENT_START(SEGMENT, DEFAULT)'
  4460. Return the base address of the named SEGMENT. If an explicit value
  4461. has already been given for this segment (with a command-line '-T'
  4462. option) then that value will be returned otherwise the value will
  4463. be DEFAULT. At present, the '-T' command-line option can only be
  4464. used to set the base address for the "text", "data", and "bss"
  4465. sections, but you can use 'SEGMENT_START' with any segment name.
  4466. 'SIZEOF(SECTION)'
  4467. Return the size in bytes of the named SECTION, if that section has
  4468. been allocated. If the section has not been allocated when this is
  4469. evaluated, the linker will report an error. In the following
  4470. example, 'symbol_1' and 'symbol_2' are assigned identical values:
  4471. SECTIONS{ ...
  4472. .output {
  4473. .start = . ;
  4474. ...
  4475. .end = . ;
  4476. }
  4477. symbol_1 = .end - .start ;
  4478. symbol_2 = SIZEOF(.output);
  4479. ... }
  4480. 'SIZEOF_HEADERS'
  4481. 'sizeof_headers'
  4482. Return the size in bytes of the output file's headers. This is
  4483. information which appears at the start of the output file. You can
  4484. use this number when setting the start address of the first
  4485. section, if you choose, to facilitate paging.
  4486. When producing an ELF output file, if the linker script uses the
  4487. 'SIZEOF_HEADERS' builtin function, the linker must compute the
  4488. number of program headers before it has determined all the section
  4489. addresses and sizes. If the linker later discovers that it needs
  4490. additional program headers, it will report an error 'not enough
  4491. room for program headers'. To avoid this error, you must avoid
  4492. using the 'SIZEOF_HEADERS' function, or you must rework your linker
  4493. script to avoid forcing the linker to use additional program
  4494. headers, or you must define the program headers yourself using the
  4495. 'PHDRS' command (*note PHDRS::).
  4496. 
  4497. File: ld.info, Node: Implicit Linker Scripts, Prev: Expressions, Up: Scripts
  4498. 3.11 Implicit Linker Scripts
  4499. ============================
  4500. If you specify a linker input file which the linker can not recognize as
  4501. an object file or an archive file, it will try to read the file as a
  4502. linker script. If the file can not be parsed as a linker script, the
  4503. linker will report an error.
  4504. An implicit linker script will not replace the default linker script.
  4505. Typically an implicit linker script would contain only symbol
  4506. assignments, or the 'INPUT', 'GROUP', or 'VERSION' commands.
  4507. Any input files read because of an implicit linker script will be
  4508. read at the position in the command line where the implicit linker
  4509. script was read. This can affect archive searching.
  4510. 
  4511. File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Scripts, Up: Top
  4512. 4 Machine Dependent Features
  4513. ****************************
  4514. 'ld' has additional features on some platforms; the following sections
  4515. describe them. Machines where 'ld' has no additional functionality are
  4516. not listed.
  4517. * Menu:
  4518. * H8/300:: 'ld' and the H8/300
  4519. * M68HC11/68HC12:: 'ld' and the Motorola 68HC11 and 68HC12 families
  4520. * ARM:: 'ld' and the ARM family
  4521. * HPPA ELF32:: 'ld' and HPPA 32-bit ELF
  4522. * M68K:: 'ld' and the Motorola 68K family
  4523. * MIPS:: 'ld' and the MIPS family
  4524. * MMIX:: 'ld' and MMIX
  4525. * MSP430:: 'ld' and MSP430
  4526. * NDS32:: 'ld' and NDS32
  4527. * Nios II:: 'ld' and the Altera Nios II
  4528. * PowerPC ELF32:: 'ld' and PowerPC 32-bit ELF Support
  4529. * PowerPC64 ELF64:: 'ld' and PowerPC64 64-bit ELF Support
  4530. * S/390 ELF:: 'ld' and S/390 ELF Support
  4531. * SPU ELF:: 'ld' and SPU ELF Support
  4532. * TI COFF:: 'ld' and TI COFF
  4533. * WIN32:: 'ld' and WIN32 (cygwin/mingw)
  4534. * Xtensa:: 'ld' and Xtensa Processors
  4535. 
  4536. File: ld.info, Node: H8/300, Next: M68HC11/68HC12, Up: Machine Dependent
  4537. 4.1 'ld' and the H8/300
  4538. =======================
  4539. For the H8/300, 'ld' can perform these global optimizations when you
  4540. specify the '--relax' command-line option.
  4541. _relaxing address modes_
  4542. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4543. within eight bits, and turns them into eight-bit program-counter
  4544. relative 'bsr' and 'bra' instructions, respectively.
  4545. _synthesizing instructions_
  4546. 'ld' finds all 'mov.b' instructions which use the sixteen-bit
  4547. absolute address form, but refer to the top page of memory, and
  4548. changes them to use the eight-bit address form. (That is: the
  4549. linker turns 'mov.b '@'AA:16' into 'mov.b '@'AA:8' whenever the
  4550. address AA is in the top page of memory).
  4551. 'ld' finds all 'mov' instructions which use the register indirect
  4552. with 32-bit displacement addressing mode, but use a small
  4553. displacement inside 16-bit displacement range, and changes them to
  4554. use the 16-bit displacement form. (That is: the linker turns
  4555. 'mov.b '@'D:32,ERx' into 'mov.b '@'D:16,ERx' whenever the
  4556. displacement D is in the 16 bit signed integer range. Only
  4557. implemented in ELF-format ld).
  4558. _bit manipulation instructions_
  4559. 'ld' finds all bit manipulation instructions like 'band, bclr,
  4560. biand, bild, bior, bist, bixor, bld, bnot, bor, bset, bst, btst,
  4561. bxor' which use 32 bit and 16 bit absolute address form, but refer
  4562. to the top page of memory, and changes them to use the 8 bit
  4563. address form. (That is: the linker turns 'bset #xx:3,'@'AA:32'
  4564. into 'bset #xx:3,'@'AA:8' whenever the address AA is in the top
  4565. page of memory).
  4566. _system control instructions_
  4567. 'ld' finds all 'ldc.w, stc.w' instructions which use the 32 bit
  4568. absolute address form, but refer to the top page of memory, and
  4569. changes them to use 16 bit address form. (That is: the linker
  4570. turns 'ldc.w '@'AA:32,ccr' into 'ldc.w '@'AA:16,ccr' whenever the
  4571. address AA is in the top page of memory).
  4572. 
  4573. File: ld.info, Node: M68HC11/68HC12, Next: ARM, Prev: H8/300, Up: Machine Dependent
  4574. 4.2 'ld' and the Motorola 68HC11 and 68HC12 families
  4575. ====================================================
  4576. 4.2.1 Linker Relaxation
  4577. -----------------------
  4578. For the Motorola 68HC11, 'ld' can perform these global optimizations
  4579. when you specify the '--relax' command-line option.
  4580. _relaxing address modes_
  4581. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4582. within eight bits, and turns them into eight-bit program-counter
  4583. relative 'bsr' and 'bra' instructions, respectively.
  4584. 'ld' also looks at all 16-bit extended addressing modes and
  4585. transforms them in a direct addressing mode when the address is in
  4586. page 0 (between 0 and 0x0ff).
  4587. _relaxing gcc instruction group_
  4588. When 'gcc' is called with '-mrelax', it can emit group of
  4589. instructions that the linker can optimize to use a 68HC11 direct
  4590. addressing mode. These instructions consists of 'bclr' or 'bset'
  4591. instructions.
  4592. 4.2.2 Trampoline Generation
  4593. ---------------------------
  4594. For 68HC11 and 68HC12, 'ld' can generate trampoline code to call a far
  4595. function using a normal 'jsr' instruction. The linker will also change
  4596. the relocation to some far function to use the trampoline address
  4597. instead of the function address. This is typically the case when a
  4598. pointer to a function is taken. The pointer will in fact point to the
  4599. function trampoline.
  4600. 
  4601. File: ld.info, Node: ARM, Next: HPPA ELF32, Prev: M68HC11/68HC12, Up: Machine Dependent
  4602. 4.3 'ld' and the ARM family
  4603. ===========================
  4604. For the ARM, 'ld' will generate code stubs to allow functions calls
  4605. between ARM and Thumb code. These stubs only work with code that has
  4606. been compiled and assembled with the '-mthumb-interwork' command line
  4607. option. If it is necessary to link with old ARM object files or
  4608. libraries, which have not been compiled with the -mthumb-interwork
  4609. option then the '--support-old-code' command-line switch should be given
  4610. to the linker. This will make it generate larger stub functions which
  4611. will work with non-interworking aware ARM code. Note, however, the
  4612. linker does not support generating stubs for function calls to
  4613. non-interworking aware Thumb code.
  4614. The '--thumb-entry' switch is a duplicate of the generic '--entry'
  4615. switch, in that it sets the program's starting address. But it also
  4616. sets the bottom bit of the address, so that it can be branched to using
  4617. a BX instruction, and the program will start executing in Thumb mode
  4618. straight away.
  4619. The '--use-nul-prefixed-import-tables' switch is specifying, that the
  4620. import tables idata4 and idata5 have to be generated with a zero element
  4621. prefix for import libraries. This is the old style to generate import
  4622. tables. By default this option is turned off.
  4623. The '--be8' switch instructs 'ld' to generate BE8 format executables.
  4624. This option is only valid when linking big-endian objects - ie ones
  4625. which have been assembled with the '-EB' option. The resulting image
  4626. will contain big-endian data and little-endian code.
  4627. The 'R_ARM_TARGET1' relocation is typically used for entries in the
  4628. '.init_array' section. It is interpreted as either 'R_ARM_REL32' or
  4629. 'R_ARM_ABS32', depending on the target. The '--target1-rel' and
  4630. '--target1-abs' switches override the default.
  4631. The '--target2=type' switch overrides the default definition of the
  4632. 'R_ARM_TARGET2' relocation. Valid values for 'type', their meanings,
  4633. and target defaults are as follows:
  4634. 'rel'
  4635. 'R_ARM_REL32' (arm*-*-elf, arm*-*-eabi)
  4636. 'abs'
  4637. 'R_ARM_ABS32' (arm*-*-symbianelf)
  4638. 'got-rel'
  4639. 'R_ARM_GOT_PREL' (arm*-*-linux, arm*-*-*bsd)
  4640. The 'R_ARM_V4BX' relocation (defined by the ARM AAELF specification)
  4641. enables objects compiled for the ARMv4 architecture to be
  4642. interworking-safe when linked with other objects compiled for ARMv4t,
  4643. but also allows pure ARMv4 binaries to be built from the same ARMv4
  4644. objects.
  4645. In the latter case, the switch '--fix-v4bx' must be passed to the
  4646. linker, which causes v4t 'BX rM' instructions to be rewritten as 'MOV
  4647. PC,rM', since v4 processors do not have a 'BX' instruction.
  4648. In the former case, the switch should not be used, and 'R_ARM_V4BX'
  4649. relocations are ignored.
  4650. Replace 'BX rM' instructions identified by 'R_ARM_V4BX' relocations
  4651. with a branch to the following veneer:
  4652. TST rM, #1
  4653. MOVEQ PC, rM
  4654. BX Rn
  4655. This allows generation of libraries/applications that work on ARMv4
  4656. cores and are still interworking safe. Note that the above veneer
  4657. clobbers the condition flags, so may cause incorrect program behavior in
  4658. rare cases.
  4659. The '--use-blx' switch enables the linker to use ARM/Thumb BLX
  4660. instructions (available on ARMv5t and above) in various situations.
  4661. Currently it is used to perform calls via the PLT from Thumb code using
  4662. BLX rather than using BX and a mode-switching stub before each PLT
  4663. entry. This should lead to such calls executing slightly faster.
  4664. This option is enabled implicitly for SymbianOS, so there is no need
  4665. to specify it if you are using that target.
  4666. The '--vfp11-denorm-fix' switch enables a link-time workaround for a
  4667. bug in certain VFP11 coprocessor hardware, which sometimes allows
  4668. instructions with denorm operands (which must be handled by support
  4669. code) to have those operands overwritten by subsequent instructions
  4670. before the support code can read the intended values.
  4671. The bug may be avoided in scalar mode if you allow at least one
  4672. intervening instruction between a VFP11 instruction which uses a
  4673. register and another instruction which writes to the same register, or
  4674. at least two intervening instructions if vector mode is in use. The bug
  4675. only affects full-compliance floating-point mode: you do not need this
  4676. workaround if you are using "runfast" mode. Please contact ARM for
  4677. further details.
  4678. If you know you are using buggy VFP11 hardware, you can enable this
  4679. workaround by specifying the linker option '--vfp-denorm-fix=scalar' if
  4680. you are using the VFP11 scalar mode only, or '--vfp-denorm-fix=vector'
  4681. if you are using vector mode (the latter also works for scalar code).
  4682. The default is '--vfp-denorm-fix=none'.
  4683. If the workaround is enabled, instructions are scanned for
  4684. potentially-troublesome sequences, and a veneer is created for each such
  4685. sequence which may trigger the erratum. The veneer consists of the
  4686. first instruction of the sequence and a branch back to the subsequent
  4687. instruction. The original instruction is then replaced with a branch to
  4688. the veneer. The extra cycles required to call and return from the
  4689. veneer are sufficient to avoid the erratum in both the scalar and vector
  4690. cases.
  4691. The '--fix-arm1176' switch enables a link-time workaround for an
  4692. erratum in certain ARM1176 processors. The workaround is enabled by
  4693. default if you are targeting ARM v6 (excluding ARM v6T2) or earlier. It
  4694. can be disabled unconditionally by specifying '--no-fix-arm1176'.
  4695. Further information is available in the "ARM1176JZ-S and ARM1176JZF-S
  4696. Programmer Advice Notice" available on the ARM documentation website at:
  4697. http://infocenter.arm.com/.
  4698. The '--fix-stm32l4xx-629360' switch enables a link-time workaround
  4699. for a bug in the bus matrix / memory controller for some of the STM32
  4700. Cortex-M4 based products (STM32L4xx). When accessing off-chip memory
  4701. via the affected bus for bus reads of 9 words or more, the bus can
  4702. generate corrupt data and/or abort. These are only core-initiated
  4703. accesses (not DMA), and might affect any access: integer loads such as
  4704. LDM, POP and floating-point loads such as VLDM, VPOP. Stores are not
  4705. affected.
  4706. The bug can be avoided by splitting memory accesses into the
  4707. necessary chunks to keep bus reads below 8 words.
  4708. The workaround is not enabled by default, this is equivalent to use
  4709. '--fix-stm32l4xx-629360=none'. If you know you are using buggy
  4710. STM32L4xx hardware, you can enable the workaround by specifying the
  4711. linker option '--fix-stm32l4xx-629360', or the equivalent
  4712. '--fix-stm32l4xx-629360=default'.
  4713. If the workaround is enabled, instructions are scanned for
  4714. potentially-troublesome sequences, and a veneer is created for each such
  4715. sequence which may trigger the erratum. The veneer consists in a
  4716. replacement sequence emulating the behaviour of the original one and a
  4717. branch back to the subsequent instruction. The original instruction is
  4718. then replaced with a branch to the veneer.
  4719. The workaround does not always preserve the memory access order for
  4720. the LDMDB instruction, when the instruction loads the PC.
  4721. The workaround is not able to handle problematic instructions when
  4722. they are in the middle of an IT block, since a branch is not allowed
  4723. there. In that case, the linker reports a warning and no replacement
  4724. occurs.
  4725. The workaround is not able to replace problematic instructions with a
  4726. PC-relative branch instruction if the '.text' section is too large. In
  4727. that case, when the branch that replaces the original code cannot be
  4728. encoded, the linker reports a warning and no replacement occurs.
  4729. The '--no-enum-size-warning' switch prevents the linker from warning
  4730. when linking object files that specify incompatible EABI enumeration
  4731. size attributes. For example, with this switch enabled, linking of an
  4732. object file using 32-bit enumeration values with another using
  4733. enumeration values fitted into the smallest possible space will not be
  4734. diagnosed.
  4735. The '--no-wchar-size-warning' switch prevents the linker from warning
  4736. when linking object files that specify incompatible EABI 'wchar_t' size
  4737. attributes. For example, with this switch enabled, linking of an object
  4738. file using 32-bit 'wchar_t' values with another using 16-bit 'wchar_t'
  4739. values will not be diagnosed.
  4740. The '--pic-veneer' switch makes the linker use PIC sequences for
  4741. ARM/Thumb interworking veneers, even if the rest of the binary is not
  4742. PIC. This avoids problems on uClinux targets where '--emit-relocs' is
  4743. used to generate relocatable binaries.
  4744. The linker will automatically generate and insert small sequences of
  4745. code into a linked ARM ELF executable whenever an attempt is made to
  4746. perform a function call to a symbol that is too far away. The placement
  4747. of these sequences of instructions - called stubs - is controlled by the
  4748. command-line option '--stub-group-size=N'. The placement is important
  4749. because a poor choice can create a need for duplicate stubs, increasing
  4750. the code size. The linker will try to group stubs together in order to
  4751. reduce interruptions to the flow of code, but it needs guidance as to
  4752. how big these groups should be and where they should be placed.
  4753. The value of 'N', the parameter to the '--stub-group-size=' option
  4754. controls where the stub groups are placed. If it is negative then all
  4755. stubs are placed after the first branch that needs them. If it is
  4756. positive then the stubs can be placed either before or after the
  4757. branches that need them. If the value of 'N' is 1 (either +1 or -1)
  4758. then the linker will choose exactly where to place groups of stubs,
  4759. using its built in heuristics. A value of 'N' greater than 1 (or
  4760. smaller than -1) tells the linker that a single group of stubs can
  4761. service at most 'N' bytes from the input sections.
  4762. The default, if '--stub-group-size=' is not specified, is 'N = +1'.
  4763. Farcalls stubs insertion is fully supported for the ARM-EABI target
  4764. only, because it relies on object files properties not present
  4765. otherwise.
  4766. The '--fix-cortex-a8' switch enables a link-time workaround for an
  4767. erratum in certain Cortex-A8 processors. The workaround is enabled by
  4768. default if you are targeting the ARM v7-A architecture profile. It can
  4769. be enabled otherwise by specifying '--fix-cortex-a8', or disabled
  4770. unconditionally by specifying '--no-fix-cortex-a8'.
  4771. The erratum only affects Thumb-2 code. Please contact ARM for
  4772. further details.
  4773. The '--fix-cortex-a53-835769' switch enables a link-time workaround
  4774. for erratum 835769 present on certain early revisions of Cortex-A53
  4775. processors. The workaround is disabled by default. It can be enabled
  4776. by specifying '--fix-cortex-a53-835769', or disabled unconditionally by
  4777. specifying '--no-fix-cortex-a53-835769'.
  4778. Please contact ARM for further details.
  4779. The '--no-merge-exidx-entries' switch disables the merging of
  4780. adjacent exidx entries in debuginfo.
  4781. The '--long-plt' option enables the use of 16 byte PLT entries which
  4782. support up to 4Gb of code. The default is to use 12 byte PLT entries
  4783. which only support 512Mb of code.
  4784. The '--no-apply-dynamic-relocs' option makes AArch64 linker do not
  4785. apply link-time values for dynamic relocations.
  4786. All SG veneers are placed in the special output section
  4787. '.gnu.sgstubs'. Its start address must be set, either with the
  4788. command-line option '--section-start' or in a linker script, to indicate
  4789. where to place these veneers in memory.
  4790. The '--cmse-implib' option requests that the import libraries
  4791. specified by the '--out-implib' and '--in-implib' options are secure
  4792. gateway import libraries, suitable for linking a non-secure executable
  4793. against secure code as per ARMv8-M Security Extensions.
  4794. The '--in-implib=file' specifies an input import library whose
  4795. symbols must keep the same address in the executable being produced. A
  4796. warning is given if no '--out-implib' is given but new symbols have been
  4797. introduced in the executable that should be listed in its import
  4798. library. Otherwise, if '--out-implib' is specified, the symbols are
  4799. added to the output import library. A warning is also given if some
  4800. symbols present in the input import library have disappeared from the
  4801. executable. This option is only effective for Secure Gateway import
  4802. libraries, ie. when '--cmse-implib' is specified.
  4803. 
  4804. File: ld.info, Node: HPPA ELF32, Next: M68K, Prev: ARM, Up: Machine Dependent
  4805. 4.4 'ld' and HPPA 32-bit ELF Support
  4806. ====================================
  4807. When generating a shared library, 'ld' will by default generate import
  4808. stubs suitable for use with a single sub-space application. The
  4809. '--multi-subspace' switch causes 'ld' to generate export stubs, and
  4810. different (larger) import stubs suitable for use with multiple
  4811. sub-spaces.
  4812. Long branch stubs and import/export stubs are placed by 'ld' in stub
  4813. sections located between groups of input sections. '--stub-group-size'
  4814. specifies the maximum size of a group of input sections handled by one
  4815. stub section. Since branch offsets are signed, a stub section may serve
  4816. two groups of input sections, one group before the stub section, and one
  4817. group after it. However, when using conditional branches that require
  4818. stubs, it may be better (for branch prediction) that stub sections only
  4819. serve one group of input sections. A negative value for 'N' chooses
  4820. this scheme, ensuring that branches to stubs always use a negative
  4821. offset. Two special values of 'N' are recognized, '1' and '-1'. These
  4822. both instruct 'ld' to automatically size input section groups for the
  4823. branch types detected, with the same behaviour regarding stub placement
  4824. as other positive or negative values of 'N' respectively.
  4825. Note that '--stub-group-size' does not split input sections. A
  4826. single input section larger than the group size specified will of course
  4827. create a larger group (of one section). If input sections are too
  4828. large, it may not be possible for a branch to reach its stub.
  4829. 
  4830. File: ld.info, Node: M68K, Next: MIPS, Prev: HPPA ELF32, Up: Machine Dependent
  4831. 4.5 'ld' and the Motorola 68K family
  4832. ====================================
  4833. The '--got=TYPE' option lets you choose the GOT generation scheme. The
  4834. choices are 'single', 'negative', 'multigot' and 'target'. When
  4835. 'target' is selected the linker chooses the default GOT generation
  4836. scheme for the current target. 'single' tells the linker to generate a
  4837. single GOT with entries only at non-negative offsets. 'negative'
  4838. instructs the linker to generate a single GOT with entries at both
  4839. negative and positive offsets. Not all environments support such GOTs.
  4840. 'multigot' allows the linker to generate several GOTs in the output
  4841. file. All GOT references from a single input object file access the
  4842. same GOT, but references from different input object files might access
  4843. different GOTs. Not all environments support such GOTs.
  4844. 
  4845. File: ld.info, Node: MIPS, Next: MMIX, Prev: M68K, Up: Machine Dependent
  4846. 4.6 'ld' and the MIPS family
  4847. ============================
  4848. The '--insn32' and '--no-insn32' options control the choice of microMIPS
  4849. instructions used in code generated by the linker, such as that in the
  4850. PLT or lazy binding stubs, or in relaxation. If '--insn32' is used,
  4851. then the linker only uses 32-bit instruction encodings. By default or
  4852. if '--no-insn32' is used, all instruction encodings are used, including
  4853. 16-bit ones where possible.
  4854. The '--ignore-branch-isa' and '--no-ignore-branch-isa' options
  4855. control branch relocation checks for invalid ISA mode transitions. If
  4856. '--ignore-branch-isa' is used, then the linker accepts any branch
  4857. relocations and any ISA mode transition required is lost in relocation
  4858. calculation, except for some cases of 'BAL' instructions which meet
  4859. relaxation conditions and are converted to equivalent 'JALX'
  4860. instructions as the associated relocation is calculated. By default or
  4861. if '--no-ignore-branch-isa' is used a check is made causing the loss of
  4862. an ISA mode transition to produce an error.
  4863. 
  4864. File: ld.info, Node: MMIX, Next: MSP430, Prev: MIPS, Up: Machine Dependent
  4865. 4.7 'ld' and MMIX
  4866. =================
  4867. For MMIX, there is a choice of generating 'ELF' object files or 'mmo'
  4868. object files when linking. The simulator 'mmix' understands the 'mmo'
  4869. format. The binutils 'objcopy' utility can translate between the two
  4870. formats.
  4871. There is one special section, the '.MMIX.reg_contents' section.
  4872. Contents in this section is assumed to correspond to that of global
  4873. registers, and symbols referring to it are translated to special
  4874. symbols, equal to registers. In a final link, the start address of the
  4875. '.MMIX.reg_contents' section corresponds to the first allocated global
  4876. register multiplied by 8. Register '$255' is not included in this
  4877. section; it is always set to the program entry, which is at the symbol
  4878. 'Main' for 'mmo' files.
  4879. Global symbols with the prefix '__.MMIX.start.', for example
  4880. '__.MMIX.start..text' and '__.MMIX.start..data' are special. The
  4881. default linker script uses these to set the default start address of a
  4882. section.
  4883. Initial and trailing multiples of zero-valued 32-bit words in a
  4884. section, are left out from an mmo file.
  4885. 
  4886. File: ld.info, Node: MSP430, Next: NDS32, Prev: MMIX, Up: Machine Dependent
  4887. 4.8 'ld' and MSP430
  4888. ===================
  4889. For the MSP430 it is possible to select the MPU architecture. The flag
  4890. '-m [mpu type]' will select an appropriate linker script for selected
  4891. MPU type. (To get a list of known MPUs just pass '-m help' option to
  4892. the linker).
  4893. The linker will recognize some extra sections which are MSP430
  4894. specific:
  4895. ''.vectors''
  4896. Defines a portion of ROM where interrupt vectors located.
  4897. ''.bootloader''
  4898. Defines the bootloader portion of the ROM (if applicable). Any
  4899. code in this section will be uploaded to the MPU.
  4900. ''.infomem''
  4901. Defines an information memory section (if applicable). Any code in
  4902. this section will be uploaded to the MPU.
  4903. ''.infomemnobits''
  4904. This is the same as the '.infomem' section except that any code in
  4905. this section will not be uploaded to the MPU.
  4906. ''.noinit''
  4907. Denotes a portion of RAM located above '.bss' section.
  4908. The last two sections are used by gcc.
  4909. '--code-region=[either,lower,upper,none]'
  4910. This will transform .text* sections to [either,lower,upper].text*
  4911. sections. The argument passed to GCC for -mcode-region is
  4912. propagated to the linker using this option.
  4913. '--data-region=[either,lower,upper,none]'
  4914. This will transform .data*, .bss* and .rodata* sections to
  4915. [either,lower,upper].[data,bss,rodata]* sections. The argument
  4916. passed to GCC for -mdata-region is propagated to the linker using
  4917. this option.
  4918. '--disable-sec-transformation'
  4919. Prevent the transformation of sections as specified by the
  4920. '--code-region' and '--data-region' options. This is useful if you
  4921. are compiling and linking using a single call to the GCC wrapper,
  4922. and want to compile the source files using -m[code,data]-region but
  4923. not transform the sections for prebuilt libraries and objects.
  4924. 
  4925. File: ld.info, Node: NDS32, Next: Nios II, Prev: MSP430, Up: Machine Dependent
  4926. 4.9 'ld' and NDS32
  4927. ==================
  4928. For NDS32, there are some options to select relaxation behavior. The
  4929. linker relaxes objects according to these options.
  4930. ''--m[no-]fp-as-gp''
  4931. Disable/enable fp-as-gp relaxation.
  4932. ''--mexport-symbols=FILE''
  4933. Exporting symbols and their address into FILE as linker script.
  4934. ''--m[no-]ex9''
  4935. Disable/enable link-time EX9 relaxation.
  4936. ''--mexport-ex9=FILE''
  4937. Export the EX9 table after linking.
  4938. ''--mimport-ex9=FILE''
  4939. Import the Ex9 table for EX9 relaxation.
  4940. ''--mupdate-ex9''
  4941. Update the existing EX9 table.
  4942. ''--mex9-limit=NUM''
  4943. Maximum number of entries in the ex9 table.
  4944. ''--mex9-loop-aware''
  4945. Avoid generating the EX9 instruction inside the loop.
  4946. ''--m[no-]ifc''
  4947. Disable/enable the link-time IFC optimization.
  4948. ''--mifc-loop-aware''
  4949. Avoid generating the IFC instruction inside the loop.
  4950. 
  4951. File: ld.info, Node: Nios II, Next: PowerPC ELF32, Prev: NDS32, Up: Machine Dependent
  4952. 4.10 'ld' and the Altera Nios II
  4953. ================================
  4954. Call and immediate jump instructions on Nios II processors are limited
  4955. to transferring control to addresses in the same 256MB memory segment,
  4956. which may result in 'ld' giving 'relocation truncated to fit' errors
  4957. with very large programs. The command-line option '--relax' enables the
  4958. generation of trampolines that can access the entire 32-bit address
  4959. space for calls outside the normal 'call' and 'jmpi' address range.
  4960. These trampolines are inserted at section boundaries, so may not
  4961. themselves be reachable if an input section and its associated call
  4962. trampolines are larger than 256MB.
  4963. The '--relax' option is enabled by default unless '-r' is also
  4964. specified. You can disable trampoline generation by using the
  4965. '--no-relax' linker option. You can also disable this optimization
  4966. locally by using the 'set .noat' directive in assembly-language source
  4967. files, as the linker-inserted trampolines use the 'at' register as a
  4968. temporary.
  4969. Note that the linker '--relax' option is independent of assembler
  4970. relaxation options, and that using the GNU assembler's '-relax-all'
  4971. option interferes with the linker's more selective call instruction
  4972. relaxation.
  4973. 
  4974. File: ld.info, Node: PowerPC ELF32, Next: PowerPC64 ELF64, Prev: Nios II, Up: Machine Dependent
  4975. 4.11 'ld' and PowerPC 32-bit ELF Support
  4976. ========================================
  4977. Branches on PowerPC processors are limited to a signed 26-bit
  4978. displacement, which may result in 'ld' giving 'relocation truncated to
  4979. fit' errors with very large programs. '--relax' enables the generation
  4980. of trampolines that can access the entire 32-bit address space. These
  4981. trampolines are inserted at section boundaries, so may not themselves be
  4982. reachable if an input section exceeds 33M in size. You may combine '-r'
  4983. and '--relax' to add trampolines in a partial link. In that case both
  4984. branches to undefined symbols and inter-section branches are also
  4985. considered potentially out of range, and trampolines inserted.
  4986. '--bss-plt'
  4987. Current PowerPC GCC accepts a '-msecure-plt' option that generates
  4988. code capable of using a newer PLT and GOT layout that has the
  4989. security advantage of no executable section ever needing to be
  4990. writable and no writable section ever being executable. PowerPC
  4991. 'ld' will generate this layout, including stubs to access the PLT,
  4992. if all input files (including startup and static libraries) were
  4993. compiled with '-msecure-plt'. '--bss-plt' forces the old BSS PLT
  4994. (and GOT layout) which can give slightly better performance.
  4995. '--secure-plt'
  4996. 'ld' will use the new PLT and GOT layout if it is linking new
  4997. '-fpic' or '-fPIC' code, but does not do so automatically when
  4998. linking non-PIC code. This option requests the new PLT and GOT
  4999. layout. A warning will be given if some object file requires the
  5000. old style BSS PLT.
  5001. '--sdata-got'
  5002. The new secure PLT and GOT are placed differently relative to other
  5003. sections compared to older BSS PLT and GOT placement. The location
  5004. of '.plt' must change because the new secure PLT is an initialized
  5005. section while the old PLT is uninitialized. The reason for the
  5006. '.got' change is more subtle: The new placement allows '.got' to be
  5007. read-only in applications linked with '-z relro -z now'. However,
  5008. this placement means that '.sdata' cannot always be used in shared
  5009. libraries, because the PowerPC ABI accesses '.sdata' in shared
  5010. libraries from the GOT pointer. '--sdata-got' forces the old GOT
  5011. placement. PowerPC GCC doesn't use '.sdata' in shared libraries,
  5012. so this option is really only useful for other compilers that may
  5013. do so.
  5014. '--emit-stub-syms'
  5015. This option causes 'ld' to label linker stubs with a local symbol
  5016. that encodes the stub type and destination.
  5017. '--no-tls-optimize'
  5018. PowerPC 'ld' normally performs some optimization of code sequences
  5019. used to access Thread-Local Storage. Use this option to disable
  5020. the optimization.
  5021. 
  5022. File: ld.info, Node: PowerPC64 ELF64, Next: S/390 ELF, Prev: PowerPC ELF32, Up: Machine Dependent
  5023. 4.12 'ld' and PowerPC64 64-bit ELF Support
  5024. ==========================================
  5025. '--stub-group-size'
  5026. Long branch stubs, PLT call stubs and TOC adjusting stubs are
  5027. placed by 'ld' in stub sections located between groups of input
  5028. sections. '--stub-group-size' specifies the maximum size of a
  5029. group of input sections handled by one stub section. Since branch
  5030. offsets are signed, a stub section may serve two groups of input
  5031. sections, one group before the stub section, and one group after
  5032. it. However, when using conditional branches that require stubs,
  5033. it may be better (for branch prediction) that stub sections only
  5034. serve one group of input sections. A negative value for 'N'
  5035. chooses this scheme, ensuring that branches to stubs always use a
  5036. negative offset. Two special values of 'N' are recognized, '1' and
  5037. '-1'. These both instruct 'ld' to automatically size input section
  5038. groups for the branch types detected, with the same behaviour
  5039. regarding stub placement as other positive or negative values of
  5040. 'N' respectively.
  5041. Note that '--stub-group-size' does not split input sections. A
  5042. single input section larger than the group size specified will of
  5043. course create a larger group (of one section). If input sections
  5044. are too large, it may not be possible for a branch to reach its
  5045. stub.
  5046. '--emit-stub-syms'
  5047. This option causes 'ld' to label linker stubs with a local symbol
  5048. that encodes the stub type and destination.
  5049. '--dotsyms'
  5050. '--no-dotsyms'
  5051. These two options control how 'ld' interprets version patterns in a
  5052. version script. Older PowerPC64 compilers emitted both a function
  5053. descriptor symbol with the same name as the function, and a code
  5054. entry symbol with the name prefixed by a dot ('.'). To properly
  5055. version a function 'foo', the version script thus needs to control
  5056. both 'foo' and '.foo'. The option '--dotsyms', on by default,
  5057. automatically adds the required dot-prefixed patterns. Use
  5058. '--no-dotsyms' to disable this feature.
  5059. '--save-restore-funcs'
  5060. '--no-save-restore-funcs'
  5061. These two options control whether PowerPC64 'ld' automatically
  5062. provides out-of-line register save and restore functions used by
  5063. '-Os' code. The default is to provide any such referenced function
  5064. for a normal final link, and to not do so for a relocatable link.
  5065. '--no-tls-optimize'
  5066. PowerPC64 'ld' normally performs some optimization of code
  5067. sequences used to access Thread-Local Storage. Use this option to
  5068. disable the optimization.
  5069. '--tls-get-addr-optimize'
  5070. '--no-tls-get-addr-optimize'
  5071. These options control whether PowerPC64 'ld' uses a special stub to
  5072. call __tls_get_addr. PowerPC64 glibc 2.22 and later support an
  5073. optimization that allows the second and subsequent calls to
  5074. '__tls_get_addr' for a given symbol to be resolved by the special
  5075. stub without calling in to glibc. By default the linker enables
  5076. this option when glibc advertises the availability of
  5077. __tls_get_addr_opt. Forcing this option on when using an older
  5078. glibc won't do much besides slow down your applications, but may be
  5079. useful if linking an application against an older glibc with the
  5080. expectation that it will normally be used on systems having a newer
  5081. glibc.
  5082. '--no-opd-optimize'
  5083. PowerPC64 'ld' normally removes '.opd' section entries
  5084. corresponding to deleted link-once functions, or functions removed
  5085. by the action of '--gc-sections' or linker script '/DISCARD/'. Use
  5086. this option to disable '.opd' optimization.
  5087. '--non-overlapping-opd'
  5088. Some PowerPC64 compilers have an option to generate compressed
  5089. '.opd' entries spaced 16 bytes apart, overlapping the third word,
  5090. the static chain pointer (unused in C) with the first word of the
  5091. next entry. This option expands such entries to the full 24 bytes.
  5092. '--no-toc-optimize'
  5093. PowerPC64 'ld' normally removes unused '.toc' section entries.
  5094. Such entries are detected by examining relocations that reference
  5095. the TOC in code sections. A reloc in a deleted code section marks
  5096. a TOC word as unneeded, while a reloc in a kept code section marks
  5097. a TOC word as needed. Since the TOC may reference itself, TOC
  5098. relocs are also examined. TOC words marked as both needed and
  5099. unneeded will of course be kept. TOC words without any referencing
  5100. reloc are assumed to be part of a multi-word entry, and are kept or
  5101. discarded as per the nearest marked preceding word. This works
  5102. reliably for compiler generated code, but may be incorrect if
  5103. assembly code is used to insert TOC entries. Use this option to
  5104. disable the optimization.
  5105. '--no-multi-toc'
  5106. If given any toc option besides '-mcmodel=medium' or
  5107. '-mcmodel=large', PowerPC64 GCC generates code for a TOC model
  5108. where TOC entries are accessed with a 16-bit offset from r2. This
  5109. limits the total TOC size to 64K. PowerPC64 'ld' extends this limit
  5110. by grouping code sections such that each group uses less than 64K
  5111. for its TOC entries, then inserts r2 adjusting stubs between
  5112. inter-group calls. 'ld' does not split apart input sections, so
  5113. cannot help if a single input file has a '.toc' section that
  5114. exceeds 64K, most likely from linking multiple files with 'ld -r'.
  5115. Use this option to turn off this feature.
  5116. '--no-toc-sort'
  5117. By default, 'ld' sorts TOC sections so that those whose file
  5118. happens to have a section called '.init' or '.fini' are placed
  5119. first, followed by TOC sections referenced by code generated with
  5120. PowerPC64 gcc's '-mcmodel=small', and lastly TOC sections
  5121. referenced only by code generated with PowerPC64 gcc's
  5122. '-mcmodel=medium' or '-mcmodel=large' options. Doing this results
  5123. in better TOC grouping for multi-TOC. Use this option to turn off
  5124. this feature.
  5125. '--plt-align'
  5126. '--no-plt-align'
  5127. Use these options to control whether individual PLT call stubs are
  5128. aligned to a 32-byte boundary, or to the specified power of two
  5129. boundary when using '--plt-align='. A negative value may be
  5130. specified to pad PLT call stubs so that they do not cross the
  5131. specified power of two boundary (or the minimum number of
  5132. boundaries if a PLT stub is so large that it must cross a
  5133. boundary). By default PLT call stubs are aligned to 32-byte
  5134. boundaries.
  5135. '--plt-static-chain'
  5136. '--no-plt-static-chain'
  5137. Use these options to control whether PLT call stubs load the static
  5138. chain pointer (r11). 'ld' defaults to not loading the static chain
  5139. since there is never any need to do so on a PLT call.
  5140. '--plt-thread-safe'
  5141. '--no-plt-thread-safe'
  5142. With power7's weakly ordered memory model, it is possible when
  5143. using lazy binding for ld.so to update a plt entry in one thread
  5144. and have another thread see the individual plt entry words update
  5145. in the wrong order, despite ld.so carefully writing in the correct
  5146. order and using memory write barriers. To avoid this we need some
  5147. sort of read barrier in the call stub, or use LD_BIND_NOW=1. By
  5148. default, 'ld' looks for calls to commonly used functions that
  5149. create threads, and if seen, adds the necessary barriers. Use
  5150. these options to change the default behaviour.
  5151. '--plt-localentry'
  5152. '--no-localentry'
  5153. ELFv2 functions with localentry:0 are those with a single entry
  5154. point, ie. global entry == local entry, and that have no
  5155. requirement on r2 (the TOC/GOT pointer) or r12, and guarantee r2 is
  5156. unchanged on return. Such an external function can be called via
  5157. the PLT without saving r2 or restoring it on return, avoiding a
  5158. common load-hit-store for small functions. The optimization is
  5159. attractive, with up to 40% reduction in execution time for a small
  5160. function, but can result in symbol interposition failures. Also,
  5161. minor changes in a shared library, including system libraries, can
  5162. cause a function that was localentry:0 to become localentry:8.
  5163. This will result in a dynamic loader complaint and failure to run.
  5164. The option is experimental, use with care. '--no-plt-localentry'
  5165. is the default.
  5166. 
  5167. File: ld.info, Node: S/390 ELF, Next: SPU ELF, Prev: PowerPC64 ELF64, Up: Machine Dependent
  5168. 4.13 'ld' and S/390 ELF Support
  5169. ===============================
  5170. '--s390-pgste'
  5171. This option marks the result file with a 'PT_S390_PGSTE' segment.
  5172. The Linux kernel is supposed to allocate 4k page tables for
  5173. binaries marked that way.
  5174. 
  5175. File: ld.info, Node: SPU ELF, Next: TI COFF, Prev: S/390 ELF, Up: Machine Dependent
  5176. 4.14 'ld' and SPU ELF Support
  5177. =============================
  5178. '--plugin'
  5179. This option marks an executable as a PIC plugin module.
  5180. '--no-overlays'
  5181. Normally, 'ld' recognizes calls to functions within overlay
  5182. regions, and redirects such calls to an overlay manager via a stub.
  5183. 'ld' also provides a built-in overlay manager. This option turns
  5184. off all this special overlay handling.
  5185. '--emit-stub-syms'
  5186. This option causes 'ld' to label overlay stubs with a local symbol
  5187. that encodes the stub type and destination.
  5188. '--extra-overlay-stubs'
  5189. This option causes 'ld' to add overlay call stubs on all function
  5190. calls out of overlay regions. Normally stubs are not added on
  5191. calls to non-overlay regions.
  5192. '--local-store=lo:hi'
  5193. 'ld' usually checks that a final executable for SPU fits in the
  5194. address range 0 to 256k. This option may be used to change the
  5195. range. Disable the check entirely with '--local-store=0:0'.
  5196. '--stack-analysis'
  5197. SPU local store space is limited. Over-allocation of stack space
  5198. unnecessarily limits space available for code and data, while
  5199. under-allocation results in runtime failures. If given this
  5200. option, 'ld' will provide an estimate of maximum stack usage. 'ld'
  5201. does this by examining symbols in code sections to determine the
  5202. extents of functions, and looking at function prologues for stack
  5203. adjusting instructions. A call-graph is created by looking for
  5204. relocations on branch instructions. The graph is then searched for
  5205. the maximum stack usage path. Note that this analysis does not
  5206. find calls made via function pointers, and does not handle
  5207. recursion and other cycles in the call graph. Stack usage may be
  5208. under-estimated if your code makes such calls. Also, stack usage
  5209. for dynamic allocation, e.g. alloca, will not be detected. If a
  5210. link map is requested, detailed information about each function's
  5211. stack usage and calls will be given.
  5212. '--emit-stack-syms'
  5213. This option, if given along with '--stack-analysis' will result in
  5214. 'ld' emitting stack sizing symbols for each function. These take
  5215. the form '__stack_<function_name>' for global functions, and
  5216. '__stack_<number>_<function_name>' for static functions.
  5217. '<number>' is the section id in hex. The value of such symbols is
  5218. the stack requirement for the corresponding function. The symbol
  5219. size will be zero, type 'STT_NOTYPE', binding 'STB_LOCAL', and
  5220. section 'SHN_ABS'.
  5221. 
  5222. File: ld.info, Node: TI COFF, Next: WIN32, Prev: SPU ELF, Up: Machine Dependent
  5223. 4.15 'ld''s Support for Various TI COFF Versions
  5224. ================================================
  5225. The '--format' switch allows selection of one of the various TI COFF
  5226. versions. The latest of this writing is 2; versions 0 and 1 are also
  5227. supported. The TI COFF versions also vary in header byte-order format;
  5228. 'ld' will read any version or byte order, but the output header format
  5229. depends on the default specified by the specific target.
  5230. 
  5231. File: ld.info, Node: WIN32, Next: Xtensa, Prev: TI COFF, Up: Machine Dependent
  5232. 4.16 'ld' and WIN32 (cygwin/mingw)
  5233. ==================================
  5234. This section describes some of the win32 specific 'ld' issues. See
  5235. *note Command-line Options: Options. for detailed description of the
  5236. command-line options mentioned here.
  5237. _import libraries_
  5238. The standard Windows linker creates and uses so-called import
  5239. libraries, which contains information for linking to dll's. They
  5240. are regular static archives and are handled as any other static
  5241. archive. The cygwin and mingw ports of 'ld' have specific support
  5242. for creating such libraries provided with the '--out-implib'
  5243. command-line option.
  5244. _exporting DLL symbols_
  5245. The cygwin/mingw 'ld' has several ways to export symbols for dll's.
  5246. _using auto-export functionality_
  5247. By default 'ld' exports symbols with the auto-export
  5248. functionality, which is controlled by the following
  5249. command-line options:
  5250. * -export-all-symbols [This is the default]
  5251. * -exclude-symbols
  5252. * -exclude-libs
  5253. * -exclude-modules-for-implib
  5254. * -version-script
  5255. When auto-export is in operation, 'ld' will export all the
  5256. non-local (global and common) symbols it finds in a DLL, with
  5257. the exception of a few symbols known to belong to the system's
  5258. runtime and libraries. As it will often not be desirable to
  5259. export all of a DLL's symbols, which may include private
  5260. functions that are not part of any public interface, the
  5261. command-line options listed above may be used to filter
  5262. symbols out from the list for exporting. The '--output-def'
  5263. option can be used in order to see the final list of exported
  5264. symbols with all exclusions taken into effect.
  5265. If '--export-all-symbols' is not given explicitly on the
  5266. command line, then the default auto-export behavior will be
  5267. _disabled_ if either of the following are true:
  5268. * A DEF file is used.
  5269. * Any symbol in any object file was marked with the
  5270. __declspec(dllexport) attribute.
  5271. _using a DEF file_
  5272. Another way of exporting symbols is using a DEF file. A DEF
  5273. file is an ASCII file containing definitions of symbols which
  5274. should be exported when a dll is created. Usually it is named
  5275. '<dll name>.def' and is added as any other object file to the
  5276. linker's command line. The file's name must end in '.def' or
  5277. '.DEF'.
  5278. gcc -o <output> <objectfiles> <dll name>.def
  5279. Using a DEF file turns off the normal auto-export behavior,
  5280. unless the '--export-all-symbols' option is also used.
  5281. Here is an example of a DEF file for a shared library called
  5282. 'xyz.dll':
  5283. LIBRARY "xyz.dll" BASE=0x20000000
  5284. EXPORTS
  5285. foo
  5286. bar
  5287. _bar = bar
  5288. another_foo = abc.dll.afoo
  5289. var1 DATA
  5290. doo = foo == foo2
  5291. eoo DATA == var1
  5292. This example defines a DLL with a non-default base address and
  5293. seven symbols in the export table. The third exported symbol
  5294. '_bar' is an alias for the second. The fourth symbol,
  5295. 'another_foo' is resolved by "forwarding" to another module
  5296. and treating it as an alias for 'afoo' exported from the DLL
  5297. 'abc.dll'. The final symbol 'var1' is declared to be a data
  5298. object. The 'doo' symbol in export library is an alias of
  5299. 'foo', which gets the string name in export table 'foo2'. The
  5300. 'eoo' symbol is an data export symbol, which gets in export
  5301. table the name 'var1'.
  5302. The optional 'LIBRARY <name>' command indicates the _internal_
  5303. name of the output DLL. If '<name>' does not include a suffix,
  5304. the default library suffix, '.DLL' is appended.
  5305. When the .DEF file is used to build an application, rather
  5306. than a library, the 'NAME <name>' command should be used
  5307. instead of 'LIBRARY'. If '<name>' does not include a suffix,
  5308. the default executable suffix, '.EXE' is appended.
  5309. With either 'LIBRARY <name>' or 'NAME <name>' the optional
  5310. specification 'BASE = <number>' may be used to specify a
  5311. non-default base address for the image.
  5312. If neither 'LIBRARY <name>' nor 'NAME <name>' is specified, or
  5313. they specify an empty string, the internal name is the same as
  5314. the filename specified on the command line.
  5315. The complete specification of an export symbol is:
  5316. EXPORTS
  5317. ( ( ( <name1> [ = <name2> ] )
  5318. | ( <name1> = <module-name> . <external-name>))
  5319. [ @ <integer> ] [NONAME] [DATA] [CONSTANT] [PRIVATE] [== <name3>] ) *
  5320. Declares '<name1>' as an exported symbol from the DLL, or
  5321. declares '<name1>' as an exported alias for '<name2>'; or
  5322. declares '<name1>' as a "forward" alias for the symbol
  5323. '<external-name>' in the DLL '<module-name>'. Optionally, the
  5324. symbol may be exported by the specified ordinal '<integer>'
  5325. alias. The optional '<name3>' is the to be used string in
  5326. import/export table for the symbol.
  5327. The optional keywords that follow the declaration indicate:
  5328. 'NONAME': Do not put the symbol name in the DLL's export
  5329. table. It will still be exported by its ordinal alias (either
  5330. the value specified by the .def specification or, otherwise,
  5331. the value assigned by the linker). The symbol name, however,
  5332. does remain visible in the import library (if any), unless
  5333. 'PRIVATE' is also specified.
  5334. 'DATA': The symbol is a variable or object, rather than a
  5335. function. The import lib will export only an indirect
  5336. reference to 'foo' as the symbol '_imp__foo' (ie, 'foo' must
  5337. be resolved as '*_imp__foo').
  5338. 'CONSTANT': Like 'DATA', but put the undecorated 'foo' as well
  5339. as '_imp__foo' into the import library. Both refer to the
  5340. read-only import address table's pointer to the variable, not
  5341. to the variable itself. This can be dangerous. If the user
  5342. code fails to add the 'dllimport' attribute and also fails to
  5343. explicitly add the extra indirection that the use of the
  5344. attribute enforces, the application will behave unexpectedly.
  5345. 'PRIVATE': Put the symbol in the DLL's export table, but do
  5346. not put it into the static import library used to resolve
  5347. imports at link time. The symbol can still be imported using
  5348. the 'LoadLibrary/GetProcAddress' API at runtime or by using
  5349. the GNU ld extension of linking directly to the DLL without an
  5350. import library.
  5351. See ld/deffilep.y in the binutils sources for the full
  5352. specification of other DEF file statements
  5353. While linking a shared dll, 'ld' is able to create a DEF file
  5354. with the '--output-def <file>' command-line option.
  5355. _Using decorations_
  5356. Another way of marking symbols for export is to modify the
  5357. source code itself, so that when building the DLL each symbol
  5358. to be exported is declared as:
  5359. __declspec(dllexport) int a_variable
  5360. __declspec(dllexport) void a_function(int with_args)
  5361. All such symbols will be exported from the DLL. If, however,
  5362. any of the object files in the DLL contain symbols decorated
  5363. in this way, then the normal auto-export behavior is disabled,
  5364. unless the '--export-all-symbols' option is also used.
  5365. Note that object files that wish to access these symbols must
  5366. _not_ decorate them with dllexport. Instead, they should use
  5367. dllimport, instead:
  5368. __declspec(dllimport) int a_variable
  5369. __declspec(dllimport) void a_function(int with_args)
  5370. This complicates the structure of library header files,
  5371. because when included by the library itself the header must
  5372. declare the variables and functions as dllexport, but when
  5373. included by client code the header must declare them as
  5374. dllimport. There are a number of idioms that are typically
  5375. used to do this; often client code can omit the __declspec()
  5376. declaration completely. See '--enable-auto-import' and
  5377. 'automatic data imports' for more information.
  5378. _automatic data imports_
  5379. The standard Windows dll format supports data imports from dlls
  5380. only by adding special decorations (dllimport/dllexport), which let
  5381. the compiler produce specific assembler instructions to deal with
  5382. this issue. This increases the effort necessary to port existing
  5383. Un*x code to these platforms, especially for large c++ libraries
  5384. and applications. The auto-import feature, which was initially
  5385. provided by Paul Sokolovsky, allows one to omit the decorations to
  5386. achieve a behavior that conforms to that on POSIX/Un*x platforms.
  5387. This feature is enabled with the '--enable-auto-import'
  5388. command-line option, although it is enabled by default on
  5389. cygwin/mingw. The '--enable-auto-import' option itself now serves
  5390. mainly to suppress any warnings that are ordinarily emitted when
  5391. linked objects trigger the feature's use.
  5392. auto-import of variables does not always work flawlessly without
  5393. additional assistance. Sometimes, you will see this message
  5394. "variable '<var>' can't be auto-imported. Please read the
  5395. documentation for ld's '--enable-auto-import' for details."
  5396. The '--enable-auto-import' documentation explains why this error
  5397. occurs, and several methods that can be used to overcome this
  5398. difficulty. One of these methods is the _runtime pseudo-relocs_
  5399. feature, described below.
  5400. For complex variables imported from DLLs (such as structs or
  5401. classes), object files typically contain a base address for the
  5402. variable and an offset (_addend_) within the variable-to specify a
  5403. particular field or public member, for instance. Unfortunately,
  5404. the runtime loader used in win32 environments is incapable of
  5405. fixing these references at runtime without the additional
  5406. information supplied by dllimport/dllexport decorations. The
  5407. standard auto-import feature described above is unable to resolve
  5408. these references.
  5409. The '--enable-runtime-pseudo-relocs' switch allows these references
  5410. to be resolved without error, while leaving the task of adjusting
  5411. the references themselves (with their non-zero addends) to
  5412. specialized code provided by the runtime environment. Recent
  5413. versions of the cygwin and mingw environments and compilers provide
  5414. this runtime support; older versions do not. However, the support
  5415. is only necessary on the developer's platform; the compiled result
  5416. will run without error on an older system.
  5417. '--enable-runtime-pseudo-relocs' is not the default; it must be
  5418. explicitly enabled as needed.
  5419. _direct linking to a dll_
  5420. The cygwin/mingw ports of 'ld' support the direct linking,
  5421. including data symbols, to a dll without the usage of any import
  5422. libraries. This is much faster and uses much less memory than does
  5423. the traditional import library method, especially when linking
  5424. large libraries or applications. When 'ld' creates an import lib,
  5425. each function or variable exported from the dll is stored in its
  5426. own bfd, even though a single bfd could contain many exports. The
  5427. overhead involved in storing, loading, and processing so many bfd's
  5428. is quite large, and explains the tremendous time, memory, and
  5429. storage needed to link against particularly large or complex
  5430. libraries when using import libs.
  5431. Linking directly to a dll uses no extra command-line switches other
  5432. than '-L' and '-l', because 'ld' already searches for a number of
  5433. names to match each library. All that is needed from the
  5434. developer's perspective is an understanding of this search, in
  5435. order to force ld to select the dll instead of an import library.
  5436. For instance, when ld is called with the argument '-lxxx' it will
  5437. attempt to find, in the first directory of its search path,
  5438. libxxx.dll.a
  5439. xxx.dll.a
  5440. libxxx.a
  5441. xxx.lib
  5442. libxxx.lib
  5443. cygxxx.dll (*)
  5444. libxxx.dll
  5445. xxx.dll
  5446. before moving on to the next directory in the search path.
  5447. (*) Actually, this is not 'cygxxx.dll' but in fact is
  5448. '<prefix>xxx.dll', where '<prefix>' is set by the 'ld' option
  5449. '--dll-search-prefix=<prefix>'. In the case of cygwin, the
  5450. standard gcc spec file includes '--dll-search-prefix=cyg', so in
  5451. effect we actually search for 'cygxxx.dll'.
  5452. Other win32-based unix environments, such as mingw or pw32, may use
  5453. other '<prefix>'es, although at present only cygwin makes use of
  5454. this feature. It was originally intended to help avoid name
  5455. conflicts among dll's built for the various win32/un*x
  5456. environments, so that (for example) two versions of a zlib dll
  5457. could coexist on the same machine.
  5458. The generic cygwin/mingw path layout uses a 'bin' directory for
  5459. applications and dll's and a 'lib' directory for the import
  5460. libraries (using cygwin nomenclature):
  5461. bin/
  5462. cygxxx.dll
  5463. lib/
  5464. libxxx.dll.a (in case of dll's)
  5465. libxxx.a (in case of static archive)
  5466. Linking directly to a dll without using the import library can be
  5467. done two ways:
  5468. 1. Use the dll directly by adding the 'bin' path to the link line
  5469. gcc -Wl,-verbose -o a.exe -L../bin/ -lxxx
  5470. However, as the dll's often have version numbers appended to their
  5471. names ('cygncurses-5.dll') this will often fail, unless one
  5472. specifies '-L../bin -lncurses-5' to include the version. Import
  5473. libs are generally not versioned, and do not have this difficulty.
  5474. 2. Create a symbolic link from the dll to a file in the 'lib'
  5475. directory according to the above mentioned search pattern. This
  5476. should be used to avoid unwanted changes in the tools needed for
  5477. making the app/dll.
  5478. ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a]
  5479. Then you can link without any make environment changes.
  5480. gcc -Wl,-verbose -o a.exe -L../lib/ -lxxx
  5481. This technique also avoids the version number problems, because the
  5482. following is perfectly legal
  5483. bin/
  5484. cygxxx-5.dll
  5485. lib/
  5486. libxxx.dll.a -> ../bin/cygxxx-5.dll
  5487. Linking directly to a dll without using an import lib will work
  5488. even when auto-import features are exercised, and even when
  5489. '--enable-runtime-pseudo-relocs' is used.
  5490. Given the improvements in speed and memory usage, one might
  5491. justifiably wonder why import libraries are used at all. There are
  5492. three reasons:
  5493. 1. Until recently, the link-directly-to-dll functionality did
  5494. _not_ work with auto-imported data.
  5495. 2. Sometimes it is necessary to include pure static objects within
  5496. the import library (which otherwise contains only bfd's for
  5497. indirection symbols that point to the exports of a dll). Again,
  5498. the import lib for the cygwin kernel makes use of this ability, and
  5499. it is not possible to do this without an import lib.
  5500. 3. Symbol aliases can only be resolved using an import lib. This
  5501. is critical when linking against OS-supplied dll's (eg, the win32
  5502. API) in which symbols are usually exported as undecorated aliases
  5503. of their stdcall-decorated assembly names.
  5504. So, import libs are not going away. But the ability to replace
  5505. true import libs with a simple symbolic link to (or a copy of) a
  5506. dll, in many cases, is a useful addition to the suite of tools
  5507. binutils makes available to the win32 developer. Given the massive
  5508. improvements in memory requirements during linking, storage
  5509. requirements, and linking speed, we expect that many developers
  5510. will soon begin to use this feature whenever possible.
  5511. _symbol aliasing_
  5512. _adding additional names_
  5513. Sometimes, it is useful to export symbols with additional
  5514. names. A symbol 'foo' will be exported as 'foo', but it can
  5515. also be exported as '_foo' by using special directives in the
  5516. DEF file when creating the dll. This will affect also the
  5517. optional created import library. Consider the following DEF
  5518. file:
  5519. LIBRARY "xyz.dll" BASE=0x61000000
  5520. EXPORTS
  5521. foo
  5522. _foo = foo
  5523. The line '_foo = foo' maps the symbol 'foo' to '_foo'.
  5524. Another method for creating a symbol alias is to create it in
  5525. the source code using the "weak" attribute:
  5526. void foo () { /* Do something. */; }
  5527. void _foo () __attribute__ ((weak, alias ("foo")));
  5528. See the gcc manual for more information about attributes and
  5529. weak symbols.
  5530. _renaming symbols_
  5531. Sometimes it is useful to rename exports. For instance, the
  5532. cygwin kernel does this regularly. A symbol '_foo' can be
  5533. exported as 'foo' but not as '_foo' by using special
  5534. directives in the DEF file. (This will also affect the import
  5535. library, if it is created). In the following example:
  5536. LIBRARY "xyz.dll" BASE=0x61000000
  5537. EXPORTS
  5538. _foo = foo
  5539. The line '_foo = foo' maps the exported symbol 'foo' to
  5540. '_foo'.
  5541. Note: using a DEF file disables the default auto-export behavior,
  5542. unless the '--export-all-symbols' command-line option is used. If,
  5543. however, you are trying to rename symbols, then you should list
  5544. _all_ desired exports in the DEF file, including the symbols that
  5545. are not being renamed, and do _not_ use the '--export-all-symbols'
  5546. option. If you list only the renamed symbols in the DEF file, and
  5547. use '--export-all-symbols' to handle the other symbols, then the
  5548. both the new names _and_ the original names for the renamed symbols
  5549. will be exported. In effect, you'd be aliasing those symbols, not
  5550. renaming them, which is probably not what you wanted.
  5551. _weak externals_
  5552. The Windows object format, PE, specifies a form of weak symbols
  5553. called weak externals. When a weak symbol is linked and the symbol
  5554. is not defined, the weak symbol becomes an alias for some other
  5555. symbol. There are three variants of weak externals:
  5556. * Definition is searched for in objects and libraries,
  5557. historically called lazy externals.
  5558. * Definition is searched for only in other objects, not in
  5559. libraries. This form is not presently implemented.
  5560. * No search; the symbol is an alias. This form is not presently
  5561. implemented.
  5562. As a GNU extension, weak symbols that do not specify an alternate
  5563. symbol are supported. If the symbol is undefined when linking, the
  5564. symbol uses a default value.
  5565. _aligned common symbols_
  5566. As a GNU extension to the PE file format, it is possible to specify
  5567. the desired alignment for a common symbol. This information is
  5568. conveyed from the assembler or compiler to the linker by means of
  5569. GNU-specific commands carried in the object file's '.drectve'
  5570. section, which are recognized by 'ld' and respected when laying out
  5571. the common symbols. Native tools will be able to process object
  5572. files employing this GNU extension, but will fail to respect the
  5573. alignment instructions, and may issue noisy warnings about unknown
  5574. linker directives.
  5575. 
  5576. File: ld.info, Node: Xtensa, Prev: WIN32, Up: Machine Dependent
  5577. 4.17 'ld' and Xtensa Processors
  5578. ===============================
  5579. The default 'ld' behavior for Xtensa processors is to interpret
  5580. 'SECTIONS' commands so that lists of explicitly named sections in a
  5581. specification with a wildcard file will be interleaved when necessary to
  5582. keep literal pools within the range of PC-relative load offsets. For
  5583. example, with the command:
  5584. SECTIONS
  5585. {
  5586. .text : {
  5587. *(.literal .text)
  5588. }
  5589. }
  5590. 'ld' may interleave some of the '.literal' and '.text' sections from
  5591. different object files to ensure that the literal pools are within the
  5592. range of PC-relative load offsets. A valid interleaving might place the
  5593. '.literal' sections from an initial group of files followed by the
  5594. '.text' sections of that group of files. Then, the '.literal' sections
  5595. from the rest of the files and the '.text' sections from the rest of the
  5596. files would follow.
  5597. Relaxation is enabled by default for the Xtensa version of 'ld' and
  5598. provides two important link-time optimizations. The first optimization
  5599. is to combine identical literal values to reduce code size. A redundant
  5600. literal will be removed and all the 'L32R' instructions that use it will
  5601. be changed to reference an identical literal, as long as the location of
  5602. the replacement literal is within the offset range of all the 'L32R'
  5603. instructions. The second optimization is to remove unnecessary overhead
  5604. from assembler-generated "longcall" sequences of 'L32R'/'CALLXN' when
  5605. the target functions are within range of direct 'CALLN' instructions.
  5606. For each of these cases where an indirect call sequence can be
  5607. optimized to a direct call, the linker will change the 'CALLXN'
  5608. instruction to a 'CALLN' instruction, remove the 'L32R' instruction, and
  5609. remove the literal referenced by the 'L32R' instruction if it is not
  5610. used for anything else. Removing the 'L32R' instruction always reduces
  5611. code size but can potentially hurt performance by changing the alignment
  5612. of subsequent branch targets. By default, the linker will always
  5613. preserve alignments, either by switching some instructions between
  5614. 24-bit encodings and the equivalent density instructions or by inserting
  5615. a no-op in place of the 'L32R' instruction that was removed. If code
  5616. size is more important than performance, the '--size-opt' option can be
  5617. used to prevent the linker from widening density instructions or
  5618. inserting no-ops, except in a few cases where no-ops are required for
  5619. correctness.
  5620. The following Xtensa-specific command-line options can be used to
  5621. control the linker:
  5622. '--size-opt'
  5623. When optimizing indirect calls to direct calls, optimize for code
  5624. size more than performance. With this option, the linker will not
  5625. insert no-ops or widen density instructions to preserve branch
  5626. target alignment. There may still be some cases where no-ops are
  5627. required to preserve the correctness of the code.
  5628. 
  5629. File: ld.info, Node: BFD, Next: Reporting Bugs, Prev: Machine Dependent, Up: Top
  5630. 5 BFD
  5631. *****
  5632. The linker accesses object and archive files using the BFD libraries.
  5633. These libraries allow the linker to use the same routines to operate on
  5634. object files whatever the object file format. A different object file
  5635. format can be supported simply by creating a new BFD back end and adding
  5636. it to the library. To conserve runtime memory, however, the linker and
  5637. associated tools are usually configured to support only a subset of the
  5638. object file formats available. You can use 'objdump -i' (*note objdump:
  5639. (binutils.info)objdump.) to list all the formats available for your
  5640. configuration.
  5641. As with most implementations, BFD is a compromise between several
  5642. conflicting requirements. The major factor influencing BFD design was
  5643. efficiency: any time used converting between formats is time which would
  5644. not have been spent had BFD not been involved. This is partly offset by
  5645. abstraction payback; since BFD simplifies applications and back ends,
  5646. more time and care may be spent optimizing algorithms for a greater
  5647. speed.
  5648. One minor artifact of the BFD solution which you should bear in mind
  5649. is the potential for information loss. There are two places where
  5650. useful information can be lost using the BFD mechanism: during
  5651. conversion and during output. *Note BFD information loss::.
  5652. * Menu:
  5653. * BFD outline:: How it works: an outline of BFD
  5654. 
  5655. File: ld.info, Node: BFD outline, Up: BFD
  5656. 5.1 How It Works: An Outline of BFD
  5657. ===================================
  5658. When an object file is opened, BFD subroutines automatically determine
  5659. the format of the input object file. They then build a descriptor in
  5660. memory with pointers to routines that will be used to access elements of
  5661. the object file's data structures.
  5662. As different information from the object files is required, BFD reads
  5663. from different sections of the file and processes them. For example, a
  5664. very common operation for the linker is processing symbol tables. Each
  5665. BFD back end provides a routine for converting between the object file's
  5666. representation of symbols and an internal canonical format. When the
  5667. linker asks for the symbol table of an object file, it calls through a
  5668. memory pointer to the routine from the relevant BFD back end which reads
  5669. and converts the table into a canonical form. The linker then operates
  5670. upon the canonical form. When the link is finished and the linker
  5671. writes the output file's symbol table, another BFD back end routine is
  5672. called to take the newly created symbol table and convert it into the
  5673. chosen output format.
  5674. * Menu:
  5675. * BFD information loss:: Information Loss
  5676. * Canonical format:: The BFD canonical object-file format
  5677. 
  5678. File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline
  5679. 5.1.1 Information Loss
  5680. ----------------------
  5681. _Information can be lost during output._ The output formats supported
  5682. by BFD do not provide identical facilities, and information which can be
  5683. described in one form has nowhere to go in another format. One example
  5684. of this is alignment information in 'b.out'. There is nowhere in an
  5685. 'a.out' format file to store alignment information on the contained
  5686. data, so when a file is linked from 'b.out' and an 'a.out' image is
  5687. produced, alignment information will not propagate to the output file.
  5688. (The linker will still use the alignment information internally, so the
  5689. link is performed correctly).
  5690. Another example is COFF section names. COFF files may contain an
  5691. unlimited number of sections, each one with a textual section name. If
  5692. the target of the link is a format which does not have many sections
  5693. (e.g., 'a.out') or has sections without names (e.g., the Oasys format),
  5694. the link cannot be done simply. You can circumvent this problem by
  5695. describing the desired input-to-output section mapping with the linker
  5696. command language.
  5697. _Information can be lost during canonicalization._ The BFD internal
  5698. canonical form of the external formats is not exhaustive; there are
  5699. structures in input formats for which there is no direct representation
  5700. internally. This means that the BFD back ends cannot maintain all
  5701. possible data richness through the transformation between external to
  5702. internal and back to external formats.
  5703. This limitation is only a problem when an application reads one
  5704. format and writes another. Each BFD back end is responsible for
  5705. maintaining as much data as possible, and the internal BFD canonical
  5706. form has structures which are opaque to the BFD core, and exported only
  5707. to the back ends. When a file is read in one format, the canonical form
  5708. is generated for BFD and the application. At the same time, the back
  5709. end saves away any information which may otherwise be lost. If the data
  5710. is then written back in the same format, the back end routine will be
  5711. able to use the canonical form provided by the BFD core as well as the
  5712. information it prepared earlier. Since there is a great deal of
  5713. commonality between back ends, there is no information lost when linking
  5714. or copying big endian COFF to little endian COFF, or 'a.out' to 'b.out'.
  5715. When a mixture of formats is linked, the information is only lost from
  5716. the files whose format differs from the destination.
  5717. 
  5718. File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline
  5719. 5.1.2 The BFD canonical object-file format
  5720. ------------------------------------------
  5721. The greatest potential for loss of information occurs when there is the
  5722. least overlap between the information provided by the source format,
  5723. that stored by the canonical format, and that needed by the destination
  5724. format. A brief description of the canonical form may help you
  5725. understand which kinds of data you can count on preserving across
  5726. conversions.
  5727. _files_
  5728. Information stored on a per-file basis includes target machine
  5729. architecture, particular implementation format type, a demand
  5730. pageable bit, and a write protected bit. Information like Unix
  5731. magic numbers is not stored here--only the magic numbers' meaning,
  5732. so a 'ZMAGIC' file would have both the demand pageable bit and the
  5733. write protected text bit set. The byte order of the target is
  5734. stored on a per-file basis, so that big- and little-endian object
  5735. files may be used with one another.
  5736. _sections_
  5737. Each section in the input file contains the name of the section,
  5738. the section's original address in the object file, size and
  5739. alignment information, various flags, and pointers into other BFD
  5740. data structures.
  5741. _symbols_
  5742. Each symbol contains a pointer to the information for the object
  5743. file which originally defined it, its name, its value, and various
  5744. flag bits. When a BFD back end reads in a symbol table, it
  5745. relocates all symbols to make them relative to the base of the
  5746. section where they were defined. Doing this ensures that each
  5747. symbol points to its containing section. Each symbol also has a
  5748. varying amount of hidden private data for the BFD back end. Since
  5749. the symbol points to the original file, the private data format for
  5750. that symbol is accessible. 'ld' can operate on a collection of
  5751. symbols of wildly different formats without problems.
  5752. Normal global and simple local symbols are maintained on output, so
  5753. an output file (no matter its format) will retain symbols pointing
  5754. to functions and to global, static, and common variables. Some
  5755. symbol information is not worth retaining; in 'a.out', type
  5756. information is stored in the symbol table as long symbol names.
  5757. This information would be useless to most COFF debuggers; the
  5758. linker has command-line switches to allow users to throw it away.
  5759. There is one word of type information within the symbol, so if the
  5760. format supports symbol type information within symbols (for
  5761. example, COFF, Oasys) and the type is simple enough to fit within
  5762. one word (nearly everything but aggregates), the information will
  5763. be preserved.
  5764. _relocation level_
  5765. Each canonical BFD relocation record contains a pointer to the
  5766. symbol to relocate to, the offset of the data to relocate, the
  5767. section the data is in, and a pointer to a relocation type
  5768. descriptor. Relocation is performed by passing messages through
  5769. the relocation type descriptor and the symbol pointer. Therefore,
  5770. relocations can be performed on output data using a relocation
  5771. method that is only available in one of the input formats. For
  5772. instance, Oasys provides a byte relocation format. A relocation
  5773. record requesting this relocation type would point indirectly to a
  5774. routine to perform this, so the relocation may be performed on a
  5775. byte being written to a 68k COFF file, even though 68k COFF has no
  5776. such relocation type.
  5777. _line numbers_
  5778. Object formats can contain, for debugging purposes, some form of
  5779. mapping between symbols, source line numbers, and addresses in the
  5780. output file. These addresses have to be relocated along with the
  5781. symbol information. Each symbol with an associated list of line
  5782. number records points to the first record of the list. The head of
  5783. a line number list consists of a pointer to the symbol, which
  5784. allows finding out the address of the function whose line number is
  5785. being described. The rest of the list is made up of pairs: offsets
  5786. into the section and line numbers. Any format which can simply
  5787. derive this information can pass it successfully between formats.
  5788. 
  5789. File: ld.info, Node: Reporting Bugs, Next: MRI, Prev: BFD, Up: Top
  5790. 6 Reporting Bugs
  5791. ****************
  5792. Your bug reports play an essential role in making 'ld' reliable.
  5793. Reporting a bug may help you by bringing a solution to your problem,
  5794. or it may not. But in any case the principal function of a bug report
  5795. is to help the entire community by making the next version of 'ld' work
  5796. better. Bug reports are your contribution to the maintenance of 'ld'.
  5797. In order for a bug report to serve its purpose, you must include the
  5798. information that enables us to fix the bug.
  5799. * Menu:
  5800. * Bug Criteria:: Have you found a bug?
  5801. * Bug Reporting:: How to report bugs
  5802. 
  5803. File: ld.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs
  5804. 6.1 Have You Found a Bug?
  5805. =========================
  5806. If you are not sure whether you have found a bug, here are some
  5807. guidelines:
  5808. * If the linker gets a fatal signal, for any input whatever, that is
  5809. a 'ld' bug. Reliable linkers never crash.
  5810. * If 'ld' produces an error message for valid input, that is a bug.
  5811. * If 'ld' does not produce an error message for invalid input, that
  5812. may be a bug. In the general case, the linker can not verify that
  5813. object files are correct.
  5814. * If you are an experienced user of linkers, your suggestions for
  5815. improvement of 'ld' are welcome in any case.
  5816. 
  5817. File: ld.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs
  5818. 6.2 How to Report Bugs
  5819. ======================
  5820. A number of companies and individuals offer support for GNU products.
  5821. If you obtained 'ld' from a support organization, we recommend you
  5822. contact that organization first.
  5823. You can find contact information for many support companies and
  5824. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  5825. Otherwise, send bug reports for 'ld' to
  5826. <http://www.sourceware.org/bugzilla/>.
  5827. The fundamental principle of reporting bugs usefully is this: *report
  5828. all the facts*. If you are not sure whether to state a fact or leave it
  5829. out, state it!
  5830. Often people omit facts because they think they know what causes the
  5831. problem and assume that some details do not matter. Thus, you might
  5832. assume that the name of a symbol you use in an example does not matter.
  5833. Well, probably it does not, but one cannot be sure. Perhaps the bug is
  5834. a stray memory reference which happens to fetch from the location where
  5835. that name is stored in memory; perhaps, if the name were different, the
  5836. contents of that location would fool the linker into doing the right
  5837. thing despite the bug. Play it safe and give a specific, complete
  5838. example. That is the easiest thing for you to do, and the most helpful.
  5839. Keep in mind that the purpose of a bug report is to enable us to fix
  5840. the bug if it is new to us. Therefore, always write your bug reports on
  5841. the assumption that the bug has not been reported previously.
  5842. Sometimes people give a few sketchy facts and ask, "Does this ring a
  5843. bell?" This cannot help us fix a bug, so it is basically useless. We
  5844. respond by asking for enough details to enable us to investigate. You
  5845. might as well expedite matters by sending them to begin with.
  5846. To enable us to fix the bug, you should include all these things:
  5847. * The version of 'ld'. 'ld' announces it if you start it with the
  5848. '--version' argument.
  5849. Without this, we will not know whether there is any point in
  5850. looking for the bug in the current version of 'ld'.
  5851. * Any patches you may have applied to the 'ld' source, including any
  5852. patches made to the 'BFD' library.
  5853. * The type of machine you are using, and the operating system name
  5854. and version number.
  5855. * What compiler (and its version) was used to compile 'ld'--e.g.
  5856. "'gcc-2.7'".
  5857. * The command arguments you gave the linker to link your example and
  5858. observe the bug. To guarantee you will not omit something
  5859. important, list them all. A copy of the Makefile (or the output
  5860. from make) is sufficient.
  5861. If we were to try to guess the arguments, we would probably guess
  5862. wrong and then we might not encounter the bug.
  5863. * A complete input file, or set of input files, that will reproduce
  5864. the bug. It is generally most helpful to send the actual object
  5865. files provided that they are reasonably small. Say no more than
  5866. 10K. For bigger files you can either make them available by FTP or
  5867. HTTP or else state that you are willing to send the object file(s)
  5868. to whomever requests them. (Note - your email will be going to a
  5869. mailing list, so we do not want to clog it up with large
  5870. attachments). But small attachments are best.
  5871. If the source files were assembled using 'gas' or compiled using
  5872. 'gcc', then it may be OK to send the source files rather than the
  5873. object files. In this case, be sure to say exactly what version of
  5874. 'gas' or 'gcc' was used to produce the object files. Also say how
  5875. 'gas' or 'gcc' were configured.
  5876. * A description of what behavior you observe that you believe is
  5877. incorrect. For example, "It gets a fatal signal."
  5878. Of course, if the bug is that 'ld' gets a fatal signal, then we
  5879. will certainly notice it. But if the bug is incorrect output, we
  5880. might not notice unless it is glaringly wrong. You might as well
  5881. not give us a chance to make a mistake.
  5882. Even if the problem you experience is a fatal signal, you should
  5883. still say so explicitly. Suppose something strange is going on,
  5884. such as, your copy of 'ld' is out of sync, or you have encountered
  5885. a bug in the C library on your system. (This has happened!) Your
  5886. copy might crash and ours would not. If you told us to expect a
  5887. crash, then when ours fails to crash, we would know that the bug
  5888. was not happening for us. If you had not told us to expect a
  5889. crash, then we would not be able to draw any conclusion from our
  5890. observations.
  5891. * If you wish to suggest changes to the 'ld' source, send us context
  5892. diffs, as generated by 'diff' with the '-u', '-c', or '-p' option.
  5893. Always send diffs from the old file to the new file. If you even
  5894. discuss something in the 'ld' source, refer to it by context, not
  5895. by line number.
  5896. The line numbers in our development sources will not match those in
  5897. your sources. Your line numbers would convey no useful information
  5898. to us.
  5899. Here are some things that are not necessary:
  5900. * A description of the envelope of the bug.
  5901. Often people who encounter a bug spend a lot of time investigating
  5902. which changes to the input file will make the bug go away and which
  5903. changes will not affect it.
  5904. This is often time consuming and not very useful, because the way
  5905. we will find the bug is by running a single example under the
  5906. debugger with breakpoints, not by pure deduction from a series of
  5907. examples. We recommend that you save your time for something else.
  5908. Of course, if you can find a simpler example to report _instead_ of
  5909. the original one, that is a convenience for us. Errors in the
  5910. output will be easier to spot, running under the debugger will take
  5911. less time, and so on.
  5912. However, simplification is not vital; if you do not want to do
  5913. this, report the bug anyway and send us the entire test case you
  5914. used.
  5915. * A patch for the bug.
  5916. A patch for the bug does help us if it is a good one. But do not
  5917. omit the necessary information, such as the test case, on the
  5918. assumption that a patch is all we need. We might see problems with
  5919. your patch and decide to fix the problem another way, or we might
  5920. not understand it at all.
  5921. Sometimes with a program as complicated as 'ld' it is very hard to
  5922. construct an example that will make the program follow a certain
  5923. path through the code. If you do not send us the example, we will
  5924. not be able to construct one, so we will not be able to verify that
  5925. the bug is fixed.
  5926. And if we cannot understand what bug you are trying to fix, or why
  5927. your patch should be an improvement, we will not install it. A
  5928. test case will help us to understand.
  5929. * A guess about what the bug is or what it depends on.
  5930. Such guesses are usually wrong. Even we cannot guess right about
  5931. such things without first using the debugger to find the facts.
  5932. 
  5933. File: ld.info, Node: MRI, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top
  5934. Appendix A MRI Compatible Script Files
  5935. **************************************
  5936. To aid users making the transition to GNU 'ld' from the MRI linker, 'ld'
  5937. can use MRI compatible linker scripts as an alternative to the more
  5938. general-purpose linker scripting language described in *note Scripts::.
  5939. MRI compatible linker scripts have a much simpler command set than the
  5940. scripting language otherwise used with 'ld'. GNU 'ld' supports the most
  5941. commonly used MRI linker commands; these commands are described here.
  5942. In general, MRI scripts aren't of much use with the 'a.out' object
  5943. file format, since it only has three sections and MRI scripts lack some
  5944. features to make use of them.
  5945. You can specify a file containing an MRI-compatible script using the
  5946. '-c' command-line option.
  5947. Each command in an MRI-compatible script occupies its own line; each
  5948. command line starts with the keyword that identifies the command (though
  5949. blank lines are also allowed for punctuation). If a line of an
  5950. MRI-compatible script begins with an unrecognized keyword, 'ld' issues a
  5951. warning message, but continues processing the script.
  5952. Lines beginning with '*' are comments.
  5953. You can write these commands using all upper-case letters, or all
  5954. lower case; for example, 'chip' is the same as 'CHIP'. The following
  5955. list shows only the upper-case form of each command.
  5956. 'ABSOLUTE SECNAME'
  5957. 'ABSOLUTE SECNAME, SECNAME, ... SECNAME'
  5958. Normally, 'ld' includes in the output file all sections from all
  5959. the input files. However, in an MRI-compatible script, you can use
  5960. the 'ABSOLUTE' command to restrict the sections that will be
  5961. present in your output program. If the 'ABSOLUTE' command is used
  5962. at all in a script, then only the sections named explicitly in
  5963. 'ABSOLUTE' commands will appear in the linker output. You can
  5964. still use other input sections (whatever you select on the command
  5965. line, or using 'LOAD') to resolve addresses in the output file.
  5966. 'ALIAS OUT-SECNAME, IN-SECNAME'
  5967. Use this command to place the data from input section IN-SECNAME in
  5968. a section called OUT-SECNAME in the linker output file.
  5969. IN-SECNAME may be an integer.
  5970. 'ALIGN SECNAME = EXPRESSION'
  5971. Align the section called SECNAME to EXPRESSION. The EXPRESSION
  5972. should be a power of two.
  5973. 'BASE EXPRESSION'
  5974. Use the value of EXPRESSION as the lowest address (other than
  5975. absolute addresses) in the output file.
  5976. 'CHIP EXPRESSION'
  5977. 'CHIP EXPRESSION, EXPRESSION'
  5978. This command does nothing; it is accepted only for compatibility.
  5979. 'END'
  5980. This command does nothing whatever; it's only accepted for
  5981. compatibility.
  5982. 'FORMAT OUTPUT-FORMAT'
  5983. Similar to the 'OUTPUT_FORMAT' command in the more general linker
  5984. language, but restricted to S-records, if OUTPUT-FORMAT is 'S'
  5985. 'LIST ANYTHING...'
  5986. Print (to the standard output file) a link map, as produced by the
  5987. 'ld' command-line option '-M'.
  5988. The keyword 'LIST' may be followed by anything on the same line,
  5989. with no change in its effect.
  5990. 'LOAD FILENAME'
  5991. 'LOAD FILENAME, FILENAME, ... FILENAME'
  5992. Include one or more object file FILENAME in the link; this has the
  5993. same effect as specifying FILENAME directly on the 'ld' command
  5994. line.
  5995. 'NAME OUTPUT-NAME'
  5996. OUTPUT-NAME is the name for the program produced by 'ld'; the
  5997. MRI-compatible command 'NAME' is equivalent to the command-line
  5998. option '-o' or the general script language command 'OUTPUT'.
  5999. 'ORDER SECNAME, SECNAME, ... SECNAME'
  6000. 'ORDER SECNAME SECNAME SECNAME'
  6001. Normally, 'ld' orders the sections in its output file in the order
  6002. in which they first appear in the input files. In an
  6003. MRI-compatible script, you can override this ordering with the
  6004. 'ORDER' command. The sections you list with 'ORDER' will appear
  6005. first in your output file, in the order specified.
  6006. 'PUBLIC NAME=EXPRESSION'
  6007. 'PUBLIC NAME,EXPRESSION'
  6008. 'PUBLIC NAME EXPRESSION'
  6009. Supply a value (EXPRESSION) for external symbol NAME used in the
  6010. linker input files.
  6011. 'SECT SECNAME, EXPRESSION'
  6012. 'SECT SECNAME=EXPRESSION'
  6013. 'SECT SECNAME EXPRESSION'
  6014. You can use any of these three forms of the 'SECT' command to
  6015. specify the start address (EXPRESSION) for section SECNAME. If you
  6016. have more than one 'SECT' statement for the same SECNAME, only the
  6017. _first_ sets the start address.
  6018. 
  6019. File: ld.info, Node: GNU Free Documentation License, Next: LD Index, Prev: MRI, Up: Top
  6020. Appendix B GNU Free Documentation License
  6021. *****************************************
  6022. Version 1.3, 3 November 2008
  6023. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  6024. <http://fsf.org/>
  6025. Everyone is permitted to copy and distribute verbatim copies
  6026. of this license document, but changing it is not allowed.
  6027. 0. PREAMBLE
  6028. The purpose of this License is to make a manual, textbook, or other
  6029. functional and useful document "free" in the sense of freedom: to
  6030. assure everyone the effective freedom to copy and redistribute it,
  6031. with or without modifying it, either commercially or
  6032. noncommercially. Secondarily, this License preserves for the
  6033. author and publisher a way to get credit for their work, while not
  6034. being considered responsible for modifications made by others.
  6035. This License is a kind of "copyleft", which means that derivative
  6036. works of the document must themselves be free in the same sense.
  6037. It complements the GNU General Public License, which is a copyleft
  6038. license designed for free software.
  6039. We have designed this License in order to use it for manuals for
  6040. free software, because free software needs free documentation: a
  6041. free program should come with manuals providing the same freedoms
  6042. that the software does. But this License is not limited to
  6043. software manuals; it can be used for any textual work, regardless
  6044. of subject matter or whether it is published as a printed book. We
  6045. recommend this License principally for works whose purpose is
  6046. instruction or reference.
  6047. 1. APPLICABILITY AND DEFINITIONS
  6048. This License applies to any manual or other work, in any medium,
  6049. that contains a notice placed by the copyright holder saying it can
  6050. be distributed under the terms of this License. Such a notice
  6051. grants a world-wide, royalty-free license, unlimited in duration,
  6052. to use that work under the conditions stated herein. The
  6053. "Document", below, refers to any such manual or work. Any member
  6054. of the public is a licensee, and is addressed as "you". You accept
  6055. the license if you copy, modify or distribute the work in a way
  6056. requiring permission under copyright law.
  6057. A "Modified Version" of the Document means any work containing the
  6058. Document or a portion of it, either copied verbatim, or with
  6059. modifications and/or translated into another language.
  6060. A "Secondary Section" is a named appendix or a front-matter section
  6061. of the Document that deals exclusively with the relationship of the
  6062. publishers or authors of the Document to the Document's overall
  6063. subject (or to related matters) and contains nothing that could
  6064. fall directly within that overall subject. (Thus, if the Document
  6065. is in part a textbook of mathematics, a Secondary Section may not
  6066. explain any mathematics.) The relationship could be a matter of
  6067. historical connection with the subject or with related matters, or
  6068. of legal, commercial, philosophical, ethical or political position
  6069. regarding them.
  6070. The "Invariant Sections" are certain Secondary Sections whose
  6071. titles are designated, as being those of Invariant Sections, in the
  6072. notice that says that the Document is released under this License.
  6073. If a section does not fit the above definition of Secondary then it
  6074. is not allowed to be designated as Invariant. The Document may
  6075. contain zero Invariant Sections. If the Document does not identify
  6076. any Invariant Sections then there are none.
  6077. The "Cover Texts" are certain short passages of text that are
  6078. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  6079. that says that the Document is released under this License. A
  6080. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  6081. be at most 25 words.
  6082. A "Transparent" copy of the Document means a machine-readable copy,
  6083. represented in a format whose specification is available to the
  6084. general public, that is suitable for revising the document
  6085. straightforwardly with generic text editors or (for images composed
  6086. of pixels) generic paint programs or (for drawings) some widely
  6087. available drawing editor, and that is suitable for input to text
  6088. formatters or for automatic translation to a variety of formats
  6089. suitable for input to text formatters. A copy made in an otherwise
  6090. Transparent file format whose markup, or absence of markup, has
  6091. been arranged to thwart or discourage subsequent modification by
  6092. readers is not Transparent. An image format is not Transparent if
  6093. used for any substantial amount of text. A copy that is not
  6094. "Transparent" is called "Opaque".
  6095. Examples of suitable formats for Transparent copies include plain
  6096. ASCII without markup, Texinfo input format, LaTeX input format,
  6097. SGML or XML using a publicly available DTD, and standard-conforming
  6098. simple HTML, PostScript or PDF designed for human modification.
  6099. Examples of transparent image formats include PNG, XCF and JPG.
  6100. Opaque formats include proprietary formats that can be read and
  6101. edited only by proprietary word processors, SGML or XML for which
  6102. the DTD and/or processing tools are not generally available, and
  6103. the machine-generated HTML, PostScript or PDF produced by some word
  6104. processors for output purposes only.
  6105. The "Title Page" means, for a printed book, the title page itself,
  6106. plus such following pages as are needed to hold, legibly, the
  6107. material this License requires to appear in the title page. For
  6108. works in formats which do not have any title page as such, "Title
  6109. Page" means the text near the most prominent appearance of the
  6110. work's title, preceding the beginning of the body of the text.
  6111. The "publisher" means any person or entity that distributes copies
  6112. of the Document to the public.
  6113. A section "Entitled XYZ" means a named subunit of the Document
  6114. whose title either is precisely XYZ or contains XYZ in parentheses
  6115. following text that translates XYZ in another language. (Here XYZ
  6116. stands for a specific section name mentioned below, such as
  6117. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  6118. To "Preserve the Title" of such a section when you modify the
  6119. Document means that it remains a section "Entitled XYZ" according
  6120. to this definition.
  6121. The Document may include Warranty Disclaimers next to the notice
  6122. which states that this License applies to the Document. These
  6123. Warranty Disclaimers are considered to be included by reference in
  6124. this License, but only as regards disclaiming warranties: any other
  6125. implication that these Warranty Disclaimers may have is void and
  6126. has no effect on the meaning of this License.
  6127. 2. VERBATIM COPYING
  6128. You may copy and distribute the Document in any medium, either
  6129. commercially or noncommercially, provided that this License, the
  6130. copyright notices, and the license notice saying this License
  6131. applies to the Document are reproduced in all copies, and that you
  6132. add no other conditions whatsoever to those of this License. You
  6133. may not use technical measures to obstruct or control the reading
  6134. or further copying of the copies you make or distribute. However,
  6135. you may accept compensation in exchange for copies. If you
  6136. distribute a large enough number of copies you must also follow the
  6137. conditions in section 3.
  6138. You may also lend copies, under the same conditions stated above,
  6139. and you may publicly display copies.
  6140. 3. COPYING IN QUANTITY
  6141. If you publish printed copies (or copies in media that commonly
  6142. have printed covers) of the Document, numbering more than 100, and
  6143. the Document's license notice requires Cover Texts, you must
  6144. enclose the copies in covers that carry, clearly and legibly, all
  6145. these Cover Texts: Front-Cover Texts on the front cover, and
  6146. Back-Cover Texts on the back cover. Both covers must also clearly
  6147. and legibly identify you as the publisher of these copies. The
  6148. front cover must present the full title with all words of the title
  6149. equally prominent and visible. You may add other material on the
  6150. covers in addition. Copying with changes limited to the covers, as
  6151. long as they preserve the title of the Document and satisfy these
  6152. conditions, can be treated as verbatim copying in other respects.
  6153. If the required texts for either cover are too voluminous to fit
  6154. legibly, you should put the first ones listed (as many as fit
  6155. reasonably) on the actual cover, and continue the rest onto
  6156. adjacent pages.
  6157. If you publish or distribute Opaque copies of the Document
  6158. numbering more than 100, you must either include a machine-readable
  6159. Transparent copy along with each Opaque copy, or state in or with
  6160. each Opaque copy a computer-network location from which the general
  6161. network-using public has access to download using public-standard
  6162. network protocols a complete Transparent copy of the Document, free
  6163. of added material. If you use the latter option, you must take
  6164. reasonably prudent steps, when you begin distribution of Opaque
  6165. copies in quantity, to ensure that this Transparent copy will
  6166. remain thus accessible at the stated location until at least one
  6167. year after the last time you distribute an Opaque copy (directly or
  6168. through your agents or retailers) of that edition to the public.
  6169. It is requested, but not required, that you contact the authors of
  6170. the Document well before redistributing any large number of copies,
  6171. to give them a chance to provide you with an updated version of the
  6172. Document.
  6173. 4. MODIFICATIONS
  6174. You may copy and distribute a Modified Version of the Document
  6175. under the conditions of sections 2 and 3 above, provided that you
  6176. release the Modified Version under precisely this License, with the
  6177. Modified Version filling the role of the Document, thus licensing
  6178. distribution and modification of the Modified Version to whoever
  6179. possesses a copy of it. In addition, you must do these things in
  6180. the Modified Version:
  6181. A. Use in the Title Page (and on the covers, if any) a title
  6182. distinct from that of the Document, and from those of previous
  6183. versions (which should, if there were any, be listed in the
  6184. History section of the Document). You may use the same title
  6185. as a previous version if the original publisher of that
  6186. version gives permission.
  6187. B. List on the Title Page, as authors, one or more persons or
  6188. entities responsible for authorship of the modifications in
  6189. the Modified Version, together with at least five of the
  6190. principal authors of the Document (all of its principal
  6191. authors, if it has fewer than five), unless they release you
  6192. from this requirement.
  6193. C. State on the Title page the name of the publisher of the
  6194. Modified Version, as the publisher.
  6195. D. Preserve all the copyright notices of the Document.
  6196. E. Add an appropriate copyright notice for your modifications
  6197. adjacent to the other copyright notices.
  6198. F. Include, immediately after the copyright notices, a license
  6199. notice giving the public permission to use the Modified
  6200. Version under the terms of this License, in the form shown in
  6201. the Addendum below.
  6202. G. Preserve in that license notice the full lists of Invariant
  6203. Sections and required Cover Texts given in the Document's
  6204. license notice.
  6205. H. Include an unaltered copy of this License.
  6206. I. Preserve the section Entitled "History", Preserve its Title,
  6207. and add to it an item stating at least the title, year, new
  6208. authors, and publisher of the Modified Version as given on the
  6209. Title Page. If there is no section Entitled "History" in the
  6210. Document, create one stating the title, year, authors, and
  6211. publisher of the Document as given on its Title Page, then add
  6212. an item describing the Modified Version as stated in the
  6213. previous sentence.
  6214. J. Preserve the network location, if any, given in the Document
  6215. for public access to a Transparent copy of the Document, and
  6216. likewise the network locations given in the Document for
  6217. previous versions it was based on. These may be placed in the
  6218. "History" section. You may omit a network location for a work
  6219. that was published at least four years before the Document
  6220. itself, or if the original publisher of the version it refers
  6221. to gives permission.
  6222. K. For any section Entitled "Acknowledgements" or "Dedications",
  6223. Preserve the Title of the section, and preserve in the section
  6224. all the substance and tone of each of the contributor
  6225. acknowledgements and/or dedications given therein.
  6226. L. Preserve all the Invariant Sections of the Document, unaltered
  6227. in their text and in their titles. Section numbers or the
  6228. equivalent are not considered part of the section titles.
  6229. M. Delete any section Entitled "Endorsements". Such a section
  6230. may not be included in the Modified Version.
  6231. N. Do not retitle any existing section to be Entitled
  6232. "Endorsements" or to conflict in title with any Invariant
  6233. Section.
  6234. O. Preserve any Warranty Disclaimers.
  6235. If the Modified Version includes new front-matter sections or
  6236. appendices that qualify as Secondary Sections and contain no
  6237. material copied from the Document, you may at your option designate
  6238. some or all of these sections as invariant. To do this, add their
  6239. titles to the list of Invariant Sections in the Modified Version's
  6240. license notice. These titles must be distinct from any other
  6241. section titles.
  6242. You may add a section Entitled "Endorsements", provided it contains
  6243. nothing but endorsements of your Modified Version by various
  6244. parties--for example, statements of peer review or that the text
  6245. has been approved by an organization as the authoritative
  6246. definition of a standard.
  6247. You may add a passage of up to five words as a Front-Cover Text,
  6248. and a passage of up to 25 words as a Back-Cover Text, to the end of
  6249. the list of Cover Texts in the Modified Version. Only one passage
  6250. of Front-Cover Text and one of Back-Cover Text may be added by (or
  6251. through arrangements made by) any one entity. If the Document
  6252. already includes a cover text for the same cover, previously added
  6253. by you or by arrangement made by the same entity you are acting on
  6254. behalf of, you may not add another; but you may replace the old
  6255. one, on explicit permission from the previous publisher that added
  6256. the old one.
  6257. The author(s) and publisher(s) of the Document do not by this
  6258. License give permission to use their names for publicity for or to
  6259. assert or imply endorsement of any Modified Version.
  6260. 5. COMBINING DOCUMENTS
  6261. You may combine the Document with other documents released under
  6262. this License, under the terms defined in section 4 above for
  6263. modified versions, provided that you include in the combination all
  6264. of the Invariant Sections of all of the original documents,
  6265. unmodified, and list them all as Invariant Sections of your
  6266. combined work in its license notice, and that you preserve all
  6267. their Warranty Disclaimers.
  6268. The combined work need only contain one copy of this License, and
  6269. multiple identical Invariant Sections may be replaced with a single
  6270. copy. If there are multiple Invariant Sections with the same name
  6271. but different contents, make the title of each such section unique
  6272. by adding at the end of it, in parentheses, the name of the
  6273. original author or publisher of that section if known, or else a
  6274. unique number. Make the same adjustment to the section titles in
  6275. the list of Invariant Sections in the license notice of the
  6276. combined work.
  6277. In the combination, you must combine any sections Entitled
  6278. "History" in the various original documents, forming one section
  6279. Entitled "History"; likewise combine any sections Entitled
  6280. "Acknowledgements", and any sections Entitled "Dedications". You
  6281. must delete all sections Entitled "Endorsements."
  6282. 6. COLLECTIONS OF DOCUMENTS
  6283. You may make a collection consisting of the Document and other
  6284. documents released under this License, and replace the individual
  6285. copies of this License in the various documents with a single copy
  6286. that is included in the collection, provided that you follow the
  6287. rules of this License for verbatim copying of each of the documents
  6288. in all other respects.
  6289. You may extract a single document from such a collection, and
  6290. distribute it individually under this License, provided you insert
  6291. a copy of this License into the extracted document, and follow this
  6292. License in all other respects regarding verbatim copying of that
  6293. document.
  6294. 7. AGGREGATION WITH INDEPENDENT WORKS
  6295. A compilation of the Document or its derivatives with other
  6296. separate and independent documents or works, in or on a volume of a
  6297. storage or distribution medium, is called an "aggregate" if the
  6298. copyright resulting from the compilation is not used to limit the
  6299. legal rights of the compilation's users beyond what the individual
  6300. works permit. When the Document is included in an aggregate, this
  6301. License does not apply to the other works in the aggregate which
  6302. are not themselves derivative works of the Document.
  6303. If the Cover Text requirement of section 3 is applicable to these
  6304. copies of the Document, then if the Document is less than one half
  6305. of the entire aggregate, the Document's Cover Texts may be placed
  6306. on covers that bracket the Document within the aggregate, or the
  6307. electronic equivalent of covers if the Document is in electronic
  6308. form. Otherwise they must appear on printed covers that bracket
  6309. the whole aggregate.
  6310. 8. TRANSLATION
  6311. Translation is considered a kind of modification, so you may
  6312. distribute translations of the Document under the terms of section
  6313. 4. Replacing Invariant Sections with translations requires special
  6314. permission from their copyright holders, but you may include
  6315. translations of some or all Invariant Sections in addition to the
  6316. original versions of these Invariant Sections. You may include a
  6317. translation of this License, and all the license notices in the
  6318. Document, and any Warranty Disclaimers, provided that you also
  6319. include the original English version of this License and the
  6320. original versions of those notices and disclaimers. In case of a
  6321. disagreement between the translation and the original version of
  6322. this License or a notice or disclaimer, the original version will
  6323. prevail.
  6324. If a section in the Document is Entitled "Acknowledgements",
  6325. "Dedications", or "History", the requirement (section 4) to
  6326. Preserve its Title (section 1) will typically require changing the
  6327. actual title.
  6328. 9. TERMINATION
  6329. You may not copy, modify, sublicense, or distribute the Document
  6330. except as expressly provided under this License. Any attempt
  6331. otherwise to copy, modify, sublicense, or distribute it is void,
  6332. and will automatically terminate your rights under this License.
  6333. However, if you cease all violation of this License, then your
  6334. license from a particular copyright holder is reinstated (a)
  6335. provisionally, unless and until the copyright holder explicitly and
  6336. finally terminates your license, and (b) permanently, if the
  6337. copyright holder fails to notify you of the violation by some
  6338. reasonable means prior to 60 days after the cessation.
  6339. Moreover, your license from a particular copyright holder is
  6340. reinstated permanently if the copyright holder notifies you of the
  6341. violation by some reasonable means, this is the first time you have
  6342. received notice of violation of this License (for any work) from
  6343. that copyright holder, and you cure the violation prior to 30 days
  6344. after your receipt of the notice.
  6345. Termination of your rights under this section does not terminate
  6346. the licenses of parties who have received copies or rights from you
  6347. under this License. If your rights have been terminated and not
  6348. permanently reinstated, receipt of a copy of some or all of the
  6349. same material does not give you any rights to use it.
  6350. 10. FUTURE REVISIONS OF THIS LICENSE
  6351. The Free Software Foundation may publish new, revised versions of
  6352. the GNU Free Documentation License from time to time. Such new
  6353. versions will be similar in spirit to the present version, but may
  6354. differ in detail to address new problems or concerns. See
  6355. <http://www.gnu.org/copyleft/>.
  6356. Each version of the License is given a distinguishing version
  6357. number. If the Document specifies that a particular numbered
  6358. version of this License "or any later version" applies to it, you
  6359. have the option of following the terms and conditions either of
  6360. that specified version or of any later version that has been
  6361. published (not as a draft) by the Free Software Foundation. If the
  6362. Document does not specify a version number of this License, you may
  6363. choose any version ever published (not as a draft) by the Free
  6364. Software Foundation. If the Document specifies that a proxy can
  6365. decide which future versions of this License can be used, that
  6366. proxy's public statement of acceptance of a version permanently
  6367. authorizes you to choose that version for the Document.
  6368. 11. RELICENSING
  6369. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  6370. World Wide Web server that publishes copyrightable works and also
  6371. provides prominent facilities for anybody to edit those works. A
  6372. public wiki that anybody can edit is an example of such a server.
  6373. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  6374. site means any set of copyrightable works thus published on the MMC
  6375. site.
  6376. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  6377. license published by Creative Commons Corporation, a not-for-profit
  6378. corporation with a principal place of business in San Francisco,
  6379. California, as well as future copyleft versions of that license
  6380. published by that same organization.
  6381. "Incorporate" means to publish or republish a Document, in whole or
  6382. in part, as part of another Document.
  6383. An MMC is "eligible for relicensing" if it is licensed under this
  6384. License, and if all works that were first published under this
  6385. License somewhere other than this MMC, and subsequently
  6386. incorporated in whole or in part into the MMC, (1) had no cover
  6387. texts or invariant sections, and (2) were thus incorporated prior
  6388. to November 1, 2008.
  6389. The operator of an MMC Site may republish an MMC contained in the
  6390. site under CC-BY-SA on the same site at any time before August 1,
  6391. 2009, provided the MMC is eligible for relicensing.
  6392. ADDENDUM: How to use this License for your documents
  6393. ====================================================
  6394. To use this License in a document you have written, include a copy of
  6395. the License in the document and put the following copyright and license
  6396. notices just after the title page:
  6397. Copyright (C) YEAR YOUR NAME.
  6398. Permission is granted to copy, distribute and/or modify this document
  6399. under the terms of the GNU Free Documentation License, Version 1.3
  6400. or any later version published by the Free Software Foundation;
  6401. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  6402. Texts. A copy of the license is included in the section entitled ``GNU
  6403. Free Documentation License''.
  6404. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  6405. Texts, replace the "with...Texts." line with this:
  6406. with the Invariant Sections being LIST THEIR TITLES, with
  6407. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  6408. being LIST.
  6409. If you have Invariant Sections without Cover Texts, or some other
  6410. combination of the three, merge those two alternatives to suit the
  6411. situation.
  6412. If your document contains nontrivial examples of program code, we
  6413. recommend releasing these examples in parallel under your choice of free
  6414. software license, such as the GNU General Public License, to permit
  6415. their use in free software.
  6416. 
  6417. File: ld.info, Node: LD Index, Prev: GNU Free Documentation License, Up: Top
  6418. LD Index
  6419. ********
  6420. �[index�]
  6421. * Menu:
  6422. * ": Symbols. (line 6)
  6423. * -(: Options. (line 911)
  6424. * --accept-unknown-input-arch: Options. (line 929)
  6425. * --add-needed: Options. (line 956)
  6426. * --add-stdcall-alias: Options. (line 1942)
  6427. * --allow-multiple-definition: Options. (line 1264)
  6428. * --allow-shlib-undefined: Options. (line 1270)
  6429. * --as-needed: Options. (line 939)
  6430. * --audit AUDITLIB: Options. (line 111)
  6431. * --auxiliary=NAME: Options. (line 242)
  6432. * --bank-window: Options. (line 2408)
  6433. * --base-file: Options. (line 1947)
  6434. * --be8: ARM. (line 28)
  6435. * --branch-stub on C-SKY: Options. (line 2380)
  6436. * --bss-plt: PowerPC ELF32. (line 16)
  6437. * --build-id: Options. (line 1904)
  6438. * --build-id=STYLE: Options. (line 1904)
  6439. * --check-sections: Options. (line 1041)
  6440. * --cmse-implib: ARM. (line 234)
  6441. * --code-region: MSP430. (line 34)
  6442. * --compact-branches: Options. (line 2453)
  6443. * --compress-debug-sections=none: Options. (line 1862)
  6444. * --compress-debug-sections=zlib: Options. (line 1862)
  6445. * --compress-debug-sections=zlib-gabi: Options. (line 1862)
  6446. * --compress-debug-sections=zlib-gnu: Options. (line 1862)
  6447. * --copy-dt-needed-entries: Options. (line 1053)
  6448. * --cref: Options. (line 1073)
  6449. * --data-region: MSP430. (line 39)
  6450. * --default-imported-symver: Options. (line 1306)
  6451. * --default-script=SCRIPT: Options. (line 595)
  6452. * --default-symver: Options. (line 1302)
  6453. * --defsym=SYMBOL=EXP: Options. (line 1110)
  6454. * --demangle[=STYLE]: Options. (line 1122)
  6455. * --depaudit AUDITLIB: Options. (line 164)
  6456. * --disable-auto-image-base: Options. (line 2124)
  6457. * --disable-auto-import: Options. (line 2263)
  6458. * --disable-large-address-aware: Options. (line 2072)
  6459. * --disable-long-section-names: Options. (line 1957)
  6460. * --disable-multiple-abs-defs: Options. (line 1153)
  6461. * --disable-new-dtags: Options. (line 1836)
  6462. * --disable-runtime-pseudo-reloc: Options. (line 2276)
  6463. * --disable-sec-transformation: MSP430. (line 45)
  6464. * --disable-stdcall-fixup: Options. (line 1979)
  6465. * --discard-all: Options. (line 680)
  6466. * --discard-locals: Options. (line 684)
  6467. * --dll: Options. (line 1952)
  6468. * --dll-search-prefix: Options. (line 2130)
  6469. * --dotsyms: PowerPC64 ELF64. (line 33)
  6470. * --dsbt-index: Options. (line 2367)
  6471. * --dsbt-size: Options. (line 2362)
  6472. * --dynamic-linker=FILE: Options. (line 1135)
  6473. * --dynamic-list-cpp-new: Options. (line 1033)
  6474. * --dynamic-list-cpp-typeinfo: Options. (line 1037)
  6475. * --dynamic-list-data: Options. (line 1030)
  6476. * --dynamic-list=DYNAMIC-LIST-FILE: Options. (line 1017)
  6477. * --dynamicbase: Options. (line 2316)
  6478. * --eh-frame-hdr: Options. (line 1825)
  6479. * --embedded-relocs: Options. (line 1148)
  6480. * --emit-relocs: Options. (line 522)
  6481. * --emit-stack-syms: SPU ELF. (line 46)
  6482. * --emit-stub-syms: PowerPC ELF32. (line 47)
  6483. * --emit-stub-syms <1>: PowerPC64 ELF64. (line 29)
  6484. * --emit-stub-syms <2>: SPU ELF. (line 15)
  6485. * --enable-auto-image-base: Options. (line 2115)
  6486. * --enable-auto-import: Options. (line 2139)
  6487. * --enable-extra-pe-debug: Options. (line 2281)
  6488. * --enable-long-section-names: Options. (line 1957)
  6489. * --enable-new-dtags: Options. (line 1836)
  6490. * --enable-runtime-pseudo-reloc: Options. (line 2268)
  6491. * --enable-stdcall-fixup: Options. (line 1979)
  6492. * --entry=ENTRY: Options. (line 174)
  6493. * --error-unresolved-symbols: Options. (line 1761)
  6494. * --exclude-all-symbols: Options. (line 2032)
  6495. * --exclude-libs: Options. (line 184)
  6496. * --exclude-modules-for-implib: Options. (line 195)
  6497. * --exclude-symbols: Options. (line 2026)
  6498. * --export-all-symbols: Options. (line 2002)
  6499. * --export-dynamic: Options. (line 208)
  6500. * --extra-overlay-stubs: SPU ELF. (line 19)
  6501. * --fatal-warnings: Options. (line 1157)
  6502. * --file-alignment: Options. (line 2036)
  6503. * --filter=NAME: Options. (line 263)
  6504. * --fix-arm1176: ARM. (line 111)
  6505. * --fix-cortex-a53-835769: ARM. (line 211)
  6506. * --fix-cortex-a8: ARM. (line 202)
  6507. * --fix-stm32l4xx-629360: ARM. (line 120)
  6508. * --fix-v4bx: ARM. (line 48)
  6509. * --fix-v4bx-interworking: ARM. (line 61)
  6510. * --force-dynamic: Options. (line 531)
  6511. * --force-exe-suffix: Options. (line 1162)
  6512. * --force-group-allocation: Options. (line 1102)
  6513. * --forceinteg: Options. (line 2321)
  6514. * --format=FORMAT: Options. (line 121)
  6515. * --format=VERSION: TI COFF. (line 6)
  6516. * --gc-keep-exported: Options. (line 1207)
  6517. * --gc-sections: Options. (line 1172)
  6518. * --got: Options. (line 2420)
  6519. * --got=TYPE: M68K. (line 6)
  6520. * --gpsize=VALUE: Options. (line 295)
  6521. * --hash-size=NUMBER: Options. (line 1846)
  6522. * --hash-style=STYLE: Options. (line 1854)
  6523. * --heap: Options. (line 2042)
  6524. * --help: Options. (line 1235)
  6525. * --high-entropy-va: Options. (line 2312)
  6526. * --ignore-branch-isa: Options. (line 2441)
  6527. * --ignore-branch-isa <1>: MIPS. (line 13)
  6528. * --image-base: Options. (line 2049)
  6529. * --in-implib=FILE: ARM. (line 239)
  6530. * --insert-timestamp: Options. (line 2344)
  6531. * --insn32: Options. (line 2432)
  6532. * --insn32 <1>: MIPS. (line 6)
  6533. * --just-symbols=FILE: Options. (line 553)
  6534. * --kill-at: Options. (line 2058)
  6535. * --large-address-aware: Options. (line 2063)
  6536. * --ld-generated-unwind-info: Options. (line 1831)
  6537. * --leading-underscore: Options. (line 1996)
  6538. * --library-path=DIR: Options. (line 353)
  6539. * --library=NAMESPEC: Options. (line 320)
  6540. * --local-store=lo:hi: SPU ELF. (line 24)
  6541. * --long-plt: ARM. (line 222)
  6542. * --major-image-version: Options. (line 2079)
  6543. * --major-os-version: Options. (line 2084)
  6544. * --major-subsystem-version: Options. (line 2088)
  6545. * --merge-exidx-entries: ARM. (line 219)
  6546. * --minor-image-version: Options. (line 2093)
  6547. * --minor-os-version: Options. (line 2098)
  6548. * --minor-subsystem-version: Options. (line 2102)
  6549. * --mri-script=MRI-CMDFILE: Options. (line 145)
  6550. * --multi-subspace: HPPA ELF32. (line 6)
  6551. * --nmagic: Options. (line 448)
  6552. * --no-accept-unknown-input-arch: Options. (line 929)
  6553. * --no-add-needed: Options. (line 956)
  6554. * --no-allow-shlib-undefined: Options. (line 1270)
  6555. * --no-apply-dynamic-relocs: ARM. (line 226)
  6556. * --no-as-needed: Options. (line 939)
  6557. * --no-bind: Options. (line 2335)
  6558. * --no-check-sections: Options. (line 1041)
  6559. * --no-compact-branches: Options. (line 2454)
  6560. * --no-copy-dt-needed-entries: Options. (line 1053)
  6561. * --no-define-common: Options. (line 1086)
  6562. * --no-demangle: Options. (line 1122)
  6563. * --no-dotsyms: PowerPC64 ELF64. (line 33)
  6564. * --no-dynamic-linker: Options. (line 1142)
  6565. * --no-eh-frame-hdr: Options. (line 1825)
  6566. * --no-enum-size-warning: ARM. (line 158)
  6567. * --no-export-dynamic: Options. (line 208)
  6568. * --no-fatal-warnings: Options. (line 1157)
  6569. * --no-fix-arm1176: ARM. (line 111)
  6570. * --no-fix-cortex-a53-835769: ARM. (line 211)
  6571. * --no-fix-cortex-a8: ARM. (line 202)
  6572. * --no-gc-sections: Options. (line 1172)
  6573. * --no-ignore-branch-isa: Options. (line 2442)
  6574. * --no-ignore-branch-isa <1>: MIPS. (line 13)
  6575. * --no-insn32: Options. (line 2433)
  6576. * --no-insn32 <1>: MIPS. (line 6)
  6577. * --no-isolation: Options. (line 2328)
  6578. * --no-keep-memory: Options. (line 1247)
  6579. * --no-leading-underscore: Options. (line 1996)
  6580. * --no-merge-exidx-entries: Options. (line 2374)
  6581. * --no-merge-exidx-entries <1>: ARM. (line 219)
  6582. * --no-multi-toc: PowerPC64 ELF64. (line 96)
  6583. * --no-omagic: Options. (line 463)
  6584. * --no-opd-optimize: PowerPC64 ELF64. (line 70)
  6585. * --no-overlays: SPU ELF. (line 9)
  6586. * --no-plt-align: PowerPC64 ELF64. (line 118)
  6587. * --no-plt-localentry: PowerPC64 ELF64. (line 147)
  6588. * --no-plt-static-chain: PowerPC64 ELF64. (line 129)
  6589. * --no-plt-thread-safe: PowerPC64 ELF64. (line 135)
  6590. * --no-print-gc-sections: Options. (line 1198)
  6591. * --no-print-map-discarded: Options. (line 443)
  6592. * --no-save-restore-funcs: PowerPC64 ELF64. (line 44)
  6593. * --no-seh: Options. (line 2331)
  6594. * --no-strip-discarded: Options. (line 573)
  6595. * --no-tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  6596. * --no-tls-optimize: PowerPC ELF32. (line 51)
  6597. * --no-tls-optimize <1>: PowerPC64 ELF64. (line 51)
  6598. * --no-toc-optimize: PowerPC64 ELF64. (line 82)
  6599. * --no-toc-sort: PowerPC64 ELF64. (line 108)
  6600. * --no-trampoline: Options. (line 2402)
  6601. * --no-undefined: Options. (line 1254)
  6602. * --no-undefined-version: Options. (line 1297)
  6603. * --no-warn-mismatch: Options. (line 1310)
  6604. * --no-warn-search-mismatch: Options. (line 1319)
  6605. * --no-wchar-size-warning: ARM. (line 165)
  6606. * --no-whole-archive: Options. (line 1323)
  6607. * --noinhibit-exec: Options. (line 1327)
  6608. * --non-overlapping-opd: PowerPC64 ELF64. (line 76)
  6609. * --nxcompat: Options. (line 2324)
  6610. * --oformat=OUTPUT-FORMAT: Options. (line 1338)
  6611. * --omagic: Options. (line 454)
  6612. * --orphan-handling=MODE: Options. (line 639)
  6613. * --out-implib: Options. (line 1351)
  6614. * --output-def: Options. (line 2107)
  6615. * --output=OUTPUT: Options. (line 469)
  6616. * --pic-executable: Options. (line 1360)
  6617. * --pic-veneer: ARM. (line 171)
  6618. * --plt-align: PowerPC64 ELF64. (line 118)
  6619. * --plt-localentry: PowerPC64 ELF64. (line 147)
  6620. * --plt-static-chain: PowerPC64 ELF64. (line 129)
  6621. * --plt-thread-safe: PowerPC64 ELF64. (line 135)
  6622. * --plugin: SPU ELF. (line 6)
  6623. * --pop-state: Options. (line 518)
  6624. * --print-gc-sections: Options. (line 1198)
  6625. * --print-map: Options. (line 388)
  6626. * --print-map-discarded: Options. (line 443)
  6627. * --print-memory-usage: Options. (line 1223)
  6628. * --print-output-format: Options. (line 1217)
  6629. * --push-state: Options. (line 500)
  6630. * --reduce-memory-overheads: Options. (line 1890)
  6631. * --relax: Options. (line 1376)
  6632. * --relax on Nios II: Nios II. (line 6)
  6633. * --relax on PowerPC: PowerPC ELF32. (line 6)
  6634. * --relax on Xtensa: Xtensa. (line 27)
  6635. * --relocatable: Options. (line 535)
  6636. * --require-defined=SYMBOL: Options. (line 621)
  6637. * --retain-symbols-file=FILENAME: Options. (line 1402)
  6638. * --s390-pgste: S/390 ELF. (line 6)
  6639. * --save-restore-funcs: PowerPC64 ELF64. (line 44)
  6640. * --script=SCRIPT: Options. (line 586)
  6641. * --sdata-got: PowerPC ELF32. (line 33)
  6642. * --section-alignment: Options. (line 2286)
  6643. * --section-start=SECTIONNAME=ORG: Options. (line 1575)
  6644. * --secure-plt: PowerPC ELF32. (line 26)
  6645. * --sort-common: Options. (line 1507)
  6646. * --sort-section=alignment: Options. (line 1522)
  6647. * --sort-section=name: Options. (line 1518)
  6648. * --spare-dynamic-tags: Options. (line 1526)
  6649. * --split-by-file: Options. (line 1531)
  6650. * --split-by-reloc: Options. (line 1536)
  6651. * --stack: Options. (line 2292)
  6652. * --stack-analysis: SPU ELF. (line 29)
  6653. * --stats: Options. (line 1549)
  6654. * --strip-all: Options. (line 564)
  6655. * --strip-debug: Options. (line 568)
  6656. * --strip-discarded: Options. (line 573)
  6657. * --stub-group-size: PowerPC64 ELF64. (line 6)
  6658. * --stub-group-size on C-SKY: Options. (line 2387)
  6659. * --stub-group-size=N: ARM. (line 176)
  6660. * --stub-group-size=N <1>: HPPA ELF32. (line 12)
  6661. * --subsystem: Options. (line 2299)
  6662. * --support-old-code: ARM. (line 6)
  6663. * --sysroot=DIRECTORY: Options. (line 1553)
  6664. * --target-help: Options. (line 1239)
  6665. * --target1-abs: ARM. (line 33)
  6666. * --target1-rel: ARM. (line 33)
  6667. * --target2=TYPE: ARM. (line 38)
  6668. * --task-link: Options. (line 1558)
  6669. * --thumb-entry=ENTRY: ARM. (line 17)
  6670. * --tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  6671. * --trace: Options. (line 578)
  6672. * --trace-symbol=SYMBOL: Options. (line 690)
  6673. * --traditional-format: Options. (line 1563)
  6674. * --tsaware: Options. (line 2341)
  6675. * --undefined=SYMBOL: Options. (line 608)
  6676. * --unique[=SECTION]: Options. (line 665)
  6677. * --unresolved-symbols: Options. (line 1605)
  6678. * --use-blx: ARM. (line 73)
  6679. * --use-nul-prefixed-import-tables: ARM. (line 23)
  6680. * --verbose[=NUMBER]: Options. (line 1634)
  6681. * --version: Options. (line 674)
  6682. * --version-script=VERSION-SCRIPTFILE: Options. (line 1642)
  6683. * --vfp11-denorm-fix: ARM. (line 82)
  6684. * --warn-alternate-em: Options. (line 1753)
  6685. * --warn-common: Options. (line 1652)
  6686. * --warn-constructors: Options. (line 1720)
  6687. * --warn-multiple-gp: Options. (line 1725)
  6688. * --warn-once: Options. (line 1739)
  6689. * --warn-section-align: Options. (line 1743)
  6690. * --warn-shared-textrel: Options. (line 1750)
  6691. * --warn-unresolved-symbols: Options. (line 1756)
  6692. * --wdmdriver: Options. (line 2338)
  6693. * --whole-archive: Options. (line 1765)
  6694. * --wrap=SYMBOL: Options. (line 1779)
  6695. * -a KEYWORD: Options. (line 104)
  6696. * -assert KEYWORD: Options. (line 963)
  6697. * -b FORMAT: Options. (line 121)
  6698. * -Bdynamic: Options. (line 966)
  6699. * -Bgroup: Options. (line 976)
  6700. * -Bshareable: Options. (line 1500)
  6701. * -Bstatic: Options. (line 983)
  6702. * -Bsymbolic: Options. (line 997)
  6703. * -Bsymbolic-functions: Options. (line 1008)
  6704. * -c MRI-CMDFILE: Options. (line 145)
  6705. * -call_shared: Options. (line 966)
  6706. * -d: Options. (line 155)
  6707. * -dc: Options. (line 155)
  6708. * -dn: Options. (line 983)
  6709. * -dp: Options. (line 155)
  6710. * -dT SCRIPT: Options. (line 595)
  6711. * -dy: Options. (line 966)
  6712. * -E: Options. (line 208)
  6713. * -e ENTRY: Options. (line 174)
  6714. * -EB: Options. (line 235)
  6715. * -EL: Options. (line 238)
  6716. * -f NAME: Options. (line 242)
  6717. * -F NAME: Options. (line 263)
  6718. * -fini=NAME: Options. (line 286)
  6719. * -g: Options. (line 292)
  6720. * -G VALUE: Options. (line 295)
  6721. * -h NAME: Options. (line 302)
  6722. * -i: Options. (line 311)
  6723. * -IFILE: Options. (line 1135)
  6724. * -init=NAME: Options. (line 314)
  6725. * -L DIR: Options. (line 353)
  6726. * -l NAMESPEC: Options. (line 320)
  6727. * -M: Options. (line 388)
  6728. * -m EMULATION: Options. (line 378)
  6729. * -Map=MAPFILE: Options. (line 1243)
  6730. * -n: Options. (line 448)
  6731. * -N: Options. (line 454)
  6732. * -no-relax: Options. (line 1376)
  6733. * -non_shared: Options. (line 983)
  6734. * -nostdlib: Options. (line 1333)
  6735. * -O LEVEL: Options. (line 475)
  6736. * -o OUTPUT: Options. (line 469)
  6737. * -P AUDITLIB: Options. (line 164)
  6738. * -pie: Options. (line 1360)
  6739. * -plugin NAME: Options. (line 485)
  6740. * -q: Options. (line 522)
  6741. * -qmagic: Options. (line 1370)
  6742. * -Qy: Options. (line 1373)
  6743. * -r: Options. (line 535)
  6744. * -R FILE: Options. (line 553)
  6745. * -rpath-link=DIR: Options. (line 1443)
  6746. * -rpath=DIR: Options. (line 1416)
  6747. * -s: Options. (line 564)
  6748. * -S: Options. (line 568)
  6749. * -shared: Options. (line 1500)
  6750. * -soname=NAME: Options. (line 302)
  6751. * -static: Options. (line 983)
  6752. * -t: Options. (line 578)
  6753. * -T SCRIPT: Options. (line 586)
  6754. * -Tbss=ORG: Options. (line 1584)
  6755. * -Tdata=ORG: Options. (line 1584)
  6756. * -Tldata-segment=ORG: Options. (line 1600)
  6757. * -Trodata-segment=ORG: Options. (line 1594)
  6758. * -Ttext-segment=ORG: Options. (line 1590)
  6759. * -Ttext=ORG: Options. (line 1584)
  6760. * -u SYMBOL: Options. (line 608)
  6761. * -Ur: Options. (line 629)
  6762. * -v: Options. (line 674)
  6763. * -V: Options. (line 674)
  6764. * -x: Options. (line 680)
  6765. * -X: Options. (line 684)
  6766. * -Y PATH: Options. (line 699)
  6767. * -y SYMBOL: Options. (line 690)
  6768. * -z defs: Options. (line 1254)
  6769. * -z KEYWORD: Options. (line 703)
  6770. * -z muldefs: Options. (line 1264)
  6771. * -z undefs: Options. (line 1254)
  6772. * .: Location Counter. (line 6)
  6773. * /DISCARD/: Output Section Discarding.
  6774. (line 26)
  6775. * 32-bit PLT entries: ARM. (line 222)
  6776. * :PHDR: Output Section Phdr.
  6777. (line 6)
  6778. * =FILLEXP: Output Section Fill.
  6779. (line 6)
  6780. * >REGION: Output Section Region.
  6781. (line 6)
  6782. * [COMMON]: Input Section Common.
  6783. (line 29)
  6784. * AArch64 rela addend: ARM. (line 226)
  6785. * ABSOLUTE (MRI): MRI. (line 32)
  6786. * absolute and relocatable symbols: Expression Section. (line 6)
  6787. * absolute expressions: Expression Section. (line 6)
  6788. * ABSOLUTE(EXP): Builtin Functions. (line 10)
  6789. * ADDR(SECTION): Builtin Functions. (line 17)
  6790. * address, section: Output Section Address.
  6791. (line 6)
  6792. * ALIAS (MRI): MRI. (line 43)
  6793. * ALIGN (MRI): MRI. (line 49)
  6794. * align expression: Builtin Functions. (line 38)
  6795. * align location counter: Builtin Functions. (line 38)
  6796. * ALIGN(ALIGN): Builtin Functions. (line 38)
  6797. * ALIGN(EXP,ALIGN): Builtin Functions. (line 38)
  6798. * ALIGN(SECTION_ALIGN): Forced Output Alignment.
  6799. (line 6)
  6800. * aligned common symbols: WIN32. (line 416)
  6801. * ALIGNOF(SECTION): Builtin Functions. (line 63)
  6802. * allocating memory: MEMORY. (line 6)
  6803. * architecture: Miscellaneous Commands.
  6804. (line 121)
  6805. * archive files, from cmd line: Options. (line 320)
  6806. * archive search path in linker script: File Commands. (line 77)
  6807. * arithmetic: Expressions. (line 6)
  6808. * arithmetic operators: Operators. (line 6)
  6809. * ARM interworking support: ARM. (line 6)
  6810. * ARM1176 erratum workaround: ARM. (line 111)
  6811. * ASSERT: Miscellaneous Commands.
  6812. (line 9)
  6813. * assertion in linker script: Miscellaneous Commands.
  6814. (line 9)
  6815. * assignment in scripts: Assignments. (line 6)
  6816. * AS_NEEDED(FILES): File Commands. (line 57)
  6817. * AT(LMA): Output Section LMA. (line 6)
  6818. * AT>LMA_REGION: Output Section LMA. (line 6)
  6819. * automatic data imports: WIN32. (line 185)
  6820. * back end: BFD. (line 6)
  6821. * BASE (MRI): MRI. (line 53)
  6822. * BE8: ARM. (line 28)
  6823. * BFD canonical format: Canonical format. (line 11)
  6824. * BFD requirements: BFD. (line 16)
  6825. * big-endian objects: Options. (line 235)
  6826. * binary input format: Options. (line 121)
  6827. * BLOCK(EXP): Builtin Functions. (line 76)
  6828. * bug criteria: Bug Criteria. (line 6)
  6829. * bug reports: Bug Reporting. (line 6)
  6830. * bugs in ld: Reporting Bugs. (line 6)
  6831. * BYTE(EXPRESSION): Output Section Data.
  6832. (line 6)
  6833. * C++ constructors, arranging in link: Output Section Keywords.
  6834. (line 19)
  6835. * CHIP (MRI): MRI. (line 57)
  6836. * COLLECT_NO_DEMANGLE: Environment. (line 29)
  6837. * combining symbols, warnings on: Options. (line 1652)
  6838. * COMDAT: Options. (line 1102)
  6839. * COMDAT <1>: Miscellaneous Commands.
  6840. (line 56)
  6841. * command files: Scripts. (line 6)
  6842. * command line: Options. (line 6)
  6843. * common allocation: Options. (line 155)
  6844. * common allocation <1>: Options. (line 1086)
  6845. * common allocation in linker script: Miscellaneous Commands.
  6846. (line 46)
  6847. * common allocation in linker script <1>: Miscellaneous Commands.
  6848. (line 51)
  6849. * common symbol placement: Input Section Common.
  6850. (line 6)
  6851. * COMMONPAGESIZE: Symbolic Constants. (line 13)
  6852. * compatibility, MRI: Options. (line 145)
  6853. * CONSTANT: Symbolic Constants. (line 6)
  6854. * constants in linker scripts: Constants. (line 6)
  6855. * constraints on output sections: Output Section Constraint.
  6856. (line 6)
  6857. * constructors: Options. (line 629)
  6858. * CONSTRUCTORS: Output Section Keywords.
  6859. (line 19)
  6860. * constructors, arranging in link: Output Section Keywords.
  6861. (line 19)
  6862. * Cortex-A53 erratum 835769 workaround: ARM. (line 211)
  6863. * Cortex-A8 erratum workaround: ARM. (line 202)
  6864. * crash of linker: Bug Criteria. (line 9)
  6865. * CREATE_OBJECT_SYMBOLS: Output Section Keywords.
  6866. (line 9)
  6867. * creating a DEF file: WIN32. (line 153)
  6868. * cross reference table: Options. (line 1073)
  6869. * cross references: Miscellaneous Commands.
  6870. (line 88)
  6871. * cross references <1>: Miscellaneous Commands.
  6872. (line 104)
  6873. * current output location: Location Counter. (line 6)
  6874. * data: Output Section Data.
  6875. (line 6)
  6876. * DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE): Builtin Functions.
  6877. (line 81)
  6878. * DATA_SEGMENT_END(EXP): Builtin Functions. (line 105)
  6879. * DATA_SEGMENT_RELRO_END(OFFSET, EXP): Builtin Functions. (line 111)
  6880. * dbx: Options. (line 1568)
  6881. * DEF files, creating: Options. (line 2107)
  6882. * default emulation: Environment. (line 21)
  6883. * default input format: Environment. (line 9)
  6884. * defined symbol: Options. (line 621)
  6885. * DEFINED(SYMBOL): Builtin Functions. (line 124)
  6886. * deleting local symbols: Options. (line 680)
  6887. * demangling, default: Environment. (line 29)
  6888. * demangling, from command line: Options. (line 1122)
  6889. * direct linking to a dll: WIN32. (line 233)
  6890. * discarding sections: Output Section Discarding.
  6891. (line 6)
  6892. * discontinuous memory: MEMORY. (line 6)
  6893. * DLLs, creating: Options. (line 2002)
  6894. * DLLs, creating <1>: Options. (line 2107)
  6895. * DLLs, creating <2>: Options. (line 2115)
  6896. * DLLs, linking to: Options. (line 2130)
  6897. * dot: Location Counter. (line 6)
  6898. * dot inside sections: Location Counter. (line 36)
  6899. * dot outside sections: Location Counter. (line 66)
  6900. * dynamic linker, from command line: Options. (line 1135)
  6901. * dynamic symbol table: Options. (line 208)
  6902. * ELF program headers: PHDRS. (line 6)
  6903. * emulation: Options. (line 378)
  6904. * emulation, default: Environment. (line 21)
  6905. * END (MRI): MRI. (line 61)
  6906. * endianness: Options. (line 235)
  6907. * entry point: Entry Point. (line 6)
  6908. * entry point, from command line: Options. (line 174)
  6909. * entry point, thumb: ARM. (line 17)
  6910. * ENTRY(SYMBOL): Entry Point. (line 6)
  6911. * error on valid input: Bug Criteria. (line 12)
  6912. * example of linker script: Simple Example. (line 6)
  6913. * EXCLUDE_FILE: Input Section Basics.
  6914. (line 17)
  6915. * exporting DLL symbols: WIN32. (line 19)
  6916. * expression evaluation order: Evaluation. (line 6)
  6917. * expression sections: Expression Section. (line 6)
  6918. * expression, absolute: Builtin Functions. (line 10)
  6919. * expressions: Expressions. (line 6)
  6920. * EXTERN: Miscellaneous Commands.
  6921. (line 39)
  6922. * fatal signal: Bug Criteria. (line 9)
  6923. * file name wildcard patterns: Input Section Wildcards.
  6924. (line 6)
  6925. * FILEHDR: PHDRS. (line 62)
  6926. * filename symbols: Output Section Keywords.
  6927. (line 9)
  6928. * fill pattern, entire section: Output Section Fill.
  6929. (line 6)
  6930. * FILL(EXPRESSION): Output Section Data.
  6931. (line 39)
  6932. * finalization function: Options. (line 286)
  6933. * first input file: File Commands. (line 85)
  6934. * first instruction: Entry Point. (line 6)
  6935. * FIX_V4BX: ARM. (line 48)
  6936. * FIX_V4BX_INTERWORKING: ARM. (line 61)
  6937. * FORCE_COMMON_ALLOCATION: Miscellaneous Commands.
  6938. (line 46)
  6939. * FORCE_GROUP_ALLOCATION: Miscellaneous Commands.
  6940. (line 56)
  6941. * forcing input section alignment: Forced Input Alignment.
  6942. (line 6)
  6943. * forcing output section alignment: Forced Output Alignment.
  6944. (line 6)
  6945. * forcing the creation of dynamic sections: Options. (line 531)
  6946. * FORMAT (MRI): MRI. (line 65)
  6947. * functions in expressions: Builtin Functions. (line 6)
  6948. * garbage collection: Options. (line 1172)
  6949. * garbage collection <1>: Options. (line 1198)
  6950. * garbage collection <2>: Options. (line 1207)
  6951. * garbage collection <3>: Input Section Keep. (line 6)
  6952. * generating optimized output: Options. (line 475)
  6953. * GNU linker: Overview. (line 6)
  6954. * GNUTARGET: Environment. (line 9)
  6955. * group allocation in linker script: Options. (line 1102)
  6956. * group allocation in linker script <1>: Miscellaneous Commands.
  6957. (line 56)
  6958. * GROUP(FILES): File Commands. (line 50)
  6959. * grouping input files: File Commands. (line 50)
  6960. * groups of archives: Options. (line 911)
  6961. * H8/300 support: H8/300. (line 6)
  6962. * header size: Builtin Functions. (line 191)
  6963. * heap size: Options. (line 2042)
  6964. * help: Options. (line 1235)
  6965. * HIDDEN: HIDDEN. (line 6)
  6966. * holes: Location Counter. (line 12)
  6967. * holes, filling: Output Section Data.
  6968. (line 39)
  6969. * HPPA multiple sub-space stubs: HPPA ELF32. (line 6)
  6970. * HPPA stub grouping: HPPA ELF32. (line 12)
  6971. * image base: Options. (line 2049)
  6972. * implicit linker scripts: Implicit Linker Scripts.
  6973. (line 6)
  6974. * import libraries: WIN32. (line 10)
  6975. * INCLUDE FILENAME: File Commands. (line 9)
  6976. * including a linker script: File Commands. (line 9)
  6977. * including an entire archive: Options. (line 1765)
  6978. * incremental link: Options. (line 311)
  6979. * INHIBIT_COMMON_ALLOCATION: Miscellaneous Commands.
  6980. (line 51)
  6981. * initialization function: Options. (line 314)
  6982. * initialized data in ROM: Output Section LMA. (line 39)
  6983. * input file format in linker script: Format Commands. (line 35)
  6984. * input filename symbols: Output Section Keywords.
  6985. (line 9)
  6986. * input files in linker scripts: File Commands. (line 19)
  6987. * input files, displaying: Options. (line 578)
  6988. * input format: Options. (line 121)
  6989. * input format <1>: Options. (line 121)
  6990. * Input import library: ARM. (line 239)
  6991. * input object files in linker scripts: File Commands. (line 19)
  6992. * input section alignment: Forced Input Alignment.
  6993. (line 6)
  6994. * input section basics: Input Section Basics.
  6995. (line 6)
  6996. * input section wildcards: Input Section Wildcards.
  6997. (line 6)
  6998. * input sections: Input Section. (line 6)
  6999. * INPUT(FILES): File Commands. (line 19)
  7000. * INSERT: Miscellaneous Commands.
  7001. (line 62)
  7002. * insert user script into default script: Miscellaneous Commands.
  7003. (line 62)
  7004. * integer notation: Constants. (line 6)
  7005. * integer suffixes: Constants. (line 15)
  7006. * internal object-file format: Canonical format. (line 11)
  7007. * invalid input: Bug Criteria. (line 14)
  7008. * K and M integer suffixes: Constants. (line 15)
  7009. * KEEP: Input Section Keep. (line 6)
  7010. * l =: MEMORY. (line 72)
  7011. * lazy evaluation: Evaluation. (line 6)
  7012. * ld bugs, reporting: Bug Reporting. (line 6)
  7013. * ldata segment origin, cmd line: Options. (line 1601)
  7014. * LDEMULATION: Environment. (line 21)
  7015. * LD_FEATURE(STRING): Miscellaneous Commands.
  7016. (line 127)
  7017. * len =: MEMORY. (line 72)
  7018. * LENGTH =: MEMORY. (line 72)
  7019. * LENGTH(MEMORY): Builtin Functions. (line 141)
  7020. * library search path in linker script: File Commands. (line 77)
  7021. * link map: Options. (line 388)
  7022. * link map discarded: Options. (line 443)
  7023. * link-time runtime library search path: Options. (line 1443)
  7024. * linker crash: Bug Criteria. (line 9)
  7025. * linker script concepts: Basic Script Concepts.
  7026. (line 6)
  7027. * linker script example: Simple Example. (line 6)
  7028. * linker script file commands: File Commands. (line 6)
  7029. * linker script format: Script Format. (line 6)
  7030. * linker script input object files: File Commands. (line 19)
  7031. * linker script simple commands: Simple Commands. (line 6)
  7032. * linker scripts: Scripts. (line 6)
  7033. * LIST (MRI): MRI. (line 69)
  7034. * little-endian objects: Options. (line 238)
  7035. * LOAD (MRI): MRI. (line 76)
  7036. * load address: Output Section LMA. (line 6)
  7037. * LOADADDR(SECTION): Builtin Functions. (line 144)
  7038. * loading, preventing: Output Section Type.
  7039. (line 21)
  7040. * local symbols, deleting: Options. (line 684)
  7041. * location counter: Location Counter. (line 6)
  7042. * LOG2CEIL(EXP): Builtin Functions. (line 148)
  7043. * LONG(EXPRESSION): Output Section Data.
  7044. (line 6)
  7045. * M and K integer suffixes: Constants. (line 15)
  7046. * M68HC11 and 68HC12 support: M68HC11/68HC12. (line 5)
  7047. * machine architecture: Miscellaneous Commands.
  7048. (line 121)
  7049. * machine dependencies: Machine Dependent. (line 6)
  7050. * mapping input sections to output sections: Input Section. (line 6)
  7051. * MAX: Builtin Functions. (line 151)
  7052. * MAXPAGESIZE: Symbolic Constants. (line 10)
  7053. * MEMORY: MEMORY. (line 6)
  7054. * memory region attributes: MEMORY. (line 34)
  7055. * memory regions: MEMORY. (line 6)
  7056. * memory regions and sections: Output Section Region.
  7057. (line 6)
  7058. * memory usage: Options. (line 1223)
  7059. * memory usage <1>: Options. (line 1247)
  7060. * Merging exidx entries: ARM. (line 219)
  7061. * MIN: Builtin Functions. (line 154)
  7062. * MIPS branch relocation check control: MIPS. (line 13)
  7063. * MIPS microMIPS instruction choice selection: MIPS. (line 6)
  7064. * Motorola 68K GOT generation: M68K. (line 6)
  7065. * MRI compatibility: MRI. (line 6)
  7066. * MSP430 extra sections: MSP430. (line 11)
  7067. * MSP430 Options: MSP430. (line 34)
  7068. * NAME (MRI): MRI. (line 82)
  7069. * name, section: Output Section Name.
  7070. (line 6)
  7071. * names: Symbols. (line 6)
  7072. * naming the output file: Options. (line 469)
  7073. * NEXT(EXP): Builtin Functions. (line 158)
  7074. * Nios II call relaxation: Nios II. (line 6)
  7075. * NMAGIC: Options. (line 448)
  7076. * NOCROSSREFS(SECTIONS): Miscellaneous Commands.
  7077. (line 88)
  7078. * NOCROSSREFS_TO(TOSECTION FROMSECTIONS): Miscellaneous Commands.
  7079. (line 104)
  7080. * NOLOAD: Output Section Type.
  7081. (line 21)
  7082. * not enough room for program headers: Builtin Functions. (line 196)
  7083. * NO_ENUM_SIZE_WARNING: ARM. (line 158)
  7084. * NO_WCHAR_SIZE_WARNING: ARM. (line 165)
  7085. * o =: MEMORY. (line 67)
  7086. * objdump -i: BFD. (line 6)
  7087. * object file management: BFD. (line 6)
  7088. * object files: Options. (line 29)
  7089. * object formats available: BFD. (line 6)
  7090. * object size: Options. (line 295)
  7091. * OMAGIC: Options. (line 454)
  7092. * OMAGIC <1>: Options. (line 463)
  7093. * ONLY_IF_RO: Output Section Constraint.
  7094. (line 6)
  7095. * ONLY_IF_RW: Output Section Constraint.
  7096. (line 6)
  7097. * opening object files: BFD outline. (line 6)
  7098. * operators for arithmetic: Operators. (line 6)
  7099. * options: Options. (line 6)
  7100. * ORDER (MRI): MRI. (line 87)
  7101. * org =: MEMORY. (line 67)
  7102. * ORIGIN =: MEMORY. (line 67)
  7103. * ORIGIN(MEMORY): Builtin Functions. (line 164)
  7104. * orphan: Orphan Sections. (line 6)
  7105. * orphan sections: Options. (line 639)
  7106. * output file after errors: Options. (line 1327)
  7107. * output file format in linker script: Format Commands. (line 10)
  7108. * output file name in linker script: File Commands. (line 67)
  7109. * output format: Options. (line 1217)
  7110. * output section alignment: Forced Output Alignment.
  7111. (line 6)
  7112. * output section attributes: Output Section Attributes.
  7113. (line 6)
  7114. * output section data: Output Section Data.
  7115. (line 6)
  7116. * OUTPUT(FILENAME): File Commands. (line 67)
  7117. * OUTPUT_ARCH(BFDARCH): Miscellaneous Commands.
  7118. (line 121)
  7119. * OUTPUT_FORMAT(BFDNAME): Format Commands. (line 10)
  7120. * OVERLAY: Overlay Description.
  7121. (line 6)
  7122. * overlays: Overlay Description.
  7123. (line 6)
  7124. * partial link: Options. (line 535)
  7125. * PE import table prefixing: ARM. (line 23)
  7126. * PHDRS: PHDRS. (line 6)
  7127. * PHDRS <1>: PHDRS. (line 62)
  7128. * PIC_VENEER: ARM. (line 171)
  7129. * Placement of SG veneers: ARM. (line 229)
  7130. * pop state governing input file handling: Options. (line 518)
  7131. * position independent executables: Options. (line 1362)
  7132. * PowerPC ELF32 options: PowerPC ELF32. (line 16)
  7133. * PowerPC GOT: PowerPC ELF32. (line 33)
  7134. * PowerPC long branches: PowerPC ELF32. (line 6)
  7135. * PowerPC PLT: PowerPC ELF32. (line 16)
  7136. * PowerPC stub symbols: PowerPC ELF32. (line 47)
  7137. * PowerPC TLS optimization: PowerPC ELF32. (line 51)
  7138. * PowerPC64 dot symbols: PowerPC64 ELF64. (line 33)
  7139. * PowerPC64 ELF64 options: PowerPC64 ELF64. (line 6)
  7140. * PowerPC64 ELFv2 PLT localentry optimization: PowerPC64 ELF64.
  7141. (line 147)
  7142. * PowerPC64 multi-TOC: PowerPC64 ELF64. (line 96)
  7143. * PowerPC64 OPD optimization: PowerPC64 ELF64. (line 70)
  7144. * PowerPC64 OPD spacing: PowerPC64 ELF64. (line 76)
  7145. * PowerPC64 PLT call stub static chain: PowerPC64 ELF64. (line 129)
  7146. * PowerPC64 PLT call stub thread safety: PowerPC64 ELF64. (line 135)
  7147. * PowerPC64 PLT stub alignment: PowerPC64 ELF64. (line 118)
  7148. * PowerPC64 register save/restore functions: PowerPC64 ELF64.
  7149. (line 44)
  7150. * PowerPC64 stub grouping: PowerPC64 ELF64. (line 6)
  7151. * PowerPC64 stub symbols: PowerPC64 ELF64. (line 29)
  7152. * PowerPC64 TLS optimization: PowerPC64 ELF64. (line 51)
  7153. * PowerPC64 TOC optimization: PowerPC64 ELF64. (line 82)
  7154. * PowerPC64 TOC sorting: PowerPC64 ELF64. (line 108)
  7155. * PowerPC64 __tls_get_addr optimization: PowerPC64 ELF64. (line 56)
  7156. * precedence in expressions: Operators. (line 6)
  7157. * prevent unnecessary loading: Output Section Type.
  7158. (line 21)
  7159. * program headers: PHDRS. (line 6)
  7160. * program headers and sections: Output Section Phdr.
  7161. (line 6)
  7162. * program headers, not enough room: Builtin Functions. (line 196)
  7163. * program segments: PHDRS. (line 6)
  7164. * PROVIDE: PROVIDE. (line 6)
  7165. * PROVIDE_HIDDEN: PROVIDE_HIDDEN. (line 6)
  7166. * PUBLIC (MRI): MRI. (line 95)
  7167. * push state governing input file handling: Options. (line 500)
  7168. * QUAD(EXPRESSION): Output Section Data.
  7169. (line 6)
  7170. * quoted symbol names: Symbols. (line 6)
  7171. * read-only text: Options. (line 448)
  7172. * read/write from cmd line: Options. (line 454)
  7173. * region alias: REGION_ALIAS. (line 6)
  7174. * region names: REGION_ALIAS. (line 6)
  7175. * regions of memory: MEMORY. (line 6)
  7176. * REGION_ALIAS(ALIAS, REGION): REGION_ALIAS. (line 6)
  7177. * relative expressions: Expression Section. (line 6)
  7178. * relaxing addressing modes: Options. (line 1376)
  7179. * relaxing on H8/300: H8/300. (line 9)
  7180. * relaxing on M68HC11: M68HC11/68HC12. (line 12)
  7181. * relaxing on NDS32: NDS32. (line 6)
  7182. * relaxing on Xtensa: Xtensa. (line 27)
  7183. * relocatable and absolute symbols: Expression Section. (line 6)
  7184. * relocatable output: Options. (line 535)
  7185. * removing sections: Output Section Discarding.
  7186. (line 6)
  7187. * reporting bugs in ld: Reporting Bugs. (line 6)
  7188. * requirements for BFD: BFD. (line 16)
  7189. * retain relocations in final executable: Options. (line 522)
  7190. * retaining specified symbols: Options. (line 1402)
  7191. * rodata segment origin, cmd line: Options. (line 1595)
  7192. * ROM initialized data: Output Section LMA. (line 39)
  7193. * round up expression: Builtin Functions. (line 38)
  7194. * round up location counter: Builtin Functions. (line 38)
  7195. * runtime library name: Options. (line 302)
  7196. * runtime library search path: Options. (line 1416)
  7197. * runtime pseudo-relocation: WIN32. (line 211)
  7198. * S/390: S/390 ELF. (line 6)
  7199. * S/390 ELF options: S/390 ELF. (line 6)
  7200. * scaled integers: Constants. (line 15)
  7201. * scommon section: Input Section Common.
  7202. (line 20)
  7203. * script files: Options. (line 586)
  7204. * script files <1>: Options. (line 595)
  7205. * scripts: Scripts. (line 6)
  7206. * search directory, from cmd line: Options. (line 353)
  7207. * search path in linker script: File Commands. (line 77)
  7208. * SEARCH_DIR(PATH): File Commands. (line 77)
  7209. * SECT (MRI): MRI. (line 101)
  7210. * section address: Output Section Address.
  7211. (line 6)
  7212. * section address in expression: Builtin Functions. (line 17)
  7213. * section alignment: Builtin Functions. (line 63)
  7214. * section alignment, warnings on: Options. (line 1743)
  7215. * section data: Output Section Data.
  7216. (line 6)
  7217. * section fill pattern: Output Section Fill.
  7218. (line 6)
  7219. * section groups: Options. (line 1102)
  7220. * section groups <1>: Miscellaneous Commands.
  7221. (line 56)
  7222. * section load address: Output Section LMA. (line 6)
  7223. * section load address in expression: Builtin Functions. (line 144)
  7224. * section name: Output Section Name.
  7225. (line 6)
  7226. * section name wildcard patterns: Input Section Wildcards.
  7227. (line 6)
  7228. * section size: Builtin Functions. (line 175)
  7229. * section, assigning to memory region: Output Section Region.
  7230. (line 6)
  7231. * section, assigning to program header: Output Section Phdr.
  7232. (line 6)
  7233. * SECTIONS: SECTIONS. (line 6)
  7234. * sections, discarding: Output Section Discarding.
  7235. (line 6)
  7236. * sections, orphan: Options. (line 639)
  7237. * Secure gateway import library: ARM. (line 234)
  7238. * segment origins, cmd line: Options. (line 1584)
  7239. * segments, ELF: PHDRS. (line 6)
  7240. * SEGMENT_START(SEGMENT, DEFAULT): Builtin Functions. (line 167)
  7241. * shared libraries: Options. (line 1502)
  7242. * SHORT(EXPRESSION): Output Section Data.
  7243. (line 6)
  7244. * SIZEOF(SECTION): Builtin Functions. (line 175)
  7245. * SIZEOF_HEADERS: Builtin Functions. (line 191)
  7246. * small common symbols: Input Section Common.
  7247. (line 20)
  7248. * SORT: Input Section Wildcards.
  7249. (line 62)
  7250. * SORT_BY_ALIGNMENT: Input Section Wildcards.
  7251. (line 51)
  7252. * SORT_BY_INIT_PRIORITY: Input Section Wildcards.
  7253. (line 57)
  7254. * SORT_BY_NAME: Input Section Wildcards.
  7255. (line 43)
  7256. * SORT_NONE: Input Section Wildcards.
  7257. (line 98)
  7258. * SPU: SPU ELF. (line 29)
  7259. * SPU <1>: SPU ELF. (line 46)
  7260. * SPU ELF options: SPU ELF. (line 6)
  7261. * SPU extra overlay stubs: SPU ELF. (line 19)
  7262. * SPU local store size: SPU ELF. (line 24)
  7263. * SPU overlay stub symbols: SPU ELF. (line 15)
  7264. * SPU overlays: SPU ELF. (line 9)
  7265. * SPU plugins: SPU ELF. (line 6)
  7266. * SQUAD(EXPRESSION): Output Section Data.
  7267. (line 6)
  7268. * stack size: Options. (line 2292)
  7269. * standard Unix system: Options. (line 7)
  7270. * start of execution: Entry Point. (line 6)
  7271. * STARTUP(FILENAME): File Commands. (line 85)
  7272. * STM32L4xx erratum workaround: ARM. (line 120)
  7273. * strip all symbols: Options. (line 564)
  7274. * strip debugger symbols: Options. (line 568)
  7275. * stripping all but some symbols: Options. (line 1402)
  7276. * STUB_GROUP_SIZE: ARM. (line 176)
  7277. * SUBALIGN(SUBSECTION_ALIGN): Forced Input Alignment.
  7278. (line 6)
  7279. * suffixes for integers: Constants. (line 15)
  7280. * symbol defaults: Builtin Functions. (line 124)
  7281. * symbol definition, scripts: Assignments. (line 6)
  7282. * symbol names: Symbols. (line 6)
  7283. * symbol tracing: Options. (line 690)
  7284. * symbol versions: VERSION. (line 6)
  7285. * symbol-only input: Options. (line 553)
  7286. * symbolic constants: Symbolic Constants. (line 6)
  7287. * symbols, from command line: Options. (line 1110)
  7288. * symbols, relocatable and absolute: Expression Section. (line 6)
  7289. * symbols, require defined: Options. (line 621)
  7290. * symbols, retaining selectively: Options. (line 1402)
  7291. * synthesizing linker: Options. (line 1376)
  7292. * synthesizing on H8/300: H8/300. (line 14)
  7293. * TARGET(BFDNAME): Format Commands. (line 35)
  7294. * TARGET1: ARM. (line 33)
  7295. * TARGET2: ARM. (line 38)
  7296. * text segment origin, cmd line: Options. (line 1591)
  7297. * thumb entry point: ARM. (line 17)
  7298. * TI COFF versions: TI COFF. (line 6)
  7299. * traditional format: Options. (line 1563)
  7300. * trampoline generation on M68HC11: M68HC11/68HC12. (line 30)
  7301. * trampoline generation on M68HC12: M68HC11/68HC12. (line 30)
  7302. * unallocated address, next: Builtin Functions. (line 158)
  7303. * undefined symbol: Options. (line 608)
  7304. * undefined symbol in linker script: Miscellaneous Commands.
  7305. (line 39)
  7306. * undefined symbols, warnings on: Options. (line 1739)
  7307. * uninitialized data placement: Input Section Common.
  7308. (line 6)
  7309. * unspecified memory: Output Section Data.
  7310. (line 39)
  7311. * usage: Options. (line 1235)
  7312. * USE_BLX: ARM. (line 73)
  7313. * using a DEF file: WIN32. (line 52)
  7314. * using auto-export functionality: WIN32. (line 22)
  7315. * Using decorations: WIN32. (line 157)
  7316. * variables, defining: Assignments. (line 6)
  7317. * verbose[=NUMBER]: Options. (line 1634)
  7318. * version: Options. (line 674)
  7319. * version script: VERSION. (line 6)
  7320. * version script, symbol versions: Options. (line 1642)
  7321. * VERSION {script text}: VERSION. (line 6)
  7322. * versions of symbols: VERSION. (line 6)
  7323. * VFP11_DENORM_FIX: ARM. (line 82)
  7324. * warnings, on combining symbols: Options. (line 1652)
  7325. * warnings, on section alignment: Options. (line 1743)
  7326. * warnings, on undefined symbols: Options. (line 1739)
  7327. * weak externals: WIN32. (line 401)
  7328. * what is this?: Overview. (line 6)
  7329. * wildcard file name patterns: Input Section Wildcards.
  7330. (line 6)
  7331. * Xtensa options: Xtensa. (line 55)
  7332. * Xtensa processors: Xtensa. (line 6)
  7333. 
  7334. Tag Table:
  7335. Node: Top730
  7336. Node: Overview1538
  7337. Node: Invocation2654
  7338. Node: Options3062
  7339. Node: Environment115284
  7340. Node: Scripts117045
  7341. Node: Basic Script Concepts118779
  7342. Node: Script Format121487
  7343. Node: Simple Example122350
  7344. Node: Simple Commands125444
  7345. Node: Entry Point125949
  7346. Node: File Commands126878
  7347. Node: Format Commands131052
  7348. Node: REGION_ALIAS133008
  7349. Node: Miscellaneous Commands137835
  7350. Node: Assignments143666
  7351. Node: Simple Assignments144177
  7352. Node: HIDDEN145908
  7353. Node: PROVIDE146535
  7354. Node: PROVIDE_HIDDEN148056
  7355. Node: Source Code Reference148300
  7356. Node: SECTIONS152217
  7357. Node: Output Section Description154105
  7358. Node: Output Section Name155346
  7359. Node: Output Section Address156223
  7360. Node: Input Section158456
  7361. Node: Input Section Basics159257
  7362. Node: Input Section Wildcards164275
  7363. Node: Input Section Common169476
  7364. Node: Input Section Keep170958
  7365. Node: Input Section Example171448
  7366. Node: Output Section Data172859
  7367. Node: Output Section Keywords175638
  7368. Node: Output Section Discarding179205
  7369. Node: Output Section Attributes180695
  7370. Node: Output Section Type181814
  7371. Node: Output Section LMA182884
  7372. Node: Forced Output Alignment185955
  7373. Node: Forced Input Alignment186384
  7374. Node: Output Section Constraint186772
  7375. Node: Output Section Region187200
  7376. Node: Output Section Phdr187633
  7377. Node: Output Section Fill188297
  7378. Node: Overlay Description189439
  7379. Node: MEMORY193884
  7380. Node: PHDRS198490
  7381. Node: VERSION203816
  7382. Node: Expressions211907
  7383. Node: Constants212836
  7384. Node: Symbolic Constants213710
  7385. Node: Symbols214261
  7386. Node: Orphan Sections215008
  7387. Node: Location Counter216593
  7388. Node: Operators221027
  7389. Node: Evaluation221949
  7390. Node: Expression Section223313
  7391. Node: Builtin Functions227283
  7392. Node: Implicit Linker Scripts235634
  7393. Node: Machine Dependent236409
  7394. Node: H8/300237497
  7395. Node: M68HC11/68HC12239570
  7396. Node: ARM241017
  7397. Node: HPPA ELF32253264
  7398. Node: M68K254887
  7399. Node: MIPS255796
  7400. Node: MMIX256912
  7401. Node: MSP430258077
  7402. Node: NDS32259990
  7403. Node: Nios II260954
  7404. Node: PowerPC ELF32262270
  7405. Node: PowerPC64 ELF64265101
  7406. Node: S/390 ELF273502
  7407. Node: SPU ELF273849
  7408. Node: TI COFF276477
  7409. Node: WIN32277003
  7410. Node: Xtensa297150
  7411. Node: BFD300116
  7412. Node: BFD outline301574
  7413. Node: BFD information loss302862
  7414. Node: Canonical format305388
  7415. Node: Reporting Bugs309716
  7416. Node: Bug Criteria310410
  7417. Node: Bug Reporting311109
  7418. Node: MRI318147
  7419. Node: GNU Free Documentation License322618
  7420. Node: LD Index347755
  7421. 
  7422. End Tag Table