ld.info 428 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296
  1. This is ld.info, produced by makeinfo version 6.5 from ld.texi.
  2. This file documents the GNU linker LD (GNU Toolchain for the A-profile
  3. Architecture 10.3-2021.07 (arm-10.29)) version 2.36.1.
  4. Copyright (C) 1991-2021 Free Software Foundation, Inc.
  5. Permission is granted to copy, distribute and/or modify this document
  6. under the terms of the GNU Free Documentation License, Version 1.3 or
  7. any later version published by the Free Software Foundation; with no
  8. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  9. Texts. A copy of the license is included in the section entitled "GNU
  10. Free Documentation License".
  11. INFO-DIR-SECTION Software development
  12. START-INFO-DIR-ENTRY
  13. * Ld: (ld). The GNU linker.
  14. END-INFO-DIR-ENTRY
  15. 
  16. File: ld.info, Node: Top, Next: Overview, Up: (dir)
  17. LD
  18. **
  19. This file documents the GNU linker ld (GNU Toolchain for the A-profile
  20. Architecture 10.3-2021.07 (arm-10.29)) version 2.36.1.
  21. This document is distributed under the terms of the GNU Free
  22. Documentation License version 1.3. A copy of the license is included in
  23. the section entitled "GNU Free Documentation License".
  24. * Menu:
  25. * Overview:: Overview
  26. * Invocation:: Invocation
  27. * Scripts:: Linker Scripts
  28. * Plugins:: Linker Plugins
  29. * Machine Dependent:: Machine Dependent Features
  30. * BFD:: BFD
  31. * Reporting Bugs:: Reporting Bugs
  32. * MRI:: MRI Compatible Script Files
  33. * GNU Free Documentation License:: GNU Free Documentation License
  34. * LD Index:: LD Index
  35. 
  36. File: ld.info, Node: Overview, Next: Invocation, Prev: Top, Up: Top
  37. 1 Overview
  38. **********
  39. 'ld' combines a number of object and archive files, relocates their data
  40. and ties up symbol references. Usually the last step in compiling a
  41. program is to run 'ld'.
  42. 'ld' accepts Linker Command Language files written in a superset of
  43. AT&T's Link Editor Command Language syntax, to provide explicit and
  44. total control over the linking process.
  45. This version of 'ld' uses the general purpose BFD libraries to
  46. operate on object files. This allows 'ld' to read, combine, and write
  47. object files in many different formats--for example, COFF or 'a.out'.
  48. Different formats may be linked together to produce any available kind
  49. of object file. *Note BFD::, for more information.
  50. Aside from its flexibility, the GNU linker is more helpful than other
  51. linkers in providing diagnostic information. Many linkers abandon
  52. execution immediately upon encountering an error; whenever possible,
  53. 'ld' continues executing, allowing you to identify other errors (or, in
  54. some cases, to get an output file in spite of the error).
  55. 
  56. File: ld.info, Node: Invocation, Next: Scripts, Prev: Overview, Up: Top
  57. 2 Invocation
  58. ************
  59. The GNU linker 'ld' is meant to cover a broad range of situations, and
  60. to be as compatible as possible with other linkers. As a result, you
  61. have many choices to control its behavior.
  62. * Menu:
  63. * Options:: Command-line Options
  64. * Environment:: Environment Variables
  65. 
  66. File: ld.info, Node: Options, Next: Environment, Up: Invocation
  67. 2.1 Command-line Options
  68. ========================
  69. The linker supports a plethora of command-line options, but in actual
  70. practice few of them are used in any particular context. For instance,
  71. a frequent use of 'ld' is to link standard Unix object files on a
  72. standard, supported Unix system. On such a system, to link a file
  73. 'hello.o':
  74. ld -o OUTPUT /lib/crt0.o hello.o -lc
  75. This tells 'ld' to produce a file called OUTPUT as the result of
  76. linking the file '/lib/crt0.o' with 'hello.o' and the library 'libc.a',
  77. which will come from the standard search directories. (See the
  78. discussion of the '-l' option below.)
  79. Some of the command-line options to 'ld' may be specified at any
  80. point in the command line. However, options which refer to files, such
  81. as '-l' or '-T', cause the file to be read at the point at which the
  82. option appears in the command line, relative to the object files and
  83. other file options. Repeating non-file options with a different
  84. argument will either have no further effect, or override prior
  85. occurrences (those further to the left on the command line) of that
  86. option. Options which may be meaningfully specified more than once are
  87. noted in the descriptions below.
  88. Non-option arguments are object files or archives which are to be
  89. linked together. They may follow, precede, or be mixed in with
  90. command-line options, except that an object file argument may not be
  91. placed between an option and its argument.
  92. Usually the linker is invoked with at least one object file, but you
  93. can specify other forms of binary input files using '-l', '-R', and the
  94. script command language. If _no_ binary input files at all are
  95. specified, the linker does not produce any output, and issues the
  96. message 'No input files'.
  97. If the linker cannot recognize the format of an object file, it will
  98. assume that it is a linker script. A script specified in this way
  99. augments the main linker script used for the link (either the default
  100. linker script or the one specified by using '-T'). This feature permits
  101. the linker to link against a file which appears to be an object or an
  102. archive, but actually merely defines some symbol values, or uses 'INPUT'
  103. or 'GROUP' to load other objects. Specifying a script in this way
  104. merely augments the main linker script, with the extra commands placed
  105. after the main script; use the '-T' option to replace the default linker
  106. script entirely, but note the effect of the 'INSERT' command. *Note
  107. Scripts::.
  108. For options whose names are a single letter, option arguments must
  109. either follow the option letter without intervening whitespace, or be
  110. given as separate arguments immediately following the option that
  111. requires them.
  112. For options whose names are multiple letters, either one dash or two
  113. can precede the option name; for example, '-trace-symbol' and
  114. '--trace-symbol' are equivalent. Note--there is one exception to this
  115. rule. Multiple letter options that start with a lower case 'o' can only
  116. be preceded by two dashes. This is to reduce confusion with the '-o'
  117. option. So for example '-omagic' sets the output file name to 'magic'
  118. whereas '--omagic' sets the NMAGIC flag on the output.
  119. Arguments to multiple-letter options must either be separated from
  120. the option name by an equals sign, or be given as separate arguments
  121. immediately following the option that requires them. For example,
  122. '--trace-symbol foo' and '--trace-symbol=foo' are equivalent. Unique
  123. abbreviations of the names of multiple-letter options are accepted.
  124. Note--if the linker is being invoked indirectly, via a compiler
  125. driver (e.g. 'gcc') then all the linker command-line options should be
  126. prefixed by '-Wl,' (or whatever is appropriate for the particular
  127. compiler driver) like this:
  128. gcc -Wl,--start-group foo.o bar.o -Wl,--end-group
  129. This is important, because otherwise the compiler driver program may
  130. silently drop the linker options, resulting in a bad link. Confusion
  131. may also arise when passing options that require values through a
  132. driver, as the use of a space between option and argument acts as a
  133. separator, and causes the driver to pass only the option to the linker
  134. and the argument to the compiler. In this case, it is simplest to use
  135. the joined forms of both single- and multiple-letter options, such as:
  136. gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map
  137. Here is a table of the generic command-line switches accepted by the
  138. GNU linker:
  139. '@FILE'
  140. Read command-line options from FILE. The options read are inserted
  141. in place of the original @FILE option. If FILE does not exist, or
  142. cannot be read, then the option will be treated literally, and not
  143. removed.
  144. Options in FILE are separated by whitespace. A whitespace
  145. character may be included in an option by surrounding the entire
  146. option in either single or double quotes. Any character (including
  147. a backslash) may be included by prefixing the character to be
  148. included with a backslash. The FILE may itself contain additional
  149. @FILE options; any such options will be processed recursively.
  150. '-a KEYWORD'
  151. This option is supported for HP/UX compatibility. The KEYWORD
  152. argument must be one of the strings 'archive', 'shared', or
  153. 'default'. '-aarchive' is functionally equivalent to '-Bstatic',
  154. and the other two keywords are functionally equivalent to
  155. '-Bdynamic'. This option may be used any number of times.
  156. '--audit AUDITLIB'
  157. Adds AUDITLIB to the 'DT_AUDIT' entry of the dynamic section.
  158. AUDITLIB is not checked for existence, nor will it use the
  159. DT_SONAME specified in the library. If specified multiple times
  160. 'DT_AUDIT' will contain a colon separated list of audit interfaces
  161. to use. If the linker finds an object with an audit entry while
  162. searching for shared libraries, it will add a corresponding
  163. 'DT_DEPAUDIT' entry in the output file. This option is only
  164. meaningful on ELF platforms supporting the rtld-audit interface.
  165. '-b INPUT-FORMAT'
  166. '--format=INPUT-FORMAT'
  167. 'ld' may be configured to support more than one kind of object
  168. file. If your 'ld' is configured this way, you can use the '-b'
  169. option to specify the binary format for input object files that
  170. follow this option on the command line. Even when 'ld' is
  171. configured to support alternative object formats, you don't usually
  172. need to specify this, as 'ld' should be configured to expect as a
  173. default input format the most usual format on each machine.
  174. INPUT-FORMAT is a text string, the name of a particular format
  175. supported by the BFD libraries. (You can list the available binary
  176. formats with 'objdump -i'.) *Note BFD::.
  177. You may want to use this option if you are linking files with an
  178. unusual binary format. You can also use '-b' to switch formats
  179. explicitly (when linking object files of different formats), by
  180. including '-b INPUT-FORMAT' before each group of object files in a
  181. particular format.
  182. The default format is taken from the environment variable
  183. 'GNUTARGET'. *Note Environment::. You can also define the input
  184. format from a script, using the command 'TARGET'; see *note Format
  185. Commands::.
  186. '-c MRI-COMMANDFILE'
  187. '--mri-script=MRI-COMMANDFILE'
  188. For compatibility with linkers produced by MRI, 'ld' accepts script
  189. files written in an alternate, restricted command language,
  190. described in *note MRI Compatible Script Files: MRI. Introduce MRI
  191. script files with the option '-c'; use the '-T' option to run
  192. linker scripts written in the general-purpose 'ld' scripting
  193. language. If MRI-CMDFILE does not exist, 'ld' looks for it in the
  194. directories specified by any '-L' options.
  195. '-d'
  196. '-dc'
  197. '-dp'
  198. These three options are equivalent; multiple forms are supported
  199. for compatibility with other linkers. They assign space to common
  200. symbols even if a relocatable output file is specified (with '-r').
  201. The script command 'FORCE_COMMON_ALLOCATION' has the same effect.
  202. *Note Miscellaneous Commands::.
  203. '--depaudit AUDITLIB'
  204. '-P AUDITLIB'
  205. Adds AUDITLIB to the 'DT_DEPAUDIT' entry of the dynamic section.
  206. AUDITLIB is not checked for existence, nor will it use the
  207. DT_SONAME specified in the library. If specified multiple times
  208. 'DT_DEPAUDIT' will contain a colon separated list of audit
  209. interfaces to use. This option is only meaningful on ELF platforms
  210. supporting the rtld-audit interface. The -P option is provided for
  211. Solaris compatibility.
  212. '--enable-non-contiguous-regions'
  213. This option avoids generating an error if an input section does not
  214. fit a matching output section. The linker tries to allocate the
  215. input section to subseque nt matching output sections, and
  216. generates an error only if no output section is large enough. This
  217. is useful when several non-contiguous memory regions are available
  218. and the input section does not require a particular one. The order
  219. in which input sections are evaluated does not change, for
  220. instance:
  221. MEMORY {
  222. MEM1 (rwx) : ORIGIN : 0x1000, LENGTH = 0x14
  223. MEM2 (rwx) : ORIGIN : 0x1000, LENGTH = 0x40
  224. MEM3 (rwx) : ORIGIN : 0x2000, LENGTH = 0x40
  225. }
  226. SECTIONS {
  227. mem1 : { *(.data.*); } > MEM1
  228. mem2 : { *(.data.*); } > MEM2
  229. mem3 : { *(.data.*); } > MEM2
  230. }
  231. with input sections:
  232. .data.1: size 8
  233. .data.2: size 0x10
  234. .data.3: size 4
  235. results in .data.1 affected to mem1, and .data.2 and .data.3
  236. affected to mem2, even though .data.3 would fit in mem3.
  237. This option is incompatible with INSERT statements because it
  238. changes the way input sections are mapped to output sections.
  239. '--enable-non-contiguous-regions-warnings'
  240. This option enables warnings when '--enable-non-contiguous-regions'
  241. allows possibly unexpected matches in sections mapping, potentially
  242. leading to silently discarding a section instead of failing because
  243. it does not fit any output region.
  244. '-e ENTRY'
  245. '--entry=ENTRY'
  246. Use ENTRY as the explicit symbol for beginning execution of your
  247. program, rather than the default entry point. If there is no
  248. symbol named ENTRY, the linker will try to parse ENTRY as a number,
  249. and use that as the entry address (the number will be interpreted
  250. in base 10; you may use a leading '0x' for base 16, or a leading
  251. '0' for base 8). *Note Entry Point::, for a discussion of defaults
  252. and other ways of specifying the entry point.
  253. '--exclude-libs LIB,LIB,...'
  254. Specifies a list of archive libraries from which symbols should not
  255. be automatically exported. The library names may be delimited by
  256. commas or colons. Specifying '--exclude-libs ALL' excludes symbols
  257. in all archive libraries from automatic export. This option is
  258. available only for the i386 PE targeted port of the linker and for
  259. ELF targeted ports. For i386 PE, symbols explicitly listed in a
  260. .def file are still exported, regardless of this option. For ELF
  261. targeted ports, symbols affected by this option will be treated as
  262. hidden.
  263. '--exclude-modules-for-implib MODULE,MODULE,...'
  264. Specifies a list of object files or archive members, from which
  265. symbols should not be automatically exported, but which should be
  266. copied wholesale into the import library being generated during the
  267. link. The module names may be delimited by commas or colons, and
  268. must match exactly the filenames used by 'ld' to open the files;
  269. for archive members, this is simply the member name, but for object
  270. files the name listed must include and match precisely any path
  271. used to specify the input file on the linker's command-line. This
  272. option is available only for the i386 PE targeted port of the
  273. linker. Symbols explicitly listed in a .def file are still
  274. exported, regardless of this option.
  275. '-E'
  276. '--export-dynamic'
  277. '--no-export-dynamic'
  278. When creating a dynamically linked executable, using the '-E'
  279. option or the '--export-dynamic' option causes the linker to add
  280. all symbols to the dynamic symbol table. The dynamic symbol table
  281. is the set of symbols which are visible from dynamic objects at run
  282. time.
  283. If you do not use either of these options (or use the
  284. '--no-export-dynamic' option to restore the default behavior), the
  285. dynamic symbol table will normally contain only those symbols which
  286. are referenced by some dynamic object mentioned in the link.
  287. If you use 'dlopen' to load a dynamic object which needs to refer
  288. back to the symbols defined by the program, rather than some other
  289. dynamic object, then you will probably need to use this option when
  290. linking the program itself.
  291. You can also use the dynamic list to control what symbols should be
  292. added to the dynamic symbol table if the output format supports it.
  293. See the description of '--dynamic-list'.
  294. Note that this option is specific to ELF targeted ports. PE
  295. targets support a similar function to export all symbols from a DLL
  296. or EXE; see the description of '--export-all-symbols' below.
  297. '--export-dynamic-symbol=GLOB'
  298. When creating a dynamically linked executable, symbols matching
  299. GLOB will be added to the dynamic symbol table. When creating a
  300. shared library, references to symbols matching GLOB will not be
  301. bound to the definitions within the shared library. This option is
  302. a no-op when creating a shared library and '-Bsymbolic' or
  303. '--dynamic-list' are not specified. This option is only meaningful
  304. on ELF platforms which support shared libraries.
  305. '--export-dynamic-symbol-list=FILE'
  306. Specify a '--export-dynamic-symbol' for each pattern in the file.
  307. The format of the file is the same as the version node without
  308. scope and node name. See *note VERSION:: for more information.
  309. '-EB'
  310. Link big-endian objects. This affects the default output format.
  311. '-EL'
  312. Link little-endian objects. This affects the default output
  313. format.
  314. '-f NAME'
  315. '--auxiliary=NAME'
  316. When creating an ELF shared object, set the internal DT_AUXILIARY
  317. field to the specified name. This tells the dynamic linker that
  318. the symbol table of the shared object should be used as an
  319. auxiliary filter on the symbol table of the shared object NAME.
  320. If you later link a program against this filter object, then, when
  321. you run the program, the dynamic linker will see the DT_AUXILIARY
  322. field. If the dynamic linker resolves any symbols from the filter
  323. object, it will first check whether there is a definition in the
  324. shared object NAME. If there is one, it will be used instead of
  325. the definition in the filter object. The shared object NAME need
  326. not exist. Thus the shared object NAME may be used to provide an
  327. alternative implementation of certain functions, perhaps for
  328. debugging or for machine-specific performance.
  329. This option may be specified more than once. The DT_AUXILIARY
  330. entries will be created in the order in which they appear on the
  331. command line.
  332. '-F NAME'
  333. '--filter=NAME'
  334. When creating an ELF shared object, set the internal DT_FILTER
  335. field to the specified name. This tells the dynamic linker that
  336. the symbol table of the shared object which is being created should
  337. be used as a filter on the symbol table of the shared object NAME.
  338. If you later link a program against this filter object, then, when
  339. you run the program, the dynamic linker will see the DT_FILTER
  340. field. The dynamic linker will resolve symbols according to the
  341. symbol table of the filter object as usual, but it will actually
  342. link to the definitions found in the shared object NAME. Thus the
  343. filter object can be used to select a subset of the symbols
  344. provided by the object NAME.
  345. Some older linkers used the '-F' option throughout a compilation
  346. toolchain for specifying object-file format for both input and
  347. output object files. The GNU linker uses other mechanisms for this
  348. purpose: the '-b', '--format', '--oformat' options, the 'TARGET'
  349. command in linker scripts, and the 'GNUTARGET' environment
  350. variable. The GNU linker will ignore the '-F' option when not
  351. creating an ELF shared object.
  352. '-fini=NAME'
  353. When creating an ELF executable or shared object, call NAME when
  354. the executable or shared object is unloaded, by setting DT_FINI to
  355. the address of the function. By default, the linker uses '_fini'
  356. as the function to call.
  357. '-g'
  358. Ignored. Provided for compatibility with other tools.
  359. '-G VALUE'
  360. '--gpsize=VALUE'
  361. Set the maximum size of objects to be optimized using the GP
  362. register to SIZE. This is only meaningful for object file formats
  363. such as MIPS ELF that support putting large and small objects into
  364. different sections. This is ignored for other object file formats.
  365. '-h NAME'
  366. '-soname=NAME'
  367. When creating an ELF shared object, set the internal DT_SONAME
  368. field to the specified name. When an executable is linked with a
  369. shared object which has a DT_SONAME field, then when the executable
  370. is run the dynamic linker will attempt to load the shared object
  371. specified by the DT_SONAME field rather than the using the file
  372. name given to the linker.
  373. '-i'
  374. Perform an incremental link (same as option '-r').
  375. '-init=NAME'
  376. When creating an ELF executable or shared object, call NAME when
  377. the executable or shared object is loaded, by setting DT_INIT to
  378. the address of the function. By default, the linker uses '_init'
  379. as the function to call.
  380. '-l NAMESPEC'
  381. '--library=NAMESPEC'
  382. Add the archive or object file specified by NAMESPEC to the list of
  383. files to link. This option may be used any number of times. If
  384. NAMESPEC is of the form ':FILENAME', 'ld' will search the library
  385. path for a file called FILENAME, otherwise it will search the
  386. library path for a file called 'libNAMESPEC.a'.
  387. On systems which support shared libraries, 'ld' may also search for
  388. files other than 'libNAMESPEC.a'. Specifically, on ELF and SunOS
  389. systems, 'ld' will search a directory for a library called
  390. 'libNAMESPEC.so' before searching for one called 'libNAMESPEC.a'.
  391. (By convention, a '.so' extension indicates a shared library.)
  392. Note that this behavior does not apply to ':FILENAME', which always
  393. specifies a file called FILENAME.
  394. The linker will search an archive only once, at the location where
  395. it is specified on the command line. If the archive defines a
  396. symbol which was undefined in some object which appeared before the
  397. archive on the command line, the linker will include the
  398. appropriate file(s) from the archive. However, an undefined symbol
  399. in an object appearing later on the command line will not cause the
  400. linker to search the archive again.
  401. See the '-(' option for a way to force the linker to search
  402. archives multiple times.
  403. You may list the same archive multiple times on the command line.
  404. This type of archive searching is standard for Unix linkers.
  405. However, if you are using 'ld' on AIX, note that it is different
  406. from the behaviour of the AIX linker.
  407. '-L SEARCHDIR'
  408. '--library-path=SEARCHDIR'
  409. Add path SEARCHDIR to the list of paths that 'ld' will search for
  410. archive libraries and 'ld' control scripts. You may use this
  411. option any number of times. The directories are searched in the
  412. order in which they are specified on the command line. Directories
  413. specified on the command line are searched before the default
  414. directories. All '-L' options apply to all '-l' options,
  415. regardless of the order in which the options appear. '-L' options
  416. do not affect how 'ld' searches for a linker script unless '-T'
  417. option is specified.
  418. If SEARCHDIR begins with '=' or '$SYSROOT', then this prefix will
  419. be replaced by the "sysroot prefix", controlled by the '--sysroot'
  420. option, or specified when the linker is configured.
  421. The default set of paths searched (without being specified with
  422. '-L') depends on which emulation mode 'ld' is using, and in some
  423. cases also on how it was configured. *Note Environment::.
  424. The paths can also be specified in a link script with the
  425. 'SEARCH_DIR' command. Directories specified this way are searched
  426. at the point in which the linker script appears in the command
  427. line.
  428. '-m EMULATION'
  429. Emulate the EMULATION linker. You can list the available
  430. emulations with the '--verbose' or '-V' options.
  431. If the '-m' option is not used, the emulation is taken from the
  432. 'LDEMULATION' environment variable, if that is defined.
  433. Otherwise, the default emulation depends upon how the linker was
  434. configured.
  435. '-M'
  436. '--print-map'
  437. Print a link map to the standard output. A link map provides
  438. information about the link, including the following:
  439. * Where object files are mapped into memory.
  440. * How common symbols are allocated.
  441. * All archive members included in the link, with a mention of
  442. the symbol which caused the archive member to be brought in.
  443. * The values assigned to symbols.
  444. Note - symbols whose values are computed by an expression
  445. which involves a reference to a previous value of the same
  446. symbol may not have correct result displayed in the link map.
  447. This is because the linker discards intermediate results and
  448. only retains the final value of an expression. Under such
  449. circumstances the linker will display the final value enclosed
  450. by square brackets. Thus for example a linker script
  451. containing:
  452. foo = 1
  453. foo = foo * 4
  454. foo = foo + 8
  455. will produce the following output in the link map if the '-M'
  456. option is used:
  457. 0x00000001 foo = 0x1
  458. [0x0000000c] foo = (foo * 0x4)
  459. [0x0000000c] foo = (foo + 0x8)
  460. See *note Expressions:: for more information about expressions
  461. in linker scripts.
  462. * How GNU properties are merged.
  463. When the linker merges input .note.gnu.property sections into
  464. one output .note.gnu.property section, some properties are
  465. removed or updated. These actions are reported in the link
  466. map. For example:
  467. Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
  468. This indicates that property 0xc0000002 is removed from output
  469. when merging properties in 'foo.o', whose property 0xc0000002
  470. value is 0x1, and 'bar.o', which doesn't have property
  471. 0xc0000002.
  472. Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1)
  473. This indicates that property 0xc0010001 value is updated to
  474. 0x1 in output when merging properties in 'foo.o', whose
  475. 0xc0010001 property value is 0x1, and 'bar.o', whose
  476. 0xc0010001 property value is 0x1.
  477. '--print-map-discarded'
  478. '--no-print-map-discarded'
  479. Print (or do not print) the list of discarded and garbage collected
  480. sections in the link map. Enabled by default.
  481. '-n'
  482. '--nmagic'
  483. Turn off page alignment of sections, and disable linking against
  484. shared libraries. If the output format supports Unix style magic
  485. numbers, mark the output as 'NMAGIC'.
  486. '-N'
  487. '--omagic'
  488. Set the text and data sections to be readable and writable. Also,
  489. do not page-align the data segment, and disable linking against
  490. shared libraries. If the output format supports Unix style magic
  491. numbers, mark the output as 'OMAGIC'. Note: Although a writable
  492. text section is allowed for PE-COFF targets, it does not conform to
  493. the format specification published by Microsoft.
  494. '--no-omagic'
  495. This option negates most of the effects of the '-N' option. It
  496. sets the text section to be read-only, and forces the data segment
  497. to be page-aligned. Note - this option does not enable linking
  498. against shared libraries. Use '-Bdynamic' for this.
  499. '-o OUTPUT'
  500. '--output=OUTPUT'
  501. Use OUTPUT as the name for the program produced by 'ld'; if this
  502. option is not specified, the name 'a.out' is used by default. The
  503. script command 'OUTPUT' can also specify the output file name.
  504. '--dependency-file=DEPFILE'
  505. Write a "dependency file" to DEPFILE. This file contains a rule
  506. suitable for 'make' describing the output file and all the input
  507. files that were read to produce it. The output is similar to the
  508. compiler's output with '-M -MP' (*note Options Controlling the
  509. Preprocessor: (gcc.info)Preprocessor Options.). Note that there is
  510. no option like the compiler's '-MM', to exclude "system files"
  511. (which is not a well-specified concept in the linker, unlike
  512. "system headers" in the compiler). So the output from
  513. '--dependency-file' is always specific to the exact state of the
  514. installation where it was produced, and should not be copied into
  515. distributed makefiles without careful editing.
  516. '-O LEVEL'
  517. If LEVEL is a numeric values greater than zero 'ld' optimizes the
  518. output. This might take significantly longer and therefore
  519. probably should only be enabled for the final binary. At the
  520. moment this option only affects ELF shared library generation.
  521. Future releases of the linker may make more use of this option.
  522. Also currently there is no difference in the linker's behaviour for
  523. different non-zero values of this option. Again this may change
  524. with future releases.
  525. '-plugin NAME'
  526. Involve a plugin in the linking process. The NAME parameter is the
  527. absolute filename of the plugin. Usually this parameter is
  528. automatically added by the complier, when using link time
  529. optimization, but users can also add their own plugins if they so
  530. wish.
  531. Note that the location of the compiler originated plugins is
  532. different from the place where the 'ar', 'nm' and 'ranlib' programs
  533. search for their plugins. In order for those commands to make use
  534. of a compiler based plugin it must first be copied into the
  535. '${libdir}/bfd-plugins' directory. All gcc based linker plugins
  536. are backward compatible, so it is sufficient to just copy in the
  537. newest one.
  538. '--push-state'
  539. The '--push-state' allows one to preserve the current state of the
  540. flags which govern the input file handling so that they can all be
  541. restored with one corresponding '--pop-state' option.
  542. The option which are covered are: '-Bdynamic', '-Bstatic', '-dn',
  543. '-dy', '-call_shared', '-non_shared', '-static', '-N', '-n',
  544. '--whole-archive', '--no-whole-archive', '-r', '-Ur',
  545. '--copy-dt-needed-entries', '--no-copy-dt-needed-entries',
  546. '--as-needed', '--no-as-needed', and '-a'.
  547. One target for this option are specifications for 'pkg-config'.
  548. When used with the '--libs' option all possibly needed libraries
  549. are listed and then possibly linked with all the time. It is
  550. better to return something as follows:
  551. -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state
  552. '--pop-state'
  553. Undoes the effect of -push-state, restores the previous values of
  554. the flags governing input file handling.
  555. '-q'
  556. '--emit-relocs'
  557. Leave relocation sections and contents in fully linked executables.
  558. Post link analysis and optimization tools may need this information
  559. in order to perform correct modifications of executables. This
  560. results in larger executables.
  561. This option is currently only supported on ELF platforms.
  562. '--force-dynamic'
  563. Force the output file to have dynamic sections. This option is
  564. specific to VxWorks targets.
  565. '-r'
  566. '--relocatable'
  567. Generate relocatable output--i.e., generate an output file that can
  568. in turn serve as input to 'ld'. This is often called "partial
  569. linking". As a side effect, in environments that support standard
  570. Unix magic numbers, this option also sets the output file's magic
  571. number to 'OMAGIC'. If this option is not specified, an absolute
  572. file is produced. When linking C++ programs, this option _will
  573. not_ resolve references to constructors; to do that, use '-Ur'.
  574. When an input file does not have the same format as the output
  575. file, partial linking is only supported if that input file does not
  576. contain any relocations. Different output formats can have further
  577. restrictions; for example some 'a.out'-based formats do not support
  578. partial linking with input files in other formats at all.
  579. This option does the same thing as '-i'.
  580. '-R FILENAME'
  581. '--just-symbols=FILENAME'
  582. Read symbol names and their addresses from FILENAME, but do not
  583. relocate it or include it in the output. This allows your output
  584. file to refer symbolically to absolute locations of memory defined
  585. in other programs. You may use this option more than once.
  586. For compatibility with other ELF linkers, if the '-R' option is
  587. followed by a directory name, rather than a file name, it is
  588. treated as the '-rpath' option.
  589. '-s'
  590. '--strip-all'
  591. Omit all symbol information from the output file.
  592. '-S'
  593. '--strip-debug'
  594. Omit debugger symbol information (but not all symbols) from the
  595. output file.
  596. '--strip-discarded'
  597. '--no-strip-discarded'
  598. Omit (or do not omit) global symbols defined in discarded sections.
  599. Enabled by default.
  600. '-t'
  601. '--trace'
  602. Print the names of the input files as 'ld' processes them. If '-t'
  603. is given twice then members within archives are also printed. '-t'
  604. output is useful to generate a list of all the object files and
  605. scripts involved in linking, for example, when packaging files for
  606. a linker bug report.
  607. '-T SCRIPTFILE'
  608. '--script=SCRIPTFILE'
  609. Use SCRIPTFILE as the linker script. This script replaces 'ld''s
  610. default linker script (rather than adding to it), so COMMANDFILE
  611. must specify everything necessary to describe the output file.
  612. *Note Scripts::. If SCRIPTFILE does not exist in the current
  613. directory, 'ld' looks for it in the directories specified by any
  614. preceding '-L' options. Multiple '-T' options accumulate.
  615. '-dT SCRIPTFILE'
  616. '--default-script=SCRIPTFILE'
  617. Use SCRIPTFILE as the default linker script. *Note Scripts::.
  618. This option is similar to the '--script' option except that
  619. processing of the script is delayed until after the rest of the
  620. command line has been processed. This allows options placed after
  621. the '--default-script' option on the command line to affect the
  622. behaviour of the linker script, which can be important when the
  623. linker command line cannot be directly controlled by the user. (eg
  624. because the command line is being constructed by another tool, such
  625. as 'gcc').
  626. '-u SYMBOL'
  627. '--undefined=SYMBOL'
  628. Force SYMBOL to be entered in the output file as an undefined
  629. symbol. Doing this may, for example, trigger linking of additional
  630. modules from standard libraries. '-u' may be repeated with
  631. different option arguments to enter additional undefined symbols.
  632. This option is equivalent to the 'EXTERN' linker script command.
  633. If this option is being used to force additional modules to be
  634. pulled into the link, and if it is an error for the symbol to
  635. remain undefined, then the option '--require-defined' should be
  636. used instead.
  637. '--require-defined=SYMBOL'
  638. Require that SYMBOL is defined in the output file. This option is
  639. the same as option '--undefined' except that if SYMBOL is not
  640. defined in the output file then the linker will issue an error and
  641. exit. The same effect can be achieved in a linker script by using
  642. 'EXTERN', 'ASSERT' and 'DEFINED' together. This option can be used
  643. multiple times to require additional symbols.
  644. '-Ur'
  645. For anything other than C++ programs, this option is equivalent to
  646. '-r': it generates relocatable output--i.e., an output file that
  647. can in turn serve as input to 'ld'. When linking C++ programs,
  648. '-Ur' _does_ resolve references to constructors, unlike '-r'. It
  649. does not work to use '-Ur' on files that were themselves linked
  650. with '-Ur'; once the constructor table has been built, it cannot be
  651. added to. Use '-Ur' only for the last partial link, and '-r' for
  652. the others.
  653. '--orphan-handling=MODE'
  654. Control how orphan sections are handled. An orphan section is one
  655. not specifically mentioned in a linker script. *Note Orphan
  656. Sections::.
  657. MODE can have any of the following values:
  658. 'place'
  659. Orphan sections are placed into a suitable output section
  660. following the strategy described in *note Orphan Sections::.
  661. The option '--unique' also affects how sections are placed.
  662. 'discard'
  663. All orphan sections are discarded, by placing them in the
  664. '/DISCARD/' section (*note Output Section Discarding::).
  665. 'warn'
  666. The linker will place the orphan section as for 'place' and
  667. also issue a warning.
  668. 'error'
  669. The linker will exit with an error if any orphan section is
  670. found.
  671. The default if '--orphan-handling' is not given is 'place'.
  672. '--unique[=SECTION]'
  673. Creates a separate output section for every input section matching
  674. SECTION, or if the optional wildcard SECTION argument is missing,
  675. for every orphan input section. An orphan section is one not
  676. specifically mentioned in a linker script. You may use this option
  677. multiple times on the command line; It prevents the normal merging
  678. of input sections with the same name, overriding output section
  679. assignments in a linker script.
  680. '-v'
  681. '--version'
  682. '-V'
  683. Display the version number for 'ld'. The '-V' option also lists
  684. the supported emulations.
  685. '-x'
  686. '--discard-all'
  687. Delete all local symbols.
  688. '-X'
  689. '--discard-locals'
  690. Delete all temporary local symbols. (These symbols start with
  691. system-specific local label prefixes, typically '.L' for ELF
  692. systems or 'L' for traditional a.out systems.)
  693. '-y SYMBOL'
  694. '--trace-symbol=SYMBOL'
  695. Print the name of each linked file in which SYMBOL appears. This
  696. option may be given any number of times. On many systems it is
  697. necessary to prepend an underscore.
  698. This option is useful when you have an undefined symbol in your
  699. link but don't know where the reference is coming from.
  700. '-Y PATH'
  701. Add PATH to the default library search path. This option exists
  702. for Solaris compatibility.
  703. '-z KEYWORD'
  704. The recognized keywords are:
  705. 'bndplt'
  706. Always generate BND prefix in PLT entries. Supported for
  707. Linux/x86_64.
  708. 'call-nop=prefix-addr'
  709. 'call-nop=suffix-nop'
  710. 'call-nop=prefix-BYTE'
  711. 'call-nop=suffix-BYTE'
  712. Specify the 1-byte 'NOP' padding when transforming indirect
  713. call to a locally defined function, foo, via its GOT slot.
  714. 'call-nop=prefix-addr' generates '0x67 call foo'.
  715. 'call-nop=suffix-nop' generates 'call foo 0x90'.
  716. 'call-nop=prefix-BYTE' generates 'BYTE call foo'.
  717. 'call-nop=suffix-BYTE' generates 'call foo BYTE'. Supported
  718. for i386 and x86_64.
  719. 'cet-report=none'
  720. 'cet-report=warning'
  721. 'cet-report=error'
  722. Specify how to report the missing
  723. GNU_PROPERTY_X86_FEATURE_1_IBT and
  724. GNU_PROPERTY_X86_FEATURE_1_SHSTK properties in input
  725. .note.gnu.property section. 'cet-report=none', which is the
  726. default, will make the linker not report missing properties in
  727. input files. 'cet-report=warning' will make the linker issue
  728. a warning for missing properties in input files.
  729. 'cet-report=error' will make the linker issue an error for
  730. missing properties in input files. Note that 'ibt' will turn
  731. off the missing GNU_PROPERTY_X86_FEATURE_1_IBT property report
  732. and 'shstk' will turn off the missing
  733. GNU_PROPERTY_X86_FEATURE_1_SHSTK property report. Supported
  734. for Linux/i386 and Linux/x86_64.
  735. 'combreloc'
  736. 'nocombreloc'
  737. Combine multiple dynamic relocation sections and sort to
  738. improve dynamic symbol lookup caching. Do not do this if
  739. 'nocombreloc'.
  740. 'common'
  741. 'nocommon'
  742. Generate common symbols with STT_COMMON type during a
  743. relocatable link. Use STT_OBJECT type if 'nocommon'.
  744. 'common-page-size=VALUE'
  745. Set the page size most commonly used to VALUE. Memory image
  746. layout will be optimized to minimize memory pages if the
  747. system is using pages of this size.
  748. 'defs'
  749. Report unresolved symbol references from regular object files.
  750. This is done even if the linker is creating a non-symbolic
  751. shared library. This option is the inverse of '-z undefs'.
  752. 'dynamic-undefined-weak'
  753. 'nodynamic-undefined-weak'
  754. Make undefined weak symbols dynamic when building a dynamic
  755. object, if they are referenced from a regular object file and
  756. not forced local by symbol visibility or versioning. Do not
  757. make them dynamic if 'nodynamic-undefined-weak'. If neither
  758. option is given, a target may default to either option being
  759. in force, or make some other selection of undefined weak
  760. symbols dynamic. Not all targets support these options.
  761. 'execstack'
  762. Marks the object as requiring executable stack.
  763. 'global'
  764. This option is only meaningful when building a shared object.
  765. It makes the symbols defined by this shared object available
  766. for symbol resolution of subsequently loaded libraries.
  767. 'globalaudit'
  768. This option is only meaningful when building a dynamic
  769. executable. This option marks the executable as requiring
  770. global auditing by setting the 'DF_1_GLOBAUDIT' bit in the
  771. 'DT_FLAGS_1' dynamic tag. Global auditing requires that any
  772. auditing library defined via the '--depaudit' or '-P'
  773. command-line options be run for all dynamic objects loaded by
  774. the application.
  775. 'ibtplt'
  776. Generate Intel Indirect Branch Tracking (IBT) enabled PLT
  777. entries. Supported for Linux/i386 and Linux/x86_64.
  778. 'ibt'
  779. Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property
  780. section to indicate compatibility with IBT. This also implies
  781. 'ibtplt'. Supported for Linux/i386 and Linux/x86_64.
  782. 'initfirst'
  783. This option is only meaningful when building a shared object.
  784. It marks the object so that its runtime initialization will
  785. occur before the runtime initialization of any other objects
  786. brought into the process at the same time. Similarly the
  787. runtime finalization of the object will occur after the
  788. runtime finalization of any other objects.
  789. 'interpose'
  790. Specify that the dynamic loader should modify its symbol
  791. search order so that symbols in this shared library interpose
  792. all other shared libraries not so marked.
  793. 'unique'
  794. 'nounique'
  795. When generating a shared library or other dynamically loadable
  796. ELF object mark it as one that should (by default) only ever
  797. be loaded once, and only in the main namespace (when using
  798. 'dlmopen'). This is primarily used to mark fundamental
  799. libraries such as libc, libpthread et al which do not usually
  800. function correctly unless they are the sole instances of
  801. themselves. This behaviour can be overridden by the 'dlmopen'
  802. caller and does not apply to certain loading mechanisms (such
  803. as audit libraries).
  804. 'lam-u48'
  805. Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48 in
  806. .note.gnu.property section to indicate compatibility with
  807. Intel LAM_U48. Supported for Linux/x86_64.
  808. 'lam-u57'
  809. Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57 in
  810. .note.gnu.property section to indicate compatibility with
  811. Intel LAM_U57. Supported for Linux/x86_64.
  812. 'lam-u48-report=none'
  813. 'lam-u48-report=warning'
  814. 'lam-u48-report=error'
  815. Specify how to report the missing
  816. GNU_PROPERTY_X86_FEATURE_1_LAM_U48 property in input
  817. .note.gnu.property section. 'lam-u48-report=none', which is
  818. the default, will make the linker not report missing
  819. properties in input files. 'lam-u48-report=warning' will make
  820. the linker issue a warning for missing properties in input
  821. files. 'lam-u48-report=error' will make the linker issue an
  822. error for missing properties in input files. Supported for
  823. Linux/x86_64.
  824. 'lam-u57-report=none'
  825. 'lam-u57-report=warning'
  826. 'lam-u57-report=error'
  827. Specify how to report the missing
  828. GNU_PROPERTY_X86_FEATURE_1_LAM_U57 property in input
  829. .note.gnu.property section. 'lam-u57-report=none', which is
  830. the default, will make the linker not report missing
  831. properties in input files. 'lam-u57-report=warning' will make
  832. the linker issue a warning for missing properties in input
  833. files. 'lam-u57-report=error' will make the linker issue an
  834. error for missing properties in input files. Supported for
  835. Linux/x86_64.
  836. 'lam-report=none'
  837. 'lam-report=warning'
  838. 'lam-report=error'
  839. Specify how to report the missing
  840. GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
  841. GNU_PROPERTY_X86_FEATURE_1_LAM_U57 properties in input
  842. .note.gnu.property section. 'lam-report=none', which is the
  843. default, will make the linker not report missing properties in
  844. input files. 'lam-report=warning' will make the linker issue
  845. a warning for missing properties in input files.
  846. 'lam-report=error' will make the linker issue an error for
  847. missing properties in input files. Supported for
  848. Linux/x86_64.
  849. 'lazy'
  850. When generating an executable or shared library, mark it to
  851. tell the dynamic linker to defer function call resolution to
  852. the point when the function is called (lazy binding), rather
  853. than at load time. Lazy binding is the default.
  854. 'loadfltr'
  855. Specify that the object's filters be processed immediately at
  856. runtime.
  857. 'max-page-size=VALUE'
  858. Set the maximum memory page size supported to VALUE.
  859. 'muldefs'
  860. Allow multiple definitions.
  861. 'nocopyreloc'
  862. Disable linker generated .dynbss variables used in place of
  863. variables defined in shared libraries. May result in dynamic
  864. text relocations.
  865. 'nodefaultlib'
  866. Specify that the dynamic loader search for dependencies of
  867. this object should ignore any default library search paths.
  868. 'nodelete'
  869. Specify that the object shouldn't be unloaded at runtime.
  870. 'nodlopen'
  871. Specify that the object is not available to 'dlopen'.
  872. 'nodump'
  873. Specify that the object can not be dumped by 'dldump'.
  874. 'noexecstack'
  875. Marks the object as not requiring executable stack.
  876. 'noextern-protected-data'
  877. Don't treat protected data symbols as external when building a
  878. shared library. This option overrides the linker backend
  879. default. It can be used to work around incorrect relocations
  880. against protected data symbols generated by compiler. Updates
  881. on protected data symbols by another module aren't visible to
  882. the resulting shared library. Supported for i386 and x86-64.
  883. 'noreloc-overflow'
  884. Disable relocation overflow check. This can be used to
  885. disable relocation overflow check if there will be no dynamic
  886. relocation overflow at run-time. Supported for x86_64.
  887. 'now'
  888. When generating an executable or shared library, mark it to
  889. tell the dynamic linker to resolve all symbols when the
  890. program is started, or when the shared library is loaded by
  891. dlopen, instead of deferring function call resolution to the
  892. point when the function is first called.
  893. 'origin'
  894. Specify that the object requires '$ORIGIN' handling in paths.
  895. 'relro'
  896. 'norelro'
  897. Create an ELF 'PT_GNU_RELRO' segment header in the object.
  898. This specifies a memory segment that should be made read-only
  899. after relocation, if supported. Specifying 'common-page-size'
  900. smaller than the system page size will render this protection
  901. ineffective. Don't create an ELF 'PT_GNU_RELRO' segment if
  902. 'norelro'.
  903. 'separate-code'
  904. 'noseparate-code'
  905. Create separate code 'PT_LOAD' segment header in the object.
  906. This specifies a memory segment that should contain only
  907. instructions and must be in wholly disjoint pages from any
  908. other data. Don't create separate code 'PT_LOAD' segment if
  909. 'noseparate-code' is used.
  910. 'unique-symbol'
  911. 'nounique-symbol'
  912. Avoid duplicated local symbol names in the symbol string
  913. table. Append ".'number'" to duplicated local symbol names if
  914. 'unique-symbol' is used. 'nounique-symbol' is the default.
  915. 'shstk'
  916. Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in
  917. .note.gnu.property section to indicate compatibility with
  918. Intel Shadow Stack. Supported for Linux/i386 and
  919. Linux/x86_64.
  920. 'stack-size=VALUE'
  921. Specify a stack size for an ELF 'PT_GNU_STACK' segment.
  922. Specifying zero will override any default non-zero sized
  923. 'PT_GNU_STACK' segment creation.
  924. 'start-stop-visibility=VALUE'
  925. Specify the ELF symbol visibility for synthesized
  926. '__start_SECNAME' and '__stop_SECNAME' symbols (*note Input
  927. Section Example::). VALUE must be exactly 'default',
  928. 'internal', 'hidden', or 'protected'. If no '-z
  929. start-stop-visibility' option is given, 'protected' is used
  930. for compatibility with historical practice. However, it's
  931. highly recommended to use '-z start-stop-visibility=hidden' in
  932. new programs and shared libraries so that these symbols are
  933. not exported between shared objects, which is not usually
  934. what's intended.
  935. 'text'
  936. 'notext'
  937. 'textoff'
  938. Report an error if DT_TEXTREL is set, i.e., if the
  939. position-independent or shared object has dynamic relocations
  940. in read-only sections. Don't report an error if 'notext' or
  941. 'textoff'.
  942. 'undefs'
  943. Do not report unresolved symbol references from regular object
  944. files, either when creating an executable, or when creating a
  945. shared library. This option is the inverse of '-z defs'.
  946. 'x86-64-baseline'
  947. 'x86-64-v2'
  948. 'x86-64-v3'
  949. 'x86-64-v4'
  950. Specify the x86-64 ISA level needed in .note.gnu.property
  951. section. 'x86-64-baseline' generates
  952. 'GNU_PROPERTY_X86_ISA_1_BASELINE'. 'x86-64-v2' generates
  953. 'GNU_PROPERTY_X86_ISA_1_V2'. 'x86-64-v3' generates
  954. 'GNU_PROPERTY_X86_ISA_1_V3'. 'x86-64-v4' generates
  955. 'GNU_PROPERTY_X86_ISA_1_V4'. Supported for Linux/i386 and
  956. Linux/x86_64.
  957. Other keywords are ignored for Solaris compatibility.
  958. '-( ARCHIVES -)'
  959. '--start-group ARCHIVES --end-group'
  960. The ARCHIVES should be a list of archive files. They may be either
  961. explicit file names, or '-l' options.
  962. The specified archives are searched repeatedly until no new
  963. undefined references are created. Normally, an archive is searched
  964. only once in the order that it is specified on the command line.
  965. If a symbol in that archive is needed to resolve an undefined
  966. symbol referred to by an object in an archive that appears later on
  967. the command line, the linker would not be able to resolve that
  968. reference. By grouping the archives, they will all be searched
  969. repeatedly until all possible references are resolved.
  970. Using this option has a significant performance cost. It is best
  971. to use it only when there are unavoidable circular references
  972. between two or more archives.
  973. '--accept-unknown-input-arch'
  974. '--no-accept-unknown-input-arch'
  975. Tells the linker to accept input files whose architecture cannot be
  976. recognised. The assumption is that the user knows what they are
  977. doing and deliberately wants to link in these unknown input files.
  978. This was the default behaviour of the linker, before release 2.14.
  979. The default behaviour from release 2.14 onwards is to reject such
  980. input files, and so the '--accept-unknown-input-arch' option has
  981. been added to restore the old behaviour.
  982. '--as-needed'
  983. '--no-as-needed'
  984. This option affects ELF DT_NEEDED tags for dynamic libraries
  985. mentioned on the command line after the '--as-needed' option.
  986. Normally the linker will add a DT_NEEDED tag for each dynamic
  987. library mentioned on the command line, regardless of whether the
  988. library is actually needed or not. '--as-needed' causes a
  989. DT_NEEDED tag to only be emitted for a library that _at that point
  990. in the link_ satisfies a non-weak undefined symbol reference from a
  991. regular object file or, if the library is not found in the
  992. DT_NEEDED lists of other needed libraries, a non-weak undefined
  993. symbol reference from another needed dynamic library. Object files
  994. or libraries appearing on the command line _after_ the library in
  995. question do not affect whether the library is seen as needed. This
  996. is similar to the rules for extraction of object files from
  997. archives. '--no-as-needed' restores the default behaviour.
  998. '--add-needed'
  999. '--no-add-needed'
  1000. These two options have been deprecated because of the similarity of
  1001. their names to the '--as-needed' and '--no-as-needed' options.
  1002. They have been replaced by '--copy-dt-needed-entries' and
  1003. '--no-copy-dt-needed-entries'.
  1004. '-assert KEYWORD'
  1005. This option is ignored for SunOS compatibility.
  1006. '-Bdynamic'
  1007. '-dy'
  1008. '-call_shared'
  1009. Link against dynamic libraries. This is only meaningful on
  1010. platforms for which shared libraries are supported. This option is
  1011. normally the default on such platforms. The different variants of
  1012. this option are for compatibility with various systems. You may
  1013. use this option multiple times on the command line: it affects
  1014. library searching for '-l' options which follow it.
  1015. '-Bgroup'
  1016. Set the 'DF_1_GROUP' flag in the 'DT_FLAGS_1' entry in the dynamic
  1017. section. This causes the runtime linker to handle lookups in this
  1018. object and its dependencies to be performed only inside the group.
  1019. '--unresolved-symbols=report-all' is implied. This option is only
  1020. meaningful on ELF platforms which support shared libraries.
  1021. '-Bstatic'
  1022. '-dn'
  1023. '-non_shared'
  1024. '-static'
  1025. Do not link against shared libraries. This is only meaningful on
  1026. platforms for which shared libraries are supported. The different
  1027. variants of this option are for compatibility with various systems.
  1028. You may use this option multiple times on the command line: it
  1029. affects library searching for '-l' options which follow it. This
  1030. option also implies '--unresolved-symbols=report-all'. This option
  1031. can be used with '-shared'. Doing so means that a shared library
  1032. is being created but that all of the library's external references
  1033. must be resolved by pulling in entries from static libraries.
  1034. '-Bsymbolic'
  1035. When creating a shared library, bind references to global symbols
  1036. to the definition within the shared library, if any. Normally, it
  1037. is possible for a program linked against a shared library to
  1038. override the definition within the shared library. This option is
  1039. only meaningful on ELF platforms which support shared libraries.
  1040. '-Bsymbolic-functions'
  1041. When creating a shared library, bind references to global function
  1042. symbols to the definition within the shared library, if any. This
  1043. option is only meaningful on ELF platforms which support shared
  1044. libraries.
  1045. '--dynamic-list=DYNAMIC-LIST-FILE'
  1046. Specify the name of a dynamic list file to the linker. This is
  1047. typically used when creating shared libraries to specify a list of
  1048. global symbols whose references shouldn't be bound to the
  1049. definition within the shared library, or creating dynamically
  1050. linked executables to specify a list of symbols which should be
  1051. added to the symbol table in the executable. This option is only
  1052. meaningful on ELF platforms which support shared libraries.
  1053. The format of the dynamic list is the same as the version node
  1054. without scope and node name. See *note VERSION:: for more
  1055. information.
  1056. '--dynamic-list-data'
  1057. Include all global data symbols to the dynamic list.
  1058. '--dynamic-list-cpp-new'
  1059. Provide the builtin dynamic list for C++ operator new and delete.
  1060. It is mainly useful for building shared libstdc++.
  1061. '--dynamic-list-cpp-typeinfo'
  1062. Provide the builtin dynamic list for C++ runtime type
  1063. identification.
  1064. '--check-sections'
  1065. '--no-check-sections'
  1066. Asks the linker _not_ to check section addresses after they have
  1067. been assigned to see if there are any overlaps. Normally the
  1068. linker will perform this check, and if it finds any overlaps it
  1069. will produce suitable error messages. The linker does know about,
  1070. and does make allowances for sections in overlays. The default
  1071. behaviour can be restored by using the command-line switch
  1072. '--check-sections'. Section overlap is not usually checked for
  1073. relocatable links. You can force checking in that case by using
  1074. the '--check-sections' option.
  1075. '--copy-dt-needed-entries'
  1076. '--no-copy-dt-needed-entries'
  1077. This option affects the treatment of dynamic libraries referred to
  1078. by DT_NEEDED tags _inside_ ELF dynamic libraries mentioned on the
  1079. command line. Normally the linker won't add a DT_NEEDED tag to the
  1080. output binary for each library mentioned in a DT_NEEDED tag in an
  1081. input dynamic library. With '--copy-dt-needed-entries' specified
  1082. on the command line however any dynamic libraries that follow it
  1083. will have their DT_NEEDED entries added. The default behaviour can
  1084. be restored with '--no-copy-dt-needed-entries'.
  1085. This option also has an effect on the resolution of symbols in
  1086. dynamic libraries. With '--copy-dt-needed-entries' dynamic
  1087. libraries mentioned on the command line will be recursively
  1088. searched, following their DT_NEEDED tags to other libraries, in
  1089. order to resolve symbols required by the output binary. With the
  1090. default setting however the searching of dynamic libraries that
  1091. follow it will stop with the dynamic library itself. No DT_NEEDED
  1092. links will be traversed to resolve symbols.
  1093. '--cref'
  1094. Output a cross reference table. If a linker map file is being
  1095. generated, the cross reference table is printed to the map file.
  1096. Otherwise, it is printed on the standard output.
  1097. The format of the table is intentionally simple, so that it may be
  1098. easily processed by a script if necessary. The symbols are printed
  1099. out, sorted by name. For each symbol, a list of file names is
  1100. given. If the symbol is defined, the first file listed is the
  1101. location of the definition. If the symbol is defined as a common
  1102. value then any files where this happens appear next. Finally any
  1103. files that reference the symbol are listed.
  1104. '--ctf-variables'
  1105. '--no-ctf-variables'
  1106. The CTF debuginfo format supports a section which encodes the names
  1107. and types of variables found in the program which do not appear in
  1108. any symbol table. These variables clearly cannot be looked up by
  1109. address by conventional debuggers, so the space used for their
  1110. types and names is usually wasted: the types are usually small but
  1111. the names are often not. '--ctf-variables' causes the generation
  1112. of such a section. The default behaviour can be restored with
  1113. '--no-ctf-variables'.
  1114. '--ctf-share-types=METHOD'
  1115. Adjust the method used to share types between translation units in
  1116. CTF.
  1117. 'share-unconflicted'
  1118. Put all types that do not have ambiguous definitions into the
  1119. shared dictionary, where debuggers can easily access them,
  1120. even if they only occur in one translation unit. This is the
  1121. default.
  1122. 'share-duplicated'
  1123. Put only types that occur in multiple translation units into
  1124. the shared dictionary: types with only one definition go into
  1125. per-translation-unit dictionaries. Types with ambiguous
  1126. definitions in multiple translation units always go into
  1127. per-translation-unit dictionaries. This tends to make the CTF
  1128. larger, but may reduce the amount of CTF in the shared
  1129. dictionary. For very large projects this may speed up opening
  1130. the CTF and save memory in the CTF consumer at runtime.
  1131. '--no-define-common'
  1132. This option inhibits the assignment of addresses to common symbols.
  1133. The script command 'INHIBIT_COMMON_ALLOCATION' has the same effect.
  1134. *Note Miscellaneous Commands::.
  1135. The '--no-define-common' option allows decoupling the decision to
  1136. assign addresses to Common symbols from the choice of the output
  1137. file type; otherwise a non-Relocatable output type forces assigning
  1138. addresses to Common symbols. Using '--no-define-common' allows
  1139. Common symbols that are referenced from a shared library to be
  1140. assigned addresses only in the main program. This eliminates the
  1141. unused duplicate space in the shared library, and also prevents any
  1142. possible confusion over resolving to the wrong duplicate when there
  1143. are many dynamic modules with specialized search paths for runtime
  1144. symbol resolution.
  1145. '--force-group-allocation'
  1146. This option causes the linker to place section group members like
  1147. normal input sections, and to delete the section groups. This is
  1148. the default behaviour for a final link but this option can be used
  1149. to change the behaviour of a relocatable link ('-r'). The script
  1150. command 'FORCE_GROUP_ALLOCATION' has the same effect. *Note
  1151. Miscellaneous Commands::.
  1152. '--defsym=SYMBOL=EXPRESSION'
  1153. Create a global symbol in the output file, containing the absolute
  1154. address given by EXPRESSION. You may use this option as many times
  1155. as necessary to define multiple symbols in the command line. A
  1156. limited form of arithmetic is supported for the EXPRESSION in this
  1157. context: you may give a hexadecimal constant or the name of an
  1158. existing symbol, or use '+' and '-' to add or subtract hexadecimal
  1159. constants or symbols. If you need more elaborate expressions,
  1160. consider using the linker command language from a script (*note
  1161. Assignments::). _Note:_ there should be no white space between
  1162. SYMBOL, the equals sign ("<=>"), and EXPRESSION.
  1163. The linker processes '--defsym' arguments and '-T' arguments in
  1164. order, placing '--defsym' before '-T' will define the symbol before
  1165. the linker script from '-T' is processed, while placing '--defsym'
  1166. after '-T' will define the symbol after the linker script has been
  1167. processed. This difference has consequences for expressions within
  1168. the linker script that use the '--defsym' symbols, which order is
  1169. correct will depend on what you are trying to achieve.
  1170. '--demangle[=STYLE]'
  1171. '--no-demangle'
  1172. These options control whether to demangle symbol names in error
  1173. messages and other output. When the linker is told to demangle, it
  1174. tries to present symbol names in a readable fashion: it strips
  1175. leading underscores if they are used by the object file format, and
  1176. converts C++ mangled symbol names into user readable names.
  1177. Different compilers have different mangling styles. The optional
  1178. demangling style argument can be used to choose an appropriate
  1179. demangling style for your compiler. The linker will demangle by
  1180. default unless the environment variable 'COLLECT_NO_DEMANGLE' is
  1181. set. These options may be used to override the default.
  1182. '-IFILE'
  1183. '--dynamic-linker=FILE'
  1184. Set the name of the dynamic linker. This is only meaningful when
  1185. generating dynamically linked ELF executables. The default dynamic
  1186. linker is normally correct; don't use this unless you know what you
  1187. are doing.
  1188. '--no-dynamic-linker'
  1189. When producing an executable file, omit the request for a dynamic
  1190. linker to be used at load-time. This is only meaningful for ELF
  1191. executables that contain dynamic relocations, and usually requires
  1192. entry point code that is capable of processing these relocations.
  1193. '--embedded-relocs'
  1194. This option is similar to the '--emit-relocs' option except that
  1195. the relocs are stored in a target-specific section. This option is
  1196. only supported by the 'BFIN', 'CR16' and _M68K_ targets.
  1197. '--disable-multiple-abs-defs'
  1198. Do not allow multiple definitions with symbols included in filename
  1199. invoked by -R or -just-symbols
  1200. '--fatal-warnings'
  1201. '--no-fatal-warnings'
  1202. Treat all warnings as errors. The default behaviour can be
  1203. restored with the option '--no-fatal-warnings'.
  1204. '--force-exe-suffix'
  1205. Make sure that an output file has a .exe suffix.
  1206. If a successfully built fully linked output file does not have a
  1207. '.exe' or '.dll' suffix, this option forces the linker to copy the
  1208. output file to one of the same name with a '.exe' suffix. This
  1209. option is useful when using unmodified Unix makefiles on a
  1210. Microsoft Windows host, since some versions of Windows won't run an
  1211. image unless it ends in a '.exe' suffix.
  1212. '--gc-sections'
  1213. '--no-gc-sections'
  1214. Enable garbage collection of unused input sections. It is ignored
  1215. on targets that do not support this option. The default behaviour
  1216. (of not performing this garbage collection) can be restored by
  1217. specifying '--no-gc-sections' on the command line. Note that
  1218. garbage collection for COFF and PE format targets is supported, but
  1219. the implementation is currently considered to be experimental.
  1220. '--gc-sections' decides which input sections are used by examining
  1221. symbols and relocations. The section containing the entry symbol
  1222. and all sections containing symbols undefined on the command-line
  1223. will be kept, as will sections containing symbols referenced by
  1224. dynamic objects. Note that when building shared libraries, the
  1225. linker must assume that any visible symbol is referenced. Once
  1226. this initial set of sections has been determined, the linker
  1227. recursively marks as used any section referenced by their
  1228. relocations. See '--entry', '--undefined', and
  1229. '--gc-keep-exported'.
  1230. This option can be set when doing a partial link (enabled with
  1231. option '-r'). In this case the root of symbols kept must be
  1232. explicitly specified either by one of the options '--entry',
  1233. '--undefined', or '--gc-keep-exported' or by a 'ENTRY' command in
  1234. the linker script.
  1235. As a GNU extension, ELF input sections marked with the
  1236. 'SHF_GNU_RETAIN' flag will not be garbage collected.
  1237. '--print-gc-sections'
  1238. '--no-print-gc-sections'
  1239. List all sections removed by garbage collection. The listing is
  1240. printed on stderr. This option is only effective if garbage
  1241. collection has been enabled via the '--gc-sections') option. The
  1242. default behaviour (of not listing the sections that are removed)
  1243. can be restored by specifying '--no-print-gc-sections' on the
  1244. command line.
  1245. '--gc-keep-exported'
  1246. When '--gc-sections' is enabled, this option prevents garbage
  1247. collection of unused input sections that contain global symbols
  1248. having default or protected visibility. This option is intended to
  1249. be used for executables where unreferenced sections would otherwise
  1250. be garbage collected regardless of the external visibility of
  1251. contained symbols. Note that this option has no effect when
  1252. linking shared objects since it is already the default behaviour.
  1253. This option is only supported for ELF format targets.
  1254. '--print-output-format'
  1255. Print the name of the default output format (perhaps influenced by
  1256. other command-line options). This is the string that would appear
  1257. in an 'OUTPUT_FORMAT' linker script command (*note File
  1258. Commands::).
  1259. '--print-memory-usage'
  1260. Print used size, total size and used size of memory regions created
  1261. with the *note MEMORY:: command. This is useful on embedded
  1262. targets to have a quick view of amount of free memory. The format
  1263. of the output has one headline and one line per region. It is both
  1264. human readable and easily parsable by tools. Here is an example of
  1265. an output:
  1266. Memory region Used Size Region Size %age Used
  1267. ROM: 256 KB 1 MB 25.00%
  1268. RAM: 32 B 2 GB 0.00%
  1269. '--help'
  1270. Print a summary of the command-line options on the standard output
  1271. and exit.
  1272. '--target-help'
  1273. Print a summary of all target-specific options on the standard
  1274. output and exit.
  1275. '-Map=MAPFILE'
  1276. Print a link map to the file MAPFILE. See the description of the
  1277. '-M' option, above. If MAPFILE is just the character '-' then the
  1278. map will be written to stdout.
  1279. Specifying a directory as MAPFILE causes the linker map to be
  1280. written as a file inside the directory. Normally name of the file
  1281. inside the directory is computed as the basename of the OUTPUT file
  1282. with '.map' appended. If however the special character '%' is used
  1283. then this will be replaced by the full path of the output file.
  1284. Additionally if there are any characters after the % symbol then
  1285. '.map' will no longer be appended.
  1286. -o foo.exe -Map=bar [Creates ./bar]
  1287. -o ../dir/foo.exe -Map=bar [Creates ./bar]
  1288. -o foo.exe -Map=../dir [Creates ../dir/foo.exe.map]
  1289. -o ../dir2/foo.exe -Map=../dir [Creates ../dir/foo.exe.map]
  1290. -o foo.exe -Map=% [Creates ./foo.exe.map]
  1291. -o ../dir/foo.exe -Map=% [Creates ../dir/foo.exe.map]
  1292. -o foo.exe -Map=%.bar [Creates ./foo.exe.bar]
  1293. -o ../dir/foo.exe -Map=%.bar [Creates ../dir/foo.exe.bar]
  1294. -o ../dir2/foo.exe -Map=../dir/% [Creates ../dir/../dir2/foo.exe.map]
  1295. -o ../dir2/foo.exe -Map=../dir/%.bar [Creates ../dir/../dir2/foo.exe.bar]
  1296. It is an error to specify more than one '%' character.
  1297. If the map file already exists then it will be overwritten by this
  1298. operation.
  1299. '--no-keep-memory'
  1300. 'ld' normally optimizes for speed over memory usage by caching the
  1301. symbol tables of input files in memory. This option tells 'ld' to
  1302. instead optimize for memory usage, by rereading the symbol tables
  1303. as necessary. This may be required if 'ld' runs out of memory
  1304. space while linking a large executable.
  1305. '--no-undefined'
  1306. '-z defs'
  1307. Report unresolved symbol references from regular object files.
  1308. This is done even if the linker is creating a non-symbolic shared
  1309. library. The switch '--[no-]allow-shlib-undefined' controls the
  1310. behaviour for reporting unresolved references found in shared
  1311. libraries being linked in.
  1312. The effects of this option can be reverted by using '-z undefs'.
  1313. '--allow-multiple-definition'
  1314. '-z muldefs'
  1315. Normally when a symbol is defined multiple times, the linker will
  1316. report a fatal error. These options allow multiple definitions and
  1317. the first definition will be used.
  1318. '--allow-shlib-undefined'
  1319. '--no-allow-shlib-undefined'
  1320. Allows or disallows undefined symbols in shared libraries. This
  1321. switch is similar to '--no-undefined' except that it determines the
  1322. behaviour when the undefined symbols are in a shared library rather
  1323. than a regular object file. It does not affect how undefined
  1324. symbols in regular object files are handled.
  1325. The default behaviour is to report errors for any undefined symbols
  1326. referenced in shared libraries if the linker is being used to
  1327. create an executable, but to allow them if the linker is being used
  1328. to create a shared library.
  1329. The reasons for allowing undefined symbol references in shared
  1330. libraries specified at link time are that:
  1331. * A shared library specified at link time may not be the same as
  1332. the one that is available at load time, so the symbol might
  1333. actually be resolvable at load time.
  1334. * There are some operating systems, eg BeOS and HPPA, where
  1335. undefined symbols in shared libraries are normal.
  1336. The BeOS kernel for example patches shared libraries at load
  1337. time to select whichever function is most appropriate for the
  1338. current architecture. This is used, for example, to
  1339. dynamically select an appropriate memset function.
  1340. '--error-handling-script=SCRIPTNAME'
  1341. If this option is provided then the linker will invoke SCRIPTNAME
  1342. whenever an error is encountered. Currently however only two kinds
  1343. of error are supported: missing symbols and missing libraries. Two
  1344. arguments will be passed to script: the keyword "undefined-symbol"
  1345. or 'missing-lib" and the NAME of the undefined symbol or missing
  1346. library. The intention is that the script will provide suggestions
  1347. to the user as to where the symbol or library might be found.
  1348. After the script has finished then the normal linker error message
  1349. will be displayed.
  1350. The availability of this option is controlled by a configure time
  1351. switch, so it may not be present in specific implementations.
  1352. '--no-undefined-version'
  1353. Normally when a symbol has an undefined version, the linker will
  1354. ignore it. This option disallows symbols with undefined version
  1355. and a fatal error will be issued instead.
  1356. '--default-symver'
  1357. Create and use a default symbol version (the soname) for
  1358. unversioned exported symbols.
  1359. '--default-imported-symver'
  1360. Create and use a default symbol version (the soname) for
  1361. unversioned imported symbols.
  1362. '--no-warn-mismatch'
  1363. Normally 'ld' will give an error if you try to link together input
  1364. files that are mismatched for some reason, perhaps because they
  1365. have been compiled for different processors or for different
  1366. endiannesses. This option tells 'ld' that it should silently
  1367. permit such possible errors. This option should only be used with
  1368. care, in cases when you have taken some special action that ensures
  1369. that the linker errors are inappropriate.
  1370. '--no-warn-search-mismatch'
  1371. Normally 'ld' will give a warning if it finds an incompatible
  1372. library during a library search. This option silences the warning.
  1373. '--no-whole-archive'
  1374. Turn off the effect of the '--whole-archive' option for subsequent
  1375. archive files.
  1376. '--noinhibit-exec'
  1377. Retain the executable output file whenever it is still usable.
  1378. Normally, the linker will not produce an output file if it
  1379. encounters errors during the link process; it exits without writing
  1380. an output file when it issues any error whatsoever.
  1381. '-nostdlib'
  1382. Only search library directories explicitly specified on the command
  1383. line. Library directories specified in linker scripts (including
  1384. linker scripts specified on the command line) are ignored.
  1385. '--oformat=OUTPUT-FORMAT'
  1386. 'ld' may be configured to support more than one kind of object
  1387. file. If your 'ld' is configured this way, you can use the
  1388. '--oformat' option to specify the binary format for the output
  1389. object file. Even when 'ld' is configured to support alternative
  1390. object formats, you don't usually need to specify this, as 'ld'
  1391. should be configured to produce as a default output format the most
  1392. usual format on each machine. OUTPUT-FORMAT is a text string, the
  1393. name of a particular format supported by the BFD libraries. (You
  1394. can list the available binary formats with 'objdump -i'.) The
  1395. script command 'OUTPUT_FORMAT' can also specify the output format,
  1396. but this option overrides it. *Note BFD::.
  1397. '--out-implib FILE'
  1398. Create an import library in FILE corresponding to the executable
  1399. the linker is generating (eg. a DLL or ELF program). This import
  1400. library (which should be called '*.dll.a' or '*.a' for DLLs) may be
  1401. used to link clients against the generated executable; this
  1402. behaviour makes it possible to skip a separate import library
  1403. creation step (eg. 'dlltool' for DLLs). This option is only
  1404. available for the i386 PE and ELF targetted ports of the linker.
  1405. '-pie'
  1406. '--pic-executable'
  1407. Create a position independent executable. This is currently only
  1408. supported on ELF platforms. Position independent executables are
  1409. similar to shared libraries in that they are relocated by the
  1410. dynamic linker to the virtual address the OS chooses for them
  1411. (which can vary between invocations). Like normal dynamically
  1412. linked executables they can be executed and symbols defined in the
  1413. executable cannot be overridden by shared libraries.
  1414. '-qmagic'
  1415. This option is ignored for Linux compatibility.
  1416. '-Qy'
  1417. This option is ignored for SVR4 compatibility.
  1418. '--relax'
  1419. '--no-relax'
  1420. An option with machine dependent effects. This option is only
  1421. supported on a few targets. *Note 'ld' and the H8/300: H8/300.
  1422. *Note 'ld' and Xtensa Processors: Xtensa. *Note 'ld' and the
  1423. 68HC11 and 68HC12: M68HC11/68HC12. *Note 'ld' and the Altera Nios
  1424. II: Nios II. *Note 'ld' and PowerPC 32-bit ELF Support: PowerPC
  1425. ELF32.
  1426. On some platforms the '--relax' option performs target specific,
  1427. global optimizations that become possible when the linker resolves
  1428. addressing in the program, such as relaxing address modes,
  1429. synthesizing new instructions, selecting shorter version of current
  1430. instructions, and combining constant values.
  1431. On some platforms these link time global optimizations may make
  1432. symbolic debugging of the resulting executable impossible. This is
  1433. known to be the case for the Matsushita MN10200 and MN10300 family
  1434. of processors.
  1435. On platforms where the feature is supported, the option
  1436. '--no-relax' will disable it.
  1437. On platforms where the feature is not supported, both '--relax' and
  1438. '--no-relax' are accepted, but ignored.
  1439. '--retain-symbols-file=FILENAME'
  1440. Retain _only_ the symbols listed in the file FILENAME, discarding
  1441. all others. FILENAME is simply a flat file, with one symbol name
  1442. per line. This option is especially useful in environments (such
  1443. as VxWorks) where a large global symbol table is accumulated
  1444. gradually, to conserve run-time memory.
  1445. '--retain-symbols-file' does _not_ discard undefined symbols, or
  1446. symbols needed for relocations.
  1447. You may only specify '--retain-symbols-file' once in the command
  1448. line. It overrides '-s' and '-S'.
  1449. '-rpath=DIR'
  1450. Add a directory to the runtime library search path. This is used
  1451. when linking an ELF executable with shared objects. All '-rpath'
  1452. arguments are concatenated and passed to the runtime linker, which
  1453. uses them to locate shared objects at runtime.
  1454. The '-rpath' option is also used when locating shared objects which
  1455. are needed by shared objects explicitly included in the link; see
  1456. the description of the '-rpath-link' option. Searching '-rpath' in
  1457. this way is only supported by native linkers and cross linkers
  1458. which have been configured with the '--with-sysroot' option.
  1459. If '-rpath' is not used when linking an ELF executable, the
  1460. contents of the environment variable 'LD_RUN_PATH' will be used if
  1461. it is defined.
  1462. The '-rpath' option may also be used on SunOS. By default, on
  1463. SunOS, the linker will form a runtime search path out of all the
  1464. '-L' options it is given. If a '-rpath' option is used, the
  1465. runtime search path will be formed exclusively using the '-rpath'
  1466. options, ignoring the '-L' options. This can be useful when using
  1467. gcc, which adds many '-L' options which may be on NFS mounted file
  1468. systems.
  1469. For compatibility with other ELF linkers, if the '-R' option is
  1470. followed by a directory name, rather than a file name, it is
  1471. treated as the '-rpath' option.
  1472. '-rpath-link=DIR'
  1473. When using ELF or SunOS, one shared library may require another.
  1474. This happens when an 'ld -shared' link includes a shared library as
  1475. one of the input files.
  1476. When the linker encounters such a dependency when doing a
  1477. non-shared, non-relocatable link, it will automatically try to
  1478. locate the required shared library and include it in the link, if
  1479. it is not included explicitly. In such a case, the '-rpath-link'
  1480. option specifies the first set of directories to search. The
  1481. '-rpath-link' option may specify a sequence of directory names
  1482. either by specifying a list of names separated by colons, or by
  1483. appearing multiple times.
  1484. The tokens $ORIGIN and $LIB can appear in these search directories.
  1485. They will be replaced by the full path to the directory containing
  1486. the program or shared object in the case of $ORIGIN and either
  1487. 'lib' - for 32-bit binaries - or 'lib64' - for 64-bit binaries - in
  1488. the case of $LIB.
  1489. The alternative form of these tokens - ${ORIGIN} and ${LIB} can
  1490. also be used. The token $PLATFORM is not supported.
  1491. This option should be used with caution as it overrides the search
  1492. path that may have been hard compiled into a shared library. In
  1493. such a case it is possible to use unintentionally a different
  1494. search path than the runtime linker would do.
  1495. The linker uses the following search paths to locate required
  1496. shared libraries:
  1497. 1. Any directories specified by '-rpath-link' options.
  1498. 2. Any directories specified by '-rpath' options. The difference
  1499. between '-rpath' and '-rpath-link' is that directories
  1500. specified by '-rpath' options are included in the executable
  1501. and used at runtime, whereas the '-rpath-link' option is only
  1502. effective at link time. Searching '-rpath' in this way is
  1503. only supported by native linkers and cross linkers which have
  1504. been configured with the '--with-sysroot' option.
  1505. 3. On an ELF system, for native linkers, if the '-rpath' and
  1506. '-rpath-link' options were not used, search the contents of
  1507. the environment variable 'LD_RUN_PATH'.
  1508. 4. On SunOS, if the '-rpath' option was not used, search any
  1509. directories specified using '-L' options.
  1510. 5. For a native linker, search the contents of the environment
  1511. variable 'LD_LIBRARY_PATH'.
  1512. 6. For a native ELF linker, the directories in 'DT_RUNPATH' or
  1513. 'DT_RPATH' of a shared library are searched for shared
  1514. libraries needed by it. The 'DT_RPATH' entries are ignored if
  1515. 'DT_RUNPATH' entries exist.
  1516. 7. The default directories, normally '/lib' and '/usr/lib'.
  1517. 8. For a linker for a Linux system, if the file '/etc/ld.so.conf'
  1518. exists, the list of directories found in that file. Note: the
  1519. path to this file is prefixed with the 'sysroot' value, if
  1520. that is defined, and then any 'prefix' string if the linker
  1521. was configured with the '--prefix=<path>' option.
  1522. 9. For a native linker on a FreeBSD system, any directories
  1523. specified by the '_PATH_ELF_HINTS' macro defined in the
  1524. 'elf-hints.h' header file.
  1525. 10. Any directories specifed by a 'SEARCH_DIR' command in the
  1526. linker script being used.
  1527. If the required shared library is not found, the linker will issue
  1528. a warning and continue with the link.
  1529. '-shared'
  1530. '-Bshareable'
  1531. Create a shared library. This is currently only supported on ELF,
  1532. XCOFF and SunOS platforms. On SunOS, the linker will automatically
  1533. create a shared library if the '-e' option is not used and there
  1534. are undefined symbols in the link.
  1535. '--sort-common'
  1536. '--sort-common=ascending'
  1537. '--sort-common=descending'
  1538. This option tells 'ld' to sort the common symbols by alignment in
  1539. ascending or descending order when it places them in the
  1540. appropriate output sections. The symbol alignments considered are
  1541. sixteen-byte or larger, eight-byte, four-byte, two-byte, and
  1542. one-byte. This is to prevent gaps between symbols due to alignment
  1543. constraints. If no sorting order is specified, then descending
  1544. order is assumed.
  1545. '--sort-section=name'
  1546. This option will apply 'SORT_BY_NAME' to all wildcard section
  1547. patterns in the linker script.
  1548. '--sort-section=alignment'
  1549. This option will apply 'SORT_BY_ALIGNMENT' to all wildcard section
  1550. patterns in the linker script.
  1551. '--spare-dynamic-tags=COUNT'
  1552. This option specifies the number of empty slots to leave in the
  1553. .dynamic section of ELF shared objects. Empty slots may be needed
  1554. by post processing tools, such as the prelinker. The default is 5.
  1555. '--split-by-file[=SIZE]'
  1556. Similar to '--split-by-reloc' but creates a new output section for
  1557. each input file when SIZE is reached. SIZE defaults to a size of 1
  1558. if not given.
  1559. '--split-by-reloc[=COUNT]'
  1560. Tries to creates extra sections in the output file so that no
  1561. single output section in the file contains more than COUNT
  1562. relocations. This is useful when generating huge relocatable files
  1563. for downloading into certain real time kernels with the COFF object
  1564. file format; since COFF cannot represent more than 65535
  1565. relocations in a single section. Note that this will fail to work
  1566. with object file formats which do not support arbitrary sections.
  1567. The linker will not split up individual input sections for
  1568. redistribution, so if a single input section contains more than
  1569. COUNT relocations one output section will contain that many
  1570. relocations. COUNT defaults to a value of 32768.
  1571. '--stats'
  1572. Compute and display statistics about the operation of the linker,
  1573. such as execution time and memory usage.
  1574. '--sysroot=DIRECTORY'
  1575. Use DIRECTORY as the location of the sysroot, overriding the
  1576. configure-time default. This option is only supported by linkers
  1577. that were configured using '--with-sysroot'.
  1578. '--task-link'
  1579. This is used by COFF/PE based targets to create a task-linked
  1580. object file where all of the global symbols have been converted to
  1581. statics.
  1582. '--traditional-format'
  1583. For some targets, the output of 'ld' is different in some ways from
  1584. the output of some existing linker. This switch requests 'ld' to
  1585. use the traditional format instead.
  1586. For example, on SunOS, 'ld' combines duplicate entries in the
  1587. symbol string table. This can reduce the size of an output file
  1588. with full debugging information by over 30 percent. Unfortunately,
  1589. the SunOS 'dbx' program can not read the resulting program ('gdb'
  1590. has no trouble). The '--traditional-format' switch tells 'ld' to
  1591. not combine duplicate entries.
  1592. '--section-start=SECTIONNAME=ORG'
  1593. Locate a section in the output file at the absolute address given
  1594. by ORG. You may use this option as many times as necessary to
  1595. locate multiple sections in the command line. ORG must be a single
  1596. hexadecimal integer; for compatibility with other linkers, you may
  1597. omit the leading '0x' usually associated with hexadecimal values.
  1598. _Note:_ there should be no white space between SECTIONNAME, the
  1599. equals sign ("<=>"), and ORG.
  1600. '-Tbss=ORG'
  1601. '-Tdata=ORG'
  1602. '-Ttext=ORG'
  1603. Same as '--section-start', with '.bss', '.data' or '.text' as the
  1604. SECTIONNAME.
  1605. '-Ttext-segment=ORG'
  1606. When creating an ELF executable, it will set the address of the
  1607. first byte of the text segment.
  1608. '-Trodata-segment=ORG'
  1609. When creating an ELF executable or shared object for a target where
  1610. the read-only data is in its own segment separate from the
  1611. executable text, it will set the address of the first byte of the
  1612. read-only data segment.
  1613. '-Tldata-segment=ORG'
  1614. When creating an ELF executable or shared object for x86-64 medium
  1615. memory model, it will set the address of the first byte of the
  1616. ldata segment.
  1617. '--unresolved-symbols=METHOD'
  1618. Determine how to handle unresolved symbols. There are four
  1619. possible values for 'method':
  1620. 'ignore-all'
  1621. Do not report any unresolved symbols.
  1622. 'report-all'
  1623. Report all unresolved symbols. This is the default.
  1624. 'ignore-in-object-files'
  1625. Report unresolved symbols that are contained in shared
  1626. libraries, but ignore them if they come from regular object
  1627. files.
  1628. 'ignore-in-shared-libs'
  1629. Report unresolved symbols that come from regular object files,
  1630. but ignore them if they come from shared libraries. This can
  1631. be useful when creating a dynamic binary and it is known that
  1632. all the shared libraries that it should be referencing are
  1633. included on the linker's command line.
  1634. The behaviour for shared libraries on their own can also be
  1635. controlled by the '--[no-]allow-shlib-undefined' option.
  1636. Normally the linker will generate an error message for each
  1637. reported unresolved symbol but the option
  1638. '--warn-unresolved-symbols' can change this to a warning.
  1639. '--dll-verbose'
  1640. '--verbose[=NUMBER]'
  1641. Display the version number for 'ld' and list the linker emulations
  1642. supported. Display which input files can and cannot be opened.
  1643. Display the linker script being used by the linker. If the
  1644. optional NUMBER argument > 1, plugin symbol status will also be
  1645. displayed.
  1646. '--version-script=VERSION-SCRIPTFILE'
  1647. Specify the name of a version script to the linker. This is
  1648. typically used when creating shared libraries to specify additional
  1649. information about the version hierarchy for the library being
  1650. created. This option is only fully supported on ELF platforms
  1651. which support shared libraries; see *note VERSION::. It is
  1652. partially supported on PE platforms, which can use version scripts
  1653. to filter symbol visibility in auto-export mode: any symbols marked
  1654. 'local' in the version script will not be exported. *Note WIN32::.
  1655. '--warn-common'
  1656. Warn when a common symbol is combined with another common symbol or
  1657. with a symbol definition. Unix linkers allow this somewhat sloppy
  1658. practice, but linkers on some other operating systems do not. This
  1659. option allows you to find potential problems from combining global
  1660. symbols. Unfortunately, some C libraries use this practice, so you
  1661. may get some warnings about symbols in the libraries as well as in
  1662. your programs.
  1663. There are three kinds of global symbols, illustrated here by C
  1664. examples:
  1665. 'int i = 1;'
  1666. A definition, which goes in the initialized data section of
  1667. the output file.
  1668. 'extern int i;'
  1669. An undefined reference, which does not allocate space. There
  1670. must be either a definition or a common symbol for the
  1671. variable somewhere.
  1672. 'int i;'
  1673. A common symbol. If there are only (one or more) common
  1674. symbols for a variable, it goes in the uninitialized data area
  1675. of the output file. The linker merges multiple common symbols
  1676. for the same variable into a single symbol. If they are of
  1677. different sizes, it picks the largest size. The linker turns
  1678. a common symbol into a declaration, if there is a definition
  1679. of the same variable.
  1680. The '--warn-common' option can produce five kinds of warnings.
  1681. Each warning consists of a pair of lines: the first describes the
  1682. symbol just encountered, and the second describes the previous
  1683. symbol encountered with the same name. One or both of the two
  1684. symbols will be a common symbol.
  1685. 1. Turning a common symbol into a reference, because there is
  1686. already a definition for the symbol.
  1687. FILE(SECTION): warning: common of `SYMBOL'
  1688. overridden by definition
  1689. FILE(SECTION): warning: defined here
  1690. 2. Turning a common symbol into a reference, because a later
  1691. definition for the symbol is encountered. This is the same as
  1692. the previous case, except that the symbols are encountered in
  1693. a different order.
  1694. FILE(SECTION): warning: definition of `SYMBOL'
  1695. overriding common
  1696. FILE(SECTION): warning: common is here
  1697. 3. Merging a common symbol with a previous same-sized common
  1698. symbol.
  1699. FILE(SECTION): warning: multiple common
  1700. of `SYMBOL'
  1701. FILE(SECTION): warning: previous common is here
  1702. 4. Merging a common symbol with a previous larger common symbol.
  1703. FILE(SECTION): warning: common of `SYMBOL'
  1704. overridden by larger common
  1705. FILE(SECTION): warning: larger common is here
  1706. 5. Merging a common symbol with a previous smaller common symbol.
  1707. This is the same as the previous case, except that the symbols
  1708. are encountered in a different order.
  1709. FILE(SECTION): warning: common of `SYMBOL'
  1710. overriding smaller common
  1711. FILE(SECTION): warning: smaller common is here
  1712. '--warn-constructors'
  1713. Warn if any global constructors are used. This is only useful for
  1714. a few object file formats. For formats like COFF or ELF, the
  1715. linker can not detect the use of global constructors.
  1716. '--warn-multiple-gp'
  1717. Warn if multiple global pointer values are required in the output
  1718. file. This is only meaningful for certain processors, such as the
  1719. Alpha. Specifically, some processors put large-valued constants in
  1720. a special section. A special register (the global pointer) points
  1721. into the middle of this section, so that constants can be loaded
  1722. efficiently via a base-register relative addressing mode. Since
  1723. the offset in base-register relative mode is fixed and relatively
  1724. small (e.g., 16 bits), this limits the maximum size of the constant
  1725. pool. Thus, in large programs, it is often necessary to use
  1726. multiple global pointer values in order to be able to address all
  1727. possible constants. This option causes a warning to be issued
  1728. whenever this case occurs.
  1729. '--warn-once'
  1730. Only warn once for each undefined symbol, rather than once per
  1731. module which refers to it.
  1732. '--warn-section-align'
  1733. Warn if the address of an output section is changed because of
  1734. alignment. Typically, the alignment will be set by an input
  1735. section. The address will only be changed if it not explicitly
  1736. specified; that is, if the 'SECTIONS' command does not specify a
  1737. start address for the section (*note SECTIONS::).
  1738. '--warn-textrel'
  1739. Warn if the linker adds DT_TEXTREL to a position-independent
  1740. executable or shared object.
  1741. '--warn-alternate-em'
  1742. Warn if an object has alternate ELF machine code.
  1743. '--warn-unresolved-symbols'
  1744. If the linker is going to report an unresolved symbol (see the
  1745. option '--unresolved-symbols') it will normally generate an error.
  1746. This option makes it generate a warning instead.
  1747. '--error-unresolved-symbols'
  1748. This restores the linker's default behaviour of generating errors
  1749. when it is reporting unresolved symbols.
  1750. '--whole-archive'
  1751. For each archive mentioned on the command line after the
  1752. '--whole-archive' option, include every object file in the archive
  1753. in the link, rather than searching the archive for the required
  1754. object files. This is normally used to turn an archive file into a
  1755. shared library, forcing every object to be included in the
  1756. resulting shared library. This option may be used more than once.
  1757. Two notes when using this option from gcc: First, gcc doesn't know
  1758. about this option, so you have to use '-Wl,-whole-archive'.
  1759. Second, don't forget to use '-Wl,-no-whole-archive' after your list
  1760. of archives, because gcc will add its own list of archives to your
  1761. link and you may not want this flag to affect those as well.
  1762. '--wrap=SYMBOL'
  1763. Use a wrapper function for SYMBOL. Any undefined reference to
  1764. SYMBOL will be resolved to '__wrap_SYMBOL'. Any undefined
  1765. reference to '__real_SYMBOL' will be resolved to SYMBOL.
  1766. This can be used to provide a wrapper for a system function. The
  1767. wrapper function should be called '__wrap_SYMBOL'. If it wishes to
  1768. call the system function, it should call '__real_SYMBOL'.
  1769. Here is a trivial example:
  1770. void *
  1771. __wrap_malloc (size_t c)
  1772. {
  1773. printf ("malloc called with %zu\n", c);
  1774. return __real_malloc (c);
  1775. }
  1776. If you link other code with this file using '--wrap malloc', then
  1777. all calls to 'malloc' will call the function '__wrap_malloc'
  1778. instead. The call to '__real_malloc' in '__wrap_malloc' will call
  1779. the real 'malloc' function.
  1780. You may wish to provide a '__real_malloc' function as well, so that
  1781. links without the '--wrap' option will succeed. If you do this,
  1782. you should not put the definition of '__real_malloc' in the same
  1783. file as '__wrap_malloc'; if you do, the assembler may resolve the
  1784. call before the linker has a chance to wrap it to 'malloc'.
  1785. Only undefined references are replaced by the linker. So,
  1786. translation unit internal references to SYMBOL are not resolved to
  1787. '__wrap_SYMBOL'. In the next example, the call to 'f' in 'g' is
  1788. not resolved to '__wrap_f'.
  1789. int
  1790. f (void)
  1791. {
  1792. return 123;
  1793. }
  1794. int
  1795. g (void)
  1796. {
  1797. return f();
  1798. }
  1799. '--eh-frame-hdr'
  1800. '--no-eh-frame-hdr'
  1801. Request ('--eh-frame-hdr') or suppress ('--no-eh-frame-hdr') the
  1802. creation of '.eh_frame_hdr' section and ELF 'PT_GNU_EH_FRAME'
  1803. segment header.
  1804. '--no-ld-generated-unwind-info'
  1805. Request creation of '.eh_frame' unwind info for linker generated
  1806. code sections like PLT. This option is on by default if linker
  1807. generated unwind info is supported.
  1808. '--enable-new-dtags'
  1809. '--disable-new-dtags'
  1810. This linker can create the new dynamic tags in ELF. But the older
  1811. ELF systems may not understand them. If you specify
  1812. '--enable-new-dtags', the new dynamic tags will be created as
  1813. needed and older dynamic tags will be omitted. If you specify
  1814. '--disable-new-dtags', no new dynamic tags will be created. By
  1815. default, the new dynamic tags are not created. Note that those
  1816. options are only available for ELF systems.
  1817. '--hash-size=NUMBER'
  1818. Set the default size of the linker's hash tables to a prime number
  1819. close to NUMBER. Increasing this value can reduce the length of
  1820. time it takes the linker to perform its tasks, at the expense of
  1821. increasing the linker's memory requirements. Similarly reducing
  1822. this value can reduce the memory requirements at the expense of
  1823. speed.
  1824. '--hash-style=STYLE'
  1825. Set the type of linker's hash table(s). STYLE can be either 'sysv'
  1826. for classic ELF '.hash' section, 'gnu' for new style GNU
  1827. '.gnu.hash' section or 'both' for both the classic ELF '.hash' and
  1828. new style GNU '.gnu.hash' hash tables. The default depends upon
  1829. how the linker was configured, but for most Linux based systems it
  1830. will be 'both'.
  1831. '--compress-debug-sections=none'
  1832. '--compress-debug-sections=zlib'
  1833. '--compress-debug-sections=zlib-gnu'
  1834. '--compress-debug-sections=zlib-gabi'
  1835. On ELF platforms, these options control how DWARF debug sections
  1836. are compressed using zlib.
  1837. '--compress-debug-sections=none' doesn't compress DWARF debug
  1838. sections. '--compress-debug-sections=zlib-gnu' compresses DWARF
  1839. debug sections and renames them to begin with '.zdebug' instead of
  1840. '.debug'. '--compress-debug-sections=zlib-gabi' also compresses
  1841. DWARF debug sections, but rather than renaming them it sets the
  1842. SHF_COMPRESSED flag in the sections' headers.
  1843. The '--compress-debug-sections=zlib' option is an alias for
  1844. '--compress-debug-sections=zlib-gabi'.
  1845. Note that this option overrides any compression in input debug
  1846. sections, so if a binary is linked with
  1847. '--compress-debug-sections=none' for example, then any compressed
  1848. debug sections in input files will be uncompressed before they are
  1849. copied into the output binary.
  1850. The default compression behaviour varies depending upon the target
  1851. involved and the configure options used to build the toolchain.
  1852. The default can be determined by examining the output from the
  1853. linker's '--help' option.
  1854. '--reduce-memory-overheads'
  1855. This option reduces memory requirements at ld runtime, at the
  1856. expense of linking speed. This was introduced to select the old
  1857. O(n^2) algorithm for link map file generation, rather than the new
  1858. O(n) algorithm which uses about 40% more memory for symbol storage.
  1859. Another effect of the switch is to set the default hash table size
  1860. to 1021, which again saves memory at the cost of lengthening the
  1861. linker's run time. This is not done however if the '--hash-size'
  1862. switch has been used.
  1863. The '--reduce-memory-overheads' switch may be also be used to
  1864. enable other tradeoffs in future versions of the linker.
  1865. '--build-id'
  1866. '--build-id=STYLE'
  1867. Request the creation of a '.note.gnu.build-id' ELF note section or
  1868. a '.buildid' COFF section. The contents of the note are unique
  1869. bits identifying this linked file. STYLE can be 'uuid' to use 128
  1870. random bits, 'sha1' to use a 160-bit SHA1 hash on the normative
  1871. parts of the output contents, 'md5' to use a 128-bit MD5 hash on
  1872. the normative parts of the output contents, or '0xHEXSTRING' to use
  1873. a chosen bit string specified as an even number of hexadecimal
  1874. digits ('-' and ':' characters between digit pairs are ignored).
  1875. If STYLE is omitted, 'sha1' is used.
  1876. The 'md5' and 'sha1' styles produces an identifier that is always
  1877. the same in an identical output file, but will be unique among all
  1878. nonidentical output files. It is not intended to be compared as a
  1879. checksum for the file's contents. A linked file may be changed
  1880. later by other tools, but the build ID bit string identifying the
  1881. original linked file does not change.
  1882. Passing 'none' for STYLE disables the setting from any '--build-id'
  1883. options earlier on the command line.
  1884. 2.1.1 Options Specific to i386 PE Targets
  1885. -----------------------------------------
  1886. The i386 PE linker supports the '-shared' option, which causes the
  1887. output to be a dynamically linked library (DLL) instead of a normal
  1888. executable. You should name the output '*.dll' when you use this
  1889. option. In addition, the linker fully supports the standard '*.def'
  1890. files, which may be specified on the linker command line like an object
  1891. file (in fact, it should precede archives it exports symbols from, to
  1892. ensure that they get linked in, just like a normal object file).
  1893. In addition to the options common to all targets, the i386 PE linker
  1894. support additional command-line options that are specific to the i386 PE
  1895. target. Options that take values may be separated from their values by
  1896. either a space or an equals sign.
  1897. '--add-stdcall-alias'
  1898. If given, symbols with a stdcall suffix (@NN) will be exported
  1899. as-is and also with the suffix stripped. [This option is specific
  1900. to the i386 PE targeted port of the linker]
  1901. '--base-file FILE'
  1902. Use FILE as the name of a file in which to save the base addresses
  1903. of all the relocations needed for generating DLLs with 'dlltool'.
  1904. [This is an i386 PE specific option]
  1905. '--dll'
  1906. Create a DLL instead of a regular executable. You may also use
  1907. '-shared' or specify a 'LIBRARY' in a given '.def' file. [This
  1908. option is specific to the i386 PE targeted port of the linker]
  1909. '--enable-long-section-names'
  1910. '--disable-long-section-names'
  1911. The PE variants of the COFF object format add an extension that
  1912. permits the use of section names longer than eight characters, the
  1913. normal limit for COFF. By default, these names are only allowed in
  1914. object files, as fully-linked executable images do not carry the
  1915. COFF string table required to support the longer names. As a GNU
  1916. extension, it is possible to allow their use in executable images
  1917. as well, or to (probably pointlessly!) disallow it in object
  1918. files, by using these two options. Executable images generated
  1919. with these long section names are slightly non-standard, carrying
  1920. as they do a string table, and may generate confusing output when
  1921. examined with non-GNU PE-aware tools, such as file viewers and
  1922. dumpers. However, GDB relies on the use of PE long section names
  1923. to find Dwarf-2 debug information sections in an executable image
  1924. at runtime, and so if neither option is specified on the
  1925. command-line, 'ld' will enable long section names, overriding the
  1926. default and technically correct behaviour, when it finds the
  1927. presence of debug information while linking an executable image and
  1928. not stripping symbols. [This option is valid for all PE targeted
  1929. ports of the linker]
  1930. '--enable-stdcall-fixup'
  1931. '--disable-stdcall-fixup'
  1932. If the link finds a symbol that it cannot resolve, it will attempt
  1933. to do "fuzzy linking" by looking for another defined symbol that
  1934. differs only in the format of the symbol name (cdecl vs stdcall)
  1935. and will resolve that symbol by linking to the match. For example,
  1936. the undefined symbol '_foo' might be linked to the function
  1937. '_foo@12', or the undefined symbol '_bar@16' might be linked to the
  1938. function '_bar'. When the linker does this, it prints a warning,
  1939. since it normally should have failed to link, but sometimes import
  1940. libraries generated from third-party dlls may need this feature to
  1941. be usable. If you specify '--enable-stdcall-fixup', this feature
  1942. is fully enabled and warnings are not printed. If you specify
  1943. '--disable-stdcall-fixup', this feature is disabled and such
  1944. mismatches are considered to be errors. [This option is specific
  1945. to the i386 PE targeted port of the linker]
  1946. '--leading-underscore'
  1947. '--no-leading-underscore'
  1948. For most targets default symbol-prefix is an underscore and is
  1949. defined in target's description. By this option it is possible to
  1950. disable/enable the default underscore symbol-prefix.
  1951. '--export-all-symbols'
  1952. If given, all global symbols in the objects used to build a DLL
  1953. will be exported by the DLL. Note that this is the default if there
  1954. otherwise wouldn't be any exported symbols. When symbols are
  1955. explicitly exported via DEF files or implicitly exported via
  1956. function attributes, the default is to not export anything else
  1957. unless this option is given. Note that the symbols 'DllMain@12',
  1958. 'DllEntryPoint@0', 'DllMainCRTStartup@12', and 'impure_ptr' will
  1959. not be automatically exported. Also, symbols imported from other
  1960. DLLs will not be re-exported, nor will symbols specifying the DLL's
  1961. internal layout such as those beginning with '_head_' or ending
  1962. with '_iname'. In addition, no symbols from 'libgcc', 'libstd++',
  1963. 'libmingw32', or 'crtX.o' will be exported. Symbols whose names
  1964. begin with '__rtti_' or '__builtin_' will not be exported, to help
  1965. with C++ DLLs. Finally, there is an extensive list of
  1966. cygwin-private symbols that are not exported (obviously, this
  1967. applies on when building DLLs for cygwin targets). These
  1968. cygwin-excludes are: '_cygwin_dll_entry@12',
  1969. '_cygwin_crt0_common@8', '_cygwin_noncygwin_dll_entry@12',
  1970. '_fmode', '_impure_ptr', 'cygwin_attach_dll', 'cygwin_premain0',
  1971. 'cygwin_premain1', 'cygwin_premain2', 'cygwin_premain3', and
  1972. 'environ'. [This option is specific to the i386 PE targeted port
  1973. of the linker]
  1974. '--exclude-symbols SYMBOL,SYMBOL,...'
  1975. Specifies a list of symbols which should not be automatically
  1976. exported. The symbol names may be delimited by commas or colons.
  1977. [This option is specific to the i386 PE targeted port of the
  1978. linker]
  1979. '--exclude-all-symbols'
  1980. Specifies no symbols should be automatically exported. [This
  1981. option is specific to the i386 PE targeted port of the linker]
  1982. '--file-alignment'
  1983. Specify the file alignment. Sections in the file will always begin
  1984. at file offsets which are multiples of this number. This defaults
  1985. to 512. [This option is specific to the i386 PE targeted port of
  1986. the linker]
  1987. '--heap RESERVE'
  1988. '--heap RESERVE,COMMIT'
  1989. Specify the number of bytes of memory to reserve (and optionally
  1990. commit) to be used as heap for this program. The default is 1MB
  1991. reserved, 4K committed. [This option is specific to the i386 PE
  1992. targeted port of the linker]
  1993. '--image-base VALUE'
  1994. Use VALUE as the base address of your program or dll. This is the
  1995. lowest memory location that will be used when your program or dll
  1996. is loaded. To reduce the need to relocate and improve performance
  1997. of your dlls, each should have a unique base address and not
  1998. overlap any other dlls. The default is 0x400000 for executables,
  1999. and 0x10000000 for dlls. [This option is specific to the i386 PE
  2000. targeted port of the linker]
  2001. '--kill-at'
  2002. If given, the stdcall suffixes (@NN) will be stripped from symbols
  2003. before they are exported. [This option is specific to the i386 PE
  2004. targeted port of the linker]
  2005. '--large-address-aware'
  2006. If given, the appropriate bit in the "Characteristics" field of the
  2007. COFF header is set to indicate that this executable supports
  2008. virtual addresses greater than 2 gigabytes. This should be used in
  2009. conjunction with the /3GB or /USERVA=VALUE megabytes switch in the
  2010. "[operating systems]" section of the BOOT.INI. Otherwise, this bit
  2011. has no effect. [This option is specific to PE targeted ports of
  2012. the linker]
  2013. '--disable-large-address-aware'
  2014. Reverts the effect of a previous '--large-address-aware' option.
  2015. This is useful if '--large-address-aware' is always set by the
  2016. compiler driver (e.g. Cygwin gcc) and the executable does not
  2017. support virtual addresses greater than 2 gigabytes. [This option
  2018. is specific to PE targeted ports of the linker]
  2019. '--major-image-version VALUE'
  2020. Sets the major number of the "image version". Defaults to 1.
  2021. [This option is specific to the i386 PE targeted port of the
  2022. linker]
  2023. '--major-os-version VALUE'
  2024. Sets the major number of the "os version". Defaults to 4. [This
  2025. option is specific to the i386 PE targeted port of the linker]
  2026. '--major-subsystem-version VALUE'
  2027. Sets the major number of the "subsystem version". Defaults to 4.
  2028. [This option is specific to the i386 PE targeted port of the
  2029. linker]
  2030. '--minor-image-version VALUE'
  2031. Sets the minor number of the "image version". Defaults to 0.
  2032. [This option is specific to the i386 PE targeted port of the
  2033. linker]
  2034. '--minor-os-version VALUE'
  2035. Sets the minor number of the "os version". Defaults to 0. [This
  2036. option is specific to the i386 PE targeted port of the linker]
  2037. '--minor-subsystem-version VALUE'
  2038. Sets the minor number of the "subsystem version". Defaults to 0.
  2039. [This option is specific to the i386 PE targeted port of the
  2040. linker]
  2041. '--output-def FILE'
  2042. The linker will create the file FILE which will contain a DEF file
  2043. corresponding to the DLL the linker is generating. This DEF file
  2044. (which should be called '*.def') may be used to create an import
  2045. library with 'dlltool' or may be used as a reference to
  2046. automatically or implicitly exported symbols. [This option is
  2047. specific to the i386 PE targeted port of the linker]
  2048. '--enable-auto-image-base'
  2049. '--enable-auto-image-base=VALUE'
  2050. Automatically choose the image base for DLLs, optionally starting
  2051. with base VALUE, unless one is specified using the '--image-base'
  2052. argument. By using a hash generated from the dllname to create
  2053. unique image bases for each DLL, in-memory collisions and
  2054. relocations which can delay program execution are avoided. [This
  2055. option is specific to the i386 PE targeted port of the linker]
  2056. '--disable-auto-image-base'
  2057. Do not automatically generate a unique image base. If there is no
  2058. user-specified image base ('--image-base') then use the platform
  2059. default. [This option is specific to the i386 PE targeted port of
  2060. the linker]
  2061. '--dll-search-prefix STRING'
  2062. When linking dynamically to a dll without an import library, search
  2063. for '<string><basename>.dll' in preference to 'lib<basename>.dll'.
  2064. This behaviour allows easy distinction between DLLs built for the
  2065. various "subplatforms": native, cygwin, uwin, pw, etc. For
  2066. instance, cygwin DLLs typically use '--dll-search-prefix=cyg'.
  2067. [This option is specific to the i386 PE targeted port of the
  2068. linker]
  2069. '--enable-auto-import'
  2070. Do sophisticated linking of '_symbol' to '__imp__symbol' for DATA
  2071. imports from DLLs, thus making it possible to bypass the dllimport
  2072. mechanism on the user side and to reference unmangled symbol names.
  2073. [This option is specific to the i386 PE targeted port of the
  2074. linker]
  2075. The following remarks pertain to the original implementation of the
  2076. feature and are obsolete nowadays for Cygwin and MinGW targets.
  2077. Note: Use of the 'auto-import' extension will cause the text
  2078. section of the image file to be made writable. This does not
  2079. conform to the PE-COFF format specification published by Microsoft.
  2080. Note - use of the 'auto-import' extension will also cause read only
  2081. data which would normally be placed into the .rdata section to be
  2082. placed into the .data section instead. This is in order to work
  2083. around a problem with consts that is described here:
  2084. http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
  2085. Using 'auto-import' generally will 'just work' - but sometimes you
  2086. may see this message:
  2087. "variable '<var>' can't be auto-imported. Please read the
  2088. documentation for ld's '--enable-auto-import' for details."
  2089. This message occurs when some (sub)expression accesses an address
  2090. ultimately given by the sum of two constants (Win32 import tables
  2091. only allow one). Instances where this may occur include accesses
  2092. to member fields of struct variables imported from a DLL, as well
  2093. as using a constant index into an array variable imported from a
  2094. DLL. Any multiword variable (arrays, structs, long long, etc) may
  2095. trigger this error condition. However, regardless of the exact
  2096. data type of the offending exported variable, ld will always detect
  2097. it, issue the warning, and exit.
  2098. There are several ways to address this difficulty, regardless of
  2099. the data type of the exported variable:
  2100. One way is to use -enable-runtime-pseudo-reloc switch. This leaves
  2101. the task of adjusting references in your client code for runtime
  2102. environment, so this method works only when runtime environment
  2103. supports this feature.
  2104. A second solution is to force one of the 'constants' to be a
  2105. variable - that is, unknown and un-optimizable at compile time.
  2106. For arrays, there are two possibilities: a) make the indexee (the
  2107. array's address) a variable, or b) make the 'constant' index a
  2108. variable. Thus:
  2109. extern type extern_array[];
  2110. extern_array[1] -->
  2111. { volatile type *t=extern_array; t[1] }
  2112. or
  2113. extern type extern_array[];
  2114. extern_array[1] -->
  2115. { volatile int t=1; extern_array[t] }
  2116. For structs (and most other multiword data types) the only option
  2117. is to make the struct itself (or the long long, or the ...)
  2118. variable:
  2119. extern struct s extern_struct;
  2120. extern_struct.field -->
  2121. { volatile struct s *t=&extern_struct; t->field }
  2122. or
  2123. extern long long extern_ll;
  2124. extern_ll -->
  2125. { volatile long long * local_ll=&extern_ll; *local_ll }
  2126. A third method of dealing with this difficulty is to abandon
  2127. 'auto-import' for the offending symbol and mark it with
  2128. '__declspec(dllimport)'. However, in practice that requires using
  2129. compile-time #defines to indicate whether you are building a DLL,
  2130. building client code that will link to the DLL, or merely
  2131. building/linking to a static library. In making the choice between
  2132. the various methods of resolving the 'direct address with constant
  2133. offset' problem, you should consider typical real-world usage:
  2134. Original:
  2135. --foo.h
  2136. extern int arr[];
  2137. --foo.c
  2138. #include "foo.h"
  2139. void main(int argc, char **argv){
  2140. printf("%d\n",arr[1]);
  2141. }
  2142. Solution 1:
  2143. --foo.h
  2144. extern int arr[];
  2145. --foo.c
  2146. #include "foo.h"
  2147. void main(int argc, char **argv){
  2148. /* This workaround is for win32 and cygwin; do not "optimize" */
  2149. volatile int *parr = arr;
  2150. printf("%d\n",parr[1]);
  2151. }
  2152. Solution 2:
  2153. --foo.h
  2154. /* Note: auto-export is assumed (no __declspec(dllexport)) */
  2155. #if (defined(_WIN32) || defined(__CYGWIN__)) && \
  2156. !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
  2157. #define FOO_IMPORT __declspec(dllimport)
  2158. #else
  2159. #define FOO_IMPORT
  2160. #endif
  2161. extern FOO_IMPORT int arr[];
  2162. --foo.c
  2163. #include "foo.h"
  2164. void main(int argc, char **argv){
  2165. printf("%d\n",arr[1]);
  2166. }
  2167. A fourth way to avoid this problem is to re-code your library to
  2168. use a functional interface rather than a data interface for the
  2169. offending variables (e.g. set_foo() and get_foo() accessor
  2170. functions).
  2171. '--disable-auto-import'
  2172. Do not attempt to do sophisticated linking of '_symbol' to
  2173. '__imp__symbol' for DATA imports from DLLs. [This option is
  2174. specific to the i386 PE targeted port of the linker]
  2175. '--enable-runtime-pseudo-reloc'
  2176. If your code contains expressions described in -enable-auto-import
  2177. section, that is, DATA imports from DLL with non-zero offset, this
  2178. switch will create a vector of 'runtime pseudo relocations' which
  2179. can be used by runtime environment to adjust references to such
  2180. data in your client code. [This option is specific to the i386 PE
  2181. targeted port of the linker]
  2182. '--disable-runtime-pseudo-reloc'
  2183. Do not create pseudo relocations for non-zero offset DATA imports
  2184. from DLLs. [This option is specific to the i386 PE targeted port
  2185. of the linker]
  2186. '--enable-extra-pe-debug'
  2187. Show additional debug info related to auto-import symbol thunking.
  2188. [This option is specific to the i386 PE targeted port of the
  2189. linker]
  2190. '--section-alignment'
  2191. Sets the section alignment. Sections in memory will always begin
  2192. at addresses which are a multiple of this number. Defaults to
  2193. 0x1000. [This option is specific to the i386 PE targeted port of
  2194. the linker]
  2195. '--stack RESERVE'
  2196. '--stack RESERVE,COMMIT'
  2197. Specify the number of bytes of memory to reserve (and optionally
  2198. commit) to be used as stack for this program. The default is 2MB
  2199. reserved, 4K committed. [This option is specific to the i386 PE
  2200. targeted port of the linker]
  2201. '--subsystem WHICH'
  2202. '--subsystem WHICH:MAJOR'
  2203. '--subsystem WHICH:MAJOR.MINOR'
  2204. Specifies the subsystem under which your program will execute. The
  2205. legal values for WHICH are 'native', 'windows', 'console', 'posix',
  2206. and 'xbox'. You may optionally set the subsystem version also.
  2207. Numeric values are also accepted for WHICH. [This option is
  2208. specific to the i386 PE targeted port of the linker]
  2209. The following options set flags in the 'DllCharacteristics' field
  2210. of the PE file header: [These options are specific to PE targeted
  2211. ports of the linker]
  2212. '--high-entropy-va'
  2213. '--disable-high-entropy-va'
  2214. Image is compatible with 64-bit address space layout randomization
  2215. (ASLR). This option is enabled by default for 64-bit PE images.
  2216. This option also implies '--dynamicbase' and
  2217. '--enable-reloc-section'.
  2218. '--dynamicbase'
  2219. '--disable-dynamicbase'
  2220. The image base address may be relocated using address space layout
  2221. randomization (ASLR). This feature was introduced with MS Windows
  2222. Vista for i386 PE targets. This option is enabled by default but
  2223. can be disabled via the '--disable-dynamicbase' option. This
  2224. option also implies '--enable-reloc-section'.
  2225. '--forceinteg'
  2226. '--disable-forceinteg'
  2227. Code integrity checks are enforced. This option is disabled by
  2228. default.
  2229. '--nxcompat'
  2230. '--disable-nxcompat'
  2231. The image is compatible with the Data Execution Prevention. This
  2232. feature was introduced with MS Windows XP SP2 for i386 PE targets.
  2233. The option is enabled by default.
  2234. '--no-isolation'
  2235. '--disable-no-isolation'
  2236. Although the image understands isolation, do not isolate the image.
  2237. This option is disabled by default.
  2238. '--no-seh'
  2239. '--disable-no-seh'
  2240. The image does not use SEH. No SE handler may be called from this
  2241. image. This option is disabled by default.
  2242. '--no-bind'
  2243. '--disable-no-bind'
  2244. Do not bind this image. This option is disabled by default.
  2245. '--wdmdriver'
  2246. '--disable-wdmdriver'
  2247. The driver uses the MS Windows Driver Model. This option is
  2248. disabled by default.
  2249. '--tsaware'
  2250. '--disable-tsaware'
  2251. The image is Terminal Server aware. This option is disabled by
  2252. default.
  2253. '--insert-timestamp'
  2254. '--no-insert-timestamp'
  2255. Insert a real timestamp into the image. This is the default
  2256. behaviour as it matches legacy code and it means that the image
  2257. will work with other, proprietary tools. The problem with this
  2258. default is that it will result in slightly different images being
  2259. produced each time the same sources are linked. The option
  2260. '--no-insert-timestamp' can be used to insert a zero value for the
  2261. timestamp, this ensuring that binaries produced from identical
  2262. sources will compare identically.
  2263. '--enable-reloc-section'
  2264. '--disable-reloc-section'
  2265. Create the base relocation table, which is necessary if the image
  2266. is loaded at a different image base than specified in the PE
  2267. header. This option is enabled by default.
  2268. 2.1.2 Options specific to C6X uClinux targets
  2269. ---------------------------------------------
  2270. The C6X uClinux target uses a binary format called DSBT to support
  2271. shared libraries. Each shared library in the system needs to have a
  2272. unique index; all executables use an index of 0.
  2273. '--dsbt-size SIZE'
  2274. This option sets the number of entries in the DSBT of the current
  2275. executable or shared library to SIZE. The default is to create a
  2276. table with 64 entries.
  2277. '--dsbt-index INDEX'
  2278. This option sets the DSBT index of the current executable or shared
  2279. library to INDEX. The default is 0, which is appropriate for
  2280. generating executables. If a shared library is generated with a
  2281. DSBT index of 0, the 'R_C6000_DSBT_INDEX' relocs are copied into
  2282. the output file.
  2283. The '--no-merge-exidx-entries' switch disables the merging of
  2284. adjacent exidx entries in frame unwind info.
  2285. 2.1.3 Options specific to C-SKY targets
  2286. ---------------------------------------
  2287. '--branch-stub'
  2288. This option enables linker branch relaxation by inserting branch
  2289. stub sections when needed to extend the range of branches. This
  2290. option is usually not required since C-SKY supports branch and call
  2291. instructions that can access the full memory range and branch
  2292. relaxation is normally handled by the compiler or assembler.
  2293. '--stub-group-size=N'
  2294. This option allows finer control of linker branch stub creation.
  2295. It sets the maximum size of a group of input sections that can be
  2296. handled by one stub section. A negative value of N locates stub
  2297. sections after their branches, while a positive value allows stub
  2298. sections to appear either before or after the branches. Values of
  2299. '1' or '-1' indicate that the linker should choose suitable
  2300. defaults.
  2301. 2.1.4 Options specific to Motorola 68HC11 and 68HC12 targets
  2302. ------------------------------------------------------------
  2303. The 68HC11 and 68HC12 linkers support specific options to control the
  2304. memory bank switching mapping and trampoline code generation.
  2305. '--no-trampoline'
  2306. This option disables the generation of trampoline. By default a
  2307. trampoline is generated for each far function which is called using
  2308. a 'jsr' instruction (this happens when a pointer to a far function
  2309. is taken).
  2310. '--bank-window NAME'
  2311. This option indicates to the linker the name of the memory region
  2312. in the 'MEMORY' specification that describes the memory bank
  2313. window. The definition of such region is then used by the linker
  2314. to compute paging and addresses within the memory window.
  2315. 2.1.5 Options specific to Motorola 68K target
  2316. ---------------------------------------------
  2317. The following options are supported to control handling of GOT
  2318. generation when linking for 68K targets.
  2319. '--got=TYPE'
  2320. This option tells the linker which GOT generation scheme to use.
  2321. TYPE should be one of 'single', 'negative', 'multigot' or 'target'.
  2322. For more information refer to the Info entry for 'ld'.
  2323. 2.1.6 Options specific to MIPS targets
  2324. --------------------------------------
  2325. The following options are supported to control microMIPS instruction
  2326. generation and branch relocation checks for ISA mode transitions when
  2327. linking for MIPS targets.
  2328. '--insn32'
  2329. '--no-insn32'
  2330. These options control the choice of microMIPS instructions used in
  2331. code generated by the linker, such as that in the PLT or lazy
  2332. binding stubs, or in relaxation. If '--insn32' is used, then the
  2333. linker only uses 32-bit instruction encodings. By default or if
  2334. '--no-insn32' is used, all instruction encodings are used,
  2335. including 16-bit ones where possible.
  2336. '--ignore-branch-isa'
  2337. '--no-ignore-branch-isa'
  2338. These options control branch relocation checks for invalid ISA mode
  2339. transitions. If '--ignore-branch-isa' is used, then the linker
  2340. accepts any branch relocations and any ISA mode transition required
  2341. is lost in relocation calculation, except for some cases of 'BAL'
  2342. instructions which meet relaxation conditions and are converted to
  2343. equivalent 'JALX' instructions as the associated relocation is
  2344. calculated. By default or if '--no-ignore-branch-isa' is used a
  2345. check is made causing the loss of an ISA mode transition to produce
  2346. an error.
  2347. '--compact-branches'
  2348. '--no-compact-branches'
  2349. These options control the generation of compact instructions by the
  2350. linker in the PLT entries for MIPS R6.
  2351. 2.1.7 Options specific to PDP11 targets
  2352. ---------------------------------------
  2353. For the pdp11-aout target, three variants of the output format can be
  2354. produced as selected by the following options. The default variant for
  2355. pdp11-aout is the '--omagic' option, whereas for other targets
  2356. '--nmagic' is the default. The '--imagic' option is defined only for
  2357. the pdp11-aout target, while the others are described here as they apply
  2358. to the pdp11-aout target.
  2359. '-N'
  2360. '--omagic'
  2361. Mark the output as 'OMAGIC' (0407) in the 'a.out' header to
  2362. indicate that the text segment is not to be write-protected and
  2363. shared. Since the text and data sections are both readable and
  2364. writable, the data section is allocated immediately contiguous
  2365. after the text segment. This is the oldest format for PDP11
  2366. executable programs and is the default for 'ld' on PDP11 Unix
  2367. systems from the beginning through 2.11BSD.
  2368. '-n'
  2369. '--nmagic'
  2370. Mark the output as 'NMAGIC' (0410) in the 'a.out' header to
  2371. indicate that when the output file is executed, the text portion
  2372. will be read-only and shareable among all processes executing the
  2373. same file. This involves moving the data areas up to the first
  2374. possible 8K byte page boundary following the end of the text. This
  2375. option creates a _pure executable_ format.
  2376. '-z'
  2377. '--imagic'
  2378. Mark the output as 'IMAGIC' (0411) in the 'a.out' header to
  2379. indicate that when the output file is executed, the program text
  2380. and data areas will be loaded into separate address spaces using
  2381. the split instruction and data space feature of the memory
  2382. management unit in larger models of the PDP11. This doubles the
  2383. address space available to the program. The text segment is again
  2384. pure, write-protected, and shareable. The only difference in the
  2385. output format between this option and the others, besides the magic
  2386. number, is that both the text and data sections start at location
  2387. 0. The '-z' option selected this format in 2.11BSD. This option
  2388. creates a _separate executable_ format.
  2389. '--no-omagic'
  2390. Equivalent to '--nmagic' for pdp11-aout.
  2391. 
  2392. File: ld.info, Node: Environment, Prev: Options, Up: Invocation
  2393. 2.2 Environment Variables
  2394. =========================
  2395. You can change the behaviour of 'ld' with the environment variables
  2396. 'GNUTARGET', 'LDEMULATION' and 'COLLECT_NO_DEMANGLE'.
  2397. 'GNUTARGET' determines the input-file object format if you don't use
  2398. '-b' (or its synonym '--format'). Its value should be one of the BFD
  2399. names for an input format (*note BFD::). If there is no 'GNUTARGET' in
  2400. the environment, 'ld' uses the natural format of the target. If
  2401. 'GNUTARGET' is set to 'default' then BFD attempts to discover the input
  2402. format by examining binary input files; this method often succeeds, but
  2403. there are potential ambiguities, since there is no method of ensuring
  2404. that the magic number used to specify object-file formats is unique.
  2405. However, the configuration procedure for BFD on each system places the
  2406. conventional format for that system first in the search-list, so
  2407. ambiguities are resolved in favor of convention.
  2408. 'LDEMULATION' determines the default emulation if you don't use the
  2409. '-m' option. The emulation can affect various aspects of linker
  2410. behaviour, particularly the default linker script. You can list the
  2411. available emulations with the '--verbose' or '-V' options. If the '-m'
  2412. option is not used, and the 'LDEMULATION' environment variable is not
  2413. defined, the default emulation depends upon how the linker was
  2414. configured.
  2415. Normally, the linker will default to demangling symbols. However, if
  2416. 'COLLECT_NO_DEMANGLE' is set in the environment, then it will default to
  2417. not demangling symbols. This environment variable is used in a similar
  2418. fashion by the 'gcc' linker wrapper program. The default may be
  2419. overridden by the '--demangle' and '--no-demangle' options.
  2420. 
  2421. File: ld.info, Node: Scripts, Next: Plugins, Prev: Invocation, Up: Top
  2422. 3 Linker Scripts
  2423. ****************
  2424. Every link is controlled by a "linker script". This script is written
  2425. in the linker command language.
  2426. The main purpose of the linker script is to describe how the sections
  2427. in the input files should be mapped into the output file, and to control
  2428. the memory layout of the output file. Most linker scripts do nothing
  2429. more than this. However, when necessary, the linker script can also
  2430. direct the linker to perform many other operations, using the commands
  2431. described below.
  2432. The linker always uses a linker script. If you do not supply one
  2433. yourself, the linker will use a default script that is compiled into the
  2434. linker executable. You can use the '--verbose' command-line option to
  2435. display the default linker script. Certain command-line options, such
  2436. as '-r' or '-N', will affect the default linker script.
  2437. You may supply your own linker script by using the '-T' command line
  2438. option. When you do this, your linker script will replace the default
  2439. linker script.
  2440. You may also use linker scripts implicitly by naming them as input
  2441. files to the linker, as though they were files to be linked. *Note
  2442. Implicit Linker Scripts::.
  2443. * Menu:
  2444. * Basic Script Concepts:: Basic Linker Script Concepts
  2445. * Script Format:: Linker Script Format
  2446. * Simple Example:: Simple Linker Script Example
  2447. * Simple Commands:: Simple Linker Script Commands
  2448. * Assignments:: Assigning Values to Symbols
  2449. * SECTIONS:: SECTIONS Command
  2450. * MEMORY:: MEMORY Command
  2451. * PHDRS:: PHDRS Command
  2452. * VERSION:: VERSION Command
  2453. * Expressions:: Expressions in Linker Scripts
  2454. * Implicit Linker Scripts:: Implicit Linker Scripts
  2455. 
  2456. File: ld.info, Node: Basic Script Concepts, Next: Script Format, Up: Scripts
  2457. 3.1 Basic Linker Script Concepts
  2458. ================================
  2459. We need to define some basic concepts and vocabulary in order to
  2460. describe the linker script language.
  2461. The linker combines input files into a single output file. The
  2462. output file and each input file are in a special data format known as an
  2463. "object file format". Each file is called an "object file". The output
  2464. file is often called an "executable", but for our purposes we will also
  2465. call it an object file. Each object file has, among other things, a
  2466. list of "sections". We sometimes refer to a section in an input file as
  2467. an "input section"; similarly, a section in the output file is an
  2468. "output section".
  2469. Each section in an object file has a name and a size. Most sections
  2470. also have an associated block of data, known as the "section contents".
  2471. A section may be marked as "loadable", which means that the contents
  2472. should be loaded into memory when the output file is run. A section
  2473. with no contents may be "allocatable", which means that an area in
  2474. memory should be set aside, but nothing in particular should be loaded
  2475. there (in some cases this memory must be zeroed out). A section which
  2476. is neither loadable nor allocatable typically contains some sort of
  2477. debugging information.
  2478. Every loadable or allocatable output section has two addresses. The
  2479. first is the "VMA", or virtual memory address. This is the address the
  2480. section will have when the output file is run. The second is the "LMA",
  2481. or load memory address. This is the address at which the section will
  2482. be loaded. In most cases the two addresses will be the same. An
  2483. example of when they might be different is when a data section is loaded
  2484. into ROM, and then copied into RAM when the program starts up (this
  2485. technique is often used to initialize global variables in a ROM based
  2486. system). In this case the ROM address would be the LMA, and the RAM
  2487. address would be the VMA.
  2488. You can see the sections in an object file by using the 'objdump'
  2489. program with the '-h' option.
  2490. Every object file also has a list of "symbols", known as the "symbol
  2491. table". A symbol may be defined or undefined. Each symbol has a name,
  2492. and each defined symbol has an address, among other information. If you
  2493. compile a C or C++ program into an object file, you will get a defined
  2494. symbol for every defined function and global or static variable. Every
  2495. undefined function or global variable which is referenced in the input
  2496. file will become an undefined symbol.
  2497. You can see the symbols in an object file by using the 'nm' program,
  2498. or by using the 'objdump' program with the '-t' option.
  2499. 
  2500. File: ld.info, Node: Script Format, Next: Simple Example, Prev: Basic Script Concepts, Up: Scripts
  2501. 3.2 Linker Script Format
  2502. ========================
  2503. Linker scripts are text files.
  2504. You write a linker script as a series of commands. Each command is
  2505. either a keyword, possibly followed by arguments, or an assignment to a
  2506. symbol. You may separate commands using semicolons. Whitespace is
  2507. generally ignored.
  2508. Strings such as file or format names can normally be entered
  2509. directly. If the file name contains a character such as a comma which
  2510. would otherwise serve to separate file names, you may put the file name
  2511. in double quotes. There is no way to use a double quote character in a
  2512. file name.
  2513. You may include comments in linker scripts just as in C, delimited by
  2514. '/*' and '*/'. As in C, comments are syntactically equivalent to
  2515. whitespace.
  2516. 
  2517. File: ld.info, Node: Simple Example, Next: Simple Commands, Prev: Script Format, Up: Scripts
  2518. 3.3 Simple Linker Script Example
  2519. ================================
  2520. Many linker scripts are fairly simple.
  2521. The simplest possible linker script has just one command: 'SECTIONS'.
  2522. You use the 'SECTIONS' command to describe the memory layout of the
  2523. output file.
  2524. The 'SECTIONS' command is a powerful command. Here we will describe
  2525. a simple use of it. Let's assume your program consists only of code,
  2526. initialized data, and uninitialized data. These will be in the '.text',
  2527. '.data', and '.bss' sections, respectively. Let's assume further that
  2528. these are the only sections which appear in your input files.
  2529. For this example, let's say that the code should be loaded at address
  2530. 0x10000, and that the data should start at address 0x8000000. Here is a
  2531. linker script which will do that:
  2532. SECTIONS
  2533. {
  2534. . = 0x10000;
  2535. .text : { *(.text) }
  2536. . = 0x8000000;
  2537. .data : { *(.data) }
  2538. .bss : { *(.bss) }
  2539. }
  2540. You write the 'SECTIONS' command as the keyword 'SECTIONS', followed
  2541. by a series of symbol assignments and output section descriptions
  2542. enclosed in curly braces.
  2543. The first line inside the 'SECTIONS' command of the above example
  2544. sets the value of the special symbol '.', which is the location counter.
  2545. If you do not specify the address of an output section in some other way
  2546. (other ways are described later), the address is set from the current
  2547. value of the location counter. The location counter is then incremented
  2548. by the size of the output section. At the start of the 'SECTIONS'
  2549. command, the location counter has the value '0'.
  2550. The second line defines an output section, '.text'. The colon is
  2551. required syntax which may be ignored for now. Within the curly braces
  2552. after the output section name, you list the names of the input sections
  2553. which should be placed into this output section. The '*' is a wildcard
  2554. which matches any file name. The expression '*(.text)' means all
  2555. '.text' input sections in all input files.
  2556. Since the location counter is '0x10000' when the output section
  2557. '.text' is defined, the linker will set the address of the '.text'
  2558. section in the output file to be '0x10000'.
  2559. The remaining lines define the '.data' and '.bss' sections in the
  2560. output file. The linker will place the '.data' output section at
  2561. address '0x8000000'. After the linker places the '.data' output
  2562. section, the value of the location counter will be '0x8000000' plus the
  2563. size of the '.data' output section. The effect is that the linker will
  2564. place the '.bss' output section immediately after the '.data' output
  2565. section in memory.
  2566. The linker will ensure that each output section has the required
  2567. alignment, by increasing the location counter if necessary. In this
  2568. example, the specified addresses for the '.text' and '.data' sections
  2569. will probably satisfy any alignment constraints, but the linker may have
  2570. to create a small gap between the '.data' and '.bss' sections.
  2571. That's it! That's a simple and complete linker script.
  2572. 
  2573. File: ld.info, Node: Simple Commands, Next: Assignments, Prev: Simple Example, Up: Scripts
  2574. 3.4 Simple Linker Script Commands
  2575. =================================
  2576. In this section we describe the simple linker script commands.
  2577. * Menu:
  2578. * Entry Point:: Setting the entry point
  2579. * File Commands:: Commands dealing with files
  2580. * Format Commands:: Commands dealing with object file formats
  2581. * REGION_ALIAS:: Assign alias names to memory regions
  2582. * Miscellaneous Commands:: Other linker script commands
  2583. 
  2584. File: ld.info, Node: Entry Point, Next: File Commands, Up: Simple Commands
  2585. 3.4.1 Setting the Entry Point
  2586. -----------------------------
  2587. The first instruction to execute in a program is called the "entry
  2588. point". You can use the 'ENTRY' linker script command to set the entry
  2589. point. The argument is a symbol name:
  2590. ENTRY(SYMBOL)
  2591. There are several ways to set the entry point. The linker will set
  2592. the entry point by trying each of the following methods in order, and
  2593. stopping when one of them succeeds:
  2594. * the '-e' ENTRY command-line option;
  2595. * the 'ENTRY(SYMBOL)' command in a linker script;
  2596. * the value of a target-specific symbol, if it is defined; For many
  2597. targets this is 'start', but PE- and BeOS-based systems for example
  2598. check a list of possible entry symbols, matching the first one
  2599. found.
  2600. * the address of the first byte of the '.text' section, if present;
  2601. * The address '0'.
  2602. 
  2603. File: ld.info, Node: File Commands, Next: Format Commands, Prev: Entry Point, Up: Simple Commands
  2604. 3.4.2 Commands Dealing with Files
  2605. ---------------------------------
  2606. Several linker script commands deal with files.
  2607. 'INCLUDE FILENAME'
  2608. Include the linker script FILENAME at this point. The file will be
  2609. searched for in the current directory, and in any directory
  2610. specified with the '-L' option. You can nest calls to 'INCLUDE' up
  2611. to 10 levels deep.
  2612. You can place 'INCLUDE' directives at the top level, in 'MEMORY' or
  2613. 'SECTIONS' commands, or in output section descriptions.
  2614. 'INPUT(FILE, FILE, ...)'
  2615. 'INPUT(FILE FILE ...)'
  2616. The 'INPUT' command directs the linker to include the named files
  2617. in the link, as though they were named on the command line.
  2618. For example, if you always want to include 'subr.o' any time you do
  2619. a link, but you can't be bothered to put it on every link command
  2620. line, then you can put 'INPUT (subr.o)' in your linker script.
  2621. In fact, if you like, you can list all of your input files in the
  2622. linker script, and then invoke the linker with nothing but a '-T'
  2623. option.
  2624. In case a "sysroot prefix" is configured, and the filename starts
  2625. with the '/' character, and the script being processed was located
  2626. inside the "sysroot prefix", the filename will be looked for in the
  2627. "sysroot prefix". The "sysroot prefix" can also be forced by
  2628. specifying '=' as the first character in the filename path, or
  2629. prefixing the filename path with '$SYSROOT'. See also the
  2630. description of '-L' in *note Command-line Options: Options.
  2631. If a "sysroot prefix" is not used then the linker will try to open
  2632. the file in the directory containing the linker script. If it is
  2633. not found the linker will then search the current directory. If it
  2634. is still not found the linker will search through the archive
  2635. library search path.
  2636. If you use 'INPUT (-lFILE)', 'ld' will transform the name to
  2637. 'libFILE.a', as with the command-line argument '-l'.
  2638. When you use the 'INPUT' command in an implicit linker script, the
  2639. files will be included in the link at the point at which the linker
  2640. script file is included. This can affect archive searching.
  2641. 'GROUP(FILE, FILE, ...)'
  2642. 'GROUP(FILE FILE ...)'
  2643. The 'GROUP' command is like 'INPUT', except that the named files
  2644. should all be archives, and they are searched repeatedly until no
  2645. new undefined references are created. See the description of '-('
  2646. in *note Command-line Options: Options.
  2647. 'AS_NEEDED(FILE, FILE, ...)'
  2648. 'AS_NEEDED(FILE FILE ...)'
  2649. This construct can appear only inside of the 'INPUT' or 'GROUP'
  2650. commands, among other filenames. The files listed will be handled
  2651. as if they appear directly in the 'INPUT' or 'GROUP' commands, with
  2652. the exception of ELF shared libraries, that will be added only when
  2653. they are actually needed. This construct essentially enables
  2654. '--as-needed' option for all the files listed inside of it and
  2655. restores previous '--as-needed' resp. '--no-as-needed' setting
  2656. afterwards.
  2657. 'OUTPUT(FILENAME)'
  2658. The 'OUTPUT' command names the output file. Using
  2659. 'OUTPUT(FILENAME)' in the linker script is exactly like using '-o
  2660. FILENAME' on the command line (*note Command Line Options:
  2661. Options.). If both are used, the command-line option takes
  2662. precedence.
  2663. You can use the 'OUTPUT' command to define a default name for the
  2664. output file other than the usual default of 'a.out'.
  2665. 'SEARCH_DIR(PATH)'
  2666. The 'SEARCH_DIR' command adds PATH to the list of paths where 'ld'
  2667. looks for archive libraries. Using 'SEARCH_DIR(PATH)' is exactly
  2668. like using '-L PATH' on the command line (*note Command-line
  2669. Options: Options.). If both are used, then the linker will search
  2670. both paths. Paths specified using the command-line option are
  2671. searched first.
  2672. 'STARTUP(FILENAME)'
  2673. The 'STARTUP' command is just like the 'INPUT' command, except that
  2674. FILENAME will become the first input file to be linked, as though
  2675. it were specified first on the command line. This may be useful
  2676. when using a system in which the entry point is always the start of
  2677. the first file.
  2678. 
  2679. File: ld.info, Node: Format Commands, Next: REGION_ALIAS, Prev: File Commands, Up: Simple Commands
  2680. 3.4.3 Commands Dealing with Object File Formats
  2681. -----------------------------------------------
  2682. A couple of linker script commands deal with object file formats.
  2683. 'OUTPUT_FORMAT(BFDNAME)'
  2684. 'OUTPUT_FORMAT(DEFAULT, BIG, LITTLE)'
  2685. The 'OUTPUT_FORMAT' command names the BFD format to use for the
  2686. output file (*note BFD::). Using 'OUTPUT_FORMAT(BFDNAME)' is
  2687. exactly like using '--oformat BFDNAME' on the command line (*note
  2688. Command-line Options: Options.). If both are used, the command
  2689. line option takes precedence.
  2690. You can use 'OUTPUT_FORMAT' with three arguments to use different
  2691. formats based on the '-EB' and '-EL' command-line options. This
  2692. permits the linker script to set the output format based on the
  2693. desired endianness.
  2694. If neither '-EB' nor '-EL' are used, then the output format will be
  2695. the first argument, DEFAULT. If '-EB' is used, the output format
  2696. will be the second argument, BIG. If '-EL' is used, the output
  2697. format will be the third argument, LITTLE.
  2698. For example, the default linker script for the MIPS ELF target uses
  2699. this command:
  2700. OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
  2701. This says that the default format for the output file is
  2702. 'elf32-bigmips', but if the user uses the '-EL' command-line
  2703. option, the output file will be created in the 'elf32-littlemips'
  2704. format.
  2705. 'TARGET(BFDNAME)'
  2706. The 'TARGET' command names the BFD format to use when reading input
  2707. files. It affects subsequent 'INPUT' and 'GROUP' commands. This
  2708. command is like using '-b BFDNAME' on the command line (*note
  2709. Command-line Options: Options.). If the 'TARGET' command is used
  2710. but 'OUTPUT_FORMAT' is not, then the last 'TARGET' command is also
  2711. used to set the format for the output file. *Note BFD::.
  2712. 
  2713. File: ld.info, Node: REGION_ALIAS, Next: Miscellaneous Commands, Prev: Format Commands, Up: Simple Commands
  2714. 3.4.4 Assign alias names to memory regions
  2715. ------------------------------------------
  2716. Alias names can be added to existing memory regions created with the
  2717. *note MEMORY:: command. Each name corresponds to at most one memory
  2718. region.
  2719. REGION_ALIAS(ALIAS, REGION)
  2720. The 'REGION_ALIAS' function creates an alias name ALIAS for the
  2721. memory region REGION. This allows a flexible mapping of output sections
  2722. to memory regions. An example follows.
  2723. Suppose we have an application for embedded systems which come with
  2724. various memory storage devices. All have a general purpose, volatile
  2725. memory 'RAM' that allows code execution or data storage. Some may have
  2726. a read-only, non-volatile memory 'ROM' that allows code execution and
  2727. read-only data access. The last variant is a read-only, non-volatile
  2728. memory 'ROM2' with read-only data access and no code execution
  2729. capability. We have four output sections:
  2730. * '.text' program code;
  2731. * '.rodata' read-only data;
  2732. * '.data' read-write initialized data;
  2733. * '.bss' read-write zero initialized data.
  2734. The goal is to provide a linker command file that contains a system
  2735. independent part defining the output sections and a system dependent
  2736. part mapping the output sections to the memory regions available on the
  2737. system. Our embedded systems come with three different memory setups
  2738. 'A', 'B' and 'C':
  2739. Section Variant A Variant B Variant C
  2740. .text RAM ROM ROM
  2741. .rodata RAM ROM ROM2
  2742. .data RAM RAM/ROM RAM/ROM2
  2743. .bss RAM RAM RAM
  2744. The notation 'RAM/ROM' or 'RAM/ROM2' means that this section is
  2745. loaded into region 'ROM' or 'ROM2' respectively. Please note that the
  2746. load address of the '.data' section starts in all three variants at the
  2747. end of the '.rodata' section.
  2748. The base linker script that deals with the output sections follows.
  2749. It includes the system dependent 'linkcmds.memory' file that describes
  2750. the memory layout:
  2751. INCLUDE linkcmds.memory
  2752. SECTIONS
  2753. {
  2754. .text :
  2755. {
  2756. *(.text)
  2757. } > REGION_TEXT
  2758. .rodata :
  2759. {
  2760. *(.rodata)
  2761. rodata_end = .;
  2762. } > REGION_RODATA
  2763. .data : AT (rodata_end)
  2764. {
  2765. data_start = .;
  2766. *(.data)
  2767. } > REGION_DATA
  2768. data_size = SIZEOF(.data);
  2769. data_load_start = LOADADDR(.data);
  2770. .bss :
  2771. {
  2772. *(.bss)
  2773. } > REGION_BSS
  2774. }
  2775. Now we need three different 'linkcmds.memory' files to define memory
  2776. regions and alias names. The content of 'linkcmds.memory' for the three
  2777. variants 'A', 'B' and 'C':
  2778. 'A'
  2779. Here everything goes into the 'RAM'.
  2780. MEMORY
  2781. {
  2782. RAM : ORIGIN = 0, LENGTH = 4M
  2783. }
  2784. REGION_ALIAS("REGION_TEXT", RAM);
  2785. REGION_ALIAS("REGION_RODATA", RAM);
  2786. REGION_ALIAS("REGION_DATA", RAM);
  2787. REGION_ALIAS("REGION_BSS", RAM);
  2788. 'B'
  2789. Program code and read-only data go into the 'ROM'. Read-write data
  2790. goes into the 'RAM'. An image of the initialized data is loaded
  2791. into the 'ROM' and will be copied during system start into the
  2792. 'RAM'.
  2793. MEMORY
  2794. {
  2795. ROM : ORIGIN = 0, LENGTH = 3M
  2796. RAM : ORIGIN = 0x10000000, LENGTH = 1M
  2797. }
  2798. REGION_ALIAS("REGION_TEXT", ROM);
  2799. REGION_ALIAS("REGION_RODATA", ROM);
  2800. REGION_ALIAS("REGION_DATA", RAM);
  2801. REGION_ALIAS("REGION_BSS", RAM);
  2802. 'C'
  2803. Program code goes into the 'ROM'. Read-only data goes into the
  2804. 'ROM2'. Read-write data goes into the 'RAM'. An image of the
  2805. initialized data is loaded into the 'ROM2' and will be copied
  2806. during system start into the 'RAM'.
  2807. MEMORY
  2808. {
  2809. ROM : ORIGIN = 0, LENGTH = 2M
  2810. ROM2 : ORIGIN = 0x10000000, LENGTH = 1M
  2811. RAM : ORIGIN = 0x20000000, LENGTH = 1M
  2812. }
  2813. REGION_ALIAS("REGION_TEXT", ROM);
  2814. REGION_ALIAS("REGION_RODATA", ROM2);
  2815. REGION_ALIAS("REGION_DATA", RAM);
  2816. REGION_ALIAS("REGION_BSS", RAM);
  2817. It is possible to write a common system initialization routine to
  2818. copy the '.data' section from 'ROM' or 'ROM2' into the 'RAM' if
  2819. necessary:
  2820. #include <string.h>
  2821. extern char data_start [];
  2822. extern char data_size [];
  2823. extern char data_load_start [];
  2824. void copy_data(void)
  2825. {
  2826. if (data_start != data_load_start)
  2827. {
  2828. memcpy(data_start, data_load_start, (size_t) data_size);
  2829. }
  2830. }
  2831. 
  2832. File: ld.info, Node: Miscellaneous Commands, Prev: REGION_ALIAS, Up: Simple Commands
  2833. 3.4.5 Other Linker Script Commands
  2834. ----------------------------------
  2835. There are a few other linker scripts commands.
  2836. 'ASSERT(EXP, MESSAGE)'
  2837. Ensure that EXP is non-zero. If it is zero, then exit the linker
  2838. with an error code, and print MESSAGE.
  2839. Note that assertions are checked before the final stages of linking
  2840. take place. This means that expressions involving symbols PROVIDEd
  2841. inside section definitions will fail if the user has not set values
  2842. for those symbols. The only exception to this rule is PROVIDEd
  2843. symbols that just reference dot. Thus an assertion like this:
  2844. .stack :
  2845. {
  2846. PROVIDE (__stack = .);
  2847. PROVIDE (__stack_size = 0x100);
  2848. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2849. }
  2850. will fail if '__stack_size' is not defined elsewhere. Symbols
  2851. PROVIDEd outside of section definitions are evaluated earlier, so
  2852. they can be used inside ASSERTions. Thus:
  2853. PROVIDE (__stack_size = 0x100);
  2854. .stack :
  2855. {
  2856. PROVIDE (__stack = .);
  2857. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2858. }
  2859. will work.
  2860. 'EXTERN(SYMBOL SYMBOL ...)'
  2861. Force SYMBOL to be entered in the output file as an undefined
  2862. symbol. Doing this may, for example, trigger linking of additional
  2863. modules from standard libraries. You may list several SYMBOLs for
  2864. each 'EXTERN', and you may use 'EXTERN' multiple times. This
  2865. command has the same effect as the '-u' command-line option.
  2866. 'FORCE_COMMON_ALLOCATION'
  2867. This command has the same effect as the '-d' command-line option:
  2868. to make 'ld' assign space to common symbols even if a relocatable
  2869. output file is specified ('-r').
  2870. 'INHIBIT_COMMON_ALLOCATION'
  2871. This command has the same effect as the '--no-define-common'
  2872. command-line option: to make 'ld' omit the assignment of addresses
  2873. to common symbols even for a non-relocatable output file.
  2874. 'FORCE_GROUP_ALLOCATION'
  2875. This command has the same effect as the '--force-group-allocation'
  2876. command-line option: to make 'ld' place section group members like
  2877. normal input sections, and to delete the section groups even if a
  2878. relocatable output file is specified ('-r').
  2879. 'INSERT [ AFTER | BEFORE ] OUTPUT_SECTION'
  2880. This command is typically used in a script specified by '-T' to
  2881. augment the default 'SECTIONS' with, for example, overlays. It
  2882. inserts all prior linker script statements after (or before)
  2883. OUTPUT_SECTION, and also causes '-T' to not override the default
  2884. linker script. The exact insertion point is as for orphan
  2885. sections. *Note Location Counter::. The insertion happens after
  2886. the linker has mapped input sections to output sections. Prior to
  2887. the insertion, since '-T' scripts are parsed before the default
  2888. linker script, statements in the '-T' script occur before the
  2889. default linker script statements in the internal linker
  2890. representation of the script. In particular, input section
  2891. assignments will be made to '-T' output sections before those in
  2892. the default script. Here is an example of how a '-T' script using
  2893. 'INSERT' might look:
  2894. SECTIONS
  2895. {
  2896. OVERLAY :
  2897. {
  2898. .ov1 { ov1*(.text) }
  2899. .ov2 { ov2*(.text) }
  2900. }
  2901. }
  2902. INSERT AFTER .text;
  2903. 'NOCROSSREFS(SECTION SECTION ...)'
  2904. This command may be used to tell 'ld' to issue an error about any
  2905. references among certain output sections.
  2906. In certain types of programs, particularly on embedded systems when
  2907. using overlays, when one section is loaded into memory, another
  2908. section will not be. Any direct references between the two
  2909. sections would be errors. For example, it would be an error if
  2910. code in one section called a function defined in the other section.
  2911. The 'NOCROSSREFS' command takes a list of output section names. If
  2912. 'ld' detects any cross references between the sections, it reports
  2913. an error and returns a non-zero exit status. Note that the
  2914. 'NOCROSSREFS' command uses output section names, not input section
  2915. names.
  2916. 'NOCROSSREFS_TO(TOSECTION FROMSECTION ...)'
  2917. This command may be used to tell 'ld' to issue an error about any
  2918. references to one section from a list of other sections.
  2919. The 'NOCROSSREFS' command is useful when ensuring that two or more
  2920. output sections are entirely independent but there are situations
  2921. where a one-way dependency is needed. For example, in a multi-core
  2922. application there may be shared code that can be called from each
  2923. core but for safety must never call back.
  2924. The 'NOCROSSREFS_TO' command takes a list of output section names.
  2925. The first section can not be referenced from any of the other
  2926. sections. If 'ld' detects any references to the first section from
  2927. any of the other sections, it reports an error and returns a
  2928. non-zero exit status. Note that the 'NOCROSSREFS_TO' command uses
  2929. output section names, not input section names.
  2930. 'OUTPUT_ARCH(BFDARCH)'
  2931. Specify a particular output machine architecture. The argument is
  2932. one of the names used by the BFD library (*note BFD::). You can
  2933. see the architecture of an object file by using the 'objdump'
  2934. program with the '-f' option.
  2935. 'LD_FEATURE(STRING)'
  2936. This command may be used to modify 'ld' behavior. If STRING is
  2937. '"SANE_EXPR"' then absolute symbols and numbers in a script are
  2938. simply treated as numbers everywhere. *Note Expression Section::.
  2939. 
  2940. File: ld.info, Node: Assignments, Next: SECTIONS, Prev: Simple Commands, Up: Scripts
  2941. 3.5 Assigning Values to Symbols
  2942. ===============================
  2943. You may assign a value to a symbol in a linker script. This will define
  2944. the symbol and place it into the symbol table with a global scope.
  2945. * Menu:
  2946. * Simple Assignments:: Simple Assignments
  2947. * HIDDEN:: HIDDEN
  2948. * PROVIDE:: PROVIDE
  2949. * PROVIDE_HIDDEN:: PROVIDE_HIDDEN
  2950. * Source Code Reference:: How to use a linker script defined symbol in source code
  2951. 
  2952. File: ld.info, Node: Simple Assignments, Next: HIDDEN, Up: Assignments
  2953. 3.5.1 Simple Assignments
  2954. ------------------------
  2955. You may assign to a symbol using any of the C assignment operators:
  2956. 'SYMBOL = EXPRESSION ;'
  2957. 'SYMBOL += EXPRESSION ;'
  2958. 'SYMBOL -= EXPRESSION ;'
  2959. 'SYMBOL *= EXPRESSION ;'
  2960. 'SYMBOL /= EXPRESSION ;'
  2961. 'SYMBOL <<= EXPRESSION ;'
  2962. 'SYMBOL >>= EXPRESSION ;'
  2963. 'SYMBOL &= EXPRESSION ;'
  2964. 'SYMBOL |= EXPRESSION ;'
  2965. The first case will define SYMBOL to the value of EXPRESSION. In the
  2966. other cases, SYMBOL must already be defined, and the value will be
  2967. adjusted accordingly.
  2968. The special symbol name '.' indicates the location counter. You may
  2969. only use this within a 'SECTIONS' command. *Note Location Counter::.
  2970. The semicolon after EXPRESSION is required.
  2971. Expressions are defined below; see *note Expressions::.
  2972. You may write symbol assignments as commands in their own right, or
  2973. as statements within a 'SECTIONS' command, or as part of an output
  2974. section description in a 'SECTIONS' command.
  2975. The section of the symbol will be set from the section of the
  2976. expression; for more information, see *note Expression Section::.
  2977. Here is an example showing the three different places that symbol
  2978. assignments may be used:
  2979. floating_point = 0;
  2980. SECTIONS
  2981. {
  2982. .text :
  2983. {
  2984. *(.text)
  2985. _etext = .;
  2986. }
  2987. _bdata = (. + 3) & ~ 3;
  2988. .data : { *(.data) }
  2989. }
  2990. In this example, the symbol 'floating_point' will be defined as zero.
  2991. The symbol '_etext' will be defined as the address following the last
  2992. '.text' input section. The symbol '_bdata' will be defined as the
  2993. address following the '.text' output section aligned upward to a 4 byte
  2994. boundary.
  2995. 
  2996. File: ld.info, Node: HIDDEN, Next: PROVIDE, Prev: Simple Assignments, Up: Assignments
  2997. 3.5.2 HIDDEN
  2998. ------------
  2999. For ELF targeted ports, define a symbol that will be hidden and won't be
  3000. exported. The syntax is 'HIDDEN(SYMBOL = EXPRESSION)'.
  3001. Here is the example from *note Simple Assignments::, rewritten to use
  3002. 'HIDDEN':
  3003. HIDDEN(floating_point = 0);
  3004. SECTIONS
  3005. {
  3006. .text :
  3007. {
  3008. *(.text)
  3009. HIDDEN(_etext = .);
  3010. }
  3011. HIDDEN(_bdata = (. + 3) & ~ 3);
  3012. .data : { *(.data) }
  3013. }
  3014. In this case none of the three symbols will be visible outside this
  3015. module.
  3016. 
  3017. File: ld.info, Node: PROVIDE, Next: PROVIDE_HIDDEN, Prev: HIDDEN, Up: Assignments
  3018. 3.5.3 PROVIDE
  3019. -------------
  3020. In some cases, it is desirable for a linker script to define a symbol
  3021. only if it is referenced and is not defined by any object included in
  3022. the link. For example, traditional linkers defined the symbol 'etext'.
  3023. However, ANSI C requires that the user be able to use 'etext' as a
  3024. function name without encountering an error. The 'PROVIDE' keyword may
  3025. be used to define a symbol, such as 'etext', only if it is referenced
  3026. but not defined. The syntax is 'PROVIDE(SYMBOL = EXPRESSION)'.
  3027. Here is an example of using 'PROVIDE' to define 'etext':
  3028. SECTIONS
  3029. {
  3030. .text :
  3031. {
  3032. *(.text)
  3033. _etext = .;
  3034. PROVIDE(etext = .);
  3035. }
  3036. }
  3037. In this example, if the program defines '_etext' (with a leading
  3038. underscore), the linker will give a multiple definition error. If, on
  3039. the other hand, the program defines 'etext' (with no leading
  3040. underscore), the linker will silently use the definition in the program.
  3041. If the program references 'etext' but does not define it, the linker
  3042. will use the definition in the linker script.
  3043. Note - the 'PROVIDE' directive considers a common symbol to be
  3044. defined, even though such a symbol could be combined with the symbol
  3045. that the 'PROVIDE' would create. This is particularly important when
  3046. considering constructor and destructor list symbols such as
  3047. '__CTOR_LIST__' as these are often defined as common symbols.
  3048. 
  3049. File: ld.info, Node: PROVIDE_HIDDEN, Next: Source Code Reference, Prev: PROVIDE, Up: Assignments
  3050. 3.5.4 PROVIDE_HIDDEN
  3051. --------------------
  3052. Similar to 'PROVIDE'. For ELF targeted ports, the symbol will be hidden
  3053. and won't be exported.
  3054. 
  3055. File: ld.info, Node: Source Code Reference, Prev: PROVIDE_HIDDEN, Up: Assignments
  3056. 3.5.5 Source Code Reference
  3057. ---------------------------
  3058. Accessing a linker script defined variable from source code is not
  3059. intuitive. In particular a linker script symbol is not equivalent to a
  3060. variable declaration in a high level language, it is instead a symbol
  3061. that does not have a value.
  3062. Before going further, it is important to note that compilers often
  3063. transform names in the source code into different names when they are
  3064. stored in the symbol table. For example, Fortran compilers commonly
  3065. prepend or append an underscore, and C++ performs extensive 'name
  3066. mangling'. Therefore there might be a discrepancy between the name of a
  3067. variable as it is used in source code and the name of the same variable
  3068. as it is defined in a linker script. For example in C a linker script
  3069. variable might be referred to as:
  3070. extern int foo;
  3071. But in the linker script it might be defined as:
  3072. _foo = 1000;
  3073. In the remaining examples however it is assumed that no name
  3074. transformation has taken place.
  3075. When a symbol is declared in a high level language such as C, two
  3076. things happen. The first is that the compiler reserves enough space in
  3077. the program's memory to hold the _value_ of the symbol. The second is
  3078. that the compiler creates an entry in the program's symbol table which
  3079. holds the symbol's _address_. ie the symbol table contains the address
  3080. of the block of memory holding the symbol's value. So for example the
  3081. following C declaration, at file scope:
  3082. int foo = 1000;
  3083. creates an entry called 'foo' in the symbol table. This entry holds
  3084. the address of an 'int' sized block of memory where the number 1000 is
  3085. initially stored.
  3086. When a program references a symbol the compiler generates code that
  3087. first accesses the symbol table to find the address of the symbol's
  3088. memory block and then code to read the value from that memory block.
  3089. So:
  3090. foo = 1;
  3091. looks up the symbol 'foo' in the symbol table, gets the address
  3092. associated with this symbol and then writes the value 1 into that
  3093. address. Whereas:
  3094. int * a = & foo;
  3095. looks up the symbol 'foo' in the symbol table, gets its address and
  3096. then copies this address into the block of memory associated with the
  3097. variable 'a'.
  3098. Linker scripts symbol declarations, by contrast, create an entry in
  3099. the symbol table but do not assign any memory to them. Thus they are an
  3100. address without a value. So for example the linker script definition:
  3101. foo = 1000;
  3102. creates an entry in the symbol table called 'foo' which holds the
  3103. address of memory location 1000, but nothing special is stored at
  3104. address 1000. This means that you cannot access the _value_ of a linker
  3105. script defined symbol - it has no value - all you can do is access the
  3106. _address_ of a linker script defined symbol.
  3107. Hence when you are using a linker script defined symbol in source
  3108. code you should always take the address of the symbol, and never attempt
  3109. to use its value. For example suppose you want to copy the contents of
  3110. a section of memory called .ROM into a section called .FLASH and the
  3111. linker script contains these declarations:
  3112. start_of_ROM = .ROM;
  3113. end_of_ROM = .ROM + sizeof (.ROM);
  3114. start_of_FLASH = .FLASH;
  3115. Then the C source code to perform the copy would be:
  3116. extern char start_of_ROM, end_of_ROM, start_of_FLASH;
  3117. memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM);
  3118. Note the use of the '&' operators. These are correct. Alternatively
  3119. the symbols can be treated as the names of vectors or arrays and then
  3120. the code will again work as expected:
  3121. extern char start_of_ROM[], end_of_ROM[], start_of_FLASH[];
  3122. memcpy (start_of_FLASH, start_of_ROM, end_of_ROM - start_of_ROM);
  3123. Note how using this method does not require the use of '&' operators.
  3124. 
  3125. File: ld.info, Node: SECTIONS, Next: MEMORY, Prev: Assignments, Up: Scripts
  3126. 3.6 SECTIONS Command
  3127. ====================
  3128. The 'SECTIONS' command tells the linker how to map input sections into
  3129. output sections, and how to place the output sections in memory.
  3130. The format of the 'SECTIONS' command is:
  3131. SECTIONS
  3132. {
  3133. SECTIONS-COMMAND
  3134. SECTIONS-COMMAND
  3135. ...
  3136. }
  3137. Each SECTIONS-COMMAND may of be one of the following:
  3138. * an 'ENTRY' command (*note Entry command: Entry Point.)
  3139. * a symbol assignment (*note Assignments::)
  3140. * an output section description
  3141. * an overlay description
  3142. The 'ENTRY' command and symbol assignments are permitted inside the
  3143. 'SECTIONS' command for convenience in using the location counter in
  3144. those commands. This can also make the linker script easier to
  3145. understand because you can use those commands at meaningful points in
  3146. the layout of the output file.
  3147. Output section descriptions and overlay descriptions are described
  3148. below.
  3149. If you do not use a 'SECTIONS' command in your linker script, the
  3150. linker will place each input section into an identically named output
  3151. section in the order that the sections are first encountered in the
  3152. input files. If all input sections are present in the first file, for
  3153. example, the order of sections in the output file will match the order
  3154. in the first input file. The first section will be at address zero.
  3155. * Menu:
  3156. * Output Section Description:: Output section description
  3157. * Output Section Name:: Output section name
  3158. * Output Section Address:: Output section address
  3159. * Input Section:: Input section description
  3160. * Output Section Data:: Output section data
  3161. * Output Section Keywords:: Output section keywords
  3162. * Output Section Discarding:: Output section discarding
  3163. * Output Section Attributes:: Output section attributes
  3164. * Overlay Description:: Overlay description
  3165. 
  3166. File: ld.info, Node: Output Section Description, Next: Output Section Name, Up: SECTIONS
  3167. 3.6.1 Output Section Description
  3168. --------------------------------
  3169. The full description of an output section looks like this:
  3170. SECTION [ADDRESS] [(TYPE)] :
  3171. [AT(LMA)]
  3172. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3173. [SUBALIGN(SUBSECTION_ALIGN)]
  3174. [CONSTRAINT]
  3175. {
  3176. OUTPUT-SECTION-COMMAND
  3177. OUTPUT-SECTION-COMMAND
  3178. ...
  3179. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP] [,]
  3180. Most output sections do not use most of the optional section
  3181. attributes.
  3182. The whitespace around SECTION is required, so that the section name
  3183. is unambiguous. The colon and the curly braces are also required. The
  3184. comma at the end may be required if a FILLEXP is used and the next
  3185. SECTIONS-COMMAND looks like a continuation of the expression. The line
  3186. breaks and other white space are optional.
  3187. Each OUTPUT-SECTION-COMMAND may be one of the following:
  3188. * a symbol assignment (*note Assignments::)
  3189. * an input section description (*note Input Section::)
  3190. * data values to include directly (*note Output Section Data::)
  3191. * a special output section keyword (*note Output Section Keywords::)
  3192. 
  3193. File: ld.info, Node: Output Section Name, Next: Output Section Address, Prev: Output Section Description, Up: SECTIONS
  3194. 3.6.2 Output Section Name
  3195. -------------------------
  3196. The name of the output section is SECTION. SECTION must meet the
  3197. constraints of your output format. In formats which only support a
  3198. limited number of sections, such as 'a.out', the name must be one of the
  3199. names supported by the format ('a.out', for example, allows only
  3200. '.text', '.data' or '.bss'). If the output format supports any number
  3201. of sections, but with numbers and not names (as is the case for Oasys),
  3202. the name should be supplied as a quoted numeric string. A section name
  3203. may consist of any sequence of characters, but a name which contains any
  3204. unusual characters such as commas must be quoted.
  3205. The output section name '/DISCARD/' is special; *note Output Section
  3206. Discarding::.
  3207. 
  3208. File: ld.info, Node: Output Section Address, Next: Input Section, Prev: Output Section Name, Up: SECTIONS
  3209. 3.6.3 Output Section Address
  3210. ----------------------------
  3211. The ADDRESS is an expression for the VMA (the virtual memory address) of
  3212. the output section. This address is optional, but if it is provided
  3213. then the output address will be set exactly as specified.
  3214. If the output address is not specified then one will be chosen for
  3215. the section, based on the heuristic below. This address will be
  3216. adjusted to fit the alignment requirement of the output section. The
  3217. alignment requirement is the strictest alignment of any input section
  3218. contained within the output section.
  3219. The output section address heuristic is as follows:
  3220. * If an output memory REGION is set for the section then it is added
  3221. to this region and its address will be the next free address in
  3222. that region.
  3223. * If the MEMORY command has been used to create a list of memory
  3224. regions then the first region which has attributes compatible with
  3225. the section is selected to contain it. The section's output
  3226. address will be the next free address in that region; *note
  3227. MEMORY::.
  3228. * If no memory regions were specified, or none match the section then
  3229. the output address will be based on the current value of the
  3230. location counter.
  3231. For example:
  3232. .text . : { *(.text) }
  3233. and
  3234. .text : { *(.text) }
  3235. are subtly different. The first will set the address of the '.text'
  3236. output section to the current value of the location counter. The second
  3237. will set it to the current value of the location counter aligned to the
  3238. strictest alignment of any of the '.text' input sections.
  3239. The ADDRESS may be an arbitrary expression; *note Expressions::. For
  3240. example, if you want to align the section on a 0x10 byte boundary, so
  3241. that the lowest four bits of the section address are zero, you could do
  3242. something like this:
  3243. .text ALIGN(0x10) : { *(.text) }
  3244. This works because 'ALIGN' returns the current location counter aligned
  3245. upward to the specified value.
  3246. Specifying ADDRESS for a section will change the value of the
  3247. location counter, provided that the section is non-empty. (Empty
  3248. sections are ignored).
  3249. 
  3250. File: ld.info, Node: Input Section, Next: Output Section Data, Prev: Output Section Address, Up: SECTIONS
  3251. 3.6.4 Input Section Description
  3252. -------------------------------
  3253. The most common output section command is an input section description.
  3254. The input section description is the most basic linker script
  3255. operation. You use output sections to tell the linker how to lay out
  3256. your program in memory. You use input section descriptions to tell the
  3257. linker how to map the input files into your memory layout.
  3258. * Menu:
  3259. * Input Section Basics:: Input section basics
  3260. * Input Section Wildcards:: Input section wildcard patterns
  3261. * Input Section Common:: Input section for common symbols
  3262. * Input Section Keep:: Input section and garbage collection
  3263. * Input Section Example:: Input section example
  3264. 
  3265. File: ld.info, Node: Input Section Basics, Next: Input Section Wildcards, Up: Input Section
  3266. 3.6.4.1 Input Section Basics
  3267. ............................
  3268. An input section description consists of a file name optionally followed
  3269. by a list of section names in parentheses.
  3270. The file name and the section name may be wildcard patterns, which we
  3271. describe further below (*note Input Section Wildcards::).
  3272. The most common input section description is to include all input
  3273. sections with a particular name in the output section. For example, to
  3274. include all input '.text' sections, you would write:
  3275. *(.text)
  3276. Here the '*' is a wildcard which matches any file name. To exclude a
  3277. list of files from matching the file name wildcard, EXCLUDE_FILE may be
  3278. used to match all files except the ones specified in the EXCLUDE_FILE
  3279. list. For example:
  3280. EXCLUDE_FILE (*crtend.o *otherfile.o) *(.ctors)
  3281. will cause all .ctors sections from all files except 'crtend.o' and
  3282. 'otherfile.o' to be included. The EXCLUDE_FILE can also be placed
  3283. inside the section list, for example:
  3284. *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)
  3285. The result of this is identically to the previous example. Supporting
  3286. two syntaxes for EXCLUDE_FILE is useful if the section list contains
  3287. more than one section, as described below.
  3288. There are two ways to include more than one section:
  3289. *(.text .rdata)
  3290. *(.text) *(.rdata)
  3291. The difference between these is the order in which the '.text' and
  3292. '.rdata' input sections will appear in the output section. In the first
  3293. example, they will be intermingled, appearing in the same order as they
  3294. are found in the linker input. In the second example, all '.text' input
  3295. sections will appear first, followed by all '.rdata' input sections.
  3296. When using EXCLUDE_FILE with more than one section, if the exclusion
  3297. is within the section list then the exclusion only applies to the
  3298. immediately following section, for example:
  3299. *(EXCLUDE_FILE (*somefile.o) .text .rdata)
  3300. will cause all '.text' sections from all files except 'somefile.o' to be
  3301. included, while all '.rdata' sections from all files, including
  3302. 'somefile.o', will be included. To exclude the '.rdata' sections from
  3303. 'somefile.o' the example could be modified to:
  3304. *(EXCLUDE_FILE (*somefile.o) .text EXCLUDE_FILE (*somefile.o) .rdata)
  3305. Alternatively, placing the EXCLUDE_FILE outside of the section list,
  3306. before the input file selection, will cause the exclusion to apply for
  3307. all sections. Thus the previous example can be rewritten as:
  3308. EXCLUDE_FILE (*somefile.o) *(.text .rdata)
  3309. You can specify a file name to include sections from a particular
  3310. file. You would do this if one or more of your files contain special
  3311. data that needs to be at a particular location in memory. For example:
  3312. data.o(.data)
  3313. To refine the sections that are included based on the section flags
  3314. of an input section, INPUT_SECTION_FLAGS may be used.
  3315. Here is a simple example for using Section header flags for ELF
  3316. sections:
  3317. SECTIONS {
  3318. .text : { INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS) *(.text) }
  3319. .text2 : { INPUT_SECTION_FLAGS (!SHF_WRITE) *(.text) }
  3320. }
  3321. In this example, the output section '.text' will be comprised of any
  3322. input section matching the name *(.text) whose section header flags
  3323. 'SHF_MERGE' and 'SHF_STRINGS' are set. The output section '.text2' will
  3324. be comprised of any input section matching the name *(.text) whose
  3325. section header flag 'SHF_WRITE' is clear.
  3326. You can also specify files within archives by writing a pattern
  3327. matching the archive, a colon, then the pattern matching the file, with
  3328. no whitespace around the colon.
  3329. 'archive:file'
  3330. matches file within archive
  3331. 'archive:'
  3332. matches the whole archive
  3333. ':file'
  3334. matches file but not one in an archive
  3335. Either one or both of 'archive' and 'file' can contain shell
  3336. wildcards. On DOS based file systems, the linker will assume that a
  3337. single letter followed by a colon is a drive specifier, so 'c:myfile.o'
  3338. is a simple file specification, not 'myfile.o' within an archive called
  3339. 'c'. 'archive:file' filespecs may also be used within an 'EXCLUDE_FILE'
  3340. list, but may not appear in other linker script contexts. For instance,
  3341. you cannot extract a file from an archive by using 'archive:file' in an
  3342. 'INPUT' command.
  3343. If you use a file name without a list of sections, then all sections
  3344. in the input file will be included in the output section. This is not
  3345. commonly done, but it may by useful on occasion. For example:
  3346. data.o
  3347. When you use a file name which is not an 'archive:file' specifier and
  3348. does not contain any wild card characters, the linker will first see if
  3349. you also specified the file name on the linker command line or in an
  3350. 'INPUT' command. If you did not, the linker will attempt to open the
  3351. file as an input file, as though it appeared on the command line. Note
  3352. that this differs from an 'INPUT' command, because the linker will not
  3353. search for the file in the archive search path.
  3354. 
  3355. File: ld.info, Node: Input Section Wildcards, Next: Input Section Common, Prev: Input Section Basics, Up: Input Section
  3356. 3.6.4.2 Input Section Wildcard Patterns
  3357. .......................................
  3358. In an input section description, either the file name or the section
  3359. name or both may be wildcard patterns.
  3360. The file name of '*' seen in many examples is a simple wildcard
  3361. pattern for the file name.
  3362. The wildcard patterns are like those used by the Unix shell.
  3363. '*'
  3364. matches any number of characters
  3365. '?'
  3366. matches any single character
  3367. '[CHARS]'
  3368. matches a single instance of any of the CHARS; the '-' character
  3369. may be used to specify a range of characters, as in '[a-z]' to
  3370. match any lower case letter
  3371. '\'
  3372. quotes the following character
  3373. When a file name is matched with a wildcard, the wildcard characters
  3374. will not match a '/' character (used to separate directory names on
  3375. Unix). A pattern consisting of a single '*' character is an exception;
  3376. it will always match any file name, whether it contains a '/' or not.
  3377. In a section name, the wildcard characters will match a '/' character.
  3378. File name wildcard patterns only match files which are explicitly
  3379. specified on the command line or in an 'INPUT' command. The linker does
  3380. not search directories to expand wildcards.
  3381. If a file name matches more than one wildcard pattern, or if a file
  3382. name appears explicitly and is also matched by a wildcard pattern, the
  3383. linker will use the first match in the linker script. For example, this
  3384. sequence of input section descriptions is probably in error, because the
  3385. 'data.o' rule will not be used:
  3386. .data : { *(.data) }
  3387. .data1 : { data.o(.data) }
  3388. Normally, the linker will place files and sections matched by
  3389. wildcards in the order in which they are seen during the link. You can
  3390. change this by using the 'SORT_BY_NAME' keyword, which appears before a
  3391. wildcard pattern in parentheses (e.g., 'SORT_BY_NAME(.text*)'). When
  3392. the 'SORT_BY_NAME' keyword is used, the linker will sort the files or
  3393. sections into ascending order by name before placing them in the output
  3394. file.
  3395. 'SORT_BY_ALIGNMENT' is similar to 'SORT_BY_NAME'.
  3396. 'SORT_BY_ALIGNMENT' will sort sections into descending order of
  3397. alignment before placing them in the output file. Placing larger
  3398. alignments before smaller alignments can reduce the amount of padding
  3399. needed.
  3400. 'SORT_BY_INIT_PRIORITY' is also similar to 'SORT_BY_NAME'.
  3401. 'SORT_BY_INIT_PRIORITY' will sort sections into ascending numerical
  3402. order of the GCC init_priority attribute encoded in the section name
  3403. before placing them in the output file. In '.init_array.NNNNN' and
  3404. '.fini_array.NNNNN', 'NNNNN' is the init_priority. In '.ctors.NNNNN'
  3405. and '.dtors.NNNNN', 'NNNNN' is 65535 minus the init_priority.
  3406. 'SORT' is an alias for 'SORT_BY_NAME'.
  3407. When there are nested section sorting commands in linker script,
  3408. there can be at most 1 level of nesting for section sorting commands.
  3409. 1. 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT' (wildcard section pattern)).
  3410. It will sort the input sections by name first, then by alignment if
  3411. two sections have the same name.
  3412. 2. 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME' (wildcard section pattern)).
  3413. It will sort the input sections by alignment first, then by name if
  3414. two sections have the same alignment.
  3415. 3. 'SORT_BY_NAME' ('SORT_BY_NAME' (wildcard section pattern)) is
  3416. treated the same as 'SORT_BY_NAME' (wildcard section pattern).
  3417. 4. 'SORT_BY_ALIGNMENT' ('SORT_BY_ALIGNMENT' (wildcard section
  3418. pattern)) is treated the same as 'SORT_BY_ALIGNMENT' (wildcard
  3419. section pattern).
  3420. 5. All other nested section sorting commands are invalid.
  3421. When both command-line section sorting option and linker script
  3422. section sorting command are used, section sorting command always takes
  3423. precedence over the command-line option.
  3424. If the section sorting command in linker script isn't nested, the
  3425. command-line option will make the section sorting command to be treated
  3426. as nested sorting command.
  3427. 1. 'SORT_BY_NAME' (wildcard section pattern ) with '--sort-sections
  3428. alignment' is equivalent to 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT'
  3429. (wildcard section pattern)).
  3430. 2. 'SORT_BY_ALIGNMENT' (wildcard section pattern) with '--sort-section
  3431. name' is equivalent to 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME'
  3432. (wildcard section pattern)).
  3433. If the section sorting command in linker script is nested, the
  3434. command-line option will be ignored.
  3435. 'SORT_NONE' disables section sorting by ignoring the command-line
  3436. section sorting option.
  3437. If you ever get confused about where input sections are going, use
  3438. the '-M' linker option to generate a map file. The map file shows
  3439. precisely how input sections are mapped to output sections.
  3440. This example shows how wildcard patterns might be used to partition
  3441. files. This linker script directs the linker to place all '.text'
  3442. sections in '.text' and all '.bss' sections in '.bss'. The linker will
  3443. place the '.data' section from all files beginning with an upper case
  3444. character in '.DATA'; for all other files, the linker will place the
  3445. '.data' section in '.data'.
  3446. SECTIONS {
  3447. .text : { *(.text) }
  3448. .DATA : { [A-Z]*(.data) }
  3449. .data : { *(.data) }
  3450. .bss : { *(.bss) }
  3451. }
  3452. 
  3453. File: ld.info, Node: Input Section Common, Next: Input Section Keep, Prev: Input Section Wildcards, Up: Input Section
  3454. 3.6.4.3 Input Section for Common Symbols
  3455. ........................................
  3456. A special notation is needed for common symbols, because in many object
  3457. file formats common symbols do not have a particular input section. The
  3458. linker treats common symbols as though they are in an input section
  3459. named 'COMMON'.
  3460. You may use file names with the 'COMMON' section just as with any
  3461. other input sections. You can use this to place common symbols from a
  3462. particular input file in one section while common symbols from other
  3463. input files are placed in another section.
  3464. In most cases, common symbols in input files will be placed in the
  3465. '.bss' section in the output file. For example:
  3466. .bss { *(.bss) *(COMMON) }
  3467. Some object file formats have more than one type of common symbol.
  3468. For example, the MIPS ELF object file format distinguishes standard
  3469. common symbols and small common symbols. In this case, the linker will
  3470. use a different special section name for other types of common symbols.
  3471. In the case of MIPS ELF, the linker uses 'COMMON' for standard common
  3472. symbols and '.scommon' for small common symbols. This permits you to
  3473. map the different types of common symbols into memory at different
  3474. locations.
  3475. You will sometimes see '[COMMON]' in old linker scripts. This
  3476. notation is now considered obsolete. It is equivalent to '*(COMMON)'.
  3477. 
  3478. File: ld.info, Node: Input Section Keep, Next: Input Section Example, Prev: Input Section Common, Up: Input Section
  3479. 3.6.4.4 Input Section and Garbage Collection
  3480. ............................................
  3481. When link-time garbage collection is in use ('--gc-sections'), it is
  3482. often useful to mark sections that should not be eliminated. This is
  3483. accomplished by surrounding an input section's wildcard entry with
  3484. 'KEEP()', as in 'KEEP(*(.init))' or 'KEEP(SORT_BY_NAME(*)(.ctors))'.
  3485. 
  3486. File: ld.info, Node: Input Section Example, Prev: Input Section Keep, Up: Input Section
  3487. 3.6.4.5 Input Section Example
  3488. .............................
  3489. The following example is a complete linker script. It tells the linker
  3490. to read all of the sections from file 'all.o' and place them at the
  3491. start of output section 'outputa' which starts at location '0x10000'.
  3492. All of section '.input1' from file 'foo.o' follows immediately, in the
  3493. same output section. All of section '.input2' from 'foo.o' goes into
  3494. output section 'outputb', followed by section '.input1' from 'foo1.o'.
  3495. All of the remaining '.input1' and '.input2' sections from any files are
  3496. written to output section 'outputc'.
  3497. SECTIONS {
  3498. outputa 0x10000 :
  3499. {
  3500. all.o
  3501. foo.o (.input1)
  3502. }
  3503. outputb :
  3504. {
  3505. foo.o (.input2)
  3506. foo1.o (.input1)
  3507. }
  3508. outputc :
  3509. {
  3510. *(.input1)
  3511. *(.input2)
  3512. }
  3513. }
  3514. If an output section's name is the same as the input section's name
  3515. and is representable as a C identifier, then the linker will
  3516. automatically *note PROVIDE:: two symbols: __start_SECNAME and
  3517. __stop_SECNAME, where SECNAME is the name of the section. These
  3518. indicate the start address and end address of the output section
  3519. respectively. Note: most section names are not representable as C
  3520. identifiers because they contain a '.' character.
  3521. 
  3522. File: ld.info, Node: Output Section Data, Next: Output Section Keywords, Prev: Input Section, Up: SECTIONS
  3523. 3.6.5 Output Section Data
  3524. -------------------------
  3525. You can include explicit bytes of data in an output section by using
  3526. 'BYTE', 'SHORT', 'LONG', 'QUAD', or 'SQUAD' as an output section
  3527. command. Each keyword is followed by an expression in parentheses
  3528. providing the value to store (*note Expressions::). The value of the
  3529. expression is stored at the current value of the location counter.
  3530. The 'BYTE', 'SHORT', 'LONG', and 'QUAD' commands store one, two,
  3531. four, and eight bytes (respectively). After storing the bytes, the
  3532. location counter is incremented by the number of bytes stored.
  3533. For example, this will store the byte 1 followed by the four byte
  3534. value of the symbol 'addr':
  3535. BYTE(1)
  3536. LONG(addr)
  3537. When using a 64 bit host or target, 'QUAD' and 'SQUAD' are the same;
  3538. they both store an 8 byte, or 64 bit, value. When both host and target
  3539. are 32 bits, an expression is computed as 32 bits. In this case 'QUAD'
  3540. stores a 32 bit value zero extended to 64 bits, and 'SQUAD' stores a 32
  3541. bit value sign extended to 64 bits.
  3542. If the object file format of the output file has an explicit
  3543. endianness, which is the normal case, the value will be stored in that
  3544. endianness. When the object file format does not have an explicit
  3545. endianness, as is true of, for example, S-records, the value will be
  3546. stored in the endianness of the first input object file.
  3547. Note--these commands only work inside a section description and not
  3548. between them, so the following will produce an error from the linker:
  3549. SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }
  3550. whereas this will work:
  3551. SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }
  3552. You may use the 'FILL' command to set the fill pattern for the
  3553. current section. It is followed by an expression in parentheses. Any
  3554. otherwise unspecified regions of memory within the section (for example,
  3555. gaps left due to the required alignment of input sections) are filled
  3556. with the value of the expression, repeated as necessary. A 'FILL'
  3557. statement covers memory locations after the point at which it occurs in
  3558. the section definition; by including more than one 'FILL' statement, you
  3559. can have different fill patterns in different parts of an output
  3560. section.
  3561. This example shows how to fill unspecified regions of memory with the
  3562. value '0x90':
  3563. FILL(0x90909090)
  3564. The 'FILL' command is similar to the '=FILLEXP' output section
  3565. attribute, but it only affects the part of the section following the
  3566. 'FILL' command, rather than the entire section. If both are used, the
  3567. 'FILL' command takes precedence. *Note Output Section Fill::, for
  3568. details on the fill expression.
  3569. 
  3570. File: ld.info, Node: Output Section Keywords, Next: Output Section Discarding, Prev: Output Section Data, Up: SECTIONS
  3571. 3.6.6 Output Section Keywords
  3572. -----------------------------
  3573. There are a couple of keywords which can appear as output section
  3574. commands.
  3575. 'CREATE_OBJECT_SYMBOLS'
  3576. The command tells the linker to create a symbol for each input
  3577. file. The name of each symbol will be the name of the
  3578. corresponding input file. The section of each symbol will be the
  3579. output section in which the 'CREATE_OBJECT_SYMBOLS' command
  3580. appears.
  3581. This is conventional for the a.out object file format. It is not
  3582. normally used for any other object file format.
  3583. 'CONSTRUCTORS'
  3584. When linking using the a.out object file format, the linker uses an
  3585. unusual set construct to support C++ global constructors and
  3586. destructors. When linking object file formats which do not support
  3587. arbitrary sections, such as ECOFF and XCOFF, the linker will
  3588. automatically recognize C++ global constructors and destructors by
  3589. name. For these object file formats, the 'CONSTRUCTORS' command
  3590. tells the linker to place constructor information in the output
  3591. section where the 'CONSTRUCTORS' command appears. The
  3592. 'CONSTRUCTORS' command is ignored for other object file formats.
  3593. The symbol '__CTOR_LIST__' marks the start of the global
  3594. constructors, and the symbol '__CTOR_END__' marks the end.
  3595. Similarly, '__DTOR_LIST__' and '__DTOR_END__' mark the start and
  3596. end of the global destructors. The first word in the list is the
  3597. number of entries, followed by the address of each constructor or
  3598. destructor, followed by a zero word. The compiler must arrange to
  3599. actually run the code. For these object file formats GNU C++
  3600. normally calls constructors from a subroutine '__main'; a call to
  3601. '__main' is automatically inserted into the startup code for
  3602. 'main'. GNU C++ normally runs destructors either by using
  3603. 'atexit', or directly from the function 'exit'.
  3604. For object file formats such as 'COFF' or 'ELF' which support
  3605. arbitrary section names, GNU C++ will normally arrange to put the
  3606. addresses of global constructors and destructors into the '.ctors'
  3607. and '.dtors' sections. Placing the following sequence into your
  3608. linker script will build the sort of table which the GNU C++
  3609. runtime code expects to see.
  3610. __CTOR_LIST__ = .;
  3611. LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  3612. *(.ctors)
  3613. LONG(0)
  3614. __CTOR_END__ = .;
  3615. __DTOR_LIST__ = .;
  3616. LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
  3617. *(.dtors)
  3618. LONG(0)
  3619. __DTOR_END__ = .;
  3620. If you are using the GNU C++ support for initialization priority,
  3621. which provides some control over the order in which global
  3622. constructors are run, you must sort the constructors at link time
  3623. to ensure that they are executed in the correct order. When using
  3624. the 'CONSTRUCTORS' command, use 'SORT_BY_NAME(CONSTRUCTORS)'
  3625. instead. When using the '.ctors' and '.dtors' sections, use
  3626. '*(SORT_BY_NAME(.ctors))' and '*(SORT_BY_NAME(.dtors))' instead of
  3627. just '*(.ctors)' and '*(.dtors)'.
  3628. Normally the compiler and linker will handle these issues
  3629. automatically, and you will not need to concern yourself with them.
  3630. However, you may need to consider this if you are using C++ and
  3631. writing your own linker scripts.
  3632. 
  3633. File: ld.info, Node: Output Section Discarding, Next: Output Section Attributes, Prev: Output Section Keywords, Up: SECTIONS
  3634. 3.6.7 Output Section Discarding
  3635. -------------------------------
  3636. The linker will not normally create output sections with no contents.
  3637. This is for convenience when referring to input sections that may or may
  3638. not be present in any of the input files. For example:
  3639. .foo : { *(.foo) }
  3640. will only create a '.foo' section in the output file if there is a
  3641. '.foo' section in at least one input file, and if the input sections are
  3642. not all empty. Other link script directives that allocate space in an
  3643. output section will also create the output section. So too will
  3644. assignments to dot even if the assignment does not create space, except
  3645. for '. = 0', '. = . + 0', '. = sym', '. = . + sym' and '. = ALIGN (. !=
  3646. 0, expr, 1)' when 'sym' is an absolute symbol of value 0 defined in the
  3647. script. This allows you to force output of an empty section with '. =
  3648. .'.
  3649. The linker will ignore address assignments (*note Output Section
  3650. Address::) on discarded output sections, except when the linker script
  3651. defines symbols in the output section. In that case the linker will
  3652. obey the address assignments, possibly advancing dot even though the
  3653. section is discarded.
  3654. The special output section name '/DISCARD/' may be used to discard
  3655. input sections. Any input sections which are assigned to an output
  3656. section named '/DISCARD/' are not included in the output file.
  3657. This can be used to discard input sections marked with the ELF flag
  3658. 'SHF_GNU_RETAIN', which would otherwise have been saved from linker
  3659. garbage collection.
  3660. Note, sections that match the '/DISCARD/' output section will be
  3661. discarded even if they are in an ELF section group which has other
  3662. members which are not being discarded. This is deliberate. Discarding
  3663. takes precedence over grouping.
  3664. 
  3665. File: ld.info, Node: Output Section Attributes, Next: Overlay Description, Prev: Output Section Discarding, Up: SECTIONS
  3666. 3.6.8 Output Section Attributes
  3667. -------------------------------
  3668. We showed above that the full description of an output section looked
  3669. like this:
  3670. SECTION [ADDRESS] [(TYPE)] :
  3671. [AT(LMA)]
  3672. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3673. [SUBALIGN(SUBSECTION_ALIGN)]
  3674. [CONSTRAINT]
  3675. {
  3676. OUTPUT-SECTION-COMMAND
  3677. OUTPUT-SECTION-COMMAND
  3678. ...
  3679. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP]
  3680. We've already described SECTION, ADDRESS, and OUTPUT-SECTION-COMMAND.
  3681. In this section we will describe the remaining section attributes.
  3682. * Menu:
  3683. * Output Section Type:: Output section type
  3684. * Output Section LMA:: Output section LMA
  3685. * Forced Output Alignment:: Forced Output Alignment
  3686. * Forced Input Alignment:: Forced Input Alignment
  3687. * Output Section Constraint:: Output section constraint
  3688. * Output Section Region:: Output section region
  3689. * Output Section Phdr:: Output section phdr
  3690. * Output Section Fill:: Output section fill
  3691. 
  3692. File: ld.info, Node: Output Section Type, Next: Output Section LMA, Up: Output Section Attributes
  3693. 3.6.8.1 Output Section Type
  3694. ...........................
  3695. Each output section may have a type. The type is a keyword in
  3696. parentheses. The following types are defined:
  3697. 'NOLOAD'
  3698. The section should be marked as not loadable, so that it will not
  3699. be loaded into memory when the program is run.
  3700. 'DSECT'
  3701. 'COPY'
  3702. 'INFO'
  3703. 'OVERLAY'
  3704. These type names are supported for backward compatibility, and are
  3705. rarely used. They all have the same effect: the section should be
  3706. marked as not allocatable, so that no memory is allocated for the
  3707. section when the program is run.
  3708. The linker normally sets the attributes of an output section based on
  3709. the input sections which map into it. You can override this by using
  3710. the section type. For example, in the script sample below, the 'ROM'
  3711. section is addressed at memory location '0' and does not need to be
  3712. loaded when the program is run.
  3713. SECTIONS {
  3714. ROM 0 (NOLOAD) : { ... }
  3715. ...
  3716. }
  3717. 
  3718. File: ld.info, Node: Output Section LMA, Next: Forced Output Alignment, Prev: Output Section Type, Up: Output Section Attributes
  3719. 3.6.8.2 Output Section LMA
  3720. ..........................
  3721. Every section has a virtual address (VMA) and a load address (LMA); see
  3722. *note Basic Script Concepts::. The virtual address is specified by the
  3723. *note Output Section Address:: described earlier. The load address is
  3724. specified by the 'AT' or 'AT>' keywords. Specifying a load address is
  3725. optional.
  3726. The 'AT' keyword takes an expression as an argument. This specifies
  3727. the exact load address of the section. The 'AT>' keyword takes the name
  3728. of a memory region as an argument. *Note MEMORY::. The load address of
  3729. the section is set to the next free address in the region, aligned to
  3730. the section's alignment requirements.
  3731. If neither 'AT' nor 'AT>' is specified for an allocatable section,
  3732. the linker will use the following heuristic to determine the load
  3733. address:
  3734. * If the section has a specific VMA address, then this is used as the
  3735. LMA address as well.
  3736. * If the section is not allocatable then its LMA is set to its VMA.
  3737. * Otherwise if a memory region can be found that is compatible with
  3738. the current section, and this region contains at least one section,
  3739. then the LMA is set so the difference between the VMA and LMA is
  3740. the same as the difference between the VMA and LMA of the last
  3741. section in the located region.
  3742. * If no memory regions have been declared then a default region that
  3743. covers the entire address space is used in the previous step.
  3744. * If no suitable region could be found, or there was no previous
  3745. section then the LMA is set equal to the VMA.
  3746. This feature is designed to make it easy to build a ROM image. For
  3747. example, the following linker script creates three output sections: one
  3748. called '.text', which starts at '0x1000', one called '.mdata', which is
  3749. loaded at the end of the '.text' section even though its VMA is
  3750. '0x2000', and one called '.bss' to hold uninitialized data at address
  3751. '0x3000'. The symbol '_data' is defined with the value '0x2000', which
  3752. shows that the location counter holds the VMA value, not the LMA value.
  3753. SECTIONS
  3754. {
  3755. .text 0x1000 : { *(.text) _etext = . ; }
  3756. .mdata 0x2000 :
  3757. AT ( ADDR (.text) + SIZEOF (.text) )
  3758. { _data = . ; *(.data); _edata = . ; }
  3759. .bss 0x3000 :
  3760. { _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;}
  3761. }
  3762. The run-time initialization code for use with a program generated
  3763. with this linker script would include something like the following, to
  3764. copy the initialized data from the ROM image to its runtime address.
  3765. Notice how this code takes advantage of the symbols defined by the
  3766. linker script.
  3767. extern char _etext, _data, _edata, _bstart, _bend;
  3768. char *src = &_etext;
  3769. char *dst = &_data;
  3770. /* ROM has data at end of text; copy it. */
  3771. while (dst < &_edata)
  3772. *dst++ = *src++;
  3773. /* Zero bss. */
  3774. for (dst = &_bstart; dst< &_bend; dst++)
  3775. *dst = 0;
  3776. 
  3777. File: ld.info, Node: Forced Output Alignment, Next: Forced Input Alignment, Prev: Output Section LMA, Up: Output Section Attributes
  3778. 3.6.8.3 Forced Output Alignment
  3779. ...............................
  3780. You can increase an output section's alignment by using ALIGN. As an
  3781. alternative you can enforce that the difference between the VMA and LMA
  3782. remains intact throughout this output section with the ALIGN_WITH_INPUT
  3783. attribute.
  3784. 
  3785. File: ld.info, Node: Forced Input Alignment, Next: Output Section Constraint, Prev: Forced Output Alignment, Up: Output Section Attributes
  3786. 3.6.8.4 Forced Input Alignment
  3787. ..............................
  3788. You can force input section alignment within an output section by using
  3789. SUBALIGN. The value specified overrides any alignment given by input
  3790. sections, whether larger or smaller.
  3791. 
  3792. File: ld.info, Node: Output Section Constraint, Next: Output Section Region, Prev: Forced Input Alignment, Up: Output Section Attributes
  3793. 3.6.8.5 Output Section Constraint
  3794. .................................
  3795. You can specify that an output section should only be created if all of
  3796. its input sections are read-only or all of its input sections are
  3797. read-write by using the keyword 'ONLY_IF_RO' and 'ONLY_IF_RW'
  3798. respectively.
  3799. 
  3800. File: ld.info, Node: Output Section Region, Next: Output Section Phdr, Prev: Output Section Constraint, Up: Output Section Attributes
  3801. 3.6.8.6 Output Section Region
  3802. .............................
  3803. You can assign a section to a previously defined region of memory by
  3804. using '>REGION'. *Note MEMORY::.
  3805. Here is a simple example:
  3806. MEMORY { rom : ORIGIN = 0x1000, LENGTH = 0x1000 }
  3807. SECTIONS { ROM : { *(.text) } >rom }
  3808. 
  3809. File: ld.info, Node: Output Section Phdr, Next: Output Section Fill, Prev: Output Section Region, Up: Output Section Attributes
  3810. 3.6.8.7 Output Section Phdr
  3811. ...........................
  3812. You can assign a section to a previously defined program segment by
  3813. using ':PHDR'. *Note PHDRS::. If a section is assigned to one or more
  3814. segments, then all subsequent allocated sections will be assigned to
  3815. those segments as well, unless they use an explicitly ':PHDR' modifier.
  3816. You can use ':NONE' to tell the linker to not put the section in any
  3817. segment at all.
  3818. Here is a simple example:
  3819. PHDRS { text PT_LOAD ; }
  3820. SECTIONS { .text : { *(.text) } :text }
  3821. 
  3822. File: ld.info, Node: Output Section Fill, Prev: Output Section Phdr, Up: Output Section Attributes
  3823. 3.6.8.8 Output Section Fill
  3824. ...........................
  3825. You can set the fill pattern for an entire section by using '=FILLEXP'.
  3826. FILLEXP is an expression (*note Expressions::). Any otherwise
  3827. unspecified regions of memory within the output section (for example,
  3828. gaps left due to the required alignment of input sections) will be
  3829. filled with the value, repeated as necessary. If the fill expression is
  3830. a simple hex number, ie. a string of hex digit starting with '0x' and
  3831. without a trailing 'k' or 'M', then an arbitrarily long sequence of hex
  3832. digits can be used to specify the fill pattern; Leading zeros become
  3833. part of the pattern too. For all other cases, including extra
  3834. parentheses or a unary '+', the fill pattern is the four least
  3835. significant bytes of the value of the expression. In all cases, the
  3836. number is big-endian.
  3837. You can also change the fill value with a 'FILL' command in the
  3838. output section commands; (*note Output Section Data::).
  3839. Here is a simple example:
  3840. SECTIONS { .text : { *(.text) } =0x90909090 }
  3841. 
  3842. File: ld.info, Node: Overlay Description, Prev: Output Section Attributes, Up: SECTIONS
  3843. 3.6.9 Overlay Description
  3844. -------------------------
  3845. An overlay description provides an easy way to describe sections which
  3846. are to be loaded as part of a single memory image but are to be run at
  3847. the same memory address. At run time, some sort of overlay manager will
  3848. copy the overlaid sections in and out of the runtime memory address as
  3849. required, perhaps by simply manipulating addressing bits. This approach
  3850. can be useful, for example, when a certain region of memory is faster
  3851. than another.
  3852. Overlays are described using the 'OVERLAY' command. The 'OVERLAY'
  3853. command is used within a 'SECTIONS' command, like an output section
  3854. description. The full syntax of the 'OVERLAY' command is as follows:
  3855. OVERLAY [START] : [NOCROSSREFS] [AT ( LDADDR )]
  3856. {
  3857. SECNAME1
  3858. {
  3859. OUTPUT-SECTION-COMMAND
  3860. OUTPUT-SECTION-COMMAND
  3861. ...
  3862. } [:PHDR...] [=FILL]
  3863. SECNAME2
  3864. {
  3865. OUTPUT-SECTION-COMMAND
  3866. OUTPUT-SECTION-COMMAND
  3867. ...
  3868. } [:PHDR...] [=FILL]
  3869. ...
  3870. } [>REGION] [:PHDR...] [=FILL] [,]
  3871. Everything is optional except 'OVERLAY' (a keyword), and each section
  3872. must have a name (SECNAME1 and SECNAME2 above). The section definitions
  3873. within the 'OVERLAY' construct are identical to those within the general
  3874. 'SECTIONS' construct (*note SECTIONS::), except that no addresses and no
  3875. memory regions may be defined for sections within an 'OVERLAY'.
  3876. The comma at the end may be required if a FILL is used and the next
  3877. SECTIONS-COMMAND looks like a continuation of the expression.
  3878. The sections are all defined with the same starting address. The
  3879. load addresses of the sections are arranged such that they are
  3880. consecutive in memory starting at the load address used for the
  3881. 'OVERLAY' as a whole (as with normal section definitions, the load
  3882. address is optional, and defaults to the start address; the start
  3883. address is also optional, and defaults to the current value of the
  3884. location counter).
  3885. If the 'NOCROSSREFS' keyword is used, and there are any references
  3886. among the sections, the linker will report an error. Since the sections
  3887. all run at the same address, it normally does not make sense for one
  3888. section to refer directly to another. *Note NOCROSSREFS: Miscellaneous
  3889. Commands.
  3890. For each section within the 'OVERLAY', the linker automatically
  3891. provides two symbols. The symbol '__load_start_SECNAME' is defined as
  3892. the starting load address of the section. The symbol
  3893. '__load_stop_SECNAME' is defined as the final load address of the
  3894. section. Any characters within SECNAME which are not legal within C
  3895. identifiers are removed. C (or assembler) code may use these symbols to
  3896. move the overlaid sections around as necessary.
  3897. At the end of the overlay, the value of the location counter is set
  3898. to the start address of the overlay plus the size of the largest
  3899. section.
  3900. Here is an example. Remember that this would appear inside a
  3901. 'SECTIONS' construct.
  3902. OVERLAY 0x1000 : AT (0x4000)
  3903. {
  3904. .text0 { o1/*.o(.text) }
  3905. .text1 { o2/*.o(.text) }
  3906. }
  3907. This will define both '.text0' and '.text1' to start at address 0x1000.
  3908. '.text0' will be loaded at address 0x4000, and '.text1' will be loaded
  3909. immediately after '.text0'. The following symbols will be defined if
  3910. referenced: '__load_start_text0', '__load_stop_text0',
  3911. '__load_start_text1', '__load_stop_text1'.
  3912. C code to copy overlay '.text1' into the overlay area might look like
  3913. the following.
  3914. extern char __load_start_text1, __load_stop_text1;
  3915. memcpy ((char *) 0x1000, &__load_start_text1,
  3916. &__load_stop_text1 - &__load_start_text1);
  3917. Note that the 'OVERLAY' command is just syntactic sugar, since
  3918. everything it does can be done using the more basic commands. The above
  3919. example could have been written identically as follows.
  3920. .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
  3921. PROVIDE (__load_start_text0 = LOADADDR (.text0));
  3922. PROVIDE (__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0));
  3923. .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
  3924. PROVIDE (__load_start_text1 = LOADADDR (.text1));
  3925. PROVIDE (__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1));
  3926. . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
  3927. 
  3928. File: ld.info, Node: MEMORY, Next: PHDRS, Prev: SECTIONS, Up: Scripts
  3929. 3.7 MEMORY Command
  3930. ==================
  3931. The linker's default configuration permits allocation of all available
  3932. memory. You can override this by using the 'MEMORY' command.
  3933. The 'MEMORY' command describes the location and size of blocks of
  3934. memory in the target. You can use it to describe which memory regions
  3935. may be used by the linker, and which memory regions it must avoid. You
  3936. can then assign sections to particular memory regions. The linker will
  3937. set section addresses based on the memory regions, and will warn about
  3938. regions that become too full. The linker will not shuffle sections
  3939. around to fit into the available regions.
  3940. A linker script may contain many uses of the 'MEMORY' command,
  3941. however, all memory blocks defined are treated as if they were specified
  3942. inside a single 'MEMORY' command. The syntax for 'MEMORY' is:
  3943. MEMORY
  3944. {
  3945. NAME [(ATTR)] : ORIGIN = ORIGIN, LENGTH = LEN
  3946. ...
  3947. }
  3948. The NAME is a name used in the linker script to refer to the region.
  3949. The region name has no meaning outside of the linker script. Region
  3950. names are stored in a separate name space, and will not conflict with
  3951. symbol names, file names, or section names. Each memory region must
  3952. have a distinct name within the 'MEMORY' command. However you can add
  3953. later alias names to existing memory regions with the *note
  3954. REGION_ALIAS:: command.
  3955. The ATTR string is an optional list of attributes that specify
  3956. whether to use a particular memory region for an input section which is
  3957. not explicitly mapped in the linker script. As described in *note
  3958. SECTIONS::, if you do not specify an output section for some input
  3959. section, the linker will create an output section with the same name as
  3960. the input section. If you define region attributes, the linker will use
  3961. them to select the memory region for the output section that it creates.
  3962. The ATTR string must consist only of the following characters:
  3963. 'R'
  3964. Read-only section
  3965. 'W'
  3966. Read/write section
  3967. 'X'
  3968. Executable section
  3969. 'A'
  3970. Allocatable section
  3971. 'I'
  3972. Initialized section
  3973. 'L'
  3974. Same as 'I'
  3975. '!'
  3976. Invert the sense of any of the attributes that follow
  3977. If an unmapped section matches any of the listed attributes other
  3978. than '!', it will be placed in the memory region. The '!' attribute
  3979. reverses the test for the characters that follow, so that an unmapped
  3980. section will be placed in the memory region only if it does not match
  3981. any of the attributes listed afterwards. Thus an attribute string of
  3982. 'RW!X' will match any unmapped section that has either or both of the
  3983. 'R' and 'W' attributes, but only as long as the section does not also
  3984. have the 'X' attribute.
  3985. The ORIGIN is an numerical expression for the start address of the
  3986. memory region. The expression must evaluate to a constant and it cannot
  3987. involve any symbols. The keyword 'ORIGIN' may be abbreviated to 'org'
  3988. or 'o' (but not, for example, 'ORG').
  3989. The LEN is an expression for the size in bytes of the memory region.
  3990. As with the ORIGIN expression, the expression must be numerical only and
  3991. must evaluate to a constant. The keyword 'LENGTH' may be abbreviated to
  3992. 'len' or 'l'.
  3993. In the following example, we specify that there are two memory
  3994. regions available for allocation: one starting at '0' for 256 kilobytes,
  3995. and the other starting at '0x40000000' for four megabytes. The linker
  3996. will place into the 'rom' memory region every section which is not
  3997. explicitly mapped into a memory region, and is either read-only or
  3998. executable. The linker will place other sections which are not
  3999. explicitly mapped into a memory region into the 'ram' memory region.
  4000. MEMORY
  4001. {
  4002. rom (rx) : ORIGIN = 0, LENGTH = 256K
  4003. ram (!rx) : org = 0x40000000, l = 4M
  4004. }
  4005. Once you define a memory region, you can direct the linker to place
  4006. specific output sections into that memory region by using the '>REGION'
  4007. output section attribute. For example, if you have a memory region
  4008. named 'mem', you would use '>mem' in the output section definition.
  4009. *Note Output Section Region::. If no address was specified for the
  4010. output section, the linker will set the address to the next available
  4011. address within the memory region. If the combined output sections
  4012. directed to a memory region are too large for the region, the linker
  4013. will issue an error message.
  4014. It is possible to access the origin and length of a memory in an
  4015. expression via the 'ORIGIN(MEMORY)' and 'LENGTH(MEMORY)' functions:
  4016. _fstack = ORIGIN(ram) + LENGTH(ram) - 4;
  4017. 
  4018. File: ld.info, Node: PHDRS, Next: VERSION, Prev: MEMORY, Up: Scripts
  4019. 3.8 PHDRS Command
  4020. =================
  4021. The ELF object file format uses "program headers", also knows as
  4022. "segments". The program headers describe how the program should be
  4023. loaded into memory. You can print them out by using the 'objdump'
  4024. program with the '-p' option.
  4025. When you run an ELF program on a native ELF system, the system loader
  4026. reads the program headers in order to figure out how to load the
  4027. program. This will only work if the program headers are set correctly.
  4028. This manual does not describe the details of how the system loader
  4029. interprets program headers; for more information, see the ELF ABI.
  4030. The linker will create reasonable program headers by default.
  4031. However, in some cases, you may need to specify the program headers more
  4032. precisely. You may use the 'PHDRS' command for this purpose. When the
  4033. linker sees the 'PHDRS' command in the linker script, it will not create
  4034. any program headers other than the ones specified.
  4035. The linker only pays attention to the 'PHDRS' command when generating
  4036. an ELF output file. In other cases, the linker will simply ignore
  4037. 'PHDRS'.
  4038. This is the syntax of the 'PHDRS' command. The words 'PHDRS',
  4039. 'FILEHDR', 'AT', and 'FLAGS' are keywords.
  4040. PHDRS
  4041. {
  4042. NAME TYPE [ FILEHDR ] [ PHDRS ] [ AT ( ADDRESS ) ]
  4043. [ FLAGS ( FLAGS ) ] ;
  4044. }
  4045. The NAME is used only for reference in the 'SECTIONS' command of the
  4046. linker script. It is not put into the output file. Program header
  4047. names are stored in a separate name space, and will not conflict with
  4048. symbol names, file names, or section names. Each program header must
  4049. have a distinct name. The headers are processed in order and it is
  4050. usual for them to map to sections in ascending load address order.
  4051. Certain program header types describe segments of memory which the
  4052. system loader will load from the file. In the linker script, you
  4053. specify the contents of these segments by placing allocatable output
  4054. sections in the segments. You use the ':PHDR' output section attribute
  4055. to place a section in a particular segment. *Note Output Section
  4056. Phdr::.
  4057. It is normal to put certain sections in more than one segment. This
  4058. merely implies that one segment of memory contains another. You may
  4059. repeat ':PHDR', using it once for each segment which should contain the
  4060. section.
  4061. If you place a section in one or more segments using ':PHDR', then
  4062. the linker will place all subsequent allocatable sections which do not
  4063. specify ':PHDR' in the same segments. This is for convenience, since
  4064. generally a whole set of contiguous sections will be placed in a single
  4065. segment. You can use ':NONE' to override the default segment and tell
  4066. the linker to not put the section in any segment at all.
  4067. You may use the 'FILEHDR' and 'PHDRS' keywords after the program
  4068. header type to further describe the contents of the segment. The
  4069. 'FILEHDR' keyword means that the segment should include the ELF file
  4070. header. The 'PHDRS' keyword means that the segment should include the
  4071. ELF program headers themselves. If applied to a loadable segment
  4072. ('PT_LOAD'), all prior loadable segments must have one of these
  4073. keywords.
  4074. The TYPE may be one of the following. The numbers indicate the value
  4075. of the keyword.
  4076. 'PT_NULL' (0)
  4077. Indicates an unused program header.
  4078. 'PT_LOAD' (1)
  4079. Indicates that this program header describes a segment to be loaded
  4080. from the file.
  4081. 'PT_DYNAMIC' (2)
  4082. Indicates a segment where dynamic linking information can be found.
  4083. 'PT_INTERP' (3)
  4084. Indicates a segment where the name of the program interpreter may
  4085. be found.
  4086. 'PT_NOTE' (4)
  4087. Indicates a segment holding note information.
  4088. 'PT_SHLIB' (5)
  4089. A reserved program header type, defined but not specified by the
  4090. ELF ABI.
  4091. 'PT_PHDR' (6)
  4092. Indicates a segment where the program headers may be found.
  4093. 'PT_TLS' (7)
  4094. Indicates a segment containing thread local storage.
  4095. EXPRESSION
  4096. An expression giving the numeric type of the program header. This
  4097. may be used for types not defined above.
  4098. You can specify that a segment should be loaded at a particular
  4099. address in memory by using an 'AT' expression. This is identical to the
  4100. 'AT' command used as an output section attribute (*note Output Section
  4101. LMA::). The 'AT' command for a program header overrides the output
  4102. section attribute.
  4103. The linker will normally set the segment flags based on the sections
  4104. which comprise the segment. You may use the 'FLAGS' keyword to
  4105. explicitly specify the segment flags. The value of FLAGS must be an
  4106. integer. It is used to set the 'p_flags' field of the program header.
  4107. Here is an example of 'PHDRS'. This shows a typical set of program
  4108. headers used on a native ELF system.
  4109. PHDRS
  4110. {
  4111. headers PT_PHDR PHDRS ;
  4112. interp PT_INTERP ;
  4113. text PT_LOAD FILEHDR PHDRS ;
  4114. data PT_LOAD ;
  4115. dynamic PT_DYNAMIC ;
  4116. }
  4117. SECTIONS
  4118. {
  4119. . = SIZEOF_HEADERS;
  4120. .interp : { *(.interp) } :text :interp
  4121. .text : { *(.text) } :text
  4122. .rodata : { *(.rodata) } /* defaults to :text */
  4123. ...
  4124. . = . + 0x1000; /* move to a new page in memory */
  4125. .data : { *(.data) } :data
  4126. .dynamic : { *(.dynamic) } :data :dynamic
  4127. ...
  4128. }
  4129. 
  4130. File: ld.info, Node: VERSION, Next: Expressions, Prev: PHDRS, Up: Scripts
  4131. 3.9 VERSION Command
  4132. ===================
  4133. The linker supports symbol versions when using ELF. Symbol versions are
  4134. only useful when using shared libraries. The dynamic linker can use
  4135. symbol versions to select a specific version of a function when it runs
  4136. a program that may have been linked against an earlier version of the
  4137. shared library.
  4138. You can include a version script directly in the main linker script,
  4139. or you can supply the version script as an implicit linker script. You
  4140. can also use the '--version-script' linker option.
  4141. The syntax of the 'VERSION' command is simply
  4142. VERSION { version-script-commands }
  4143. The format of the version script commands is identical to that used
  4144. by Sun's linker in Solaris 2.5. The version script defines a tree of
  4145. version nodes. You specify the node names and interdependencies in the
  4146. version script. You can specify which symbols are bound to which
  4147. version nodes, and you can reduce a specified set of symbols to local
  4148. scope so that they are not globally visible outside of the shared
  4149. library.
  4150. The easiest way to demonstrate the version script language is with a
  4151. few examples.
  4152. VERS_1.1 {
  4153. global:
  4154. foo1;
  4155. local:
  4156. old*;
  4157. original*;
  4158. new*;
  4159. };
  4160. VERS_1.2 {
  4161. foo2;
  4162. } VERS_1.1;
  4163. VERS_2.0 {
  4164. bar1; bar2;
  4165. extern "C++" {
  4166. ns::*;
  4167. "f(int, double)";
  4168. };
  4169. } VERS_1.2;
  4170. This example version script defines three version nodes. The first
  4171. version node defined is 'VERS_1.1'; it has no other dependencies. The
  4172. script binds the symbol 'foo1' to 'VERS_1.1'. It reduces a number of
  4173. symbols to local scope so that they are not visible outside of the
  4174. shared library; this is done using wildcard patterns, so that any symbol
  4175. whose name begins with 'old', 'original', or 'new' is matched. The
  4176. wildcard patterns available are the same as those used in the shell when
  4177. matching filenames (also known as "globbing"). However, if you specify
  4178. the symbol name inside double quotes, then the name is treated as
  4179. literal, rather than as a glob pattern.
  4180. Next, the version script defines node 'VERS_1.2'. This node depends
  4181. upon 'VERS_1.1'. The script binds the symbol 'foo2' to the version node
  4182. 'VERS_1.2'.
  4183. Finally, the version script defines node 'VERS_2.0'. This node
  4184. depends upon 'VERS_1.2'. The scripts binds the symbols 'bar1' and
  4185. 'bar2' are bound to the version node 'VERS_2.0'.
  4186. When the linker finds a symbol defined in a library which is not
  4187. specifically bound to a version node, it will effectively bind it to an
  4188. unspecified base version of the library. You can bind all otherwise
  4189. unspecified symbols to a given version node by using 'global: *;'
  4190. somewhere in the version script. Note that it's slightly crazy to use
  4191. wildcards in a global spec except on the last version node. Global
  4192. wildcards elsewhere run the risk of accidentally adding symbols to the
  4193. set exported for an old version. That's wrong since older versions
  4194. ought to have a fixed set of symbols.
  4195. The names of the version nodes have no specific meaning other than
  4196. what they might suggest to the person reading them. The '2.0' version
  4197. could just as well have appeared in between '1.1' and '1.2'. However,
  4198. this would be a confusing way to write a version script.
  4199. Node name can be omitted, provided it is the only version node in the
  4200. version script. Such version script doesn't assign any versions to
  4201. symbols, only selects which symbols will be globally visible out and
  4202. which won't.
  4203. { global: foo; bar; local: *; };
  4204. When you link an application against a shared library that has
  4205. versioned symbols, the application itself knows which version of each
  4206. symbol it requires, and it also knows which version nodes it needs from
  4207. each shared library it is linked against. Thus at runtime, the dynamic
  4208. loader can make a quick check to make sure that the libraries you have
  4209. linked against do in fact supply all of the version nodes that the
  4210. application will need to resolve all of the dynamic symbols. In this
  4211. way it is possible for the dynamic linker to know with certainty that
  4212. all external symbols that it needs will be resolvable without having to
  4213. search for each symbol reference.
  4214. The symbol versioning is in effect a much more sophisticated way of
  4215. doing minor version checking that SunOS does. The fundamental problem
  4216. that is being addressed here is that typically references to external
  4217. functions are bound on an as-needed basis, and are not all bound when
  4218. the application starts up. If a shared library is out of date, a
  4219. required interface may be missing; when the application tries to use
  4220. that interface, it may suddenly and unexpectedly fail. With symbol
  4221. versioning, the user will get a warning when they start their program if
  4222. the libraries being used with the application are too old.
  4223. There are several GNU extensions to Sun's versioning approach. The
  4224. first of these is the ability to bind a symbol to a version node in the
  4225. source file where the symbol is defined instead of in the versioning
  4226. script. This was done mainly to reduce the burden on the library
  4227. maintainer. You can do this by putting something like:
  4228. __asm__(".symver original_foo,foo@VERS_1.1");
  4229. in the C source file. This renames the function 'original_foo' to be an
  4230. alias for 'foo' bound to the version node 'VERS_1.1'. The 'local:'
  4231. directive can be used to prevent the symbol 'original_foo' from being
  4232. exported. A '.symver' directive takes precedence over a version script.
  4233. The second GNU extension is to allow multiple versions of the same
  4234. function to appear in a given shared library. In this way you can make
  4235. an incompatible change to an interface without increasing the major
  4236. version number of the shared library, while still allowing applications
  4237. linked against the old interface to continue to function.
  4238. To do this, you must use multiple '.symver' directives in the source
  4239. file. Here is an example:
  4240. __asm__(".symver original_foo,foo@");
  4241. __asm__(".symver old_foo,foo@VERS_1.1");
  4242. __asm__(".symver old_foo1,foo@VERS_1.2");
  4243. __asm__(".symver new_foo,foo@@VERS_2.0");
  4244. In this example, 'foo@' represents the symbol 'foo' bound to the
  4245. unspecified base version of the symbol. The source file that contains
  4246. this example would define 4 C functions: 'original_foo', 'old_foo',
  4247. 'old_foo1', and 'new_foo'.
  4248. When you have multiple definitions of a given symbol, there needs to
  4249. be some way to specify a default version to which external references to
  4250. this symbol will be bound. You can do this with the 'foo@@VERS_2.0'
  4251. type of '.symver' directive. You can only declare one version of a
  4252. symbol as the default in this manner; otherwise you would effectively
  4253. have multiple definitions of the same symbol.
  4254. If you wish to bind a reference to a specific version of the symbol
  4255. within the shared library, you can use the aliases of convenience (i.e.,
  4256. 'old_foo'), or you can use the '.symver' directive to specifically bind
  4257. to an external version of the function in question.
  4258. You can also specify the language in the version script:
  4259. VERSION extern "lang" { version-script-commands }
  4260. The supported 'lang's are 'C', 'C++', and 'Java'. The linker will
  4261. iterate over the list of symbols at the link time and demangle them
  4262. according to 'lang' before matching them to the patterns specified in
  4263. 'version-script-commands'. The default 'lang' is 'C'.
  4264. Demangled names may contains spaces and other special characters. As
  4265. described above, you can use a glob pattern to match demangled names, or
  4266. you can use a double-quoted string to match the string exactly. In the
  4267. latter case, be aware that minor differences (such as differing
  4268. whitespace) between the version script and the demangler output will
  4269. cause a mismatch. As the exact string generated by the demangler might
  4270. change in the future, even if the mangled name does not, you should
  4271. check that all of your version directives are behaving as you expect
  4272. when you upgrade.
  4273. 
  4274. File: ld.info, Node: Expressions, Next: Implicit Linker Scripts, Prev: VERSION, Up: Scripts
  4275. 3.10 Expressions in Linker Scripts
  4276. ==================================
  4277. The syntax for expressions in the linker script language is identical to
  4278. that of C expressions. All expressions are evaluated as integers. All
  4279. expressions are evaluated in the same size, which is 32 bits if both the
  4280. host and target are 32 bits, and is otherwise 64 bits.
  4281. You can use and set symbol values in expressions.
  4282. The linker defines several special purpose builtin functions for use
  4283. in expressions.
  4284. * Menu:
  4285. * Constants:: Constants
  4286. * Symbolic Constants:: Symbolic constants
  4287. * Symbols:: Symbol Names
  4288. * Orphan Sections:: Orphan Sections
  4289. * Location Counter:: The Location Counter
  4290. * Operators:: Operators
  4291. * Evaluation:: Evaluation
  4292. * Expression Section:: The Section of an Expression
  4293. * Builtin Functions:: Builtin Functions
  4294. 
  4295. File: ld.info, Node: Constants, Next: Symbolic Constants, Up: Expressions
  4296. 3.10.1 Constants
  4297. ----------------
  4298. All constants are integers.
  4299. As in C, the linker considers an integer beginning with '0' to be
  4300. octal, and an integer beginning with '0x' or '0X' to be hexadecimal.
  4301. Alternatively the linker accepts suffixes of 'h' or 'H' for hexadecimal,
  4302. 'o' or 'O' for octal, 'b' or 'B' for binary and 'd' or 'D' for decimal.
  4303. Any integer value without a prefix or a suffix is considered to be
  4304. decimal.
  4305. In addition, you can use the suffixes 'K' and 'M' to scale a constant
  4306. by '1024' or '1024*1024' respectively. For example, the following all
  4307. refer to the same quantity:
  4308. _fourk_1 = 4K;
  4309. _fourk_2 = 4096;
  4310. _fourk_3 = 0x1000;
  4311. _fourk_4 = 10000o;
  4312. Note - the 'K' and 'M' suffixes cannot be used in conjunction with
  4313. the base suffixes mentioned above.
  4314. 
  4315. File: ld.info, Node: Symbolic Constants, Next: Symbols, Prev: Constants, Up: Expressions
  4316. 3.10.2 Symbolic Constants
  4317. -------------------------
  4318. It is possible to refer to target-specific constants via the use of the
  4319. 'CONSTANT(NAME)' operator, where NAME is one of:
  4320. 'MAXPAGESIZE'
  4321. The target's maximum page size.
  4322. 'COMMONPAGESIZE'
  4323. The target's default page size.
  4324. So for example:
  4325. .text ALIGN (CONSTANT (MAXPAGESIZE)) : { *(.text) }
  4326. will create a text section aligned to the largest page boundary
  4327. supported by the target.
  4328. 
  4329. File: ld.info, Node: Symbols, Next: Orphan Sections, Prev: Symbolic Constants, Up: Expressions
  4330. 3.10.3 Symbol Names
  4331. -------------------
  4332. Unless quoted, symbol names start with a letter, underscore, or period
  4333. and may include letters, digits, underscores, periods, and hyphens.
  4334. Unquoted symbol names must not conflict with any keywords. You can
  4335. specify a symbol which contains odd characters or has the same name as a
  4336. keyword by surrounding the symbol name in double quotes:
  4337. "SECTION" = 9;
  4338. "with a space" = "also with a space" + 10;
  4339. Since symbols can contain many non-alphabetic characters, it is
  4340. safest to delimit symbols with spaces. For example, 'A-B' is one
  4341. symbol, whereas 'A - B' is an expression involving subtraction.
  4342. 
  4343. File: ld.info, Node: Orphan Sections, Next: Location Counter, Prev: Symbols, Up: Expressions
  4344. 3.10.4 Orphan Sections
  4345. ----------------------
  4346. Orphan sections are sections present in the input files which are not
  4347. explicitly placed into the output file by the linker script. The linker
  4348. will still copy these sections into the output file by either finding,
  4349. or creating a suitable output section in which to place the orphaned
  4350. input section.
  4351. If the name of an orphaned input section exactly matches the name of
  4352. an existing output section, then the orphaned input section will be
  4353. placed at the end of that output section.
  4354. If there is no output section with a matching name then new output
  4355. sections will be created. Each new output section will have the same
  4356. name as the orphan section placed within it. If there are multiple
  4357. orphan sections with the same name, these will all be combined into one
  4358. new output section.
  4359. If new output sections are created to hold orphaned input sections,
  4360. then the linker must decide where to place these new output sections in
  4361. relation to existing output sections. On most modern targets, the
  4362. linker attempts to place orphan sections after sections of the same
  4363. attribute, such as code vs data, loadable vs non-loadable, etc. If no
  4364. sections with matching attributes are found, or your target lacks this
  4365. support, the orphan section is placed at the end of the file.
  4366. The command-line options '--orphan-handling' and '--unique' (*note
  4367. Command-line Options: Options.) can be used to control which output
  4368. sections an orphan is placed in.
  4369. 
  4370. File: ld.info, Node: Location Counter, Next: Operators, Prev: Orphan Sections, Up: Expressions
  4371. 3.10.5 The Location Counter
  4372. ---------------------------
  4373. The special linker variable "dot" '.' always contains the current output
  4374. location counter. Since the '.' always refers to a location in an
  4375. output section, it may only appear in an expression within a 'SECTIONS'
  4376. command. The '.' symbol may appear anywhere that an ordinary symbol is
  4377. allowed in an expression.
  4378. Assigning a value to '.' will cause the location counter to be moved.
  4379. This may be used to create holes in the output section. The location
  4380. counter may not be moved backwards inside an output section, and may not
  4381. be moved backwards outside of an output section if so doing creates
  4382. areas with overlapping LMAs.
  4383. SECTIONS
  4384. {
  4385. output :
  4386. {
  4387. file1(.text)
  4388. . = . + 1000;
  4389. file2(.text)
  4390. . += 1000;
  4391. file3(.text)
  4392. } = 0x12345678;
  4393. }
  4394. In the previous example, the '.text' section from 'file1' is located at
  4395. the beginning of the output section 'output'. It is followed by a 1000
  4396. byte gap. Then the '.text' section from 'file2' appears, also with a
  4397. 1000 byte gap following before the '.text' section from 'file3'. The
  4398. notation '= 0x12345678' specifies what data to write in the gaps (*note
  4399. Output Section Fill::).
  4400. Note: '.' actually refers to the byte offset from the start of the
  4401. current containing object. Normally this is the 'SECTIONS' statement,
  4402. whose start address is 0, hence '.' can be used as an absolute address.
  4403. If '.' is used inside a section description however, it refers to the
  4404. byte offset from the start of that section, not an absolute address.
  4405. Thus in a script like this:
  4406. SECTIONS
  4407. {
  4408. . = 0x100
  4409. .text: {
  4410. *(.text)
  4411. . = 0x200
  4412. }
  4413. . = 0x500
  4414. .data: {
  4415. *(.data)
  4416. . += 0x600
  4417. }
  4418. }
  4419. The '.text' section will be assigned a starting address of 0x100 and
  4420. a size of exactly 0x200 bytes, even if there is not enough data in the
  4421. '.text' input sections to fill this area. (If there is too much data,
  4422. an error will be produced because this would be an attempt to move '.'
  4423. backwards). The '.data' section will start at 0x500 and it will have an
  4424. extra 0x600 bytes worth of space after the end of the values from the
  4425. '.data' input sections and before the end of the '.data' output section
  4426. itself.
  4427. Setting symbols to the value of the location counter outside of an
  4428. output section statement can result in unexpected values if the linker
  4429. needs to place orphan sections. For example, given the following:
  4430. SECTIONS
  4431. {
  4432. start_of_text = . ;
  4433. .text: { *(.text) }
  4434. end_of_text = . ;
  4435. start_of_data = . ;
  4436. .data: { *(.data) }
  4437. end_of_data = . ;
  4438. }
  4439. If the linker needs to place some input section, e.g. '.rodata', not
  4440. mentioned in the script, it might choose to place that section between
  4441. '.text' and '.data'. You might think the linker should place '.rodata'
  4442. on the blank line in the above script, but blank lines are of no
  4443. particular significance to the linker. As well, the linker doesn't
  4444. associate the above symbol names with their sections. Instead, it
  4445. assumes that all assignments or other statements belong to the previous
  4446. output section, except for the special case of an assignment to '.'.
  4447. I.e., the linker will place the orphan '.rodata' section as if the
  4448. script was written as follows:
  4449. SECTIONS
  4450. {
  4451. start_of_text = . ;
  4452. .text: { *(.text) }
  4453. end_of_text = . ;
  4454. start_of_data = . ;
  4455. .rodata: { *(.rodata) }
  4456. .data: { *(.data) }
  4457. end_of_data = . ;
  4458. }
  4459. This may or may not be the script author's intention for the value of
  4460. 'start_of_data'. One way to influence the orphan section placement is
  4461. to assign the location counter to itself, as the linker assumes that an
  4462. assignment to '.' is setting the start address of a following output
  4463. section and thus should be grouped with that section. So you could
  4464. write:
  4465. SECTIONS
  4466. {
  4467. start_of_text = . ;
  4468. .text: { *(.text) }
  4469. end_of_text = . ;
  4470. . = . ;
  4471. start_of_data = . ;
  4472. .data: { *(.data) }
  4473. end_of_data = . ;
  4474. }
  4475. Now, the orphan '.rodata' section will be placed between
  4476. 'end_of_text' and 'start_of_data'.
  4477. 
  4478. File: ld.info, Node: Operators, Next: Evaluation, Prev: Location Counter, Up: Expressions
  4479. 3.10.6 Operators
  4480. ----------------
  4481. The linker recognizes the standard C set of arithmetic operators, with
  4482. the standard bindings and precedence levels:
  4483. precedence associativity Operators Notes
  4484. (highest)
  4485. 1 left ! - ~ (1)
  4486. 2 left * / %
  4487. 3 left + -
  4488. 4 left >> <<
  4489. 5 left == != > < <= >=
  4490. 6 left &
  4491. 7 left |
  4492. 8 left &&
  4493. 9 left ||
  4494. 10 right ? :
  4495. 11 right &= += -= *= /= (2)
  4496. (lowest)
  4497. Notes: (1) Prefix operators (2) *Note Assignments::.
  4498. 
  4499. File: ld.info, Node: Evaluation, Next: Expression Section, Prev: Operators, Up: Expressions
  4500. 3.10.7 Evaluation
  4501. -----------------
  4502. The linker evaluates expressions lazily. It only computes the value of
  4503. an expression when absolutely necessary.
  4504. The linker needs some information, such as the value of the start
  4505. address of the first section, and the origins and lengths of memory
  4506. regions, in order to do any linking at all. These values are computed
  4507. as soon as possible when the linker reads in the linker script.
  4508. However, other values (such as symbol values) are not known or needed
  4509. until after storage allocation. Such values are evaluated later, when
  4510. other information (such as the sizes of output sections) is available
  4511. for use in the symbol assignment expression.
  4512. The sizes of sections cannot be known until after allocation, so
  4513. assignments dependent upon these are not performed until after
  4514. allocation.
  4515. Some expressions, such as those depending upon the location counter
  4516. '.', must be evaluated during section allocation.
  4517. If the result of an expression is required, but the value is not
  4518. available, then an error results. For example, a script like the
  4519. following
  4520. SECTIONS
  4521. {
  4522. .text 9+this_isnt_constant :
  4523. { *(.text) }
  4524. }
  4525. will cause the error message 'non constant expression for initial
  4526. address'.
  4527. 
  4528. File: ld.info, Node: Expression Section, Next: Builtin Functions, Prev: Evaluation, Up: Expressions
  4529. 3.10.8 The Section of an Expression
  4530. -----------------------------------
  4531. Addresses and symbols may be section relative, or absolute. A section
  4532. relative symbol is relocatable. If you request relocatable output using
  4533. the '-r' option, a further link operation may change the value of a
  4534. section relative symbol. On the other hand, an absolute symbol will
  4535. retain the same value throughout any further link operations.
  4536. Some terms in linker expressions are addresses. This is true of
  4537. section relative symbols and for builtin functions that return an
  4538. address, such as 'ADDR', 'LOADADDR', 'ORIGIN' and 'SEGMENT_START'.
  4539. Other terms are simply numbers, or are builtin functions that return a
  4540. non-address value, such as 'LENGTH'. One complication is that unless
  4541. you set 'LD_FEATURE ("SANE_EXPR")' (*note Miscellaneous Commands::),
  4542. numbers and absolute symbols are treated differently depending on their
  4543. location, for compatibility with older versions of 'ld'. Expressions
  4544. appearing outside an output section definition treat all numbers as
  4545. absolute addresses. Expressions appearing inside an output section
  4546. definition treat absolute symbols as numbers. If 'LD_FEATURE
  4547. ("SANE_EXPR")' is given, then absolute symbols and numbers are simply
  4548. treated as numbers everywhere.
  4549. In the following simple example,
  4550. SECTIONS
  4551. {
  4552. . = 0x100;
  4553. __executable_start = 0x100;
  4554. .data :
  4555. {
  4556. . = 0x10;
  4557. __data_start = 0x10;
  4558. *(.data)
  4559. }
  4560. ...
  4561. }
  4562. both '.' and '__executable_start' are set to the absolute address
  4563. 0x100 in the first two assignments, then both '.' and '__data_start' are
  4564. set to 0x10 relative to the '.data' section in the second two
  4565. assignments.
  4566. For expressions involving numbers, relative addresses and absolute
  4567. addresses, ld follows these rules to evaluate terms:
  4568. * Unary operations on an absolute address or number, and binary
  4569. operations on two absolute addresses or two numbers, or between one
  4570. absolute address and a number, apply the operator to the value(s).
  4571. * Unary operations on a relative address, and binary operations on
  4572. two relative addresses in the same section or between one relative
  4573. address and a number, apply the operator to the offset part of the
  4574. address(es).
  4575. * Other binary operations, that is, between two relative addresses
  4576. not in the same section, or between a relative address and an
  4577. absolute address, first convert any non-absolute term to an
  4578. absolute address before applying the operator.
  4579. The result section of each sub-expression is as follows:
  4580. * An operation involving only numbers results in a number.
  4581. * The result of comparisons, '&&' and '||' is also a number.
  4582. * The result of other binary arithmetic and logical operations on two
  4583. relative addresses in the same section or two absolute addresses
  4584. (after above conversions) is also a number when 'LD_FEATURE
  4585. ("SANE_EXPR")' or inside an output section definition but an
  4586. absolute address otherwise.
  4587. * The result of other operations on relative addresses or one
  4588. relative address and a number, is a relative address in the same
  4589. section as the relative operand(s).
  4590. * The result of other operations on absolute addresses (after above
  4591. conversions) is an absolute address.
  4592. You can use the builtin function 'ABSOLUTE' to force an expression to
  4593. be absolute when it would otherwise be relative. For example, to create
  4594. an absolute symbol set to the address of the end of the output section
  4595. '.data':
  4596. SECTIONS
  4597. {
  4598. .data : { *(.data) _edata = ABSOLUTE(.); }
  4599. }
  4600. If 'ABSOLUTE' were not used, '_edata' would be relative to the '.data'
  4601. section.
  4602. Using 'LOADADDR' also forces an expression absolute, since this
  4603. particular builtin function returns an absolute address.
  4604. 
  4605. File: ld.info, Node: Builtin Functions, Prev: Expression Section, Up: Expressions
  4606. 3.10.9 Builtin Functions
  4607. ------------------------
  4608. The linker script language includes a number of builtin functions for
  4609. use in linker script expressions.
  4610. 'ABSOLUTE(EXP)'
  4611. Return the absolute (non-relocatable, as opposed to non-negative)
  4612. value of the expression EXP. Primarily useful to assign an
  4613. absolute value to a symbol within a section definition, where
  4614. symbol values are normally section relative. *Note Expression
  4615. Section::.
  4616. 'ADDR(SECTION)'
  4617. Return the address (VMA) of the named SECTION. Your script must
  4618. previously have defined the location of that section. In the
  4619. following example, 'start_of_output_1', 'symbol_1' and 'symbol_2'
  4620. are assigned equivalent values, except that 'symbol_1' will be
  4621. relative to the '.output1' section while the other two will be
  4622. absolute:
  4623. SECTIONS { ...
  4624. .output1 :
  4625. {
  4626. start_of_output_1 = ABSOLUTE(.);
  4627. ...
  4628. }
  4629. .output :
  4630. {
  4631. symbol_1 = ADDR(.output1);
  4632. symbol_2 = start_of_output_1;
  4633. }
  4634. ... }
  4635. 'ALIGN(ALIGN)'
  4636. 'ALIGN(EXP,ALIGN)'
  4637. Return the location counter ('.') or arbitrary expression aligned
  4638. to the next ALIGN boundary. The single operand 'ALIGN' doesn't
  4639. change the value of the location counter--it just does arithmetic
  4640. on it. The two operand 'ALIGN' allows an arbitrary expression to
  4641. be aligned upwards ('ALIGN(ALIGN)' is equivalent to
  4642. 'ALIGN(ABSOLUTE(.), ALIGN)').
  4643. Here is an example which aligns the output '.data' section to the
  4644. next '0x2000' byte boundary after the preceding section and sets a
  4645. variable within the section to the next '0x8000' boundary after the
  4646. input sections:
  4647. SECTIONS { ...
  4648. .data ALIGN(0x2000): {
  4649. *(.data)
  4650. variable = ALIGN(0x8000);
  4651. }
  4652. ... }
  4653. The first use of 'ALIGN' in this example specifies the location of
  4654. a section because it is used as the optional ADDRESS attribute of a
  4655. section definition (*note Output Section Address::). The second
  4656. use of 'ALIGN' is used to defines the value of a symbol.
  4657. The builtin function 'NEXT' is closely related to 'ALIGN'.
  4658. 'ALIGNOF(SECTION)'
  4659. Return the alignment in bytes of the named SECTION, if that section
  4660. has been allocated. If the section has not been allocated when
  4661. this is evaluated, the linker will report an error. In the
  4662. following example, the alignment of the '.output' section is stored
  4663. as the first value in that section.
  4664. SECTIONS{ ...
  4665. .output {
  4666. LONG (ALIGNOF (.output))
  4667. ...
  4668. }
  4669. ... }
  4670. 'BLOCK(EXP)'
  4671. This is a synonym for 'ALIGN', for compatibility with older linker
  4672. scripts. It is most often seen when setting the address of an
  4673. output section.
  4674. 'DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE)'
  4675. This is equivalent to either
  4676. (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1)))
  4677. or
  4678. (ALIGN(MAXPAGESIZE)
  4679. + ((. + COMMONPAGESIZE - 1) & (MAXPAGESIZE - COMMONPAGESIZE)))
  4680. depending on whether the latter uses fewer COMMONPAGESIZE sized
  4681. pages for the data segment (area between the result of this
  4682. expression and 'DATA_SEGMENT_END') than the former or not. If the
  4683. latter form is used, it means COMMONPAGESIZE bytes of runtime
  4684. memory will be saved at the expense of up to COMMONPAGESIZE wasted
  4685. bytes in the on-disk file.
  4686. This expression can only be used directly in 'SECTIONS' commands,
  4687. not in any output section descriptions and only once in the linker
  4688. script. COMMONPAGESIZE should be less or equal to MAXPAGESIZE and
  4689. should be the system page size the object wants to be optimized for
  4690. while still running on system page sizes up to MAXPAGESIZE. Note
  4691. however that '-z relro' protection will not be effective if the
  4692. system page size is larger than COMMONPAGESIZE.
  4693. Example:
  4694. . = DATA_SEGMENT_ALIGN(0x10000, 0x2000);
  4695. 'DATA_SEGMENT_END(EXP)'
  4696. This defines the end of data segment for 'DATA_SEGMENT_ALIGN'
  4697. evaluation purposes.
  4698. . = DATA_SEGMENT_END(.);
  4699. 'DATA_SEGMENT_RELRO_END(OFFSET, EXP)'
  4700. This defines the end of the 'PT_GNU_RELRO' segment when '-z relro'
  4701. option is used. When '-z relro' option is not present,
  4702. 'DATA_SEGMENT_RELRO_END' does nothing, otherwise
  4703. 'DATA_SEGMENT_ALIGN' is padded so that EXP + OFFSET is aligned to
  4704. the COMMONPAGESIZE argument given to 'DATA_SEGMENT_ALIGN'. If
  4705. present in the linker script, it must be placed between
  4706. 'DATA_SEGMENT_ALIGN' and 'DATA_SEGMENT_END'. Evaluates to the
  4707. second argument plus any padding needed at the end of the
  4708. 'PT_GNU_RELRO' segment due to section alignment.
  4709. . = DATA_SEGMENT_RELRO_END(24, .);
  4710. 'DEFINED(SYMBOL)'
  4711. Return 1 if SYMBOL is in the linker global symbol table and is
  4712. defined before the statement using DEFINED in the script, otherwise
  4713. return 0. You can use this function to provide default values for
  4714. symbols. For example, the following script fragment shows how to
  4715. set a global symbol 'begin' to the first location in the '.text'
  4716. section--but if a symbol called 'begin' already existed, its value
  4717. is preserved:
  4718. SECTIONS { ...
  4719. .text : {
  4720. begin = DEFINED(begin) ? begin : . ;
  4721. ...
  4722. }
  4723. ...
  4724. }
  4725. 'LENGTH(MEMORY)'
  4726. Return the length of the memory region named MEMORY.
  4727. 'LOADADDR(SECTION)'
  4728. Return the absolute LMA of the named SECTION. (*note Output
  4729. Section LMA::).
  4730. 'LOG2CEIL(EXP)'
  4731. Return the binary logarithm of EXP rounded towards infinity.
  4732. 'LOG2CEIL(0)' returns 0.
  4733. 'MAX(EXP1, EXP2)'
  4734. Returns the maximum of EXP1 and EXP2.
  4735. 'MIN(EXP1, EXP2)'
  4736. Returns the minimum of EXP1 and EXP2.
  4737. 'NEXT(EXP)'
  4738. Return the next unallocated address that is a multiple of EXP.
  4739. This function is closely related to 'ALIGN(EXP)'; unless you use
  4740. the 'MEMORY' command to define discontinuous memory for the output
  4741. file, the two functions are equivalent.
  4742. 'ORIGIN(MEMORY)'
  4743. Return the origin of the memory region named MEMORY.
  4744. 'SEGMENT_START(SEGMENT, DEFAULT)'
  4745. Return the base address of the named SEGMENT. If an explicit value
  4746. has already been given for this segment (with a command-line '-T'
  4747. option) then that value will be returned otherwise the value will
  4748. be DEFAULT. At present, the '-T' command-line option can only be
  4749. used to set the base address for the "text", "data", and "bss"
  4750. sections, but you can use 'SEGMENT_START' with any segment name.
  4751. 'SIZEOF(SECTION)'
  4752. Return the size in bytes of the named SECTION, if that section has
  4753. been allocated. If the section has not been allocated when this is
  4754. evaluated, the linker will report an error. In the following
  4755. example, 'symbol_1' and 'symbol_2' are assigned identical values:
  4756. SECTIONS{ ...
  4757. .output {
  4758. .start = . ;
  4759. ...
  4760. .end = . ;
  4761. }
  4762. symbol_1 = .end - .start ;
  4763. symbol_2 = SIZEOF(.output);
  4764. ... }
  4765. 'SIZEOF_HEADERS'
  4766. 'sizeof_headers'
  4767. Return the size in bytes of the output file's headers. This is
  4768. information which appears at the start of the output file. You can
  4769. use this number when setting the start address of the first
  4770. section, if you choose, to facilitate paging.
  4771. When producing an ELF output file, if the linker script uses the
  4772. 'SIZEOF_HEADERS' builtin function, the linker must compute the
  4773. number of program headers before it has determined all the section
  4774. addresses and sizes. If the linker later discovers that it needs
  4775. additional program headers, it will report an error 'not enough
  4776. room for program headers'. To avoid this error, you must avoid
  4777. using the 'SIZEOF_HEADERS' function, or you must rework your linker
  4778. script to avoid forcing the linker to use additional program
  4779. headers, or you must define the program headers yourself using the
  4780. 'PHDRS' command (*note PHDRS::).
  4781. 
  4782. File: ld.info, Node: Implicit Linker Scripts, Prev: Expressions, Up: Scripts
  4783. 3.11 Implicit Linker Scripts
  4784. ============================
  4785. If you specify a linker input file which the linker can not recognize as
  4786. an object file or an archive file, it will try to read the file as a
  4787. linker script. If the file can not be parsed as a linker script, the
  4788. linker will report an error.
  4789. An implicit linker script will not replace the default linker script.
  4790. Typically an implicit linker script would contain only symbol
  4791. assignments, or the 'INPUT', 'GROUP', or 'VERSION' commands.
  4792. Any input files read because of an implicit linker script will be
  4793. read at the position in the command line where the implicit linker
  4794. script was read. This can affect archive searching.
  4795. 
  4796. File: ld.info, Node: Plugins, Next: Machine Dependent, Prev: Scripts, Up: Top
  4797. 4 Linker Plugins
  4798. ****************
  4799. The linker can use dynamically loaded plugins to modify its behavior.
  4800. For example, the link-time optimization feature that some compilers
  4801. support is implemented with a linker plugin.
  4802. Currently there is only one plugin shipped by default, but more may
  4803. be added here later.
  4804. * Menu:
  4805. * libdep Plugin:: Static Library Dependencies Plugin
  4806. 
  4807. File: ld.info, Node: libdep Plugin, Up: Plugins
  4808. 4.1 Static Library Dependencies Plugin
  4809. ======================================
  4810. Originally, static libraries were contained in an archive file
  4811. consisting just of a collection of relocatable object files. Later they
  4812. evolved to optionally include a symbol table, to assist in finding the
  4813. needed objects within a library. There their evolution ended, and
  4814. dynamic libraries rose to ascendance.
  4815. One useful feature of dynamic libraries was that, more than just
  4816. collecting multiple objects into a single file, they also included a
  4817. list of their dependencies, such that one could specify just the name of
  4818. a single dynamic library at link time, and all of its dependencies would
  4819. be implicitly referenced as well. But static libraries lacked this
  4820. feature, so if a link invocation was switched from using dynamic
  4821. libraries to static libraries, the link command would usually fail
  4822. unless it was rewritten to explicitly list the dependencies of the
  4823. static library.
  4824. The GNU 'ar' utility now supports a '--record-libdeps' option to
  4825. embed dependency lists into static libraries as well, and the 'libdep'
  4826. plugin may be used to read this dependency information at link time.
  4827. The dependency information is stored as a single string, carrying '-l'
  4828. and '-L' arguments as they would normally appear in a linker command
  4829. line. As such, the information can be written with any text utility and
  4830. stored into any archive, even if GNU 'ar' is not being used to create
  4831. the archive. The information is stored in an archive member named
  4832. '__.LIBDEP'.
  4833. For example, given a library 'libssl.a' that depends on another
  4834. library 'libcrypto.a' which may be found in '/usr/local/lib', the
  4835. '__.LIBDEP' member of 'libssl.a' would contain
  4836. -L/usr/local/lib -lcrypto
  4837. 
  4838. File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Plugins, Up: Top
  4839. 5 Machine Dependent Features
  4840. ****************************
  4841. 'ld' has additional features on some platforms; the following sections
  4842. describe them. Machines where 'ld' has no additional functionality are
  4843. not listed.
  4844. * Menu:
  4845. * H8/300:: 'ld' and the H8/300
  4846. * M68HC11/68HC12:: 'ld' and the Motorola 68HC11 and 68HC12 families
  4847. * ARM:: 'ld' and the ARM family
  4848. * HPPA ELF32:: 'ld' and HPPA 32-bit ELF
  4849. * M68K:: 'ld' and the Motorola 68K family
  4850. * MIPS:: 'ld' and the MIPS family
  4851. * MMIX:: 'ld' and MMIX
  4852. * MSP430:: 'ld' and MSP430
  4853. * NDS32:: 'ld' and NDS32
  4854. * Nios II:: 'ld' and the Altera Nios II
  4855. * PowerPC ELF32:: 'ld' and PowerPC 32-bit ELF Support
  4856. * PowerPC64 ELF64:: 'ld' and PowerPC64 64-bit ELF Support
  4857. * S/390 ELF:: 'ld' and S/390 ELF Support
  4858. * SPU ELF:: 'ld' and SPU ELF Support
  4859. * TI COFF:: 'ld' and TI COFF
  4860. * WIN32:: 'ld' and WIN32 (cygwin/mingw)
  4861. * Xtensa:: 'ld' and Xtensa Processors
  4862. 
  4863. File: ld.info, Node: H8/300, Next: M68HC11/68HC12, Up: Machine Dependent
  4864. 5.1 'ld' and the H8/300
  4865. =======================
  4866. For the H8/300, 'ld' can perform these global optimizations when you
  4867. specify the '--relax' command-line option.
  4868. _relaxing address modes_
  4869. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4870. within eight bits, and turns them into eight-bit program-counter
  4871. relative 'bsr' and 'bra' instructions, respectively.
  4872. _synthesizing instructions_
  4873. 'ld' finds all 'mov.b' instructions which use the sixteen-bit
  4874. absolute address form, but refer to the top page of memory, and
  4875. changes them to use the eight-bit address form. (That is: the
  4876. linker turns 'mov.b '@'AA:16' into 'mov.b '@'AA:8' whenever the
  4877. address AA is in the top page of memory).
  4878. 'ld' finds all 'mov' instructions which use the register indirect
  4879. with 32-bit displacement addressing mode, but use a small
  4880. displacement inside 16-bit displacement range, and changes them to
  4881. use the 16-bit displacement form. (That is: the linker turns
  4882. 'mov.b '@'D:32,ERx' into 'mov.b '@'D:16,ERx' whenever the
  4883. displacement D is in the 16 bit signed integer range. Only
  4884. implemented in ELF-format ld).
  4885. _bit manipulation instructions_
  4886. 'ld' finds all bit manipulation instructions like 'band, bclr,
  4887. biand, bild, bior, bist, bixor, bld, bnot, bor, bset, bst, btst,
  4888. bxor' which use 32 bit and 16 bit absolute address form, but refer
  4889. to the top page of memory, and changes them to use the 8 bit
  4890. address form. (That is: the linker turns 'bset #xx:3,'@'AA:32'
  4891. into 'bset #xx:3,'@'AA:8' whenever the address AA is in the top
  4892. page of memory).
  4893. _system control instructions_
  4894. 'ld' finds all 'ldc.w, stc.w' instructions which use the 32 bit
  4895. absolute address form, but refer to the top page of memory, and
  4896. changes them to use 16 bit address form. (That is: the linker
  4897. turns 'ldc.w '@'AA:32,ccr' into 'ldc.w '@'AA:16,ccr' whenever the
  4898. address AA is in the top page of memory).
  4899. 
  4900. File: ld.info, Node: M68HC11/68HC12, Next: ARM, Prev: H8/300, Up: Machine Dependent
  4901. 5.2 'ld' and the Motorola 68HC11 and 68HC12 families
  4902. ====================================================
  4903. 5.2.1 Linker Relaxation
  4904. -----------------------
  4905. For the Motorola 68HC11, 'ld' can perform these global optimizations
  4906. when you specify the '--relax' command-line option.
  4907. _relaxing address modes_
  4908. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4909. within eight bits, and turns them into eight-bit program-counter
  4910. relative 'bsr' and 'bra' instructions, respectively.
  4911. 'ld' also looks at all 16-bit extended addressing modes and
  4912. transforms them in a direct addressing mode when the address is in
  4913. page 0 (between 0 and 0x0ff).
  4914. _relaxing gcc instruction group_
  4915. When 'gcc' is called with '-mrelax', it can emit group of
  4916. instructions that the linker can optimize to use a 68HC11 direct
  4917. addressing mode. These instructions consists of 'bclr' or 'bset'
  4918. instructions.
  4919. 5.2.2 Trampoline Generation
  4920. ---------------------------
  4921. For 68HC11 and 68HC12, 'ld' can generate trampoline code to call a far
  4922. function using a normal 'jsr' instruction. The linker will also change
  4923. the relocation to some far function to use the trampoline address
  4924. instead of the function address. This is typically the case when a
  4925. pointer to a function is taken. The pointer will in fact point to the
  4926. function trampoline.
  4927. 
  4928. File: ld.info, Node: ARM, Next: HPPA ELF32, Prev: M68HC11/68HC12, Up: Machine Dependent
  4929. 5.3 'ld' and the ARM family
  4930. ===========================
  4931. For the ARM, 'ld' will generate code stubs to allow functions calls
  4932. between ARM and Thumb code. These stubs only work with code that has
  4933. been compiled and assembled with the '-mthumb-interwork' command line
  4934. option. If it is necessary to link with old ARM object files or
  4935. libraries, which have not been compiled with the -mthumb-interwork
  4936. option then the '--support-old-code' command-line switch should be given
  4937. to the linker. This will make it generate larger stub functions which
  4938. will work with non-interworking aware ARM code. Note, however, the
  4939. linker does not support generating stubs for function calls to
  4940. non-interworking aware Thumb code.
  4941. The '--thumb-entry' switch is a duplicate of the generic '--entry'
  4942. switch, in that it sets the program's starting address. But it also
  4943. sets the bottom bit of the address, so that it can be branched to using
  4944. a BX instruction, and the program will start executing in Thumb mode
  4945. straight away.
  4946. The '--use-nul-prefixed-import-tables' switch is specifying, that the
  4947. import tables idata4 and idata5 have to be generated with a zero element
  4948. prefix for import libraries. This is the old style to generate import
  4949. tables. By default this option is turned off.
  4950. The '--be8' switch instructs 'ld' to generate BE8 format executables.
  4951. This option is only valid when linking big-endian objects - ie ones
  4952. which have been assembled with the '-EB' option. The resulting image
  4953. will contain big-endian data and little-endian code.
  4954. The 'R_ARM_TARGET1' relocation is typically used for entries in the
  4955. '.init_array' section. It is interpreted as either 'R_ARM_REL32' or
  4956. 'R_ARM_ABS32', depending on the target. The '--target1-rel' and
  4957. '--target1-abs' switches override the default.
  4958. The '--target2=type' switch overrides the default definition of the
  4959. 'R_ARM_TARGET2' relocation. Valid values for 'type', their meanings,
  4960. and target defaults are as follows:
  4961. 'rel'
  4962. 'R_ARM_REL32' (arm*-*-elf, arm*-*-eabi)
  4963. 'abs'
  4964. 'R_ARM_ABS32' (arm*-*-symbianelf)
  4965. 'got-rel'
  4966. 'R_ARM_GOT_PREL' (arm*-*-linux, arm*-*-*bsd)
  4967. The 'R_ARM_V4BX' relocation (defined by the ARM AAELF specification)
  4968. enables objects compiled for the ARMv4 architecture to be
  4969. interworking-safe when linked with other objects compiled for ARMv4t,
  4970. but also allows pure ARMv4 binaries to be built from the same ARMv4
  4971. objects.
  4972. In the latter case, the switch '--fix-v4bx' must be passed to the
  4973. linker, which causes v4t 'BX rM' instructions to be rewritten as 'MOV
  4974. PC,rM', since v4 processors do not have a 'BX' instruction.
  4975. In the former case, the switch should not be used, and 'R_ARM_V4BX'
  4976. relocations are ignored.
  4977. Replace 'BX rM' instructions identified by 'R_ARM_V4BX' relocations
  4978. with a branch to the following veneer:
  4979. TST rM, #1
  4980. MOVEQ PC, rM
  4981. BX Rn
  4982. This allows generation of libraries/applications that work on ARMv4
  4983. cores and are still interworking safe. Note that the above veneer
  4984. clobbers the condition flags, so may cause incorrect program behavior in
  4985. rare cases.
  4986. The '--use-blx' switch enables the linker to use ARM/Thumb BLX
  4987. instructions (available on ARMv5t and above) in various situations.
  4988. Currently it is used to perform calls via the PLT from Thumb code using
  4989. BLX rather than using BX and a mode-switching stub before each PLT
  4990. entry. This should lead to such calls executing slightly faster.
  4991. This option is enabled implicitly for SymbianOS, so there is no need
  4992. to specify it if you are using that target.
  4993. The '--vfp11-denorm-fix' switch enables a link-time workaround for a
  4994. bug in certain VFP11 coprocessor hardware, which sometimes allows
  4995. instructions with denorm operands (which must be handled by support
  4996. code) to have those operands overwritten by subsequent instructions
  4997. before the support code can read the intended values.
  4998. The bug may be avoided in scalar mode if you allow at least one
  4999. intervening instruction between a VFP11 instruction which uses a
  5000. register and another instruction which writes to the same register, or
  5001. at least two intervening instructions if vector mode is in use. The bug
  5002. only affects full-compliance floating-point mode: you do not need this
  5003. workaround if you are using "runfast" mode. Please contact ARM for
  5004. further details.
  5005. If you know you are using buggy VFP11 hardware, you can enable this
  5006. workaround by specifying the linker option '--vfp-denorm-fix=scalar' if
  5007. you are using the VFP11 scalar mode only, or '--vfp-denorm-fix=vector'
  5008. if you are using vector mode (the latter also works for scalar code).
  5009. The default is '--vfp-denorm-fix=none'.
  5010. If the workaround is enabled, instructions are scanned for
  5011. potentially-troublesome sequences, and a veneer is created for each such
  5012. sequence which may trigger the erratum. The veneer consists of the
  5013. first instruction of the sequence and a branch back to the subsequent
  5014. instruction. The original instruction is then replaced with a branch to
  5015. the veneer. The extra cycles required to call and return from the
  5016. veneer are sufficient to avoid the erratum in both the scalar and vector
  5017. cases.
  5018. The '--fix-arm1176' switch enables a link-time workaround for an
  5019. erratum in certain ARM1176 processors. The workaround is enabled by
  5020. default if you are targeting ARM v6 (excluding ARM v6T2) or earlier. It
  5021. can be disabled unconditionally by specifying '--no-fix-arm1176'.
  5022. Further information is available in the "ARM1176JZ-S and ARM1176JZF-S
  5023. Programmer Advice Notice" available on the ARM documentation website at:
  5024. http://infocenter.arm.com/.
  5025. The '--fix-stm32l4xx-629360' switch enables a link-time workaround
  5026. for a bug in the bus matrix / memory controller for some of the STM32
  5027. Cortex-M4 based products (STM32L4xx). When accessing off-chip memory
  5028. via the affected bus for bus reads of 9 words or more, the bus can
  5029. generate corrupt data and/or abort. These are only core-initiated
  5030. accesses (not DMA), and might affect any access: integer loads such as
  5031. LDM, POP and floating-point loads such as VLDM, VPOP. Stores are not
  5032. affected.
  5033. The bug can be avoided by splitting memory accesses into the
  5034. necessary chunks to keep bus reads below 8 words.
  5035. The workaround is not enabled by default, this is equivalent to use
  5036. '--fix-stm32l4xx-629360=none'. If you know you are using buggy
  5037. STM32L4xx hardware, you can enable the workaround by specifying the
  5038. linker option '--fix-stm32l4xx-629360', or the equivalent
  5039. '--fix-stm32l4xx-629360=default'.
  5040. If the workaround is enabled, instructions are scanned for
  5041. potentially-troublesome sequences, and a veneer is created for each such
  5042. sequence which may trigger the erratum. The veneer consists in a
  5043. replacement sequence emulating the behaviour of the original one and a
  5044. branch back to the subsequent instruction. The original instruction is
  5045. then replaced with a branch to the veneer.
  5046. The workaround does not always preserve the memory access order for
  5047. the LDMDB instruction, when the instruction loads the PC.
  5048. The workaround is not able to handle problematic instructions when
  5049. they are in the middle of an IT block, since a branch is not allowed
  5050. there. In that case, the linker reports a warning and no replacement
  5051. occurs.
  5052. The workaround is not able to replace problematic instructions with a
  5053. PC-relative branch instruction if the '.text' section is too large. In
  5054. that case, when the branch that replaces the original code cannot be
  5055. encoded, the linker reports a warning and no replacement occurs.
  5056. The '--no-enum-size-warning' switch prevents the linker from warning
  5057. when linking object files that specify incompatible EABI enumeration
  5058. size attributes. For example, with this switch enabled, linking of an
  5059. object file using 32-bit enumeration values with another using
  5060. enumeration values fitted into the smallest possible space will not be
  5061. diagnosed.
  5062. The '--no-wchar-size-warning' switch prevents the linker from warning
  5063. when linking object files that specify incompatible EABI 'wchar_t' size
  5064. attributes. For example, with this switch enabled, linking of an object
  5065. file using 32-bit 'wchar_t' values with another using 16-bit 'wchar_t'
  5066. values will not be diagnosed.
  5067. The '--pic-veneer' switch makes the linker use PIC sequences for
  5068. ARM/Thumb interworking veneers, even if the rest of the binary is not
  5069. PIC. This avoids problems on uClinux targets where '--emit-relocs' is
  5070. used to generate relocatable binaries.
  5071. The linker will automatically generate and insert small sequences of
  5072. code into a linked ARM ELF executable whenever an attempt is made to
  5073. perform a function call to a symbol that is too far away. The placement
  5074. of these sequences of instructions - called stubs - is controlled by the
  5075. command-line option '--stub-group-size=N'. The placement is important
  5076. because a poor choice can create a need for duplicate stubs, increasing
  5077. the code size. The linker will try to group stubs together in order to
  5078. reduce interruptions to the flow of code, but it needs guidance as to
  5079. how big these groups should be and where they should be placed.
  5080. The value of 'N', the parameter to the '--stub-group-size=' option
  5081. controls where the stub groups are placed. If it is negative then all
  5082. stubs are placed after the first branch that needs them. If it is
  5083. positive then the stubs can be placed either before or after the
  5084. branches that need them. If the value of 'N' is 1 (either +1 or -1)
  5085. then the linker will choose exactly where to place groups of stubs,
  5086. using its built in heuristics. A value of 'N' greater than 1 (or
  5087. smaller than -1) tells the linker that a single group of stubs can
  5088. service at most 'N' bytes from the input sections.
  5089. The default, if '--stub-group-size=' is not specified, is 'N = +1'.
  5090. Farcalls stubs insertion is fully supported for the ARM-EABI target
  5091. only, because it relies on object files properties not present
  5092. otherwise.
  5093. The '--fix-cortex-a8' switch enables a link-time workaround for an
  5094. erratum in certain Cortex-A8 processors. The workaround is enabled by
  5095. default if you are targeting the ARM v7-A architecture profile. It can
  5096. be enabled otherwise by specifying '--fix-cortex-a8', or disabled
  5097. unconditionally by specifying '--no-fix-cortex-a8'.
  5098. The erratum only affects Thumb-2 code. Please contact ARM for
  5099. further details.
  5100. The '--fix-cortex-a53-835769' switch enables a link-time workaround
  5101. for erratum 835769 present on certain early revisions of Cortex-A53
  5102. processors. The workaround is disabled by default. It can be enabled
  5103. by specifying '--fix-cortex-a53-835769', or disabled unconditionally by
  5104. specifying '--no-fix-cortex-a53-835769'.
  5105. Please contact ARM for further details.
  5106. The '--no-merge-exidx-entries' switch disables the merging of
  5107. adjacent exidx entries in debuginfo.
  5108. The '--long-plt' option enables the use of 16 byte PLT entries which
  5109. support up to 4Gb of code. The default is to use 12 byte PLT entries
  5110. which only support 512Mb of code.
  5111. The '--no-apply-dynamic-relocs' option makes AArch64 linker do not
  5112. apply link-time values for dynamic relocations.
  5113. All SG veneers are placed in the special output section
  5114. '.gnu.sgstubs'. Its start address must be set, either with the
  5115. command-line option '--section-start' or in a linker script, to indicate
  5116. where to place these veneers in memory.
  5117. The '--cmse-implib' option requests that the import libraries
  5118. specified by the '--out-implib' and '--in-implib' options are secure
  5119. gateway import libraries, suitable for linking a non-secure executable
  5120. against secure code as per ARMv8-M Security Extensions.
  5121. The '--in-implib=file' specifies an input import library whose
  5122. symbols must keep the same address in the executable being produced. A
  5123. warning is given if no '--out-implib' is given but new symbols have been
  5124. introduced in the executable that should be listed in its import
  5125. library. Otherwise, if '--out-implib' is specified, the symbols are
  5126. added to the output import library. A warning is also given if some
  5127. symbols present in the input import library have disappeared from the
  5128. executable. This option is only effective for Secure Gateway import
  5129. libraries, ie. when '--cmse-implib' is specified.
  5130. 
  5131. File: ld.info, Node: HPPA ELF32, Next: M68K, Prev: ARM, Up: Machine Dependent
  5132. 5.4 'ld' and HPPA 32-bit ELF Support
  5133. ====================================
  5134. When generating a shared library, 'ld' will by default generate import
  5135. stubs suitable for use with a single sub-space application. The
  5136. '--multi-subspace' switch causes 'ld' to generate export stubs, and
  5137. different (larger) import stubs suitable for use with multiple
  5138. sub-spaces.
  5139. Long branch stubs and import/export stubs are placed by 'ld' in stub
  5140. sections located between groups of input sections. '--stub-group-size'
  5141. specifies the maximum size of a group of input sections handled by one
  5142. stub section. Since branch offsets are signed, a stub section may serve
  5143. two groups of input sections, one group before the stub section, and one
  5144. group after it. However, when using conditional branches that require
  5145. stubs, it may be better (for branch prediction) that stub sections only
  5146. serve one group of input sections. A negative value for 'N' chooses
  5147. this scheme, ensuring that branches to stubs always use a negative
  5148. offset. Two special values of 'N' are recognized, '1' and '-1'. These
  5149. both instruct 'ld' to automatically size input section groups for the
  5150. branch types detected, with the same behaviour regarding stub placement
  5151. as other positive or negative values of 'N' respectively.
  5152. Note that '--stub-group-size' does not split input sections. A
  5153. single input section larger than the group size specified will of course
  5154. create a larger group (of one section). If input sections are too
  5155. large, it may not be possible for a branch to reach its stub.
  5156. 
  5157. File: ld.info, Node: M68K, Next: MIPS, Prev: HPPA ELF32, Up: Machine Dependent
  5158. 5.5 'ld' and the Motorola 68K family
  5159. ====================================
  5160. The '--got=TYPE' option lets you choose the GOT generation scheme. The
  5161. choices are 'single', 'negative', 'multigot' and 'target'. When
  5162. 'target' is selected the linker chooses the default GOT generation
  5163. scheme for the current target. 'single' tells the linker to generate a
  5164. single GOT with entries only at non-negative offsets. 'negative'
  5165. instructs the linker to generate a single GOT with entries at both
  5166. negative and positive offsets. Not all environments support such GOTs.
  5167. 'multigot' allows the linker to generate several GOTs in the output
  5168. file. All GOT references from a single input object file access the
  5169. same GOT, but references from different input object files might access
  5170. different GOTs. Not all environments support such GOTs.
  5171. 
  5172. File: ld.info, Node: MIPS, Next: MMIX, Prev: M68K, Up: Machine Dependent
  5173. 5.6 'ld' and the MIPS family
  5174. ============================
  5175. The '--insn32' and '--no-insn32' options control the choice of microMIPS
  5176. instructions used in code generated by the linker, such as that in the
  5177. PLT or lazy binding stubs, or in relaxation. If '--insn32' is used,
  5178. then the linker only uses 32-bit instruction encodings. By default or
  5179. if '--no-insn32' is used, all instruction encodings are used, including
  5180. 16-bit ones where possible.
  5181. The '--ignore-branch-isa' and '--no-ignore-branch-isa' options
  5182. control branch relocation checks for invalid ISA mode transitions. If
  5183. '--ignore-branch-isa' is used, then the linker accepts any branch
  5184. relocations and any ISA mode transition required is lost in relocation
  5185. calculation, except for some cases of 'BAL' instructions which meet
  5186. relaxation conditions and are converted to equivalent 'JALX'
  5187. instructions as the associated relocation is calculated. By default or
  5188. if '--no-ignore-branch-isa' is used a check is made causing the loss of
  5189. an ISA mode transition to produce an error.
  5190. 
  5191. File: ld.info, Node: MMIX, Next: MSP430, Prev: MIPS, Up: Machine Dependent
  5192. 5.7 'ld' and MMIX
  5193. =================
  5194. For MMIX, there is a choice of generating 'ELF' object files or 'mmo'
  5195. object files when linking. The simulator 'mmix' understands the 'mmo'
  5196. format. The binutils 'objcopy' utility can translate between the two
  5197. formats.
  5198. There is one special section, the '.MMIX.reg_contents' section.
  5199. Contents in this section is assumed to correspond to that of global
  5200. registers, and symbols referring to it are translated to special
  5201. symbols, equal to registers. In a final link, the start address of the
  5202. '.MMIX.reg_contents' section corresponds to the first allocated global
  5203. register multiplied by 8. Register '$255' is not included in this
  5204. section; it is always set to the program entry, which is at the symbol
  5205. 'Main' for 'mmo' files.
  5206. Global symbols with the prefix '__.MMIX.start.', for example
  5207. '__.MMIX.start..text' and '__.MMIX.start..data' are special. The
  5208. default linker script uses these to set the default start address of a
  5209. section.
  5210. Initial and trailing multiples of zero-valued 32-bit words in a
  5211. section, are left out from an mmo file.
  5212. 
  5213. File: ld.info, Node: MSP430, Next: NDS32, Prev: MMIX, Up: Machine Dependent
  5214. 5.8 'ld' and MSP430
  5215. ===================
  5216. For the MSP430 it is possible to select the MPU architecture. The flag
  5217. '-m [mpu type]' will select an appropriate linker script for selected
  5218. MPU type. (To get a list of known MPUs just pass '-m help' option to
  5219. the linker).
  5220. The linker will recognize some extra sections which are MSP430
  5221. specific:
  5222. ''.vectors''
  5223. Defines a portion of ROM where interrupt vectors located.
  5224. ''.bootloader''
  5225. Defines the bootloader portion of the ROM (if applicable). Any
  5226. code in this section will be uploaded to the MPU.
  5227. ''.infomem''
  5228. Defines an information memory section (if applicable). Any code in
  5229. this section will be uploaded to the MPU.
  5230. ''.infomemnobits''
  5231. This is the same as the '.infomem' section except that any code in
  5232. this section will not be uploaded to the MPU.
  5233. ''.noinit''
  5234. Denotes a portion of RAM located above '.bss' section.
  5235. The last two sections are used by gcc.
  5236. '--code-region=[either,lower,upper,none]'
  5237. This will transform .text* sections to [either,lower,upper].text*
  5238. sections. The argument passed to GCC for -mcode-region is
  5239. propagated to the linker using this option.
  5240. '--data-region=[either,lower,upper,none]'
  5241. This will transform .data*, .bss* and .rodata* sections to
  5242. [either,lower,upper].[data,bss,rodata]* sections. The argument
  5243. passed to GCC for -mdata-region is propagated to the linker using
  5244. this option.
  5245. '--disable-sec-transformation'
  5246. Prevent the transformation of sections as specified by the
  5247. '--code-region' and '--data-region' options. This is useful if you
  5248. are compiling and linking using a single call to the GCC wrapper,
  5249. and want to compile the source files using -m[code,data]-region but
  5250. not transform the sections for prebuilt libraries and objects.
  5251. 
  5252. File: ld.info, Node: NDS32, Next: Nios II, Prev: MSP430, Up: Machine Dependent
  5253. 5.9 'ld' and NDS32
  5254. ==================
  5255. For NDS32, there are some options to select relaxation behavior. The
  5256. linker relaxes objects according to these options.
  5257. ''--m[no-]fp-as-gp''
  5258. Disable/enable fp-as-gp relaxation.
  5259. ''--mexport-symbols=FILE''
  5260. Exporting symbols and their address into FILE as linker script.
  5261. ''--m[no-]ex9''
  5262. Disable/enable link-time EX9 relaxation.
  5263. ''--mexport-ex9=FILE''
  5264. Export the EX9 table after linking.
  5265. ''--mimport-ex9=FILE''
  5266. Import the Ex9 table for EX9 relaxation.
  5267. ''--mupdate-ex9''
  5268. Update the existing EX9 table.
  5269. ''--mex9-limit=NUM''
  5270. Maximum number of entries in the ex9 table.
  5271. ''--mex9-loop-aware''
  5272. Avoid generating the EX9 instruction inside the loop.
  5273. ''--m[no-]ifc''
  5274. Disable/enable the link-time IFC optimization.
  5275. ''--mifc-loop-aware''
  5276. Avoid generating the IFC instruction inside the loop.
  5277. 
  5278. File: ld.info, Node: Nios II, Next: PowerPC ELF32, Prev: NDS32, Up: Machine Dependent
  5279. 5.10 'ld' and the Altera Nios II
  5280. ================================
  5281. Call and immediate jump instructions on Nios II processors are limited
  5282. to transferring control to addresses in the same 256MB memory segment,
  5283. which may result in 'ld' giving 'relocation truncated to fit' errors
  5284. with very large programs. The command-line option '--relax' enables the
  5285. generation of trampolines that can access the entire 32-bit address
  5286. space for calls outside the normal 'call' and 'jmpi' address range.
  5287. These trampolines are inserted at section boundaries, so may not
  5288. themselves be reachable if an input section and its associated call
  5289. trampolines are larger than 256MB.
  5290. The '--relax' option is enabled by default unless '-r' is also
  5291. specified. You can disable trampoline generation by using the
  5292. '--no-relax' linker option. You can also disable this optimization
  5293. locally by using the 'set .noat' directive in assembly-language source
  5294. files, as the linker-inserted trampolines use the 'at' register as a
  5295. temporary.
  5296. Note that the linker '--relax' option is independent of assembler
  5297. relaxation options, and that using the GNU assembler's '-relax-all'
  5298. option interferes with the linker's more selective call instruction
  5299. relaxation.
  5300. 
  5301. File: ld.info, Node: PowerPC ELF32, Next: PowerPC64 ELF64, Prev: Nios II, Up: Machine Dependent
  5302. 5.11 'ld' and PowerPC 32-bit ELF Support
  5303. ========================================
  5304. Branches on PowerPC processors are limited to a signed 26-bit
  5305. displacement, which may result in 'ld' giving 'relocation truncated to
  5306. fit' errors with very large programs. '--relax' enables the generation
  5307. of trampolines that can access the entire 32-bit address space. These
  5308. trampolines are inserted at section boundaries, so may not themselves be
  5309. reachable if an input section exceeds 33M in size. You may combine '-r'
  5310. and '--relax' to add trampolines in a partial link. In that case both
  5311. branches to undefined symbols and inter-section branches are also
  5312. considered potentially out of range, and trampolines inserted.
  5313. '--bss-plt'
  5314. Current PowerPC GCC accepts a '-msecure-plt' option that generates
  5315. code capable of using a newer PLT and GOT layout that has the
  5316. security advantage of no executable section ever needing to be
  5317. writable and no writable section ever being executable. PowerPC
  5318. 'ld' will generate this layout, including stubs to access the PLT,
  5319. if all input files (including startup and static libraries) were
  5320. compiled with '-msecure-plt'. '--bss-plt' forces the old BSS PLT
  5321. (and GOT layout) which can give slightly better performance.
  5322. '--secure-plt'
  5323. 'ld' will use the new PLT and GOT layout if it is linking new
  5324. '-fpic' or '-fPIC' code, but does not do so automatically when
  5325. linking non-PIC code. This option requests the new PLT and GOT
  5326. layout. A warning will be given if some object file requires the
  5327. old style BSS PLT.
  5328. '--sdata-got'
  5329. The new secure PLT and GOT are placed differently relative to other
  5330. sections compared to older BSS PLT and GOT placement. The location
  5331. of '.plt' must change because the new secure PLT is an initialized
  5332. section while the old PLT is uninitialized. The reason for the
  5333. '.got' change is more subtle: The new placement allows '.got' to be
  5334. read-only in applications linked with '-z relro -z now'. However,
  5335. this placement means that '.sdata' cannot always be used in shared
  5336. libraries, because the PowerPC ABI accesses '.sdata' in shared
  5337. libraries from the GOT pointer. '--sdata-got' forces the old GOT
  5338. placement. PowerPC GCC doesn't use '.sdata' in shared libraries,
  5339. so this option is really only useful for other compilers that may
  5340. do so.
  5341. '--emit-stub-syms'
  5342. This option causes 'ld' to label linker stubs with a local symbol
  5343. that encodes the stub type and destination.
  5344. '--no-tls-optimize'
  5345. PowerPC 'ld' normally performs some optimization of code sequences
  5346. used to access Thread-Local Storage. Use this option to disable
  5347. the optimization.
  5348. 
  5349. File: ld.info, Node: PowerPC64 ELF64, Next: S/390 ELF, Prev: PowerPC ELF32, Up: Machine Dependent
  5350. 5.12 'ld' and PowerPC64 64-bit ELF Support
  5351. ==========================================
  5352. '--stub-group-size'
  5353. Long branch stubs, PLT call stubs and TOC adjusting stubs are
  5354. placed by 'ld' in stub sections located between groups of input
  5355. sections. '--stub-group-size' specifies the maximum size of a
  5356. group of input sections handled by one stub section. Since branch
  5357. offsets are signed, a stub section may serve two groups of input
  5358. sections, one group before the stub section, and one group after
  5359. it. However, when using conditional branches that require stubs,
  5360. it may be better (for branch prediction) that stub sections only
  5361. serve one group of input sections. A negative value for 'N'
  5362. chooses this scheme, ensuring that branches to stubs always use a
  5363. negative offset. Two special values of 'N' are recognized, '1' and
  5364. '-1'. These both instruct 'ld' to automatically size input section
  5365. groups for the branch types detected, with the same behaviour
  5366. regarding stub placement as other positive or negative values of
  5367. 'N' respectively.
  5368. Note that '--stub-group-size' does not split input sections. A
  5369. single input section larger than the group size specified will of
  5370. course create a larger group (of one section). If input sections
  5371. are too large, it may not be possible for a branch to reach its
  5372. stub.
  5373. '--emit-stub-syms'
  5374. This option causes 'ld' to label linker stubs with a local symbol
  5375. that encodes the stub type and destination.
  5376. '--dotsyms'
  5377. '--no-dotsyms'
  5378. These two options control how 'ld' interprets version patterns in a
  5379. version script. Older PowerPC64 compilers emitted both a function
  5380. descriptor symbol with the same name as the function, and a code
  5381. entry symbol with the name prefixed by a dot ('.'). To properly
  5382. version a function 'foo', the version script thus needs to control
  5383. both 'foo' and '.foo'. The option '--dotsyms', on by default,
  5384. automatically adds the required dot-prefixed patterns. Use
  5385. '--no-dotsyms' to disable this feature.
  5386. '--save-restore-funcs'
  5387. '--no-save-restore-funcs'
  5388. These two options control whether PowerPC64 'ld' automatically
  5389. provides out-of-line register save and restore functions used by
  5390. '-Os' code. The default is to provide any such referenced function
  5391. for a normal final link, and to not do so for a relocatable link.
  5392. '--no-tls-optimize'
  5393. PowerPC64 'ld' normally performs some optimization of code
  5394. sequences used to access Thread-Local Storage. Use this option to
  5395. disable the optimization.
  5396. '--tls-get-addr-optimize'
  5397. '--no-tls-get-addr-optimize'
  5398. These options control how PowerPC64 'ld' uses a special stub to
  5399. call __tls_get_addr. PowerPC64 glibc 2.22 and later support an
  5400. optimization that allows the second and subsequent calls to
  5401. '__tls_get_addr' for a given symbol to be resolved by the special
  5402. stub without calling in to glibc. By default the linker enables
  5403. generation of the stub when glibc advertises the availability of
  5404. __tls_get_addr_opt. Using '--tls-get-addr-optimize' with an older
  5405. glibc won't do much besides slow down your applications, but may be
  5406. useful if linking an application against an older glibc with the
  5407. expectation that it will normally be used on systems having a newer
  5408. glibc. '--tls-get-addr-regsave' forces generation of a stub that
  5409. saves and restores volatile registers around the call into glibc.
  5410. Normally, this is done when the linker detects a call to
  5411. __tls_get_addr_desc. Such calls then go via the register saving
  5412. stub to __tls_get_addr_opt. '--no-tls-get-addr-regsave' disables
  5413. generation of the register saves.
  5414. '--no-opd-optimize'
  5415. PowerPC64 'ld' normally removes '.opd' section entries
  5416. corresponding to deleted link-once functions, or functions removed
  5417. by the action of '--gc-sections' or linker script '/DISCARD/'. Use
  5418. this option to disable '.opd' optimization.
  5419. '--non-overlapping-opd'
  5420. Some PowerPC64 compilers have an option to generate compressed
  5421. '.opd' entries spaced 16 bytes apart, overlapping the third word,
  5422. the static chain pointer (unused in C) with the first word of the
  5423. next entry. This option expands such entries to the full 24 bytes.
  5424. '--no-toc-optimize'
  5425. PowerPC64 'ld' normally removes unused '.toc' section entries.
  5426. Such entries are detected by examining relocations that reference
  5427. the TOC in code sections. A reloc in a deleted code section marks
  5428. a TOC word as unneeded, while a reloc in a kept code section marks
  5429. a TOC word as needed. Since the TOC may reference itself, TOC
  5430. relocs are also examined. TOC words marked as both needed and
  5431. unneeded will of course be kept. TOC words without any referencing
  5432. reloc are assumed to be part of a multi-word entry, and are kept or
  5433. discarded as per the nearest marked preceding word. This works
  5434. reliably for compiler generated code, but may be incorrect if
  5435. assembly code is used to insert TOC entries. Use this option to
  5436. disable the optimization.
  5437. '--no-inline-optimize'
  5438. PowerPC64 'ld' normally replaces inline PLT call sequences marked
  5439. with 'R_PPC64_PLTSEQ', 'R_PPC64_PLTCALL', 'R_PPC64_PLT16_HA' and
  5440. 'R_PPC64_PLT16_LO_DS' relocations by a number of 'nop's and a
  5441. direct call when the function is defined locally and can't be
  5442. overridden by some other definition. This option disables that
  5443. optimization.
  5444. '--no-multi-toc'
  5445. If given any toc option besides '-mcmodel=medium' or
  5446. '-mcmodel=large', PowerPC64 GCC generates code for a TOC model
  5447. where TOC entries are accessed with a 16-bit offset from r2. This
  5448. limits the total TOC size to 64K. PowerPC64 'ld' extends this limit
  5449. by grouping code sections such that each group uses less than 64K
  5450. for its TOC entries, then inserts r2 adjusting stubs between
  5451. inter-group calls. 'ld' does not split apart input sections, so
  5452. cannot help if a single input file has a '.toc' section that
  5453. exceeds 64K, most likely from linking multiple files with 'ld -r'.
  5454. Use this option to turn off this feature.
  5455. '--no-toc-sort'
  5456. By default, 'ld' sorts TOC sections so that those whose file
  5457. happens to have a section called '.init' or '.fini' are placed
  5458. first, followed by TOC sections referenced by code generated with
  5459. PowerPC64 gcc's '-mcmodel=small', and lastly TOC sections
  5460. referenced only by code generated with PowerPC64 gcc's
  5461. '-mcmodel=medium' or '-mcmodel=large' options. Doing this results
  5462. in better TOC grouping for multi-TOC. Use this option to turn off
  5463. this feature.
  5464. '--plt-align'
  5465. '--no-plt-align'
  5466. Use these options to control whether individual PLT call stubs are
  5467. aligned to a 32-byte boundary, or to the specified power of two
  5468. boundary when using '--plt-align='. A negative value may be
  5469. specified to pad PLT call stubs so that they do not cross the
  5470. specified power of two boundary (or the minimum number of
  5471. boundaries if a PLT stub is so large that it must cross a
  5472. boundary). By default PLT call stubs are aligned to 32-byte
  5473. boundaries.
  5474. '--plt-static-chain'
  5475. '--no-plt-static-chain'
  5476. Use these options to control whether PLT call stubs load the static
  5477. chain pointer (r11). 'ld' defaults to not loading the static chain
  5478. since there is never any need to do so on a PLT call.
  5479. '--plt-thread-safe'
  5480. '--no-plt-thread-safe'
  5481. With power7's weakly ordered memory model, it is possible when
  5482. using lazy binding for ld.so to update a plt entry in one thread
  5483. and have another thread see the individual plt entry words update
  5484. in the wrong order, despite ld.so carefully writing in the correct
  5485. order and using memory write barriers. To avoid this we need some
  5486. sort of read barrier in the call stub, or use LD_BIND_NOW=1. By
  5487. default, 'ld' looks for calls to commonly used functions that
  5488. create threads, and if seen, adds the necessary barriers. Use
  5489. these options to change the default behaviour.
  5490. '--plt-localentry'
  5491. '--no-localentry'
  5492. ELFv2 functions with localentry:0 are those with a single entry
  5493. point, ie. global entry == local entry, and that have no
  5494. requirement on r2 (the TOC/GOT pointer) or r12, and guarantee r2 is
  5495. unchanged on return. Such an external function can be called via
  5496. the PLT without saving r2 or restoring it on return, avoiding a
  5497. common load-hit-store for small functions. The optimization is
  5498. attractive, with up to 40% reduction in execution time for a small
  5499. function, but can result in symbol interposition failures. Also,
  5500. minor changes in a shared library, including system libraries, can
  5501. cause a function that was localentry:0 to become localentry:8.
  5502. This will result in a dynamic loader complaint and failure to run.
  5503. The option is experimental, use with care. '--no-plt-localentry'
  5504. is the default.
  5505. '--power10-stubs'
  5506. '--no-power10-stubs'
  5507. When PowerPC64 'ld' links input object files containing relocations
  5508. used on power10 prefixed instructions it normally creates linkage
  5509. stubs (PLT call and long branch) using power10 instructions for
  5510. '@notoc' PLT calls where 'r2' is not known. The power10 notoc
  5511. stubs are smaller and faster, so are preferred for power10.
  5512. '--power10-stubs' and '--no-power10-stubs' allow you to override
  5513. the linker's selection of stub instructions.
  5514. '--power10-stubs=auto' allows the user to select the default auto
  5515. mode.
  5516. 
  5517. File: ld.info, Node: S/390 ELF, Next: SPU ELF, Prev: PowerPC64 ELF64, Up: Machine Dependent
  5518. 5.13 'ld' and S/390 ELF Support
  5519. ===============================
  5520. '--s390-pgste'
  5521. This option marks the result file with a 'PT_S390_PGSTE' segment.
  5522. The Linux kernel is supposed to allocate 4k page tables for
  5523. binaries marked that way.
  5524. 
  5525. File: ld.info, Node: SPU ELF, Next: TI COFF, Prev: S/390 ELF, Up: Machine Dependent
  5526. 5.14 'ld' and SPU ELF Support
  5527. =============================
  5528. '--plugin'
  5529. This option marks an executable as a PIC plugin module.
  5530. '--no-overlays'
  5531. Normally, 'ld' recognizes calls to functions within overlay
  5532. regions, and redirects such calls to an overlay manager via a stub.
  5533. 'ld' also provides a built-in overlay manager. This option turns
  5534. off all this special overlay handling.
  5535. '--emit-stub-syms'
  5536. This option causes 'ld' to label overlay stubs with a local symbol
  5537. that encodes the stub type and destination.
  5538. '--extra-overlay-stubs'
  5539. This option causes 'ld' to add overlay call stubs on all function
  5540. calls out of overlay regions. Normally stubs are not added on
  5541. calls to non-overlay regions.
  5542. '--local-store=lo:hi'
  5543. 'ld' usually checks that a final executable for SPU fits in the
  5544. address range 0 to 256k. This option may be used to change the
  5545. range. Disable the check entirely with '--local-store=0:0'.
  5546. '--stack-analysis'
  5547. SPU local store space is limited. Over-allocation of stack space
  5548. unnecessarily limits space available for code and data, while
  5549. under-allocation results in runtime failures. If given this
  5550. option, 'ld' will provide an estimate of maximum stack usage. 'ld'
  5551. does this by examining symbols in code sections to determine the
  5552. extents of functions, and looking at function prologues for stack
  5553. adjusting instructions. A call-graph is created by looking for
  5554. relocations on branch instructions. The graph is then searched for
  5555. the maximum stack usage path. Note that this analysis does not
  5556. find calls made via function pointers, and does not handle
  5557. recursion and other cycles in the call graph. Stack usage may be
  5558. under-estimated if your code makes such calls. Also, stack usage
  5559. for dynamic allocation, e.g. alloca, will not be detected. If a
  5560. link map is requested, detailed information about each function's
  5561. stack usage and calls will be given.
  5562. '--emit-stack-syms'
  5563. This option, if given along with '--stack-analysis' will result in
  5564. 'ld' emitting stack sizing symbols for each function. These take
  5565. the form '__stack_<function_name>' for global functions, and
  5566. '__stack_<number>_<function_name>' for static functions.
  5567. '<number>' is the section id in hex. The value of such symbols is
  5568. the stack requirement for the corresponding function. The symbol
  5569. size will be zero, type 'STT_NOTYPE', binding 'STB_LOCAL', and
  5570. section 'SHN_ABS'.
  5571. 
  5572. File: ld.info, Node: TI COFF, Next: WIN32, Prev: SPU ELF, Up: Machine Dependent
  5573. 5.15 'ld''s Support for Various TI COFF Versions
  5574. ================================================
  5575. The '--format' switch allows selection of one of the various TI COFF
  5576. versions. The latest of this writing is 2; versions 0 and 1 are also
  5577. supported. The TI COFF versions also vary in header byte-order format;
  5578. 'ld' will read any version or byte order, but the output header format
  5579. depends on the default specified by the specific target.
  5580. 
  5581. File: ld.info, Node: WIN32, Next: Xtensa, Prev: TI COFF, Up: Machine Dependent
  5582. 5.16 'ld' and WIN32 (cygwin/mingw)
  5583. ==================================
  5584. This section describes some of the win32 specific 'ld' issues. See
  5585. *note Command-line Options: Options. for detailed description of the
  5586. command-line options mentioned here.
  5587. _import libraries_
  5588. The standard Windows linker creates and uses so-called import
  5589. libraries, which contains information for linking to dll's. They
  5590. are regular static archives and are handled as any other static
  5591. archive. The cygwin and mingw ports of 'ld' have specific support
  5592. for creating such libraries provided with the '--out-implib'
  5593. command-line option.
  5594. _exporting DLL symbols_
  5595. The cygwin/mingw 'ld' has several ways to export symbols for dll's.
  5596. _using auto-export functionality_
  5597. By default 'ld' exports symbols with the auto-export
  5598. functionality, which is controlled by the following
  5599. command-line options:
  5600. * -export-all-symbols [This is the default]
  5601. * -exclude-symbols
  5602. * -exclude-libs
  5603. * -exclude-modules-for-implib
  5604. * -version-script
  5605. When auto-export is in operation, 'ld' will export all the
  5606. non-local (global and common) symbols it finds in a DLL, with
  5607. the exception of a few symbols known to belong to the system's
  5608. runtime and libraries. As it will often not be desirable to
  5609. export all of a DLL's symbols, which may include private
  5610. functions that are not part of any public interface, the
  5611. command-line options listed above may be used to filter
  5612. symbols out from the list for exporting. The '--output-def'
  5613. option can be used in order to see the final list of exported
  5614. symbols with all exclusions taken into effect.
  5615. If '--export-all-symbols' is not given explicitly on the
  5616. command line, then the default auto-export behavior will be
  5617. _disabled_ if either of the following are true:
  5618. * A DEF file is used.
  5619. * Any symbol in any object file was marked with the
  5620. __declspec(dllexport) attribute.
  5621. _using a DEF file_
  5622. Another way of exporting symbols is using a DEF file. A DEF
  5623. file is an ASCII file containing definitions of symbols which
  5624. should be exported when a dll is created. Usually it is named
  5625. '<dll name>.def' and is added as any other object file to the
  5626. linker's command line. The file's name must end in '.def' or
  5627. '.DEF'.
  5628. gcc -o <output> <objectfiles> <dll name>.def
  5629. Using a DEF file turns off the normal auto-export behavior,
  5630. unless the '--export-all-symbols' option is also used.
  5631. Here is an example of a DEF file for a shared library called
  5632. 'xyz.dll':
  5633. LIBRARY "xyz.dll" BASE=0x20000000
  5634. EXPORTS
  5635. foo
  5636. bar
  5637. _bar = bar
  5638. another_foo = abc.dll.afoo
  5639. var1 DATA
  5640. doo = foo == foo2
  5641. eoo DATA == var1
  5642. This example defines a DLL with a non-default base address and
  5643. seven symbols in the export table. The third exported symbol
  5644. '_bar' is an alias for the second. The fourth symbol,
  5645. 'another_foo' is resolved by "forwarding" to another module
  5646. and treating it as an alias for 'afoo' exported from the DLL
  5647. 'abc.dll'. The final symbol 'var1' is declared to be a data
  5648. object. The 'doo' symbol in export library is an alias of
  5649. 'foo', which gets the string name in export table 'foo2'. The
  5650. 'eoo' symbol is an data export symbol, which gets in export
  5651. table the name 'var1'.
  5652. The optional 'LIBRARY <name>' command indicates the _internal_
  5653. name of the output DLL. If '<name>' does not include a suffix,
  5654. the default library suffix, '.DLL' is appended.
  5655. When the .DEF file is used to build an application, rather
  5656. than a library, the 'NAME <name>' command should be used
  5657. instead of 'LIBRARY'. If '<name>' does not include a suffix,
  5658. the default executable suffix, '.EXE' is appended.
  5659. With either 'LIBRARY <name>' or 'NAME <name>' the optional
  5660. specification 'BASE = <number>' may be used to specify a
  5661. non-default base address for the image.
  5662. If neither 'LIBRARY <name>' nor 'NAME <name>' is specified, or
  5663. they specify an empty string, the internal name is the same as
  5664. the filename specified on the command line.
  5665. The complete specification of an export symbol is:
  5666. EXPORTS
  5667. ( ( ( <name1> [ = <name2> ] )
  5668. | ( <name1> = <module-name> . <external-name>))
  5669. [ @ <integer> ] [NONAME] [DATA] [CONSTANT] [PRIVATE] [== <name3>] ) *
  5670. Declares '<name1>' as an exported symbol from the DLL, or
  5671. declares '<name1>' as an exported alias for '<name2>'; or
  5672. declares '<name1>' as a "forward" alias for the symbol
  5673. '<external-name>' in the DLL '<module-name>'. Optionally, the
  5674. symbol may be exported by the specified ordinal '<integer>'
  5675. alias. The optional '<name3>' is the to be used string in
  5676. import/export table for the symbol.
  5677. The optional keywords that follow the declaration indicate:
  5678. 'NONAME': Do not put the symbol name in the DLL's export
  5679. table. It will still be exported by its ordinal alias (either
  5680. the value specified by the .def specification or, otherwise,
  5681. the value assigned by the linker). The symbol name, however,
  5682. does remain visible in the import library (if any), unless
  5683. 'PRIVATE' is also specified.
  5684. 'DATA': The symbol is a variable or object, rather than a
  5685. function. The import lib will export only an indirect
  5686. reference to 'foo' as the symbol '_imp__foo' (ie, 'foo' must
  5687. be resolved as '*_imp__foo').
  5688. 'CONSTANT': Like 'DATA', but put the undecorated 'foo' as well
  5689. as '_imp__foo' into the import library. Both refer to the
  5690. read-only import address table's pointer to the variable, not
  5691. to the variable itself. This can be dangerous. If the user
  5692. code fails to add the 'dllimport' attribute and also fails to
  5693. explicitly add the extra indirection that the use of the
  5694. attribute enforces, the application will behave unexpectedly.
  5695. 'PRIVATE': Put the symbol in the DLL's export table, but do
  5696. not put it into the static import library used to resolve
  5697. imports at link time. The symbol can still be imported using
  5698. the 'LoadLibrary/GetProcAddress' API at runtime or by using
  5699. the GNU ld extension of linking directly to the DLL without an
  5700. import library.
  5701. See ld/deffilep.y in the binutils sources for the full
  5702. specification of other DEF file statements
  5703. While linking a shared dll, 'ld' is able to create a DEF file
  5704. with the '--output-def <file>' command-line option.
  5705. _Using decorations_
  5706. Another way of marking symbols for export is to modify the
  5707. source code itself, so that when building the DLL each symbol
  5708. to be exported is declared as:
  5709. __declspec(dllexport) int a_variable
  5710. __declspec(dllexport) void a_function(int with_args)
  5711. All such symbols will be exported from the DLL. If, however,
  5712. any of the object files in the DLL contain symbols decorated
  5713. in this way, then the normal auto-export behavior is disabled,
  5714. unless the '--export-all-symbols' option is also used.
  5715. Note that object files that wish to access these symbols must
  5716. _not_ decorate them with dllexport. Instead, they should use
  5717. dllimport, instead:
  5718. __declspec(dllimport) int a_variable
  5719. __declspec(dllimport) void a_function(int with_args)
  5720. This complicates the structure of library header files,
  5721. because when included by the library itself the header must
  5722. declare the variables and functions as dllexport, but when
  5723. included by client code the header must declare them as
  5724. dllimport. There are a number of idioms that are typically
  5725. used to do this; often client code can omit the __declspec()
  5726. declaration completely. See '--enable-auto-import' and
  5727. 'automatic data imports' for more information.
  5728. _automatic data imports_
  5729. The standard Windows dll format supports data imports from dlls
  5730. only by adding special decorations (dllimport/dllexport), which let
  5731. the compiler produce specific assembler instructions to deal with
  5732. this issue. This increases the effort necessary to port existing
  5733. Un*x code to these platforms, especially for large c++ libraries
  5734. and applications. The auto-import feature, which was initially
  5735. provided by Paul Sokolovsky, allows one to omit the decorations to
  5736. achieve a behavior that conforms to that on POSIX/Un*x platforms.
  5737. This feature is enabled with the '--enable-auto-import'
  5738. command-line option, although it is enabled by default on
  5739. cygwin/mingw. The '--enable-auto-import' option itself now serves
  5740. mainly to suppress any warnings that are ordinarily emitted when
  5741. linked objects trigger the feature's use.
  5742. auto-import of variables does not always work flawlessly without
  5743. additional assistance. Sometimes, you will see this message
  5744. "variable '<var>' can't be auto-imported. Please read the
  5745. documentation for ld's '--enable-auto-import' for details."
  5746. The '--enable-auto-import' documentation explains why this error
  5747. occurs, and several methods that can be used to overcome this
  5748. difficulty. One of these methods is the _runtime pseudo-relocs_
  5749. feature, described below.
  5750. For complex variables imported from DLLs (such as structs or
  5751. classes), object files typically contain a base address for the
  5752. variable and an offset (_addend_) within the variable-to specify a
  5753. particular field or public member, for instance. Unfortunately,
  5754. the runtime loader used in win32 environments is incapable of
  5755. fixing these references at runtime without the additional
  5756. information supplied by dllimport/dllexport decorations. The
  5757. standard auto-import feature described above is unable to resolve
  5758. these references.
  5759. The '--enable-runtime-pseudo-relocs' switch allows these references
  5760. to be resolved without error, while leaving the task of adjusting
  5761. the references themselves (with their non-zero addends) to
  5762. specialized code provided by the runtime environment. Recent
  5763. versions of the cygwin and mingw environments and compilers provide
  5764. this runtime support; older versions do not. However, the support
  5765. is only necessary on the developer's platform; the compiled result
  5766. will run without error on an older system.
  5767. '--enable-runtime-pseudo-relocs' is not the default; it must be
  5768. explicitly enabled as needed.
  5769. _direct linking to a dll_
  5770. The cygwin/mingw ports of 'ld' support the direct linking,
  5771. including data symbols, to a dll without the usage of any import
  5772. libraries. This is much faster and uses much less memory than does
  5773. the traditional import library method, especially when linking
  5774. large libraries or applications. When 'ld' creates an import lib,
  5775. each function or variable exported from the dll is stored in its
  5776. own bfd, even though a single bfd could contain many exports. The
  5777. overhead involved in storing, loading, and processing so many bfd's
  5778. is quite large, and explains the tremendous time, memory, and
  5779. storage needed to link against particularly large or complex
  5780. libraries when using import libs.
  5781. Linking directly to a dll uses no extra command-line switches other
  5782. than '-L' and '-l', because 'ld' already searches for a number of
  5783. names to match each library. All that is needed from the
  5784. developer's perspective is an understanding of this search, in
  5785. order to force ld to select the dll instead of an import library.
  5786. For instance, when ld is called with the argument '-lxxx' it will
  5787. attempt to find, in the first directory of its search path,
  5788. libxxx.dll.a
  5789. xxx.dll.a
  5790. libxxx.a
  5791. xxx.lib
  5792. libxxx.lib
  5793. cygxxx.dll (*)
  5794. libxxx.dll
  5795. xxx.dll
  5796. before moving on to the next directory in the search path.
  5797. (*) Actually, this is not 'cygxxx.dll' but in fact is
  5798. '<prefix>xxx.dll', where '<prefix>' is set by the 'ld' option
  5799. '--dll-search-prefix=<prefix>'. In the case of cygwin, the
  5800. standard gcc spec file includes '--dll-search-prefix=cyg', so in
  5801. effect we actually search for 'cygxxx.dll'.
  5802. Other win32-based unix environments, such as mingw or pw32, may use
  5803. other '<prefix>'es, although at present only cygwin makes use of
  5804. this feature. It was originally intended to help avoid name
  5805. conflicts among dll's built for the various win32/un*x
  5806. environments, so that (for example) two versions of a zlib dll
  5807. could coexist on the same machine.
  5808. The generic cygwin/mingw path layout uses a 'bin' directory for
  5809. applications and dll's and a 'lib' directory for the import
  5810. libraries (using cygwin nomenclature):
  5811. bin/
  5812. cygxxx.dll
  5813. lib/
  5814. libxxx.dll.a (in case of dll's)
  5815. libxxx.a (in case of static archive)
  5816. Linking directly to a dll without using the import library can be
  5817. done two ways:
  5818. 1. Use the dll directly by adding the 'bin' path to the link line
  5819. gcc -Wl,-verbose -o a.exe -L../bin/ -lxxx
  5820. However, as the dll's often have version numbers appended to their
  5821. names ('cygncurses-5.dll') this will often fail, unless one
  5822. specifies '-L../bin -lncurses-5' to include the version. Import
  5823. libs are generally not versioned, and do not have this difficulty.
  5824. 2. Create a symbolic link from the dll to a file in the 'lib'
  5825. directory according to the above mentioned search pattern. This
  5826. should be used to avoid unwanted changes in the tools needed for
  5827. making the app/dll.
  5828. ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a]
  5829. Then you can link without any make environment changes.
  5830. gcc -Wl,-verbose -o a.exe -L../lib/ -lxxx
  5831. This technique also avoids the version number problems, because the
  5832. following is perfectly legal
  5833. bin/
  5834. cygxxx-5.dll
  5835. lib/
  5836. libxxx.dll.a -> ../bin/cygxxx-5.dll
  5837. Linking directly to a dll without using an import lib will work
  5838. even when auto-import features are exercised, and even when
  5839. '--enable-runtime-pseudo-relocs' is used.
  5840. Given the improvements in speed and memory usage, one might
  5841. justifiably wonder why import libraries are used at all. There are
  5842. three reasons:
  5843. 1. Until recently, the link-directly-to-dll functionality did
  5844. _not_ work with auto-imported data.
  5845. 2. Sometimes it is necessary to include pure static objects within
  5846. the import library (which otherwise contains only bfd's for
  5847. indirection symbols that point to the exports of a dll). Again,
  5848. the import lib for the cygwin kernel makes use of this ability, and
  5849. it is not possible to do this without an import lib.
  5850. 3. Symbol aliases can only be resolved using an import lib. This
  5851. is critical when linking against OS-supplied dll's (eg, the win32
  5852. API) in which symbols are usually exported as undecorated aliases
  5853. of their stdcall-decorated assembly names.
  5854. So, import libs are not going away. But the ability to replace
  5855. true import libs with a simple symbolic link to (or a copy of) a
  5856. dll, in many cases, is a useful addition to the suite of tools
  5857. binutils makes available to the win32 developer. Given the massive
  5858. improvements in memory requirements during linking, storage
  5859. requirements, and linking speed, we expect that many developers
  5860. will soon begin to use this feature whenever possible.
  5861. _symbol aliasing_
  5862. _adding additional names_
  5863. Sometimes, it is useful to export symbols with additional
  5864. names. A symbol 'foo' will be exported as 'foo', but it can
  5865. also be exported as '_foo' by using special directives in the
  5866. DEF file when creating the dll. This will affect also the
  5867. optional created import library. Consider the following DEF
  5868. file:
  5869. LIBRARY "xyz.dll" BASE=0x61000000
  5870. EXPORTS
  5871. foo
  5872. _foo = foo
  5873. The line '_foo = foo' maps the symbol 'foo' to '_foo'.
  5874. Another method for creating a symbol alias is to create it in
  5875. the source code using the "weak" attribute:
  5876. void foo () { /* Do something. */; }
  5877. void _foo () __attribute__ ((weak, alias ("foo")));
  5878. See the gcc manual for more information about attributes and
  5879. weak symbols.
  5880. _renaming symbols_
  5881. Sometimes it is useful to rename exports. For instance, the
  5882. cygwin kernel does this regularly. A symbol '_foo' can be
  5883. exported as 'foo' but not as '_foo' by using special
  5884. directives in the DEF file. (This will also affect the import
  5885. library, if it is created). In the following example:
  5886. LIBRARY "xyz.dll" BASE=0x61000000
  5887. EXPORTS
  5888. _foo = foo
  5889. The line '_foo = foo' maps the exported symbol 'foo' to
  5890. '_foo'.
  5891. Note: using a DEF file disables the default auto-export behavior,
  5892. unless the '--export-all-symbols' command-line option is used. If,
  5893. however, you are trying to rename symbols, then you should list
  5894. _all_ desired exports in the DEF file, including the symbols that
  5895. are not being renamed, and do _not_ use the '--export-all-symbols'
  5896. option. If you list only the renamed symbols in the DEF file, and
  5897. use '--export-all-symbols' to handle the other symbols, then the
  5898. both the new names _and_ the original names for the renamed symbols
  5899. will be exported. In effect, you'd be aliasing those symbols, not
  5900. renaming them, which is probably not what you wanted.
  5901. _weak externals_
  5902. The Windows object format, PE, specifies a form of weak symbols
  5903. called weak externals. When a weak symbol is linked and the symbol
  5904. is not defined, the weak symbol becomes an alias for some other
  5905. symbol. There are three variants of weak externals:
  5906. * Definition is searched for in objects and libraries,
  5907. historically called lazy externals.
  5908. * Definition is searched for only in other objects, not in
  5909. libraries. This form is not presently implemented.
  5910. * No search; the symbol is an alias. This form is not presently
  5911. implemented.
  5912. As a GNU extension, weak symbols that do not specify an alternate
  5913. symbol are supported. If the symbol is undefined when linking, the
  5914. symbol uses a default value.
  5915. _aligned common symbols_
  5916. As a GNU extension to the PE file format, it is possible to specify
  5917. the desired alignment for a common symbol. This information is
  5918. conveyed from the assembler or compiler to the linker by means of
  5919. GNU-specific commands carried in the object file's '.drectve'
  5920. section, which are recognized by 'ld' and respected when laying out
  5921. the common symbols. Native tools will be able to process object
  5922. files employing this GNU extension, but will fail to respect the
  5923. alignment instructions, and may issue noisy warnings about unknown
  5924. linker directives.
  5925. 
  5926. File: ld.info, Node: Xtensa, Prev: WIN32, Up: Machine Dependent
  5927. 5.17 'ld' and Xtensa Processors
  5928. ===============================
  5929. The default 'ld' behavior for Xtensa processors is to interpret
  5930. 'SECTIONS' commands so that lists of explicitly named sections in a
  5931. specification with a wildcard file will be interleaved when necessary to
  5932. keep literal pools within the range of PC-relative load offsets. For
  5933. example, with the command:
  5934. SECTIONS
  5935. {
  5936. .text : {
  5937. *(.literal .text)
  5938. }
  5939. }
  5940. 'ld' may interleave some of the '.literal' and '.text' sections from
  5941. different object files to ensure that the literal pools are within the
  5942. range of PC-relative load offsets. A valid interleaving might place the
  5943. '.literal' sections from an initial group of files followed by the
  5944. '.text' sections of that group of files. Then, the '.literal' sections
  5945. from the rest of the files and the '.text' sections from the rest of the
  5946. files would follow.
  5947. Relaxation is enabled by default for the Xtensa version of 'ld' and
  5948. provides two important link-time optimizations. The first optimization
  5949. is to combine identical literal values to reduce code size. A redundant
  5950. literal will be removed and all the 'L32R' instructions that use it will
  5951. be changed to reference an identical literal, as long as the location of
  5952. the replacement literal is within the offset range of all the 'L32R'
  5953. instructions. The second optimization is to remove unnecessary overhead
  5954. from assembler-generated "longcall" sequences of 'L32R'/'CALLXN' when
  5955. the target functions are within range of direct 'CALLN' instructions.
  5956. For each of these cases where an indirect call sequence can be
  5957. optimized to a direct call, the linker will change the 'CALLXN'
  5958. instruction to a 'CALLN' instruction, remove the 'L32R' instruction, and
  5959. remove the literal referenced by the 'L32R' instruction if it is not
  5960. used for anything else. Removing the 'L32R' instruction always reduces
  5961. code size but can potentially hurt performance by changing the alignment
  5962. of subsequent branch targets. By default, the linker will always
  5963. preserve alignments, either by switching some instructions between
  5964. 24-bit encodings and the equivalent density instructions or by inserting
  5965. a no-op in place of the 'L32R' instruction that was removed. If code
  5966. size is more important than performance, the '--size-opt' option can be
  5967. used to prevent the linker from widening density instructions or
  5968. inserting no-ops, except in a few cases where no-ops are required for
  5969. correctness.
  5970. The following Xtensa-specific command-line options can be used to
  5971. control the linker:
  5972. '--size-opt'
  5973. When optimizing indirect calls to direct calls, optimize for code
  5974. size more than performance. With this option, the linker will not
  5975. insert no-ops or widen density instructions to preserve branch
  5976. target alignment. There may still be some cases where no-ops are
  5977. required to preserve the correctness of the code.
  5978. '--abi-windowed'
  5979. '--abi-call0'
  5980. Choose ABI for the output object and for the generated PLT code.
  5981. PLT code inserted by the linker must match ABI of the output object
  5982. because windowed and call0 ABI use incompatible function call
  5983. conventions. Default ABI is chosen by the ABI tag in the
  5984. '.xtensa.info' section of the first input object. A warning is
  5985. issued if ABI tags of input objects do not match each other or the
  5986. chosen output object ABI.
  5987. 
  5988. File: ld.info, Node: BFD, Next: Reporting Bugs, Prev: Machine Dependent, Up: Top
  5989. 6 BFD
  5990. *****
  5991. The linker accesses object and archive files using the BFD libraries.
  5992. These libraries allow the linker to use the same routines to operate on
  5993. object files whatever the object file format. A different object file
  5994. format can be supported simply by creating a new BFD back end and adding
  5995. it to the library. To conserve runtime memory, however, the linker and
  5996. associated tools are usually configured to support only a subset of the
  5997. object file formats available. You can use 'objdump -i' (*note objdump:
  5998. (binutils.info)objdump.) to list all the formats available for your
  5999. configuration.
  6000. As with most implementations, BFD is a compromise between several
  6001. conflicting requirements. The major factor influencing BFD design was
  6002. efficiency: any time used converting between formats is time which would
  6003. not have been spent had BFD not been involved. This is partly offset by
  6004. abstraction payback; since BFD simplifies applications and back ends,
  6005. more time and care may be spent optimizing algorithms for a greater
  6006. speed.
  6007. One minor artifact of the BFD solution which you should bear in mind
  6008. is the potential for information loss. There are two places where
  6009. useful information can be lost using the BFD mechanism: during
  6010. conversion and during output. *Note BFD information loss::.
  6011. * Menu:
  6012. * BFD outline:: How it works: an outline of BFD
  6013. 
  6014. File: ld.info, Node: BFD outline, Up: BFD
  6015. 6.1 How It Works: An Outline of BFD
  6016. ===================================
  6017. When an object file is opened, BFD subroutines automatically determine
  6018. the format of the input object file. They then build a descriptor in
  6019. memory with pointers to routines that will be used to access elements of
  6020. the object file's data structures.
  6021. As different information from the object files is required, BFD reads
  6022. from different sections of the file and processes them. For example, a
  6023. very common operation for the linker is processing symbol tables. Each
  6024. BFD back end provides a routine for converting between the object file's
  6025. representation of symbols and an internal canonical format. When the
  6026. linker asks for the symbol table of an object file, it calls through a
  6027. memory pointer to the routine from the relevant BFD back end which reads
  6028. and converts the table into a canonical form. The linker then operates
  6029. upon the canonical form. When the link is finished and the linker
  6030. writes the output file's symbol table, another BFD back end routine is
  6031. called to take the newly created symbol table and convert it into the
  6032. chosen output format.
  6033. * Menu:
  6034. * BFD information loss:: Information Loss
  6035. * Canonical format:: The BFD canonical object-file format
  6036. 
  6037. File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline
  6038. 6.1.1 Information Loss
  6039. ----------------------
  6040. _Information can be lost during output._ The output formats supported
  6041. by BFD do not provide identical facilities, and information which can be
  6042. described in one form has nowhere to go in another format. One example
  6043. of this is alignment information in 'b.out'. There is nowhere in an
  6044. 'a.out' format file to store alignment information on the contained
  6045. data, so when a file is linked from 'b.out' and an 'a.out' image is
  6046. produced, alignment information will not propagate to the output file.
  6047. (The linker will still use the alignment information internally, so the
  6048. link is performed correctly).
  6049. Another example is COFF section names. COFF files may contain an
  6050. unlimited number of sections, each one with a textual section name. If
  6051. the target of the link is a format which does not have many sections
  6052. (e.g., 'a.out') or has sections without names (e.g., the Oasys format),
  6053. the link cannot be done simply. You can circumvent this problem by
  6054. describing the desired input-to-output section mapping with the linker
  6055. command language.
  6056. _Information can be lost during canonicalization._ The BFD internal
  6057. canonical form of the external formats is not exhaustive; there are
  6058. structures in input formats for which there is no direct representation
  6059. internally. This means that the BFD back ends cannot maintain all
  6060. possible data richness through the transformation between external to
  6061. internal and back to external formats.
  6062. This limitation is only a problem when an application reads one
  6063. format and writes another. Each BFD back end is responsible for
  6064. maintaining as much data as possible, and the internal BFD canonical
  6065. form has structures which are opaque to the BFD core, and exported only
  6066. to the back ends. When a file is read in one format, the canonical form
  6067. is generated for BFD and the application. At the same time, the back
  6068. end saves away any information which may otherwise be lost. If the data
  6069. is then written back in the same format, the back end routine will be
  6070. able to use the canonical form provided by the BFD core as well as the
  6071. information it prepared earlier. Since there is a great deal of
  6072. commonality between back ends, there is no information lost when linking
  6073. or copying big endian COFF to little endian COFF, or 'a.out' to 'b.out'.
  6074. When a mixture of formats is linked, the information is only lost from
  6075. the files whose format differs from the destination.
  6076. 
  6077. File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline
  6078. 6.1.2 The BFD canonical object-file format
  6079. ------------------------------------------
  6080. The greatest potential for loss of information occurs when there is the
  6081. least overlap between the information provided by the source format,
  6082. that stored by the canonical format, and that needed by the destination
  6083. format. A brief description of the canonical form may help you
  6084. understand which kinds of data you can count on preserving across
  6085. conversions.
  6086. _files_
  6087. Information stored on a per-file basis includes target machine
  6088. architecture, particular implementation format type, a demand
  6089. pageable bit, and a write protected bit. Information like Unix
  6090. magic numbers is not stored here--only the magic numbers' meaning,
  6091. so a 'ZMAGIC' file would have both the demand pageable bit and the
  6092. write protected text bit set. The byte order of the target is
  6093. stored on a per-file basis, so that big- and little-endian object
  6094. files may be used with one another.
  6095. _sections_
  6096. Each section in the input file contains the name of the section,
  6097. the section's original address in the object file, size and
  6098. alignment information, various flags, and pointers into other BFD
  6099. data structures.
  6100. _symbols_
  6101. Each symbol contains a pointer to the information for the object
  6102. file which originally defined it, its name, its value, and various
  6103. flag bits. When a BFD back end reads in a symbol table, it
  6104. relocates all symbols to make them relative to the base of the
  6105. section where they were defined. Doing this ensures that each
  6106. symbol points to its containing section. Each symbol also has a
  6107. varying amount of hidden private data for the BFD back end. Since
  6108. the symbol points to the original file, the private data format for
  6109. that symbol is accessible. 'ld' can operate on a collection of
  6110. symbols of wildly different formats without problems.
  6111. Normal global and simple local symbols are maintained on output, so
  6112. an output file (no matter its format) will retain symbols pointing
  6113. to functions and to global, static, and common variables. Some
  6114. symbol information is not worth retaining; in 'a.out', type
  6115. information is stored in the symbol table as long symbol names.
  6116. This information would be useless to most COFF debuggers; the
  6117. linker has command-line switches to allow users to throw it away.
  6118. There is one word of type information within the symbol, so if the
  6119. format supports symbol type information within symbols (for
  6120. example, COFF, Oasys) and the type is simple enough to fit within
  6121. one word (nearly everything but aggregates), the information will
  6122. be preserved.
  6123. _relocation level_
  6124. Each canonical BFD relocation record contains a pointer to the
  6125. symbol to relocate to, the offset of the data to relocate, the
  6126. section the data is in, and a pointer to a relocation type
  6127. descriptor. Relocation is performed by passing messages through
  6128. the relocation type descriptor and the symbol pointer. Therefore,
  6129. relocations can be performed on output data using a relocation
  6130. method that is only available in one of the input formats. For
  6131. instance, Oasys provides a byte relocation format. A relocation
  6132. record requesting this relocation type would point indirectly to a
  6133. routine to perform this, so the relocation may be performed on a
  6134. byte being written to a 68k COFF file, even though 68k COFF has no
  6135. such relocation type.
  6136. _line numbers_
  6137. Object formats can contain, for debugging purposes, some form of
  6138. mapping between symbols, source line numbers, and addresses in the
  6139. output file. These addresses have to be relocated along with the
  6140. symbol information. Each symbol with an associated list of line
  6141. number records points to the first record of the list. The head of
  6142. a line number list consists of a pointer to the symbol, which
  6143. allows finding out the address of the function whose line number is
  6144. being described. The rest of the list is made up of pairs: offsets
  6145. into the section and line numbers. Any format which can simply
  6146. derive this information can pass it successfully between formats.
  6147. 
  6148. File: ld.info, Node: Reporting Bugs, Next: MRI, Prev: BFD, Up: Top
  6149. 7 Reporting Bugs
  6150. ****************
  6151. Your bug reports play an essential role in making 'ld' reliable.
  6152. Reporting a bug may help you by bringing a solution to your problem,
  6153. or it may not. But in any case the principal function of a bug report
  6154. is to help the entire community by making the next version of 'ld' work
  6155. better. Bug reports are your contribution to the maintenance of 'ld'.
  6156. In order for a bug report to serve its purpose, you must include the
  6157. information that enables us to fix the bug.
  6158. * Menu:
  6159. * Bug Criteria:: Have you found a bug?
  6160. * Bug Reporting:: How to report bugs
  6161. 
  6162. File: ld.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs
  6163. 7.1 Have You Found a Bug?
  6164. =========================
  6165. If you are not sure whether you have found a bug, here are some
  6166. guidelines:
  6167. * If the linker gets a fatal signal, for any input whatever, that is
  6168. a 'ld' bug. Reliable linkers never crash.
  6169. * If 'ld' produces an error message for valid input, that is a bug.
  6170. * If 'ld' does not produce an error message for invalid input, that
  6171. may be a bug. In the general case, the linker can not verify that
  6172. object files are correct.
  6173. * If you are an experienced user of linkers, your suggestions for
  6174. improvement of 'ld' are welcome in any case.
  6175. 
  6176. File: ld.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs
  6177. 7.2 How to Report Bugs
  6178. ======================
  6179. A number of companies and individuals offer support for GNU products.
  6180. If you obtained 'ld' from a support organization, we recommend you
  6181. contact that organization first.
  6182. You can find contact information for many support companies and
  6183. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  6184. Otherwise, send bug reports for 'ld' to <https://bugs.linaro.org/>.
  6185. The fundamental principle of reporting bugs usefully is this: *report
  6186. all the facts*. If you are not sure whether to state a fact or leave it
  6187. out, state it!
  6188. Often people omit facts because they think they know what causes the
  6189. problem and assume that some details do not matter. Thus, you might
  6190. assume that the name of a symbol you use in an example does not matter.
  6191. Well, probably it does not, but one cannot be sure. Perhaps the bug is
  6192. a stray memory reference which happens to fetch from the location where
  6193. that name is stored in memory; perhaps, if the name were different, the
  6194. contents of that location would fool the linker into doing the right
  6195. thing despite the bug. Play it safe and give a specific, complete
  6196. example. That is the easiest thing for you to do, and the most helpful.
  6197. Keep in mind that the purpose of a bug report is to enable us to fix
  6198. the bug if it is new to us. Therefore, always write your bug reports on
  6199. the assumption that the bug has not been reported previously.
  6200. Sometimes people give a few sketchy facts and ask, "Does this ring a
  6201. bell?" This cannot help us fix a bug, so it is basically useless. We
  6202. respond by asking for enough details to enable us to investigate. You
  6203. might as well expedite matters by sending them to begin with.
  6204. To enable us to fix the bug, you should include all these things:
  6205. * The version of 'ld'. 'ld' announces it if you start it with the
  6206. '--version' argument.
  6207. Without this, we will not know whether there is any point in
  6208. looking for the bug in the current version of 'ld'.
  6209. * Any patches you may have applied to the 'ld' source, including any
  6210. patches made to the 'BFD' library.
  6211. * The type of machine you are using, and the operating system name
  6212. and version number.
  6213. * What compiler (and its version) was used to compile 'ld'--e.g.
  6214. "'gcc-2.7'".
  6215. * The command arguments you gave the linker to link your example and
  6216. observe the bug. To guarantee you will not omit something
  6217. important, list them all. A copy of the Makefile (or the output
  6218. from make) is sufficient.
  6219. If we were to try to guess the arguments, we would probably guess
  6220. wrong and then we might not encounter the bug.
  6221. * A complete input file, or set of input files, that will reproduce
  6222. the bug. It is generally most helpful to send the actual object
  6223. files provided that they are reasonably small. Say no more than
  6224. 10K. For bigger files you can either make them available by FTP or
  6225. HTTP or else state that you are willing to send the object file(s)
  6226. to whomever requests them. (Note - your email will be going to a
  6227. mailing list, so we do not want to clog it up with large
  6228. attachments). But small attachments are best.
  6229. If the source files were assembled using 'gas' or compiled using
  6230. 'gcc', then it may be OK to send the source files rather than the
  6231. object files. In this case, be sure to say exactly what version of
  6232. 'gas' or 'gcc' was used to produce the object files. Also say how
  6233. 'gas' or 'gcc' were configured.
  6234. * A description of what behavior you observe that you believe is
  6235. incorrect. For example, "It gets a fatal signal."
  6236. Of course, if the bug is that 'ld' gets a fatal signal, then we
  6237. will certainly notice it. But if the bug is incorrect output, we
  6238. might not notice unless it is glaringly wrong. You might as well
  6239. not give us a chance to make a mistake.
  6240. Even if the problem you experience is a fatal signal, you should
  6241. still say so explicitly. Suppose something strange is going on,
  6242. such as, your copy of 'ld' is out of sync, or you have encountered
  6243. a bug in the C library on your system. (This has happened!) Your
  6244. copy might crash and ours would not. If you told us to expect a
  6245. crash, then when ours fails to crash, we would know that the bug
  6246. was not happening for us. If you had not told us to expect a
  6247. crash, then we would not be able to draw any conclusion from our
  6248. observations.
  6249. * If you wish to suggest changes to the 'ld' source, send us context
  6250. diffs, as generated by 'diff' with the '-u', '-c', or '-p' option.
  6251. Always send diffs from the old file to the new file. If you even
  6252. discuss something in the 'ld' source, refer to it by context, not
  6253. by line number.
  6254. The line numbers in our development sources will not match those in
  6255. your sources. Your line numbers would convey no useful information
  6256. to us.
  6257. Here are some things that are not necessary:
  6258. * A description of the envelope of the bug.
  6259. Often people who encounter a bug spend a lot of time investigating
  6260. which changes to the input file will make the bug go away and which
  6261. changes will not affect it.
  6262. This is often time consuming and not very useful, because the way
  6263. we will find the bug is by running a single example under the
  6264. debugger with breakpoints, not by pure deduction from a series of
  6265. examples. We recommend that you save your time for something else.
  6266. Of course, if you can find a simpler example to report _instead_ of
  6267. the original one, that is a convenience for us. Errors in the
  6268. output will be easier to spot, running under the debugger will take
  6269. less time, and so on.
  6270. However, simplification is not vital; if you do not want to do
  6271. this, report the bug anyway and send us the entire test case you
  6272. used.
  6273. * A patch for the bug.
  6274. A patch for the bug does help us if it is a good one. But do not
  6275. omit the necessary information, such as the test case, on the
  6276. assumption that a patch is all we need. We might see problems with
  6277. your patch and decide to fix the problem another way, or we might
  6278. not understand it at all.
  6279. Sometimes with a program as complicated as 'ld' it is very hard to
  6280. construct an example that will make the program follow a certain
  6281. path through the code. If you do not send us the example, we will
  6282. not be able to construct one, so we will not be able to verify that
  6283. the bug is fixed.
  6284. And if we cannot understand what bug you are trying to fix, or why
  6285. your patch should be an improvement, we will not install it. A
  6286. test case will help us to understand.
  6287. * A guess about what the bug is or what it depends on.
  6288. Such guesses are usually wrong. Even we cannot guess right about
  6289. such things without first using the debugger to find the facts.
  6290. 
  6291. File: ld.info, Node: MRI, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top
  6292. Appendix A MRI Compatible Script Files
  6293. **************************************
  6294. To aid users making the transition to GNU 'ld' from the MRI linker, 'ld'
  6295. can use MRI compatible linker scripts as an alternative to the more
  6296. general-purpose linker scripting language described in *note Scripts::.
  6297. MRI compatible linker scripts have a much simpler command set than the
  6298. scripting language otherwise used with 'ld'. GNU 'ld' supports the most
  6299. commonly used MRI linker commands; these commands are described here.
  6300. In general, MRI scripts aren't of much use with the 'a.out' object
  6301. file format, since it only has three sections and MRI scripts lack some
  6302. features to make use of them.
  6303. You can specify a file containing an MRI-compatible script using the
  6304. '-c' command-line option.
  6305. Each command in an MRI-compatible script occupies its own line; each
  6306. command line starts with the keyword that identifies the command (though
  6307. blank lines are also allowed for punctuation). If a line of an
  6308. MRI-compatible script begins with an unrecognized keyword, 'ld' issues a
  6309. warning message, but continues processing the script.
  6310. Lines beginning with '*' are comments.
  6311. You can write these commands using all upper-case letters, or all
  6312. lower case; for example, 'chip' is the same as 'CHIP'. The following
  6313. list shows only the upper-case form of each command.
  6314. 'ABSOLUTE SECNAME'
  6315. 'ABSOLUTE SECNAME, SECNAME, ... SECNAME'
  6316. Normally, 'ld' includes in the output file all sections from all
  6317. the input files. However, in an MRI-compatible script, you can use
  6318. the 'ABSOLUTE' command to restrict the sections that will be
  6319. present in your output program. If the 'ABSOLUTE' command is used
  6320. at all in a script, then only the sections named explicitly in
  6321. 'ABSOLUTE' commands will appear in the linker output. You can
  6322. still use other input sections (whatever you select on the command
  6323. line, or using 'LOAD') to resolve addresses in the output file.
  6324. 'ALIAS OUT-SECNAME, IN-SECNAME'
  6325. Use this command to place the data from input section IN-SECNAME in
  6326. a section called OUT-SECNAME in the linker output file.
  6327. IN-SECNAME may be an integer.
  6328. 'ALIGN SECNAME = EXPRESSION'
  6329. Align the section called SECNAME to EXPRESSION. The EXPRESSION
  6330. should be a power of two.
  6331. 'BASE EXPRESSION'
  6332. Use the value of EXPRESSION as the lowest address (other than
  6333. absolute addresses) in the output file.
  6334. 'CHIP EXPRESSION'
  6335. 'CHIP EXPRESSION, EXPRESSION'
  6336. This command does nothing; it is accepted only for compatibility.
  6337. 'END'
  6338. This command does nothing whatever; it's only accepted for
  6339. compatibility.
  6340. 'FORMAT OUTPUT-FORMAT'
  6341. Similar to the 'OUTPUT_FORMAT' command in the more general linker
  6342. language, but restricted to S-records, if OUTPUT-FORMAT is 'S'
  6343. 'LIST ANYTHING...'
  6344. Print (to the standard output file) a link map, as produced by the
  6345. 'ld' command-line option '-M'.
  6346. The keyword 'LIST' may be followed by anything on the same line,
  6347. with no change in its effect.
  6348. 'LOAD FILENAME'
  6349. 'LOAD FILENAME, FILENAME, ... FILENAME'
  6350. Include one or more object file FILENAME in the link; this has the
  6351. same effect as specifying FILENAME directly on the 'ld' command
  6352. line.
  6353. 'NAME OUTPUT-NAME'
  6354. OUTPUT-NAME is the name for the program produced by 'ld'; the
  6355. MRI-compatible command 'NAME' is equivalent to the command-line
  6356. option '-o' or the general script language command 'OUTPUT'.
  6357. 'ORDER SECNAME, SECNAME, ... SECNAME'
  6358. 'ORDER SECNAME SECNAME SECNAME'
  6359. Normally, 'ld' orders the sections in its output file in the order
  6360. in which they first appear in the input files. In an
  6361. MRI-compatible script, you can override this ordering with the
  6362. 'ORDER' command. The sections you list with 'ORDER' will appear
  6363. first in your output file, in the order specified.
  6364. 'PUBLIC NAME=EXPRESSION'
  6365. 'PUBLIC NAME,EXPRESSION'
  6366. 'PUBLIC NAME EXPRESSION'
  6367. Supply a value (EXPRESSION) for external symbol NAME used in the
  6368. linker input files.
  6369. 'SECT SECNAME, EXPRESSION'
  6370. 'SECT SECNAME=EXPRESSION'
  6371. 'SECT SECNAME EXPRESSION'
  6372. You can use any of these three forms of the 'SECT' command to
  6373. specify the start address (EXPRESSION) for section SECNAME. If you
  6374. have more than one 'SECT' statement for the same SECNAME, only the
  6375. _first_ sets the start address.
  6376. 
  6377. File: ld.info, Node: GNU Free Documentation License, Next: LD Index, Prev: MRI, Up: Top
  6378. Appendix B GNU Free Documentation License
  6379. *****************************************
  6380. Version 1.3, 3 November 2008
  6381. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  6382. <http://fsf.org/>
  6383. Everyone is permitted to copy and distribute verbatim copies
  6384. of this license document, but changing it is not allowed.
  6385. 0. PREAMBLE
  6386. The purpose of this License is to make a manual, textbook, or other
  6387. functional and useful document "free" in the sense of freedom: to
  6388. assure everyone the effective freedom to copy and redistribute it,
  6389. with or without modifying it, either commercially or
  6390. noncommercially. Secondarily, this License preserves for the
  6391. author and publisher a way to get credit for their work, while not
  6392. being considered responsible for modifications made by others.
  6393. This License is a kind of "copyleft", which means that derivative
  6394. works of the document must themselves be free in the same sense.
  6395. It complements the GNU General Public License, which is a copyleft
  6396. license designed for free software.
  6397. We have designed this License in order to use it for manuals for
  6398. free software, because free software needs free documentation: a
  6399. free program should come with manuals providing the same freedoms
  6400. that the software does. But this License is not limited to
  6401. software manuals; it can be used for any textual work, regardless
  6402. of subject matter or whether it is published as a printed book. We
  6403. recommend this License principally for works whose purpose is
  6404. instruction or reference.
  6405. 1. APPLICABILITY AND DEFINITIONS
  6406. This License applies to any manual or other work, in any medium,
  6407. that contains a notice placed by the copyright holder saying it can
  6408. be distributed under the terms of this License. Such a notice
  6409. grants a world-wide, royalty-free license, unlimited in duration,
  6410. to use that work under the conditions stated herein. The
  6411. "Document", below, refers to any such manual or work. Any member
  6412. of the public is a licensee, and is addressed as "you". You accept
  6413. the license if you copy, modify or distribute the work in a way
  6414. requiring permission under copyright law.
  6415. A "Modified Version" of the Document means any work containing the
  6416. Document or a portion of it, either copied verbatim, or with
  6417. modifications and/or translated into another language.
  6418. A "Secondary Section" is a named appendix or a front-matter section
  6419. of the Document that deals exclusively with the relationship of the
  6420. publishers or authors of the Document to the Document's overall
  6421. subject (or to related matters) and contains nothing that could
  6422. fall directly within that overall subject. (Thus, if the Document
  6423. is in part a textbook of mathematics, a Secondary Section may not
  6424. explain any mathematics.) The relationship could be a matter of
  6425. historical connection with the subject or with related matters, or
  6426. of legal, commercial, philosophical, ethical or political position
  6427. regarding them.
  6428. The "Invariant Sections" are certain Secondary Sections whose
  6429. titles are designated, as being those of Invariant Sections, in the
  6430. notice that says that the Document is released under this License.
  6431. If a section does not fit the above definition of Secondary then it
  6432. is not allowed to be designated as Invariant. The Document may
  6433. contain zero Invariant Sections. If the Document does not identify
  6434. any Invariant Sections then there are none.
  6435. The "Cover Texts" are certain short passages of text that are
  6436. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  6437. that says that the Document is released under this License. A
  6438. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  6439. be at most 25 words.
  6440. A "Transparent" copy of the Document means a machine-readable copy,
  6441. represented in a format whose specification is available to the
  6442. general public, that is suitable for revising the document
  6443. straightforwardly with generic text editors or (for images composed
  6444. of pixels) generic paint programs or (for drawings) some widely
  6445. available drawing editor, and that is suitable for input to text
  6446. formatters or for automatic translation to a variety of formats
  6447. suitable for input to text formatters. A copy made in an otherwise
  6448. Transparent file format whose markup, or absence of markup, has
  6449. been arranged to thwart or discourage subsequent modification by
  6450. readers is not Transparent. An image format is not Transparent if
  6451. used for any substantial amount of text. A copy that is not
  6452. "Transparent" is called "Opaque".
  6453. Examples of suitable formats for Transparent copies include plain
  6454. ASCII without markup, Texinfo input format, LaTeX input format,
  6455. SGML or XML using a publicly available DTD, and standard-conforming
  6456. simple HTML, PostScript or PDF designed for human modification.
  6457. Examples of transparent image formats include PNG, XCF and JPG.
  6458. Opaque formats include proprietary formats that can be read and
  6459. edited only by proprietary word processors, SGML or XML for which
  6460. the DTD and/or processing tools are not generally available, and
  6461. the machine-generated HTML, PostScript or PDF produced by some word
  6462. processors for output purposes only.
  6463. The "Title Page" means, for a printed book, the title page itself,
  6464. plus such following pages as are needed to hold, legibly, the
  6465. material this License requires to appear in the title page. For
  6466. works in formats which do not have any title page as such, "Title
  6467. Page" means the text near the most prominent appearance of the
  6468. work's title, preceding the beginning of the body of the text.
  6469. The "publisher" means any person or entity that distributes copies
  6470. of the Document to the public.
  6471. A section "Entitled XYZ" means a named subunit of the Document
  6472. whose title either is precisely XYZ or contains XYZ in parentheses
  6473. following text that translates XYZ in another language. (Here XYZ
  6474. stands for a specific section name mentioned below, such as
  6475. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  6476. To "Preserve the Title" of such a section when you modify the
  6477. Document means that it remains a section "Entitled XYZ" according
  6478. to this definition.
  6479. The Document may include Warranty Disclaimers next to the notice
  6480. which states that this License applies to the Document. These
  6481. Warranty Disclaimers are considered to be included by reference in
  6482. this License, but only as regards disclaiming warranties: any other
  6483. implication that these Warranty Disclaimers may have is void and
  6484. has no effect on the meaning of this License.
  6485. 2. VERBATIM COPYING
  6486. You may copy and distribute the Document in any medium, either
  6487. commercially or noncommercially, provided that this License, the
  6488. copyright notices, and the license notice saying this License
  6489. applies to the Document are reproduced in all copies, and that you
  6490. add no other conditions whatsoever to those of this License. You
  6491. may not use technical measures to obstruct or control the reading
  6492. or further copying of the copies you make or distribute. However,
  6493. you may accept compensation in exchange for copies. If you
  6494. distribute a large enough number of copies you must also follow the
  6495. conditions in section 3.
  6496. You may also lend copies, under the same conditions stated above,
  6497. and you may publicly display copies.
  6498. 3. COPYING IN QUANTITY
  6499. If you publish printed copies (or copies in media that commonly
  6500. have printed covers) of the Document, numbering more than 100, and
  6501. the Document's license notice requires Cover Texts, you must
  6502. enclose the copies in covers that carry, clearly and legibly, all
  6503. these Cover Texts: Front-Cover Texts on the front cover, and
  6504. Back-Cover Texts on the back cover. Both covers must also clearly
  6505. and legibly identify you as the publisher of these copies. The
  6506. front cover must present the full title with all words of the title
  6507. equally prominent and visible. You may add other material on the
  6508. covers in addition. Copying with changes limited to the covers, as
  6509. long as they preserve the title of the Document and satisfy these
  6510. conditions, can be treated as verbatim copying in other respects.
  6511. If the required texts for either cover are too voluminous to fit
  6512. legibly, you should put the first ones listed (as many as fit
  6513. reasonably) on the actual cover, and continue the rest onto
  6514. adjacent pages.
  6515. If you publish or distribute Opaque copies of the Document
  6516. numbering more than 100, you must either include a machine-readable
  6517. Transparent copy along with each Opaque copy, or state in or with
  6518. each Opaque copy a computer-network location from which the general
  6519. network-using public has access to download using public-standard
  6520. network protocols a complete Transparent copy of the Document, free
  6521. of added material. If you use the latter option, you must take
  6522. reasonably prudent steps, when you begin distribution of Opaque
  6523. copies in quantity, to ensure that this Transparent copy will
  6524. remain thus accessible at the stated location until at least one
  6525. year after the last time you distribute an Opaque copy (directly or
  6526. through your agents or retailers) of that edition to the public.
  6527. It is requested, but not required, that you contact the authors of
  6528. the Document well before redistributing any large number of copies,
  6529. to give them a chance to provide you with an updated version of the
  6530. Document.
  6531. 4. MODIFICATIONS
  6532. You may copy and distribute a Modified Version of the Document
  6533. under the conditions of sections 2 and 3 above, provided that you
  6534. release the Modified Version under precisely this License, with the
  6535. Modified Version filling the role of the Document, thus licensing
  6536. distribution and modification of the Modified Version to whoever
  6537. possesses a copy of it. In addition, you must do these things in
  6538. the Modified Version:
  6539. A. Use in the Title Page (and on the covers, if any) a title
  6540. distinct from that of the Document, and from those of previous
  6541. versions (which should, if there were any, be listed in the
  6542. History section of the Document). You may use the same title
  6543. as a previous version if the original publisher of that
  6544. version gives permission.
  6545. B. List on the Title Page, as authors, one or more persons or
  6546. entities responsible for authorship of the modifications in
  6547. the Modified Version, together with at least five of the
  6548. principal authors of the Document (all of its principal
  6549. authors, if it has fewer than five), unless they release you
  6550. from this requirement.
  6551. C. State on the Title page the name of the publisher of the
  6552. Modified Version, as the publisher.
  6553. D. Preserve all the copyright notices of the Document.
  6554. E. Add an appropriate copyright notice for your modifications
  6555. adjacent to the other copyright notices.
  6556. F. Include, immediately after the copyright notices, a license
  6557. notice giving the public permission to use the Modified
  6558. Version under the terms of this License, in the form shown in
  6559. the Addendum below.
  6560. G. Preserve in that license notice the full lists of Invariant
  6561. Sections and required Cover Texts given in the Document's
  6562. license notice.
  6563. H. Include an unaltered copy of this License.
  6564. I. Preserve the section Entitled "History", Preserve its Title,
  6565. and add to it an item stating at least the title, year, new
  6566. authors, and publisher of the Modified Version as given on the
  6567. Title Page. If there is no section Entitled "History" in the
  6568. Document, create one stating the title, year, authors, and
  6569. publisher of the Document as given on its Title Page, then add
  6570. an item describing the Modified Version as stated in the
  6571. previous sentence.
  6572. J. Preserve the network location, if any, given in the Document
  6573. for public access to a Transparent copy of the Document, and
  6574. likewise the network locations given in the Document for
  6575. previous versions it was based on. These may be placed in the
  6576. "History" section. You may omit a network location for a work
  6577. that was published at least four years before the Document
  6578. itself, or if the original publisher of the version it refers
  6579. to gives permission.
  6580. K. For any section Entitled "Acknowledgements" or "Dedications",
  6581. Preserve the Title of the section, and preserve in the section
  6582. all the substance and tone of each of the contributor
  6583. acknowledgements and/or dedications given therein.
  6584. L. Preserve all the Invariant Sections of the Document, unaltered
  6585. in their text and in their titles. Section numbers or the
  6586. equivalent are not considered part of the section titles.
  6587. M. Delete any section Entitled "Endorsements". Such a section
  6588. may not be included in the Modified Version.
  6589. N. Do not retitle any existing section to be Entitled
  6590. "Endorsements" or to conflict in title with any Invariant
  6591. Section.
  6592. O. Preserve any Warranty Disclaimers.
  6593. If the Modified Version includes new front-matter sections or
  6594. appendices that qualify as Secondary Sections and contain no
  6595. material copied from the Document, you may at your option designate
  6596. some or all of these sections as invariant. To do this, add their
  6597. titles to the list of Invariant Sections in the Modified Version's
  6598. license notice. These titles must be distinct from any other
  6599. section titles.
  6600. You may add a section Entitled "Endorsements", provided it contains
  6601. nothing but endorsements of your Modified Version by various
  6602. parties--for example, statements of peer review or that the text
  6603. has been approved by an organization as the authoritative
  6604. definition of a standard.
  6605. You may add a passage of up to five words as a Front-Cover Text,
  6606. and a passage of up to 25 words as a Back-Cover Text, to the end of
  6607. the list of Cover Texts in the Modified Version. Only one passage
  6608. of Front-Cover Text and one of Back-Cover Text may be added by (or
  6609. through arrangements made by) any one entity. If the Document
  6610. already includes a cover text for the same cover, previously added
  6611. by you or by arrangement made by the same entity you are acting on
  6612. behalf of, you may not add another; but you may replace the old
  6613. one, on explicit permission from the previous publisher that added
  6614. the old one.
  6615. The author(s) and publisher(s) of the Document do not by this
  6616. License give permission to use their names for publicity for or to
  6617. assert or imply endorsement of any Modified Version.
  6618. 5. COMBINING DOCUMENTS
  6619. You may combine the Document with other documents released under
  6620. this License, under the terms defined in section 4 above for
  6621. modified versions, provided that you include in the combination all
  6622. of the Invariant Sections of all of the original documents,
  6623. unmodified, and list them all as Invariant Sections of your
  6624. combined work in its license notice, and that you preserve all
  6625. their Warranty Disclaimers.
  6626. The combined work need only contain one copy of this License, and
  6627. multiple identical Invariant Sections may be replaced with a single
  6628. copy. If there are multiple Invariant Sections with the same name
  6629. but different contents, make the title of each such section unique
  6630. by adding at the end of it, in parentheses, the name of the
  6631. original author or publisher of that section if known, or else a
  6632. unique number. Make the same adjustment to the section titles in
  6633. the list of Invariant Sections in the license notice of the
  6634. combined work.
  6635. In the combination, you must combine any sections Entitled
  6636. "History" in the various original documents, forming one section
  6637. Entitled "History"; likewise combine any sections Entitled
  6638. "Acknowledgements", and any sections Entitled "Dedications". You
  6639. must delete all sections Entitled "Endorsements."
  6640. 6. COLLECTIONS OF DOCUMENTS
  6641. You may make a collection consisting of the Document and other
  6642. documents released under this License, and replace the individual
  6643. copies of this License in the various documents with a single copy
  6644. that is included in the collection, provided that you follow the
  6645. rules of this License for verbatim copying of each of the documents
  6646. in all other respects.
  6647. You may extract a single document from such a collection, and
  6648. distribute it individually under this License, provided you insert
  6649. a copy of this License into the extracted document, and follow this
  6650. License in all other respects regarding verbatim copying of that
  6651. document.
  6652. 7. AGGREGATION WITH INDEPENDENT WORKS
  6653. A compilation of the Document or its derivatives with other
  6654. separate and independent documents or works, in or on a volume of a
  6655. storage or distribution medium, is called an "aggregate" if the
  6656. copyright resulting from the compilation is not used to limit the
  6657. legal rights of the compilation's users beyond what the individual
  6658. works permit. When the Document is included in an aggregate, this
  6659. License does not apply to the other works in the aggregate which
  6660. are not themselves derivative works of the Document.
  6661. If the Cover Text requirement of section 3 is applicable to these
  6662. copies of the Document, then if the Document is less than one half
  6663. of the entire aggregate, the Document's Cover Texts may be placed
  6664. on covers that bracket the Document within the aggregate, or the
  6665. electronic equivalent of covers if the Document is in electronic
  6666. form. Otherwise they must appear on printed covers that bracket
  6667. the whole aggregate.
  6668. 8. TRANSLATION
  6669. Translation is considered a kind of modification, so you may
  6670. distribute translations of the Document under the terms of section
  6671. 4. Replacing Invariant Sections with translations requires special
  6672. permission from their copyright holders, but you may include
  6673. translations of some or all Invariant Sections in addition to the
  6674. original versions of these Invariant Sections. You may include a
  6675. translation of this License, and all the license notices in the
  6676. Document, and any Warranty Disclaimers, provided that you also
  6677. include the original English version of this License and the
  6678. original versions of those notices and disclaimers. In case of a
  6679. disagreement between the translation and the original version of
  6680. this License or a notice or disclaimer, the original version will
  6681. prevail.
  6682. If a section in the Document is Entitled "Acknowledgements",
  6683. "Dedications", or "History", the requirement (section 4) to
  6684. Preserve its Title (section 1) will typically require changing the
  6685. actual title.
  6686. 9. TERMINATION
  6687. You may not copy, modify, sublicense, or distribute the Document
  6688. except as expressly provided under this License. Any attempt
  6689. otherwise to copy, modify, sublicense, or distribute it is void,
  6690. and will automatically terminate your rights under this License.
  6691. However, if you cease all violation of this License, then your
  6692. license from a particular copyright holder is reinstated (a)
  6693. provisionally, unless and until the copyright holder explicitly and
  6694. finally terminates your license, and (b) permanently, if the
  6695. copyright holder fails to notify you of the violation by some
  6696. reasonable means prior to 60 days after the cessation.
  6697. Moreover, your license from a particular copyright holder is
  6698. reinstated permanently if the copyright holder notifies you of the
  6699. violation by some reasonable means, this is the first time you have
  6700. received notice of violation of this License (for any work) from
  6701. that copyright holder, and you cure the violation prior to 30 days
  6702. after your receipt of the notice.
  6703. Termination of your rights under this section does not terminate
  6704. the licenses of parties who have received copies or rights from you
  6705. under this License. If your rights have been terminated and not
  6706. permanently reinstated, receipt of a copy of some or all of the
  6707. same material does not give you any rights to use it.
  6708. 10. FUTURE REVISIONS OF THIS LICENSE
  6709. The Free Software Foundation may publish new, revised versions of
  6710. the GNU Free Documentation License from time to time. Such new
  6711. versions will be similar in spirit to the present version, but may
  6712. differ in detail to address new problems or concerns. See
  6713. <http://www.gnu.org/copyleft/>.
  6714. Each version of the License is given a distinguishing version
  6715. number. If the Document specifies that a particular numbered
  6716. version of this License "or any later version" applies to it, you
  6717. have the option of following the terms and conditions either of
  6718. that specified version or of any later version that has been
  6719. published (not as a draft) by the Free Software Foundation. If the
  6720. Document does not specify a version number of this License, you may
  6721. choose any version ever published (not as a draft) by the Free
  6722. Software Foundation. If the Document specifies that a proxy can
  6723. decide which future versions of this License can be used, that
  6724. proxy's public statement of acceptance of a version permanently
  6725. authorizes you to choose that version for the Document.
  6726. 11. RELICENSING
  6727. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  6728. World Wide Web server that publishes copyrightable works and also
  6729. provides prominent facilities for anybody to edit those works. A
  6730. public wiki that anybody can edit is an example of such a server.
  6731. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  6732. site means any set of copyrightable works thus published on the MMC
  6733. site.
  6734. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  6735. license published by Creative Commons Corporation, a not-for-profit
  6736. corporation with a principal place of business in San Francisco,
  6737. California, as well as future copyleft versions of that license
  6738. published by that same organization.
  6739. "Incorporate" means to publish or republish a Document, in whole or
  6740. in part, as part of another Document.
  6741. An MMC is "eligible for relicensing" if it is licensed under this
  6742. License, and if all works that were first published under this
  6743. License somewhere other than this MMC, and subsequently
  6744. incorporated in whole or in part into the MMC, (1) had no cover
  6745. texts or invariant sections, and (2) were thus incorporated prior
  6746. to November 1, 2008.
  6747. The operator of an MMC Site may republish an MMC contained in the
  6748. site under CC-BY-SA on the same site at any time before August 1,
  6749. 2009, provided the MMC is eligible for relicensing.
  6750. ADDENDUM: How to use this License for your documents
  6751. ====================================================
  6752. To use this License in a document you have written, include a copy of
  6753. the License in the document and put the following copyright and license
  6754. notices just after the title page:
  6755. Copyright (C) YEAR YOUR NAME.
  6756. Permission is granted to copy, distribute and/or modify this document
  6757. under the terms of the GNU Free Documentation License, Version 1.3
  6758. or any later version published by the Free Software Foundation;
  6759. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  6760. Texts. A copy of the license is included in the section entitled ``GNU
  6761. Free Documentation License''.
  6762. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  6763. Texts, replace the "with...Texts." line with this:
  6764. with the Invariant Sections being LIST THEIR TITLES, with
  6765. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  6766. being LIST.
  6767. If you have Invariant Sections without Cover Texts, or some other
  6768. combination of the three, merge those two alternatives to suit the
  6769. situation.
  6770. If your document contains nontrivial examples of program code, we
  6771. recommend releasing these examples in parallel under your choice of free
  6772. software license, such as the GNU General Public License, to permit
  6773. their use in free software.
  6774. 
  6775. File: ld.info, Node: LD Index, Prev: GNU Free Documentation License, Up: Top
  6776. LD Index
  6777. ********
  6778. �[index�]
  6779. * Menu:
  6780. * ": Symbols. (line 6)
  6781. * -(: Options. (line 1069)
  6782. * --accept-unknown-input-arch: Options. (line 1087)
  6783. * --add-needed: Options. (line 1114)
  6784. * --add-stdcall-alias: Options. (line 2183)
  6785. * --allow-multiple-definition: Options. (line 1482)
  6786. * --allow-shlib-undefined: Options. (line 1488)
  6787. * --as-needed: Options. (line 1097)
  6788. * --audit AUDITLIB: Options. (line 111)
  6789. * --auxiliary=NAME: Options. (line 294)
  6790. * --bank-window: Options. (line 2674)
  6791. * --base-file: Options. (line 2188)
  6792. * --be8: ARM. (line 28)
  6793. * --branch-stub on C-SKY: Options. (line 2646)
  6794. * --bss-plt: PowerPC ELF32. (line 16)
  6795. * --build-id: Options. (line 2145)
  6796. * --build-id=STYLE: Options. (line 2145)
  6797. * --check-sections: Options. (line 1192)
  6798. * --cmse-implib: ARM. (line 234)
  6799. * --code-region: MSP430. (line 34)
  6800. * --compact-branches: Options. (line 2719)
  6801. * --compress-debug-sections=none: Options. (line 2103)
  6802. * --compress-debug-sections=zlib: Options. (line 2103)
  6803. * --compress-debug-sections=zlib-gabi: Options. (line 2103)
  6804. * --compress-debug-sections=zlib-gnu: Options. (line 2103)
  6805. * --copy-dt-needed-entries: Options. (line 1204)
  6806. * --cref: Options. (line 1224)
  6807. * --ctf-share-types: Options. (line 1248)
  6808. * --ctf-variables: Options. (line 1237)
  6809. * --data-region: MSP430. (line 39)
  6810. * --default-imported-symver: Options. (line 1538)
  6811. * --default-script=SCRIPT: Options. (line 660)
  6812. * --default-symver: Options. (line 1534)
  6813. * --defsym=SYMBOL=EXP: Options. (line 1292)
  6814. * --demangle[=STYLE]: Options. (line 1312)
  6815. * --depaudit AUDITLIB: Options. (line 164)
  6816. * --dependency-file=DEPFILE: Options. (line 527)
  6817. * --disable-auto-image-base: Options. (line 2365)
  6818. * --disable-auto-import: Options. (line 2504)
  6819. * --disable-large-address-aware: Options. (line 2313)
  6820. * --disable-long-section-names: Options. (line 2198)
  6821. * --disable-multiple-abs-defs: Options. (line 1343)
  6822. * --disable-new-dtags: Options. (line 2077)
  6823. * --disable-runtime-pseudo-reloc: Options. (line 2517)
  6824. * --disable-sec-transformation: MSP430. (line 45)
  6825. * --disable-stdcall-fixup: Options. (line 2220)
  6826. * --discard-all: Options. (line 745)
  6827. * --discard-locals: Options. (line 749)
  6828. * --dll: Options. (line 2193)
  6829. * --dll-search-prefix: Options. (line 2371)
  6830. * --dotsyms: PowerPC64 ELF64. (line 33)
  6831. * --dsbt-index: Options. (line 2633)
  6832. * --dsbt-size: Options. (line 2628)
  6833. * --dynamic-linker=FILE: Options. (line 1325)
  6834. * --dynamic-list-cpp-new: Options. (line 1184)
  6835. * --dynamic-list-cpp-typeinfo: Options. (line 1188)
  6836. * --dynamic-list-data: Options. (line 1181)
  6837. * --dynamic-list=DYNAMIC-LIST-FILE: Options. (line 1168)
  6838. * --dynamicbase: Options. (line 2561)
  6839. * --eh-frame-hdr: Options. (line 2066)
  6840. * --embedded-relocs: Options. (line 1338)
  6841. * --emit-relocs: Options. (line 587)
  6842. * --emit-stack-syms: SPU ELF. (line 46)
  6843. * --emit-stub-syms: PowerPC ELF32. (line 47)
  6844. * --emit-stub-syms <1>: PowerPC64 ELF64. (line 29)
  6845. * --emit-stub-syms <2>: SPU ELF. (line 15)
  6846. * --enable-auto-image-base: Options. (line 2356)
  6847. * --enable-auto-import: Options. (line 2380)
  6848. * --enable-extra-pe-debug: Options. (line 2522)
  6849. * --enable-long-section-names: Options. (line 2198)
  6850. * --enable-new-dtags: Options. (line 2077)
  6851. * --enable-non-contiguous-regions: Options. (line 174)
  6852. * --enable-non-contiguous-regions-warnings: Options. (line 206)
  6853. * --enable-reloc-section: Options. (line 2615)
  6854. * --enable-runtime-pseudo-reloc: Options. (line 2509)
  6855. * --enable-stdcall-fixup: Options. (line 2220)
  6856. * --entry=ENTRY: Options. (line 212)
  6857. * --error-handling-script=SCRIPTNAME: Options. (line 1515)
  6858. * --error-unresolved-symbols: Options. (line 2002)
  6859. * --exclude-all-symbols: Options. (line 2273)
  6860. * --exclude-libs: Options. (line 222)
  6861. * --exclude-modules-for-implib: Options. (line 233)
  6862. * --exclude-symbols: Options. (line 2267)
  6863. * --export-all-symbols: Options. (line 2243)
  6864. * --export-dynamic: Options. (line 246)
  6865. * --export-dynamic-symbol-list=FILE: Options. (line 282)
  6866. * --export-dynamic-symbol=GLOB: Options. (line 273)
  6867. * --extra-overlay-stubs: SPU ELF. (line 19)
  6868. * --fatal-warnings: Options. (line 1347)
  6869. * --file-alignment: Options. (line 2277)
  6870. * --filter=NAME: Options. (line 315)
  6871. * --fix-arm1176: ARM. (line 111)
  6872. * --fix-cortex-a53-835769: ARM. (line 211)
  6873. * --fix-cortex-a8: ARM. (line 202)
  6874. * --fix-stm32l4xx-629360: ARM. (line 120)
  6875. * --fix-v4bx: ARM. (line 48)
  6876. * --fix-v4bx-interworking: ARM. (line 61)
  6877. * --force-dynamic: Options. (line 596)
  6878. * --force-exe-suffix: Options. (line 1352)
  6879. * --force-group-allocation: Options. (line 1284)
  6880. * --forceinteg: Options. (line 2569)
  6881. * --format=FORMAT: Options. (line 121)
  6882. * --format=VERSION: TI COFF. (line 6)
  6883. * --gc-keep-exported: Options. (line 1400)
  6884. * --gc-sections: Options. (line 1362)
  6885. * --got: Options. (line 2686)
  6886. * --got=TYPE: M68K. (line 6)
  6887. * --gpsize=VALUE: Options. (line 347)
  6888. * --hash-size=NUMBER: Options. (line 2087)
  6889. * --hash-style=STYLE: Options. (line 2095)
  6890. * --heap: Options. (line 2283)
  6891. * --help: Options. (line 1428)
  6892. * --high-entropy-va: Options. (line 2553)
  6893. * --ignore-branch-isa: Options. (line 2707)
  6894. * --ignore-branch-isa <1>: MIPS. (line 13)
  6895. * --image-base: Options. (line 2290)
  6896. * --imagic: Options. (line 2756)
  6897. * --in-implib=FILE: ARM. (line 239)
  6898. * --insert-timestamp: Options. (line 2604)
  6899. * --insn32: Options. (line 2698)
  6900. * --insn32 <1>: MIPS. (line 6)
  6901. * --just-symbols=FILE: Options. (line 618)
  6902. * --kill-at: Options. (line 2299)
  6903. * --large-address-aware: Options. (line 2304)
  6904. * --ld-generated-unwind-info: Options. (line 2072)
  6905. * --leading-underscore: Options. (line 2237)
  6906. * --library-path=DIR: Options. (line 405)
  6907. * --library=NAMESPEC: Options. (line 372)
  6908. * --local-store=lo:hi: SPU ELF. (line 24)
  6909. * --long-plt: ARM. (line 222)
  6910. * --major-image-version: Options. (line 2320)
  6911. * --major-os-version: Options. (line 2325)
  6912. * --major-subsystem-version: Options. (line 2329)
  6913. * --merge-exidx-entries: ARM. (line 219)
  6914. * --minor-image-version: Options. (line 2334)
  6915. * --minor-os-version: Options. (line 2339)
  6916. * --minor-subsystem-version: Options. (line 2343)
  6917. * --mri-script=MRI-CMDFILE: Options. (line 145)
  6918. * --multi-subspace: HPPA ELF32. (line 6)
  6919. * --nmagic: Options. (line 500)
  6920. * --nmagic <1>: Options. (line 2746)
  6921. * --no-accept-unknown-input-arch: Options. (line 1087)
  6922. * --no-add-needed: Options. (line 1114)
  6923. * --no-allow-shlib-undefined: Options. (line 1488)
  6924. * --no-apply-dynamic-relocs: ARM. (line 226)
  6925. * --no-as-needed: Options. (line 1097)
  6926. * --no-bind: Options. (line 2590)
  6927. * --no-check-sections: Options. (line 1192)
  6928. * --no-compact-branches: Options. (line 2720)
  6929. * --no-copy-dt-needed-entries: Options. (line 1204)
  6930. * --no-ctf-variables: Options. (line 1237)
  6931. * --no-define-common: Options. (line 1268)
  6932. * --no-demangle: Options. (line 1312)
  6933. * --no-dotsyms: PowerPC64 ELF64. (line 33)
  6934. * --no-dynamic-linker: Options. (line 1332)
  6935. * --no-eh-frame-hdr: Options. (line 2066)
  6936. * --no-enum-size-warning: ARM. (line 158)
  6937. * --no-export-dynamic: Options. (line 246)
  6938. * --no-fatal-warnings: Options. (line 1347)
  6939. * --no-fix-arm1176: ARM. (line 111)
  6940. * --no-fix-cortex-a53-835769: ARM. (line 211)
  6941. * --no-fix-cortex-a8: ARM. (line 202)
  6942. * --no-gc-sections: Options. (line 1362)
  6943. * --no-ignore-branch-isa: Options. (line 2708)
  6944. * --no-ignore-branch-isa <1>: MIPS. (line 13)
  6945. * --no-inline-optimize: PowerPC64 ELF64. (line 101)
  6946. * --no-insn32: Options. (line 2699)
  6947. * --no-insn32 <1>: MIPS. (line 6)
  6948. * --no-isolation: Options. (line 2580)
  6949. * --no-keep-memory: Options. (line 1465)
  6950. * --no-leading-underscore: Options. (line 2237)
  6951. * --no-merge-exidx-entries: Options. (line 2640)
  6952. * --no-merge-exidx-entries <1>: ARM. (line 219)
  6953. * --no-multi-toc: PowerPC64 ELF64. (line 109)
  6954. * --no-omagic: Options. (line 515)
  6955. * --no-omagic <1>: Options. (line 2770)
  6956. * --no-opd-optimize: PowerPC64 ELF64. (line 75)
  6957. * --no-overlays: SPU ELF. (line 9)
  6958. * --no-plt-align: PowerPC64 ELF64. (line 131)
  6959. * --no-plt-localentry: PowerPC64 ELF64. (line 160)
  6960. * --no-plt-static-chain: PowerPC64 ELF64. (line 142)
  6961. * --no-plt-thread-safe: PowerPC64 ELF64. (line 148)
  6962. * --no-power10-stubs: PowerPC64 ELF64. (line 176)
  6963. * --no-print-gc-sections: Options. (line 1391)
  6964. * --no-print-map-discarded: Options. (line 495)
  6965. * --no-save-restore-funcs: PowerPC64 ELF64. (line 44)
  6966. * --no-seh: Options. (line 2585)
  6967. * --no-strip-discarded: Options. (line 638)
  6968. * --no-tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  6969. * --no-tls-get-addr-regsave: PowerPC64 ELF64. (line 56)
  6970. * --no-tls-optimize: PowerPC ELF32. (line 51)
  6971. * --no-tls-optimize <1>: PowerPC64 ELF64. (line 51)
  6972. * --no-toc-optimize: PowerPC64 ELF64. (line 87)
  6973. * --no-toc-sort: PowerPC64 ELF64. (line 121)
  6974. * --no-trampoline: Options. (line 2668)
  6975. * --no-undefined: Options. (line 1472)
  6976. * --no-undefined-version: Options. (line 1529)
  6977. * --no-warn-mismatch: Options. (line 1542)
  6978. * --no-warn-search-mismatch: Options. (line 1551)
  6979. * --no-wchar-size-warning: ARM. (line 165)
  6980. * --no-whole-archive: Options. (line 1555)
  6981. * --noinhibit-exec: Options. (line 1559)
  6982. * --non-overlapping-opd: PowerPC64 ELF64. (line 81)
  6983. * --nxcompat: Options. (line 2574)
  6984. * --oformat=OUTPUT-FORMAT: Options. (line 1570)
  6985. * --omagic: Options. (line 506)
  6986. * --omagic <1>: Options. (line 2735)
  6987. * --orphan-handling=MODE: Options. (line 704)
  6988. * --out-implib: Options. (line 1583)
  6989. * --output-def: Options. (line 2348)
  6990. * --output=OUTPUT: Options. (line 521)
  6991. * --pic-executable: Options. (line 1592)
  6992. * --pic-veneer: ARM. (line 171)
  6993. * --plt-align: PowerPC64 ELF64. (line 131)
  6994. * --plt-localentry: PowerPC64 ELF64. (line 160)
  6995. * --plt-static-chain: PowerPC64 ELF64. (line 142)
  6996. * --plt-thread-safe: PowerPC64 ELF64. (line 148)
  6997. * --plugin: SPU ELF. (line 6)
  6998. * --pop-state: Options. (line 583)
  6999. * --power10-stubs: PowerPC64 ELF64. (line 176)
  7000. * --print-gc-sections: Options. (line 1391)
  7001. * --print-map: Options. (line 440)
  7002. * --print-map-discarded: Options. (line 495)
  7003. * --print-memory-usage: Options. (line 1416)
  7004. * --print-output-format: Options. (line 1410)
  7005. * --push-state: Options. (line 565)
  7006. * --reduce-memory-overheads: Options. (line 2131)
  7007. * --relax: Options. (line 1608)
  7008. * --relax on Nios II: Nios II. (line 6)
  7009. * --relax on PowerPC: PowerPC ELF32. (line 6)
  7010. * --relax on Xtensa: Xtensa. (line 27)
  7011. * --relocatable: Options. (line 600)
  7012. * --require-defined=SYMBOL: Options. (line 686)
  7013. * --retain-symbols-file=FILENAME: Options. (line 1634)
  7014. * --s390-pgste: S/390 ELF. (line 6)
  7015. * --save-restore-funcs: PowerPC64 ELF64. (line 44)
  7016. * --script=SCRIPT: Options. (line 651)
  7017. * --sdata-got: PowerPC ELF32. (line 33)
  7018. * --section-alignment: Options. (line 2527)
  7019. * --section-start=SECTIONNAME=ORG: Options. (line 1815)
  7020. * --secure-plt: PowerPC ELF32. (line 26)
  7021. * --sort-common: Options. (line 1747)
  7022. * --sort-section=alignment: Options. (line 1762)
  7023. * --sort-section=name: Options. (line 1758)
  7024. * --spare-dynamic-tags: Options. (line 1766)
  7025. * --split-by-file: Options. (line 1771)
  7026. * --split-by-reloc: Options. (line 1776)
  7027. * --stack: Options. (line 2533)
  7028. * --stack-analysis: SPU ELF. (line 29)
  7029. * --stats: Options. (line 1789)
  7030. * --strip-all: Options. (line 629)
  7031. * --strip-debug: Options. (line 633)
  7032. * --strip-discarded: Options. (line 638)
  7033. * --stub-group-size: PowerPC64 ELF64. (line 6)
  7034. * --stub-group-size on C-SKY: Options. (line 2653)
  7035. * --stub-group-size=N: ARM. (line 176)
  7036. * --stub-group-size=N <1>: HPPA ELF32. (line 12)
  7037. * --subsystem: Options. (line 2540)
  7038. * --support-old-code: ARM. (line 6)
  7039. * --sysroot=DIRECTORY: Options. (line 1793)
  7040. * --target-help: Options. (line 1432)
  7041. * --target1-abs: ARM. (line 33)
  7042. * --target1-rel: ARM. (line 33)
  7043. * --target2=TYPE: ARM. (line 38)
  7044. * --task-link: Options. (line 1798)
  7045. * --thumb-entry=ENTRY: ARM. (line 17)
  7046. * --tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  7047. * --tls-get-addr-regsave: PowerPC64 ELF64. (line 56)
  7048. * --trace: Options. (line 643)
  7049. * --trace-symbol=SYMBOL: Options. (line 755)
  7050. * --traditional-format: Options. (line 1803)
  7051. * --tsaware: Options. (line 2599)
  7052. * --undefined=SYMBOL: Options. (line 673)
  7053. * --unique[=SECTION]: Options. (line 730)
  7054. * --unresolved-symbols: Options. (line 1845)
  7055. * --use-blx: ARM. (line 73)
  7056. * --use-nul-prefixed-import-tables: ARM. (line 23)
  7057. * --verbose[=NUMBER]: Options. (line 1874)
  7058. * --version: Options. (line 739)
  7059. * --version-script=VERSION-SCRIPTFILE: Options. (line 1882)
  7060. * --vfp11-denorm-fix: ARM. (line 82)
  7061. * --warn-alternate-em: Options. (line 1994)
  7062. * --warn-common: Options. (line 1892)
  7063. * --warn-constructors: Options. (line 1960)
  7064. * --warn-multiple-gp: Options. (line 1965)
  7065. * --warn-once: Options. (line 1979)
  7066. * --warn-section-align: Options. (line 1983)
  7067. * --warn-textrel: Options. (line 1990)
  7068. * --warn-unresolved-symbols: Options. (line 1997)
  7069. * --wdmdriver: Options. (line 2594)
  7070. * --whole-archive: Options. (line 2006)
  7071. * --wrap=SYMBOL: Options. (line 2020)
  7072. * -a KEYWORD: Options. (line 104)
  7073. * -assert KEYWORD: Options. (line 1121)
  7074. * -b FORMAT: Options. (line 121)
  7075. * -Bdynamic: Options. (line 1124)
  7076. * -Bgroup: Options. (line 1134)
  7077. * -Bshareable: Options. (line 1740)
  7078. * -Bstatic: Options. (line 1141)
  7079. * -Bsymbolic: Options. (line 1155)
  7080. * -Bsymbolic-functions: Options. (line 1162)
  7081. * -c MRI-CMDFILE: Options. (line 145)
  7082. * -call_shared: Options. (line 1124)
  7083. * -d: Options. (line 155)
  7084. * -dc: Options. (line 155)
  7085. * -dn: Options. (line 1141)
  7086. * -dp: Options. (line 155)
  7087. * -dT SCRIPT: Options. (line 660)
  7088. * -dy: Options. (line 1124)
  7089. * -E: Options. (line 246)
  7090. * -e ENTRY: Options. (line 212)
  7091. * -EB: Options. (line 287)
  7092. * -EL: Options. (line 290)
  7093. * -f NAME: Options. (line 294)
  7094. * -F NAME: Options. (line 315)
  7095. * -fini=NAME: Options. (line 338)
  7096. * -g: Options. (line 344)
  7097. * -G VALUE: Options. (line 347)
  7098. * -h NAME: Options. (line 354)
  7099. * -i: Options. (line 363)
  7100. * -IFILE: Options. (line 1325)
  7101. * -init=NAME: Options. (line 366)
  7102. * -L DIR: Options. (line 405)
  7103. * -l NAMESPEC: Options. (line 372)
  7104. * -M: Options. (line 440)
  7105. * -m EMULATION: Options. (line 430)
  7106. * -Map=MAPFILE: Options. (line 1436)
  7107. * -n: Options. (line 500)
  7108. * -N: Options. (line 506)
  7109. * -N <1>: Options. (line 2734)
  7110. * -n <1>: Options. (line 2745)
  7111. * -no-relax: Options. (line 1608)
  7112. * -non_shared: Options. (line 1141)
  7113. * -nostdlib: Options. (line 1565)
  7114. * -O LEVEL: Options. (line 540)
  7115. * -o OUTPUT: Options. (line 521)
  7116. * -P AUDITLIB: Options. (line 164)
  7117. * -pie: Options. (line 1592)
  7118. * -plugin NAME: Options. (line 550)
  7119. * -q: Options. (line 587)
  7120. * -qmagic: Options. (line 1602)
  7121. * -Qy: Options. (line 1605)
  7122. * -r: Options. (line 600)
  7123. * -R FILE: Options. (line 618)
  7124. * -rpath-link=DIR: Options. (line 1675)
  7125. * -rpath=DIR: Options. (line 1648)
  7126. * -s: Options. (line 629)
  7127. * -S: Options. (line 633)
  7128. * -shared: Options. (line 1740)
  7129. * -soname=NAME: Options. (line 354)
  7130. * -static: Options. (line 1141)
  7131. * -t: Options. (line 643)
  7132. * -T SCRIPT: Options. (line 651)
  7133. * -Tbss=ORG: Options. (line 1824)
  7134. * -Tdata=ORG: Options. (line 1824)
  7135. * -Tldata-segment=ORG: Options. (line 1840)
  7136. * -Trodata-segment=ORG: Options. (line 1834)
  7137. * -Ttext-segment=ORG: Options. (line 1830)
  7138. * -Ttext=ORG: Options. (line 1824)
  7139. * -u SYMBOL: Options. (line 673)
  7140. * -Ur: Options. (line 694)
  7141. * -v: Options. (line 739)
  7142. * -V: Options. (line 739)
  7143. * -x: Options. (line 745)
  7144. * -X: Options. (line 749)
  7145. * -Y PATH: Options. (line 764)
  7146. * -y SYMBOL: Options. (line 755)
  7147. * -z: Options. (line 2755)
  7148. * -z defs: Options. (line 1472)
  7149. * -z KEYWORD: Options. (line 768)
  7150. * -z muldefs: Options. (line 1482)
  7151. * -z undefs: Options. (line 1472)
  7152. * .: Location Counter. (line 6)
  7153. * /DISCARD/: Output Section Discarding.
  7154. (line 26)
  7155. * 32-bit PLT entries: ARM. (line 222)
  7156. * :PHDR: Output Section Phdr.
  7157. (line 6)
  7158. * =FILLEXP: Output Section Fill.
  7159. (line 6)
  7160. * >REGION: Output Section Region.
  7161. (line 6)
  7162. * [COMMON]: Input Section Common.
  7163. (line 29)
  7164. * AArch64 rela addend: ARM. (line 226)
  7165. * ABSOLUTE (MRI): MRI. (line 32)
  7166. * absolute and relocatable symbols: Expression Section. (line 6)
  7167. * absolute expressions: Expression Section. (line 6)
  7168. * ABSOLUTE(EXP): Builtin Functions. (line 10)
  7169. * ADDR(SECTION): Builtin Functions. (line 17)
  7170. * address, section: Output Section Address.
  7171. (line 6)
  7172. * ALIAS (MRI): MRI. (line 43)
  7173. * ALIGN (MRI): MRI. (line 49)
  7174. * align expression: Builtin Functions. (line 38)
  7175. * align location counter: Builtin Functions. (line 38)
  7176. * ALIGN(ALIGN): Builtin Functions. (line 38)
  7177. * ALIGN(EXP,ALIGN): Builtin Functions. (line 38)
  7178. * ALIGN(SECTION_ALIGN): Forced Output Alignment.
  7179. (line 6)
  7180. * aligned common symbols: WIN32. (line 416)
  7181. * ALIGNOF(SECTION): Builtin Functions. (line 63)
  7182. * allocating memory: MEMORY. (line 6)
  7183. * architecture: Miscellaneous Commands.
  7184. (line 121)
  7185. * archive files, from cmd line: Options. (line 372)
  7186. * archive search path in linker script: File Commands. (line 80)
  7187. * arithmetic: Expressions. (line 6)
  7188. * arithmetic operators: Operators. (line 6)
  7189. * ARM interworking support: ARM. (line 6)
  7190. * ARM1176 erratum workaround: ARM. (line 111)
  7191. * ASSERT: Miscellaneous Commands.
  7192. (line 9)
  7193. * assertion in linker script: Miscellaneous Commands.
  7194. (line 9)
  7195. * assignment in scripts: Assignments. (line 6)
  7196. * AS_NEEDED(FILES): File Commands. (line 60)
  7197. * AT(LMA): Output Section LMA. (line 6)
  7198. * AT>LMA_REGION: Output Section LMA. (line 6)
  7199. * automatic data imports: WIN32. (line 185)
  7200. * back end: BFD. (line 6)
  7201. * BASE (MRI): MRI. (line 53)
  7202. * BE8: ARM. (line 28)
  7203. * BFD canonical format: Canonical format. (line 11)
  7204. * BFD requirements: BFD. (line 16)
  7205. * big-endian objects: Options. (line 287)
  7206. * binary input format: Options. (line 121)
  7207. * BLOCK(EXP): Builtin Functions. (line 76)
  7208. * bug criteria: Bug Criteria. (line 6)
  7209. * bug reports: Bug Reporting. (line 6)
  7210. * bugs in ld: Reporting Bugs. (line 6)
  7211. * BYTE(EXPRESSION): Output Section Data.
  7212. (line 6)
  7213. * C++ constructors, arranging in link: Output Section Keywords.
  7214. (line 19)
  7215. * CHIP (MRI): MRI. (line 57)
  7216. * COLLECT_NO_DEMANGLE: Environment. (line 29)
  7217. * combining symbols, warnings on: Options. (line 1892)
  7218. * COMDAT: Options. (line 1284)
  7219. * COMDAT <1>: Miscellaneous Commands.
  7220. (line 56)
  7221. * command files: Scripts. (line 6)
  7222. * command line: Options. (line 6)
  7223. * common allocation: Options. (line 155)
  7224. * common allocation <1>: Options. (line 1268)
  7225. * common allocation in linker script: Miscellaneous Commands.
  7226. (line 46)
  7227. * common allocation in linker script <1>: Miscellaneous Commands.
  7228. (line 51)
  7229. * common symbol placement: Input Section Common.
  7230. (line 6)
  7231. * COMMONPAGESIZE: Symbolic Constants. (line 13)
  7232. * compatibility, MRI: Options. (line 145)
  7233. * CONSTANT: Symbolic Constants. (line 6)
  7234. * constants in linker scripts: Constants. (line 6)
  7235. * constraints on output sections: Output Section Constraint.
  7236. (line 6)
  7237. * constructors: Options. (line 694)
  7238. * CONSTRUCTORS: Output Section Keywords.
  7239. (line 19)
  7240. * constructors, arranging in link: Output Section Keywords.
  7241. (line 19)
  7242. * Cortex-A53 erratum 835769 workaround: ARM. (line 211)
  7243. * Cortex-A8 erratum workaround: ARM. (line 202)
  7244. * crash of linker: Bug Criteria. (line 9)
  7245. * CREATE_OBJECT_SYMBOLS: Output Section Keywords.
  7246. (line 9)
  7247. * creating a DEF file: WIN32. (line 153)
  7248. * cross reference table: Options. (line 1224)
  7249. * cross references: Miscellaneous Commands.
  7250. (line 88)
  7251. * cross references <1>: Miscellaneous Commands.
  7252. (line 104)
  7253. * ctf type sharing: Options. (line 1248)
  7254. * ctf variables: Options. (line 1237)
  7255. * current output location: Location Counter. (line 6)
  7256. * data: Output Section Data.
  7257. (line 6)
  7258. * DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE): Builtin Functions.
  7259. (line 81)
  7260. * DATA_SEGMENT_END(EXP): Builtin Functions. (line 105)
  7261. * DATA_SEGMENT_RELRO_END(OFFSET, EXP): Builtin Functions. (line 111)
  7262. * dbx: Options. (line 1808)
  7263. * DEF files, creating: Options. (line 2348)
  7264. * default emulation: Environment. (line 21)
  7265. * default input format: Environment. (line 9)
  7266. * defined symbol: Options. (line 686)
  7267. * DEFINED(SYMBOL): Builtin Functions. (line 124)
  7268. * deleting local symbols: Options. (line 745)
  7269. * demangling, default: Environment. (line 29)
  7270. * demangling, from command line: Options. (line 1312)
  7271. * dependency file: Options. (line 527)
  7272. * direct linking to a dll: WIN32. (line 233)
  7273. * discarding sections: Output Section Discarding.
  7274. (line 6)
  7275. * discontinuous memory: MEMORY. (line 6)
  7276. * DLLs, creating: Options. (line 2243)
  7277. * DLLs, creating <1>: Options. (line 2348)
  7278. * DLLs, creating <2>: Options. (line 2356)
  7279. * DLLs, linking to: Options. (line 2371)
  7280. * dot: Location Counter. (line 6)
  7281. * dot inside sections: Location Counter. (line 36)
  7282. * dot outside sections: Location Counter. (line 66)
  7283. * dynamic linker, from command line: Options. (line 1325)
  7284. * dynamic symbol table: Options. (line 246)
  7285. * ELF program headers: PHDRS. (line 6)
  7286. * ELF symbol visibility: Options. (line 1031)
  7287. * emulation: Options. (line 430)
  7288. * emulation, default: Environment. (line 21)
  7289. * END (MRI): MRI. (line 61)
  7290. * endianness: Options. (line 287)
  7291. * entry point: Entry Point. (line 6)
  7292. * entry point, from command line: Options. (line 212)
  7293. * entry point, thumb: ARM. (line 17)
  7294. * ENTRY(SYMBOL): Entry Point. (line 6)
  7295. * error on valid input: Bug Criteria. (line 12)
  7296. * example of linker script: Simple Example. (line 6)
  7297. * EXCLUDE_FILE: Input Section Basics.
  7298. (line 17)
  7299. * export dynamic symbol: Options. (line 273)
  7300. * export dynamic symbol list: Options. (line 282)
  7301. * exporting DLL symbols: WIN32. (line 19)
  7302. * expression evaluation order: Evaluation. (line 6)
  7303. * expression sections: Expression Section. (line 6)
  7304. * expression, absolute: Builtin Functions. (line 10)
  7305. * expressions: Expressions. (line 6)
  7306. * EXTERN: Miscellaneous Commands.
  7307. (line 39)
  7308. * fatal signal: Bug Criteria. (line 9)
  7309. * file name wildcard patterns: Input Section Wildcards.
  7310. (line 6)
  7311. * FILEHDR: PHDRS. (line 62)
  7312. * filename symbols: Output Section Keywords.
  7313. (line 9)
  7314. * fill pattern, entire section: Output Section Fill.
  7315. (line 6)
  7316. * FILL(EXPRESSION): Output Section Data.
  7317. (line 39)
  7318. * finalization function: Options. (line 338)
  7319. * first input file: File Commands. (line 88)
  7320. * first instruction: Entry Point. (line 6)
  7321. * FIX_V4BX: ARM. (line 48)
  7322. * FIX_V4BX_INTERWORKING: ARM. (line 61)
  7323. * FORCE_COMMON_ALLOCATION: Miscellaneous Commands.
  7324. (line 46)
  7325. * FORCE_GROUP_ALLOCATION: Miscellaneous Commands.
  7326. (line 56)
  7327. * forcing input section alignment: Forced Input Alignment.
  7328. (line 6)
  7329. * forcing output section alignment: Forced Output Alignment.
  7330. (line 6)
  7331. * forcing the creation of dynamic sections: Options. (line 596)
  7332. * FORMAT (MRI): MRI. (line 65)
  7333. * functions in expressions: Builtin Functions. (line 6)
  7334. * garbage collection: Options. (line 1362)
  7335. * garbage collection <1>: Options. (line 1391)
  7336. * garbage collection <2>: Options. (line 1400)
  7337. * garbage collection <3>: Input Section Keep. (line 6)
  7338. * generating optimized output: Options. (line 540)
  7339. * GNU linker: Overview. (line 6)
  7340. * GNUTARGET: Environment. (line 9)
  7341. * group allocation in linker script: Options. (line 1284)
  7342. * group allocation in linker script <1>: Miscellaneous Commands.
  7343. (line 56)
  7344. * GROUP(FILES): File Commands. (line 53)
  7345. * grouping input files: File Commands. (line 53)
  7346. * groups of archives: Options. (line 1069)
  7347. * H8/300 support: H8/300. (line 6)
  7348. * header size: Builtin Functions. (line 191)
  7349. * heap size: Options. (line 2283)
  7350. * help: Options. (line 1428)
  7351. * HIDDEN: HIDDEN. (line 6)
  7352. * holes: Location Counter. (line 12)
  7353. * holes, filling: Output Section Data.
  7354. (line 39)
  7355. * HPPA multiple sub-space stubs: HPPA ELF32. (line 6)
  7356. * HPPA stub grouping: HPPA ELF32. (line 12)
  7357. * image base: Options. (line 2290)
  7358. * implicit linker scripts: Implicit Linker Scripts.
  7359. (line 6)
  7360. * import libraries: WIN32. (line 10)
  7361. * INCLUDE FILENAME: File Commands. (line 9)
  7362. * including a linker script: File Commands. (line 9)
  7363. * including an entire archive: Options. (line 2006)
  7364. * incremental link: Options. (line 363)
  7365. * INHIBIT_COMMON_ALLOCATION: Miscellaneous Commands.
  7366. (line 51)
  7367. * initialization function: Options. (line 366)
  7368. * initialized data in ROM: Output Section LMA. (line 39)
  7369. * input file format in linker script: Format Commands. (line 35)
  7370. * input filename symbols: Output Section Keywords.
  7371. (line 9)
  7372. * input files in linker scripts: File Commands. (line 19)
  7373. * input files, displaying: Options. (line 643)
  7374. * input format: Options. (line 121)
  7375. * input format <1>: Options. (line 121)
  7376. * Input import library: ARM. (line 239)
  7377. * input object files in linker scripts: File Commands. (line 19)
  7378. * input section alignment: Forced Input Alignment.
  7379. (line 6)
  7380. * input section basics: Input Section Basics.
  7381. (line 6)
  7382. * input section wildcards: Input Section Wildcards.
  7383. (line 6)
  7384. * input sections: Input Section. (line 6)
  7385. * INPUT(FILES): File Commands. (line 19)
  7386. * INSERT: Miscellaneous Commands.
  7387. (line 62)
  7388. * insert user script into default script: Miscellaneous Commands.
  7389. (line 62)
  7390. * integer notation: Constants. (line 6)
  7391. * integer suffixes: Constants. (line 15)
  7392. * internal object-file format: Canonical format. (line 11)
  7393. * invalid input: Bug Criteria. (line 14)
  7394. * K and M integer suffixes: Constants. (line 15)
  7395. * KEEP: Input Section Keep. (line 6)
  7396. * l =: MEMORY. (line 72)
  7397. * lazy evaluation: Evaluation. (line 6)
  7398. * ld bugs, reporting: Bug Reporting. (line 6)
  7399. * ldata segment origin, cmd line: Options. (line 1841)
  7400. * LDEMULATION: Environment. (line 21)
  7401. * LD_FEATURE(STRING): Miscellaneous Commands.
  7402. (line 127)
  7403. * len =: MEMORY. (line 72)
  7404. * LENGTH =: MEMORY. (line 72)
  7405. * LENGTH(MEMORY): Builtin Functions. (line 141)
  7406. * library search path in linker script: File Commands. (line 80)
  7407. * link map: Options. (line 440)
  7408. * link map discarded: Options. (line 495)
  7409. * link-time runtime library search path: Options. (line 1675)
  7410. * linker crash: Bug Criteria. (line 9)
  7411. * linker plugins: Plugins. (line 6)
  7412. * linker script concepts: Basic Script Concepts.
  7413. (line 6)
  7414. * linker script example: Simple Example. (line 6)
  7415. * linker script file commands: File Commands. (line 6)
  7416. * linker script format: Script Format. (line 6)
  7417. * linker script input object files: File Commands. (line 19)
  7418. * linker script simple commands: Simple Commands. (line 6)
  7419. * linker scripts: Scripts. (line 6)
  7420. * LIST (MRI): MRI. (line 69)
  7421. * little-endian objects: Options. (line 290)
  7422. * LOAD (MRI): MRI. (line 76)
  7423. * load address: Output Section LMA. (line 6)
  7424. * LOADADDR(SECTION): Builtin Functions. (line 144)
  7425. * loading, preventing: Output Section Type.
  7426. (line 21)
  7427. * local symbols, deleting: Options. (line 749)
  7428. * location counter: Location Counter. (line 6)
  7429. * LOG2CEIL(EXP): Builtin Functions. (line 148)
  7430. * LONG(EXPRESSION): Output Section Data.
  7431. (line 6)
  7432. * M and K integer suffixes: Constants. (line 15)
  7433. * M68HC11 and 68HC12 support: M68HC11/68HC12. (line 5)
  7434. * machine architecture: Miscellaneous Commands.
  7435. (line 121)
  7436. * machine dependencies: Machine Dependent. (line 6)
  7437. * mapping input sections to output sections: Input Section. (line 6)
  7438. * MAX: Builtin Functions. (line 151)
  7439. * MAXPAGESIZE: Symbolic Constants. (line 10)
  7440. * MEMORY: MEMORY. (line 6)
  7441. * memory region attributes: MEMORY. (line 34)
  7442. * memory regions: MEMORY. (line 6)
  7443. * memory regions and sections: Output Section Region.
  7444. (line 6)
  7445. * memory usage: Options. (line 1416)
  7446. * memory usage <1>: Options. (line 1465)
  7447. * Merging exidx entries: ARM. (line 219)
  7448. * MIN: Builtin Functions. (line 154)
  7449. * MIPS branch relocation check control: MIPS. (line 13)
  7450. * MIPS microMIPS instruction choice selection: MIPS. (line 6)
  7451. * Motorola 68K GOT generation: M68K. (line 6)
  7452. * MRI compatibility: MRI. (line 6)
  7453. * MSP430 extra sections: MSP430. (line 11)
  7454. * MSP430 Options: MSP430. (line 34)
  7455. * NAME (MRI): MRI. (line 82)
  7456. * name, section: Output Section Name.
  7457. (line 6)
  7458. * names: Symbols. (line 6)
  7459. * naming the output file: Options. (line 521)
  7460. * NEXT(EXP): Builtin Functions. (line 158)
  7461. * Nios II call relaxation: Nios II. (line 6)
  7462. * NMAGIC: Options. (line 500)
  7463. * NOCROSSREFS(SECTIONS): Miscellaneous Commands.
  7464. (line 88)
  7465. * NOCROSSREFS_TO(TOSECTION FROMSECTIONS): Miscellaneous Commands.
  7466. (line 104)
  7467. * NOLOAD: Output Section Type.
  7468. (line 21)
  7469. * not enough room for program headers: Builtin Functions. (line 196)
  7470. * NO_ENUM_SIZE_WARNING: ARM. (line 158)
  7471. * NO_WCHAR_SIZE_WARNING: ARM. (line 165)
  7472. * o =: MEMORY. (line 67)
  7473. * objdump -i: BFD. (line 6)
  7474. * object file management: BFD. (line 6)
  7475. * object files: Options. (line 29)
  7476. * object formats available: BFD. (line 6)
  7477. * object size: Options. (line 347)
  7478. * OMAGIC: Options. (line 506)
  7479. * OMAGIC <1>: Options. (line 515)
  7480. * ONLY_IF_RO: Output Section Constraint.
  7481. (line 6)
  7482. * ONLY_IF_RW: Output Section Constraint.
  7483. (line 6)
  7484. * opening object files: BFD outline. (line 6)
  7485. * operators for arithmetic: Operators. (line 6)
  7486. * options: Options. (line 6)
  7487. * ORDER (MRI): MRI. (line 87)
  7488. * org =: MEMORY. (line 67)
  7489. * ORIGIN =: MEMORY. (line 67)
  7490. * ORIGIN(MEMORY): Builtin Functions. (line 164)
  7491. * orphan: Orphan Sections. (line 6)
  7492. * orphan sections: Options. (line 704)
  7493. * output file after errors: Options. (line 1559)
  7494. * output file format in linker script: Format Commands. (line 10)
  7495. * output file name in linker script: File Commands. (line 70)
  7496. * output format: Options. (line 1410)
  7497. * output section alignment: Forced Output Alignment.
  7498. (line 6)
  7499. * output section attributes: Output Section Attributes.
  7500. (line 6)
  7501. * output section data: Output Section Data.
  7502. (line 6)
  7503. * OUTPUT(FILENAME): File Commands. (line 70)
  7504. * OUTPUT_ARCH(BFDARCH): Miscellaneous Commands.
  7505. (line 121)
  7506. * OUTPUT_FORMAT(BFDNAME): Format Commands. (line 10)
  7507. * OVERLAY: Overlay Description.
  7508. (line 6)
  7509. * overlays: Overlay Description.
  7510. (line 6)
  7511. * partial link: Options. (line 600)
  7512. * PE import table prefixing: ARM. (line 23)
  7513. * PHDRS: PHDRS. (line 6)
  7514. * PHDRS <1>: PHDRS. (line 62)
  7515. * PIC_VENEER: ARM. (line 171)
  7516. * Placement of SG veneers: ARM. (line 229)
  7517. * plugins: Plugins. (line 6)
  7518. * pop state governing input file handling: Options. (line 583)
  7519. * position independent executables: Options. (line 1594)
  7520. * PowerPC ELF32 options: PowerPC ELF32. (line 16)
  7521. * PowerPC GOT: PowerPC ELF32. (line 33)
  7522. * PowerPC long branches: PowerPC ELF32. (line 6)
  7523. * PowerPC PLT: PowerPC ELF32. (line 16)
  7524. * PowerPC stub symbols: PowerPC ELF32. (line 47)
  7525. * PowerPC TLS optimization: PowerPC ELF32. (line 51)
  7526. * PowerPC64 dot symbols: PowerPC64 ELF64. (line 33)
  7527. * PowerPC64 ELF64 options: PowerPC64 ELF64. (line 6)
  7528. * PowerPC64 ELFv2 PLT localentry optimization: PowerPC64 ELF64.
  7529. (line 160)
  7530. * PowerPC64 inline PLT call optimization: PowerPC64 ELF64. (line 101)
  7531. * PowerPC64 multi-TOC: PowerPC64 ELF64. (line 109)
  7532. * PowerPC64 OPD optimization: PowerPC64 ELF64. (line 75)
  7533. * PowerPC64 OPD spacing: PowerPC64 ELF64. (line 81)
  7534. * PowerPC64 PLT call stub static chain: PowerPC64 ELF64. (line 142)
  7535. * PowerPC64 PLT call stub thread safety: PowerPC64 ELF64. (line 148)
  7536. * PowerPC64 PLT stub alignment: PowerPC64 ELF64. (line 131)
  7537. * PowerPC64 Power10 stubs: PowerPC64 ELF64. (line 176)
  7538. * PowerPC64 register save/restore functions: PowerPC64 ELF64.
  7539. (line 44)
  7540. * PowerPC64 stub grouping: PowerPC64 ELF64. (line 6)
  7541. * PowerPC64 stub symbols: PowerPC64 ELF64. (line 29)
  7542. * PowerPC64 TLS optimization: PowerPC64 ELF64. (line 51)
  7543. * PowerPC64 TOC optimization: PowerPC64 ELF64. (line 87)
  7544. * PowerPC64 TOC sorting: PowerPC64 ELF64. (line 121)
  7545. * PowerPC64 __tls_get_addr optimization: PowerPC64 ELF64. (line 56)
  7546. * precedence in expressions: Operators. (line 6)
  7547. * prevent unnecessary loading: Output Section Type.
  7548. (line 21)
  7549. * program headers: PHDRS. (line 6)
  7550. * program headers and sections: Output Section Phdr.
  7551. (line 6)
  7552. * program headers, not enough room: Builtin Functions. (line 196)
  7553. * program segments: PHDRS. (line 6)
  7554. * PROVIDE: PROVIDE. (line 6)
  7555. * PROVIDE_HIDDEN: PROVIDE_HIDDEN. (line 6)
  7556. * PUBLIC (MRI): MRI. (line 95)
  7557. * push state governing input file handling: Options. (line 565)
  7558. * QUAD(EXPRESSION): Output Section Data.
  7559. (line 6)
  7560. * quoted symbol names: Symbols. (line 6)
  7561. * read-only text: Options. (line 500)
  7562. * read/write from cmd line: Options. (line 506)
  7563. * region alias: REGION_ALIAS. (line 6)
  7564. * region names: REGION_ALIAS. (line 6)
  7565. * regions of memory: MEMORY. (line 6)
  7566. * REGION_ALIAS(ALIAS, REGION): REGION_ALIAS. (line 6)
  7567. * relative expressions: Expression Section. (line 6)
  7568. * relaxing addressing modes: Options. (line 1608)
  7569. * relaxing on H8/300: H8/300. (line 9)
  7570. * relaxing on M68HC11: M68HC11/68HC12. (line 12)
  7571. * relaxing on NDS32: NDS32. (line 6)
  7572. * relaxing on Xtensa: Xtensa. (line 27)
  7573. * relocatable and absolute symbols: Expression Section. (line 6)
  7574. * relocatable output: Options. (line 600)
  7575. * removing sections: Output Section Discarding.
  7576. (line 6)
  7577. * reporting bugs in ld: Reporting Bugs. (line 6)
  7578. * requirements for BFD: BFD. (line 16)
  7579. * retain relocations in final executable: Options. (line 587)
  7580. * retaining specified symbols: Options. (line 1634)
  7581. * rodata segment origin, cmd line: Options. (line 1835)
  7582. * ROM initialized data: Output Section LMA. (line 39)
  7583. * round up expression: Builtin Functions. (line 38)
  7584. * round up location counter: Builtin Functions. (line 38)
  7585. * runtime library name: Options. (line 354)
  7586. * runtime library search path: Options. (line 1648)
  7587. * runtime pseudo-relocation: WIN32. (line 211)
  7588. * S/390: S/390 ELF. (line 6)
  7589. * S/390 ELF options: S/390 ELF. (line 6)
  7590. * scaled integers: Constants. (line 15)
  7591. * scommon section: Input Section Common.
  7592. (line 20)
  7593. * script files: Options. (line 651)
  7594. * script files <1>: Options. (line 660)
  7595. * scripts: Scripts. (line 6)
  7596. * search directory, from cmd line: Options. (line 405)
  7597. * search path in linker script: File Commands. (line 80)
  7598. * SEARCH_DIR(PATH): File Commands. (line 80)
  7599. * SECT (MRI): MRI. (line 101)
  7600. * section address: Output Section Address.
  7601. (line 6)
  7602. * section address in expression: Builtin Functions. (line 17)
  7603. * section alignment: Builtin Functions. (line 63)
  7604. * section alignment, warnings on: Options. (line 1983)
  7605. * section data: Output Section Data.
  7606. (line 6)
  7607. * section fill pattern: Output Section Fill.
  7608. (line 6)
  7609. * section groups: Options. (line 1284)
  7610. * section groups <1>: Miscellaneous Commands.
  7611. (line 56)
  7612. * section load address: Output Section LMA. (line 6)
  7613. * section load address in expression: Builtin Functions. (line 144)
  7614. * section name: Output Section Name.
  7615. (line 6)
  7616. * section name wildcard patterns: Input Section Wildcards.
  7617. (line 6)
  7618. * section size: Builtin Functions. (line 175)
  7619. * section, assigning to memory region: Output Section Region.
  7620. (line 6)
  7621. * section, assigning to program header: Output Section Phdr.
  7622. (line 6)
  7623. * SECTIONS: SECTIONS. (line 6)
  7624. * sections, discarding: Output Section Discarding.
  7625. (line 6)
  7626. * sections, orphan: Options. (line 704)
  7627. * Secure gateway import library: ARM. (line 234)
  7628. * segment origins, cmd line: Options. (line 1824)
  7629. * segments, ELF: PHDRS. (line 6)
  7630. * SEGMENT_START(SEGMENT, DEFAULT): Builtin Functions. (line 167)
  7631. * shared libraries: Options. (line 1742)
  7632. * SHORT(EXPRESSION): Output Section Data.
  7633. (line 6)
  7634. * SIZEOF(SECTION): Builtin Functions. (line 175)
  7635. * SIZEOF_HEADERS: Builtin Functions. (line 191)
  7636. * small common symbols: Input Section Common.
  7637. (line 20)
  7638. * SORT: Input Section Wildcards.
  7639. (line 64)
  7640. * SORT_BY_ALIGNMENT: Input Section Wildcards.
  7641. (line 51)
  7642. * SORT_BY_INIT_PRIORITY: Input Section Wildcards.
  7643. (line 57)
  7644. * SORT_BY_NAME: Input Section Wildcards.
  7645. (line 43)
  7646. * SORT_NONE: Input Section Wildcards.
  7647. (line 100)
  7648. * SPU: SPU ELF. (line 29)
  7649. * SPU <1>: SPU ELF. (line 46)
  7650. * SPU ELF options: SPU ELF. (line 6)
  7651. * SPU extra overlay stubs: SPU ELF. (line 19)
  7652. * SPU local store size: SPU ELF. (line 24)
  7653. * SPU overlay stub symbols: SPU ELF. (line 15)
  7654. * SPU overlays: SPU ELF. (line 9)
  7655. * SPU plugins: SPU ELF. (line 6)
  7656. * SQUAD(EXPRESSION): Output Section Data.
  7657. (line 6)
  7658. * stack size: Options. (line 2533)
  7659. * standard Unix system: Options. (line 7)
  7660. * start of execution: Entry Point. (line 6)
  7661. * STARTUP(FILENAME): File Commands. (line 88)
  7662. * static library dependencies: libdep Plugin. (line 6)
  7663. * STM32L4xx erratum workaround: ARM. (line 120)
  7664. * strip all symbols: Options. (line 629)
  7665. * strip debugger symbols: Options. (line 633)
  7666. * stripping all but some symbols: Options. (line 1634)
  7667. * STUB_GROUP_SIZE: ARM. (line 176)
  7668. * SUBALIGN(SUBSECTION_ALIGN): Forced Input Alignment.
  7669. (line 6)
  7670. * suffixes for integers: Constants. (line 15)
  7671. * symbol defaults: Builtin Functions. (line 124)
  7672. * symbol definition, scripts: Assignments. (line 6)
  7673. * symbol names: Symbols. (line 6)
  7674. * symbol tracing: Options. (line 755)
  7675. * symbol versions: VERSION. (line 6)
  7676. * symbol-only input: Options. (line 618)
  7677. * symbolic constants: Symbolic Constants. (line 6)
  7678. * symbols, from command line: Options. (line 1292)
  7679. * symbols, relocatable and absolute: Expression Section. (line 6)
  7680. * symbols, require defined: Options. (line 686)
  7681. * symbols, retaining selectively: Options. (line 1634)
  7682. * synthesizing linker: Options. (line 1608)
  7683. * synthesizing on H8/300: H8/300. (line 14)
  7684. * TARGET(BFDNAME): Format Commands. (line 35)
  7685. * TARGET1: ARM. (line 33)
  7686. * TARGET2: ARM. (line 38)
  7687. * text segment origin, cmd line: Options. (line 1831)
  7688. * thumb entry point: ARM. (line 17)
  7689. * TI COFF versions: TI COFF. (line 6)
  7690. * traditional format: Options. (line 1803)
  7691. * trampoline generation on M68HC11: M68HC11/68HC12. (line 30)
  7692. * trampoline generation on M68HC12: M68HC11/68HC12. (line 30)
  7693. * unallocated address, next: Builtin Functions. (line 158)
  7694. * undefined symbol: Options. (line 673)
  7695. * undefined symbol in linker script: Miscellaneous Commands.
  7696. (line 39)
  7697. * undefined symbols, warnings on: Options. (line 1979)
  7698. * uninitialized data placement: Input Section Common.
  7699. (line 6)
  7700. * unspecified memory: Output Section Data.
  7701. (line 39)
  7702. * usage: Options. (line 1428)
  7703. * USE_BLX: ARM. (line 73)
  7704. * using a DEF file: WIN32. (line 52)
  7705. * using auto-export functionality: WIN32. (line 22)
  7706. * Using decorations: WIN32. (line 157)
  7707. * variables, defining: Assignments. (line 6)
  7708. * verbose[=NUMBER]: Options. (line 1874)
  7709. * version: Options. (line 739)
  7710. * version script: VERSION. (line 6)
  7711. * version script, symbol versions: Options. (line 1882)
  7712. * VERSION {script text}: VERSION. (line 6)
  7713. * versions of symbols: VERSION. (line 6)
  7714. * VFP11_DENORM_FIX: ARM. (line 82)
  7715. * visibility: Options. (line 1031)
  7716. * warnings, on combining symbols: Options. (line 1892)
  7717. * warnings, on section alignment: Options. (line 1983)
  7718. * warnings, on undefined symbols: Options. (line 1979)
  7719. * weak externals: WIN32. (line 401)
  7720. * what is this?: Overview. (line 6)
  7721. * wildcard file name patterns: Input Section Wildcards.
  7722. (line 6)
  7723. * Xtensa options: Xtensa. (line 55)
  7724. * Xtensa processors: Xtensa. (line 6)
  7725. 
  7726. Tag Table:
  7727. Node: Top762
  7728. Node: Overview1649
  7729. Node: Invocation2765
  7730. Node: Options3173
  7731. Node: Environment130452
  7732. Node: Scripts132213
  7733. Node: Basic Script Concepts133937
  7734. Node: Script Format136645
  7735. Node: Simple Example137508
  7736. Node: Simple Commands140602
  7737. Node: Entry Point141107
  7738. Node: File Commands142036
  7739. Node: Format Commands146345
  7740. Node: REGION_ALIAS148301
  7741. Node: Miscellaneous Commands153128
  7742. Node: Assignments158959
  7743. Node: Simple Assignments159470
  7744. Node: HIDDEN161201
  7745. Node: PROVIDE161828
  7746. Node: PROVIDE_HIDDEN163349
  7747. Node: Source Code Reference163593
  7748. Node: SECTIONS167510
  7749. Node: Output Section Description169398
  7750. Node: Output Section Name170639
  7751. Node: Output Section Address171516
  7752. Node: Input Section173749
  7753. Node: Input Section Basics174550
  7754. Node: Input Section Wildcards179568
  7755. Node: Input Section Common184863
  7756. Node: Input Section Keep186345
  7757. Node: Input Section Example186835
  7758. Node: Output Section Data188246
  7759. Node: Output Section Keywords191025
  7760. Node: Output Section Discarding194592
  7761. Node: Output Section Attributes196482
  7762. Node: Output Section Type197601
  7763. Node: Output Section LMA198671
  7764. Node: Forced Output Alignment201742
  7765. Node: Forced Input Alignment202171
  7766. Node: Output Section Constraint202559
  7767. Node: Output Section Region202987
  7768. Node: Output Section Phdr203420
  7769. Node: Output Section Fill204084
  7770. Node: Overlay Description205226
  7771. Node: MEMORY209671
  7772. Node: PHDRS214277
  7773. Node: VERSION219603
  7774. Node: Expressions227694
  7775. Node: Constants228623
  7776. Node: Symbolic Constants229497
  7777. Node: Symbols230048
  7778. Node: Orphan Sections230795
  7779. Node: Location Counter232380
  7780. Node: Operators236814
  7781. Node: Evaluation237736
  7782. Node: Expression Section239100
  7783. Node: Builtin Functions243070
  7784. Node: Implicit Linker Scripts251421
  7785. Node: Plugins252196
  7786. Node: libdep Plugin252656
  7787. Node: Machine Dependent254453
  7788. Node: H8/300255541
  7789. Node: M68HC11/68HC12257614
  7790. Node: ARM259061
  7791. Node: HPPA ELF32271308
  7792. Node: M68K272931
  7793. Node: MIPS273840
  7794. Node: MMIX274956
  7795. Node: MSP430276121
  7796. Node: NDS32278034
  7797. Node: Nios II278998
  7798. Node: PowerPC ELF32280314
  7799. Node: PowerPC64 ELF64283145
  7800. Node: S/390 ELF292903
  7801. Node: SPU ELF293250
  7802. Node: TI COFF295878
  7803. Node: WIN32296404
  7804. Node: Xtensa316551
  7805. Node: BFD319994
  7806. Node: BFD outline321452
  7807. Node: BFD information loss322740
  7808. Node: Canonical format325266
  7809. Node: Reporting Bugs329594
  7810. Node: Bug Criteria330288
  7811. Node: Bug Reporting330987
  7812. Node: MRI338014
  7813. Node: GNU Free Documentation License342485
  7814. Node: LD Index367622
  7815. 
  7816. End Tag Table