ld.info 406 KB

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