ld.info 432 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375
  1. This is ld.info, produced by makeinfo version 6.8 from ld.texi.
  2. This file documents the GNU linker LD (GNU Binutils) version 2.38.
  3. Copyright (C) 1991-2022 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with no
  7. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  8. Texts. A copy of the license is included in the section entitled "GNU
  9. Free Documentation License".
  10. INFO-DIR-SECTION Software development
  11. START-INFO-DIR-ENTRY
  12. * Ld: (ld). The GNU linker.
  13. END-INFO-DIR-ENTRY
  14. 
  15. File: ld.info, Node: Top, Next: Overview, Up: (dir)
  16. LD
  17. **
  18. This file documents the GNU linker ld (GNU Binutils) version 2.38.
  19. This document is distributed under the terms of the GNU Free
  20. Documentation License version 1.3. A copy of the license is included in
  21. the section entitled "GNU Free Documentation License".
  22. * Menu:
  23. * Overview:: Overview
  24. * Invocation:: Invocation
  25. * Scripts:: Linker Scripts
  26. * Plugins:: Linker Plugins
  27. * Machine Dependent:: Machine Dependent Features
  28. * BFD:: BFD
  29. * Reporting Bugs:: Reporting Bugs
  30. * MRI:: MRI Compatible Script Files
  31. * GNU Free Documentation License:: GNU Free Documentation License
  32. * LD Index:: LD Index
  33. 
  34. File: ld.info, Node: Overview, Next: Invocation, Prev: Top, Up: Top
  35. 1 Overview
  36. **********
  37. 'ld' combines a number of object and archive files, relocates their data
  38. and ties up symbol references. Usually the last step in compiling a
  39. program is to run 'ld'.
  40. 'ld' accepts Linker Command Language files written in a superset of
  41. AT&T's Link Editor Command Language syntax, to provide explicit and
  42. total control over the linking process.
  43. This version of 'ld' uses the general purpose BFD libraries to
  44. operate on object files. This allows 'ld' to read, combine, and write
  45. object files in many different formats--for example, COFF or 'a.out'.
  46. Different formats may be linked together to produce any available kind
  47. of object file. *Note BFD::, for more information.
  48. Aside from its flexibility, the GNU linker is more helpful than other
  49. linkers in providing diagnostic information. Many linkers abandon
  50. execution immediately upon encountering an error; whenever possible,
  51. 'ld' continues executing, allowing you to identify other errors (or, in
  52. some cases, to get an output file in spite of the error).
  53. 
  54. File: ld.info, Node: Invocation, Next: Scripts, Prev: Overview, Up: Top
  55. 2 Invocation
  56. ************
  57. The GNU linker 'ld' is meant to cover a broad range of situations, and
  58. to be as compatible as possible with other linkers. As a result, you
  59. have many choices to control its behavior.
  60. * Menu:
  61. * Options:: Command-line Options
  62. * Environment:: Environment Variables
  63. 
  64. File: ld.info, Node: Options, Next: Environment, Up: Invocation
  65. 2.1 Command-line Options
  66. ========================
  67. The linker supports a plethora of command-line options, but in actual
  68. practice few of them are used in any particular context. For instance,
  69. a frequent use of 'ld' is to link standard Unix object files on a
  70. standard, supported Unix system. On such a system, to link a file
  71. 'hello.o':
  72. ld -o OUTPUT /lib/crt0.o hello.o -lc
  73. This tells 'ld' to produce a file called OUTPUT as the result of
  74. linking the file '/lib/crt0.o' with 'hello.o' and the library 'libc.a',
  75. which will come from the standard search directories. (See the
  76. discussion of the '-l' option below.)
  77. Some of the command-line options to 'ld' may be specified at any
  78. point in the command line. However, options which refer to files, such
  79. as '-l' or '-T', cause the file to be read at the point at which the
  80. option appears in the command line, relative to the object files and
  81. other file options. Repeating non-file options with a different
  82. argument will either have no further effect, or override prior
  83. occurrences (those further to the left on the command line) of that
  84. option. Options which may be meaningfully specified more than once are
  85. noted in the descriptions below.
  86. Non-option arguments are object files or archives which are to be
  87. linked together. They may follow, precede, or be mixed in with
  88. command-line options, except that an object file argument may not be
  89. placed between an option and its argument.
  90. Usually the linker is invoked with at least one object file, but you
  91. can specify other forms of binary input files using '-l', '-R', and the
  92. script command language. If _no_ binary input files at all are
  93. specified, the linker does not produce any output, and issues the
  94. message 'No input files'.
  95. If the linker cannot recognize the format of an object file, it will
  96. assume that it is a linker script. A script specified in this way
  97. augments the main linker script used for the link (either the default
  98. linker script or the one specified by using '-T'). This feature permits
  99. the linker to link against a file which appears to be an object or an
  100. archive, but actually merely defines some symbol values, or uses 'INPUT'
  101. or 'GROUP' to load other objects. Specifying a script in this way
  102. merely augments the main linker script, with the extra commands placed
  103. after the main script; use the '-T' option to replace the default linker
  104. script entirely, but note the effect of the 'INSERT' command. *Note
  105. Scripts::.
  106. For options whose names are a single letter, option arguments must
  107. either follow the option letter without intervening whitespace, or be
  108. given as separate arguments immediately following the option that
  109. requires them.
  110. For options whose names are multiple letters, either one dash or two
  111. can precede the option name; for example, '-trace-symbol' and
  112. '--trace-symbol' are equivalent. Note--there is one exception to this
  113. rule. Multiple letter options that start with a lower case 'o' can only
  114. be preceded by two dashes. This is to reduce confusion with the '-o'
  115. option. So for example '-omagic' sets the output file name to 'magic'
  116. whereas '--omagic' sets the NMAGIC flag on the output.
  117. Arguments to multiple-letter options must either be separated from
  118. the option name by an equals sign, or be given as separate arguments
  119. immediately following the option that requires them. For example,
  120. '--trace-symbol foo' and '--trace-symbol=foo' are equivalent. Unique
  121. abbreviations of the names of multiple-letter options are accepted.
  122. Note--if the linker is being invoked indirectly, via a compiler
  123. driver (e.g. 'gcc') then all the linker command-line options should be
  124. prefixed by '-Wl,' (or whatever is appropriate for the particular
  125. compiler driver) like this:
  126. gcc -Wl,--start-group foo.o bar.o -Wl,--end-group
  127. This is important, because otherwise the compiler driver program may
  128. silently drop the linker options, resulting in a bad link. Confusion
  129. may also arise when passing options that require values through a
  130. driver, as the use of a space between option and argument acts as a
  131. separator, and causes the driver to pass only the option to the linker
  132. and the argument to the compiler. In this case, it is simplest to use
  133. the joined forms of both single- and multiple-letter options, such as:
  134. gcc foo.o bar.o -Wl,-eENTRY -Wl,-Map=a.map
  135. Here is a table of the generic command-line switches accepted by the
  136. GNU linker:
  137. '@FILE'
  138. Read command-line options from FILE. The options read are inserted
  139. in place of the original @FILE option. If FILE does not exist, or
  140. cannot be read, then the option will be treated literally, and not
  141. removed.
  142. Options in FILE are separated by whitespace. A whitespace
  143. character may be included in an option by surrounding the entire
  144. option in either single or double quotes. Any character (including
  145. a backslash) may be included by prefixing the character to be
  146. included with a backslash. The FILE may itself contain additional
  147. @FILE options; any such options will be processed recursively.
  148. '-a KEYWORD'
  149. This option is supported for HP/UX compatibility. The KEYWORD
  150. argument must be one of the strings 'archive', 'shared', or
  151. 'default'. '-aarchive' is functionally equivalent to '-Bstatic',
  152. and the other two keywords are functionally equivalent to
  153. '-Bdynamic'. This option may be used any number of times.
  154. '--audit AUDITLIB'
  155. Adds AUDITLIB to the 'DT_AUDIT' entry of the dynamic section.
  156. AUDITLIB is not checked for existence, nor will it use the
  157. DT_SONAME specified in the library. If specified multiple times
  158. 'DT_AUDIT' will contain a colon separated list of audit interfaces
  159. to use. If the linker finds an object with an audit entry while
  160. searching for shared libraries, it will add a corresponding
  161. 'DT_DEPAUDIT' entry in the output file. This option is only
  162. meaningful on ELF platforms supporting the rtld-audit interface.
  163. '-b INPUT-FORMAT'
  164. '--format=INPUT-FORMAT'
  165. 'ld' may be configured to support more than one kind of object
  166. file. If your 'ld' is configured this way, you can use the '-b'
  167. option to specify the binary format for input object files that
  168. follow this option on the command line. Even when 'ld' is
  169. configured to support alternative object formats, you don't usually
  170. need to specify this, as 'ld' should be configured to expect as a
  171. default input format the most usual format on each machine.
  172. INPUT-FORMAT is a text string, the name of a particular format
  173. supported by the BFD libraries. (You can list the available binary
  174. formats with 'objdump -i'.) *Note BFD::.
  175. You may want to use this option if you are linking files with an
  176. unusual binary format. You can also use '-b' to switch formats
  177. explicitly (when linking object files of different formats), by
  178. including '-b INPUT-FORMAT' before each group of object files in a
  179. particular format.
  180. The default format is taken from the environment variable
  181. 'GNUTARGET'. *Note Environment::. You can also define the input
  182. format from a script, using the command 'TARGET'; see *note Format
  183. Commands::.
  184. '-c MRI-COMMANDFILE'
  185. '--mri-script=MRI-COMMANDFILE'
  186. For compatibility with linkers produced by MRI, 'ld' accepts script
  187. files written in an alternate, restricted command language,
  188. described in *note MRI Compatible Script Files: MRI. Introduce MRI
  189. script files with the option '-c'; use the '-T' option to run
  190. linker scripts written in the general-purpose 'ld' scripting
  191. language. If MRI-CMDFILE does not exist, 'ld' looks for it in the
  192. directories specified by any '-L' options.
  193. '-d'
  194. '-dc'
  195. '-dp'
  196. These three options are equivalent; multiple forms are supported
  197. for compatibility with other linkers. They assign space to common
  198. symbols even if a relocatable output file is specified (with '-r').
  199. The script command 'FORCE_COMMON_ALLOCATION' has the same effect.
  200. *Note Miscellaneous Commands::.
  201. '--depaudit AUDITLIB'
  202. '-P AUDITLIB'
  203. Adds AUDITLIB to the 'DT_DEPAUDIT' entry of the dynamic section.
  204. AUDITLIB is not checked for existence, nor will it use the
  205. DT_SONAME specified in the library. If specified multiple times
  206. 'DT_DEPAUDIT' will contain a colon separated list of audit
  207. interfaces to use. This option is only meaningful on ELF platforms
  208. supporting the rtld-audit interface. The -P option is provided for
  209. Solaris compatibility.
  210. '--enable-non-contiguous-regions'
  211. This option avoids generating an error if an input section does not
  212. fit a matching output section. The linker tries to allocate the
  213. input section to subseque nt matching output sections, and
  214. generates an error only if no output section is large enough. This
  215. is useful when several non-contiguous memory regions are available
  216. and the input section does not require a particular one. The order
  217. in which input sections are evaluated does not change, for
  218. instance:
  219. MEMORY {
  220. MEM1 (rwx) : ORIGIN : 0x1000, LENGTH = 0x14
  221. MEM2 (rwx) : ORIGIN : 0x1000, LENGTH = 0x40
  222. MEM3 (rwx) : ORIGIN : 0x2000, LENGTH = 0x40
  223. }
  224. SECTIONS {
  225. mem1 : { *(.data.*); } > MEM1
  226. mem2 : { *(.data.*); } > MEM2
  227. mem3 : { *(.data.*); } > MEM2
  228. }
  229. with input sections:
  230. .data.1: size 8
  231. .data.2: size 0x10
  232. .data.3: size 4
  233. results in .data.1 affected to mem1, and .data.2 and .data.3
  234. affected to mem2, even though .data.3 would fit in mem3.
  235. This option is incompatible with INSERT statements because it
  236. changes the way input sections are mapped to output sections.
  237. '--enable-non-contiguous-regions-warnings'
  238. This option enables warnings when '--enable-non-contiguous-regions'
  239. allows possibly unexpected matches in sections mapping, potentially
  240. leading to silently discarding a section instead of failing because
  241. it does not fit any output region.
  242. '-e ENTRY'
  243. '--entry=ENTRY'
  244. Use ENTRY as the explicit symbol for beginning execution of your
  245. program, rather than the default entry point. If there is no
  246. symbol named ENTRY, the linker will try to parse ENTRY as a number,
  247. and use that as the entry address (the number will be interpreted
  248. in base 10; you may use a leading '0x' for base 16, or a leading
  249. '0' for base 8). *Note Entry Point::, for a discussion of defaults
  250. and other ways of specifying the entry point.
  251. '--exclude-libs LIB,LIB,...'
  252. Specifies a list of archive libraries from which symbols should not
  253. be automatically exported. The library names may be delimited by
  254. commas or colons. Specifying '--exclude-libs ALL' excludes symbols
  255. in all archive libraries from automatic export. This option is
  256. available only for the i386 PE targeted port of the linker and for
  257. ELF targeted ports. For i386 PE, symbols explicitly listed in a
  258. .def file are still exported, regardless of this option. For ELF
  259. targeted ports, symbols affected by this option will be treated as
  260. hidden.
  261. '--exclude-modules-for-implib MODULE,MODULE,...'
  262. Specifies a list of object files or archive members, from which
  263. symbols should not be automatically exported, but which should be
  264. copied wholesale into the import library being generated during the
  265. link. The module names may be delimited by commas or colons, and
  266. must match exactly the filenames used by 'ld' to open the files;
  267. for archive members, this is simply the member name, but for object
  268. files the name listed must include and match precisely any path
  269. used to specify the input file on the linker's command-line. This
  270. option is available only for the i386 PE targeted port of the
  271. linker. Symbols explicitly listed in a .def file are still
  272. exported, regardless of this option.
  273. '-E'
  274. '--export-dynamic'
  275. '--no-export-dynamic'
  276. When creating a dynamically linked executable, using the '-E'
  277. option or the '--export-dynamic' option causes the linker to add
  278. all symbols to the dynamic symbol table. The dynamic symbol table
  279. is the set of symbols which are visible from dynamic objects at run
  280. time.
  281. If you do not use either of these options (or use the
  282. '--no-export-dynamic' option to restore the default behavior), the
  283. dynamic symbol table will normally contain only those symbols which
  284. are referenced by some dynamic object mentioned in the link.
  285. If you use 'dlopen' to load a dynamic object which needs to refer
  286. back to the symbols defined by the program, rather than some other
  287. dynamic object, then you will probably need to use this option when
  288. linking the program itself.
  289. You can also use the dynamic list to control what symbols should be
  290. added to the dynamic symbol table if the output format supports it.
  291. See the description of '--dynamic-list'.
  292. Note that this option is specific to ELF targeted ports. PE
  293. targets support a similar function to export all symbols from a DLL
  294. or EXE; see the description of '--export-all-symbols' below.
  295. '--export-dynamic-symbol=GLOB'
  296. When creating a dynamically linked executable, symbols matching
  297. GLOB will be added to the dynamic symbol table. When creating a
  298. shared library, references to symbols matching GLOB will not be
  299. bound to the definitions within the shared library. This option is
  300. a no-op when creating a shared library and '-Bsymbolic' or
  301. '--dynamic-list' are not specified. This option is only meaningful
  302. on ELF platforms which support shared libraries.
  303. '--export-dynamic-symbol-list=FILE'
  304. Specify a '--export-dynamic-symbol' for each pattern in the file.
  305. The format of the file is the same as the version node without
  306. scope and node name. See *note VERSION:: for more information.
  307. '-EB'
  308. Link big-endian objects. This affects the default output format.
  309. '-EL'
  310. Link little-endian objects. This affects the default output
  311. format.
  312. '-f NAME'
  313. '--auxiliary=NAME'
  314. When creating an ELF shared object, set the internal DT_AUXILIARY
  315. field to the specified name. This tells the dynamic linker that
  316. the symbol table of the shared object should be used as an
  317. auxiliary filter on the symbol table of the shared object NAME.
  318. If you later link a program against this filter object, then, when
  319. you run the program, the dynamic linker will see the DT_AUXILIARY
  320. field. If the dynamic linker resolves any symbols from the filter
  321. object, it will first check whether there is a definition in the
  322. shared object NAME. If there is one, it will be used instead of
  323. the definition in the filter object. The shared object NAME need
  324. not exist. Thus the shared object NAME may be used to provide an
  325. alternative implementation of certain functions, perhaps for
  326. debugging or for machine-specific performance.
  327. This option may be specified more than once. The DT_AUXILIARY
  328. entries will be created in the order in which they appear on the
  329. command line.
  330. '-F NAME'
  331. '--filter=NAME'
  332. When creating an ELF shared object, set the internal DT_FILTER
  333. field to the specified name. This tells the dynamic linker that
  334. the symbol table of the shared object which is being created should
  335. be used as a filter on the symbol table of the shared object NAME.
  336. If you later link a program against this filter object, then, when
  337. you run the program, the dynamic linker will see the DT_FILTER
  338. field. The dynamic linker will resolve symbols according to the
  339. symbol table of the filter object as usual, but it will actually
  340. link to the definitions found in the shared object NAME. Thus the
  341. filter object can be used to select a subset of the symbols
  342. provided by the object NAME.
  343. Some older linkers used the '-F' option throughout a compilation
  344. toolchain for specifying object-file format for both input and
  345. output object files. The GNU linker uses other mechanisms for this
  346. purpose: the '-b', '--format', '--oformat' options, the 'TARGET'
  347. command in linker scripts, and the 'GNUTARGET' environment
  348. variable. The GNU linker will ignore the '-F' option when not
  349. creating an ELF shared object.
  350. '-fini=NAME'
  351. When creating an ELF executable or shared object, call NAME when
  352. the executable or shared object is unloaded, by setting DT_FINI to
  353. the address of the function. By default, the linker uses '_fini'
  354. as the function to call.
  355. '-g'
  356. Ignored. Provided for compatibility with other tools.
  357. '-G VALUE'
  358. '--gpsize=VALUE'
  359. Set the maximum size of objects to be optimized using the GP
  360. register to SIZE. This is only meaningful for object file formats
  361. such as MIPS ELF that support putting large and small objects into
  362. different sections. This is ignored for other object file formats.
  363. '-h NAME'
  364. '-soname=NAME'
  365. When creating an ELF shared object, set the internal DT_SONAME
  366. field to the specified name. When an executable is linked with a
  367. shared object which has a DT_SONAME field, then when the executable
  368. is run the dynamic linker will attempt to load the shared object
  369. specified by the DT_SONAME field rather than using the file name
  370. given to the linker.
  371. '-i'
  372. Perform an incremental link (same as option '-r').
  373. '-init=NAME'
  374. When creating an ELF executable or shared object, call NAME when
  375. the executable or shared object is loaded, by setting DT_INIT to
  376. the address of the function. By default, the linker uses '_init'
  377. as the function to call.
  378. '-l NAMESPEC'
  379. '--library=NAMESPEC'
  380. Add the archive or object file specified by NAMESPEC to the list of
  381. files to link. This option may be used any number of times. If
  382. NAMESPEC is of the form ':FILENAME', 'ld' will search the library
  383. path for a file called FILENAME, otherwise it will search the
  384. library path for a file called 'libNAMESPEC.a'.
  385. On systems which support shared libraries, 'ld' may also search for
  386. files other than 'libNAMESPEC.a'. Specifically, on ELF and SunOS
  387. systems, 'ld' will search a directory for a library called
  388. 'libNAMESPEC.so' before searching for one called 'libNAMESPEC.a'.
  389. (By convention, a '.so' extension indicates a shared library.)
  390. Note that this behavior does not apply to ':FILENAME', which always
  391. specifies a file called FILENAME.
  392. The linker will search an archive only once, at the location where
  393. it is specified on the command line. If the archive defines a
  394. symbol which was undefined in some object which appeared before the
  395. archive on the command line, the linker will include the
  396. appropriate file(s) from the archive. However, an undefined symbol
  397. in an object appearing later on the command line will not cause the
  398. linker to search the archive again.
  399. See the '-(' option for a way to force the linker to search
  400. archives multiple times.
  401. You may list the same archive multiple times on the command line.
  402. This type of archive searching is standard for Unix linkers.
  403. However, if you are using 'ld' on AIX, note that it is different
  404. from the behaviour of the AIX linker.
  405. '-L SEARCHDIR'
  406. '--library-path=SEARCHDIR'
  407. Add path SEARCHDIR to the list of paths that 'ld' will search for
  408. archive libraries and 'ld' control scripts. You may use this
  409. option any number of times. The directories are searched in the
  410. order in which they are specified on the command line. Directories
  411. specified on the command line are searched before the default
  412. directories. All '-L' options apply to all '-l' options,
  413. regardless of the order in which the options appear. '-L' options
  414. do not affect how 'ld' searches for a linker script unless '-T'
  415. option is specified.
  416. If SEARCHDIR begins with '=' or '$SYSROOT', then this prefix will
  417. be replaced by the "sysroot prefix", controlled by the '--sysroot'
  418. option, or specified when the linker is configured.
  419. The default set of paths searched (without being specified with
  420. '-L') depends on which emulation mode 'ld' is using, and in some
  421. cases also on how it was configured. *Note Environment::.
  422. The paths can also be specified in a link script with the
  423. 'SEARCH_DIR' command. Directories specified this way are searched
  424. at the point in which the linker script appears in the command
  425. line.
  426. '-m EMULATION'
  427. Emulate the EMULATION linker. You can list the available
  428. emulations with the '--verbose' or '-V' options.
  429. If the '-m' option is not used, the emulation is taken from the
  430. 'LDEMULATION' environment variable, if that is defined.
  431. Otherwise, the default emulation depends upon how the linker was
  432. configured.
  433. '-M'
  434. '--print-map'
  435. Print a link map to the standard output. A link map provides
  436. information about the link, including the following:
  437. * Where object files are mapped into memory.
  438. * How common symbols are allocated.
  439. * All archive members included in the link, with a mention of
  440. the symbol which caused the archive member to be brought in.
  441. * The values assigned to symbols.
  442. Note - symbols whose values are computed by an expression
  443. which involves a reference to a previous value of the same
  444. symbol may not have correct result displayed in the link map.
  445. This is because the linker discards intermediate results and
  446. only retains the final value of an expression. Under such
  447. circumstances the linker will display the final value enclosed
  448. by square brackets. Thus for example a linker script
  449. containing:
  450. foo = 1
  451. foo = foo * 4
  452. foo = foo + 8
  453. will produce the following output in the link map if the '-M'
  454. option is used:
  455. 0x00000001 foo = 0x1
  456. [0x0000000c] foo = (foo * 0x4)
  457. [0x0000000c] foo = (foo + 0x8)
  458. See *note Expressions:: for more information about expressions
  459. in linker scripts.
  460. * How GNU properties are merged.
  461. When the linker merges input .note.gnu.property sections into
  462. one output .note.gnu.property section, some properties are
  463. removed or updated. These actions are reported in the link
  464. map. For example:
  465. Removed property 0xc0000002 to merge foo.o (0x1) and bar.o (not found)
  466. This indicates that property 0xc0000002 is removed from output
  467. when merging properties in 'foo.o', whose property 0xc0000002
  468. value is 0x1, and 'bar.o', which doesn't have property
  469. 0xc0000002.
  470. Updated property 0xc0010001 (0x1) to merge foo.o (0x1) and bar.o (0x1)
  471. This indicates that property 0xc0010001 value is updated to
  472. 0x1 in output when merging properties in 'foo.o', whose
  473. 0xc0010001 property value is 0x1, and 'bar.o', whose
  474. 0xc0010001 property value is 0x1.
  475. '--print-map-discarded'
  476. '--no-print-map-discarded'
  477. Print (or do not print) the list of discarded and garbage collected
  478. sections in the link map. Enabled by default.
  479. '-n'
  480. '--nmagic'
  481. Turn off page alignment of sections, and disable linking against
  482. shared libraries. If the output format supports Unix style magic
  483. numbers, mark the output as 'NMAGIC'.
  484. '-N'
  485. '--omagic'
  486. Set the text and data sections to be readable and writable. Also,
  487. do not page-align the data segment, and disable linking against
  488. shared libraries. If the output format supports Unix style magic
  489. numbers, mark the output as 'OMAGIC'. Note: Although a writable
  490. text section is allowed for PE-COFF targets, it does not conform to
  491. the format specification published by Microsoft.
  492. '--no-omagic'
  493. This option negates most of the effects of the '-N' option. It
  494. sets the text section to be read-only, and forces the data segment
  495. to be page-aligned. Note - this option does not enable linking
  496. against shared libraries. Use '-Bdynamic' for this.
  497. '-o OUTPUT'
  498. '--output=OUTPUT'
  499. Use OUTPUT as the name for the program produced by 'ld'; if this
  500. option is not specified, the name 'a.out' is used by default. The
  501. script command 'OUTPUT' can also specify the output file name.
  502. '--dependency-file=DEPFILE'
  503. Write a "dependency file" to DEPFILE. This file contains a rule
  504. suitable for 'make' describing the output file and all the input
  505. files that were read to produce it. The output is similar to the
  506. compiler's output with '-M -MP' (*note Options Controlling the
  507. Preprocessor: (gcc.info)Preprocessor Options.). Note that there is
  508. no option like the compiler's '-MM', to exclude "system files"
  509. (which is not a well-specified concept in the linker, unlike
  510. "system headers" in the compiler). So the output from
  511. '--dependency-file' is always specific to the exact state of the
  512. installation where it was produced, and should not be copied into
  513. distributed makefiles without careful editing.
  514. '-O LEVEL'
  515. If LEVEL is a numeric values greater than zero 'ld' optimizes the
  516. output. This might take significantly longer and therefore
  517. probably should only be enabled for the final binary. At the
  518. moment this option only affects ELF shared library generation.
  519. Future releases of the linker may make more use of this option.
  520. Also currently there is no difference in the linker's behaviour for
  521. different non-zero values of this option. Again this may change
  522. with future releases.
  523. '-plugin NAME'
  524. Involve a plugin in the linking process. The NAME parameter is the
  525. absolute filename of the plugin. Usually this parameter is
  526. automatically added by the complier, when using link time
  527. optimization, but users can also add their own plugins if they so
  528. wish.
  529. Note that the location of the compiler originated plugins is
  530. different from the place where the 'ar', 'nm' and 'ranlib' programs
  531. search for their plugins. In order for those commands to make use
  532. of a compiler based plugin it must first be copied into the
  533. '${libdir}/bfd-plugins' directory. All gcc based linker plugins
  534. are backward compatible, so it is sufficient to just copy in the
  535. newest one.
  536. '--push-state'
  537. The '--push-state' allows one to preserve the current state of the
  538. flags which govern the input file handling so that they can all be
  539. restored with one corresponding '--pop-state' option.
  540. The option which are covered are: '-Bdynamic', '-Bstatic', '-dn',
  541. '-dy', '-call_shared', '-non_shared', '-static', '-N', '-n',
  542. '--whole-archive', '--no-whole-archive', '-r', '-Ur',
  543. '--copy-dt-needed-entries', '--no-copy-dt-needed-entries',
  544. '--as-needed', '--no-as-needed', and '-a'.
  545. One target for this option are specifications for 'pkg-config'.
  546. When used with the '--libs' option all possibly needed libraries
  547. are listed and then possibly linked with all the time. It is
  548. better to return something as follows:
  549. -Wl,--push-state,--as-needed -libone -libtwo -Wl,--pop-state
  550. '--pop-state'
  551. Undoes the effect of -push-state, restores the previous values of
  552. the flags governing input file handling.
  553. '-q'
  554. '--emit-relocs'
  555. Leave relocation sections and contents in fully linked executables.
  556. Post link analysis and optimization tools may need this information
  557. in order to perform correct modifications of executables. This
  558. results in larger executables.
  559. This option is currently only supported on ELF platforms.
  560. '--force-dynamic'
  561. Force the output file to have dynamic sections. This option is
  562. specific to VxWorks targets.
  563. '-r'
  564. '--relocatable'
  565. Generate relocatable output--i.e., generate an output file that can
  566. in turn serve as input to 'ld'. This is often called "partial
  567. linking". As a side effect, in environments that support standard
  568. Unix magic numbers, this option also sets the output file's magic
  569. number to 'OMAGIC'. If this option is not specified, an absolute
  570. file is produced. When linking C++ programs, this option _will
  571. not_ resolve references to constructors; to do that, use '-Ur'.
  572. When an input file does not have the same format as the output
  573. file, partial linking is only supported if that input file does not
  574. contain any relocations. Different output formats can have further
  575. restrictions; for example some 'a.out'-based formats do not support
  576. partial linking with input files in other formats at all.
  577. This option does the same thing as '-i'.
  578. '-R FILENAME'
  579. '--just-symbols=FILENAME'
  580. Read symbol names and their addresses from FILENAME, but do not
  581. relocate it or include it in the output. This allows your output
  582. file to refer symbolically to absolute locations of memory defined
  583. in other programs. You may use this option more than once.
  584. For compatibility with other ELF linkers, if the '-R' option is
  585. followed by a directory name, rather than a file name, it is
  586. treated as the '-rpath' option.
  587. '-s'
  588. '--strip-all'
  589. Omit all symbol information from the output file.
  590. '-S'
  591. '--strip-debug'
  592. Omit debugger symbol information (but not all symbols) from the
  593. output file.
  594. '--strip-discarded'
  595. '--no-strip-discarded'
  596. Omit (or do not omit) global symbols defined in discarded sections.
  597. Enabled by default.
  598. '-t'
  599. '--trace'
  600. Print the names of the input files as 'ld' processes them. If '-t'
  601. is given twice then members within archives are also printed. '-t'
  602. output is useful to generate a list of all the object files and
  603. scripts involved in linking, for example, when packaging files for
  604. a linker bug report.
  605. '-T SCRIPTFILE'
  606. '--script=SCRIPTFILE'
  607. Use SCRIPTFILE as the linker script. This script replaces 'ld''s
  608. default linker script (rather than adding to it), so COMMANDFILE
  609. must specify everything necessary to describe the output file.
  610. *Note Scripts::. If SCRIPTFILE does not exist in the current
  611. directory, 'ld' looks for it in the directories specified by any
  612. preceding '-L' options. Multiple '-T' options accumulate.
  613. '-dT SCRIPTFILE'
  614. '--default-script=SCRIPTFILE'
  615. Use SCRIPTFILE as the default linker script. *Note Scripts::.
  616. This option is similar to the '--script' option except that
  617. processing of the script is delayed until after the rest of the
  618. command line has been processed. This allows options placed after
  619. the '--default-script' option on the command line to affect the
  620. behaviour of the linker script, which can be important when the
  621. linker command line cannot be directly controlled by the user. (eg
  622. because the command line is being constructed by another tool, such
  623. as 'gcc').
  624. '-u SYMBOL'
  625. '--undefined=SYMBOL'
  626. Force SYMBOL to be entered in the output file as an undefined
  627. symbol. Doing this may, for example, trigger linking of additional
  628. modules from standard libraries. '-u' may be repeated with
  629. different option arguments to enter additional undefined symbols.
  630. This option is equivalent to the 'EXTERN' linker script command.
  631. If this option is being used to force additional modules to be
  632. pulled into the link, and if it is an error for the symbol to
  633. remain undefined, then the option '--require-defined' should be
  634. used instead.
  635. '--require-defined=SYMBOL'
  636. Require that SYMBOL is defined in the output file. This option is
  637. the same as option '--undefined' except that if SYMBOL is not
  638. defined in the output file then the linker will issue an error and
  639. exit. The same effect can be achieved in a linker script by using
  640. 'EXTERN', 'ASSERT' and 'DEFINED' together. This option can be used
  641. multiple times to require additional symbols.
  642. '-Ur'
  643. For anything other than C++ programs, this option is equivalent to
  644. '-r': it generates relocatable output--i.e., an output file that
  645. can in turn serve as input to 'ld'. When linking C++ programs,
  646. '-Ur' _does_ resolve references to constructors, unlike '-r'. It
  647. does not work to use '-Ur' on files that were themselves linked
  648. with '-Ur'; once the constructor table has been built, it cannot be
  649. added to. Use '-Ur' only for the last partial link, and '-r' for
  650. the others.
  651. '--orphan-handling=MODE'
  652. Control how orphan sections are handled. An orphan section is one
  653. not specifically mentioned in a linker script. *Note Orphan
  654. Sections::.
  655. MODE can have any of the following values:
  656. 'place'
  657. Orphan sections are placed into a suitable output section
  658. following the strategy described in *note Orphan Sections::.
  659. The option '--unique' also affects how sections are placed.
  660. 'discard'
  661. All orphan sections are discarded, by placing them in the
  662. '/DISCARD/' section (*note Output Section Discarding::).
  663. 'warn'
  664. The linker will place the orphan section as for 'place' and
  665. also issue a warning.
  666. 'error'
  667. The linker will exit with an error if any orphan section is
  668. found.
  669. The default if '--orphan-handling' is not given is 'place'.
  670. '--unique[=SECTION]'
  671. Creates a separate output section for every input section matching
  672. SECTION, or if the optional wildcard SECTION argument is missing,
  673. for every orphan input section. An orphan section is one not
  674. specifically mentioned in a linker script. You may use this option
  675. multiple times on the command line; It prevents the normal merging
  676. of input sections with the same name, overriding output section
  677. assignments in a linker script.
  678. '-v'
  679. '--version'
  680. '-V'
  681. Display the version number for 'ld'. The '-V' option also lists
  682. the supported emulations.
  683. '-x'
  684. '--discard-all'
  685. Delete all local symbols.
  686. '-X'
  687. '--discard-locals'
  688. Delete all temporary local symbols. (These symbols start with
  689. system-specific local label prefixes, typically '.L' for ELF
  690. systems or 'L' for traditional a.out systems.)
  691. '-y SYMBOL'
  692. '--trace-symbol=SYMBOL'
  693. Print the name of each linked file in which SYMBOL appears. This
  694. option may be given any number of times. On many systems it is
  695. necessary to prepend an underscore.
  696. This option is useful when you have an undefined symbol in your
  697. link but don't know where the reference is coming from.
  698. '-Y PATH'
  699. Add PATH to the default library search path. This option exists
  700. for Solaris compatibility.
  701. '-z KEYWORD'
  702. The recognized keywords are:
  703. 'bndplt'
  704. Always generate BND prefix in PLT entries. Supported for
  705. Linux/x86_64.
  706. 'call-nop=prefix-addr'
  707. 'call-nop=suffix-nop'
  708. 'call-nop=prefix-BYTE'
  709. 'call-nop=suffix-BYTE'
  710. Specify the 1-byte 'NOP' padding when transforming indirect
  711. call to a locally defined function, foo, via its GOT slot.
  712. 'call-nop=prefix-addr' generates '0x67 call foo'.
  713. 'call-nop=suffix-nop' generates 'call foo 0x90'.
  714. 'call-nop=prefix-BYTE' generates 'BYTE call foo'.
  715. 'call-nop=suffix-BYTE' generates 'call foo BYTE'. Supported
  716. for i386 and x86_64.
  717. 'cet-report=none'
  718. 'cet-report=warning'
  719. 'cet-report=error'
  720. Specify how to report the missing
  721. GNU_PROPERTY_X86_FEATURE_1_IBT and
  722. GNU_PROPERTY_X86_FEATURE_1_SHSTK properties in input
  723. .note.gnu.property section. 'cet-report=none', which is the
  724. default, will make the linker not report missing properties in
  725. input files. 'cet-report=warning' will make the linker issue
  726. a warning for missing properties in input files.
  727. 'cet-report=error' will make the linker issue an error for
  728. missing properties in input files. Note that 'ibt' will turn
  729. off the missing GNU_PROPERTY_X86_FEATURE_1_IBT property report
  730. and 'shstk' will turn off the missing
  731. GNU_PROPERTY_X86_FEATURE_1_SHSTK property report. Supported
  732. for Linux/i386 and Linux/x86_64.
  733. 'combreloc'
  734. 'nocombreloc'
  735. Combine multiple dynamic relocation sections and sort to
  736. improve dynamic symbol lookup caching. Do not do this if
  737. 'nocombreloc'.
  738. 'common'
  739. 'nocommon'
  740. Generate common symbols with STT_COMMON type during a
  741. relocatable link. Use STT_OBJECT type if 'nocommon'.
  742. 'common-page-size=VALUE'
  743. Set the page size most commonly used to VALUE. Memory image
  744. layout will be optimized to minimize memory pages if the
  745. system is using pages of this size.
  746. 'defs'
  747. Report unresolved symbol references from regular object files.
  748. This is done even if the linker is creating a non-symbolic
  749. shared library. This option is the inverse of '-z undefs'.
  750. 'dynamic-undefined-weak'
  751. 'nodynamic-undefined-weak'
  752. Make undefined weak symbols dynamic when building a dynamic
  753. object, if they are referenced from a regular object file and
  754. not forced local by symbol visibility or versioning. Do not
  755. make them dynamic if 'nodynamic-undefined-weak'. If neither
  756. option is given, a target may default to either option being
  757. in force, or make some other selection of undefined weak
  758. symbols dynamic. Not all targets support these options.
  759. 'execstack'
  760. Marks the object as requiring executable stack.
  761. 'global'
  762. This option is only meaningful when building a shared object.
  763. It makes the symbols defined by this shared object available
  764. for symbol resolution of subsequently loaded libraries.
  765. 'globalaudit'
  766. This option is only meaningful when building a dynamic
  767. executable. This option marks the executable as requiring
  768. global auditing by setting the 'DF_1_GLOBAUDIT' bit in the
  769. 'DT_FLAGS_1' dynamic tag. Global auditing requires that any
  770. auditing library defined via the '--depaudit' or '-P'
  771. command-line options be run for all dynamic objects loaded by
  772. the application.
  773. 'ibtplt'
  774. Generate Intel Indirect Branch Tracking (IBT) enabled PLT
  775. entries. Supported for Linux/i386 and Linux/x86_64.
  776. 'ibt'
  777. Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property
  778. section to indicate compatibility with IBT. This also implies
  779. 'ibtplt'. Supported for Linux/i386 and Linux/x86_64.
  780. 'indirect-extern-access'
  781. 'noindirect-extern-access'
  782. Generate GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS in
  783. .note.gnu.property section to indicate that object file
  784. requires canonical function pointers and cannot be used with
  785. copy relocation. This option also implies
  786. 'noextern-protected-data' and 'nocopyreloc'. Supported for
  787. i386 and x86-64.
  788. 'noindirect-extern-access' removes
  789. GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS from
  790. .note.gnu.property section.
  791. 'initfirst'
  792. This option is only meaningful when building a shared object.
  793. It marks the object so that its runtime initialization will
  794. occur before the runtime initialization of any other objects
  795. brought into the process at the same time. Similarly the
  796. runtime finalization of the object will occur after the
  797. runtime finalization of any other objects.
  798. 'interpose'
  799. Specify that the dynamic loader should modify its symbol
  800. search order so that symbols in this shared library interpose
  801. all other shared libraries not so marked.
  802. 'unique'
  803. 'nounique'
  804. When generating a shared library or other dynamically loadable
  805. ELF object mark it as one that should (by default) only ever
  806. be loaded once, and only in the main namespace (when using
  807. 'dlmopen'). This is primarily used to mark fundamental
  808. libraries such as libc, libpthread et al which do not usually
  809. function correctly unless they are the sole instances of
  810. themselves. This behaviour can be overridden by the 'dlmopen'
  811. caller and does not apply to certain loading mechanisms (such
  812. as audit libraries).
  813. 'lam-u48'
  814. Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U48 in
  815. .note.gnu.property section to indicate compatibility with
  816. Intel LAM_U48. Supported for Linux/x86_64.
  817. 'lam-u57'
  818. Generate GNU_PROPERTY_X86_FEATURE_1_LAM_U57 in
  819. .note.gnu.property section to indicate compatibility with
  820. Intel LAM_U57. Supported for Linux/x86_64.
  821. 'lam-u48-report=none'
  822. 'lam-u48-report=warning'
  823. 'lam-u48-report=error'
  824. Specify how to report the missing
  825. GNU_PROPERTY_X86_FEATURE_1_LAM_U48 property in input
  826. .note.gnu.property section. 'lam-u48-report=none', which is
  827. the default, will make the linker not report missing
  828. properties in input files. 'lam-u48-report=warning' will make
  829. the linker issue a warning for missing properties in input
  830. files. 'lam-u48-report=error' will make the linker issue an
  831. error for missing properties in input files. Supported for
  832. Linux/x86_64.
  833. 'lam-u57-report=none'
  834. 'lam-u57-report=warning'
  835. 'lam-u57-report=error'
  836. Specify how to report the missing
  837. GNU_PROPERTY_X86_FEATURE_1_LAM_U57 property in input
  838. .note.gnu.property section. 'lam-u57-report=none', which is
  839. the default, will make the linker not report missing
  840. properties in input files. 'lam-u57-report=warning' will make
  841. the linker issue a warning for missing properties in input
  842. files. 'lam-u57-report=error' will make the linker issue an
  843. error for missing properties in input files. Supported for
  844. Linux/x86_64.
  845. 'lam-report=none'
  846. 'lam-report=warning'
  847. 'lam-report=error'
  848. Specify how to report the missing
  849. GNU_PROPERTY_X86_FEATURE_1_LAM_U48 and
  850. GNU_PROPERTY_X86_FEATURE_1_LAM_U57 properties in input
  851. .note.gnu.property section. 'lam-report=none', which is the
  852. default, will make the linker not report missing properties in
  853. input files. 'lam-report=warning' will make the linker issue
  854. a warning for missing properties in input files.
  855. 'lam-report=error' will make the linker issue an error for
  856. missing properties in input files. Supported for
  857. Linux/x86_64.
  858. 'lazy'
  859. When generating an executable or shared library, mark it to
  860. tell the dynamic linker to defer function call resolution to
  861. the point when the function is called (lazy binding), rather
  862. than at load time. Lazy binding is the default.
  863. 'loadfltr'
  864. Specify that the object's filters be processed immediately at
  865. runtime.
  866. 'max-page-size=VALUE'
  867. Set the maximum memory page size supported to VALUE.
  868. 'muldefs'
  869. Allow multiple definitions.
  870. 'nocopyreloc'
  871. Disable linker generated .dynbss variables used in place of
  872. variables defined in shared libraries. May result in dynamic
  873. text relocations.
  874. 'nodefaultlib'
  875. Specify that the dynamic loader search for dependencies of
  876. this object should ignore any default library search paths.
  877. 'nodelete'
  878. Specify that the object shouldn't be unloaded at runtime.
  879. 'nodlopen'
  880. Specify that the object is not available to 'dlopen'.
  881. 'nodump'
  882. Specify that the object can not be dumped by 'dldump'.
  883. 'noexecstack'
  884. Marks the object as not requiring executable stack.
  885. 'noextern-protected-data'
  886. Don't treat protected data symbols as external when building a
  887. shared library. This option overrides the linker backend
  888. default. It can be used to work around incorrect relocations
  889. against protected data symbols generated by compiler. Updates
  890. on protected data symbols by another module aren't visible to
  891. the resulting shared library. Supported for i386 and x86-64.
  892. 'noreloc-overflow'
  893. Disable relocation overflow check. This can be used to
  894. disable relocation overflow check if there will be no dynamic
  895. relocation overflow at run-time. Supported for x86_64.
  896. 'now'
  897. When generating an executable or shared library, mark it to
  898. tell the dynamic linker to resolve all symbols when the
  899. program is started, or when the shared library is loaded by
  900. dlopen, instead of deferring function call resolution to the
  901. point when the function is first called.
  902. 'origin'
  903. Specify that the object requires '$ORIGIN' handling in paths.
  904. 'pack-relative-relocs'
  905. 'nopack-relative-relocs'
  906. Generate compact relative relocation in position-independent
  907. executable and shared library. It adds 'DT_RELR', 'DT_RELRSZ'
  908. and 'DT_RELRENT' entries to the dynamic section. It is
  909. ignored when building position-dependent executable and
  910. relocatable output. 'nopack-relative-relocs' is the default,
  911. which disables compact relative relocation. When linked
  912. against the GNU C Library, a GLIBC_ABI_DT_RELR symbol version
  913. dependency on the shared C Library is added to the output.
  914. Supported for i386 and x86-64.
  915. 'relro'
  916. 'norelro'
  917. Create an ELF 'PT_GNU_RELRO' segment header in the object.
  918. This specifies a memory segment that should be made read-only
  919. after relocation, if supported. Specifying 'common-page-size'
  920. smaller than the system page size will render this protection
  921. ineffective. Don't create an ELF 'PT_GNU_RELRO' segment if
  922. 'norelro'.
  923. 'report-relative-reloc'
  924. Report dynamic relative relocations generated by linker.
  925. Supported for Linux/i386 and Linux/x86_64.
  926. 'separate-code'
  927. 'noseparate-code'
  928. Create separate code 'PT_LOAD' segment header in the object.
  929. This specifies a memory segment that should contain only
  930. instructions and must be in wholly disjoint pages from any
  931. other data. Don't create separate code 'PT_LOAD' segment if
  932. 'noseparate-code' is used.
  933. 'shstk'
  934. Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in
  935. .note.gnu.property section to indicate compatibility with
  936. Intel Shadow Stack. Supported for Linux/i386 and
  937. Linux/x86_64.
  938. 'stack-size=VALUE'
  939. Specify a stack size for an ELF 'PT_GNU_STACK' segment.
  940. Specifying zero will override any default non-zero sized
  941. 'PT_GNU_STACK' segment creation.
  942. 'start-stop-gc'
  943. 'nostart-stop-gc'
  944. When '--gc-sections' is in effect, a reference from a retained
  945. section to '__start_SECNAME' or '__stop_SECNAME' causes all
  946. input sections named 'SECNAME' to also be retained, if
  947. 'SECNAME' is representable as a C identifier and either
  948. '__start_SECNAME' or '__stop_SECNAME' is synthesized by the
  949. linker. '-z start-stop-gc' disables this effect, allowing
  950. sections to be garbage collected as if the special synthesized
  951. symbols were not defined. '-z start-stop-gc' has no effect on
  952. a definition of '__start_SECNAME' or '__stop_SECNAME' in an
  953. object file or linker script. Such a definition will prevent
  954. the linker providing a synthesized '__start_SECNAME' or
  955. '__stop_SECNAME' respectively, and therefore the special
  956. treatment by garbage collection for those references.
  957. 'start-stop-visibility=VALUE'
  958. Specify the ELF symbol visibility for synthesized
  959. '__start_SECNAME' and '__stop_SECNAME' symbols (*note Input
  960. Section Example::). VALUE must be exactly 'default',
  961. 'internal', 'hidden', or 'protected'. If no '-z
  962. start-stop-visibility' option is given, 'protected' is used
  963. for compatibility with historical practice. However, it's
  964. highly recommended to use '-z start-stop-visibility=hidden' in
  965. new programs and shared libraries so that these symbols are
  966. not exported between shared objects, which is not usually
  967. what's intended.
  968. 'text'
  969. 'notext'
  970. 'textoff'
  971. Report an error if DT_TEXTREL is set, i.e., if the
  972. position-independent or shared object has dynamic relocations
  973. in read-only sections. Don't report an error if 'notext' or
  974. 'textoff'.
  975. 'undefs'
  976. Do not report unresolved symbol references from regular object
  977. files, either when creating an executable, or when creating a
  978. shared library. This option is the inverse of '-z defs'.
  979. 'unique-symbol'
  980. 'nounique-symbol'
  981. Avoid duplicated local symbol names in the symbol string
  982. table. Append ".'number'" to duplicated local symbol names if
  983. 'unique-symbol' is used. 'nounique-symbol' is the default.
  984. 'x86-64-baseline'
  985. 'x86-64-v2'
  986. 'x86-64-v3'
  987. 'x86-64-v4'
  988. Specify the x86-64 ISA level needed in .note.gnu.property
  989. section. 'x86-64-baseline' generates
  990. 'GNU_PROPERTY_X86_ISA_1_BASELINE'. 'x86-64-v2' generates
  991. 'GNU_PROPERTY_X86_ISA_1_V2'. 'x86-64-v3' generates
  992. 'GNU_PROPERTY_X86_ISA_1_V3'. 'x86-64-v4' generates
  993. 'GNU_PROPERTY_X86_ISA_1_V4'. Supported for Linux/i386 and
  994. Linux/x86_64.
  995. Other keywords are ignored for Solaris compatibility.
  996. '-( ARCHIVES -)'
  997. '--start-group ARCHIVES --end-group'
  998. The ARCHIVES should be a list of archive files. They may be either
  999. explicit file names, or '-l' options.
  1000. The specified archives are searched repeatedly until no new
  1001. undefined references are created. Normally, an archive is searched
  1002. only once in the order that it is specified on the command line.
  1003. If a symbol in that archive is needed to resolve an undefined
  1004. symbol referred to by an object in an archive that appears later on
  1005. the command line, the linker would not be able to resolve that
  1006. reference. By grouping the archives, they will all be searched
  1007. repeatedly until all possible references are resolved.
  1008. Using this option has a significant performance cost. It is best
  1009. to use it only when there are unavoidable circular references
  1010. between two or more archives.
  1011. '--accept-unknown-input-arch'
  1012. '--no-accept-unknown-input-arch'
  1013. Tells the linker to accept input files whose architecture cannot be
  1014. recognised. The assumption is that the user knows what they are
  1015. doing and deliberately wants to link in these unknown input files.
  1016. This was the default behaviour of the linker, before release 2.14.
  1017. The default behaviour from release 2.14 onwards is to reject such
  1018. input files, and so the '--accept-unknown-input-arch' option has
  1019. been added to restore the old behaviour.
  1020. '--as-needed'
  1021. '--no-as-needed'
  1022. This option affects ELF DT_NEEDED tags for dynamic libraries
  1023. mentioned on the command line after the '--as-needed' option.
  1024. Normally the linker will add a DT_NEEDED tag for each dynamic
  1025. library mentioned on the command line, regardless of whether the
  1026. library is actually needed or not. '--as-needed' causes a
  1027. DT_NEEDED tag to only be emitted for a library that _at that point
  1028. in the link_ satisfies a non-weak undefined symbol reference from a
  1029. regular object file or, if the library is not found in the
  1030. DT_NEEDED lists of other needed libraries, a non-weak undefined
  1031. symbol reference from another needed dynamic library. Object files
  1032. or libraries appearing on the command line _after_ the library in
  1033. question do not affect whether the library is seen as needed. This
  1034. is similar to the rules for extraction of object files from
  1035. archives. '--no-as-needed' restores the default behaviour.
  1036. Note: On Linux based systems the '--as-needed' option also has an
  1037. affect on the behaviour of the '--rpath' and '--rpath-link'
  1038. options. See the description of '--rpath-link' for more details.
  1039. '--add-needed'
  1040. '--no-add-needed'
  1041. These two options have been deprecated because of the similarity of
  1042. their names to the '--as-needed' and '--no-as-needed' options.
  1043. They have been replaced by '--copy-dt-needed-entries' and
  1044. '--no-copy-dt-needed-entries'.
  1045. '-assert KEYWORD'
  1046. This option is ignored for SunOS compatibility.
  1047. '-Bdynamic'
  1048. '-dy'
  1049. '-call_shared'
  1050. Link against dynamic libraries. This is only meaningful on
  1051. platforms for which shared libraries are supported. This option is
  1052. normally the default on such platforms. The different variants of
  1053. this option are for compatibility with various systems. You may
  1054. use this option multiple times on the command line: it affects
  1055. library searching for '-l' options which follow it.
  1056. '-Bgroup'
  1057. Set the 'DF_1_GROUP' flag in the 'DT_FLAGS_1' entry in the dynamic
  1058. section. This causes the runtime linker to handle lookups in this
  1059. object and its dependencies to be performed only inside the group.
  1060. '--unresolved-symbols=report-all' is implied. This option is only
  1061. meaningful on ELF platforms which support shared libraries.
  1062. '-Bstatic'
  1063. '-dn'
  1064. '-non_shared'
  1065. '-static'
  1066. Do not link against shared libraries. This is only meaningful on
  1067. platforms for which shared libraries are supported. The different
  1068. variants of this option are for compatibility with various systems.
  1069. You may use this option multiple times on the command line: it
  1070. affects library searching for '-l' options which follow it. This
  1071. option also implies '--unresolved-symbols=report-all'. This option
  1072. can be used with '-shared'. Doing so means that a shared library
  1073. is being created but that all of the library's external references
  1074. must be resolved by pulling in entries from static libraries.
  1075. '-Bsymbolic'
  1076. When creating a shared library, bind references to global symbols
  1077. to the definition within the shared library, if any. Normally, it
  1078. is possible for a program linked against a shared library to
  1079. override the definition within the shared library. This option is
  1080. only meaningful on ELF platforms which support shared libraries.
  1081. '-Bsymbolic-functions'
  1082. When creating a shared library, bind references to global function
  1083. symbols to the definition within the shared library, if any. This
  1084. option is only meaningful on ELF platforms which support shared
  1085. libraries.
  1086. '-Bno-symbolic'
  1087. This option can cancel previously specified '-Bsymbolic' and
  1088. '-Bsymbolic-functions'.
  1089. '--dynamic-list=DYNAMIC-LIST-FILE'
  1090. Specify the name of a dynamic list file to the linker. This is
  1091. typically used when creating shared libraries to specify a list of
  1092. global symbols whose references shouldn't be bound to the
  1093. definition within the shared library, or creating dynamically
  1094. linked executables to specify a list of symbols which should be
  1095. added to the symbol table in the executable. This option is only
  1096. meaningful on ELF platforms which support shared libraries.
  1097. The format of the dynamic list is the same as the version node
  1098. without scope and node name. See *note VERSION:: for more
  1099. information.
  1100. '--dynamic-list-data'
  1101. Include all global data symbols to the dynamic list.
  1102. '--dynamic-list-cpp-new'
  1103. Provide the builtin dynamic list for C++ operator new and delete.
  1104. It is mainly useful for building shared libstdc++.
  1105. '--dynamic-list-cpp-typeinfo'
  1106. Provide the builtin dynamic list for C++ runtime type
  1107. identification.
  1108. '--check-sections'
  1109. '--no-check-sections'
  1110. Asks the linker _not_ to check section addresses after they have
  1111. been assigned to see if there are any overlaps. Normally the
  1112. linker will perform this check, and if it finds any overlaps it
  1113. will produce suitable error messages. The linker does know about,
  1114. and does make allowances for sections in overlays. The default
  1115. behaviour can be restored by using the command-line switch
  1116. '--check-sections'. Section overlap is not usually checked for
  1117. relocatable links. You can force checking in that case by using
  1118. the '--check-sections' option.
  1119. '--copy-dt-needed-entries'
  1120. '--no-copy-dt-needed-entries'
  1121. This option affects the treatment of dynamic libraries referred to
  1122. by DT_NEEDED tags _inside_ ELF dynamic libraries mentioned on the
  1123. command line. Normally the linker won't add a DT_NEEDED tag to the
  1124. output binary for each library mentioned in a DT_NEEDED tag in an
  1125. input dynamic library. With '--copy-dt-needed-entries' specified
  1126. on the command line however any dynamic libraries that follow it
  1127. will have their DT_NEEDED entries added. The default behaviour can
  1128. be restored with '--no-copy-dt-needed-entries'.
  1129. This option also has an effect on the resolution of symbols in
  1130. dynamic libraries. With '--copy-dt-needed-entries' dynamic
  1131. libraries mentioned on the command line will be recursively
  1132. searched, following their DT_NEEDED tags to other libraries, in
  1133. order to resolve symbols required by the output binary. With the
  1134. default setting however the searching of dynamic libraries that
  1135. follow it will stop with the dynamic library itself. No DT_NEEDED
  1136. links will be traversed to resolve symbols.
  1137. '--cref'
  1138. Output a cross reference table. If a linker map file is being
  1139. generated, the cross reference table is printed to the map file.
  1140. Otherwise, it is printed on the standard output.
  1141. The format of the table is intentionally simple, so that it may be
  1142. easily processed by a script if necessary. The symbols are printed
  1143. out, sorted by name. For each symbol, a list of file names is
  1144. given. If the symbol is defined, the first file listed is the
  1145. location of the definition. If the symbol is defined as a common
  1146. value then any files where this happens appear next. Finally any
  1147. files that reference the symbol are listed.
  1148. '--ctf-variables'
  1149. '--no-ctf-variables'
  1150. The CTF debuginfo format supports a section which encodes the names
  1151. and types of variables found in the program which do not appear in
  1152. any symbol table. These variables clearly cannot be looked up by
  1153. address by conventional debuggers, so the space used for their
  1154. types and names is usually wasted: the types are usually small but
  1155. the names are often not. '--ctf-variables' causes the generation
  1156. of such a section. The default behaviour can be restored with
  1157. '--no-ctf-variables'.
  1158. '--ctf-share-types=METHOD'
  1159. Adjust the method used to share types between translation units in
  1160. CTF.
  1161. 'share-unconflicted'
  1162. Put all types that do not have ambiguous definitions into the
  1163. shared dictionary, where debuggers can easily access them,
  1164. even if they only occur in one translation unit. This is the
  1165. default.
  1166. 'share-duplicated'
  1167. Put only types that occur in multiple translation units into
  1168. the shared dictionary: types with only one definition go into
  1169. per-translation-unit dictionaries. Types with ambiguous
  1170. definitions in multiple translation units always go into
  1171. per-translation-unit dictionaries. This tends to make the CTF
  1172. larger, but may reduce the amount of CTF in the shared
  1173. dictionary. For very large projects this may speed up opening
  1174. the CTF and save memory in the CTF consumer at runtime.
  1175. '--no-define-common'
  1176. This option inhibits the assignment of addresses to common symbols.
  1177. The script command 'INHIBIT_COMMON_ALLOCATION' has the same effect.
  1178. *Note Miscellaneous Commands::.
  1179. The '--no-define-common' option allows decoupling the decision to
  1180. assign addresses to Common symbols from the choice of the output
  1181. file type; otherwise a non-Relocatable output type forces assigning
  1182. addresses to Common symbols. Using '--no-define-common' allows
  1183. Common symbols that are referenced from a shared library to be
  1184. assigned addresses only in the main program. This eliminates the
  1185. unused duplicate space in the shared library, and also prevents any
  1186. possible confusion over resolving to the wrong duplicate when there
  1187. are many dynamic modules with specialized search paths for runtime
  1188. symbol resolution.
  1189. '--force-group-allocation'
  1190. This option causes the linker to place section group members like
  1191. normal input sections, and to delete the section groups. This is
  1192. the default behaviour for a final link but this option can be used
  1193. to change the behaviour of a relocatable link ('-r'). The script
  1194. command 'FORCE_GROUP_ALLOCATION' has the same effect. *Note
  1195. Miscellaneous Commands::.
  1196. '--defsym=SYMBOL=EXPRESSION'
  1197. Create a global symbol in the output file, containing the absolute
  1198. address given by EXPRESSION. You may use this option as many times
  1199. as necessary to define multiple symbols in the command line. A
  1200. limited form of arithmetic is supported for the EXPRESSION in this
  1201. context: you may give a hexadecimal constant or the name of an
  1202. existing symbol, or use '+' and '-' to add or subtract hexadecimal
  1203. constants or symbols. If you need more elaborate expressions,
  1204. consider using the linker command language from a script (*note
  1205. Assignments::). _Note:_ there should be no white space between
  1206. SYMBOL, the equals sign ("<=>"), and EXPRESSION.
  1207. The linker processes '--defsym' arguments and '-T' arguments in
  1208. order, placing '--defsym' before '-T' will define the symbol before
  1209. the linker script from '-T' is processed, while placing '--defsym'
  1210. after '-T' will define the symbol after the linker script has been
  1211. processed. This difference has consequences for expressions within
  1212. the linker script that use the '--defsym' symbols, which order is
  1213. correct will depend on what you are trying to achieve.
  1214. '--demangle[=STYLE]'
  1215. '--no-demangle'
  1216. These options control whether to demangle symbol names in error
  1217. messages and other output. When the linker is told to demangle, it
  1218. tries to present symbol names in a readable fashion: it strips
  1219. leading underscores if they are used by the object file format, and
  1220. converts C++ mangled symbol names into user readable names.
  1221. Different compilers have different mangling styles. The optional
  1222. demangling style argument can be used to choose an appropriate
  1223. demangling style for your compiler. The linker will demangle by
  1224. default unless the environment variable 'COLLECT_NO_DEMANGLE' is
  1225. set. These options may be used to override the default.
  1226. '-IFILE'
  1227. '--dynamic-linker=FILE'
  1228. Set the name of the dynamic linker. This is only meaningful when
  1229. generating dynamically linked ELF executables. The default dynamic
  1230. linker is normally correct; don't use this unless you know what you
  1231. are doing.
  1232. '--no-dynamic-linker'
  1233. When producing an executable file, omit the request for a dynamic
  1234. linker to be used at load-time. This is only meaningful for ELF
  1235. executables that contain dynamic relocations, and usually requires
  1236. entry point code that is capable of processing these relocations.
  1237. '--embedded-relocs'
  1238. This option is similar to the '--emit-relocs' option except that
  1239. the relocs are stored in a target-specific section. This option is
  1240. only supported by the 'BFIN', 'CR16' and _M68K_ targets.
  1241. '--disable-multiple-abs-defs'
  1242. Do not allow multiple definitions with symbols included in filename
  1243. invoked by -R or -just-symbols
  1244. '--fatal-warnings'
  1245. '--no-fatal-warnings'
  1246. Treat all warnings as errors. The default behaviour can be
  1247. restored with the option '--no-fatal-warnings'.
  1248. '--force-exe-suffix'
  1249. Make sure that an output file has a .exe suffix.
  1250. If a successfully built fully linked output file does not have a
  1251. '.exe' or '.dll' suffix, this option forces the linker to copy the
  1252. output file to one of the same name with a '.exe' suffix. This
  1253. option is useful when using unmodified Unix makefiles on a
  1254. Microsoft Windows host, since some versions of Windows won't run an
  1255. image unless it ends in a '.exe' suffix.
  1256. '--gc-sections'
  1257. '--no-gc-sections'
  1258. Enable garbage collection of unused input sections. It is ignored
  1259. on targets that do not support this option. The default behaviour
  1260. (of not performing this garbage collection) can be restored by
  1261. specifying '--no-gc-sections' on the command line. Note that
  1262. garbage collection for COFF and PE format targets is supported, but
  1263. the implementation is currently considered to be experimental.
  1264. '--gc-sections' decides which input sections are used by examining
  1265. symbols and relocations. The section containing the entry symbol
  1266. and all sections containing symbols undefined on the command-line
  1267. will be kept, as will sections containing symbols referenced by
  1268. dynamic objects. Note that when building shared libraries, the
  1269. linker must assume that any visible symbol is referenced. Once
  1270. this initial set of sections has been determined, the linker
  1271. recursively marks as used any section referenced by their
  1272. relocations. See '--entry', '--undefined', and
  1273. '--gc-keep-exported'.
  1274. This option can be set when doing a partial link (enabled with
  1275. option '-r'). In this case the root of symbols kept must be
  1276. explicitly specified either by one of the options '--entry',
  1277. '--undefined', or '--gc-keep-exported' or by a 'ENTRY' command in
  1278. the linker script.
  1279. As a GNU extension, ELF input sections marked with the
  1280. 'SHF_GNU_RETAIN' flag will not be garbage collected.
  1281. '--print-gc-sections'
  1282. '--no-print-gc-sections'
  1283. List all sections removed by garbage collection. The listing is
  1284. printed on stderr. This option is only effective if garbage
  1285. collection has been enabled via the '--gc-sections') option. The
  1286. default behaviour (of not listing the sections that are removed)
  1287. can be restored by specifying '--no-print-gc-sections' on the
  1288. command line.
  1289. '--gc-keep-exported'
  1290. When '--gc-sections' is enabled, this option prevents garbage
  1291. collection of unused input sections that contain global symbols
  1292. having default or protected visibility. This option is intended to
  1293. be used for executables where unreferenced sections would otherwise
  1294. be garbage collected regardless of the external visibility of
  1295. contained symbols. Note that this option has no effect when
  1296. linking shared objects since it is already the default behaviour.
  1297. This option is only supported for ELF format targets.
  1298. '--print-output-format'
  1299. Print the name of the default output format (perhaps influenced by
  1300. other command-line options). This is the string that would appear
  1301. in an 'OUTPUT_FORMAT' linker script command (*note File
  1302. Commands::).
  1303. '--print-memory-usage'
  1304. Print used size, total size and used size of memory regions created
  1305. with the *note MEMORY:: command. This is useful on embedded
  1306. targets to have a quick view of amount of free memory. The format
  1307. of the output has one headline and one line per region. It is both
  1308. human readable and easily parsable by tools. Here is an example of
  1309. an output:
  1310. Memory region Used Size Region Size %age Used
  1311. ROM: 256 KB 1 MB 25.00%
  1312. RAM: 32 B 2 GB 0.00%
  1313. '--help'
  1314. Print a summary of the command-line options on the standard output
  1315. and exit.
  1316. '--target-help'
  1317. Print a summary of all target-specific options on the standard
  1318. output and exit.
  1319. '-Map=MAPFILE'
  1320. Print a link map to the file MAPFILE. See the description of the
  1321. '-M' option, above. If MAPFILE is just the character '-' then the
  1322. map will be written to stdout.
  1323. Specifying a directory as MAPFILE causes the linker map to be
  1324. written as a file inside the directory. Normally name of the file
  1325. inside the directory is computed as the basename of the OUTPUT file
  1326. with '.map' appended. If however the special character '%' is used
  1327. then this will be replaced by the full path of the output file.
  1328. Additionally if there are any characters after the % symbol then
  1329. '.map' will no longer be appended.
  1330. -o foo.exe -Map=bar [Creates ./bar]
  1331. -o ../dir/foo.exe -Map=bar [Creates ./bar]
  1332. -o foo.exe -Map=../dir [Creates ../dir/foo.exe.map]
  1333. -o ../dir2/foo.exe -Map=../dir [Creates ../dir/foo.exe.map]
  1334. -o foo.exe -Map=% [Creates ./foo.exe.map]
  1335. -o ../dir/foo.exe -Map=% [Creates ../dir/foo.exe.map]
  1336. -o foo.exe -Map=%.bar [Creates ./foo.exe.bar]
  1337. -o ../dir/foo.exe -Map=%.bar [Creates ../dir/foo.exe.bar]
  1338. -o ../dir2/foo.exe -Map=../dir/% [Creates ../dir/../dir2/foo.exe.map]
  1339. -o ../dir2/foo.exe -Map=../dir/%.bar [Creates ../dir/../dir2/foo.exe.bar]
  1340. It is an error to specify more than one '%' character.
  1341. If the map file already exists then it will be overwritten by this
  1342. operation.
  1343. '--no-keep-memory'
  1344. 'ld' normally optimizes for speed over memory usage by caching the
  1345. symbol tables of input files in memory. This option tells 'ld' to
  1346. instead optimize for memory usage, by rereading the symbol tables
  1347. as necessary. This may be required if 'ld' runs out of memory
  1348. space while linking a large executable.
  1349. '--no-undefined'
  1350. '-z defs'
  1351. Report unresolved symbol references from regular object files.
  1352. This is done even if the linker is creating a non-symbolic shared
  1353. library. The switch '--[no-]allow-shlib-undefined' controls the
  1354. behaviour for reporting unresolved references found in shared
  1355. libraries being linked in.
  1356. The effects of this option can be reverted by using '-z undefs'.
  1357. '--allow-multiple-definition'
  1358. '-z muldefs'
  1359. Normally when a symbol is defined multiple times, the linker will
  1360. report a fatal error. These options allow multiple definitions and
  1361. the first definition will be used.
  1362. '--allow-shlib-undefined'
  1363. '--no-allow-shlib-undefined'
  1364. Allows or disallows undefined symbols in shared libraries. This
  1365. switch is similar to '--no-undefined' except that it determines the
  1366. behaviour when the undefined symbols are in a shared library rather
  1367. than a regular object file. It does not affect how undefined
  1368. symbols in regular object files are handled.
  1369. The default behaviour is to report errors for any undefined symbols
  1370. referenced in shared libraries if the linker is being used to
  1371. create an executable, but to allow them if the linker is being used
  1372. to create a shared library.
  1373. The reasons for allowing undefined symbol references in shared
  1374. libraries specified at link time are that:
  1375. * A shared library specified at link time may not be the same as
  1376. the one that is available at load time, so the symbol might
  1377. actually be resolvable at load time.
  1378. * There are some operating systems, eg BeOS and HPPA, where
  1379. undefined symbols in shared libraries are normal.
  1380. The BeOS kernel for example patches shared libraries at load
  1381. time to select whichever function is most appropriate for the
  1382. current architecture. This is used, for example, to
  1383. dynamically select an appropriate memset function.
  1384. '--error-handling-script=SCRIPTNAME'
  1385. If this option is provided then the linker will invoke SCRIPTNAME
  1386. whenever an error is encountered. Currently however only two kinds
  1387. of error are supported: missing symbols and missing libraries. Two
  1388. arguments will be passed to script: the keyword "undefined-symbol"
  1389. or 'missing-lib" and the NAME of the undefined symbol or missing
  1390. library. The intention is that the script will provide suggestions
  1391. to the user as to where the symbol or library might be found.
  1392. After the script has finished then the normal linker error message
  1393. will be displayed.
  1394. The availability of this option is controlled by a configure time
  1395. switch, so it may not be present in specific implementations.
  1396. '--no-undefined-version'
  1397. Normally when a symbol has an undefined version, the linker will
  1398. ignore it. This option disallows symbols with undefined version
  1399. and a fatal error will be issued instead.
  1400. '--default-symver'
  1401. Create and use a default symbol version (the soname) for
  1402. unversioned exported symbols.
  1403. '--default-imported-symver'
  1404. Create and use a default symbol version (the soname) for
  1405. unversioned imported symbols.
  1406. '--no-warn-mismatch'
  1407. Normally 'ld' will give an error if you try to link together input
  1408. files that are mismatched for some reason, perhaps because they
  1409. have been compiled for different processors or for different
  1410. endiannesses. This option tells 'ld' that it should silently
  1411. permit such possible errors. This option should only be used with
  1412. care, in cases when you have taken some special action that ensures
  1413. that the linker errors are inappropriate.
  1414. '--no-warn-search-mismatch'
  1415. Normally 'ld' will give a warning if it finds an incompatible
  1416. library during a library search. This option silences the warning.
  1417. '--no-whole-archive'
  1418. Turn off the effect of the '--whole-archive' option for subsequent
  1419. archive files.
  1420. '--noinhibit-exec'
  1421. Retain the executable output file whenever it is still usable.
  1422. Normally, the linker will not produce an output file if it
  1423. encounters errors during the link process; it exits without writing
  1424. an output file when it issues any error whatsoever.
  1425. '-nostdlib'
  1426. Only search library directories explicitly specified on the command
  1427. line. Library directories specified in linker scripts (including
  1428. linker scripts specified on the command line) are ignored.
  1429. '--oformat=OUTPUT-FORMAT'
  1430. 'ld' may be configured to support more than one kind of object
  1431. file. If your 'ld' is configured this way, you can use the
  1432. '--oformat' option to specify the binary format for the output
  1433. object file. Even when 'ld' is configured to support alternative
  1434. object formats, you don't usually need to specify this, as 'ld'
  1435. should be configured to produce as a default output format the most
  1436. usual format on each machine. OUTPUT-FORMAT is a text string, the
  1437. name of a particular format supported by the BFD libraries. (You
  1438. can list the available binary formats with 'objdump -i'.) The
  1439. script command 'OUTPUT_FORMAT' can also specify the output format,
  1440. but this option overrides it. *Note BFD::.
  1441. '--out-implib FILE'
  1442. Create an import library in FILE corresponding to the executable
  1443. the linker is generating (eg. a DLL or ELF program). This import
  1444. library (which should be called '*.dll.a' or '*.a' for DLLs) may be
  1445. used to link clients against the generated executable; this
  1446. behaviour makes it possible to skip a separate import library
  1447. creation step (eg. 'dlltool' for DLLs). This option is only
  1448. available for the i386 PE and ELF targetted ports of the linker.
  1449. '-pie'
  1450. '--pic-executable'
  1451. Create a position independent executable. This is currently only
  1452. supported on ELF platforms. Position independent executables are
  1453. similar to shared libraries in that they are relocated by the
  1454. dynamic linker to the virtual address the OS chooses for them
  1455. (which can vary between invocations). Like normal dynamically
  1456. linked executables they can be executed and symbols defined in the
  1457. executable cannot be overridden by shared libraries.
  1458. '-no-pie'
  1459. Create a position dependent executable. This is the default.
  1460. '-qmagic'
  1461. This option is ignored for Linux compatibility.
  1462. '-Qy'
  1463. This option is ignored for SVR4 compatibility.
  1464. '--relax'
  1465. '--no-relax'
  1466. An option with machine dependent effects. This option is only
  1467. supported on a few targets. *Note 'ld' and the H8/300: H8/300.
  1468. *Note 'ld' and Xtensa Processors: Xtensa. *Note 'ld' and the
  1469. 68HC11 and 68HC12: M68HC11/68HC12. *Note 'ld' and the Altera Nios
  1470. II: Nios II. *Note 'ld' and PowerPC 32-bit ELF Support: PowerPC
  1471. ELF32.
  1472. On some platforms the '--relax' option performs target specific,
  1473. global optimizations that become possible when the linker resolves
  1474. addressing in the program, such as relaxing address modes,
  1475. synthesizing new instructions, selecting shorter version of current
  1476. instructions, and combining constant values.
  1477. On some platforms these link time global optimizations may make
  1478. symbolic debugging of the resulting executable impossible. This is
  1479. known to be the case for the Matsushita MN10200 and MN10300 family
  1480. of processors.
  1481. On platforms where the feature is supported, the option
  1482. '--no-relax' will disable it.
  1483. On platforms where the feature is not supported, both '--relax' and
  1484. '--no-relax' are accepted, but ignored.
  1485. '--retain-symbols-file=FILENAME'
  1486. Retain _only_ the symbols listed in the file FILENAME, discarding
  1487. all others. FILENAME is simply a flat file, with one symbol name
  1488. per line. This option is especially useful in environments (such
  1489. as VxWorks) where a large global symbol table is accumulated
  1490. gradually, to conserve run-time memory.
  1491. '--retain-symbols-file' does _not_ discard undefined symbols, or
  1492. symbols needed for relocations.
  1493. You may only specify '--retain-symbols-file' once in the command
  1494. line. It overrides '-s' and '-S'.
  1495. '-rpath=DIR'
  1496. Add a directory to the runtime library search path. This is used
  1497. when linking an ELF executable with shared objects. All '-rpath'
  1498. arguments are concatenated and passed to the runtime linker, which
  1499. uses them to locate shared objects at runtime.
  1500. The '-rpath' option is also used when locating shared objects which
  1501. are needed by shared objects explicitly included in the link; see
  1502. the description of the '-rpath-link' option. Searching '-rpath' in
  1503. this way is only supported by native linkers and cross linkers
  1504. which have been configured with the '--with-sysroot' option.
  1505. If '-rpath' is not used when linking an ELF executable, the
  1506. contents of the environment variable 'LD_RUN_PATH' will be used if
  1507. it is defined.
  1508. The '-rpath' option may also be used on SunOS. By default, on
  1509. SunOS, the linker will form a runtime search path out of all the
  1510. '-L' options it is given. If a '-rpath' option is used, the
  1511. runtime search path will be formed exclusively using the '-rpath'
  1512. options, ignoring the '-L' options. This can be useful when using
  1513. gcc, which adds many '-L' options which may be on NFS mounted file
  1514. systems.
  1515. For compatibility with other ELF linkers, if the '-R' option is
  1516. followed by a directory name, rather than a file name, it is
  1517. treated as the '-rpath' option.
  1518. '-rpath-link=DIR'
  1519. When using ELF or SunOS, one shared library may require another.
  1520. This happens when an 'ld -shared' link includes a shared library as
  1521. one of the input files.
  1522. When the linker encounters such a dependency when doing a
  1523. non-shared, non-relocatable link, it will automatically try to
  1524. locate the required shared library and include it in the link, if
  1525. it is not included explicitly. In such a case, the '-rpath-link'
  1526. option specifies the first set of directories to search. The
  1527. '-rpath-link' option may specify a sequence of directory names
  1528. either by specifying a list of names separated by colons, or by
  1529. appearing multiple times.
  1530. The tokens $ORIGIN and $LIB can appear in these search directories.
  1531. They will be replaced by the full path to the directory containing
  1532. the program or shared object in the case of $ORIGIN and either
  1533. 'lib' - for 32-bit binaries - or 'lib64' - for 64-bit binaries - in
  1534. the case of $LIB.
  1535. The alternative form of these tokens - ${ORIGIN} and ${LIB} can
  1536. also be used. The token $PLATFORM is not supported.
  1537. This option should be used with caution as it overrides the search
  1538. path that may have been hard compiled into a shared library. In
  1539. such a case it is possible to use unintentionally a different
  1540. search path than the runtime linker would do.
  1541. The linker uses the following search paths to locate required
  1542. shared libraries:
  1543. 1. Any directories specified by '-rpath-link' options.
  1544. 2. Any directories specified by '-rpath' options. The difference
  1545. between '-rpath' and '-rpath-link' is that directories
  1546. specified by '-rpath' options are included in the executable
  1547. and used at runtime, whereas the '-rpath-link' option is only
  1548. effective at link time. Searching '-rpath' in this way is
  1549. only supported by native linkers and cross linkers which have
  1550. been configured with the '--with-sysroot' option.
  1551. 3. On an ELF system, for native linkers, if the '-rpath' and
  1552. '-rpath-link' options were not used, search the contents of
  1553. the environment variable 'LD_RUN_PATH'.
  1554. 4. On SunOS, if the '-rpath' option was not used, search any
  1555. directories specified using '-L' options.
  1556. 5. For a native linker, search the contents of the environment
  1557. variable 'LD_LIBRARY_PATH'.
  1558. 6. For a native ELF linker, the directories in 'DT_RUNPATH' or
  1559. 'DT_RPATH' of a shared library are searched for shared
  1560. libraries needed by it. The 'DT_RPATH' entries are ignored if
  1561. 'DT_RUNPATH' entries exist.
  1562. 7. For a linker for a Linux system, if the file '/etc/ld.so.conf'
  1563. exists, the list of directories found in that file. Note: the
  1564. path to this file is prefixed with the 'sysroot' value, if
  1565. that is defined, and then any 'prefix' string if the linker
  1566. was configured with the '--prefix=<path>' option.
  1567. 8. For a native linker on a FreeBSD system, any directories
  1568. specified by the '_PATH_ELF_HINTS' macro defined in the
  1569. 'elf-hints.h' header file.
  1570. 9. Any directories specified by a 'SEARCH_DIR' command in a
  1571. linker script given on the command line, including scripts
  1572. specified by '-T' (but not '-dT').
  1573. 10. The default directories, normally '/lib' and '/usr/lib'.
  1574. 11. Any directories specified by a plugin
  1575. LDPT_SET_EXTRA_LIBRARY_PATH.
  1576. 12. Any directories specified by a 'SEARCH_DIR' command in a
  1577. default linker script.
  1578. Note however on Linux based systems there is an additional caveat:
  1579. If the '--as-needed' option is active _and_ a shared library is
  1580. located which would normally satisfy the search _and_ this library
  1581. does not have DT_NEEDED tag for 'libc.so' _and_ there is a shared
  1582. library later on in the set of search directories which also
  1583. satisfies the search _and_ this second shared library does have a
  1584. DT_NEEDED tag for 'libc.so' _then_ the second library will be
  1585. selected instead of the first.
  1586. If the required shared library is not found, the linker will issue
  1587. a warning and continue with the link.
  1588. '-shared'
  1589. '-Bshareable'
  1590. Create a shared library. This is currently only supported on ELF,
  1591. XCOFF and SunOS platforms. On SunOS, the linker will automatically
  1592. create a shared library if the '-e' option is not used and there
  1593. are undefined symbols in the link.
  1594. '--sort-common'
  1595. '--sort-common=ascending'
  1596. '--sort-common=descending'
  1597. This option tells 'ld' to sort the common symbols by alignment in
  1598. ascending or descending order when it places them in the
  1599. appropriate output sections. The symbol alignments considered are
  1600. sixteen-byte or larger, eight-byte, four-byte, two-byte, and
  1601. one-byte. This is to prevent gaps between symbols due to alignment
  1602. constraints. If no sorting order is specified, then descending
  1603. order is assumed.
  1604. '--sort-section=name'
  1605. This option will apply 'SORT_BY_NAME' to all wildcard section
  1606. patterns in the linker script.
  1607. '--sort-section=alignment'
  1608. This option will apply 'SORT_BY_ALIGNMENT' to all wildcard section
  1609. patterns in the linker script.
  1610. '--spare-dynamic-tags=COUNT'
  1611. This option specifies the number of empty slots to leave in the
  1612. .dynamic section of ELF shared objects. Empty slots may be needed
  1613. by post processing tools, such as the prelinker. The default is 5.
  1614. '--split-by-file[=SIZE]'
  1615. Similar to '--split-by-reloc' but creates a new output section for
  1616. each input file when SIZE is reached. SIZE defaults to a size of 1
  1617. if not given.
  1618. '--split-by-reloc[=COUNT]'
  1619. Tries to creates extra sections in the output file so that no
  1620. single output section in the file contains more than COUNT
  1621. relocations. This is useful when generating huge relocatable files
  1622. for downloading into certain real time kernels with the COFF object
  1623. file format; since COFF cannot represent more than 65535
  1624. relocations in a single section. Note that this will fail to work
  1625. with object file formats which do not support arbitrary sections.
  1626. The linker will not split up individual input sections for
  1627. redistribution, so if a single input section contains more than
  1628. COUNT relocations one output section will contain that many
  1629. relocations. COUNT defaults to a value of 32768.
  1630. '--stats'
  1631. Compute and display statistics about the operation of the linker,
  1632. such as execution time and memory usage.
  1633. '--sysroot=DIRECTORY'
  1634. Use DIRECTORY as the location of the sysroot, overriding the
  1635. configure-time default. This option is only supported by linkers
  1636. that were configured using '--with-sysroot'.
  1637. '--task-link'
  1638. This is used by COFF/PE based targets to create a task-linked
  1639. object file where all of the global symbols have been converted to
  1640. statics.
  1641. '--traditional-format'
  1642. For some targets, the output of 'ld' is different in some ways from
  1643. the output of some existing linker. This switch requests 'ld' to
  1644. use the traditional format instead.
  1645. For example, on SunOS, 'ld' combines duplicate entries in the
  1646. symbol string table. This can reduce the size of an output file
  1647. with full debugging information by over 30 percent. Unfortunately,
  1648. the SunOS 'dbx' program can not read the resulting program ('gdb'
  1649. has no trouble). The '--traditional-format' switch tells 'ld' to
  1650. not combine duplicate entries.
  1651. '--section-start=SECTIONNAME=ORG'
  1652. Locate a section in the output file at the absolute address given
  1653. by ORG. You may use this option as many times as necessary to
  1654. locate multiple sections in the command line. ORG must be a single
  1655. hexadecimal integer; for compatibility with other linkers, you may
  1656. omit the leading '0x' usually associated with hexadecimal values.
  1657. _Note:_ there should be no white space between SECTIONNAME, the
  1658. equals sign ("<=>"), and ORG.
  1659. '-Tbss=ORG'
  1660. '-Tdata=ORG'
  1661. '-Ttext=ORG'
  1662. Same as '--section-start', with '.bss', '.data' or '.text' as the
  1663. SECTIONNAME.
  1664. '-Ttext-segment=ORG'
  1665. When creating an ELF executable, it will set the address of the
  1666. first byte of the text segment.
  1667. '-Trodata-segment=ORG'
  1668. When creating an ELF executable or shared object for a target where
  1669. the read-only data is in its own segment separate from the
  1670. executable text, it will set the address of the first byte of the
  1671. read-only data segment.
  1672. '-Tldata-segment=ORG'
  1673. When creating an ELF executable or shared object for x86-64 medium
  1674. memory model, it will set the address of the first byte of the
  1675. ldata segment.
  1676. '--unresolved-symbols=METHOD'
  1677. Determine how to handle unresolved symbols. There are four
  1678. possible values for 'method':
  1679. 'ignore-all'
  1680. Do not report any unresolved symbols.
  1681. 'report-all'
  1682. Report all unresolved symbols. This is the default.
  1683. 'ignore-in-object-files'
  1684. Report unresolved symbols that are contained in shared
  1685. libraries, but ignore them if they come from regular object
  1686. files.
  1687. 'ignore-in-shared-libs'
  1688. Report unresolved symbols that come from regular object files,
  1689. but ignore them if they come from shared libraries. This can
  1690. be useful when creating a dynamic binary and it is known that
  1691. all the shared libraries that it should be referencing are
  1692. included on the linker's command line.
  1693. The behaviour for shared libraries on their own can also be
  1694. controlled by the '--[no-]allow-shlib-undefined' option.
  1695. Normally the linker will generate an error message for each
  1696. reported unresolved symbol but the option
  1697. '--warn-unresolved-symbols' can change this to a warning.
  1698. '--dll-verbose'
  1699. '--verbose[=NUMBER]'
  1700. Display the version number for 'ld' and list the linker emulations
  1701. supported. Display which input files can and cannot be opened.
  1702. Display the linker script being used by the linker. If the
  1703. optional NUMBER argument > 1, plugin symbol status will also be
  1704. displayed.
  1705. '--version-script=VERSION-SCRIPTFILE'
  1706. Specify the name of a version script to the linker. This is
  1707. typically used when creating shared libraries to specify additional
  1708. information about the version hierarchy for the library being
  1709. created. This option is only fully supported on ELF platforms
  1710. which support shared libraries; see *note VERSION::. It is
  1711. partially supported on PE platforms, which can use version scripts
  1712. to filter symbol visibility in auto-export mode: any symbols marked
  1713. 'local' in the version script will not be exported. *Note WIN32::.
  1714. '--warn-common'
  1715. Warn when a common symbol is combined with another common symbol or
  1716. with a symbol definition. Unix linkers allow this somewhat sloppy
  1717. practice, but linkers on some other operating systems do not. This
  1718. option allows you to find potential problems from combining global
  1719. symbols. Unfortunately, some C libraries use this practice, so you
  1720. may get some warnings about symbols in the libraries as well as in
  1721. your programs.
  1722. There are three kinds of global symbols, illustrated here by C
  1723. examples:
  1724. 'int i = 1;'
  1725. A definition, which goes in the initialized data section of
  1726. the output file.
  1727. 'extern int i;'
  1728. An undefined reference, which does not allocate space. There
  1729. must be either a definition or a common symbol for the
  1730. variable somewhere.
  1731. 'int i;'
  1732. A common symbol. If there are only (one or more) common
  1733. symbols for a variable, it goes in the uninitialized data area
  1734. of the output file. The linker merges multiple common symbols
  1735. for the same variable into a single symbol. If they are of
  1736. different sizes, it picks the largest size. The linker turns
  1737. a common symbol into a declaration, if there is a definition
  1738. of the same variable.
  1739. The '--warn-common' option can produce five kinds of warnings.
  1740. Each warning consists of a pair of lines: the first describes the
  1741. symbol just encountered, and the second describes the previous
  1742. symbol encountered with the same name. One or both of the two
  1743. symbols will be a common symbol.
  1744. 1. Turning a common symbol into a reference, because there is
  1745. already a definition for the symbol.
  1746. FILE(SECTION): warning: common of `SYMBOL'
  1747. overridden by definition
  1748. FILE(SECTION): warning: defined here
  1749. 2. Turning a common symbol into a reference, because a later
  1750. definition for the symbol is encountered. This is the same as
  1751. the previous case, except that the symbols are encountered in
  1752. a different order.
  1753. FILE(SECTION): warning: definition of `SYMBOL'
  1754. overriding common
  1755. FILE(SECTION): warning: common is here
  1756. 3. Merging a common symbol with a previous same-sized common
  1757. symbol.
  1758. FILE(SECTION): warning: multiple common
  1759. of `SYMBOL'
  1760. FILE(SECTION): warning: previous common is here
  1761. 4. Merging a common symbol with a previous larger common symbol.
  1762. FILE(SECTION): warning: common of `SYMBOL'
  1763. overridden by larger common
  1764. FILE(SECTION): warning: larger common is here
  1765. 5. Merging a common symbol with a previous smaller common symbol.
  1766. This is the same as the previous case, except that the symbols
  1767. are encountered in a different order.
  1768. FILE(SECTION): warning: common of `SYMBOL'
  1769. overriding smaller common
  1770. FILE(SECTION): warning: smaller common is here
  1771. '--warn-constructors'
  1772. Warn if any global constructors are used. This is only useful for
  1773. a few object file formats. For formats like COFF or ELF, the
  1774. linker can not detect the use of global constructors.
  1775. '--warn-multiple-gp'
  1776. Warn if multiple global pointer values are required in the output
  1777. file. This is only meaningful for certain processors, such as the
  1778. Alpha. Specifically, some processors put large-valued constants in
  1779. a special section. A special register (the global pointer) points
  1780. into the middle of this section, so that constants can be loaded
  1781. efficiently via a base-register relative addressing mode. Since
  1782. the offset in base-register relative mode is fixed and relatively
  1783. small (e.g., 16 bits), this limits the maximum size of the constant
  1784. pool. Thus, in large programs, it is often necessary to use
  1785. multiple global pointer values in order to be able to address all
  1786. possible constants. This option causes a warning to be issued
  1787. whenever this case occurs.
  1788. '--warn-once'
  1789. Only warn once for each undefined symbol, rather than once per
  1790. module which refers to it.
  1791. '--warn-section-align'
  1792. Warn if the address of an output section is changed because of
  1793. alignment. Typically, the alignment will be set by an input
  1794. section. The address will only be changed if it not explicitly
  1795. specified; that is, if the 'SECTIONS' command does not specify a
  1796. start address for the section (*note SECTIONS::).
  1797. '--warn-textrel'
  1798. Warn if the linker adds DT_TEXTREL to a position-independent
  1799. executable or shared object.
  1800. '--warn-alternate-em'
  1801. Warn if an object has alternate ELF machine code.
  1802. '--warn-unresolved-symbols'
  1803. If the linker is going to report an unresolved symbol (see the
  1804. option '--unresolved-symbols') it will normally generate an error.
  1805. This option makes it generate a warning instead.
  1806. '--error-unresolved-symbols'
  1807. This restores the linker's default behaviour of generating errors
  1808. when it is reporting unresolved symbols.
  1809. '--whole-archive'
  1810. For each archive mentioned on the command line after the
  1811. '--whole-archive' option, include every object file in the archive
  1812. in the link, rather than searching the archive for the required
  1813. object files. This is normally used to turn an archive file into a
  1814. shared library, forcing every object to be included in the
  1815. resulting shared library. This option may be used more than once.
  1816. Two notes when using this option from gcc: First, gcc doesn't know
  1817. about this option, so you have to use '-Wl,-whole-archive'.
  1818. Second, don't forget to use '-Wl,-no-whole-archive' after your list
  1819. of archives, because gcc will add its own list of archives to your
  1820. link and you may not want this flag to affect those as well.
  1821. '--wrap=SYMBOL'
  1822. Use a wrapper function for SYMBOL. Any undefined reference to
  1823. SYMBOL will be resolved to '__wrap_SYMBOL'. Any undefined
  1824. reference to '__real_SYMBOL' will be resolved to SYMBOL.
  1825. This can be used to provide a wrapper for a system function. The
  1826. wrapper function should be called '__wrap_SYMBOL'. If it wishes to
  1827. call the system function, it should call '__real_SYMBOL'.
  1828. Here is a trivial example:
  1829. void *
  1830. __wrap_malloc (size_t c)
  1831. {
  1832. printf ("malloc called with %zu\n", c);
  1833. return __real_malloc (c);
  1834. }
  1835. If you link other code with this file using '--wrap malloc', then
  1836. all calls to 'malloc' will call the function '__wrap_malloc'
  1837. instead. The call to '__real_malloc' in '__wrap_malloc' will call
  1838. the real 'malloc' function.
  1839. You may wish to provide a '__real_malloc' function as well, so that
  1840. links without the '--wrap' option will succeed. If you do this,
  1841. you should not put the definition of '__real_malloc' in the same
  1842. file as '__wrap_malloc'; if you do, the assembler may resolve the
  1843. call before the linker has a chance to wrap it to 'malloc'.
  1844. Only undefined references are replaced by the linker. So,
  1845. translation unit internal references to SYMBOL are not resolved to
  1846. '__wrap_SYMBOL'. In the next example, the call to 'f' in 'g' is
  1847. not resolved to '__wrap_f'.
  1848. int
  1849. f (void)
  1850. {
  1851. return 123;
  1852. }
  1853. int
  1854. g (void)
  1855. {
  1856. return f();
  1857. }
  1858. '--eh-frame-hdr'
  1859. '--no-eh-frame-hdr'
  1860. Request ('--eh-frame-hdr') or suppress ('--no-eh-frame-hdr') the
  1861. creation of '.eh_frame_hdr' section and ELF 'PT_GNU_EH_FRAME'
  1862. segment header.
  1863. '--no-ld-generated-unwind-info'
  1864. Request creation of '.eh_frame' unwind info for linker generated
  1865. code sections like PLT. This option is on by default if linker
  1866. generated unwind info is supported.
  1867. '--enable-new-dtags'
  1868. '--disable-new-dtags'
  1869. This linker can create the new dynamic tags in ELF. But the older
  1870. ELF systems may not understand them. If you specify
  1871. '--enable-new-dtags', the new dynamic tags will be created as
  1872. needed and older dynamic tags will be omitted. If you specify
  1873. '--disable-new-dtags', no new dynamic tags will be created. By
  1874. default, the new dynamic tags are not created. Note that those
  1875. options are only available for ELF systems.
  1876. '--hash-size=NUMBER'
  1877. Set the default size of the linker's hash tables to a prime number
  1878. close to NUMBER. Increasing this value can reduce the length of
  1879. time it takes the linker to perform its tasks, at the expense of
  1880. increasing the linker's memory requirements. Similarly reducing
  1881. this value can reduce the memory requirements at the expense of
  1882. speed.
  1883. '--hash-style=STYLE'
  1884. Set the type of linker's hash table(s). STYLE can be either 'sysv'
  1885. for classic ELF '.hash' section, 'gnu' for new style GNU
  1886. '.gnu.hash' section or 'both' for both the classic ELF '.hash' and
  1887. new style GNU '.gnu.hash' hash tables. The default depends upon
  1888. how the linker was configured, but for most Linux based systems it
  1889. will be 'both'.
  1890. '--compress-debug-sections=none'
  1891. '--compress-debug-sections=zlib'
  1892. '--compress-debug-sections=zlib-gnu'
  1893. '--compress-debug-sections=zlib-gabi'
  1894. On ELF platforms, these options control how DWARF debug sections
  1895. are compressed using zlib.
  1896. '--compress-debug-sections=none' doesn't compress DWARF debug
  1897. sections. '--compress-debug-sections=zlib-gnu' compresses DWARF
  1898. debug sections and renames them to begin with '.zdebug' instead of
  1899. '.debug'. '--compress-debug-sections=zlib-gabi' also compresses
  1900. DWARF debug sections, but rather than renaming them it sets the
  1901. SHF_COMPRESSED flag in the sections' headers.
  1902. The '--compress-debug-sections=zlib' option is an alias for
  1903. '--compress-debug-sections=zlib-gabi'.
  1904. Note that this option overrides any compression in input debug
  1905. sections, so if a binary is linked with
  1906. '--compress-debug-sections=none' for example, then any compressed
  1907. debug sections in input files will be uncompressed before they are
  1908. copied into the output binary.
  1909. The default compression behaviour varies depending upon the target
  1910. involved and the configure options used to build the toolchain.
  1911. The default can be determined by examining the output from the
  1912. linker's '--help' option.
  1913. '--reduce-memory-overheads'
  1914. This option reduces memory requirements at ld runtime, at the
  1915. expense of linking speed. This was introduced to select the old
  1916. O(n^2) algorithm for link map file generation, rather than the new
  1917. O(n) algorithm which uses about 40% more memory for symbol storage.
  1918. Another effect of the switch is to set the default hash table size
  1919. to 1021, which again saves memory at the cost of lengthening the
  1920. linker's run time. This is not done however if the '--hash-size'
  1921. switch has been used.
  1922. The '--reduce-memory-overheads' switch may be also be used to
  1923. enable other tradeoffs in future versions of the linker.
  1924. '--max-cache-size=SIZE'
  1925. 'ld' normally caches the relocation information and symbol tables
  1926. of input files in memory with the unlimited size. This option sets
  1927. the maximum cache size to SIZE.
  1928. '--build-id'
  1929. '--build-id=STYLE'
  1930. Request the creation of a '.note.gnu.build-id' ELF note section or
  1931. a '.buildid' COFF section. The contents of the note are unique
  1932. bits identifying this linked file. STYLE can be 'uuid' to use 128
  1933. random bits, 'sha1' to use a 160-bit SHA1 hash on the normative
  1934. parts of the output contents, 'md5' to use a 128-bit MD5 hash on
  1935. the normative parts of the output contents, or '0xHEXSTRING' to use
  1936. a chosen bit string specified as an even number of hexadecimal
  1937. digits ('-' and ':' characters between digit pairs are ignored).
  1938. If STYLE is omitted, 'sha1' is used.
  1939. The 'md5' and 'sha1' styles produces an identifier that is always
  1940. the same in an identical output file, but will be unique among all
  1941. nonidentical output files. It is not intended to be compared as a
  1942. checksum for the file's contents. A linked file may be changed
  1943. later by other tools, but the build ID bit string identifying the
  1944. original linked file does not change.
  1945. Passing 'none' for STYLE disables the setting from any '--build-id'
  1946. options earlier on the command line.
  1947. 2.1.1 Options Specific to i386 PE Targets
  1948. -----------------------------------------
  1949. The i386 PE linker supports the '-shared' option, which causes the
  1950. output to be a dynamically linked library (DLL) instead of a normal
  1951. executable. You should name the output '*.dll' when you use this
  1952. option. In addition, the linker fully supports the standard '*.def'
  1953. files, which may be specified on the linker command line like an object
  1954. file (in fact, it should precede archives it exports symbols from, to
  1955. ensure that they get linked in, just like a normal object file).
  1956. In addition to the options common to all targets, the i386 PE linker
  1957. support additional command-line options that are specific to the i386 PE
  1958. target. Options that take values may be separated from their values by
  1959. either a space or an equals sign.
  1960. '--add-stdcall-alias'
  1961. If given, symbols with a stdcall suffix (@NN) will be exported
  1962. as-is and also with the suffix stripped. [This option is specific
  1963. to the i386 PE targeted port of the linker]
  1964. '--base-file FILE'
  1965. Use FILE as the name of a file in which to save the base addresses
  1966. of all the relocations needed for generating DLLs with 'dlltool'.
  1967. [This is an i386 PE specific option]
  1968. '--dll'
  1969. Create a DLL instead of a regular executable. You may also use
  1970. '-shared' or specify a 'LIBRARY' in a given '.def' file. [This
  1971. option is specific to the i386 PE targeted port of the linker]
  1972. '--enable-long-section-names'
  1973. '--disable-long-section-names'
  1974. The PE variants of the COFF object format add an extension that
  1975. permits the use of section names longer than eight characters, the
  1976. normal limit for COFF. By default, these names are only allowed in
  1977. object files, as fully-linked executable images do not carry the
  1978. COFF string table required to support the longer names. As a GNU
  1979. extension, it is possible to allow their use in executable images
  1980. as well, or to (probably pointlessly!) disallow it in object
  1981. files, by using these two options. Executable images generated
  1982. with these long section names are slightly non-standard, carrying
  1983. as they do a string table, and may generate confusing output when
  1984. examined with non-GNU PE-aware tools, such as file viewers and
  1985. dumpers. However, GDB relies on the use of PE long section names
  1986. to find Dwarf-2 debug information sections in an executable image
  1987. at runtime, and so if neither option is specified on the
  1988. command-line, 'ld' will enable long section names, overriding the
  1989. default and technically correct behaviour, when it finds the
  1990. presence of debug information while linking an executable image and
  1991. not stripping symbols. [This option is valid for all PE targeted
  1992. ports of the linker]
  1993. '--enable-stdcall-fixup'
  1994. '--disable-stdcall-fixup'
  1995. If the link finds a symbol that it cannot resolve, it will attempt
  1996. to do "fuzzy linking" by looking for another defined symbol that
  1997. differs only in the format of the symbol name (cdecl vs stdcall)
  1998. and will resolve that symbol by linking to the match. For example,
  1999. the undefined symbol '_foo' might be linked to the function
  2000. '_foo@12', or the undefined symbol '_bar@16' might be linked to the
  2001. function '_bar'. When the linker does this, it prints a warning,
  2002. since it normally should have failed to link, but sometimes import
  2003. libraries generated from third-party dlls may need this feature to
  2004. be usable. If you specify '--enable-stdcall-fixup', this feature
  2005. is fully enabled and warnings are not printed. If you specify
  2006. '--disable-stdcall-fixup', this feature is disabled and such
  2007. mismatches are considered to be errors. [This option is specific
  2008. to the i386 PE targeted port of the linker]
  2009. '--leading-underscore'
  2010. '--no-leading-underscore'
  2011. For most targets default symbol-prefix is an underscore and is
  2012. defined in target's description. By this option it is possible to
  2013. disable/enable the default underscore symbol-prefix.
  2014. '--export-all-symbols'
  2015. If given, all global symbols in the objects used to build a DLL
  2016. will be exported by the DLL. Note that this is the default if there
  2017. otherwise wouldn't be any exported symbols. When symbols are
  2018. explicitly exported via DEF files or implicitly exported via
  2019. function attributes, the default is to not export anything else
  2020. unless this option is given. Note that the symbols 'DllMain@12',
  2021. 'DllEntryPoint@0', 'DllMainCRTStartup@12', and 'impure_ptr' will
  2022. not be automatically exported. Also, symbols imported from other
  2023. DLLs will not be re-exported, nor will symbols specifying the DLL's
  2024. internal layout such as those beginning with '_head_' or ending
  2025. with '_iname'. In addition, no symbols from 'libgcc', 'libstd++',
  2026. 'libmingw32', or 'crtX.o' will be exported. Symbols whose names
  2027. begin with '__rtti_' or '__builtin_' will not be exported, to help
  2028. with C++ DLLs. Finally, there is an extensive list of
  2029. cygwin-private symbols that are not exported (obviously, this
  2030. applies on when building DLLs for cygwin targets). These
  2031. cygwin-excludes are: '_cygwin_dll_entry@12',
  2032. '_cygwin_crt0_common@8', '_cygwin_noncygwin_dll_entry@12',
  2033. '_fmode', '_impure_ptr', 'cygwin_attach_dll', 'cygwin_premain0',
  2034. 'cygwin_premain1', 'cygwin_premain2', 'cygwin_premain3', and
  2035. 'environ'. [This option is specific to the i386 PE targeted port
  2036. of the linker]
  2037. '--exclude-symbols SYMBOL,SYMBOL,...'
  2038. Specifies a list of symbols which should not be automatically
  2039. exported. The symbol names may be delimited by commas or colons.
  2040. [This option is specific to the i386 PE targeted port of the
  2041. linker]
  2042. '--exclude-all-symbols'
  2043. Specifies no symbols should be automatically exported. [This
  2044. option is specific to the i386 PE targeted port of the linker]
  2045. '--file-alignment'
  2046. Specify the file alignment. Sections in the file will always begin
  2047. at file offsets which are multiples of this number. This defaults
  2048. to 512. [This option is specific to the i386 PE targeted port of
  2049. the linker]
  2050. '--heap RESERVE'
  2051. '--heap RESERVE,COMMIT'
  2052. Specify the number of bytes of memory to reserve (and optionally
  2053. commit) to be used as heap for this program. The default is 1MB
  2054. reserved, 4K committed. [This option is specific to the i386 PE
  2055. targeted port of the linker]
  2056. '--image-base VALUE'
  2057. Use VALUE as the base address of your program or dll. This is the
  2058. lowest memory location that will be used when your program or dll
  2059. is loaded. To reduce the need to relocate and improve performance
  2060. of your dlls, each should have a unique base address and not
  2061. overlap any other dlls. The default is 0x400000 for executables,
  2062. and 0x10000000 for dlls. [This option is specific to the i386 PE
  2063. targeted port of the linker]
  2064. '--kill-at'
  2065. If given, the stdcall suffixes (@NN) will be stripped from symbols
  2066. before they are exported. [This option is specific to the i386 PE
  2067. targeted port of the linker]
  2068. '--large-address-aware'
  2069. If given, the appropriate bit in the "Characteristics" field of the
  2070. COFF header is set to indicate that this executable supports
  2071. virtual addresses greater than 2 gigabytes. This should be used in
  2072. conjunction with the /3GB or /USERVA=VALUE megabytes switch in the
  2073. "[operating systems]" section of the BOOT.INI. Otherwise, this bit
  2074. has no effect. [This option is specific to PE targeted ports of
  2075. the linker]
  2076. '--disable-large-address-aware'
  2077. Reverts the effect of a previous '--large-address-aware' option.
  2078. This is useful if '--large-address-aware' is always set by the
  2079. compiler driver (e.g. Cygwin gcc) and the executable does not
  2080. support virtual addresses greater than 2 gigabytes. [This option
  2081. is specific to PE targeted ports of the linker]
  2082. '--major-image-version VALUE'
  2083. Sets the major number of the "image version". Defaults to 1.
  2084. [This option is specific to the i386 PE targeted port of the
  2085. linker]
  2086. '--major-os-version VALUE'
  2087. Sets the major number of the "os version". Defaults to 4. [This
  2088. option is specific to the i386 PE targeted port of the linker]
  2089. '--major-subsystem-version VALUE'
  2090. Sets the major number of the "subsystem version". Defaults to 4.
  2091. [This option is specific to the i386 PE targeted port of the
  2092. linker]
  2093. '--minor-image-version VALUE'
  2094. Sets the minor number of the "image version". Defaults to 0.
  2095. [This option is specific to the i386 PE targeted port of the
  2096. linker]
  2097. '--minor-os-version VALUE'
  2098. Sets the minor number of the "os version". Defaults to 0. [This
  2099. option is specific to the i386 PE targeted port of the linker]
  2100. '--minor-subsystem-version VALUE'
  2101. Sets the minor number of the "subsystem version". Defaults to 0.
  2102. [This option is specific to the i386 PE targeted port of the
  2103. linker]
  2104. '--output-def FILE'
  2105. The linker will create the file FILE which will contain a DEF file
  2106. corresponding to the DLL the linker is generating. This DEF file
  2107. (which should be called '*.def') may be used to create an import
  2108. library with 'dlltool' or may be used as a reference to
  2109. automatically or implicitly exported symbols. [This option is
  2110. specific to the i386 PE targeted port of the linker]
  2111. '--enable-auto-image-base'
  2112. '--enable-auto-image-base=VALUE'
  2113. Automatically choose the image base for DLLs, optionally starting
  2114. with base VALUE, unless one is specified using the '--image-base'
  2115. argument. By using a hash generated from the dllname to create
  2116. unique image bases for each DLL, in-memory collisions and
  2117. relocations which can delay program execution are avoided. [This
  2118. option is specific to the i386 PE targeted port of the linker]
  2119. '--disable-auto-image-base'
  2120. Do not automatically generate a unique image base. If there is no
  2121. user-specified image base ('--image-base') then use the platform
  2122. default. [This option is specific to the i386 PE targeted port of
  2123. the linker]
  2124. '--dll-search-prefix STRING'
  2125. When linking dynamically to a dll without an import library, search
  2126. for '<string><basename>.dll' in preference to 'lib<basename>.dll'.
  2127. This behaviour allows easy distinction between DLLs built for the
  2128. various "subplatforms": native, cygwin, uwin, pw, etc. For
  2129. instance, cygwin DLLs typically use '--dll-search-prefix=cyg'.
  2130. [This option is specific to the i386 PE targeted port of the
  2131. linker]
  2132. '--enable-auto-import'
  2133. Do sophisticated linking of '_symbol' to '__imp__symbol' for DATA
  2134. imports from DLLs, thus making it possible to bypass the dllimport
  2135. mechanism on the user side and to reference unmangled symbol names.
  2136. [This option is specific to the i386 PE targeted port of the
  2137. linker]
  2138. The following remarks pertain to the original implementation of the
  2139. feature and are obsolete nowadays for Cygwin and MinGW targets.
  2140. Note: Use of the 'auto-import' extension will cause the text
  2141. section of the image file to be made writable. This does not
  2142. conform to the PE-COFF format specification published by Microsoft.
  2143. Note - use of the 'auto-import' extension will also cause read only
  2144. data which would normally be placed into the .rdata section to be
  2145. placed into the .data section instead. This is in order to work
  2146. around a problem with consts that is described here:
  2147. http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
  2148. Using 'auto-import' generally will 'just work' - but sometimes you
  2149. may see this message:
  2150. "variable '<var>' can't be auto-imported. Please read the
  2151. documentation for ld's '--enable-auto-import' for details."
  2152. This message occurs when some (sub)expression accesses an address
  2153. ultimately given by the sum of two constants (Win32 import tables
  2154. only allow one). Instances where this may occur include accesses
  2155. to member fields of struct variables imported from a DLL, as well
  2156. as using a constant index into an array variable imported from a
  2157. DLL. Any multiword variable (arrays, structs, long long, etc) may
  2158. trigger this error condition. However, regardless of the exact
  2159. data type of the offending exported variable, ld will always detect
  2160. it, issue the warning, and exit.
  2161. There are several ways to address this difficulty, regardless of
  2162. the data type of the exported variable:
  2163. One way is to use -enable-runtime-pseudo-reloc switch. This leaves
  2164. the task of adjusting references in your client code for runtime
  2165. environment, so this method works only when runtime environment
  2166. supports this feature.
  2167. A second solution is to force one of the 'constants' to be a
  2168. variable - that is, unknown and un-optimizable at compile time.
  2169. For arrays, there are two possibilities: a) make the indexee (the
  2170. array's address) a variable, or b) make the 'constant' index a
  2171. variable. Thus:
  2172. extern type extern_array[];
  2173. extern_array[1] -->
  2174. { volatile type *t=extern_array; t[1] }
  2175. or
  2176. extern type extern_array[];
  2177. extern_array[1] -->
  2178. { volatile int t=1; extern_array[t] }
  2179. For structs (and most other multiword data types) the only option
  2180. is to make the struct itself (or the long long, or the ...)
  2181. variable:
  2182. extern struct s extern_struct;
  2183. extern_struct.field -->
  2184. { volatile struct s *t=&extern_struct; t->field }
  2185. or
  2186. extern long long extern_ll;
  2187. extern_ll -->
  2188. { volatile long long * local_ll=&extern_ll; *local_ll }
  2189. A third method of dealing with this difficulty is to abandon
  2190. 'auto-import' for the offending symbol and mark it with
  2191. '__declspec(dllimport)'. However, in practice that requires using
  2192. compile-time #defines to indicate whether you are building a DLL,
  2193. building client code that will link to the DLL, or merely
  2194. building/linking to a static library. In making the choice between
  2195. the various methods of resolving the 'direct address with constant
  2196. offset' problem, you should consider typical real-world usage:
  2197. Original:
  2198. --foo.h
  2199. extern int arr[];
  2200. --foo.c
  2201. #include "foo.h"
  2202. void main(int argc, char **argv){
  2203. printf("%d\n",arr[1]);
  2204. }
  2205. Solution 1:
  2206. --foo.h
  2207. extern int arr[];
  2208. --foo.c
  2209. #include "foo.h"
  2210. void main(int argc, char **argv){
  2211. /* This workaround is for win32 and cygwin; do not "optimize" */
  2212. volatile int *parr = arr;
  2213. printf("%d\n",parr[1]);
  2214. }
  2215. Solution 2:
  2216. --foo.h
  2217. /* Note: auto-export is assumed (no __declspec(dllexport)) */
  2218. #if (defined(_WIN32) || defined(__CYGWIN__)) && \
  2219. !(defined(FOO_BUILD_DLL) || defined(FOO_STATIC))
  2220. #define FOO_IMPORT __declspec(dllimport)
  2221. #else
  2222. #define FOO_IMPORT
  2223. #endif
  2224. extern FOO_IMPORT int arr[];
  2225. --foo.c
  2226. #include "foo.h"
  2227. void main(int argc, char **argv){
  2228. printf("%d\n",arr[1]);
  2229. }
  2230. A fourth way to avoid this problem is to re-code your library to
  2231. use a functional interface rather than a data interface for the
  2232. offending variables (e.g. set_foo() and get_foo() accessor
  2233. functions).
  2234. '--disable-auto-import'
  2235. Do not attempt to do sophisticated linking of '_symbol' to
  2236. '__imp__symbol' for DATA imports from DLLs. [This option is
  2237. specific to the i386 PE targeted port of the linker]
  2238. '--enable-runtime-pseudo-reloc'
  2239. If your code contains expressions described in -enable-auto-import
  2240. section, that is, DATA imports from DLL with non-zero offset, this
  2241. switch will create a vector of 'runtime pseudo relocations' which
  2242. can be used by runtime environment to adjust references to such
  2243. data in your client code. [This option is specific to the i386 PE
  2244. targeted port of the linker]
  2245. '--disable-runtime-pseudo-reloc'
  2246. Do not create pseudo relocations for non-zero offset DATA imports
  2247. from DLLs. [This option is specific to the i386 PE targeted port
  2248. of the linker]
  2249. '--enable-extra-pe-debug'
  2250. Show additional debug info related to auto-import symbol thunking.
  2251. [This option is specific to the i386 PE targeted port of the
  2252. linker]
  2253. '--section-alignment'
  2254. Sets the section alignment. Sections in memory will always begin
  2255. at addresses which are a multiple of this number. Defaults to
  2256. 0x1000. [This option is specific to the i386 PE targeted port of
  2257. the linker]
  2258. '--stack RESERVE'
  2259. '--stack RESERVE,COMMIT'
  2260. Specify the number of bytes of memory to reserve (and optionally
  2261. commit) to be used as stack for this program. The default is 2MB
  2262. reserved, 4K committed. [This option is specific to the i386 PE
  2263. targeted port of the linker]
  2264. '--subsystem WHICH'
  2265. '--subsystem WHICH:MAJOR'
  2266. '--subsystem WHICH:MAJOR.MINOR'
  2267. Specifies the subsystem under which your program will execute. The
  2268. legal values for WHICH are 'native', 'windows', 'console', 'posix',
  2269. and 'xbox'. You may optionally set the subsystem version also.
  2270. Numeric values are also accepted for WHICH. [This option is
  2271. specific to the i386 PE targeted port of the linker]
  2272. The following options set flags in the 'DllCharacteristics' field
  2273. of the PE file header: [These options are specific to PE targeted
  2274. ports of the linker]
  2275. '--high-entropy-va'
  2276. '--disable-high-entropy-va'
  2277. Image is compatible with 64-bit address space layout randomization
  2278. (ASLR). This option is enabled by default for 64-bit PE images.
  2279. This option also implies '--dynamicbase' and
  2280. '--enable-reloc-section'.
  2281. '--dynamicbase'
  2282. '--disable-dynamicbase'
  2283. The image base address may be relocated using address space layout
  2284. randomization (ASLR). This feature was introduced with MS Windows
  2285. Vista for i386 PE targets. This option is enabled by default but
  2286. can be disabled via the '--disable-dynamicbase' option. This
  2287. option also implies '--enable-reloc-section'.
  2288. '--forceinteg'
  2289. '--disable-forceinteg'
  2290. Code integrity checks are enforced. This option is disabled by
  2291. default.
  2292. '--nxcompat'
  2293. '--disable-nxcompat'
  2294. The image is compatible with the Data Execution Prevention. This
  2295. feature was introduced with MS Windows XP SP2 for i386 PE targets.
  2296. The option is enabled by default.
  2297. '--no-isolation'
  2298. '--disable-no-isolation'
  2299. Although the image understands isolation, do not isolate the image.
  2300. This option is disabled by default.
  2301. '--no-seh'
  2302. '--disable-no-seh'
  2303. The image does not use SEH. No SE handler may be called from this
  2304. image. This option is disabled by default.
  2305. '--no-bind'
  2306. '--disable-no-bind'
  2307. Do not bind this image. This option is disabled by default.
  2308. '--wdmdriver'
  2309. '--disable-wdmdriver'
  2310. The driver uses the MS Windows Driver Model. This option is
  2311. disabled by default.
  2312. '--tsaware'
  2313. '--disable-tsaware'
  2314. The image is Terminal Server aware. This option is disabled by
  2315. default.
  2316. '--insert-timestamp'
  2317. '--no-insert-timestamp'
  2318. Insert a real timestamp into the image. This is the default
  2319. behaviour as it matches legacy code and it means that the image
  2320. will work with other, proprietary tools. The problem with this
  2321. default is that it will result in slightly different images being
  2322. produced each time the same sources are linked. The option
  2323. '--no-insert-timestamp' can be used to insert a zero value for the
  2324. timestamp, this ensuring that binaries produced from identical
  2325. sources will compare identically.
  2326. '--enable-reloc-section'
  2327. '--disable-reloc-section'
  2328. Create the base relocation table, which is necessary if the image
  2329. is loaded at a different image base than specified in the PE
  2330. header. This option is enabled by default.
  2331. 2.1.2 Options specific to C6X uClinux targets
  2332. ---------------------------------------------
  2333. The C6X uClinux target uses a binary format called DSBT to support
  2334. shared libraries. Each shared library in the system needs to have a
  2335. unique index; all executables use an index of 0.
  2336. '--dsbt-size SIZE'
  2337. This option sets the number of entries in the DSBT of the current
  2338. executable or shared library to SIZE. The default is to create a
  2339. table with 64 entries.
  2340. '--dsbt-index INDEX'
  2341. This option sets the DSBT index of the current executable or shared
  2342. library to INDEX. The default is 0, which is appropriate for
  2343. generating executables. If a shared library is generated with a
  2344. DSBT index of 0, the 'R_C6000_DSBT_INDEX' relocs are copied into
  2345. the output file.
  2346. The '--no-merge-exidx-entries' switch disables the merging of
  2347. adjacent exidx entries in frame unwind info.
  2348. 2.1.3 Options specific to C-SKY targets
  2349. ---------------------------------------
  2350. '--branch-stub'
  2351. This option enables linker branch relaxation by inserting branch
  2352. stub sections when needed to extend the range of branches. This
  2353. option is usually not required since C-SKY supports branch and call
  2354. instructions that can access the full memory range and branch
  2355. relaxation is normally handled by the compiler or assembler.
  2356. '--stub-group-size=N'
  2357. This option allows finer control of linker branch stub creation.
  2358. It sets the maximum size of a group of input sections that can be
  2359. handled by one stub section. A negative value of N locates stub
  2360. sections after their branches, while a positive value allows stub
  2361. sections to appear either before or after the branches. Values of
  2362. '1' or '-1' indicate that the linker should choose suitable
  2363. defaults.
  2364. 2.1.4 Options specific to Motorola 68HC11 and 68HC12 targets
  2365. ------------------------------------------------------------
  2366. The 68HC11 and 68HC12 linkers support specific options to control the
  2367. memory bank switching mapping and trampoline code generation.
  2368. '--no-trampoline'
  2369. This option disables the generation of trampoline. By default a
  2370. trampoline is generated for each far function which is called using
  2371. a 'jsr' instruction (this happens when a pointer to a far function
  2372. is taken).
  2373. '--bank-window NAME'
  2374. This option indicates to the linker the name of the memory region
  2375. in the 'MEMORY' specification that describes the memory bank
  2376. window. The definition of such region is then used by the linker
  2377. to compute paging and addresses within the memory window.
  2378. 2.1.5 Options specific to Motorola 68K target
  2379. ---------------------------------------------
  2380. The following options are supported to control handling of GOT
  2381. generation when linking for 68K targets.
  2382. '--got=TYPE'
  2383. This option tells the linker which GOT generation scheme to use.
  2384. TYPE should be one of 'single', 'negative', 'multigot' or 'target'.
  2385. For more information refer to the Info entry for 'ld'.
  2386. 2.1.6 Options specific to MIPS targets
  2387. --------------------------------------
  2388. The following options are supported to control microMIPS instruction
  2389. generation and branch relocation checks for ISA mode transitions when
  2390. linking for MIPS targets.
  2391. '--insn32'
  2392. '--no-insn32'
  2393. These options control the choice of microMIPS instructions used in
  2394. code generated by the linker, such as that in the PLT or lazy
  2395. binding stubs, or in relaxation. If '--insn32' is used, then the
  2396. linker only uses 32-bit instruction encodings. By default or if
  2397. '--no-insn32' is used, all instruction encodings are used,
  2398. including 16-bit ones where possible.
  2399. '--ignore-branch-isa'
  2400. '--no-ignore-branch-isa'
  2401. These options control branch relocation checks for invalid ISA mode
  2402. transitions. If '--ignore-branch-isa' is used, then the linker
  2403. accepts any branch relocations and any ISA mode transition required
  2404. is lost in relocation calculation, except for some cases of 'BAL'
  2405. instructions which meet relaxation conditions and are converted to
  2406. equivalent 'JALX' instructions as the associated relocation is
  2407. calculated. By default or if '--no-ignore-branch-isa' is used a
  2408. check is made causing the loss of an ISA mode transition to produce
  2409. an error.
  2410. '--compact-branches'
  2411. '--no-compact-branches'
  2412. These options control the generation of compact instructions by the
  2413. linker in the PLT entries for MIPS R6.
  2414. 2.1.7 Options specific to PDP11 targets
  2415. ---------------------------------------
  2416. For the pdp11-aout target, three variants of the output format can be
  2417. produced as selected by the following options. The default variant for
  2418. pdp11-aout is the '--omagic' option, whereas for other targets
  2419. '--nmagic' is the default. The '--imagic' option is defined only for
  2420. the pdp11-aout target, while the others are described here as they apply
  2421. to the pdp11-aout target.
  2422. '-N'
  2423. '--omagic'
  2424. Mark the output as 'OMAGIC' (0407) in the 'a.out' header to
  2425. indicate that the text segment is not to be write-protected and
  2426. shared. Since the text and data sections are both readable and
  2427. writable, the data section is allocated immediately contiguous
  2428. after the text segment. This is the oldest format for PDP11
  2429. executable programs and is the default for 'ld' on PDP11 Unix
  2430. systems from the beginning through 2.11BSD.
  2431. '-n'
  2432. '--nmagic'
  2433. Mark the output as 'NMAGIC' (0410) in the 'a.out' header to
  2434. indicate that when the output file is executed, the text portion
  2435. will be read-only and shareable among all processes executing the
  2436. same file. This involves moving the data areas up to the first
  2437. possible 8K byte page boundary following the end of the text. This
  2438. option creates a _pure executable_ format.
  2439. '-z'
  2440. '--imagic'
  2441. Mark the output as 'IMAGIC' (0411) in the 'a.out' header to
  2442. indicate that when the output file is executed, the program text
  2443. and data areas will be loaded into separate address spaces using
  2444. the split instruction and data space feature of the memory
  2445. management unit in larger models of the PDP11. This doubles the
  2446. address space available to the program. The text segment is again
  2447. pure, write-protected, and shareable. The only difference in the
  2448. output format between this option and the others, besides the magic
  2449. number, is that both the text and data sections start at location
  2450. 0. The '-z' option selected this format in 2.11BSD. This option
  2451. creates a _separate executable_ format.
  2452. '--no-omagic'
  2453. Equivalent to '--nmagic' for pdp11-aout.
  2454. 
  2455. File: ld.info, Node: Environment, Prev: Options, Up: Invocation
  2456. 2.2 Environment Variables
  2457. =========================
  2458. You can change the behaviour of 'ld' with the environment variables
  2459. 'GNUTARGET', 'LDEMULATION' and 'COLLECT_NO_DEMANGLE'.
  2460. 'GNUTARGET' determines the input-file object format if you don't use
  2461. '-b' (or its synonym '--format'). Its value should be one of the BFD
  2462. names for an input format (*note BFD::). If there is no 'GNUTARGET' in
  2463. the environment, 'ld' uses the natural format of the target. If
  2464. 'GNUTARGET' is set to 'default' then BFD attempts to discover the input
  2465. format by examining binary input files; this method often succeeds, but
  2466. there are potential ambiguities, since there is no method of ensuring
  2467. that the magic number used to specify object-file formats is unique.
  2468. However, the configuration procedure for BFD on each system places the
  2469. conventional format for that system first in the search-list, so
  2470. ambiguities are resolved in favor of convention.
  2471. 'LDEMULATION' determines the default emulation if you don't use the
  2472. '-m' option. The emulation can affect various aspects of linker
  2473. behaviour, particularly the default linker script. You can list the
  2474. available emulations with the '--verbose' or '-V' options. If the '-m'
  2475. option is not used, and the 'LDEMULATION' environment variable is not
  2476. defined, the default emulation depends upon how the linker was
  2477. configured.
  2478. Normally, the linker will default to demangling symbols. However, if
  2479. 'COLLECT_NO_DEMANGLE' is set in the environment, then it will default to
  2480. not demangling symbols. This environment variable is used in a similar
  2481. fashion by the 'gcc' linker wrapper program. The default may be
  2482. overridden by the '--demangle' and '--no-demangle' options.
  2483. 
  2484. File: ld.info, Node: Scripts, Next: Plugins, Prev: Invocation, Up: Top
  2485. 3 Linker Scripts
  2486. ****************
  2487. Every link is controlled by a "linker script". This script is written
  2488. in the linker command language.
  2489. The main purpose of the linker script is to describe how the sections
  2490. in the input files should be mapped into the output file, and to control
  2491. the memory layout of the output file. Most linker scripts do nothing
  2492. more than this. However, when necessary, the linker script can also
  2493. direct the linker to perform many other operations, using the commands
  2494. described below.
  2495. The linker always uses a linker script. If you do not supply one
  2496. yourself, the linker will use a default script that is compiled into the
  2497. linker executable. You can use the '--verbose' command-line option to
  2498. display the default linker script. Certain command-line options, such
  2499. as '-r' or '-N', will affect the default linker script.
  2500. You may supply your own linker script by using the '-T' command line
  2501. option. When you do this, your linker script will replace the default
  2502. linker script.
  2503. You may also use linker scripts implicitly by naming them as input
  2504. files to the linker, as though they were files to be linked. *Note
  2505. Implicit Linker Scripts::.
  2506. * Menu:
  2507. * Basic Script Concepts:: Basic Linker Script Concepts
  2508. * Script Format:: Linker Script Format
  2509. * Simple Example:: Simple Linker Script Example
  2510. * Simple Commands:: Simple Linker Script Commands
  2511. * Assignments:: Assigning Values to Symbols
  2512. * SECTIONS:: SECTIONS Command
  2513. * MEMORY:: MEMORY Command
  2514. * PHDRS:: PHDRS Command
  2515. * VERSION:: VERSION Command
  2516. * Expressions:: Expressions in Linker Scripts
  2517. * Implicit Linker Scripts:: Implicit Linker Scripts
  2518. 
  2519. File: ld.info, Node: Basic Script Concepts, Next: Script Format, Up: Scripts
  2520. 3.1 Basic Linker Script Concepts
  2521. ================================
  2522. We need to define some basic concepts and vocabulary in order to
  2523. describe the linker script language.
  2524. The linker combines input files into a single output file. The
  2525. output file and each input file are in a special data format known as an
  2526. "object file format". Each file is called an "object file". The output
  2527. file is often called an "executable", but for our purposes we will also
  2528. call it an object file. Each object file has, among other things, a
  2529. list of "sections". We sometimes refer to a section in an input file as
  2530. an "input section"; similarly, a section in the output file is an
  2531. "output section".
  2532. Each section in an object file has a name and a size. Most sections
  2533. also have an associated block of data, known as the "section contents".
  2534. A section may be marked as "loadable", which means that the contents
  2535. should be loaded into memory when the output file is run. A section
  2536. with no contents may be "allocatable", which means that an area in
  2537. memory should be set aside, but nothing in particular should be loaded
  2538. there (in some cases this memory must be zeroed out). A section which
  2539. is neither loadable nor allocatable typically contains some sort of
  2540. debugging information.
  2541. Every loadable or allocatable output section has two addresses. The
  2542. first is the "VMA", or virtual memory address. This is the address the
  2543. section will have when the output file is run. The second is the "LMA",
  2544. or load memory address. This is the address at which the section will
  2545. be loaded. In most cases the two addresses will be the same. An
  2546. example of when they might be different is when a data section is loaded
  2547. into ROM, and then copied into RAM when the program starts up (this
  2548. technique is often used to initialize global variables in a ROM based
  2549. system). In this case the ROM address would be the LMA, and the RAM
  2550. address would be the VMA.
  2551. You can see the sections in an object file by using the 'objdump'
  2552. program with the '-h' option.
  2553. Every object file also has a list of "symbols", known as the "symbol
  2554. table". A symbol may be defined or undefined. Each symbol has a name,
  2555. and each defined symbol has an address, among other information. If you
  2556. compile a C or C++ program into an object file, you will get a defined
  2557. symbol for every defined function and global or static variable. Every
  2558. undefined function or global variable which is referenced in the input
  2559. file will become an undefined symbol.
  2560. You can see the symbols in an object file by using the 'nm' program,
  2561. or by using the 'objdump' program with the '-t' option.
  2562. 
  2563. File: ld.info, Node: Script Format, Next: Simple Example, Prev: Basic Script Concepts, Up: Scripts
  2564. 3.2 Linker Script Format
  2565. ========================
  2566. Linker scripts are text files.
  2567. You write a linker script as a series of commands. Each command is
  2568. either a keyword, possibly followed by arguments, or an assignment to a
  2569. symbol. You may separate commands using semicolons. Whitespace is
  2570. generally ignored.
  2571. Strings such as file or format names can normally be entered
  2572. directly. If the file name contains a character such as a comma which
  2573. would otherwise serve to separate file names, you may put the file name
  2574. in double quotes. There is no way to use a double quote character in a
  2575. file name.
  2576. You may include comments in linker scripts just as in C, delimited by
  2577. '/*' and '*/'. As in C, comments are syntactically equivalent to
  2578. whitespace.
  2579. 
  2580. File: ld.info, Node: Simple Example, Next: Simple Commands, Prev: Script Format, Up: Scripts
  2581. 3.3 Simple Linker Script Example
  2582. ================================
  2583. Many linker scripts are fairly simple.
  2584. The simplest possible linker script has just one command: 'SECTIONS'.
  2585. You use the 'SECTIONS' command to describe the memory layout of the
  2586. output file.
  2587. The 'SECTIONS' command is a powerful command. Here we will describe
  2588. a simple use of it. Let's assume your program consists only of code,
  2589. initialized data, and uninitialized data. These will be in the '.text',
  2590. '.data', and '.bss' sections, respectively. Let's assume further that
  2591. these are the only sections which appear in your input files.
  2592. For this example, let's say that the code should be loaded at address
  2593. 0x10000, and that the data should start at address 0x8000000. Here is a
  2594. linker script which will do that:
  2595. SECTIONS
  2596. {
  2597. . = 0x10000;
  2598. .text : { *(.text) }
  2599. . = 0x8000000;
  2600. .data : { *(.data) }
  2601. .bss : { *(.bss) }
  2602. }
  2603. You write the 'SECTIONS' command as the keyword 'SECTIONS', followed
  2604. by a series of symbol assignments and output section descriptions
  2605. enclosed in curly braces.
  2606. The first line inside the 'SECTIONS' command of the above example
  2607. sets the value of the special symbol '.', which is the location counter.
  2608. If you do not specify the address of an output section in some other way
  2609. (other ways are described later), the address is set from the current
  2610. value of the location counter. The location counter is then incremented
  2611. by the size of the output section. At the start of the 'SECTIONS'
  2612. command, the location counter has the value '0'.
  2613. The second line defines an output section, '.text'. The colon is
  2614. required syntax which may be ignored for now. Within the curly braces
  2615. after the output section name, you list the names of the input sections
  2616. which should be placed into this output section. The '*' is a wildcard
  2617. which matches any file name. The expression '*(.text)' means all
  2618. '.text' input sections in all input files.
  2619. Since the location counter is '0x10000' when the output section
  2620. '.text' is defined, the linker will set the address of the '.text'
  2621. section in the output file to be '0x10000'.
  2622. The remaining lines define the '.data' and '.bss' sections in the
  2623. output file. The linker will place the '.data' output section at
  2624. address '0x8000000'. After the linker places the '.data' output
  2625. section, the value of the location counter will be '0x8000000' plus the
  2626. size of the '.data' output section. The effect is that the linker will
  2627. place the '.bss' output section immediately after the '.data' output
  2628. section in memory.
  2629. The linker will ensure that each output section has the required
  2630. alignment, by increasing the location counter if necessary. In this
  2631. example, the specified addresses for the '.text' and '.data' sections
  2632. will probably satisfy any alignment constraints, but the linker may have
  2633. to create a small gap between the '.data' and '.bss' sections.
  2634. That's it! That's a simple and complete linker script.
  2635. 
  2636. File: ld.info, Node: Simple Commands, Next: Assignments, Prev: Simple Example, Up: Scripts
  2637. 3.4 Simple Linker Script Commands
  2638. =================================
  2639. In this section we describe the simple linker script commands.
  2640. * Menu:
  2641. * Entry Point:: Setting the entry point
  2642. * File Commands:: Commands dealing with files
  2643. * Format Commands:: Commands dealing with object file formats
  2644. * REGION_ALIAS:: Assign alias names to memory regions
  2645. * Miscellaneous Commands:: Other linker script commands
  2646. 
  2647. File: ld.info, Node: Entry Point, Next: File Commands, Up: Simple Commands
  2648. 3.4.1 Setting the Entry Point
  2649. -----------------------------
  2650. The first instruction to execute in a program is called the "entry
  2651. point". You can use the 'ENTRY' linker script command to set the entry
  2652. point. The argument is a symbol name:
  2653. ENTRY(SYMBOL)
  2654. There are several ways to set the entry point. The linker will set
  2655. the entry point by trying each of the following methods in order, and
  2656. stopping when one of them succeeds:
  2657. * the '-e' ENTRY command-line option;
  2658. * the 'ENTRY(SYMBOL)' command in a linker script;
  2659. * the value of a target-specific symbol, if it is defined; For many
  2660. targets this is 'start', but PE- and BeOS-based systems for example
  2661. check a list of possible entry symbols, matching the first one
  2662. found.
  2663. * the address of the first byte of the code section, if present and
  2664. an executable is being created - the code section is usually
  2665. '.text', but can be something else;
  2666. * The address '0'.
  2667. 
  2668. File: ld.info, Node: File Commands, Next: Format Commands, Prev: Entry Point, Up: Simple Commands
  2669. 3.4.2 Commands Dealing with Files
  2670. ---------------------------------
  2671. Several linker script commands deal with files.
  2672. 'INCLUDE FILENAME'
  2673. Include the linker script FILENAME at this point. The file will be
  2674. searched for in the current directory, and in any directory
  2675. specified with the '-L' option. You can nest calls to 'INCLUDE' up
  2676. to 10 levels deep.
  2677. You can place 'INCLUDE' directives at the top level, in 'MEMORY' or
  2678. 'SECTIONS' commands, or in output section descriptions.
  2679. 'INPUT(FILE, FILE, ...)'
  2680. 'INPUT(FILE FILE ...)'
  2681. The 'INPUT' command directs the linker to include the named files
  2682. in the link, as though they were named on the command line.
  2683. For example, if you always want to include 'subr.o' any time you do
  2684. a link, but you can't be bothered to put it on every link command
  2685. line, then you can put 'INPUT (subr.o)' in your linker script.
  2686. In fact, if you like, you can list all of your input files in the
  2687. linker script, and then invoke the linker with nothing but a '-T'
  2688. option.
  2689. In case a "sysroot prefix" is configured, and the filename starts
  2690. with the '/' character, and the script being processed was located
  2691. inside the "sysroot prefix", the filename will be looked for in the
  2692. "sysroot prefix". The "sysroot prefix" can also be forced by
  2693. specifying '=' as the first character in the filename path, or
  2694. prefixing the filename path with '$SYSROOT'. See also the
  2695. description of '-L' in *note Command-line Options: Options.
  2696. If a "sysroot prefix" is not used then the linker will try to open
  2697. the file in the directory containing the linker script. If it is
  2698. not found the linker will then search the current directory. If it
  2699. is still not found the linker will search through the archive
  2700. library search path.
  2701. If you use 'INPUT (-lFILE)', 'ld' will transform the name to
  2702. 'libFILE.a', as with the command-line argument '-l'.
  2703. When you use the 'INPUT' command in an implicit linker script, the
  2704. files will be included in the link at the point at which the linker
  2705. script file is included. This can affect archive searching.
  2706. 'GROUP(FILE, FILE, ...)'
  2707. 'GROUP(FILE FILE ...)'
  2708. The 'GROUP' command is like 'INPUT', except that the named files
  2709. should all be archives, and they are searched repeatedly until no
  2710. new undefined references are created. See the description of '-('
  2711. in *note Command-line Options: Options.
  2712. 'AS_NEEDED(FILE, FILE, ...)'
  2713. 'AS_NEEDED(FILE FILE ...)'
  2714. This construct can appear only inside of the 'INPUT' or 'GROUP'
  2715. commands, among other filenames. The files listed will be handled
  2716. as if they appear directly in the 'INPUT' or 'GROUP' commands, with
  2717. the exception of ELF shared libraries, that will be added only when
  2718. they are actually needed. This construct essentially enables
  2719. '--as-needed' option for all the files listed inside of it and
  2720. restores previous '--as-needed' resp. '--no-as-needed' setting
  2721. afterwards.
  2722. 'OUTPUT(FILENAME)'
  2723. The 'OUTPUT' command names the output file. Using
  2724. 'OUTPUT(FILENAME)' in the linker script is exactly like using '-o
  2725. FILENAME' on the command line (*note Command Line Options:
  2726. Options.). If both are used, the command-line option takes
  2727. precedence.
  2728. You can use the 'OUTPUT' command to define a default name for the
  2729. output file other than the usual default of 'a.out'.
  2730. 'SEARCH_DIR(PATH)'
  2731. The 'SEARCH_DIR' command adds PATH to the list of paths where 'ld'
  2732. looks for archive libraries. Using 'SEARCH_DIR(PATH)' is exactly
  2733. like using '-L PATH' on the command line (*note Command-line
  2734. Options: Options.). If both are used, then the linker will search
  2735. both paths. Paths specified using the command-line option are
  2736. searched first.
  2737. 'STARTUP(FILENAME)'
  2738. The 'STARTUP' command is just like the 'INPUT' command, except that
  2739. FILENAME will become the first input file to be linked, as though
  2740. it were specified first on the command line. This may be useful
  2741. when using a system in which the entry point is always the start of
  2742. the first file.
  2743. 
  2744. File: ld.info, Node: Format Commands, Next: REGION_ALIAS, Prev: File Commands, Up: Simple Commands
  2745. 3.4.3 Commands Dealing with Object File Formats
  2746. -----------------------------------------------
  2747. A couple of linker script commands deal with object file formats.
  2748. 'OUTPUT_FORMAT(BFDNAME)'
  2749. 'OUTPUT_FORMAT(DEFAULT, BIG, LITTLE)'
  2750. The 'OUTPUT_FORMAT' command names the BFD format to use for the
  2751. output file (*note BFD::). Using 'OUTPUT_FORMAT(BFDNAME)' is
  2752. exactly like using '--oformat BFDNAME' on the command line (*note
  2753. Command-line Options: Options.). If both are used, the command
  2754. line option takes precedence.
  2755. You can use 'OUTPUT_FORMAT' with three arguments to use different
  2756. formats based on the '-EB' and '-EL' command-line options. This
  2757. permits the linker script to set the output format based on the
  2758. desired endianness.
  2759. If neither '-EB' nor '-EL' are used, then the output format will be
  2760. the first argument, DEFAULT. If '-EB' is used, the output format
  2761. will be the second argument, BIG. If '-EL' is used, the output
  2762. format will be the third argument, LITTLE.
  2763. For example, the default linker script for the MIPS ELF target uses
  2764. this command:
  2765. OUTPUT_FORMAT(elf32-bigmips, elf32-bigmips, elf32-littlemips)
  2766. This says that the default format for the output file is
  2767. 'elf32-bigmips', but if the user uses the '-EL' command-line
  2768. option, the output file will be created in the 'elf32-littlemips'
  2769. format.
  2770. 'TARGET(BFDNAME)'
  2771. The 'TARGET' command names the BFD format to use when reading input
  2772. files. It affects subsequent 'INPUT' and 'GROUP' commands. This
  2773. command is like using '-b BFDNAME' on the command line (*note
  2774. Command-line Options: Options.). If the 'TARGET' command is used
  2775. but 'OUTPUT_FORMAT' is not, then the last 'TARGET' command is also
  2776. used to set the format for the output file. *Note BFD::.
  2777. 
  2778. File: ld.info, Node: REGION_ALIAS, Next: Miscellaneous Commands, Prev: Format Commands, Up: Simple Commands
  2779. 3.4.4 Assign alias names to memory regions
  2780. ------------------------------------------
  2781. Alias names can be added to existing memory regions created with the
  2782. *note MEMORY:: command. Each name corresponds to at most one memory
  2783. region.
  2784. REGION_ALIAS(ALIAS, REGION)
  2785. The 'REGION_ALIAS' function creates an alias name ALIAS for the
  2786. memory region REGION. This allows a flexible mapping of output sections
  2787. to memory regions. An example follows.
  2788. Suppose we have an application for embedded systems which come with
  2789. various memory storage devices. All have a general purpose, volatile
  2790. memory 'RAM' that allows code execution or data storage. Some may have
  2791. a read-only, non-volatile memory 'ROM' that allows code execution and
  2792. read-only data access. The last variant is a read-only, non-volatile
  2793. memory 'ROM2' with read-only data access and no code execution
  2794. capability. We have four output sections:
  2795. * '.text' program code;
  2796. * '.rodata' read-only data;
  2797. * '.data' read-write initialized data;
  2798. * '.bss' read-write zero initialized data.
  2799. The goal is to provide a linker command file that contains a system
  2800. independent part defining the output sections and a system dependent
  2801. part mapping the output sections to the memory regions available on the
  2802. system. Our embedded systems come with three different memory setups
  2803. 'A', 'B' and 'C':
  2804. Section Variant A Variant B Variant C
  2805. .text RAM ROM ROM
  2806. .rodata RAM ROM ROM2
  2807. .data RAM RAM/ROM RAM/ROM2
  2808. .bss RAM RAM RAM
  2809. The notation 'RAM/ROM' or 'RAM/ROM2' means that this section is
  2810. loaded into region 'ROM' or 'ROM2' respectively. Please note that the
  2811. load address of the '.data' section starts in all three variants at the
  2812. end of the '.rodata' section.
  2813. The base linker script that deals with the output sections follows.
  2814. It includes the system dependent 'linkcmds.memory' file that describes
  2815. the memory layout:
  2816. INCLUDE linkcmds.memory
  2817. SECTIONS
  2818. {
  2819. .text :
  2820. {
  2821. *(.text)
  2822. } > REGION_TEXT
  2823. .rodata :
  2824. {
  2825. *(.rodata)
  2826. rodata_end = .;
  2827. } > REGION_RODATA
  2828. .data : AT (rodata_end)
  2829. {
  2830. data_start = .;
  2831. *(.data)
  2832. } > REGION_DATA
  2833. data_size = SIZEOF(.data);
  2834. data_load_start = LOADADDR(.data);
  2835. .bss :
  2836. {
  2837. *(.bss)
  2838. } > REGION_BSS
  2839. }
  2840. Now we need three different 'linkcmds.memory' files to define memory
  2841. regions and alias names. The content of 'linkcmds.memory' for the three
  2842. variants 'A', 'B' and 'C':
  2843. 'A'
  2844. Here everything goes into the 'RAM'.
  2845. MEMORY
  2846. {
  2847. RAM : ORIGIN = 0, LENGTH = 4M
  2848. }
  2849. REGION_ALIAS("REGION_TEXT", RAM);
  2850. REGION_ALIAS("REGION_RODATA", RAM);
  2851. REGION_ALIAS("REGION_DATA", RAM);
  2852. REGION_ALIAS("REGION_BSS", RAM);
  2853. 'B'
  2854. Program code and read-only data go into the 'ROM'. Read-write data
  2855. goes into the 'RAM'. An image of the initialized data is loaded
  2856. into the 'ROM' and will be copied during system start into the
  2857. 'RAM'.
  2858. MEMORY
  2859. {
  2860. ROM : ORIGIN = 0, LENGTH = 3M
  2861. RAM : ORIGIN = 0x10000000, LENGTH = 1M
  2862. }
  2863. REGION_ALIAS("REGION_TEXT", ROM);
  2864. REGION_ALIAS("REGION_RODATA", ROM);
  2865. REGION_ALIAS("REGION_DATA", RAM);
  2866. REGION_ALIAS("REGION_BSS", RAM);
  2867. 'C'
  2868. Program code goes into the 'ROM'. Read-only data goes into the
  2869. 'ROM2'. Read-write data goes into the 'RAM'. An image of the
  2870. initialized data is loaded into the 'ROM2' and will be copied
  2871. during system start into the 'RAM'.
  2872. MEMORY
  2873. {
  2874. ROM : ORIGIN = 0, LENGTH = 2M
  2875. ROM2 : ORIGIN = 0x10000000, LENGTH = 1M
  2876. RAM : ORIGIN = 0x20000000, LENGTH = 1M
  2877. }
  2878. REGION_ALIAS("REGION_TEXT", ROM);
  2879. REGION_ALIAS("REGION_RODATA", ROM2);
  2880. REGION_ALIAS("REGION_DATA", RAM);
  2881. REGION_ALIAS("REGION_BSS", RAM);
  2882. It is possible to write a common system initialization routine to
  2883. copy the '.data' section from 'ROM' or 'ROM2' into the 'RAM' if
  2884. necessary:
  2885. #include <string.h>
  2886. extern char data_start [];
  2887. extern char data_size [];
  2888. extern char data_load_start [];
  2889. void copy_data(void)
  2890. {
  2891. if (data_start != data_load_start)
  2892. {
  2893. memcpy(data_start, data_load_start, (size_t) data_size);
  2894. }
  2895. }
  2896. 
  2897. File: ld.info, Node: Miscellaneous Commands, Prev: REGION_ALIAS, Up: Simple Commands
  2898. 3.4.5 Other Linker Script Commands
  2899. ----------------------------------
  2900. There are a few other linker scripts commands.
  2901. 'ASSERT(EXP, MESSAGE)'
  2902. Ensure that EXP is non-zero. If it is zero, then exit the linker
  2903. with an error code, and print MESSAGE.
  2904. Note that assertions are checked before the final stages of linking
  2905. take place. This means that expressions involving symbols PROVIDEd
  2906. inside section definitions will fail if the user has not set values
  2907. for those symbols. The only exception to this rule is PROVIDEd
  2908. symbols that just reference dot. Thus an assertion like this:
  2909. .stack :
  2910. {
  2911. PROVIDE (__stack = .);
  2912. PROVIDE (__stack_size = 0x100);
  2913. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2914. }
  2915. will fail if '__stack_size' is not defined elsewhere. Symbols
  2916. PROVIDEd outside of section definitions are evaluated earlier, so
  2917. they can be used inside ASSERTions. Thus:
  2918. PROVIDE (__stack_size = 0x100);
  2919. .stack :
  2920. {
  2921. PROVIDE (__stack = .);
  2922. ASSERT ((__stack > (_end + __stack_size)), "Error: No room left for the stack");
  2923. }
  2924. will work.
  2925. 'EXTERN(SYMBOL SYMBOL ...)'
  2926. Force SYMBOL to be entered in the output file as an undefined
  2927. symbol. Doing this may, for example, trigger linking of additional
  2928. modules from standard libraries. You may list several SYMBOLs for
  2929. each 'EXTERN', and you may use 'EXTERN' multiple times. This
  2930. command has the same effect as the '-u' command-line option.
  2931. 'FORCE_COMMON_ALLOCATION'
  2932. This command has the same effect as the '-d' command-line option:
  2933. to make 'ld' assign space to common symbols even if a relocatable
  2934. output file is specified ('-r').
  2935. 'INHIBIT_COMMON_ALLOCATION'
  2936. This command has the same effect as the '--no-define-common'
  2937. command-line option: to make 'ld' omit the assignment of addresses
  2938. to common symbols even for a non-relocatable output file.
  2939. 'FORCE_GROUP_ALLOCATION'
  2940. This command has the same effect as the '--force-group-allocation'
  2941. command-line option: to make 'ld' place section group members like
  2942. normal input sections, and to delete the section groups even if a
  2943. relocatable output file is specified ('-r').
  2944. 'INSERT [ AFTER | BEFORE ] OUTPUT_SECTION'
  2945. This command is typically used in a script specified by '-T' to
  2946. augment the default 'SECTIONS' with, for example, overlays. It
  2947. inserts all prior linker script statements after (or before)
  2948. OUTPUT_SECTION, and also causes '-T' to not override the default
  2949. linker script. The exact insertion point is as for orphan
  2950. sections. *Note Location Counter::. The insertion happens after
  2951. the linker has mapped input sections to output sections. Prior to
  2952. the insertion, since '-T' scripts are parsed before the default
  2953. linker script, statements in the '-T' script occur before the
  2954. default linker script statements in the internal linker
  2955. representation of the script. In particular, input section
  2956. assignments will be made to '-T' output sections before those in
  2957. the default script. Here is an example of how a '-T' script using
  2958. 'INSERT' might look:
  2959. SECTIONS
  2960. {
  2961. OVERLAY :
  2962. {
  2963. .ov1 { ov1*(.text) }
  2964. .ov2 { ov2*(.text) }
  2965. }
  2966. }
  2967. INSERT AFTER .text;
  2968. 'NOCROSSREFS(SECTION SECTION ...)'
  2969. This command may be used to tell 'ld' to issue an error about any
  2970. references among certain output sections.
  2971. In certain types of programs, particularly on embedded systems when
  2972. using overlays, when one section is loaded into memory, another
  2973. section will not be. Any direct references between the two
  2974. sections would be errors. For example, it would be an error if
  2975. code in one section called a function defined in the other section.
  2976. The 'NOCROSSREFS' command takes a list of output section names. If
  2977. 'ld' detects any cross references between the sections, it reports
  2978. an error and returns a non-zero exit status. Note that the
  2979. 'NOCROSSREFS' command uses output section names, not input section
  2980. names.
  2981. 'NOCROSSREFS_TO(TOSECTION FROMSECTION ...)'
  2982. This command may be used to tell 'ld' to issue an error about any
  2983. references to one section from a list of other sections.
  2984. The 'NOCROSSREFS' command is useful when ensuring that two or more
  2985. output sections are entirely independent but there are situations
  2986. where a one-way dependency is needed. For example, in a multi-core
  2987. application there may be shared code that can be called from each
  2988. core but for safety must never call back.
  2989. The 'NOCROSSREFS_TO' command takes a list of output section names.
  2990. The first section can not be referenced from any of the other
  2991. sections. If 'ld' detects any references to the first section from
  2992. any of the other sections, it reports an error and returns a
  2993. non-zero exit status. Note that the 'NOCROSSREFS_TO' command uses
  2994. output section names, not input section names.
  2995. 'OUTPUT_ARCH(BFDARCH)'
  2996. Specify a particular output machine architecture. The argument is
  2997. one of the names used by the BFD library (*note BFD::). You can
  2998. see the architecture of an object file by using the 'objdump'
  2999. program with the '-f' option.
  3000. 'LD_FEATURE(STRING)'
  3001. This command may be used to modify 'ld' behavior. If STRING is
  3002. '"SANE_EXPR"' then absolute symbols and numbers in a script are
  3003. simply treated as numbers everywhere. *Note Expression Section::.
  3004. 
  3005. File: ld.info, Node: Assignments, Next: SECTIONS, Prev: Simple Commands, Up: Scripts
  3006. 3.5 Assigning Values to Symbols
  3007. ===============================
  3008. You may assign a value to a symbol in a linker script. This will define
  3009. the symbol and place it into the symbol table with a global scope.
  3010. * Menu:
  3011. * Simple Assignments:: Simple Assignments
  3012. * HIDDEN:: HIDDEN
  3013. * PROVIDE:: PROVIDE
  3014. * PROVIDE_HIDDEN:: PROVIDE_HIDDEN
  3015. * Source Code Reference:: How to use a linker script defined symbol in source code
  3016. 
  3017. File: ld.info, Node: Simple Assignments, Next: HIDDEN, Up: Assignments
  3018. 3.5.1 Simple Assignments
  3019. ------------------------
  3020. You may assign to a symbol using any of the C assignment operators:
  3021. 'SYMBOL = EXPRESSION ;'
  3022. 'SYMBOL += EXPRESSION ;'
  3023. 'SYMBOL -= EXPRESSION ;'
  3024. 'SYMBOL *= EXPRESSION ;'
  3025. 'SYMBOL /= EXPRESSION ;'
  3026. 'SYMBOL <<= EXPRESSION ;'
  3027. 'SYMBOL >>= EXPRESSION ;'
  3028. 'SYMBOL &= EXPRESSION ;'
  3029. 'SYMBOL |= EXPRESSION ;'
  3030. The first case will define SYMBOL to the value of EXPRESSION. In the
  3031. other cases, SYMBOL must already be defined, and the value will be
  3032. adjusted accordingly.
  3033. The special symbol name '.' indicates the location counter. You may
  3034. only use this within a 'SECTIONS' command. *Note Location Counter::.
  3035. The semicolon after EXPRESSION is required.
  3036. Expressions are defined below; see *note Expressions::.
  3037. You may write symbol assignments as commands in their own right, or
  3038. as statements within a 'SECTIONS' command, or as part of an output
  3039. section description in a 'SECTIONS' command.
  3040. The section of the symbol will be set from the section of the
  3041. expression; for more information, see *note Expression Section::.
  3042. Here is an example showing the three different places that symbol
  3043. assignments may be used:
  3044. floating_point = 0;
  3045. SECTIONS
  3046. {
  3047. .text :
  3048. {
  3049. *(.text)
  3050. _etext = .;
  3051. }
  3052. _bdata = (. + 3) & ~ 3;
  3053. .data : { *(.data) }
  3054. }
  3055. In this example, the symbol 'floating_point' will be defined as zero.
  3056. The symbol '_etext' will be defined as the address following the last
  3057. '.text' input section. The symbol '_bdata' will be defined as the
  3058. address following the '.text' output section aligned upward to a 4 byte
  3059. boundary.
  3060. 
  3061. File: ld.info, Node: HIDDEN, Next: PROVIDE, Prev: Simple Assignments, Up: Assignments
  3062. 3.5.2 HIDDEN
  3063. ------------
  3064. For ELF targeted ports, define a symbol that will be hidden and won't be
  3065. exported. The syntax is 'HIDDEN(SYMBOL = EXPRESSION)'.
  3066. Here is the example from *note Simple Assignments::, rewritten to use
  3067. 'HIDDEN':
  3068. HIDDEN(floating_point = 0);
  3069. SECTIONS
  3070. {
  3071. .text :
  3072. {
  3073. *(.text)
  3074. HIDDEN(_etext = .);
  3075. }
  3076. HIDDEN(_bdata = (. + 3) & ~ 3);
  3077. .data : { *(.data) }
  3078. }
  3079. In this case none of the three symbols will be visible outside this
  3080. module.
  3081. 
  3082. File: ld.info, Node: PROVIDE, Next: PROVIDE_HIDDEN, Prev: HIDDEN, Up: Assignments
  3083. 3.5.3 PROVIDE
  3084. -------------
  3085. In some cases, it is desirable for a linker script to define a symbol
  3086. only if it is referenced and is not defined by any object included in
  3087. the link. For example, traditional linkers defined the symbol 'etext'.
  3088. However, ANSI C requires that the user be able to use 'etext' as a
  3089. function name without encountering an error. The 'PROVIDE' keyword may
  3090. be used to define a symbol, such as 'etext', only if it is referenced
  3091. but not defined. The syntax is 'PROVIDE(SYMBOL = EXPRESSION)'.
  3092. Here is an example of using 'PROVIDE' to define 'etext':
  3093. SECTIONS
  3094. {
  3095. .text :
  3096. {
  3097. *(.text)
  3098. _etext = .;
  3099. PROVIDE(etext = .);
  3100. }
  3101. }
  3102. In this example, if the program defines '_etext' (with a leading
  3103. underscore), the linker will give a multiple definition diagnostic. If,
  3104. on the other hand, the program defines 'etext' (with no leading
  3105. underscore), the linker will silently use the definition in the program.
  3106. If the program references 'etext' but does not define it, the linker
  3107. will use the definition in the linker script.
  3108. Note - the 'PROVIDE' directive considers a common symbol to be
  3109. defined, even though such a symbol could be combined with the symbol
  3110. that the 'PROVIDE' would create. This is particularly important when
  3111. considering constructor and destructor list symbols such as
  3112. '__CTOR_LIST__' as these are often defined as common symbols.
  3113. 
  3114. File: ld.info, Node: PROVIDE_HIDDEN, Next: Source Code Reference, Prev: PROVIDE, Up: Assignments
  3115. 3.5.4 PROVIDE_HIDDEN
  3116. --------------------
  3117. Similar to 'PROVIDE'. For ELF targeted ports, the symbol will be hidden
  3118. and won't be exported.
  3119. 
  3120. File: ld.info, Node: Source Code Reference, Prev: PROVIDE_HIDDEN, Up: Assignments
  3121. 3.5.5 Source Code Reference
  3122. ---------------------------
  3123. Accessing a linker script defined variable from source code is not
  3124. intuitive. In particular a linker script symbol is not equivalent to a
  3125. variable declaration in a high level language, it is instead a symbol
  3126. that does not have a value.
  3127. Before going further, it is important to note that compilers often
  3128. transform names in the source code into different names when they are
  3129. stored in the symbol table. For example, Fortran compilers commonly
  3130. prepend or append an underscore, and C++ performs extensive 'name
  3131. mangling'. Therefore there might be a discrepancy between the name of a
  3132. variable as it is used in source code and the name of the same variable
  3133. as it is defined in a linker script. For example in C a linker script
  3134. variable might be referred to as:
  3135. extern int foo;
  3136. But in the linker script it might be defined as:
  3137. _foo = 1000;
  3138. In the remaining examples however it is assumed that no name
  3139. transformation has taken place.
  3140. When a symbol is declared in a high level language such as C, two
  3141. things happen. The first is that the compiler reserves enough space in
  3142. the program's memory to hold the _value_ of the symbol. The second is
  3143. that the compiler creates an entry in the program's symbol table which
  3144. holds the symbol's _address_. ie the symbol table contains the address
  3145. of the block of memory holding the symbol's value. So for example the
  3146. following C declaration, at file scope:
  3147. int foo = 1000;
  3148. creates an entry called 'foo' in the symbol table. This entry holds
  3149. the address of an 'int' sized block of memory where the number 1000 is
  3150. initially stored.
  3151. When a program references a symbol the compiler generates code that
  3152. first accesses the symbol table to find the address of the symbol's
  3153. memory block and then code to read the value from that memory block.
  3154. So:
  3155. foo = 1;
  3156. looks up the symbol 'foo' in the symbol table, gets the address
  3157. associated with this symbol and then writes the value 1 into that
  3158. address. Whereas:
  3159. int * a = & foo;
  3160. looks up the symbol 'foo' in the symbol table, gets its address and
  3161. then copies this address into the block of memory associated with the
  3162. variable 'a'.
  3163. Linker scripts symbol declarations, by contrast, create an entry in
  3164. the symbol table but do not assign any memory to them. Thus they are an
  3165. address without a value. So for example the linker script definition:
  3166. foo = 1000;
  3167. creates an entry in the symbol table called 'foo' which holds the
  3168. address of memory location 1000, but nothing special is stored at
  3169. address 1000. This means that you cannot access the _value_ of a linker
  3170. script defined symbol - it has no value - all you can do is access the
  3171. _address_ of a linker script defined symbol.
  3172. Hence when you are using a linker script defined symbol in source
  3173. code you should always take the address of the symbol, and never attempt
  3174. to use its value. For example suppose you want to copy the contents of
  3175. a section of memory called .ROM into a section called .FLASH and the
  3176. linker script contains these declarations:
  3177. start_of_ROM = .ROM;
  3178. end_of_ROM = .ROM + sizeof (.ROM);
  3179. start_of_FLASH = .FLASH;
  3180. Then the C source code to perform the copy would be:
  3181. extern char start_of_ROM, end_of_ROM, start_of_FLASH;
  3182. memcpy (& start_of_FLASH, & start_of_ROM, & end_of_ROM - & start_of_ROM);
  3183. Note the use of the '&' operators. These are correct. Alternatively
  3184. the symbols can be treated as the names of vectors or arrays and then
  3185. the code will again work as expected:
  3186. extern char start_of_ROM[], end_of_ROM[], start_of_FLASH[];
  3187. memcpy (start_of_FLASH, start_of_ROM, end_of_ROM - start_of_ROM);
  3188. Note how using this method does not require the use of '&' operators.
  3189. 
  3190. File: ld.info, Node: SECTIONS, Next: MEMORY, Prev: Assignments, Up: Scripts
  3191. 3.6 SECTIONS Command
  3192. ====================
  3193. The 'SECTIONS' command tells the linker how to map input sections into
  3194. output sections, and how to place the output sections in memory.
  3195. The format of the 'SECTIONS' command is:
  3196. SECTIONS
  3197. {
  3198. SECTIONS-COMMAND
  3199. SECTIONS-COMMAND
  3200. ...
  3201. }
  3202. Each SECTIONS-COMMAND may of be one of the following:
  3203. * an 'ENTRY' command (*note Entry command: Entry Point.)
  3204. * a symbol assignment (*note Assignments::)
  3205. * an output section description
  3206. * an overlay description
  3207. The 'ENTRY' command and symbol assignments are permitted inside the
  3208. 'SECTIONS' command for convenience in using the location counter in
  3209. those commands. This can also make the linker script easier to
  3210. understand because you can use those commands at meaningful points in
  3211. the layout of the output file.
  3212. Output section descriptions and overlay descriptions are described
  3213. below.
  3214. If you do not use a 'SECTIONS' command in your linker script, the
  3215. linker will place each input section into an identically named output
  3216. section in the order that the sections are first encountered in the
  3217. input files. If all input sections are present in the first file, for
  3218. example, the order of sections in the output file will match the order
  3219. in the first input file. The first section will be at address zero.
  3220. * Menu:
  3221. * Output Section Description:: Output section description
  3222. * Output Section Name:: Output section name
  3223. * Output Section Address:: Output section address
  3224. * Input Section:: Input section description
  3225. * Output Section Data:: Output section data
  3226. * Output Section Keywords:: Output section keywords
  3227. * Output Section Discarding:: Output section discarding
  3228. * Output Section Attributes:: Output section attributes
  3229. * Overlay Description:: Overlay description
  3230. 
  3231. File: ld.info, Node: Output Section Description, Next: Output Section Name, Up: SECTIONS
  3232. 3.6.1 Output Section Description
  3233. --------------------------------
  3234. The full description of an output section looks like this:
  3235. SECTION [ADDRESS] [(TYPE)] :
  3236. [AT(LMA)]
  3237. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3238. [SUBALIGN(SUBSECTION_ALIGN)]
  3239. [CONSTRAINT]
  3240. {
  3241. OUTPUT-SECTION-COMMAND
  3242. OUTPUT-SECTION-COMMAND
  3243. ...
  3244. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP] [,]
  3245. Most output sections do not use most of the optional section
  3246. attributes.
  3247. The whitespace around SECTION is required, so that the section name
  3248. is unambiguous. The colon and the curly braces are also required. The
  3249. comma at the end may be required if a FILLEXP is used and the next
  3250. SECTIONS-COMMAND looks like a continuation of the expression. The line
  3251. breaks and other white space are optional.
  3252. Each OUTPUT-SECTION-COMMAND may be one of the following:
  3253. * a symbol assignment (*note Assignments::)
  3254. * an input section description (*note Input Section::)
  3255. * data values to include directly (*note Output Section Data::)
  3256. * a special output section keyword (*note Output Section Keywords::)
  3257. 
  3258. File: ld.info, Node: Output Section Name, Next: Output Section Address, Prev: Output Section Description, Up: SECTIONS
  3259. 3.6.2 Output Section Name
  3260. -------------------------
  3261. The name of the output section is SECTION. SECTION must meet the
  3262. constraints of your output format. In formats which only support a
  3263. limited number of sections, such as 'a.out', the name must be one of the
  3264. names supported by the format ('a.out', for example, allows only
  3265. '.text', '.data' or '.bss'). If the output format supports any number
  3266. of sections, but with numbers and not names (as is the case for Oasys),
  3267. the name should be supplied as a quoted numeric string. A section name
  3268. may consist of any sequence of characters, but a name which contains any
  3269. unusual characters such as commas must be quoted.
  3270. The output section name '/DISCARD/' is special; *note Output Section
  3271. Discarding::.
  3272. 
  3273. File: ld.info, Node: Output Section Address, Next: Input Section, Prev: Output Section Name, Up: SECTIONS
  3274. 3.6.3 Output Section Address
  3275. ----------------------------
  3276. The ADDRESS is an expression for the VMA (the virtual memory address) of
  3277. the output section. This address is optional, but if it is provided
  3278. then the output address will be set exactly as specified.
  3279. If the output address is not specified then one will be chosen for
  3280. the section, based on the heuristic below. This address will be
  3281. adjusted to fit the alignment requirement of the output section. The
  3282. alignment requirement is the strictest alignment of any input section
  3283. contained within the output section.
  3284. The output section address heuristic is as follows:
  3285. * If an output memory REGION is set for the section then it is added
  3286. to this region and its address will be the next free address in
  3287. that region.
  3288. * If the MEMORY command has been used to create a list of memory
  3289. regions then the first region which has attributes compatible with
  3290. the section is selected to contain it. The section's output
  3291. address will be the next free address in that region; *note
  3292. MEMORY::.
  3293. * If no memory regions were specified, or none match the section then
  3294. the output address will be based on the current value of the
  3295. location counter.
  3296. For example:
  3297. .text . : { *(.text) }
  3298. and
  3299. .text : { *(.text) }
  3300. are subtly different. The first will set the address of the '.text'
  3301. output section to the current value of the location counter. The second
  3302. will set it to the current value of the location counter aligned to the
  3303. strictest alignment of any of the '.text' input sections.
  3304. The ADDRESS may be an arbitrary expression; *note Expressions::. For
  3305. example, if you want to align the section on a 0x10 byte boundary, so
  3306. that the lowest four bits of the section address are zero, you could do
  3307. something like this:
  3308. .text ALIGN(0x10) : { *(.text) }
  3309. This works because 'ALIGN' returns the current location counter aligned
  3310. upward to the specified value.
  3311. Specifying ADDRESS for a section will change the value of the
  3312. location counter, provided that the section is non-empty. (Empty
  3313. sections are ignored).
  3314. 
  3315. File: ld.info, Node: Input Section, Next: Output Section Data, Prev: Output Section Address, Up: SECTIONS
  3316. 3.6.4 Input Section Description
  3317. -------------------------------
  3318. The most common output section command is an input section description.
  3319. The input section description is the most basic linker script
  3320. operation. You use output sections to tell the linker how to lay out
  3321. your program in memory. You use input section descriptions to tell the
  3322. linker how to map the input files into your memory layout.
  3323. * Menu:
  3324. * Input Section Basics:: Input section basics
  3325. * Input Section Wildcards:: Input section wildcard patterns
  3326. * Input Section Common:: Input section for common symbols
  3327. * Input Section Keep:: Input section and garbage collection
  3328. * Input Section Example:: Input section example
  3329. 
  3330. File: ld.info, Node: Input Section Basics, Next: Input Section Wildcards, Up: Input Section
  3331. 3.6.4.1 Input Section Basics
  3332. ............................
  3333. An input section description consists of a file name optionally followed
  3334. by a list of section names in parentheses.
  3335. The file name and the section name may be wildcard patterns, which we
  3336. describe further below (*note Input Section Wildcards::).
  3337. The most common input section description is to include all input
  3338. sections with a particular name in the output section. For example, to
  3339. include all input '.text' sections, you would write:
  3340. *(.text)
  3341. Here the '*' is a wildcard which matches any file name. To exclude a
  3342. list of files from matching the file name wildcard, EXCLUDE_FILE may be
  3343. used to match all files except the ones specified in the EXCLUDE_FILE
  3344. list. For example:
  3345. EXCLUDE_FILE (*crtend.o *otherfile.o) *(.ctors)
  3346. will cause all .ctors sections from all files except 'crtend.o' and
  3347. 'otherfile.o' to be included. The EXCLUDE_FILE can also be placed
  3348. inside the section list, for example:
  3349. *(EXCLUDE_FILE (*crtend.o *otherfile.o) .ctors)
  3350. The result of this is identically to the previous example. Supporting
  3351. two syntaxes for EXCLUDE_FILE is useful if the section list contains
  3352. more than one section, as described below.
  3353. There are two ways to include more than one section:
  3354. *(.text .rdata)
  3355. *(.text) *(.rdata)
  3356. The difference between these is the order in which the '.text' and
  3357. '.rdata' input sections will appear in the output section. In the first
  3358. example, they will be intermingled, appearing in the same order as they
  3359. are found in the linker input. In the second example, all '.text' input
  3360. sections will appear first, followed by all '.rdata' input sections.
  3361. When using EXCLUDE_FILE with more than one section, if the exclusion
  3362. is within the section list then the exclusion only applies to the
  3363. immediately following section, for example:
  3364. *(EXCLUDE_FILE (*somefile.o) .text .rdata)
  3365. will cause all '.text' sections from all files except 'somefile.o' to be
  3366. included, while all '.rdata' sections from all files, including
  3367. 'somefile.o', will be included. To exclude the '.rdata' sections from
  3368. 'somefile.o' the example could be modified to:
  3369. *(EXCLUDE_FILE (*somefile.o) .text EXCLUDE_FILE (*somefile.o) .rdata)
  3370. Alternatively, placing the EXCLUDE_FILE outside of the section list,
  3371. before the input file selection, will cause the exclusion to apply for
  3372. all sections. Thus the previous example can be rewritten as:
  3373. EXCLUDE_FILE (*somefile.o) *(.text .rdata)
  3374. You can specify a file name to include sections from a particular
  3375. file. You would do this if one or more of your files contain special
  3376. data that needs to be at a particular location in memory. For example:
  3377. data.o(.data)
  3378. To refine the sections that are included based on the section flags
  3379. of an input section, INPUT_SECTION_FLAGS may be used.
  3380. Here is a simple example for using Section header flags for ELF
  3381. sections:
  3382. SECTIONS {
  3383. .text : { INPUT_SECTION_FLAGS (SHF_MERGE & SHF_STRINGS) *(.text) }
  3384. .text2 : { INPUT_SECTION_FLAGS (!SHF_WRITE) *(.text) }
  3385. }
  3386. In this example, the output section '.text' will be comprised of any
  3387. input section matching the name *(.text) whose section header flags
  3388. 'SHF_MERGE' and 'SHF_STRINGS' are set. The output section '.text2' will
  3389. be comprised of any input section matching the name *(.text) whose
  3390. section header flag 'SHF_WRITE' is clear.
  3391. You can also specify files within archives by writing a pattern
  3392. matching the archive, a colon, then the pattern matching the file, with
  3393. no whitespace around the colon.
  3394. 'archive:file'
  3395. matches file within archive
  3396. 'archive:'
  3397. matches the whole archive
  3398. ':file'
  3399. matches file but not one in an archive
  3400. Either one or both of 'archive' and 'file' can contain shell
  3401. wildcards. On DOS based file systems, the linker will assume that a
  3402. single letter followed by a colon is a drive specifier, so 'c:myfile.o'
  3403. is a simple file specification, not 'myfile.o' within an archive called
  3404. 'c'. 'archive:file' filespecs may also be used within an 'EXCLUDE_FILE'
  3405. list, but may not appear in other linker script contexts. For instance,
  3406. you cannot extract a file from an archive by using 'archive:file' in an
  3407. 'INPUT' command.
  3408. If you use a file name without a list of sections, then all sections
  3409. in the input file will be included in the output section. This is not
  3410. commonly done, but it may by useful on occasion. For example:
  3411. data.o
  3412. When you use a file name which is not an 'archive:file' specifier and
  3413. does not contain any wild card characters, the linker will first see if
  3414. you also specified the file name on the linker command line or in an
  3415. 'INPUT' command. If you did not, the linker will attempt to open the
  3416. file as an input file, as though it appeared on the command line. Note
  3417. that this differs from an 'INPUT' command, because the linker will not
  3418. search for the file in the archive search path.
  3419. 
  3420. File: ld.info, Node: Input Section Wildcards, Next: Input Section Common, Prev: Input Section Basics, Up: Input Section
  3421. 3.6.4.2 Input Section Wildcard Patterns
  3422. .......................................
  3423. In an input section description, either the file name or the section
  3424. name or both may be wildcard patterns.
  3425. The file name of '*' seen in many examples is a simple wildcard
  3426. pattern for the file name.
  3427. The wildcard patterns are like those used by the Unix shell.
  3428. '*'
  3429. matches any number of characters
  3430. '?'
  3431. matches any single character
  3432. '[CHARS]'
  3433. matches a single instance of any of the CHARS; the '-' character
  3434. may be used to specify a range of characters, as in '[a-z]' to
  3435. match any lower case letter
  3436. '\'
  3437. quotes the following character
  3438. File name wildcard patterns only match files which are explicitly
  3439. specified on the command line or in an 'INPUT' command. The linker does
  3440. not search directories to expand wildcards.
  3441. If a file name matches more than one wildcard pattern, or if a file
  3442. name appears explicitly and is also matched by a wildcard pattern, the
  3443. linker will use the first match in the linker script. For example, this
  3444. sequence of input section descriptions is probably in error, because the
  3445. 'data.o' rule will not be used:
  3446. .data : { *(.data) }
  3447. .data1 : { data.o(.data) }
  3448. Normally, the linker will place files and sections matched by
  3449. wildcards in the order in which they are seen during the link. You can
  3450. change this by using the 'SORT_BY_NAME' keyword, which appears before a
  3451. wildcard pattern in parentheses (e.g., 'SORT_BY_NAME(.text*)'). When
  3452. the 'SORT_BY_NAME' keyword is used, the linker will sort the files or
  3453. sections into ascending order by name before placing them in the output
  3454. file.
  3455. 'SORT_BY_ALIGNMENT' is similar to 'SORT_BY_NAME'.
  3456. 'SORT_BY_ALIGNMENT' will sort sections into descending order of
  3457. alignment before placing them in the output file. Placing larger
  3458. alignments before smaller alignments can reduce the amount of padding
  3459. needed.
  3460. 'SORT_BY_INIT_PRIORITY' is also similar to 'SORT_BY_NAME'.
  3461. 'SORT_BY_INIT_PRIORITY' will sort sections into ascending numerical
  3462. order of the GCC init_priority attribute encoded in the section name
  3463. before placing them in the output file. In '.init_array.NNNNN' and
  3464. '.fini_array.NNNNN', 'NNNNN' is the init_priority. In '.ctors.NNNNN'
  3465. and '.dtors.NNNNN', 'NNNNN' is 65535 minus the init_priority.
  3466. 'SORT' is an alias for 'SORT_BY_NAME'.
  3467. When there are nested section sorting commands in linker script,
  3468. there can be at most 1 level of nesting for section sorting commands.
  3469. 1. 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT' (wildcard section pattern)).
  3470. It will sort the input sections by name first, then by alignment if
  3471. two sections have the same name.
  3472. 2. 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME' (wildcard section pattern)).
  3473. It will sort the input sections by alignment first, then by name if
  3474. two sections have the same alignment.
  3475. 3. 'SORT_BY_NAME' ('SORT_BY_NAME' (wildcard section pattern)) is
  3476. treated the same as 'SORT_BY_NAME' (wildcard section pattern).
  3477. 4. 'SORT_BY_ALIGNMENT' ('SORT_BY_ALIGNMENT' (wildcard section
  3478. pattern)) is treated the same as 'SORT_BY_ALIGNMENT' (wildcard
  3479. section pattern).
  3480. 5. All other nested section sorting commands are invalid.
  3481. When both command-line section sorting option and linker script
  3482. section sorting command are used, section sorting command always takes
  3483. precedence over the command-line option.
  3484. If the section sorting command in linker script isn't nested, the
  3485. command-line option will make the section sorting command to be treated
  3486. as nested sorting command.
  3487. 1. 'SORT_BY_NAME' (wildcard section pattern ) with '--sort-sections
  3488. alignment' is equivalent to 'SORT_BY_NAME' ('SORT_BY_ALIGNMENT'
  3489. (wildcard section pattern)).
  3490. 2. 'SORT_BY_ALIGNMENT' (wildcard section pattern) with '--sort-section
  3491. name' is equivalent to 'SORT_BY_ALIGNMENT' ('SORT_BY_NAME'
  3492. (wildcard section pattern)).
  3493. If the section sorting command in linker script is nested, the
  3494. command-line option will be ignored.
  3495. 'SORT_NONE' disables section sorting by ignoring the command-line
  3496. section sorting option.
  3497. If you ever get confused about where input sections are going, use
  3498. the '-M' linker option to generate a map file. The map file shows
  3499. precisely how input sections are mapped to output sections.
  3500. This example shows how wildcard patterns might be used to partition
  3501. files. This linker script directs the linker to place all '.text'
  3502. sections in '.text' and all '.bss' sections in '.bss'. The linker will
  3503. place the '.data' section from all files beginning with an upper case
  3504. character in '.DATA'; for all other files, the linker will place the
  3505. '.data' section in '.data'.
  3506. SECTIONS {
  3507. .text : { *(.text) }
  3508. .DATA : { [A-Z]*(.data) }
  3509. .data : { *(.data) }
  3510. .bss : { *(.bss) }
  3511. }
  3512. 
  3513. File: ld.info, Node: Input Section Common, Next: Input Section Keep, Prev: Input Section Wildcards, Up: Input Section
  3514. 3.6.4.3 Input Section for Common Symbols
  3515. ........................................
  3516. A special notation is needed for common symbols, because in many object
  3517. file formats common symbols do not have a particular input section. The
  3518. linker treats common symbols as though they are in an input section
  3519. named 'COMMON'.
  3520. You may use file names with the 'COMMON' section just as with any
  3521. other input sections. You can use this to place common symbols from a
  3522. particular input file in one section while common symbols from other
  3523. input files are placed in another section.
  3524. In most cases, common symbols in input files will be placed in the
  3525. '.bss' section in the output file. For example:
  3526. .bss { *(.bss) *(COMMON) }
  3527. Some object file formats have more than one type of common symbol.
  3528. For example, the MIPS ELF object file format distinguishes standard
  3529. common symbols and small common symbols. In this case, the linker will
  3530. use a different special section name for other types of common symbols.
  3531. In the case of MIPS ELF, the linker uses 'COMMON' for standard common
  3532. symbols and '.scommon' for small common symbols. This permits you to
  3533. map the different types of common symbols into memory at different
  3534. locations.
  3535. You will sometimes see '[COMMON]' in old linker scripts. This
  3536. notation is now considered obsolete. It is equivalent to '*(COMMON)'.
  3537. 
  3538. File: ld.info, Node: Input Section Keep, Next: Input Section Example, Prev: Input Section Common, Up: Input Section
  3539. 3.6.4.4 Input Section and Garbage Collection
  3540. ............................................
  3541. When link-time garbage collection is in use ('--gc-sections'), it is
  3542. often useful to mark sections that should not be eliminated. This is
  3543. accomplished by surrounding an input section's wildcard entry with
  3544. 'KEEP()', as in 'KEEP(*(.init))' or 'KEEP(SORT_BY_NAME(*)(.ctors))'.
  3545. 
  3546. File: ld.info, Node: Input Section Example, Prev: Input Section Keep, Up: Input Section
  3547. 3.6.4.5 Input Section Example
  3548. .............................
  3549. The following example is a complete linker script. It tells the linker
  3550. to read all of the sections from file 'all.o' and place them at the
  3551. start of output section 'outputa' which starts at location '0x10000'.
  3552. All of section '.input1' from file 'foo.o' follows immediately, in the
  3553. same output section. All of section '.input2' from 'foo.o' goes into
  3554. output section 'outputb', followed by section '.input1' from 'foo1.o'.
  3555. All of the remaining '.input1' and '.input2' sections from any files are
  3556. written to output section 'outputc'.
  3557. SECTIONS {
  3558. outputa 0x10000 :
  3559. {
  3560. all.o
  3561. foo.o (.input1)
  3562. }
  3563. outputb :
  3564. {
  3565. foo.o (.input2)
  3566. foo1.o (.input1)
  3567. }
  3568. outputc :
  3569. {
  3570. *(.input1)
  3571. *(.input2)
  3572. }
  3573. }
  3574. If an output section's name is the same as the input section's name
  3575. and is representable as a C identifier, then the linker will
  3576. automatically *note PROVIDE:: two symbols: __start_SECNAME and
  3577. __stop_SECNAME, where SECNAME is the name of the section. These
  3578. indicate the start address and end address of the output section
  3579. respectively. Note: most section names are not representable as C
  3580. identifiers because they contain a '.' character.
  3581. 
  3582. File: ld.info, Node: Output Section Data, Next: Output Section Keywords, Prev: Input Section, Up: SECTIONS
  3583. 3.6.5 Output Section Data
  3584. -------------------------
  3585. You can include explicit bytes of data in an output section by using
  3586. 'BYTE', 'SHORT', 'LONG', 'QUAD', or 'SQUAD' as an output section
  3587. command. Each keyword is followed by an expression in parentheses
  3588. providing the value to store (*note Expressions::). The value of the
  3589. expression is stored at the current value of the location counter.
  3590. The 'BYTE', 'SHORT', 'LONG', and 'QUAD' commands store one, two,
  3591. four, and eight bytes (respectively). After storing the bytes, the
  3592. location counter is incremented by the number of bytes stored.
  3593. For example, this will store the byte 1 followed by the four byte
  3594. value of the symbol 'addr':
  3595. BYTE(1)
  3596. LONG(addr)
  3597. When using a 64 bit host or target, 'QUAD' and 'SQUAD' are the same;
  3598. they both store an 8 byte, or 64 bit, value. When both host and target
  3599. are 32 bits, an expression is computed as 32 bits. In this case 'QUAD'
  3600. stores a 32 bit value zero extended to 64 bits, and 'SQUAD' stores a 32
  3601. bit value sign extended to 64 bits.
  3602. If the object file format of the output file has an explicit
  3603. endianness, which is the normal case, the value will be stored in that
  3604. endianness. When the object file format does not have an explicit
  3605. endianness, as is true of, for example, S-records, the value will be
  3606. stored in the endianness of the first input object file.
  3607. Note--these commands only work inside a section description and not
  3608. between them, so the following will produce an error from the linker:
  3609. SECTIONS { .text : { *(.text) } LONG(1) .data : { *(.data) } }
  3610. whereas this will work:
  3611. SECTIONS { .text : { *(.text) ; LONG(1) } .data : { *(.data) } }
  3612. You may use the 'FILL' command to set the fill pattern for the
  3613. current section. It is followed by an expression in parentheses. Any
  3614. otherwise unspecified regions of memory within the section (for example,
  3615. gaps left due to the required alignment of input sections) are filled
  3616. with the value of the expression, repeated as necessary. A 'FILL'
  3617. statement covers memory locations after the point at which it occurs in
  3618. the section definition; by including more than one 'FILL' statement, you
  3619. can have different fill patterns in different parts of an output
  3620. section.
  3621. This example shows how to fill unspecified regions of memory with the
  3622. value '0x90':
  3623. FILL(0x90909090)
  3624. The 'FILL' command is similar to the '=FILLEXP' output section
  3625. attribute, but it only affects the part of the section following the
  3626. 'FILL' command, rather than the entire section. If both are used, the
  3627. 'FILL' command takes precedence. *Note Output Section Fill::, for
  3628. details on the fill expression.
  3629. 
  3630. File: ld.info, Node: Output Section Keywords, Next: Output Section Discarding, Prev: Output Section Data, Up: SECTIONS
  3631. 3.6.6 Output Section Keywords
  3632. -----------------------------
  3633. There are a couple of keywords which can appear as output section
  3634. commands.
  3635. 'CREATE_OBJECT_SYMBOLS'
  3636. The command tells the linker to create a symbol for each input
  3637. file. The name of each symbol will be the name of the
  3638. corresponding input file. The section of each symbol will be the
  3639. output section in which the 'CREATE_OBJECT_SYMBOLS' command
  3640. appears.
  3641. This is conventional for the a.out object file format. It is not
  3642. normally used for any other object file format.
  3643. 'CONSTRUCTORS'
  3644. When linking using the a.out object file format, the linker uses an
  3645. unusual set construct to support C++ global constructors and
  3646. destructors. When linking object file formats which do not support
  3647. arbitrary sections, such as ECOFF and XCOFF, the linker will
  3648. automatically recognize C++ global constructors and destructors by
  3649. name. For these object file formats, the 'CONSTRUCTORS' command
  3650. tells the linker to place constructor information in the output
  3651. section where the 'CONSTRUCTORS' command appears. The
  3652. 'CONSTRUCTORS' command is ignored for other object file formats.
  3653. The symbol '__CTOR_LIST__' marks the start of the global
  3654. constructors, and the symbol '__CTOR_END__' marks the end.
  3655. Similarly, '__DTOR_LIST__' and '__DTOR_END__' mark the start and
  3656. end of the global destructors. The first word in the list is the
  3657. number of entries, followed by the address of each constructor or
  3658. destructor, followed by a zero word. The compiler must arrange to
  3659. actually run the code. For these object file formats GNU C++
  3660. normally calls constructors from a subroutine '__main'; a call to
  3661. '__main' is automatically inserted into the startup code for
  3662. 'main'. GNU C++ normally runs destructors either by using
  3663. 'atexit', or directly from the function 'exit'.
  3664. For object file formats such as 'COFF' or 'ELF' which support
  3665. arbitrary section names, GNU C++ will normally arrange to put the
  3666. addresses of global constructors and destructors into the '.ctors'
  3667. and '.dtors' sections. Placing the following sequence into your
  3668. linker script will build the sort of table which the GNU C++
  3669. runtime code expects to see.
  3670. __CTOR_LIST__ = .;
  3671. LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  3672. *(.ctors)
  3673. LONG(0)
  3674. __CTOR_END__ = .;
  3675. __DTOR_LIST__ = .;
  3676. LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
  3677. *(.dtors)
  3678. LONG(0)
  3679. __DTOR_END__ = .;
  3680. If you are using the GNU C++ support for initialization priority,
  3681. which provides some control over the order in which global
  3682. constructors are run, you must sort the constructors at link time
  3683. to ensure that they are executed in the correct order. When using
  3684. the 'CONSTRUCTORS' command, use 'SORT_BY_NAME(CONSTRUCTORS)'
  3685. instead. When using the '.ctors' and '.dtors' sections, use
  3686. '*(SORT_BY_NAME(.ctors))' and '*(SORT_BY_NAME(.dtors))' instead of
  3687. just '*(.ctors)' and '*(.dtors)'.
  3688. Normally the compiler and linker will handle these issues
  3689. automatically, and you will not need to concern yourself with them.
  3690. However, you may need to consider this if you are using C++ and
  3691. writing your own linker scripts.
  3692. 
  3693. File: ld.info, Node: Output Section Discarding, Next: Output Section Attributes, Prev: Output Section Keywords, Up: SECTIONS
  3694. 3.6.7 Output Section Discarding
  3695. -------------------------------
  3696. The linker will not normally create output sections with no contents.
  3697. This is for convenience when referring to input sections that may or may
  3698. not be present in any of the input files. For example:
  3699. .foo : { *(.foo) }
  3700. will only create a '.foo' section in the output file if there is a
  3701. '.foo' section in at least one input file, and if the input sections are
  3702. not all empty. Other link script directives that allocate space in an
  3703. output section will also create the output section. So too will
  3704. assignments to dot even if the assignment does not create space, except
  3705. for '. = 0', '. = . + 0', '. = sym', '. = . + sym' and '. = ALIGN (. !=
  3706. 0, expr, 1)' when 'sym' is an absolute symbol of value 0 defined in the
  3707. script. This allows you to force output of an empty section with '. =
  3708. .'.
  3709. The linker will ignore address assignments (*note Output Section
  3710. Address::) on discarded output sections, except when the linker script
  3711. defines symbols in the output section. In that case the linker will
  3712. obey the address assignments, possibly advancing dot even though the
  3713. section is discarded.
  3714. The special output section name '/DISCARD/' may be used to discard
  3715. input sections. Any input sections which are assigned to an output
  3716. section named '/DISCARD/' are not included in the output file.
  3717. This can be used to discard input sections marked with the ELF flag
  3718. 'SHF_GNU_RETAIN', which would otherwise have been saved from linker
  3719. garbage collection.
  3720. Note, sections that match the '/DISCARD/' output section will be
  3721. discarded even if they are in an ELF section group which has other
  3722. members which are not being discarded. This is deliberate. Discarding
  3723. takes precedence over grouping.
  3724. 
  3725. File: ld.info, Node: Output Section Attributes, Next: Overlay Description, Prev: Output Section Discarding, Up: SECTIONS
  3726. 3.6.8 Output Section Attributes
  3727. -------------------------------
  3728. We showed above that the full description of an output section looked
  3729. like this:
  3730. SECTION [ADDRESS] [(TYPE)] :
  3731. [AT(LMA)]
  3732. [ALIGN(SECTION_ALIGN) | ALIGN_WITH_INPUT]
  3733. [SUBALIGN(SUBSECTION_ALIGN)]
  3734. [CONSTRAINT]
  3735. {
  3736. OUTPUT-SECTION-COMMAND
  3737. OUTPUT-SECTION-COMMAND
  3738. ...
  3739. } [>REGION] [AT>LMA_REGION] [:PHDR :PHDR ...] [=FILLEXP]
  3740. We've already described SECTION, ADDRESS, and OUTPUT-SECTION-COMMAND.
  3741. In this section we will describe the remaining section attributes.
  3742. * Menu:
  3743. * Output Section Type:: Output section type
  3744. * Output Section LMA:: Output section LMA
  3745. * Forced Output Alignment:: Forced Output Alignment
  3746. * Forced Input Alignment:: Forced Input Alignment
  3747. * Output Section Constraint:: Output section constraint
  3748. * Output Section Region:: Output section region
  3749. * Output Section Phdr:: Output section phdr
  3750. * Output Section Fill:: Output section fill
  3751. 
  3752. File: ld.info, Node: Output Section Type, Next: Output Section LMA, Up: Output Section Attributes
  3753. 3.6.8.1 Output Section Type
  3754. ...........................
  3755. Each output section may have a type. The type is a keyword in
  3756. parentheses. The following types are defined:
  3757. 'NOLOAD'
  3758. The section should be marked as not loadable, so that it will not
  3759. be loaded into memory when the program is run.
  3760. 'READONLY'
  3761. The section should be marked as read-only.
  3762. 'DSECT'
  3763. 'COPY'
  3764. 'INFO'
  3765. 'OVERLAY'
  3766. These type names are supported for backward compatibility, and are
  3767. rarely used. They all have the same effect: the section should be
  3768. marked as not allocatable, so that no memory is allocated for the
  3769. section when the program is run.
  3770. The linker normally sets the attributes of an output section based on
  3771. the input sections which map into it. You can override this by using
  3772. the section type. For example, in the script sample below, the 'ROM'
  3773. section is addressed at memory location '0' and does not need to be
  3774. loaded when the program is run.
  3775. SECTIONS {
  3776. ROM 0 (NOLOAD) : { ... }
  3777. ...
  3778. }
  3779. 
  3780. File: ld.info, Node: Output Section LMA, Next: Forced Output Alignment, Prev: Output Section Type, Up: Output Section Attributes
  3781. 3.6.8.2 Output Section LMA
  3782. ..........................
  3783. Every section has a virtual address (VMA) and a load address (LMA); see
  3784. *note Basic Script Concepts::. The virtual address is specified by the
  3785. *note Output Section Address:: described earlier. The load address is
  3786. specified by the 'AT' or 'AT>' keywords. Specifying a load address is
  3787. optional.
  3788. The 'AT' keyword takes an expression as an argument. This specifies
  3789. the exact load address of the section. The 'AT>' keyword takes the name
  3790. of a memory region as an argument. *Note MEMORY::. The load address of
  3791. the section is set to the next free address in the region, aligned to
  3792. the section's alignment requirements.
  3793. If neither 'AT' nor 'AT>' is specified for an allocatable section,
  3794. the linker will use the following heuristic to determine the load
  3795. address:
  3796. * If the section has a specific VMA address, then this is used as the
  3797. LMA address as well.
  3798. * If the section is not allocatable then its LMA is set to its VMA.
  3799. * Otherwise if a memory region can be found that is compatible with
  3800. the current section, and this region contains at least one section,
  3801. then the LMA is set so the difference between the VMA and LMA is
  3802. the same as the difference between the VMA and LMA of the last
  3803. section in the located region.
  3804. * If no memory regions have been declared then a default region that
  3805. covers the entire address space is used in the previous step.
  3806. * If no suitable region could be found, or there was no previous
  3807. section then the LMA is set equal to the VMA.
  3808. This feature is designed to make it easy to build a ROM image. For
  3809. example, the following linker script creates three output sections: one
  3810. called '.text', which starts at '0x1000', one called '.mdata', which is
  3811. loaded at the end of the '.text' section even though its VMA is
  3812. '0x2000', and one called '.bss' to hold uninitialized data at address
  3813. '0x3000'. The symbol '_data' is defined with the value '0x2000', which
  3814. shows that the location counter holds the VMA value, not the LMA value.
  3815. SECTIONS
  3816. {
  3817. .text 0x1000 : { *(.text) _etext = . ; }
  3818. .mdata 0x2000 :
  3819. AT ( ADDR (.text) + SIZEOF (.text) )
  3820. { _data = . ; *(.data); _edata = . ; }
  3821. .bss 0x3000 :
  3822. { _bstart = . ; *(.bss) *(COMMON) ; _bend = . ;}
  3823. }
  3824. The run-time initialization code for use with a program generated
  3825. with this linker script would include something like the following, to
  3826. copy the initialized data from the ROM image to its runtime address.
  3827. Notice how this code takes advantage of the symbols defined by the
  3828. linker script.
  3829. extern char _etext, _data, _edata, _bstart, _bend;
  3830. char *src = &_etext;
  3831. char *dst = &_data;
  3832. /* ROM has data at end of text; copy it. */
  3833. while (dst < &_edata)
  3834. *dst++ = *src++;
  3835. /* Zero bss. */
  3836. for (dst = &_bstart; dst< &_bend; dst++)
  3837. *dst = 0;
  3838. 
  3839. File: ld.info, Node: Forced Output Alignment, Next: Forced Input Alignment, Prev: Output Section LMA, Up: Output Section Attributes
  3840. 3.6.8.3 Forced Output Alignment
  3841. ...............................
  3842. You can increase an output section's alignment by using ALIGN. As an
  3843. alternative you can enforce that the difference between the VMA and LMA
  3844. remains intact throughout this output section with the ALIGN_WITH_INPUT
  3845. attribute.
  3846. 
  3847. File: ld.info, Node: Forced Input Alignment, Next: Output Section Constraint, Prev: Forced Output Alignment, Up: Output Section Attributes
  3848. 3.6.8.4 Forced Input Alignment
  3849. ..............................
  3850. You can force input section alignment within an output section by using
  3851. SUBALIGN. The value specified overrides any alignment given by input
  3852. sections, whether larger or smaller.
  3853. 
  3854. File: ld.info, Node: Output Section Constraint, Next: Output Section Region, Prev: Forced Input Alignment, Up: Output Section Attributes
  3855. 3.6.8.5 Output Section Constraint
  3856. .................................
  3857. You can specify that an output section should only be created if all of
  3858. its input sections are read-only or all of its input sections are
  3859. read-write by using the keyword 'ONLY_IF_RO' and 'ONLY_IF_RW'
  3860. respectively.
  3861. 
  3862. File: ld.info, Node: Output Section Region, Next: Output Section Phdr, Prev: Output Section Constraint, Up: Output Section Attributes
  3863. 3.6.8.6 Output Section Region
  3864. .............................
  3865. You can assign a section to a previously defined region of memory by
  3866. using '>REGION'. *Note MEMORY::.
  3867. Here is a simple example:
  3868. MEMORY { rom : ORIGIN = 0x1000, LENGTH = 0x1000 }
  3869. SECTIONS { ROM : { *(.text) } >rom }
  3870. 
  3871. File: ld.info, Node: Output Section Phdr, Next: Output Section Fill, Prev: Output Section Region, Up: Output Section Attributes
  3872. 3.6.8.7 Output Section Phdr
  3873. ...........................
  3874. You can assign a section to a previously defined program segment by
  3875. using ':PHDR'. *Note PHDRS::. If a section is assigned to one or more
  3876. segments, then all subsequent allocated sections will be assigned to
  3877. those segments as well, unless they use an explicitly ':PHDR' modifier.
  3878. You can use ':NONE' to tell the linker to not put the section in any
  3879. segment at all.
  3880. Here is a simple example:
  3881. PHDRS { text PT_LOAD ; }
  3882. SECTIONS { .text : { *(.text) } :text }
  3883. 
  3884. File: ld.info, Node: Output Section Fill, Prev: Output Section Phdr, Up: Output Section Attributes
  3885. 3.6.8.8 Output Section Fill
  3886. ...........................
  3887. You can set the fill pattern for an entire section by using '=FILLEXP'.
  3888. FILLEXP is an expression (*note Expressions::). Any otherwise
  3889. unspecified regions of memory within the output section (for example,
  3890. gaps left due to the required alignment of input sections) will be
  3891. filled with the value, repeated as necessary. If the fill expression is
  3892. a simple hex number, ie. a string of hex digit starting with '0x' and
  3893. without a trailing 'k' or 'M', then an arbitrarily long sequence of hex
  3894. digits can be used to specify the fill pattern; Leading zeros become
  3895. part of the pattern too. For all other cases, including extra
  3896. parentheses or a unary '+', the fill pattern is the four least
  3897. significant bytes of the value of the expression. In all cases, the
  3898. number is big-endian.
  3899. You can also change the fill value with a 'FILL' command in the
  3900. output section commands; (*note Output Section Data::).
  3901. Here is a simple example:
  3902. SECTIONS { .text : { *(.text) } =0x90909090 }
  3903. 
  3904. File: ld.info, Node: Overlay Description, Prev: Output Section Attributes, Up: SECTIONS
  3905. 3.6.9 Overlay Description
  3906. -------------------------
  3907. An overlay description provides an easy way to describe sections which
  3908. are to be loaded as part of a single memory image but are to be run at
  3909. the same memory address. At run time, some sort of overlay manager will
  3910. copy the overlaid sections in and out of the runtime memory address as
  3911. required, perhaps by simply manipulating addressing bits. This approach
  3912. can be useful, for example, when a certain region of memory is faster
  3913. than another.
  3914. Overlays are described using the 'OVERLAY' command. The 'OVERLAY'
  3915. command is used within a 'SECTIONS' command, like an output section
  3916. description. The full syntax of the 'OVERLAY' command is as follows:
  3917. OVERLAY [START] : [NOCROSSREFS] [AT ( LDADDR )]
  3918. {
  3919. SECNAME1
  3920. {
  3921. OUTPUT-SECTION-COMMAND
  3922. OUTPUT-SECTION-COMMAND
  3923. ...
  3924. } [:PHDR...] [=FILL]
  3925. SECNAME2
  3926. {
  3927. OUTPUT-SECTION-COMMAND
  3928. OUTPUT-SECTION-COMMAND
  3929. ...
  3930. } [:PHDR...] [=FILL]
  3931. ...
  3932. } [>REGION] [:PHDR...] [=FILL] [,]
  3933. Everything is optional except 'OVERLAY' (a keyword), and each section
  3934. must have a name (SECNAME1 and SECNAME2 above). The section definitions
  3935. within the 'OVERLAY' construct are identical to those within the general
  3936. 'SECTIONS' construct (*note SECTIONS::), except that no addresses and no
  3937. memory regions may be defined for sections within an 'OVERLAY'.
  3938. The comma at the end may be required if a FILL is used and the next
  3939. SECTIONS-COMMAND looks like a continuation of the expression.
  3940. The sections are all defined with the same starting address. The
  3941. load addresses of the sections are arranged such that they are
  3942. consecutive in memory starting at the load address used for the
  3943. 'OVERLAY' as a whole (as with normal section definitions, the load
  3944. address is optional, and defaults to the start address; the start
  3945. address is also optional, and defaults to the current value of the
  3946. location counter).
  3947. If the 'NOCROSSREFS' keyword is used, and there are any references
  3948. among the sections, the linker will report an error. Since the sections
  3949. all run at the same address, it normally does not make sense for one
  3950. section to refer directly to another. *Note NOCROSSREFS: Miscellaneous
  3951. Commands.
  3952. For each section within the 'OVERLAY', the linker automatically
  3953. provides two symbols. The symbol '__load_start_SECNAME' is defined as
  3954. the starting load address of the section. The symbol
  3955. '__load_stop_SECNAME' is defined as the final load address of the
  3956. section. Any characters within SECNAME which are not legal within C
  3957. identifiers are removed. C (or assembler) code may use these symbols to
  3958. move the overlaid sections around as necessary.
  3959. At the end of the overlay, the value of the location counter is set
  3960. to the start address of the overlay plus the size of the largest
  3961. section.
  3962. Here is an example. Remember that this would appear inside a
  3963. 'SECTIONS' construct.
  3964. OVERLAY 0x1000 : AT (0x4000)
  3965. {
  3966. .text0 { o1/*.o(.text) }
  3967. .text1 { o2/*.o(.text) }
  3968. }
  3969. This will define both '.text0' and '.text1' to start at address 0x1000.
  3970. '.text0' will be loaded at address 0x4000, and '.text1' will be loaded
  3971. immediately after '.text0'. The following symbols will be defined if
  3972. referenced: '__load_start_text0', '__load_stop_text0',
  3973. '__load_start_text1', '__load_stop_text1'.
  3974. C code to copy overlay '.text1' into the overlay area might look like
  3975. the following.
  3976. extern char __load_start_text1, __load_stop_text1;
  3977. memcpy ((char *) 0x1000, &__load_start_text1,
  3978. &__load_stop_text1 - &__load_start_text1);
  3979. Note that the 'OVERLAY' command is just syntactic sugar, since
  3980. everything it does can be done using the more basic commands. The above
  3981. example could have been written identically as follows.
  3982. .text0 0x1000 : AT (0x4000) { o1/*.o(.text) }
  3983. PROVIDE (__load_start_text0 = LOADADDR (.text0));
  3984. PROVIDE (__load_stop_text0 = LOADADDR (.text0) + SIZEOF (.text0));
  3985. .text1 0x1000 : AT (0x4000 + SIZEOF (.text0)) { o2/*.o(.text) }
  3986. PROVIDE (__load_start_text1 = LOADADDR (.text1));
  3987. PROVIDE (__load_stop_text1 = LOADADDR (.text1) + SIZEOF (.text1));
  3988. . = 0x1000 + MAX (SIZEOF (.text0), SIZEOF (.text1));
  3989. 
  3990. File: ld.info, Node: MEMORY, Next: PHDRS, Prev: SECTIONS, Up: Scripts
  3991. 3.7 MEMORY Command
  3992. ==================
  3993. The linker's default configuration permits allocation of all available
  3994. memory. You can override this by using the 'MEMORY' command.
  3995. The 'MEMORY' command describes the location and size of blocks of
  3996. memory in the target. You can use it to describe which memory regions
  3997. may be used by the linker, and which memory regions it must avoid. You
  3998. can then assign sections to particular memory regions. The linker will
  3999. set section addresses based on the memory regions, and will warn about
  4000. regions that become too full. The linker will not shuffle sections
  4001. around to fit into the available regions.
  4002. A linker script may contain many uses of the 'MEMORY' command,
  4003. however, all memory blocks defined are treated as if they were specified
  4004. inside a single 'MEMORY' command. The syntax for 'MEMORY' is:
  4005. MEMORY
  4006. {
  4007. NAME [(ATTR)] : ORIGIN = ORIGIN, LENGTH = LEN
  4008. ...
  4009. }
  4010. The NAME is a name used in the linker script to refer to the region.
  4011. The region name has no meaning outside of the linker script. Region
  4012. names are stored in a separate name space, and will not conflict with
  4013. symbol names, file names, or section names. Each memory region must
  4014. have a distinct name within the 'MEMORY' command. However you can add
  4015. later alias names to existing memory regions with the *note
  4016. REGION_ALIAS:: command.
  4017. The ATTR string is an optional list of attributes that specify
  4018. whether to use a particular memory region for an input section which is
  4019. not explicitly mapped in the linker script. As described in *note
  4020. SECTIONS::, if you do not specify an output section for some input
  4021. section, the linker will create an output section with the same name as
  4022. the input section. If you define region attributes, the linker will use
  4023. them to select the memory region for the output section that it creates.
  4024. The ATTR string must consist only of the following characters:
  4025. 'R'
  4026. Read-only section
  4027. 'W'
  4028. Read/write section
  4029. 'X'
  4030. Executable section
  4031. 'A'
  4032. Allocatable section
  4033. 'I'
  4034. Initialized section
  4035. 'L'
  4036. Same as 'I'
  4037. '!'
  4038. Invert the sense of any of the attributes that follow
  4039. If an unmapped section matches any of the listed attributes other
  4040. than '!', it will be placed in the memory region. The '!' attribute
  4041. reverses the test for the characters that follow, so that an unmapped
  4042. section will be placed in the memory region only if it does not match
  4043. any of the attributes listed afterwards. Thus an attribute string of
  4044. 'RW!X' will match any unmapped section that has either or both of the
  4045. 'R' and 'W' attributes, but only as long as the section does not also
  4046. have the 'X' attribute.
  4047. The ORIGIN is an numerical expression for the start address of the
  4048. memory region. The expression must evaluate to a constant and it cannot
  4049. involve any symbols. The keyword 'ORIGIN' may be abbreviated to 'org'
  4050. or 'o' (but not, for example, 'ORG').
  4051. The LEN is an expression for the size in bytes of the memory region.
  4052. As with the ORIGIN expression, the expression must be numerical only and
  4053. must evaluate to a constant. The keyword 'LENGTH' may be abbreviated to
  4054. 'len' or 'l'.
  4055. In the following example, we specify that there are two memory
  4056. regions available for allocation: one starting at '0' for 256 kilobytes,
  4057. and the other starting at '0x40000000' for four megabytes. The linker
  4058. will place into the 'rom' memory region every section which is not
  4059. explicitly mapped into a memory region, and is either read-only or
  4060. executable. The linker will place other sections which are not
  4061. explicitly mapped into a memory region into the 'ram' memory region.
  4062. MEMORY
  4063. {
  4064. rom (rx) : ORIGIN = 0, LENGTH = 256K
  4065. ram (!rx) : org = 0x40000000, l = 4M
  4066. }
  4067. Once you define a memory region, you can direct the linker to place
  4068. specific output sections into that memory region by using the '>REGION'
  4069. output section attribute. For example, if you have a memory region
  4070. named 'mem', you would use '>mem' in the output section definition.
  4071. *Note Output Section Region::. If no address was specified for the
  4072. output section, the linker will set the address to the next available
  4073. address within the memory region. If the combined output sections
  4074. directed to a memory region are too large for the region, the linker
  4075. will issue an error message.
  4076. It is possible to access the origin and length of a memory in an
  4077. expression via the 'ORIGIN(MEMORY)' and 'LENGTH(MEMORY)' functions:
  4078. _fstack = ORIGIN(ram) + LENGTH(ram) - 4;
  4079. 
  4080. File: ld.info, Node: PHDRS, Next: VERSION, Prev: MEMORY, Up: Scripts
  4081. 3.8 PHDRS Command
  4082. =================
  4083. The ELF object file format uses "program headers", also knows as
  4084. "segments". The program headers describe how the program should be
  4085. loaded into memory. You can print them out by using the 'objdump'
  4086. program with the '-p' option.
  4087. When you run an ELF program on a native ELF system, the system loader
  4088. reads the program headers in order to figure out how to load the
  4089. program. This will only work if the program headers are set correctly.
  4090. This manual does not describe the details of how the system loader
  4091. interprets program headers; for more information, see the ELF ABI.
  4092. The linker will create reasonable program headers by default.
  4093. However, in some cases, you may need to specify the program headers more
  4094. precisely. You may use the 'PHDRS' command for this purpose. When the
  4095. linker sees the 'PHDRS' command in the linker script, it will not create
  4096. any program headers other than the ones specified.
  4097. The linker only pays attention to the 'PHDRS' command when generating
  4098. an ELF output file. In other cases, the linker will simply ignore
  4099. 'PHDRS'.
  4100. This is the syntax of the 'PHDRS' command. The words 'PHDRS',
  4101. 'FILEHDR', 'AT', and 'FLAGS' are keywords.
  4102. PHDRS
  4103. {
  4104. NAME TYPE [ FILEHDR ] [ PHDRS ] [ AT ( ADDRESS ) ]
  4105. [ FLAGS ( FLAGS ) ] ;
  4106. }
  4107. The NAME is used only for reference in the 'SECTIONS' command of the
  4108. linker script. It is not put into the output file. Program header
  4109. names are stored in a separate name space, and will not conflict with
  4110. symbol names, file names, or section names. Each program header must
  4111. have a distinct name. The headers are processed in order and it is
  4112. usual for them to map to sections in ascending load address order.
  4113. Certain program header types describe segments of memory which the
  4114. system loader will load from the file. In the linker script, you
  4115. specify the contents of these segments by placing allocatable output
  4116. sections in the segments. You use the ':PHDR' output section attribute
  4117. to place a section in a particular segment. *Note Output Section
  4118. Phdr::.
  4119. It is normal to put certain sections in more than one segment. This
  4120. merely implies that one segment of memory contains another. You may
  4121. repeat ':PHDR', using it once for each segment which should contain the
  4122. section.
  4123. If you place a section in one or more segments using ':PHDR', then
  4124. the linker will place all subsequent allocatable sections which do not
  4125. specify ':PHDR' in the same segments. This is for convenience, since
  4126. generally a whole set of contiguous sections will be placed in a single
  4127. segment. You can use ':NONE' to override the default segment and tell
  4128. the linker to not put the section in any segment at all.
  4129. You may use the 'FILEHDR' and 'PHDRS' keywords after the program
  4130. header type to further describe the contents of the segment. The
  4131. 'FILEHDR' keyword means that the segment should include the ELF file
  4132. header. The 'PHDRS' keyword means that the segment should include the
  4133. ELF program headers themselves. If applied to a loadable segment
  4134. ('PT_LOAD'), all prior loadable segments must have one of these
  4135. keywords.
  4136. The TYPE may be one of the following. The numbers indicate the value
  4137. of the keyword.
  4138. 'PT_NULL' (0)
  4139. Indicates an unused program header.
  4140. 'PT_LOAD' (1)
  4141. Indicates that this program header describes a segment to be loaded
  4142. from the file.
  4143. 'PT_DYNAMIC' (2)
  4144. Indicates a segment where dynamic linking information can be found.
  4145. 'PT_INTERP' (3)
  4146. Indicates a segment where the name of the program interpreter may
  4147. be found.
  4148. 'PT_NOTE' (4)
  4149. Indicates a segment holding note information.
  4150. 'PT_SHLIB' (5)
  4151. A reserved program header type, defined but not specified by the
  4152. ELF ABI.
  4153. 'PT_PHDR' (6)
  4154. Indicates a segment where the program headers may be found.
  4155. 'PT_TLS' (7)
  4156. Indicates a segment containing thread local storage.
  4157. EXPRESSION
  4158. An expression giving the numeric type of the program header. This
  4159. may be used for types not defined above.
  4160. You can specify that a segment should be loaded at a particular
  4161. address in memory by using an 'AT' expression. This is identical to the
  4162. 'AT' command used as an output section attribute (*note Output Section
  4163. LMA::). The 'AT' command for a program header overrides the output
  4164. section attribute.
  4165. The linker will normally set the segment flags based on the sections
  4166. which comprise the segment. You may use the 'FLAGS' keyword to
  4167. explicitly specify the segment flags. The value of FLAGS must be an
  4168. integer. It is used to set the 'p_flags' field of the program header.
  4169. Here is an example of 'PHDRS'. This shows a typical set of program
  4170. headers used on a native ELF system.
  4171. PHDRS
  4172. {
  4173. headers PT_PHDR PHDRS ;
  4174. interp PT_INTERP ;
  4175. text PT_LOAD FILEHDR PHDRS ;
  4176. data PT_LOAD ;
  4177. dynamic PT_DYNAMIC ;
  4178. }
  4179. SECTIONS
  4180. {
  4181. . = SIZEOF_HEADERS;
  4182. .interp : { *(.interp) } :text :interp
  4183. .text : { *(.text) } :text
  4184. .rodata : { *(.rodata) } /* defaults to :text */
  4185. ...
  4186. . = . + 0x1000; /* move to a new page in memory */
  4187. .data : { *(.data) } :data
  4188. .dynamic : { *(.dynamic) } :data :dynamic
  4189. ...
  4190. }
  4191. 
  4192. File: ld.info, Node: VERSION, Next: Expressions, Prev: PHDRS, Up: Scripts
  4193. 3.9 VERSION Command
  4194. ===================
  4195. The linker supports symbol versions when using ELF. Symbol versions are
  4196. only useful when using shared libraries. The dynamic linker can use
  4197. symbol versions to select a specific version of a function when it runs
  4198. a program that may have been linked against an earlier version of the
  4199. shared library.
  4200. You can include a version script directly in the main linker script,
  4201. or you can supply the version script as an implicit linker script. You
  4202. can also use the '--version-script' linker option.
  4203. The syntax of the 'VERSION' command is simply
  4204. VERSION { version-script-commands }
  4205. The format of the version script commands is identical to that used
  4206. by Sun's linker in Solaris 2.5. The version script defines a tree of
  4207. version nodes. You specify the node names and interdependencies in the
  4208. version script. You can specify which symbols are bound to which
  4209. version nodes, and you can reduce a specified set of symbols to local
  4210. scope so that they are not globally visible outside of the shared
  4211. library.
  4212. The easiest way to demonstrate the version script language is with a
  4213. few examples.
  4214. VERS_1.1 {
  4215. global:
  4216. foo1;
  4217. local:
  4218. old*;
  4219. original*;
  4220. new*;
  4221. };
  4222. VERS_1.2 {
  4223. foo2;
  4224. } VERS_1.1;
  4225. VERS_2.0 {
  4226. bar1; bar2;
  4227. extern "C++" {
  4228. ns::*;
  4229. "f(int, double)";
  4230. };
  4231. } VERS_1.2;
  4232. This example version script defines three version nodes. The first
  4233. version node defined is 'VERS_1.1'; it has no other dependencies. The
  4234. script binds the symbol 'foo1' to 'VERS_1.1'. It reduces a number of
  4235. symbols to local scope so that they are not visible outside of the
  4236. shared library; this is done using wildcard patterns, so that any symbol
  4237. whose name begins with 'old', 'original', or 'new' is matched. The
  4238. wildcard patterns available are the same as those used in the shell when
  4239. matching filenames (also known as "globbing"). However, if you specify
  4240. the symbol name inside double quotes, then the name is treated as
  4241. literal, rather than as a glob pattern.
  4242. Next, the version script defines node 'VERS_1.2'. This node depends
  4243. upon 'VERS_1.1'. The script binds the symbol 'foo2' to the version node
  4244. 'VERS_1.2'.
  4245. Finally, the version script defines node 'VERS_2.0'. This node
  4246. depends upon 'VERS_1.2'. The scripts binds the symbols 'bar1' and
  4247. 'bar2' are bound to the version node 'VERS_2.0'.
  4248. When the linker finds a symbol defined in a library which is not
  4249. specifically bound to a version node, it will effectively bind it to an
  4250. unspecified base version of the library. You can bind all otherwise
  4251. unspecified symbols to a given version node by using 'global: *;'
  4252. somewhere in the version script. Note that it's slightly crazy to use
  4253. wildcards in a global spec except on the last version node. Global
  4254. wildcards elsewhere run the risk of accidentally adding symbols to the
  4255. set exported for an old version. That's wrong since older versions
  4256. ought to have a fixed set of symbols.
  4257. The names of the version nodes have no specific meaning other than
  4258. what they might suggest to the person reading them. The '2.0' version
  4259. could just as well have appeared in between '1.1' and '1.2'. However,
  4260. this would be a confusing way to write a version script.
  4261. Node name can be omitted, provided it is the only version node in the
  4262. version script. Such version script doesn't assign any versions to
  4263. symbols, only selects which symbols will be globally visible out and
  4264. which won't.
  4265. { global: foo; bar; local: *; };
  4266. When you link an application against a shared library that has
  4267. versioned symbols, the application itself knows which version of each
  4268. symbol it requires, and it also knows which version nodes it needs from
  4269. each shared library it is linked against. Thus at runtime, the dynamic
  4270. loader can make a quick check to make sure that the libraries you have
  4271. linked against do in fact supply all of the version nodes that the
  4272. application will need to resolve all of the dynamic symbols. In this
  4273. way it is possible for the dynamic linker to know with certainty that
  4274. all external symbols that it needs will be resolvable without having to
  4275. search for each symbol reference.
  4276. The symbol versioning is in effect a much more sophisticated way of
  4277. doing minor version checking that SunOS does. The fundamental problem
  4278. that is being addressed here is that typically references to external
  4279. functions are bound on an as-needed basis, and are not all bound when
  4280. the application starts up. If a shared library is out of date, a
  4281. required interface may be missing; when the application tries to use
  4282. that interface, it may suddenly and unexpectedly fail. With symbol
  4283. versioning, the user will get a warning when they start their program if
  4284. the libraries being used with the application are too old.
  4285. There are several GNU extensions to Sun's versioning approach. The
  4286. first of these is the ability to bind a symbol to a version node in the
  4287. source file where the symbol is defined instead of in the versioning
  4288. script. This was done mainly to reduce the burden on the library
  4289. maintainer. You can do this by putting something like:
  4290. __asm__(".symver original_foo,foo@VERS_1.1");
  4291. in the C source file. This renames the function 'original_foo' to be an
  4292. alias for 'foo' bound to the version node 'VERS_1.1'. The 'local:'
  4293. directive can be used to prevent the symbol 'original_foo' from being
  4294. exported. A '.symver' directive takes precedence over a version script.
  4295. The second GNU extension is to allow multiple versions of the same
  4296. function to appear in a given shared library. In this way you can make
  4297. an incompatible change to an interface without increasing the major
  4298. version number of the shared library, while still allowing applications
  4299. linked against the old interface to continue to function.
  4300. To do this, you must use multiple '.symver' directives in the source
  4301. file. Here is an example:
  4302. __asm__(".symver original_foo,foo@");
  4303. __asm__(".symver old_foo,foo@VERS_1.1");
  4304. __asm__(".symver old_foo1,foo@VERS_1.2");
  4305. __asm__(".symver new_foo,foo@@VERS_2.0");
  4306. In this example, 'foo@' represents the symbol 'foo' bound to the
  4307. unspecified base version of the symbol. The source file that contains
  4308. this example would define 4 C functions: 'original_foo', 'old_foo',
  4309. 'old_foo1', and 'new_foo'.
  4310. When you have multiple definitions of a given symbol, there needs to
  4311. be some way to specify a default version to which external references to
  4312. this symbol will be bound. You can do this with the 'foo@@VERS_2.0'
  4313. type of '.symver' directive. You can only declare one version of a
  4314. symbol as the default in this manner; otherwise you would effectively
  4315. have multiple definitions of the same symbol.
  4316. If you wish to bind a reference to a specific version of the symbol
  4317. within the shared library, you can use the aliases of convenience (i.e.,
  4318. 'old_foo'), or you can use the '.symver' directive to specifically bind
  4319. to an external version of the function in question.
  4320. You can also specify the language in the version script:
  4321. VERSION extern "lang" { version-script-commands }
  4322. The supported 'lang's are 'C', 'C++', and 'Java'. The linker will
  4323. iterate over the list of symbols at the link time and demangle them
  4324. according to 'lang' before matching them to the patterns specified in
  4325. 'version-script-commands'. The default 'lang' is 'C'.
  4326. Demangled names may contains spaces and other special characters. As
  4327. described above, you can use a glob pattern to match demangled names, or
  4328. you can use a double-quoted string to match the string exactly. In the
  4329. latter case, be aware that minor differences (such as differing
  4330. whitespace) between the version script and the demangler output will
  4331. cause a mismatch. As the exact string generated by the demangler might
  4332. change in the future, even if the mangled name does not, you should
  4333. check that all of your version directives are behaving as you expect
  4334. when you upgrade.
  4335. 
  4336. File: ld.info, Node: Expressions, Next: Implicit Linker Scripts, Prev: VERSION, Up: Scripts
  4337. 3.10 Expressions in Linker Scripts
  4338. ==================================
  4339. The syntax for expressions in the linker script language is identical to
  4340. that of C expressions, except that whitespace is required in some places
  4341. to resolve syntactic ambiguities. All expressions are evaluated as
  4342. integers. All expressions are evaluated in the same size, which is 32
  4343. bits if both the host and target are 32 bits, and is otherwise 64 bits.
  4344. You can use and set symbol values in expressions.
  4345. The linker defines several special purpose builtin functions for use
  4346. in expressions.
  4347. * Menu:
  4348. * Constants:: Constants
  4349. * Symbolic Constants:: Symbolic constants
  4350. * Symbols:: Symbol Names
  4351. * Orphan Sections:: Orphan Sections
  4352. * Location Counter:: The Location Counter
  4353. * Operators:: Operators
  4354. * Evaluation:: Evaluation
  4355. * Expression Section:: The Section of an Expression
  4356. * Builtin Functions:: Builtin Functions
  4357. 
  4358. File: ld.info, Node: Constants, Next: Symbolic Constants, Up: Expressions
  4359. 3.10.1 Constants
  4360. ----------------
  4361. All constants are integers.
  4362. As in C, the linker considers an integer beginning with '0' to be
  4363. octal, and an integer beginning with '0x' or '0X' to be hexadecimal.
  4364. Alternatively the linker accepts suffixes of 'h' or 'H' for hexadecimal,
  4365. 'o' or 'O' for octal, 'b' or 'B' for binary and 'd' or 'D' for decimal.
  4366. Any integer value without a prefix or a suffix is considered to be
  4367. decimal.
  4368. In addition, you can use the suffixes 'K' and 'M' to scale a constant
  4369. by '1024' or '1024*1024' respectively. For example, the following all
  4370. refer to the same quantity:
  4371. _fourk_1 = 4K;
  4372. _fourk_2 = 4096;
  4373. _fourk_3 = 0x1000;
  4374. _fourk_4 = 10000o;
  4375. Note - the 'K' and 'M' suffixes cannot be used in conjunction with
  4376. the base suffixes mentioned above.
  4377. 
  4378. File: ld.info, Node: Symbolic Constants, Next: Symbols, Prev: Constants, Up: Expressions
  4379. 3.10.2 Symbolic Constants
  4380. -------------------------
  4381. It is possible to refer to target-specific constants via the use of the
  4382. 'CONSTANT(NAME)' operator, where NAME is one of:
  4383. 'MAXPAGESIZE'
  4384. The target's maximum page size.
  4385. 'COMMONPAGESIZE'
  4386. The target's default page size.
  4387. So for example:
  4388. .text ALIGN (CONSTANT (MAXPAGESIZE)) : { *(.text) }
  4389. will create a text section aligned to the largest page boundary
  4390. supported by the target.
  4391. 
  4392. File: ld.info, Node: Symbols, Next: Orphan Sections, Prev: Symbolic Constants, Up: Expressions
  4393. 3.10.3 Symbol Names
  4394. -------------------
  4395. Unless quoted, symbol names start with a letter, underscore, or period
  4396. and may include letters, digits, underscores, periods, and hyphens.
  4397. Unquoted symbol names must not conflict with any keywords. You can
  4398. specify a symbol which contains odd characters or has the same name as a
  4399. keyword by surrounding the symbol name in double quotes:
  4400. "SECTION" = 9;
  4401. "with a space" = "also with a space" + 10;
  4402. Since symbols can contain many non-alphabetic characters, it is
  4403. safest to delimit symbols with spaces. For example, 'A-B' is one
  4404. symbol, whereas 'A - B' is an expression involving subtraction.
  4405. 
  4406. File: ld.info, Node: Orphan Sections, Next: Location Counter, Prev: Symbols, Up: Expressions
  4407. 3.10.4 Orphan Sections
  4408. ----------------------
  4409. Orphan sections are sections present in the input files which are not
  4410. explicitly placed into the output file by the linker script. The linker
  4411. will still copy these sections into the output file by either finding,
  4412. or creating a suitable output section in which to place the orphaned
  4413. input section.
  4414. If the name of an orphaned input section exactly matches the name of
  4415. an existing output section, then the orphaned input section will be
  4416. placed at the end of that output section.
  4417. If there is no output section with a matching name then new output
  4418. sections will be created. Each new output section will have the same
  4419. name as the orphan section placed within it. If there are multiple
  4420. orphan sections with the same name, these will all be combined into one
  4421. new output section.
  4422. If new output sections are created to hold orphaned input sections,
  4423. then the linker must decide where to place these new output sections in
  4424. relation to existing output sections. On most modern targets, the
  4425. linker attempts to place orphan sections after sections of the same
  4426. attribute, such as code vs data, loadable vs non-loadable, etc. If no
  4427. sections with matching attributes are found, or your target lacks this
  4428. support, the orphan section is placed at the end of the file.
  4429. The command-line options '--orphan-handling' and '--unique' (*note
  4430. Command-line Options: Options.) can be used to control which output
  4431. sections an orphan is placed in.
  4432. 
  4433. File: ld.info, Node: Location Counter, Next: Operators, Prev: Orphan Sections, Up: Expressions
  4434. 3.10.5 The Location Counter
  4435. ---------------------------
  4436. The special linker variable "dot" '.' always contains the current output
  4437. location counter. Since the '.' always refers to a location in an
  4438. output section, it may only appear in an expression within a 'SECTIONS'
  4439. command. The '.' symbol may appear anywhere that an ordinary symbol is
  4440. allowed in an expression.
  4441. Assigning a value to '.' will cause the location counter to be moved.
  4442. This may be used to create holes in the output section. The location
  4443. counter may not be moved backwards inside an output section, and may not
  4444. be moved backwards outside of an output section if so doing creates
  4445. areas with overlapping LMAs.
  4446. SECTIONS
  4447. {
  4448. output :
  4449. {
  4450. file1(.text)
  4451. . = . + 1000;
  4452. file2(.text)
  4453. . += 1000;
  4454. file3(.text)
  4455. } = 0x12345678;
  4456. }
  4457. In the previous example, the '.text' section from 'file1' is located at
  4458. the beginning of the output section 'output'. It is followed by a 1000
  4459. byte gap. Then the '.text' section from 'file2' appears, also with a
  4460. 1000 byte gap following before the '.text' section from 'file3'. The
  4461. notation '= 0x12345678' specifies what data to write in the gaps (*note
  4462. Output Section Fill::).
  4463. Note: '.' actually refers to the byte offset from the start of the
  4464. current containing object. Normally this is the 'SECTIONS' statement,
  4465. whose start address is 0, hence '.' can be used as an absolute address.
  4466. If '.' is used inside a section description however, it refers to the
  4467. byte offset from the start of that section, not an absolute address.
  4468. Thus in a script like this:
  4469. SECTIONS
  4470. {
  4471. . = 0x100
  4472. .text: {
  4473. *(.text)
  4474. . = 0x200
  4475. }
  4476. . = 0x500
  4477. .data: {
  4478. *(.data)
  4479. . += 0x600
  4480. }
  4481. }
  4482. The '.text' section will be assigned a starting address of 0x100 and
  4483. a size of exactly 0x200 bytes, even if there is not enough data in the
  4484. '.text' input sections to fill this area. (If there is too much data,
  4485. an error will be produced because this would be an attempt to move '.'
  4486. backwards). The '.data' section will start at 0x500 and it will have an
  4487. extra 0x600 bytes worth of space after the end of the values from the
  4488. '.data' input sections and before the end of the '.data' output section
  4489. itself.
  4490. Setting symbols to the value of the location counter outside of an
  4491. output section statement can result in unexpected values if the linker
  4492. needs to place orphan sections. For example, given the following:
  4493. SECTIONS
  4494. {
  4495. start_of_text = . ;
  4496. .text: { *(.text) }
  4497. end_of_text = . ;
  4498. start_of_data = . ;
  4499. .data: { *(.data) }
  4500. end_of_data = . ;
  4501. }
  4502. If the linker needs to place some input section, e.g. '.rodata', not
  4503. mentioned in the script, it might choose to place that section between
  4504. '.text' and '.data'. You might think the linker should place '.rodata'
  4505. on the blank line in the above script, but blank lines are of no
  4506. particular significance to the linker. As well, the linker doesn't
  4507. associate the above symbol names with their sections. Instead, it
  4508. assumes that all assignments or other statements belong to the previous
  4509. output section, except for the special case of an assignment to '.'.
  4510. I.e., the linker will place the orphan '.rodata' section as if the
  4511. script was written as follows:
  4512. SECTIONS
  4513. {
  4514. start_of_text = . ;
  4515. .text: { *(.text) }
  4516. end_of_text = . ;
  4517. start_of_data = . ;
  4518. .rodata: { *(.rodata) }
  4519. .data: { *(.data) }
  4520. end_of_data = . ;
  4521. }
  4522. This may or may not be the script author's intention for the value of
  4523. 'start_of_data'. One way to influence the orphan section placement is
  4524. to assign the location counter to itself, as the linker assumes that an
  4525. assignment to '.' is setting the start address of a following output
  4526. section and thus should be grouped with that section. So you could
  4527. write:
  4528. SECTIONS
  4529. {
  4530. start_of_text = . ;
  4531. .text: { *(.text) }
  4532. end_of_text = . ;
  4533. . = . ;
  4534. start_of_data = . ;
  4535. .data: { *(.data) }
  4536. end_of_data = . ;
  4537. }
  4538. Now, the orphan '.rodata' section will be placed between
  4539. 'end_of_text' and 'start_of_data'.
  4540. 
  4541. File: ld.info, Node: Operators, Next: Evaluation, Prev: Location Counter, Up: Expressions
  4542. 3.10.6 Operators
  4543. ----------------
  4544. The linker recognizes the standard C set of arithmetic operators, with
  4545. the standard bindings and precedence levels:
  4546. precedence associativity Operators Notes
  4547. (highest)
  4548. 1 left ! - ~ (1)
  4549. 2 left * / %
  4550. 3 left + -
  4551. 4 left >> <<
  4552. 5 left == != > < <= >=
  4553. 6 left &
  4554. 7 left |
  4555. 8 left &&
  4556. 9 left ||
  4557. 10 right ? :
  4558. 11 right &= += -= *= /= (2)
  4559. (lowest)
  4560. Notes: (1) Prefix operators (2) *Note Assignments::.
  4561. 
  4562. File: ld.info, Node: Evaluation, Next: Expression Section, Prev: Operators, Up: Expressions
  4563. 3.10.7 Evaluation
  4564. -----------------
  4565. The linker evaluates expressions lazily. It only computes the value of
  4566. an expression when absolutely necessary.
  4567. The linker needs some information, such as the value of the start
  4568. address of the first section, and the origins and lengths of memory
  4569. regions, in order to do any linking at all. These values are computed
  4570. as soon as possible when the linker reads in the linker script.
  4571. However, other values (such as symbol values) are not known or needed
  4572. until after storage allocation. Such values are evaluated later, when
  4573. other information (such as the sizes of output sections) is available
  4574. for use in the symbol assignment expression.
  4575. The sizes of sections cannot be known until after allocation, so
  4576. assignments dependent upon these are not performed until after
  4577. allocation.
  4578. Some expressions, such as those depending upon the location counter
  4579. '.', must be evaluated during section allocation.
  4580. If the result of an expression is required, but the value is not
  4581. available, then an error results. For example, a script like the
  4582. following
  4583. SECTIONS
  4584. {
  4585. .text 9+this_isnt_constant :
  4586. { *(.text) }
  4587. }
  4588. will cause the error message 'non constant expression for initial
  4589. address'.
  4590. 
  4591. File: ld.info, Node: Expression Section, Next: Builtin Functions, Prev: Evaluation, Up: Expressions
  4592. 3.10.8 The Section of an Expression
  4593. -----------------------------------
  4594. Addresses and symbols may be section relative, or absolute. A section
  4595. relative symbol is relocatable. If you request relocatable output using
  4596. the '-r' option, a further link operation may change the value of a
  4597. section relative symbol. On the other hand, an absolute symbol will
  4598. retain the same value throughout any further link operations.
  4599. Some terms in linker expressions are addresses. This is true of
  4600. section relative symbols and for builtin functions that return an
  4601. address, such as 'ADDR', 'LOADADDR', 'ORIGIN' and 'SEGMENT_START'.
  4602. Other terms are simply numbers, or are builtin functions that return a
  4603. non-address value, such as 'LENGTH'. One complication is that unless
  4604. you set 'LD_FEATURE ("SANE_EXPR")' (*note Miscellaneous Commands::),
  4605. numbers and absolute symbols are treated differently depending on their
  4606. location, for compatibility with older versions of 'ld'. Expressions
  4607. appearing outside an output section definition treat all numbers as
  4608. absolute addresses. Expressions appearing inside an output section
  4609. definition treat absolute symbols as numbers. If 'LD_FEATURE
  4610. ("SANE_EXPR")' is given, then absolute symbols and numbers are simply
  4611. treated as numbers everywhere.
  4612. In the following simple example,
  4613. SECTIONS
  4614. {
  4615. . = 0x100;
  4616. __executable_start = 0x100;
  4617. .data :
  4618. {
  4619. . = 0x10;
  4620. __data_start = 0x10;
  4621. *(.data)
  4622. }
  4623. ...
  4624. }
  4625. both '.' and '__executable_start' are set to the absolute address
  4626. 0x100 in the first two assignments, then both '.' and '__data_start' are
  4627. set to 0x10 relative to the '.data' section in the second two
  4628. assignments.
  4629. For expressions involving numbers, relative addresses and absolute
  4630. addresses, ld follows these rules to evaluate terms:
  4631. * Unary operations on an absolute address or number, and binary
  4632. operations on two absolute addresses or two numbers, or between one
  4633. absolute address and a number, apply the operator to the value(s).
  4634. * Unary operations on a relative address, and binary operations on
  4635. two relative addresses in the same section or between one relative
  4636. address and a number, apply the operator to the offset part of the
  4637. address(es).
  4638. * Other binary operations, that is, between two relative addresses
  4639. not in the same section, or between a relative address and an
  4640. absolute address, first convert any non-absolute term to an
  4641. absolute address before applying the operator.
  4642. The result section of each sub-expression is as follows:
  4643. * An operation involving only numbers results in a number.
  4644. * The result of comparisons, '&&' and '||' is also a number.
  4645. * The result of other binary arithmetic and logical operations on two
  4646. relative addresses in the same section or two absolute addresses
  4647. (after above conversions) is also a number when 'LD_FEATURE
  4648. ("SANE_EXPR")' or inside an output section definition but an
  4649. absolute address otherwise.
  4650. * The result of other operations on relative addresses or one
  4651. relative address and a number, is a relative address in the same
  4652. section as the relative operand(s).
  4653. * The result of other operations on absolute addresses (after above
  4654. conversions) is an absolute address.
  4655. You can use the builtin function 'ABSOLUTE' to force an expression to
  4656. be absolute when it would otherwise be relative. For example, to create
  4657. an absolute symbol set to the address of the end of the output section
  4658. '.data':
  4659. SECTIONS
  4660. {
  4661. .data : { *(.data) _edata = ABSOLUTE(.); }
  4662. }
  4663. If 'ABSOLUTE' were not used, '_edata' would be relative to the '.data'
  4664. section.
  4665. Using 'LOADADDR' also forces an expression absolute, since this
  4666. particular builtin function returns an absolute address.
  4667. 
  4668. File: ld.info, Node: Builtin Functions, Prev: Expression Section, Up: Expressions
  4669. 3.10.9 Builtin Functions
  4670. ------------------------
  4671. The linker script language includes a number of builtin functions for
  4672. use in linker script expressions.
  4673. 'ABSOLUTE(EXP)'
  4674. Return the absolute (non-relocatable, as opposed to non-negative)
  4675. value of the expression EXP. Primarily useful to assign an
  4676. absolute value to a symbol within a section definition, where
  4677. symbol values are normally section relative. *Note Expression
  4678. Section::.
  4679. 'ADDR(SECTION)'
  4680. Return the address (VMA) of the named SECTION. Your script must
  4681. previously have defined the location of that section. In the
  4682. following example, 'start_of_output_1', 'symbol_1' and 'symbol_2'
  4683. are assigned equivalent values, except that 'symbol_1' will be
  4684. relative to the '.output1' section while the other two will be
  4685. absolute:
  4686. SECTIONS { ...
  4687. .output1 :
  4688. {
  4689. start_of_output_1 = ABSOLUTE(.);
  4690. ...
  4691. }
  4692. .output :
  4693. {
  4694. symbol_1 = ADDR(.output1);
  4695. symbol_2 = start_of_output_1;
  4696. }
  4697. ... }
  4698. 'ALIGN(ALIGN)'
  4699. 'ALIGN(EXP,ALIGN)'
  4700. Return the location counter ('.') or arbitrary expression aligned
  4701. to the next ALIGN boundary. The single operand 'ALIGN' doesn't
  4702. change the value of the location counter--it just does arithmetic
  4703. on it. The two operand 'ALIGN' allows an arbitrary expression to
  4704. be aligned upwards ('ALIGN(ALIGN)' is equivalent to
  4705. 'ALIGN(ABSOLUTE(.), ALIGN)').
  4706. Here is an example which aligns the output '.data' section to the
  4707. next '0x2000' byte boundary after the preceding section and sets a
  4708. variable within the section to the next '0x8000' boundary after the
  4709. input sections:
  4710. SECTIONS { ...
  4711. .data ALIGN(0x2000): {
  4712. *(.data)
  4713. variable = ALIGN(0x8000);
  4714. }
  4715. ... }
  4716. The first use of 'ALIGN' in this example specifies the location of
  4717. a section because it is used as the optional ADDRESS attribute of a
  4718. section definition (*note Output Section Address::). The second
  4719. use of 'ALIGN' is used to defines the value of a symbol.
  4720. The builtin function 'NEXT' is closely related to 'ALIGN'.
  4721. 'ALIGNOF(SECTION)'
  4722. Return the alignment in bytes of the named SECTION, if that section
  4723. has been allocated. If the section has not been allocated when
  4724. this is evaluated, the linker will report an error. In the
  4725. following example, the alignment of the '.output' section is stored
  4726. as the first value in that section.
  4727. SECTIONS{ ...
  4728. .output {
  4729. LONG (ALIGNOF (.output))
  4730. ...
  4731. }
  4732. ... }
  4733. 'BLOCK(EXP)'
  4734. This is a synonym for 'ALIGN', for compatibility with older linker
  4735. scripts. It is most often seen when setting the address of an
  4736. output section.
  4737. 'DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE)'
  4738. This is equivalent to either
  4739. (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1)))
  4740. or
  4741. (ALIGN(MAXPAGESIZE)
  4742. + ((. + COMMONPAGESIZE - 1) & (MAXPAGESIZE - COMMONPAGESIZE)))
  4743. depending on whether the latter uses fewer COMMONPAGESIZE sized
  4744. pages for the data segment (area between the result of this
  4745. expression and 'DATA_SEGMENT_END') than the former or not. If the
  4746. latter form is used, it means COMMONPAGESIZE bytes of runtime
  4747. memory will be saved at the expense of up to COMMONPAGESIZE wasted
  4748. bytes in the on-disk file.
  4749. This expression can only be used directly in 'SECTIONS' commands,
  4750. not in any output section descriptions and only once in the linker
  4751. script. COMMONPAGESIZE should be less or equal to MAXPAGESIZE and
  4752. should be the system page size the object wants to be optimized for
  4753. while still running on system page sizes up to MAXPAGESIZE. Note
  4754. however that '-z relro' protection will not be effective if the
  4755. system page size is larger than COMMONPAGESIZE.
  4756. Example:
  4757. . = DATA_SEGMENT_ALIGN(0x10000, 0x2000);
  4758. 'DATA_SEGMENT_END(EXP)'
  4759. This defines the end of data segment for 'DATA_SEGMENT_ALIGN'
  4760. evaluation purposes.
  4761. . = DATA_SEGMENT_END(.);
  4762. 'DATA_SEGMENT_RELRO_END(OFFSET, EXP)'
  4763. This defines the end of the 'PT_GNU_RELRO' segment when '-z relro'
  4764. option is used. When '-z relro' option is not present,
  4765. 'DATA_SEGMENT_RELRO_END' does nothing, otherwise
  4766. 'DATA_SEGMENT_ALIGN' is padded so that EXP + OFFSET is aligned to
  4767. the COMMONPAGESIZE argument given to 'DATA_SEGMENT_ALIGN'. If
  4768. present in the linker script, it must be placed between
  4769. 'DATA_SEGMENT_ALIGN' and 'DATA_SEGMENT_END'. Evaluates to the
  4770. second argument plus any padding needed at the end of the
  4771. 'PT_GNU_RELRO' segment due to section alignment.
  4772. . = DATA_SEGMENT_RELRO_END(24, .);
  4773. 'DEFINED(SYMBOL)'
  4774. Return 1 if SYMBOL is in the linker global symbol table and is
  4775. defined before the statement using DEFINED in the script, otherwise
  4776. return 0. You can use this function to provide default values for
  4777. symbols. For example, the following script fragment shows how to
  4778. set a global symbol 'begin' to the first location in the '.text'
  4779. section--but if a symbol called 'begin' already existed, its value
  4780. is preserved:
  4781. SECTIONS { ...
  4782. .text : {
  4783. begin = DEFINED(begin) ? begin : . ;
  4784. ...
  4785. }
  4786. ...
  4787. }
  4788. 'LENGTH(MEMORY)'
  4789. Return the length of the memory region named MEMORY.
  4790. 'LOADADDR(SECTION)'
  4791. Return the absolute LMA of the named SECTION. (*note Output
  4792. Section LMA::).
  4793. 'LOG2CEIL(EXP)'
  4794. Return the binary logarithm of EXP rounded towards infinity.
  4795. 'LOG2CEIL(0)' returns 0.
  4796. 'MAX(EXP1, EXP2)'
  4797. Returns the maximum of EXP1 and EXP2.
  4798. 'MIN(EXP1, EXP2)'
  4799. Returns the minimum of EXP1 and EXP2.
  4800. 'NEXT(EXP)'
  4801. Return the next unallocated address that is a multiple of EXP.
  4802. This function is closely related to 'ALIGN(EXP)'; unless you use
  4803. the 'MEMORY' command to define discontinuous memory for the output
  4804. file, the two functions are equivalent.
  4805. 'ORIGIN(MEMORY)'
  4806. Return the origin of the memory region named MEMORY.
  4807. 'SEGMENT_START(SEGMENT, DEFAULT)'
  4808. Return the base address of the named SEGMENT. If an explicit value
  4809. has already been given for this segment (with a command-line '-T'
  4810. option) then that value will be returned otherwise the value will
  4811. be DEFAULT. At present, the '-T' command-line option can only be
  4812. used to set the base address for the "text", "data", and "bss"
  4813. sections, but you can use 'SEGMENT_START' with any segment name.
  4814. 'SIZEOF(SECTION)'
  4815. Return the size in bytes of the named SECTION, if that section has
  4816. been allocated. If the section has not been allocated when this is
  4817. evaluated, the linker will report an error. In the following
  4818. example, 'symbol_1' and 'symbol_2' are assigned identical values:
  4819. SECTIONS{ ...
  4820. .output {
  4821. .start = . ;
  4822. ...
  4823. .end = . ;
  4824. }
  4825. symbol_1 = .end - .start ;
  4826. symbol_2 = SIZEOF(.output);
  4827. ... }
  4828. 'SIZEOF_HEADERS'
  4829. Return the size in bytes of the output file's headers. This is
  4830. information which appears at the start of the output file. You can
  4831. use this number when setting the start address of the first
  4832. section, if you choose, to facilitate paging.
  4833. When producing an ELF output file, if the linker script uses the
  4834. 'SIZEOF_HEADERS' builtin function, the linker must compute the
  4835. number of program headers before it has determined all the section
  4836. addresses and sizes. If the linker later discovers that it needs
  4837. additional program headers, it will report an error 'not enough
  4838. room for program headers'. To avoid this error, you must avoid
  4839. using the 'SIZEOF_HEADERS' function, or you must rework your linker
  4840. script to avoid forcing the linker to use additional program
  4841. headers, or you must define the program headers yourself using the
  4842. 'PHDRS' command (*note PHDRS::).
  4843. 
  4844. File: ld.info, Node: Implicit Linker Scripts, Prev: Expressions, Up: Scripts
  4845. 3.11 Implicit Linker Scripts
  4846. ============================
  4847. If you specify a linker input file which the linker can not recognize as
  4848. an object file or an archive file, it will try to read the file as a
  4849. linker script. If the file can not be parsed as a linker script, the
  4850. linker will report an error.
  4851. An implicit linker script will not replace the default linker script.
  4852. Typically an implicit linker script would contain only symbol
  4853. assignments, or the 'INPUT', 'GROUP', or 'VERSION' commands.
  4854. Any input files read because of an implicit linker script will be
  4855. read at the position in the command line where the implicit linker
  4856. script was read. This can affect archive searching.
  4857. 
  4858. File: ld.info, Node: Plugins, Next: Machine Dependent, Prev: Scripts, Up: Top
  4859. 4 Linker Plugins
  4860. ****************
  4861. The linker can use dynamically loaded plugins to modify its behavior.
  4862. For example, the link-time optimization feature that some compilers
  4863. support is implemented with a linker plugin.
  4864. Currently there is only one plugin shipped by default, but more may
  4865. be added here later.
  4866. * Menu:
  4867. * libdep Plugin:: Static Library Dependencies Plugin
  4868. 
  4869. File: ld.info, Node: libdep Plugin, Up: Plugins
  4870. 4.1 Static Library Dependencies Plugin
  4871. ======================================
  4872. Originally, static libraries were contained in an archive file
  4873. consisting just of a collection of relocatable object files. Later they
  4874. evolved to optionally include a symbol table, to assist in finding the
  4875. needed objects within a library. There their evolution ended, and
  4876. dynamic libraries rose to ascendance.
  4877. One useful feature of dynamic libraries was that, more than just
  4878. collecting multiple objects into a single file, they also included a
  4879. list of their dependencies, such that one could specify just the name of
  4880. a single dynamic library at link time, and all of its dependencies would
  4881. be implicitly referenced as well. But static libraries lacked this
  4882. feature, so if a link invocation was switched from using dynamic
  4883. libraries to static libraries, the link command would usually fail
  4884. unless it was rewritten to explicitly list the dependencies of the
  4885. static library.
  4886. The GNU 'ar' utility now supports a '--record-libdeps' option to
  4887. embed dependency lists into static libraries as well, and the 'libdep'
  4888. plugin may be used to read this dependency information at link time.
  4889. The dependency information is stored as a single string, carrying '-l'
  4890. and '-L' arguments as they would normally appear in a linker command
  4891. line. As such, the information can be written with any text utility and
  4892. stored into any archive, even if GNU 'ar' is not being used to create
  4893. the archive. The information is stored in an archive member named
  4894. '__.LIBDEP'.
  4895. For example, given a library 'libssl.a' that depends on another
  4896. library 'libcrypto.a' which may be found in '/usr/local/lib', the
  4897. '__.LIBDEP' member of 'libssl.a' would contain
  4898. -L/usr/local/lib -lcrypto
  4899. 
  4900. File: ld.info, Node: Machine Dependent, Next: BFD, Prev: Plugins, Up: Top
  4901. 5 Machine Dependent Features
  4902. ****************************
  4903. 'ld' has additional features on some platforms; the following sections
  4904. describe them. Machines where 'ld' has no additional functionality are
  4905. not listed.
  4906. * Menu:
  4907. * H8/300:: 'ld' and the H8/300
  4908. * M68HC11/68HC12:: 'ld' and the Motorola 68HC11 and 68HC12 families
  4909. * ARM:: 'ld' and the ARM family
  4910. * HPPA ELF32:: 'ld' and HPPA 32-bit ELF
  4911. * M68K:: 'ld' and the Motorola 68K family
  4912. * MIPS:: 'ld' and the MIPS family
  4913. * MMIX:: 'ld' and MMIX
  4914. * MSP430:: 'ld' and MSP430
  4915. * NDS32:: 'ld' and NDS32
  4916. * Nios II:: 'ld' and the Altera Nios II
  4917. * PowerPC ELF32:: 'ld' and PowerPC 32-bit ELF Support
  4918. * PowerPC64 ELF64:: 'ld' and PowerPC64 64-bit ELF Support
  4919. * S/390 ELF:: 'ld' and S/390 ELF Support
  4920. * SPU ELF:: 'ld' and SPU ELF Support
  4921. * TI COFF:: 'ld' and TI COFF
  4922. * WIN32:: 'ld' and WIN32 (cygwin/mingw)
  4923. * Xtensa:: 'ld' and Xtensa Processors
  4924. 
  4925. File: ld.info, Node: H8/300, Next: M68HC11/68HC12, Up: Machine Dependent
  4926. 5.1 'ld' and the H8/300
  4927. =======================
  4928. For the H8/300, 'ld' can perform these global optimizations when you
  4929. specify the '--relax' command-line option.
  4930. _relaxing address modes_
  4931. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4932. within eight bits, and turns them into eight-bit program-counter
  4933. relative 'bsr' and 'bra' instructions, respectively.
  4934. _synthesizing instructions_
  4935. 'ld' finds all 'mov.b' instructions which use the sixteen-bit
  4936. absolute address form, but refer to the top page of memory, and
  4937. changes them to use the eight-bit address form. (That is: the
  4938. linker turns 'mov.b '@'AA:16' into 'mov.b '@'AA:8' whenever the
  4939. address AA is in the top page of memory).
  4940. 'ld' finds all 'mov' instructions which use the register indirect
  4941. with 32-bit displacement addressing mode, but use a small
  4942. displacement inside 16-bit displacement range, and changes them to
  4943. use the 16-bit displacement form. (That is: the linker turns
  4944. 'mov.b '@'D:32,ERx' into 'mov.b '@'D:16,ERx' whenever the
  4945. displacement D is in the 16 bit signed integer range. Only
  4946. implemented in ELF-format ld).
  4947. _bit manipulation instructions_
  4948. 'ld' finds all bit manipulation instructions like 'band, bclr,
  4949. biand, bild, bior, bist, bixor, bld, bnot, bor, bset, bst, btst,
  4950. bxor' which use 32 bit and 16 bit absolute address form, but refer
  4951. to the top page of memory, and changes them to use the 8 bit
  4952. address form. (That is: the linker turns 'bset #xx:3,'@'AA:32'
  4953. into 'bset #xx:3,'@'AA:8' whenever the address AA is in the top
  4954. page of memory).
  4955. _system control instructions_
  4956. 'ld' finds all 'ldc.w, stc.w' instructions which use the 32 bit
  4957. absolute address form, but refer to the top page of memory, and
  4958. changes them to use 16 bit address form. (That is: the linker
  4959. turns 'ldc.w '@'AA:32,ccr' into 'ldc.w '@'AA:16,ccr' whenever the
  4960. address AA is in the top page of memory).
  4961. 
  4962. File: ld.info, Node: M68HC11/68HC12, Next: ARM, Prev: H8/300, Up: Machine Dependent
  4963. 5.2 'ld' and the Motorola 68HC11 and 68HC12 families
  4964. ====================================================
  4965. 5.2.1 Linker Relaxation
  4966. -----------------------
  4967. For the Motorola 68HC11, 'ld' can perform these global optimizations
  4968. when you specify the '--relax' command-line option.
  4969. _relaxing address modes_
  4970. 'ld' finds all 'jsr' and 'jmp' instructions whose targets are
  4971. within eight bits, and turns them into eight-bit program-counter
  4972. relative 'bsr' and 'bra' instructions, respectively.
  4973. 'ld' also looks at all 16-bit extended addressing modes and
  4974. transforms them in a direct addressing mode when the address is in
  4975. page 0 (between 0 and 0x0ff).
  4976. _relaxing gcc instruction group_
  4977. When 'gcc' is called with '-mrelax', it can emit group of
  4978. instructions that the linker can optimize to use a 68HC11 direct
  4979. addressing mode. These instructions consists of 'bclr' or 'bset'
  4980. instructions.
  4981. 5.2.2 Trampoline Generation
  4982. ---------------------------
  4983. For 68HC11 and 68HC12, 'ld' can generate trampoline code to call a far
  4984. function using a normal 'jsr' instruction. The linker will also change
  4985. the relocation to some far function to use the trampoline address
  4986. instead of the function address. This is typically the case when a
  4987. pointer to a function is taken. The pointer will in fact point to the
  4988. function trampoline.
  4989. 
  4990. File: ld.info, Node: ARM, Next: HPPA ELF32, Prev: M68HC11/68HC12, Up: Machine Dependent
  4991. 5.3 'ld' and the ARM family
  4992. ===========================
  4993. For the ARM, 'ld' will generate code stubs to allow functions calls
  4994. between ARM and Thumb code. These stubs only work with code that has
  4995. been compiled and assembled with the '-mthumb-interwork' command line
  4996. option. If it is necessary to link with old ARM object files or
  4997. libraries, which have not been compiled with the -mthumb-interwork
  4998. option then the '--support-old-code' command-line switch should be given
  4999. to the linker. This will make it generate larger stub functions which
  5000. will work with non-interworking aware ARM code. Note, however, the
  5001. linker does not support generating stubs for function calls to
  5002. non-interworking aware Thumb code.
  5003. The '--thumb-entry' switch is a duplicate of the generic '--entry'
  5004. switch, in that it sets the program's starting address. But it also
  5005. sets the bottom bit of the address, so that it can be branched to using
  5006. a BX instruction, and the program will start executing in Thumb mode
  5007. straight away.
  5008. The '--use-nul-prefixed-import-tables' switch is specifying, that the
  5009. import tables idata4 and idata5 have to be generated with a zero element
  5010. prefix for import libraries. This is the old style to generate import
  5011. tables. By default this option is turned off.
  5012. The '--be8' switch instructs 'ld' to generate BE8 format executables.
  5013. This option is only valid when linking big-endian objects - ie ones
  5014. which have been assembled with the '-EB' option. The resulting image
  5015. will contain big-endian data and little-endian code.
  5016. The 'R_ARM_TARGET1' relocation is typically used for entries in the
  5017. '.init_array' section. It is interpreted as either 'R_ARM_REL32' or
  5018. 'R_ARM_ABS32', depending on the target. The '--target1-rel' and
  5019. '--target1-abs' switches override the default.
  5020. The '--target2=type' switch overrides the default definition of the
  5021. 'R_ARM_TARGET2' relocation. Valid values for 'type', their meanings,
  5022. and target defaults are as follows:
  5023. 'rel'
  5024. 'R_ARM_REL32' (arm*-*-elf, arm*-*-eabi)
  5025. 'abs'
  5026. 'R_ARM_ABS32'
  5027. 'got-rel'
  5028. 'R_ARM_GOT_PREL' (arm*-*-linux, arm*-*-*bsd)
  5029. The 'R_ARM_V4BX' relocation (defined by the ARM AAELF specification)
  5030. enables objects compiled for the ARMv4 architecture to be
  5031. interworking-safe when linked with other objects compiled for ARMv4t,
  5032. but also allows pure ARMv4 binaries to be built from the same ARMv4
  5033. objects.
  5034. In the latter case, the switch '--fix-v4bx' must be passed to the
  5035. linker, which causes v4t 'BX rM' instructions to be rewritten as 'MOV
  5036. PC,rM', since v4 processors do not have a 'BX' instruction.
  5037. In the former case, the switch should not be used, and 'R_ARM_V4BX'
  5038. relocations are ignored.
  5039. Replace 'BX rM' instructions identified by 'R_ARM_V4BX' relocations
  5040. with a branch to the following veneer:
  5041. TST rM, #1
  5042. MOVEQ PC, rM
  5043. BX Rn
  5044. This allows generation of libraries/applications that work on ARMv4
  5045. cores and are still interworking safe. Note that the above veneer
  5046. clobbers the condition flags, so may cause incorrect program behavior in
  5047. rare cases.
  5048. The '--use-blx' switch enables the linker to use ARM/Thumb BLX
  5049. instructions (available on ARMv5t and above) in various situations.
  5050. Currently it is used to perform calls via the PLT from Thumb code using
  5051. BLX rather than using BX and a mode-switching stub before each PLT
  5052. entry. This should lead to such calls executing slightly faster.
  5053. The '--vfp11-denorm-fix' switch enables a link-time workaround for a
  5054. bug in certain VFP11 coprocessor hardware, which sometimes allows
  5055. instructions with denorm operands (which must be handled by support
  5056. code) to have those operands overwritten by subsequent instructions
  5057. before the support code can read the intended values.
  5058. The bug may be avoided in scalar mode if you allow at least one
  5059. intervening instruction between a VFP11 instruction which uses a
  5060. register and another instruction which writes to the same register, or
  5061. at least two intervening instructions if vector mode is in use. The bug
  5062. only affects full-compliance floating-point mode: you do not need this
  5063. workaround if you are using "runfast" mode. Please contact ARM for
  5064. further details.
  5065. If you know you are using buggy VFP11 hardware, you can enable this
  5066. workaround by specifying the linker option '--vfp-denorm-fix=scalar' if
  5067. you are using the VFP11 scalar mode only, or '--vfp-denorm-fix=vector'
  5068. if you are using vector mode (the latter also works for scalar code).
  5069. The default is '--vfp-denorm-fix=none'.
  5070. If the workaround is enabled, instructions are scanned for
  5071. potentially-troublesome sequences, and a veneer is created for each such
  5072. sequence which may trigger the erratum. The veneer consists of the
  5073. first instruction of the sequence and a branch back to the subsequent
  5074. instruction. The original instruction is then replaced with a branch to
  5075. the veneer. The extra cycles required to call and return from the
  5076. veneer are sufficient to avoid the erratum in both the scalar and vector
  5077. cases.
  5078. The '--fix-arm1176' switch enables a link-time workaround for an
  5079. erratum in certain ARM1176 processors. The workaround is enabled by
  5080. default if you are targeting ARM v6 (excluding ARM v6T2) or earlier. It
  5081. can be disabled unconditionally by specifying '--no-fix-arm1176'.
  5082. Further information is available in the "ARM1176JZ-S and ARM1176JZF-S
  5083. Programmer Advice Notice" available on the ARM documentation website at:
  5084. http://infocenter.arm.com/.
  5085. The '--fix-stm32l4xx-629360' switch enables a link-time workaround
  5086. for a bug in the bus matrix / memory controller for some of the STM32
  5087. Cortex-M4 based products (STM32L4xx). When accessing off-chip memory
  5088. via the affected bus for bus reads of 9 words or more, the bus can
  5089. generate corrupt data and/or abort. These are only core-initiated
  5090. accesses (not DMA), and might affect any access: integer loads such as
  5091. LDM, POP and floating-point loads such as VLDM, VPOP. Stores are not
  5092. affected.
  5093. The bug can be avoided by splitting memory accesses into the
  5094. necessary chunks to keep bus reads below 8 words.
  5095. The workaround is not enabled by default, this is equivalent to use
  5096. '--fix-stm32l4xx-629360=none'. If you know you are using buggy
  5097. STM32L4xx hardware, you can enable the workaround by specifying the
  5098. linker option '--fix-stm32l4xx-629360', or the equivalent
  5099. '--fix-stm32l4xx-629360=default'.
  5100. If the workaround is enabled, instructions are scanned for
  5101. potentially-troublesome sequences, and a veneer is created for each such
  5102. sequence which may trigger the erratum. The veneer consists in a
  5103. replacement sequence emulating the behaviour of the original one and a
  5104. branch back to the subsequent instruction. The original instruction is
  5105. then replaced with a branch to the veneer.
  5106. The workaround does not always preserve the memory access order for
  5107. the LDMDB instruction, when the instruction loads the PC.
  5108. The workaround is not able to handle problematic instructions when
  5109. they are in the middle of an IT block, since a branch is not allowed
  5110. there. In that case, the linker reports a warning and no replacement
  5111. occurs.
  5112. The workaround is not able to replace problematic instructions with a
  5113. PC-relative branch instruction if the '.text' section is too large. In
  5114. that case, when the branch that replaces the original code cannot be
  5115. encoded, the linker reports a warning and no replacement occurs.
  5116. The '--no-enum-size-warning' switch prevents the linker from warning
  5117. when linking object files that specify incompatible EABI enumeration
  5118. size attributes. For example, with this switch enabled, linking of an
  5119. object file using 32-bit enumeration values with another using
  5120. enumeration values fitted into the smallest possible space will not be
  5121. diagnosed.
  5122. The '--no-wchar-size-warning' switch prevents the linker from warning
  5123. when linking object files that specify incompatible EABI 'wchar_t' size
  5124. attributes. For example, with this switch enabled, linking of an object
  5125. file using 32-bit 'wchar_t' values with another using 16-bit 'wchar_t'
  5126. values will not be diagnosed.
  5127. The '--pic-veneer' switch makes the linker use PIC sequences for
  5128. ARM/Thumb interworking veneers, even if the rest of the binary is not
  5129. PIC. This avoids problems on uClinux targets where '--emit-relocs' is
  5130. used to generate relocatable binaries.
  5131. The linker will automatically generate and insert small sequences of
  5132. code into a linked ARM ELF executable whenever an attempt is made to
  5133. perform a function call to a symbol that is too far away. The placement
  5134. of these sequences of instructions - called stubs - is controlled by the
  5135. command-line option '--stub-group-size=N'. The placement is important
  5136. because a poor choice can create a need for duplicate stubs, increasing
  5137. the code size. The linker will try to group stubs together in order to
  5138. reduce interruptions to the flow of code, but it needs guidance as to
  5139. how big these groups should be and where they should be placed.
  5140. The value of 'N', the parameter to the '--stub-group-size=' option
  5141. controls where the stub groups are placed. If it is negative then all
  5142. stubs are placed after the first branch that needs them. If it is
  5143. positive then the stubs can be placed either before or after the
  5144. branches that need them. If the value of 'N' is 1 (either +1 or -1)
  5145. then the linker will choose exactly where to place groups of stubs,
  5146. using its built in heuristics. A value of 'N' greater than 1 (or
  5147. smaller than -1) tells the linker that a single group of stubs can
  5148. service at most 'N' bytes from the input sections.
  5149. The default, if '--stub-group-size=' is not specified, is 'N = +1'.
  5150. Farcalls stubs insertion is fully supported for the ARM-EABI target
  5151. only, because it relies on object files properties not present
  5152. otherwise.
  5153. The '--fix-cortex-a8' switch enables a link-time workaround for an
  5154. erratum in certain Cortex-A8 processors. The workaround is enabled by
  5155. default if you are targeting the ARM v7-A architecture profile. It can
  5156. be enabled otherwise by specifying '--fix-cortex-a8', or disabled
  5157. unconditionally by specifying '--no-fix-cortex-a8'.
  5158. The erratum only affects Thumb-2 code. Please contact ARM for
  5159. further details.
  5160. The '--fix-cortex-a53-835769' switch enables a link-time workaround
  5161. for erratum 835769 present on certain early revisions of Cortex-A53
  5162. processors. The workaround is disabled by default. It can be enabled
  5163. by specifying '--fix-cortex-a53-835769', or disabled unconditionally by
  5164. specifying '--no-fix-cortex-a53-835769'.
  5165. Please contact ARM for further details.
  5166. The '--no-merge-exidx-entries' switch disables the merging of
  5167. adjacent exidx entries in debuginfo.
  5168. The '--long-plt' option enables the use of 16 byte PLT entries which
  5169. support up to 4Gb of code. The default is to use 12 byte PLT entries
  5170. which only support 512Mb of code.
  5171. The '--no-apply-dynamic-relocs' option makes AArch64 linker do not
  5172. apply link-time values for dynamic relocations.
  5173. All SG veneers are placed in the special output section
  5174. '.gnu.sgstubs'. Its start address must be set, either with the
  5175. command-line option '--section-start' or in a linker script, to indicate
  5176. where to place these veneers in memory.
  5177. The '--cmse-implib' option requests that the import libraries
  5178. specified by the '--out-implib' and '--in-implib' options are secure
  5179. gateway import libraries, suitable for linking a non-secure executable
  5180. against secure code as per ARMv8-M Security Extensions.
  5181. The '--in-implib=file' specifies an input import library whose
  5182. symbols must keep the same address in the executable being produced. A
  5183. warning is given if no '--out-implib' is given but new symbols have been
  5184. introduced in the executable that should be listed in its import
  5185. library. Otherwise, if '--out-implib' is specified, the symbols are
  5186. added to the output import library. A warning is also given if some
  5187. symbols present in the input import library have disappeared from the
  5188. executable. This option is only effective for Secure Gateway import
  5189. libraries, ie. when '--cmse-implib' is specified.
  5190. 
  5191. File: ld.info, Node: HPPA ELF32, Next: M68K, Prev: ARM, Up: Machine Dependent
  5192. 5.4 'ld' and HPPA 32-bit ELF Support
  5193. ====================================
  5194. When generating a shared library, 'ld' will by default generate import
  5195. stubs suitable for use with a single sub-space application. The
  5196. '--multi-subspace' switch causes 'ld' to generate export stubs, and
  5197. different (larger) import stubs suitable for use with multiple
  5198. sub-spaces.
  5199. Long branch stubs and import/export stubs are placed by 'ld' in stub
  5200. sections located between groups of input sections. '--stub-group-size'
  5201. specifies the maximum size of a group of input sections handled by one
  5202. stub section. Since branch offsets are signed, a stub section may serve
  5203. two groups of input sections, one group before the stub section, and one
  5204. group after it. However, when using conditional branches that require
  5205. stubs, it may be better (for branch prediction) that stub sections only
  5206. serve one group of input sections. A negative value for 'N' chooses
  5207. this scheme, ensuring that branches to stubs always use a negative
  5208. offset. Two special values of 'N' are recognized, '1' and '-1'. These
  5209. both instruct 'ld' to automatically size input section groups for the
  5210. branch types detected, with the same behaviour regarding stub placement
  5211. as other positive or negative values of 'N' respectively.
  5212. Note that '--stub-group-size' does not split input sections. A
  5213. single input section larger than the group size specified will of course
  5214. create a larger group (of one section). If input sections are too
  5215. large, it may not be possible for a branch to reach its stub.
  5216. 
  5217. File: ld.info, Node: M68K, Next: MIPS, Prev: HPPA ELF32, Up: Machine Dependent
  5218. 5.5 'ld' and the Motorola 68K family
  5219. ====================================
  5220. The '--got=TYPE' option lets you choose the GOT generation scheme. The
  5221. choices are 'single', 'negative', 'multigot' and 'target'. When
  5222. 'target' is selected the linker chooses the default GOT generation
  5223. scheme for the current target. 'single' tells the linker to generate a
  5224. single GOT with entries only at non-negative offsets. 'negative'
  5225. instructs the linker to generate a single GOT with entries at both
  5226. negative and positive offsets. Not all environments support such GOTs.
  5227. 'multigot' allows the linker to generate several GOTs in the output
  5228. file. All GOT references from a single input object file access the
  5229. same GOT, but references from different input object files might access
  5230. different GOTs. Not all environments support such GOTs.
  5231. 
  5232. File: ld.info, Node: MIPS, Next: MMIX, Prev: M68K, Up: Machine Dependent
  5233. 5.6 'ld' and the MIPS family
  5234. ============================
  5235. The '--insn32' and '--no-insn32' options control the choice of microMIPS
  5236. instructions used in code generated by the linker, such as that in the
  5237. PLT or lazy binding stubs, or in relaxation. If '--insn32' is used,
  5238. then the linker only uses 32-bit instruction encodings. By default or
  5239. if '--no-insn32' is used, all instruction encodings are used, including
  5240. 16-bit ones where possible.
  5241. The '--ignore-branch-isa' and '--no-ignore-branch-isa' options
  5242. control branch relocation checks for invalid ISA mode transitions. If
  5243. '--ignore-branch-isa' is used, then the linker accepts any branch
  5244. relocations and any ISA mode transition required is lost in relocation
  5245. calculation, except for some cases of 'BAL' instructions which meet
  5246. relaxation conditions and are converted to equivalent 'JALX'
  5247. instructions as the associated relocation is calculated. By default or
  5248. if '--no-ignore-branch-isa' is used a check is made causing the loss of
  5249. an ISA mode transition to produce an error.
  5250. 
  5251. File: ld.info, Node: MMIX, Next: MSP430, Prev: MIPS, Up: Machine Dependent
  5252. 5.7 'ld' and MMIX
  5253. =================
  5254. For MMIX, there is a choice of generating 'ELF' object files or 'mmo'
  5255. object files when linking. The simulator 'mmix' understands the 'mmo'
  5256. format. The binutils 'objcopy' utility can translate between the two
  5257. formats.
  5258. There is one special section, the '.MMIX.reg_contents' section.
  5259. Contents in this section is assumed to correspond to that of global
  5260. registers, and symbols referring to it are translated to special
  5261. symbols, equal to registers. In a final link, the start address of the
  5262. '.MMIX.reg_contents' section corresponds to the first allocated global
  5263. register multiplied by 8. Register '$255' is not included in this
  5264. section; it is always set to the program entry, which is at the symbol
  5265. 'Main' for 'mmo' files.
  5266. Global symbols with the prefix '__.MMIX.start.', for example
  5267. '__.MMIX.start..text' and '__.MMIX.start..data' are special. The
  5268. default linker script uses these to set the default start address of a
  5269. section.
  5270. Initial and trailing multiples of zero-valued 32-bit words in a
  5271. section, are left out from an mmo file.
  5272. 
  5273. File: ld.info, Node: MSP430, Next: NDS32, Prev: MMIX, Up: Machine Dependent
  5274. 5.8 'ld' and MSP430
  5275. ===================
  5276. For the MSP430 it is possible to select the MPU architecture. The flag
  5277. '-m [mpu type]' will select an appropriate linker script for selected
  5278. MPU type. (To get a list of known MPUs just pass '-m help' option to
  5279. the linker).
  5280. The linker will recognize some extra sections which are MSP430
  5281. specific:
  5282. ''.vectors''
  5283. Defines a portion of ROM where interrupt vectors located.
  5284. ''.bootloader''
  5285. Defines the bootloader portion of the ROM (if applicable). Any
  5286. code in this section will be uploaded to the MPU.
  5287. ''.infomem''
  5288. Defines an information memory section (if applicable). Any code in
  5289. this section will be uploaded to the MPU.
  5290. ''.infomemnobits''
  5291. This is the same as the '.infomem' section except that any code in
  5292. this section will not be uploaded to the MPU.
  5293. ''.noinit''
  5294. Denotes a portion of RAM located above '.bss' section.
  5295. The last two sections are used by gcc.
  5296. '--code-region=[either,lower,upper,none]'
  5297. This will transform .text* sections to [either,lower,upper].text*
  5298. sections. The argument passed to GCC for -mcode-region is
  5299. propagated to the linker using this option.
  5300. '--data-region=[either,lower,upper,none]'
  5301. This will transform .data*, .bss* and .rodata* sections to
  5302. [either,lower,upper].[data,bss,rodata]* sections. The argument
  5303. passed to GCC for -mdata-region is propagated to the linker using
  5304. this option.
  5305. '--disable-sec-transformation'
  5306. Prevent the transformation of sections as specified by the
  5307. '--code-region' and '--data-region' options. This is useful if you
  5308. are compiling and linking using a single call to the GCC wrapper,
  5309. and want to compile the source files using -m[code,data]-region but
  5310. not transform the sections for prebuilt libraries and objects.
  5311. 
  5312. File: ld.info, Node: NDS32, Next: Nios II, Prev: MSP430, Up: Machine Dependent
  5313. 5.9 'ld' and NDS32
  5314. ==================
  5315. For NDS32, there are some options to select relaxation behavior. The
  5316. linker relaxes objects according to these options.
  5317. ''--m[no-]fp-as-gp''
  5318. Disable/enable fp-as-gp relaxation.
  5319. ''--mexport-symbols=FILE''
  5320. Exporting symbols and their address into FILE as linker script.
  5321. ''--m[no-]ex9''
  5322. Disable/enable link-time EX9 relaxation.
  5323. ''--mexport-ex9=FILE''
  5324. Export the EX9 table after linking.
  5325. ''--mimport-ex9=FILE''
  5326. Import the Ex9 table for EX9 relaxation.
  5327. ''--mupdate-ex9''
  5328. Update the existing EX9 table.
  5329. ''--mex9-limit=NUM''
  5330. Maximum number of entries in the ex9 table.
  5331. ''--mex9-loop-aware''
  5332. Avoid generating the EX9 instruction inside the loop.
  5333. ''--m[no-]ifc''
  5334. Disable/enable the link-time IFC optimization.
  5335. ''--mifc-loop-aware''
  5336. Avoid generating the IFC instruction inside the loop.
  5337. 
  5338. File: ld.info, Node: Nios II, Next: PowerPC ELF32, Prev: NDS32, Up: Machine Dependent
  5339. 5.10 'ld' and the Altera Nios II
  5340. ================================
  5341. Call and immediate jump instructions on Nios II processors are limited
  5342. to transferring control to addresses in the same 256MB memory segment,
  5343. which may result in 'ld' giving 'relocation truncated to fit' errors
  5344. with very large programs. The command-line option '--relax' enables the
  5345. generation of trampolines that can access the entire 32-bit address
  5346. space for calls outside the normal 'call' and 'jmpi' address range.
  5347. These trampolines are inserted at section boundaries, so may not
  5348. themselves be reachable if an input section and its associated call
  5349. trampolines are larger than 256MB.
  5350. The '--relax' option is enabled by default unless '-r' is also
  5351. specified. You can disable trampoline generation by using the
  5352. '--no-relax' linker option. You can also disable this optimization
  5353. locally by using the 'set .noat' directive in assembly-language source
  5354. files, as the linker-inserted trampolines use the 'at' register as a
  5355. temporary.
  5356. Note that the linker '--relax' option is independent of assembler
  5357. relaxation options, and that using the GNU assembler's '-relax-all'
  5358. option interferes with the linker's more selective call instruction
  5359. relaxation.
  5360. 
  5361. File: ld.info, Node: PowerPC ELF32, Next: PowerPC64 ELF64, Prev: Nios II, Up: Machine Dependent
  5362. 5.11 'ld' and PowerPC 32-bit ELF Support
  5363. ========================================
  5364. Branches on PowerPC processors are limited to a signed 26-bit
  5365. displacement, which may result in 'ld' giving 'relocation truncated to
  5366. fit' errors with very large programs. '--relax' enables the generation
  5367. of trampolines that can access the entire 32-bit address space. These
  5368. trampolines are inserted at section boundaries, so may not themselves be
  5369. reachable if an input section exceeds 33M in size. You may combine '-r'
  5370. and '--relax' to add trampolines in a partial link. In that case both
  5371. branches to undefined symbols and inter-section branches are also
  5372. considered potentially out of range, and trampolines inserted.
  5373. '--bss-plt'
  5374. Current PowerPC GCC accepts a '-msecure-plt' option that generates
  5375. code capable of using a newer PLT and GOT layout that has the
  5376. security advantage of no executable section ever needing to be
  5377. writable and no writable section ever being executable. PowerPC
  5378. 'ld' will generate this layout, including stubs to access the PLT,
  5379. if all input files (including startup and static libraries) were
  5380. compiled with '-msecure-plt'. '--bss-plt' forces the old BSS PLT
  5381. (and GOT layout) which can give slightly better performance.
  5382. '--secure-plt'
  5383. 'ld' will use the new PLT and GOT layout if it is linking new
  5384. '-fpic' or '-fPIC' code, but does not do so automatically when
  5385. linking non-PIC code. This option requests the new PLT and GOT
  5386. layout. A warning will be given if some object file requires the
  5387. old style BSS PLT.
  5388. '--sdata-got'
  5389. The new secure PLT and GOT are placed differently relative to other
  5390. sections compared to older BSS PLT and GOT placement. The location
  5391. of '.plt' must change because the new secure PLT is an initialized
  5392. section while the old PLT is uninitialized. The reason for the
  5393. '.got' change is more subtle: The new placement allows '.got' to be
  5394. read-only in applications linked with '-z relro -z now'. However,
  5395. this placement means that '.sdata' cannot always be used in shared
  5396. libraries, because the PowerPC ABI accesses '.sdata' in shared
  5397. libraries from the GOT pointer. '--sdata-got' forces the old GOT
  5398. placement. PowerPC GCC doesn't use '.sdata' in shared libraries,
  5399. so this option is really only useful for other compilers that may
  5400. do so.
  5401. '--emit-stub-syms'
  5402. This option causes 'ld' to label linker stubs with a local symbol
  5403. that encodes the stub type and destination.
  5404. '--no-tls-optimize'
  5405. PowerPC 'ld' normally performs some optimization of code sequences
  5406. used to access Thread-Local Storage. Use this option to disable
  5407. the optimization.
  5408. 
  5409. File: ld.info, Node: PowerPC64 ELF64, Next: S/390 ELF, Prev: PowerPC ELF32, Up: Machine Dependent
  5410. 5.12 'ld' and PowerPC64 64-bit ELF Support
  5411. ==========================================
  5412. '--stub-group-size'
  5413. Long branch stubs, PLT call stubs and TOC adjusting stubs are
  5414. placed by 'ld' in stub sections located between groups of input
  5415. sections. '--stub-group-size' specifies the maximum size of a
  5416. group of input sections handled by one stub section. Since branch
  5417. offsets are signed, a stub section may serve two groups of input
  5418. sections, one group before the stub section, and one group after
  5419. it. However, when using conditional branches that require stubs,
  5420. it may be better (for branch prediction) that stub sections only
  5421. serve one group of input sections. A negative value for 'N'
  5422. chooses this scheme, ensuring that branches to stubs always use a
  5423. negative offset. Two special values of 'N' are recognized, '1' and
  5424. '-1'. These both instruct 'ld' to automatically size input section
  5425. groups for the branch types detected, with the same behaviour
  5426. regarding stub placement as other positive or negative values of
  5427. 'N' respectively.
  5428. Note that '--stub-group-size' does not split input sections. A
  5429. single input section larger than the group size specified will of
  5430. course create a larger group (of one section). If input sections
  5431. are too large, it may not be possible for a branch to reach its
  5432. stub.
  5433. '--emit-stub-syms'
  5434. This option causes 'ld' to label linker stubs with a local symbol
  5435. that encodes the stub type and destination.
  5436. '--dotsyms'
  5437. '--no-dotsyms'
  5438. These two options control how 'ld' interprets version patterns in a
  5439. version script. Older PowerPC64 compilers emitted both a function
  5440. descriptor symbol with the same name as the function, and a code
  5441. entry symbol with the name prefixed by a dot ('.'). To properly
  5442. version a function 'foo', the version script thus needs to control
  5443. both 'foo' and '.foo'. The option '--dotsyms', on by default,
  5444. automatically adds the required dot-prefixed patterns. Use
  5445. '--no-dotsyms' to disable this feature.
  5446. '--save-restore-funcs'
  5447. '--no-save-restore-funcs'
  5448. These two options control whether PowerPC64 'ld' automatically
  5449. provides out-of-line register save and restore functions used by
  5450. '-Os' code. The default is to provide any such referenced function
  5451. for a normal final link, and to not do so for a relocatable link.
  5452. '--no-tls-optimize'
  5453. PowerPC64 'ld' normally performs some optimization of code
  5454. sequences used to access Thread-Local Storage. Use this option to
  5455. disable the optimization.
  5456. '--tls-get-addr-optimize'
  5457. '--no-tls-get-addr-optimize'
  5458. These options control how PowerPC64 'ld' uses a special stub to
  5459. call __tls_get_addr. PowerPC64 glibc 2.22 and later support an
  5460. optimization that allows the second and subsequent calls to
  5461. '__tls_get_addr' for a given symbol to be resolved by the special
  5462. stub without calling in to glibc. By default the linker enables
  5463. generation of the stub when glibc advertises the availability of
  5464. __tls_get_addr_opt. Using '--tls-get-addr-optimize' with an older
  5465. glibc won't do much besides slow down your applications, but may be
  5466. useful if linking an application against an older glibc with the
  5467. expectation that it will normally be used on systems having a newer
  5468. glibc. '--tls-get-addr-regsave' forces generation of a stub that
  5469. saves and restores volatile registers around the call into glibc.
  5470. Normally, this is done when the linker detects a call to
  5471. __tls_get_addr_desc. Such calls then go via the register saving
  5472. stub to __tls_get_addr_opt. '--no-tls-get-addr-regsave' disables
  5473. generation of the register saves.
  5474. '--no-opd-optimize'
  5475. PowerPC64 'ld' normally removes '.opd' section entries
  5476. corresponding to deleted link-once functions, or functions removed
  5477. by the action of '--gc-sections' or linker script '/DISCARD/'. Use
  5478. this option to disable '.opd' optimization.
  5479. '--non-overlapping-opd'
  5480. Some PowerPC64 compilers have an option to generate compressed
  5481. '.opd' entries spaced 16 bytes apart, overlapping the third word,
  5482. the static chain pointer (unused in C) with the first word of the
  5483. next entry. This option expands such entries to the full 24 bytes.
  5484. '--no-toc-optimize'
  5485. PowerPC64 'ld' normally removes unused '.toc' section entries.
  5486. Such entries are detected by examining relocations that reference
  5487. the TOC in code sections. A reloc in a deleted code section marks
  5488. a TOC word as unneeded, while a reloc in a kept code section marks
  5489. a TOC word as needed. Since the TOC may reference itself, TOC
  5490. relocs are also examined. TOC words marked as both needed and
  5491. unneeded will of course be kept. TOC words without any referencing
  5492. reloc are assumed to be part of a multi-word entry, and are kept or
  5493. discarded as per the nearest marked preceding word. This works
  5494. reliably for compiler generated code, but may be incorrect if
  5495. assembly code is used to insert TOC entries. Use this option to
  5496. disable the optimization.
  5497. '--no-inline-optimize'
  5498. PowerPC64 'ld' normally replaces inline PLT call sequences marked
  5499. with 'R_PPC64_PLTSEQ', 'R_PPC64_PLTCALL', 'R_PPC64_PLT16_HA' and
  5500. 'R_PPC64_PLT16_LO_DS' relocations by a number of 'nop's and a
  5501. direct call when the function is defined locally and can't be
  5502. overridden by some other definition. This option disables that
  5503. optimization.
  5504. '--no-multi-toc'
  5505. If given any toc option besides '-mcmodel=medium' or
  5506. '-mcmodel=large', PowerPC64 GCC generates code for a TOC model
  5507. where TOC entries are accessed with a 16-bit offset from r2. This
  5508. limits the total TOC size to 64K. PowerPC64 'ld' extends this limit
  5509. by grouping code sections such that each group uses less than 64K
  5510. for its TOC entries, then inserts r2 adjusting stubs between
  5511. inter-group calls. 'ld' does not split apart input sections, so
  5512. cannot help if a single input file has a '.toc' section that
  5513. exceeds 64K, most likely from linking multiple files with 'ld -r'.
  5514. Use this option to turn off this feature.
  5515. '--no-toc-sort'
  5516. By default, 'ld' sorts TOC sections so that those whose file
  5517. happens to have a section called '.init' or '.fini' are placed
  5518. first, followed by TOC sections referenced by code generated with
  5519. PowerPC64 gcc's '-mcmodel=small', and lastly TOC sections
  5520. referenced only by code generated with PowerPC64 gcc's
  5521. '-mcmodel=medium' or '-mcmodel=large' options. Doing this results
  5522. in better TOC grouping for multi-TOC. Use this option to turn off
  5523. this feature.
  5524. '--plt-align'
  5525. '--no-plt-align'
  5526. Use these options to control whether individual PLT call stubs are
  5527. aligned to a 32-byte boundary, or to the specified power of two
  5528. boundary when using '--plt-align='. A negative value may be
  5529. specified to pad PLT call stubs so that they do not cross the
  5530. specified power of two boundary (or the minimum number of
  5531. boundaries if a PLT stub is so large that it must cross a
  5532. boundary). By default PLT call stubs are aligned to 32-byte
  5533. boundaries.
  5534. '--plt-static-chain'
  5535. '--no-plt-static-chain'
  5536. Use these options to control whether PLT call stubs load the static
  5537. chain pointer (r11). 'ld' defaults to not loading the static chain
  5538. since there is never any need to do so on a PLT call.
  5539. '--plt-thread-safe'
  5540. '--no-plt-thread-safe'
  5541. With power7's weakly ordered memory model, it is possible when
  5542. using lazy binding for ld.so to update a plt entry in one thread
  5543. and have another thread see the individual plt entry words update
  5544. in the wrong order, despite ld.so carefully writing in the correct
  5545. order and using memory write barriers. To avoid this we need some
  5546. sort of read barrier in the call stub, or use LD_BIND_NOW=1. By
  5547. default, 'ld' looks for calls to commonly used functions that
  5548. create threads, and if seen, adds the necessary barriers. Use
  5549. these options to change the default behaviour.
  5550. '--plt-localentry'
  5551. '--no-localentry'
  5552. ELFv2 functions with localentry:0 are those with a single entry
  5553. point, ie. global entry == local entry, and that have no
  5554. requirement on r2 (the TOC/GOT pointer) or r12, and guarantee r2 is
  5555. unchanged on return. Such an external function can be called via
  5556. the PLT without saving r2 or restoring it on return, avoiding a
  5557. common load-hit-store for small functions. The optimization is
  5558. attractive, with up to 40% reduction in execution time for a small
  5559. function, but can result in symbol interposition failures. Also,
  5560. minor changes in a shared library, including system libraries, can
  5561. cause a function that was localentry:0 to become localentry:8.
  5562. This will result in a dynamic loader complaint and failure to run.
  5563. The option is experimental, use with care. '--no-plt-localentry'
  5564. is the default.
  5565. '--power10-stubs'
  5566. '--no-power10-stubs'
  5567. When PowerPC64 'ld' links input object files containing relocations
  5568. used on power10 prefixed instructions it normally creates linkage
  5569. stubs (PLT call and long branch) using power10 instructions for
  5570. '@notoc' PLT calls where 'r2' is not known. The power10 notoc
  5571. stubs are smaller and faster, so are preferred for power10.
  5572. '--power10-stubs' and '--no-power10-stubs' allow you to override
  5573. the linker's selection of stub instructions.
  5574. '--power10-stubs=auto' allows the user to select the default auto
  5575. mode.
  5576. 
  5577. File: ld.info, Node: S/390 ELF, Next: SPU ELF, Prev: PowerPC64 ELF64, Up: Machine Dependent
  5578. 5.13 'ld' and S/390 ELF Support
  5579. ===============================
  5580. '--s390-pgste'
  5581. This option marks the result file with a 'PT_S390_PGSTE' segment.
  5582. The Linux kernel is supposed to allocate 4k page tables for
  5583. binaries marked that way.
  5584. 
  5585. File: ld.info, Node: SPU ELF, Next: TI COFF, Prev: S/390 ELF, Up: Machine Dependent
  5586. 5.14 'ld' and SPU ELF Support
  5587. =============================
  5588. '--plugin'
  5589. This option marks an executable as a PIC plugin module.
  5590. '--no-overlays'
  5591. Normally, 'ld' recognizes calls to functions within overlay
  5592. regions, and redirects such calls to an overlay manager via a stub.
  5593. 'ld' also provides a built-in overlay manager. This option turns
  5594. off all this special overlay handling.
  5595. '--emit-stub-syms'
  5596. This option causes 'ld' to label overlay stubs with a local symbol
  5597. that encodes the stub type and destination.
  5598. '--extra-overlay-stubs'
  5599. This option causes 'ld' to add overlay call stubs on all function
  5600. calls out of overlay regions. Normally stubs are not added on
  5601. calls to non-overlay regions.
  5602. '--local-store=lo:hi'
  5603. 'ld' usually checks that a final executable for SPU fits in the
  5604. address range 0 to 256k. This option may be used to change the
  5605. range. Disable the check entirely with '--local-store=0:0'.
  5606. '--stack-analysis'
  5607. SPU local store space is limited. Over-allocation of stack space
  5608. unnecessarily limits space available for code and data, while
  5609. under-allocation results in runtime failures. If given this
  5610. option, 'ld' will provide an estimate of maximum stack usage. 'ld'
  5611. does this by examining symbols in code sections to determine the
  5612. extents of functions, and looking at function prologues for stack
  5613. adjusting instructions. A call-graph is created by looking for
  5614. relocations on branch instructions. The graph is then searched for
  5615. the maximum stack usage path. Note that this analysis does not
  5616. find calls made via function pointers, and does not handle
  5617. recursion and other cycles in the call graph. Stack usage may be
  5618. under-estimated if your code makes such calls. Also, stack usage
  5619. for dynamic allocation, e.g. alloca, will not be detected. If a
  5620. link map is requested, detailed information about each function's
  5621. stack usage and calls will be given.
  5622. '--emit-stack-syms'
  5623. This option, if given along with '--stack-analysis' will result in
  5624. 'ld' emitting stack sizing symbols for each function. These take
  5625. the form '__stack_<function_name>' for global functions, and
  5626. '__stack_<number>_<function_name>' for static functions.
  5627. '<number>' is the section id in hex. The value of such symbols is
  5628. the stack requirement for the corresponding function. The symbol
  5629. size will be zero, type 'STT_NOTYPE', binding 'STB_LOCAL', and
  5630. section 'SHN_ABS'.
  5631. 
  5632. File: ld.info, Node: TI COFF, Next: WIN32, Prev: SPU ELF, Up: Machine Dependent
  5633. 5.15 'ld''s Support for Various TI COFF Versions
  5634. ================================================
  5635. The '--format' switch allows selection of one of the various TI COFF
  5636. versions. The latest of this writing is 2; versions 0 and 1 are also
  5637. supported. The TI COFF versions also vary in header byte-order format;
  5638. 'ld' will read any version or byte order, but the output header format
  5639. depends on the default specified by the specific target.
  5640. 
  5641. File: ld.info, Node: WIN32, Next: Xtensa, Prev: TI COFF, Up: Machine Dependent
  5642. 5.16 'ld' and WIN32 (cygwin/mingw)
  5643. ==================================
  5644. This section describes some of the win32 specific 'ld' issues. See
  5645. *note Command-line Options: Options. for detailed description of the
  5646. command-line options mentioned here.
  5647. _import libraries_
  5648. The standard Windows linker creates and uses so-called import
  5649. libraries, which contains information for linking to dll's. They
  5650. are regular static archives and are handled as any other static
  5651. archive. The cygwin and mingw ports of 'ld' have specific support
  5652. for creating such libraries provided with the '--out-implib'
  5653. command-line option.
  5654. _exporting DLL symbols_
  5655. The cygwin/mingw 'ld' has several ways to export symbols for dll's.
  5656. _using auto-export functionality_
  5657. By default 'ld' exports symbols with the auto-export
  5658. functionality, which is controlled by the following
  5659. command-line options:
  5660. * -export-all-symbols [This is the default]
  5661. * -exclude-symbols
  5662. * -exclude-libs
  5663. * -exclude-modules-for-implib
  5664. * -version-script
  5665. When auto-export is in operation, 'ld' will export all the
  5666. non-local (global and common) symbols it finds in a DLL, with
  5667. the exception of a few symbols known to belong to the system's
  5668. runtime and libraries. As it will often not be desirable to
  5669. export all of a DLL's symbols, which may include private
  5670. functions that are not part of any public interface, the
  5671. command-line options listed above may be used to filter
  5672. symbols out from the list for exporting. The '--output-def'
  5673. option can be used in order to see the final list of exported
  5674. symbols with all exclusions taken into effect.
  5675. If '--export-all-symbols' is not given explicitly on the
  5676. command line, then the default auto-export behavior will be
  5677. _disabled_ if either of the following are true:
  5678. * A DEF file is used.
  5679. * Any symbol in any object file was marked with the
  5680. __declspec(dllexport) attribute.
  5681. _using a DEF file_
  5682. Another way of exporting symbols is using a DEF file. A DEF
  5683. file is an ASCII file containing definitions of symbols which
  5684. should be exported when a dll is created. Usually it is named
  5685. '<dll name>.def' and is added as any other object file to the
  5686. linker's command line. The file's name must end in '.def' or
  5687. '.DEF'.
  5688. gcc -o <output> <objectfiles> <dll name>.def
  5689. Using a DEF file turns off the normal auto-export behavior,
  5690. unless the '--export-all-symbols' option is also used.
  5691. Here is an example of a DEF file for a shared library called
  5692. 'xyz.dll':
  5693. LIBRARY "xyz.dll" BASE=0x20000000
  5694. EXPORTS
  5695. foo
  5696. bar
  5697. _bar = bar
  5698. another_foo = abc.dll.afoo
  5699. var1 DATA
  5700. doo = foo == foo2
  5701. eoo DATA == var1
  5702. This example defines a DLL with a non-default base address and
  5703. seven symbols in the export table. The third exported symbol
  5704. '_bar' is an alias for the second. The fourth symbol,
  5705. 'another_foo' is resolved by "forwarding" to another module
  5706. and treating it as an alias for 'afoo' exported from the DLL
  5707. 'abc.dll'. The final symbol 'var1' is declared to be a data
  5708. object. The 'doo' symbol in export library is an alias of
  5709. 'foo', which gets the string name in export table 'foo2'. The
  5710. 'eoo' symbol is an data export symbol, which gets in export
  5711. table the name 'var1'.
  5712. The optional 'LIBRARY <name>' command indicates the _internal_
  5713. name of the output DLL. If '<name>' does not include a suffix,
  5714. the default library suffix, '.DLL' is appended.
  5715. When the .DEF file is used to build an application, rather
  5716. than a library, the 'NAME <name>' command should be used
  5717. instead of 'LIBRARY'. If '<name>' does not include a suffix,
  5718. the default executable suffix, '.EXE' is appended.
  5719. With either 'LIBRARY <name>' or 'NAME <name>' the optional
  5720. specification 'BASE = <number>' may be used to specify a
  5721. non-default base address for the image.
  5722. If neither 'LIBRARY <name>' nor 'NAME <name>' is specified, or
  5723. they specify an empty string, the internal name is the same as
  5724. the filename specified on the command line.
  5725. The complete specification of an export symbol is:
  5726. EXPORTS
  5727. ( ( ( <name1> [ = <name2> ] )
  5728. | ( <name1> = <module-name> . <external-name>))
  5729. [ @ <integer> ] [NONAME] [DATA] [CONSTANT] [PRIVATE] [== <name3>] ) *
  5730. Declares '<name1>' as an exported symbol from the DLL, or
  5731. declares '<name1>' as an exported alias for '<name2>'; or
  5732. declares '<name1>' as a "forward" alias for the symbol
  5733. '<external-name>' in the DLL '<module-name>'. Optionally, the
  5734. symbol may be exported by the specified ordinal '<integer>'
  5735. alias. The optional '<name3>' is the to be used string in
  5736. import/export table for the symbol.
  5737. The optional keywords that follow the declaration indicate:
  5738. 'NONAME': Do not put the symbol name in the DLL's export
  5739. table. It will still be exported by its ordinal alias (either
  5740. the value specified by the .def specification or, otherwise,
  5741. the value assigned by the linker). The symbol name, however,
  5742. does remain visible in the import library (if any), unless
  5743. 'PRIVATE' is also specified.
  5744. 'DATA': The symbol is a variable or object, rather than a
  5745. function. The import lib will export only an indirect
  5746. reference to 'foo' as the symbol '_imp__foo' (ie, 'foo' must
  5747. be resolved as '*_imp__foo').
  5748. 'CONSTANT': Like 'DATA', but put the undecorated 'foo' as well
  5749. as '_imp__foo' into the import library. Both refer to the
  5750. read-only import address table's pointer to the variable, not
  5751. to the variable itself. This can be dangerous. If the user
  5752. code fails to add the 'dllimport' attribute and also fails to
  5753. explicitly add the extra indirection that the use of the
  5754. attribute enforces, the application will behave unexpectedly.
  5755. 'PRIVATE': Put the symbol in the DLL's export table, but do
  5756. not put it into the static import library used to resolve
  5757. imports at link time. The symbol can still be imported using
  5758. the 'LoadLibrary/GetProcAddress' API at runtime or by using
  5759. the GNU ld extension of linking directly to the DLL without an
  5760. import library.
  5761. See ld/deffilep.y in the binutils sources for the full
  5762. specification of other DEF file statements
  5763. While linking a shared dll, 'ld' is able to create a DEF file
  5764. with the '--output-def <file>' command-line option.
  5765. _Using decorations_
  5766. Another way of marking symbols for export is to modify the
  5767. source code itself, so that when building the DLL each symbol
  5768. to be exported is declared as:
  5769. __declspec(dllexport) int a_variable
  5770. __declspec(dllexport) void a_function(int with_args)
  5771. All such symbols will be exported from the DLL. If, however,
  5772. any of the object files in the DLL contain symbols decorated
  5773. in this way, then the normal auto-export behavior is disabled,
  5774. unless the '--export-all-symbols' option is also used.
  5775. Note that object files that wish to access these symbols must
  5776. _not_ decorate them with dllexport. Instead, they should use
  5777. dllimport, instead:
  5778. __declspec(dllimport) int a_variable
  5779. __declspec(dllimport) void a_function(int with_args)
  5780. This complicates the structure of library header files,
  5781. because when included by the library itself the header must
  5782. declare the variables and functions as dllexport, but when
  5783. included by client code the header must declare them as
  5784. dllimport. There are a number of idioms that are typically
  5785. used to do this; often client code can omit the __declspec()
  5786. declaration completely. See '--enable-auto-import' and
  5787. 'automatic data imports' for more information.
  5788. _automatic data imports_
  5789. The standard Windows dll format supports data imports from dlls
  5790. only by adding special decorations (dllimport/dllexport), which let
  5791. the compiler produce specific assembler instructions to deal with
  5792. this issue. This increases the effort necessary to port existing
  5793. Un*x code to these platforms, especially for large c++ libraries
  5794. and applications. The auto-import feature, which was initially
  5795. provided by Paul Sokolovsky, allows one to omit the decorations to
  5796. achieve a behavior that conforms to that on POSIX/Un*x platforms.
  5797. This feature is enabled with the '--enable-auto-import'
  5798. command-line option, although it is enabled by default on
  5799. cygwin/mingw. The '--enable-auto-import' option itself now serves
  5800. mainly to suppress any warnings that are ordinarily emitted when
  5801. linked objects trigger the feature's use.
  5802. auto-import of variables does not always work flawlessly without
  5803. additional assistance. Sometimes, you will see this message
  5804. "variable '<var>' can't be auto-imported. Please read the
  5805. documentation for ld's '--enable-auto-import' for details."
  5806. The '--enable-auto-import' documentation explains why this error
  5807. occurs, and several methods that can be used to overcome this
  5808. difficulty. One of these methods is the _runtime pseudo-relocs_
  5809. feature, described below.
  5810. For complex variables imported from DLLs (such as structs or
  5811. classes), object files typically contain a base address for the
  5812. variable and an offset (_addend_) within the variable-to specify a
  5813. particular field or public member, for instance. Unfortunately,
  5814. the runtime loader used in win32 environments is incapable of
  5815. fixing these references at runtime without the additional
  5816. information supplied by dllimport/dllexport decorations. The
  5817. standard auto-import feature described above is unable to resolve
  5818. these references.
  5819. The '--enable-runtime-pseudo-relocs' switch allows these references
  5820. to be resolved without error, while leaving the task of adjusting
  5821. the references themselves (with their non-zero addends) to
  5822. specialized code provided by the runtime environment. Recent
  5823. versions of the cygwin and mingw environments and compilers provide
  5824. this runtime support; older versions do not. However, the support
  5825. is only necessary on the developer's platform; the compiled result
  5826. will run without error on an older system.
  5827. '--enable-runtime-pseudo-relocs' is not the default; it must be
  5828. explicitly enabled as needed.
  5829. _direct linking to a dll_
  5830. The cygwin/mingw ports of 'ld' support the direct linking,
  5831. including data symbols, to a dll without the usage of any import
  5832. libraries. This is much faster and uses much less memory than does
  5833. the traditional import library method, especially when linking
  5834. large libraries or applications. When 'ld' creates an import lib,
  5835. each function or variable exported from the dll is stored in its
  5836. own bfd, even though a single bfd could contain many exports. The
  5837. overhead involved in storing, loading, and processing so many bfd's
  5838. is quite large, and explains the tremendous time, memory, and
  5839. storage needed to link against particularly large or complex
  5840. libraries when using import libs.
  5841. Linking directly to a dll uses no extra command-line switches other
  5842. than '-L' and '-l', because 'ld' already searches for a number of
  5843. names to match each library. All that is needed from the
  5844. developer's perspective is an understanding of this search, in
  5845. order to force ld to select the dll instead of an import library.
  5846. For instance, when ld is called with the argument '-lxxx' it will
  5847. attempt to find, in the first directory of its search path,
  5848. libxxx.dll.a
  5849. xxx.dll.a
  5850. libxxx.a
  5851. xxx.lib
  5852. libxxx.lib
  5853. cygxxx.dll (*)
  5854. libxxx.dll
  5855. xxx.dll
  5856. before moving on to the next directory in the search path.
  5857. (*) Actually, this is not 'cygxxx.dll' but in fact is
  5858. '<prefix>xxx.dll', where '<prefix>' is set by the 'ld' option
  5859. '--dll-search-prefix=<prefix>'. In the case of cygwin, the
  5860. standard gcc spec file includes '--dll-search-prefix=cyg', so in
  5861. effect we actually search for 'cygxxx.dll'.
  5862. Other win32-based unix environments, such as mingw or pw32, may use
  5863. other '<prefix>'es, although at present only cygwin makes use of
  5864. this feature. It was originally intended to help avoid name
  5865. conflicts among dll's built for the various win32/un*x
  5866. environments, so that (for example) two versions of a zlib dll
  5867. could coexist on the same machine.
  5868. The generic cygwin/mingw path layout uses a 'bin' directory for
  5869. applications and dll's and a 'lib' directory for the import
  5870. libraries (using cygwin nomenclature):
  5871. bin/
  5872. cygxxx.dll
  5873. lib/
  5874. libxxx.dll.a (in case of dll's)
  5875. libxxx.a (in case of static archive)
  5876. Linking directly to a dll without using the import library can be
  5877. done two ways:
  5878. 1. Use the dll directly by adding the 'bin' path to the link line
  5879. gcc -Wl,-verbose -o a.exe -L../bin/ -lxxx
  5880. However, as the dll's often have version numbers appended to their
  5881. names ('cygncurses-5.dll') this will often fail, unless one
  5882. specifies '-L../bin -lncurses-5' to include the version. Import
  5883. libs are generally not versioned, and do not have this difficulty.
  5884. 2. Create a symbolic link from the dll to a file in the 'lib'
  5885. directory according to the above mentioned search pattern. This
  5886. should be used to avoid unwanted changes in the tools needed for
  5887. making the app/dll.
  5888. ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a]
  5889. Then you can link without any make environment changes.
  5890. gcc -Wl,-verbose -o a.exe -L../lib/ -lxxx
  5891. This technique also avoids the version number problems, because the
  5892. following is perfectly legal
  5893. bin/
  5894. cygxxx-5.dll
  5895. lib/
  5896. libxxx.dll.a -> ../bin/cygxxx-5.dll
  5897. Linking directly to a dll without using an import lib will work
  5898. even when auto-import features are exercised, and even when
  5899. '--enable-runtime-pseudo-relocs' is used.
  5900. Given the improvements in speed and memory usage, one might
  5901. justifiably wonder why import libraries are used at all. There are
  5902. three reasons:
  5903. 1. Until recently, the link-directly-to-dll functionality did
  5904. _not_ work with auto-imported data.
  5905. 2. Sometimes it is necessary to include pure static objects within
  5906. the import library (which otherwise contains only bfd's for
  5907. indirection symbols that point to the exports of a dll). Again,
  5908. the import lib for the cygwin kernel makes use of this ability, and
  5909. it is not possible to do this without an import lib.
  5910. 3. Symbol aliases can only be resolved using an import lib. This
  5911. is critical when linking against OS-supplied dll's (eg, the win32
  5912. API) in which symbols are usually exported as undecorated aliases
  5913. of their stdcall-decorated assembly names.
  5914. So, import libs are not going away. But the ability to replace
  5915. true import libs with a simple symbolic link to (or a copy of) a
  5916. dll, in many cases, is a useful addition to the suite of tools
  5917. binutils makes available to the win32 developer. Given the massive
  5918. improvements in memory requirements during linking, storage
  5919. requirements, and linking speed, we expect that many developers
  5920. will soon begin to use this feature whenever possible.
  5921. _symbol aliasing_
  5922. _adding additional names_
  5923. Sometimes, it is useful to export symbols with additional
  5924. names. A symbol 'foo' will be exported as 'foo', but it can
  5925. also be exported as '_foo' by using special directives in the
  5926. DEF file when creating the dll. This will affect also the
  5927. optional created import library. Consider the following DEF
  5928. file:
  5929. LIBRARY "xyz.dll" BASE=0x61000000
  5930. EXPORTS
  5931. foo
  5932. _foo = foo
  5933. The line '_foo = foo' maps the symbol 'foo' to '_foo'.
  5934. Another method for creating a symbol alias is to create it in
  5935. the source code using the "weak" attribute:
  5936. void foo () { /* Do something. */; }
  5937. void _foo () __attribute__ ((weak, alias ("foo")));
  5938. See the gcc manual for more information about attributes and
  5939. weak symbols.
  5940. _renaming symbols_
  5941. Sometimes it is useful to rename exports. For instance, the
  5942. cygwin kernel does this regularly. A symbol '_foo' can be
  5943. exported as 'foo' but not as '_foo' by using special
  5944. directives in the DEF file. (This will also affect the import
  5945. library, if it is created). In the following example:
  5946. LIBRARY "xyz.dll" BASE=0x61000000
  5947. EXPORTS
  5948. _foo = foo
  5949. The line '_foo = foo' maps the exported symbol 'foo' to
  5950. '_foo'.
  5951. Note: using a DEF file disables the default auto-export behavior,
  5952. unless the '--export-all-symbols' command-line option is used. If,
  5953. however, you are trying to rename symbols, then you should list
  5954. _all_ desired exports in the DEF file, including the symbols that
  5955. are not being renamed, and do _not_ use the '--export-all-symbols'
  5956. option. If you list only the renamed symbols in the DEF file, and
  5957. use '--export-all-symbols' to handle the other symbols, then the
  5958. both the new names _and_ the original names for the renamed symbols
  5959. will be exported. In effect, you'd be aliasing those symbols, not
  5960. renaming them, which is probably not what you wanted.
  5961. _weak externals_
  5962. The Windows object format, PE, specifies a form of weak symbols
  5963. called weak externals. When a weak symbol is linked and the symbol
  5964. is not defined, the weak symbol becomes an alias for some other
  5965. symbol. There are three variants of weak externals:
  5966. * Definition is searched for in objects and libraries,
  5967. historically called lazy externals.
  5968. * Definition is searched for only in other objects, not in
  5969. libraries. This form is not presently implemented.
  5970. * No search; the symbol is an alias. This form is not presently
  5971. implemented.
  5972. As a GNU extension, weak symbols that do not specify an alternate
  5973. symbol are supported. If the symbol is undefined when linking, the
  5974. symbol uses a default value.
  5975. _aligned common symbols_
  5976. As a GNU extension to the PE file format, it is possible to specify
  5977. the desired alignment for a common symbol. This information is
  5978. conveyed from the assembler or compiler to the linker by means of
  5979. GNU-specific commands carried in the object file's '.drectve'
  5980. section, which are recognized by 'ld' and respected when laying out
  5981. the common symbols. Native tools will be able to process object
  5982. files employing this GNU extension, but will fail to respect the
  5983. alignment instructions, and may issue noisy warnings about unknown
  5984. linker directives.
  5985. 
  5986. File: ld.info, Node: Xtensa, Prev: WIN32, Up: Machine Dependent
  5987. 5.17 'ld' and Xtensa Processors
  5988. ===============================
  5989. The default 'ld' behavior for Xtensa processors is to interpret
  5990. 'SECTIONS' commands so that lists of explicitly named sections in a
  5991. specification with a wildcard file will be interleaved when necessary to
  5992. keep literal pools within the range of PC-relative load offsets. For
  5993. example, with the command:
  5994. SECTIONS
  5995. {
  5996. .text : {
  5997. *(.literal .text)
  5998. }
  5999. }
  6000. 'ld' may interleave some of the '.literal' and '.text' sections from
  6001. different object files to ensure that the literal pools are within the
  6002. range of PC-relative load offsets. A valid interleaving might place the
  6003. '.literal' sections from an initial group of files followed by the
  6004. '.text' sections of that group of files. Then, the '.literal' sections
  6005. from the rest of the files and the '.text' sections from the rest of the
  6006. files would follow.
  6007. Relaxation is enabled by default for the Xtensa version of 'ld' and
  6008. provides two important link-time optimizations. The first optimization
  6009. is to combine identical literal values to reduce code size. A redundant
  6010. literal will be removed and all the 'L32R' instructions that use it will
  6011. be changed to reference an identical literal, as long as the location of
  6012. the replacement literal is within the offset range of all the 'L32R'
  6013. instructions. The second optimization is to remove unnecessary overhead
  6014. from assembler-generated "longcall" sequences of 'L32R'/'CALLXN' when
  6015. the target functions are within range of direct 'CALLN' instructions.
  6016. For each of these cases where an indirect call sequence can be
  6017. optimized to a direct call, the linker will change the 'CALLXN'
  6018. instruction to a 'CALLN' instruction, remove the 'L32R' instruction, and
  6019. remove the literal referenced by the 'L32R' instruction if it is not
  6020. used for anything else. Removing the 'L32R' instruction always reduces
  6021. code size but can potentially hurt performance by changing the alignment
  6022. of subsequent branch targets. By default, the linker will always
  6023. preserve alignments, either by switching some instructions between
  6024. 24-bit encodings and the equivalent density instructions or by inserting
  6025. a no-op in place of the 'L32R' instruction that was removed. If code
  6026. size is more important than performance, the '--size-opt' option can be
  6027. used to prevent the linker from widening density instructions or
  6028. inserting no-ops, except in a few cases where no-ops are required for
  6029. correctness.
  6030. The following Xtensa-specific command-line options can be used to
  6031. control the linker:
  6032. '--size-opt'
  6033. When optimizing indirect calls to direct calls, optimize for code
  6034. size more than performance. With this option, the linker will not
  6035. insert no-ops or widen density instructions to preserve branch
  6036. target alignment. There may still be some cases where no-ops are
  6037. required to preserve the correctness of the code.
  6038. '--abi-windowed'
  6039. '--abi-call0'
  6040. Choose ABI for the output object and for the generated PLT code.
  6041. PLT code inserted by the linker must match ABI of the output object
  6042. because windowed and call0 ABI use incompatible function call
  6043. conventions. Default ABI is chosen by the ABI tag in the
  6044. '.xtensa.info' section of the first input object. A warning is
  6045. issued if ABI tags of input objects do not match each other or the
  6046. chosen output object ABI.
  6047. 
  6048. File: ld.info, Node: BFD, Next: Reporting Bugs, Prev: Machine Dependent, Up: Top
  6049. 6 BFD
  6050. *****
  6051. The linker accesses object and archive files using the BFD libraries.
  6052. These libraries allow the linker to use the same routines to operate on
  6053. object files whatever the object file format. A different object file
  6054. format can be supported simply by creating a new BFD back end and adding
  6055. it to the library. To conserve runtime memory, however, the linker and
  6056. associated tools are usually configured to support only a subset of the
  6057. object file formats available. You can use 'objdump -i' (*note objdump:
  6058. (binutils.info)objdump.) to list all the formats available for your
  6059. configuration.
  6060. As with most implementations, BFD is a compromise between several
  6061. conflicting requirements. The major factor influencing BFD design was
  6062. efficiency: any time used converting between formats is time which would
  6063. not have been spent had BFD not been involved. This is partly offset by
  6064. abstraction payback; since BFD simplifies applications and back ends,
  6065. more time and care may be spent optimizing algorithms for a greater
  6066. speed.
  6067. One minor artifact of the BFD solution which you should bear in mind
  6068. is the potential for information loss. There are two places where
  6069. useful information can be lost using the BFD mechanism: during
  6070. conversion and during output. *Note BFD information loss::.
  6071. * Menu:
  6072. * BFD outline:: How it works: an outline of BFD
  6073. 
  6074. File: ld.info, Node: BFD outline, Up: BFD
  6075. 6.1 How It Works: An Outline of BFD
  6076. ===================================
  6077. When an object file is opened, BFD subroutines automatically determine
  6078. the format of the input object file. They then build a descriptor in
  6079. memory with pointers to routines that will be used to access elements of
  6080. the object file's data structures.
  6081. As different information from the object files is required, BFD reads
  6082. from different sections of the file and processes them. For example, a
  6083. very common operation for the linker is processing symbol tables. Each
  6084. BFD back end provides a routine for converting between the object file's
  6085. representation of symbols and an internal canonical format. When the
  6086. linker asks for the symbol table of an object file, it calls through a
  6087. memory pointer to the routine from the relevant BFD back end which reads
  6088. and converts the table into a canonical form. The linker then operates
  6089. upon the canonical form. When the link is finished and the linker
  6090. writes the output file's symbol table, another BFD back end routine is
  6091. called to take the newly created symbol table and convert it into the
  6092. chosen output format.
  6093. * Menu:
  6094. * BFD information loss:: Information Loss
  6095. * Canonical format:: The BFD canonical object-file format
  6096. 
  6097. File: ld.info, Node: BFD information loss, Next: Canonical format, Up: BFD outline
  6098. 6.1.1 Information Loss
  6099. ----------------------
  6100. _Information can be lost during output._ The output formats supported
  6101. by BFD do not provide identical facilities, and information which can be
  6102. described in one form has nowhere to go in another format. One example
  6103. of this is alignment information in 'b.out'. There is nowhere in an
  6104. 'a.out' format file to store alignment information on the contained
  6105. data, so when a file is linked from 'b.out' and an 'a.out' image is
  6106. produced, alignment information will not propagate to the output file.
  6107. (The linker will still use the alignment information internally, so the
  6108. link is performed correctly).
  6109. Another example is COFF section names. COFF files may contain an
  6110. unlimited number of sections, each one with a textual section name. If
  6111. the target of the link is a format which does not have many sections
  6112. (e.g., 'a.out') or has sections without names (e.g., the Oasys format),
  6113. the link cannot be done simply. You can circumvent this problem by
  6114. describing the desired input-to-output section mapping with the linker
  6115. command language.
  6116. _Information can be lost during canonicalization._ The BFD internal
  6117. canonical form of the external formats is not exhaustive; there are
  6118. structures in input formats for which there is no direct representation
  6119. internally. This means that the BFD back ends cannot maintain all
  6120. possible data richness through the transformation between external to
  6121. internal and back to external formats.
  6122. This limitation is only a problem when an application reads one
  6123. format and writes another. Each BFD back end is responsible for
  6124. maintaining as much data as possible, and the internal BFD canonical
  6125. form has structures which are opaque to the BFD core, and exported only
  6126. to the back ends. When a file is read in one format, the canonical form
  6127. is generated for BFD and the application. At the same time, the back
  6128. end saves away any information which may otherwise be lost. If the data
  6129. is then written back in the same format, the back end routine will be
  6130. able to use the canonical form provided by the BFD core as well as the
  6131. information it prepared earlier. Since there is a great deal of
  6132. commonality between back ends, there is no information lost when linking
  6133. or copying big endian COFF to little endian COFF, or 'a.out' to 'b.out'.
  6134. When a mixture of formats is linked, the information is only lost from
  6135. the files whose format differs from the destination.
  6136. 
  6137. File: ld.info, Node: Canonical format, Prev: BFD information loss, Up: BFD outline
  6138. 6.1.2 The BFD canonical object-file format
  6139. ------------------------------------------
  6140. The greatest potential for loss of information occurs when there is the
  6141. least overlap between the information provided by the source format,
  6142. that stored by the canonical format, and that needed by the destination
  6143. format. A brief description of the canonical form may help you
  6144. understand which kinds of data you can count on preserving across
  6145. conversions.
  6146. _files_
  6147. Information stored on a per-file basis includes target machine
  6148. architecture, particular implementation format type, a demand
  6149. pageable bit, and a write protected bit. Information like Unix
  6150. magic numbers is not stored here--only the magic numbers' meaning,
  6151. so a 'ZMAGIC' file would have both the demand pageable bit and the
  6152. write protected text bit set. The byte order of the target is
  6153. stored on a per-file basis, so that big- and little-endian object
  6154. files may be used with one another.
  6155. _sections_
  6156. Each section in the input file contains the name of the section,
  6157. the section's original address in the object file, size and
  6158. alignment information, various flags, and pointers into other BFD
  6159. data structures.
  6160. _symbols_
  6161. Each symbol contains a pointer to the information for the object
  6162. file which originally defined it, its name, its value, and various
  6163. flag bits. When a BFD back end reads in a symbol table, it
  6164. relocates all symbols to make them relative to the base of the
  6165. section where they were defined. Doing this ensures that each
  6166. symbol points to its containing section. Each symbol also has a
  6167. varying amount of hidden private data for the BFD back end. Since
  6168. the symbol points to the original file, the private data format for
  6169. that symbol is accessible. 'ld' can operate on a collection of
  6170. symbols of wildly different formats without problems.
  6171. Normal global and simple local symbols are maintained on output, so
  6172. an output file (no matter its format) will retain symbols pointing
  6173. to functions and to global, static, and common variables. Some
  6174. symbol information is not worth retaining; in 'a.out', type
  6175. information is stored in the symbol table as long symbol names.
  6176. This information would be useless to most COFF debuggers; the
  6177. linker has command-line switches to allow users to throw it away.
  6178. There is one word of type information within the symbol, so if the
  6179. format supports symbol type information within symbols (for
  6180. example, COFF, Oasys) and the type is simple enough to fit within
  6181. one word (nearly everything but aggregates), the information will
  6182. be preserved.
  6183. _relocation level_
  6184. Each canonical BFD relocation record contains a pointer to the
  6185. symbol to relocate to, the offset of the data to relocate, the
  6186. section the data is in, and a pointer to a relocation type
  6187. descriptor. Relocation is performed by passing messages through
  6188. the relocation type descriptor and the symbol pointer. Therefore,
  6189. relocations can be performed on output data using a relocation
  6190. method that is only available in one of the input formats. For
  6191. instance, Oasys provides a byte relocation format. A relocation
  6192. record requesting this relocation type would point indirectly to a
  6193. routine to perform this, so the relocation may be performed on a
  6194. byte being written to a 68k COFF file, even though 68k COFF has no
  6195. such relocation type.
  6196. _line numbers_
  6197. Object formats can contain, for debugging purposes, some form of
  6198. mapping between symbols, source line numbers, and addresses in the
  6199. output file. These addresses have to be relocated along with the
  6200. symbol information. Each symbol with an associated list of line
  6201. number records points to the first record of the list. The head of
  6202. a line number list consists of a pointer to the symbol, which
  6203. allows finding out the address of the function whose line number is
  6204. being described. The rest of the list is made up of pairs: offsets
  6205. into the section and line numbers. Any format which can simply
  6206. derive this information can pass it successfully between formats.
  6207. 
  6208. File: ld.info, Node: Reporting Bugs, Next: MRI, Prev: BFD, Up: Top
  6209. 7 Reporting Bugs
  6210. ****************
  6211. Your bug reports play an essential role in making 'ld' reliable.
  6212. Reporting a bug may help you by bringing a solution to your problem,
  6213. or it may not. But in any case the principal function of a bug report
  6214. is to help the entire community by making the next version of 'ld' work
  6215. better. Bug reports are your contribution to the maintenance of 'ld'.
  6216. In order for a bug report to serve its purpose, you must include the
  6217. information that enables us to fix the bug.
  6218. * Menu:
  6219. * Bug Criteria:: Have you found a bug?
  6220. * Bug Reporting:: How to report bugs
  6221. 
  6222. File: ld.info, Node: Bug Criteria, Next: Bug Reporting, Up: Reporting Bugs
  6223. 7.1 Have You Found a Bug?
  6224. =========================
  6225. If you are not sure whether you have found a bug, here are some
  6226. guidelines:
  6227. * If the linker gets a fatal signal, for any input whatever, that is
  6228. a 'ld' bug. Reliable linkers never crash.
  6229. * If 'ld' produces an error message for valid input, that is a bug.
  6230. * If 'ld' does not produce an error message for invalid input, that
  6231. may be a bug. In the general case, the linker can not verify that
  6232. object files are correct.
  6233. * If you are an experienced user of linkers, your suggestions for
  6234. improvement of 'ld' are welcome in any case.
  6235. 
  6236. File: ld.info, Node: Bug Reporting, Prev: Bug Criteria, Up: Reporting Bugs
  6237. 7.2 How to Report Bugs
  6238. ======================
  6239. A number of companies and individuals offer support for GNU products.
  6240. If you obtained 'ld' from a support organization, we recommend you
  6241. contact that organization first.
  6242. You can find contact information for many support companies and
  6243. individuals in the file 'etc/SERVICE' in the GNU Emacs distribution.
  6244. Otherwise, send bug reports for 'ld' to
  6245. <https://sourceware.org/bugzilla/>.
  6246. The fundamental principle of reporting bugs usefully is this: *report
  6247. all the facts*. If you are not sure whether to state a fact or leave it
  6248. out, state it!
  6249. Often people omit facts because they think they know what causes the
  6250. problem and assume that some details do not matter. Thus, you might
  6251. assume that the name of a symbol you use in an example does not matter.
  6252. Well, probably it does not, but one cannot be sure. Perhaps the bug is
  6253. a stray memory reference which happens to fetch from the location where
  6254. that name is stored in memory; perhaps, if the name were different, the
  6255. contents of that location would fool the linker into doing the right
  6256. thing despite the bug. Play it safe and give a specific, complete
  6257. example. That is the easiest thing for you to do, and the most helpful.
  6258. Keep in mind that the purpose of a bug report is to enable us to fix
  6259. the bug if it is new to us. Therefore, always write your bug reports on
  6260. the assumption that the bug has not been reported previously.
  6261. Sometimes people give a few sketchy facts and ask, "Does this ring a
  6262. bell?" This cannot help us fix a bug, so it is basically useless. We
  6263. respond by asking for enough details to enable us to investigate. You
  6264. might as well expedite matters by sending them to begin with.
  6265. To enable us to fix the bug, you should include all these things:
  6266. * The version of 'ld'. 'ld' announces it if you start it with the
  6267. '--version' argument.
  6268. Without this, we will not know whether there is any point in
  6269. looking for the bug in the current version of 'ld'.
  6270. * Any patches you may have applied to the 'ld' source, including any
  6271. patches made to the 'BFD' library.
  6272. * The type of machine you are using, and the operating system name
  6273. and version number.
  6274. * What compiler (and its version) was used to compile 'ld'--e.g.
  6275. "'gcc-2.7'".
  6276. * The command arguments you gave the linker to link your example and
  6277. observe the bug. To guarantee you will not omit something
  6278. important, list them all. A copy of the Makefile (or the output
  6279. from make) is sufficient.
  6280. If we were to try to guess the arguments, we would probably guess
  6281. wrong and then we might not encounter the bug.
  6282. * A complete input file, or set of input files, that will reproduce
  6283. the bug. It is generally most helpful to send the actual object
  6284. files provided that they are reasonably small. Say no more than
  6285. 10K. For bigger files you can either make them available by FTP or
  6286. HTTP or else state that you are willing to send the object file(s)
  6287. to whomever requests them. (Note - your email will be going to a
  6288. mailing list, so we do not want to clog it up with large
  6289. attachments). But small attachments are best.
  6290. If the source files were assembled using 'gas' or compiled using
  6291. 'gcc', then it may be OK to send the source files rather than the
  6292. object files. In this case, be sure to say exactly what version of
  6293. 'gas' or 'gcc' was used to produce the object files. Also say how
  6294. 'gas' or 'gcc' were configured.
  6295. * A description of what behavior you observe that you believe is
  6296. incorrect. For example, "It gets a fatal signal."
  6297. Of course, if the bug is that 'ld' gets a fatal signal, then we
  6298. will certainly notice it. But if the bug is incorrect output, we
  6299. might not notice unless it is glaringly wrong. You might as well
  6300. not give us a chance to make a mistake.
  6301. Even if the problem you experience is a fatal signal, you should
  6302. still say so explicitly. Suppose something strange is going on,
  6303. such as, your copy of 'ld' is out of sync, or you have encountered
  6304. a bug in the C library on your system. (This has happened!) Your
  6305. copy might crash and ours would not. If you told us to expect a
  6306. crash, then when ours fails to crash, we would know that the bug
  6307. was not happening for us. If you had not told us to expect a
  6308. crash, then we would not be able to draw any conclusion from our
  6309. observations.
  6310. * If you wish to suggest changes to the 'ld' source, send us context
  6311. diffs, as generated by 'diff' with the '-u', '-c', or '-p' option.
  6312. Always send diffs from the old file to the new file. If you even
  6313. discuss something in the 'ld' source, refer to it by context, not
  6314. by line number.
  6315. The line numbers in our development sources will not match those in
  6316. your sources. Your line numbers would convey no useful information
  6317. to us.
  6318. Here are some things that are not necessary:
  6319. * A description of the envelope of the bug.
  6320. Often people who encounter a bug spend a lot of time investigating
  6321. which changes to the input file will make the bug go away and which
  6322. changes will not affect it.
  6323. This is often time consuming and not very useful, because the way
  6324. we will find the bug is by running a single example under the
  6325. debugger with breakpoints, not by pure deduction from a series of
  6326. examples. We recommend that you save your time for something else.
  6327. Of course, if you can find a simpler example to report _instead_ of
  6328. the original one, that is a convenience for us. Errors in the
  6329. output will be easier to spot, running under the debugger will take
  6330. less time, and so on.
  6331. However, simplification is not vital; if you do not want to do
  6332. this, report the bug anyway and send us the entire test case you
  6333. used.
  6334. * A patch for the bug.
  6335. A patch for the bug does help us if it is a good one. But do not
  6336. omit the necessary information, such as the test case, on the
  6337. assumption that a patch is all we need. We might see problems with
  6338. your patch and decide to fix the problem another way, or we might
  6339. not understand it at all.
  6340. Sometimes with a program as complicated as 'ld' it is very hard to
  6341. construct an example that will make the program follow a certain
  6342. path through the code. If you do not send us the example, we will
  6343. not be able to construct one, so we will not be able to verify that
  6344. the bug is fixed.
  6345. And if we cannot understand what bug you are trying to fix, or why
  6346. your patch should be an improvement, we will not install it. A
  6347. test case will help us to understand.
  6348. * A guess about what the bug is or what it depends on.
  6349. Such guesses are usually wrong. Even we cannot guess right about
  6350. such things without first using the debugger to find the facts.
  6351. 
  6352. File: ld.info, Node: MRI, Next: GNU Free Documentation License, Prev: Reporting Bugs, Up: Top
  6353. Appendix A MRI Compatible Script Files
  6354. **************************************
  6355. To aid users making the transition to GNU 'ld' from the MRI linker, 'ld'
  6356. can use MRI compatible linker scripts as an alternative to the more
  6357. general-purpose linker scripting language described in *note Scripts::.
  6358. MRI compatible linker scripts have a much simpler command set than the
  6359. scripting language otherwise used with 'ld'. GNU 'ld' supports the most
  6360. commonly used MRI linker commands; these commands are described here.
  6361. In general, MRI scripts aren't of much use with the 'a.out' object
  6362. file format, since it only has three sections and MRI scripts lack some
  6363. features to make use of them.
  6364. You can specify a file containing an MRI-compatible script using the
  6365. '-c' command-line option.
  6366. Each command in an MRI-compatible script occupies its own line; each
  6367. command line starts with the keyword that identifies the command (though
  6368. blank lines are also allowed for punctuation). If a line of an
  6369. MRI-compatible script begins with an unrecognized keyword, 'ld' issues a
  6370. warning message, but continues processing the script.
  6371. Lines beginning with '*' are comments.
  6372. You can write these commands using all upper-case letters, or all
  6373. lower case; for example, 'chip' is the same as 'CHIP'. The following
  6374. list shows only the upper-case form of each command.
  6375. 'ABSOLUTE SECNAME'
  6376. 'ABSOLUTE SECNAME, SECNAME, ... SECNAME'
  6377. Normally, 'ld' includes in the output file all sections from all
  6378. the input files. However, in an MRI-compatible script, you can use
  6379. the 'ABSOLUTE' command to restrict the sections that will be
  6380. present in your output program. If the 'ABSOLUTE' command is used
  6381. at all in a script, then only the sections named explicitly in
  6382. 'ABSOLUTE' commands will appear in the linker output. You can
  6383. still use other input sections (whatever you select on the command
  6384. line, or using 'LOAD') to resolve addresses in the output file.
  6385. 'ALIAS OUT-SECNAME, IN-SECNAME'
  6386. Use this command to place the data from input section IN-SECNAME in
  6387. a section called OUT-SECNAME in the linker output file.
  6388. IN-SECNAME may be an integer.
  6389. 'ALIGN SECNAME = EXPRESSION'
  6390. Align the section called SECNAME to EXPRESSION. The EXPRESSION
  6391. should be a power of two.
  6392. 'BASE EXPRESSION'
  6393. Use the value of EXPRESSION as the lowest address (other than
  6394. absolute addresses) in the output file.
  6395. 'CHIP EXPRESSION'
  6396. 'CHIP EXPRESSION, EXPRESSION'
  6397. This command does nothing; it is accepted only for compatibility.
  6398. 'END'
  6399. This command does nothing whatever; it's only accepted for
  6400. compatibility.
  6401. 'FORMAT OUTPUT-FORMAT'
  6402. Similar to the 'OUTPUT_FORMAT' command in the more general linker
  6403. language, but restricted to S-records, if OUTPUT-FORMAT is 'S'
  6404. 'LIST ANYTHING...'
  6405. Print (to the standard output file) a link map, as produced by the
  6406. 'ld' command-line option '-M'.
  6407. The keyword 'LIST' may be followed by anything on the same line,
  6408. with no change in its effect.
  6409. 'LOAD FILENAME'
  6410. 'LOAD FILENAME, FILENAME, ... FILENAME'
  6411. Include one or more object file FILENAME in the link; this has the
  6412. same effect as specifying FILENAME directly on the 'ld' command
  6413. line.
  6414. 'NAME OUTPUT-NAME'
  6415. OUTPUT-NAME is the name for the program produced by 'ld'; the
  6416. MRI-compatible command 'NAME' is equivalent to the command-line
  6417. option '-o' or the general script language command 'OUTPUT'.
  6418. 'ORDER SECNAME, SECNAME, ... SECNAME'
  6419. 'ORDER SECNAME SECNAME SECNAME'
  6420. Normally, 'ld' orders the sections in its output file in the order
  6421. in which they first appear in the input files. In an
  6422. MRI-compatible script, you can override this ordering with the
  6423. 'ORDER' command. The sections you list with 'ORDER' will appear
  6424. first in your output file, in the order specified.
  6425. 'PUBLIC NAME=EXPRESSION'
  6426. 'PUBLIC NAME,EXPRESSION'
  6427. 'PUBLIC NAME EXPRESSION'
  6428. Supply a value (EXPRESSION) for external symbol NAME used in the
  6429. linker input files.
  6430. 'SECT SECNAME, EXPRESSION'
  6431. 'SECT SECNAME=EXPRESSION'
  6432. 'SECT SECNAME EXPRESSION'
  6433. You can use any of these three forms of the 'SECT' command to
  6434. specify the start address (EXPRESSION) for section SECNAME. If you
  6435. have more than one 'SECT' statement for the same SECNAME, only the
  6436. _first_ sets the start address.
  6437. 
  6438. File: ld.info, Node: GNU Free Documentation License, Next: LD Index, Prev: MRI, Up: Top
  6439. Appendix B GNU Free Documentation License
  6440. *****************************************
  6441. Version 1.3, 3 November 2008
  6442. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  6443. <http://fsf.org/>
  6444. Everyone is permitted to copy and distribute verbatim copies
  6445. of this license document, but changing it is not allowed.
  6446. 0. PREAMBLE
  6447. The purpose of this License is to make a manual, textbook, or other
  6448. functional and useful document "free" in the sense of freedom: to
  6449. assure everyone the effective freedom to copy and redistribute it,
  6450. with or without modifying it, either commercially or
  6451. noncommercially. Secondarily, this License preserves for the
  6452. author and publisher a way to get credit for their work, while not
  6453. being considered responsible for modifications made by others.
  6454. This License is a kind of "copyleft", which means that derivative
  6455. works of the document must themselves be free in the same sense.
  6456. It complements the GNU General Public License, which is a copyleft
  6457. license designed for free software.
  6458. We have designed this License in order to use it for manuals for
  6459. free software, because free software needs free documentation: a
  6460. free program should come with manuals providing the same freedoms
  6461. that the software does. But this License is not limited to
  6462. software manuals; it can be used for any textual work, regardless
  6463. of subject matter or whether it is published as a printed book. We
  6464. recommend this License principally for works whose purpose is
  6465. instruction or reference.
  6466. 1. APPLICABILITY AND DEFINITIONS
  6467. This License applies to any manual or other work, in any medium,
  6468. that contains a notice placed by the copyright holder saying it can
  6469. be distributed under the terms of this License. Such a notice
  6470. grants a world-wide, royalty-free license, unlimited in duration,
  6471. to use that work under the conditions stated herein. The
  6472. "Document", below, refers to any such manual or work. Any member
  6473. of the public is a licensee, and is addressed as "you". You accept
  6474. the license if you copy, modify or distribute the work in a way
  6475. requiring permission under copyright law.
  6476. A "Modified Version" of the Document means any work containing the
  6477. Document or a portion of it, either copied verbatim, or with
  6478. modifications and/or translated into another language.
  6479. A "Secondary Section" is a named appendix or a front-matter section
  6480. of the Document that deals exclusively with the relationship of the
  6481. publishers or authors of the Document to the Document's overall
  6482. subject (or to related matters) and contains nothing that could
  6483. fall directly within that overall subject. (Thus, if the Document
  6484. is in part a textbook of mathematics, a Secondary Section may not
  6485. explain any mathematics.) The relationship could be a matter of
  6486. historical connection with the subject or with related matters, or
  6487. of legal, commercial, philosophical, ethical or political position
  6488. regarding them.
  6489. The "Invariant Sections" are certain Secondary Sections whose
  6490. titles are designated, as being those of Invariant Sections, in the
  6491. notice that says that the Document is released under this License.
  6492. If a section does not fit the above definition of Secondary then it
  6493. is not allowed to be designated as Invariant. The Document may
  6494. contain zero Invariant Sections. If the Document does not identify
  6495. any Invariant Sections then there are none.
  6496. The "Cover Texts" are certain short passages of text that are
  6497. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  6498. that says that the Document is released under this License. A
  6499. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  6500. be at most 25 words.
  6501. A "Transparent" copy of the Document means a machine-readable copy,
  6502. represented in a format whose specification is available to the
  6503. general public, that is suitable for revising the document
  6504. straightforwardly with generic text editors or (for images composed
  6505. of pixels) generic paint programs or (for drawings) some widely
  6506. available drawing editor, and that is suitable for input to text
  6507. formatters or for automatic translation to a variety of formats
  6508. suitable for input to text formatters. A copy made in an otherwise
  6509. Transparent file format whose markup, or absence of markup, has
  6510. been arranged to thwart or discourage subsequent modification by
  6511. readers is not Transparent. An image format is not Transparent if
  6512. used for any substantial amount of text. A copy that is not
  6513. "Transparent" is called "Opaque".
  6514. Examples of suitable formats for Transparent copies include plain
  6515. ASCII without markup, Texinfo input format, LaTeX input format,
  6516. SGML or XML using a publicly available DTD, and standard-conforming
  6517. simple HTML, PostScript or PDF designed for human modification.
  6518. Examples of transparent image formats include PNG, XCF and JPG.
  6519. Opaque formats include proprietary formats that can be read and
  6520. edited only by proprietary word processors, SGML or XML for which
  6521. the DTD and/or processing tools are not generally available, and
  6522. the machine-generated HTML, PostScript or PDF produced by some word
  6523. processors for output purposes only.
  6524. The "Title Page" means, for a printed book, the title page itself,
  6525. plus such following pages as are needed to hold, legibly, the
  6526. material this License requires to appear in the title page. For
  6527. works in formats which do not have any title page as such, "Title
  6528. Page" means the text near the most prominent appearance of the
  6529. work's title, preceding the beginning of the body of the text.
  6530. The "publisher" means any person or entity that distributes copies
  6531. of the Document to the public.
  6532. A section "Entitled XYZ" means a named subunit of the Document
  6533. whose title either is precisely XYZ or contains XYZ in parentheses
  6534. following text that translates XYZ in another language. (Here XYZ
  6535. stands for a specific section name mentioned below, such as
  6536. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  6537. To "Preserve the Title" of such a section when you modify the
  6538. Document means that it remains a section "Entitled XYZ" according
  6539. to this definition.
  6540. The Document may include Warranty Disclaimers next to the notice
  6541. which states that this License applies to the Document. These
  6542. Warranty Disclaimers are considered to be included by reference in
  6543. this License, but only as regards disclaiming warranties: any other
  6544. implication that these Warranty Disclaimers may have is void and
  6545. has no effect on the meaning of this License.
  6546. 2. VERBATIM COPYING
  6547. You may copy and distribute the Document in any medium, either
  6548. commercially or noncommercially, provided that this License, the
  6549. copyright notices, and the license notice saying this License
  6550. applies to the Document are reproduced in all copies, and that you
  6551. add no other conditions whatsoever to those of this License. You
  6552. may not use technical measures to obstruct or control the reading
  6553. or further copying of the copies you make or distribute. However,
  6554. you may accept compensation in exchange for copies. If you
  6555. distribute a large enough number of copies you must also follow the
  6556. conditions in section 3.
  6557. You may also lend copies, under the same conditions stated above,
  6558. and you may publicly display copies.
  6559. 3. COPYING IN QUANTITY
  6560. If you publish printed copies (or copies in media that commonly
  6561. have printed covers) of the Document, numbering more than 100, and
  6562. the Document's license notice requires Cover Texts, you must
  6563. enclose the copies in covers that carry, clearly and legibly, all
  6564. these Cover Texts: Front-Cover Texts on the front cover, and
  6565. Back-Cover Texts on the back cover. Both covers must also clearly
  6566. and legibly identify you as the publisher of these copies. The
  6567. front cover must present the full title with all words of the title
  6568. equally prominent and visible. You may add other material on the
  6569. covers in addition. Copying with changes limited to the covers, as
  6570. long as they preserve the title of the Document and satisfy these
  6571. conditions, can be treated as verbatim copying in other respects.
  6572. If the required texts for either cover are too voluminous to fit
  6573. legibly, you should put the first ones listed (as many as fit
  6574. reasonably) on the actual cover, and continue the rest onto
  6575. adjacent pages.
  6576. If you publish or distribute Opaque copies of the Document
  6577. numbering more than 100, you must either include a machine-readable
  6578. Transparent copy along with each Opaque copy, or state in or with
  6579. each Opaque copy a computer-network location from which the general
  6580. network-using public has access to download using public-standard
  6581. network protocols a complete Transparent copy of the Document, free
  6582. of added material. If you use the latter option, you must take
  6583. reasonably prudent steps, when you begin distribution of Opaque
  6584. copies in quantity, to ensure that this Transparent copy will
  6585. remain thus accessible at the stated location until at least one
  6586. year after the last time you distribute an Opaque copy (directly or
  6587. through your agents or retailers) of that edition to the public.
  6588. It is requested, but not required, that you contact the authors of
  6589. the Document well before redistributing any large number of copies,
  6590. to give them a chance to provide you with an updated version of the
  6591. Document.
  6592. 4. MODIFICATIONS
  6593. You may copy and distribute a Modified Version of the Document
  6594. under the conditions of sections 2 and 3 above, provided that you
  6595. release the Modified Version under precisely this License, with the
  6596. Modified Version filling the role of the Document, thus licensing
  6597. distribution and modification of the Modified Version to whoever
  6598. possesses a copy of it. In addition, you must do these things in
  6599. the Modified Version:
  6600. A. Use in the Title Page (and on the covers, if any) a title
  6601. distinct from that of the Document, and from those of previous
  6602. versions (which should, if there were any, be listed in the
  6603. History section of the Document). You may use the same title
  6604. as a previous version if the original publisher of that
  6605. version gives permission.
  6606. B. List on the Title Page, as authors, one or more persons or
  6607. entities responsible for authorship of the modifications in
  6608. the Modified Version, together with at least five of the
  6609. principal authors of the Document (all of its principal
  6610. authors, if it has fewer than five), unless they release you
  6611. from this requirement.
  6612. C. State on the Title page the name of the publisher of the
  6613. Modified Version, as the publisher.
  6614. D. Preserve all the copyright notices of the Document.
  6615. E. Add an appropriate copyright notice for your modifications
  6616. adjacent to the other copyright notices.
  6617. F. Include, immediately after the copyright notices, a license
  6618. notice giving the public permission to use the Modified
  6619. Version under the terms of this License, in the form shown in
  6620. the Addendum below.
  6621. G. Preserve in that license notice the full lists of Invariant
  6622. Sections and required Cover Texts given in the Document's
  6623. license notice.
  6624. H. Include an unaltered copy of this License.
  6625. I. Preserve the section Entitled "History", Preserve its Title,
  6626. and add to it an item stating at least the title, year, new
  6627. authors, and publisher of the Modified Version as given on the
  6628. Title Page. If there is no section Entitled "History" in the
  6629. Document, create one stating the title, year, authors, and
  6630. publisher of the Document as given on its Title Page, then add
  6631. an item describing the Modified Version as stated in the
  6632. previous sentence.
  6633. J. Preserve the network location, if any, given in the Document
  6634. for public access to a Transparent copy of the Document, and
  6635. likewise the network locations given in the Document for
  6636. previous versions it was based on. These may be placed in the
  6637. "History" section. You may omit a network location for a work
  6638. that was published at least four years before the Document
  6639. itself, or if the original publisher of the version it refers
  6640. to gives permission.
  6641. K. For any section Entitled "Acknowledgements" or "Dedications",
  6642. Preserve the Title of the section, and preserve in the section
  6643. all the substance and tone of each of the contributor
  6644. acknowledgements and/or dedications given therein.
  6645. L. Preserve all the Invariant Sections of the Document, unaltered
  6646. in their text and in their titles. Section numbers or the
  6647. equivalent are not considered part of the section titles.
  6648. M. Delete any section Entitled "Endorsements". Such a section
  6649. may not be included in the Modified Version.
  6650. N. Do not retitle any existing section to be Entitled
  6651. "Endorsements" or to conflict in title with any Invariant
  6652. Section.
  6653. O. Preserve any Warranty Disclaimers.
  6654. If the Modified Version includes new front-matter sections or
  6655. appendices that qualify as Secondary Sections and contain no
  6656. material copied from the Document, you may at your option designate
  6657. some or all of these sections as invariant. To do this, add their
  6658. titles to the list of Invariant Sections in the Modified Version's
  6659. license notice. These titles must be distinct from any other
  6660. section titles.
  6661. You may add a section Entitled "Endorsements", provided it contains
  6662. nothing but endorsements of your Modified Version by various
  6663. parties--for example, statements of peer review or that the text
  6664. has been approved by an organization as the authoritative
  6665. definition of a standard.
  6666. You may add a passage of up to five words as a Front-Cover Text,
  6667. and a passage of up to 25 words as a Back-Cover Text, to the end of
  6668. the list of Cover Texts in the Modified Version. Only one passage
  6669. of Front-Cover Text and one of Back-Cover Text may be added by (or
  6670. through arrangements made by) any one entity. If the Document
  6671. already includes a cover text for the same cover, previously added
  6672. by you or by arrangement made by the same entity you are acting on
  6673. behalf of, you may not add another; but you may replace the old
  6674. one, on explicit permission from the previous publisher that added
  6675. the old one.
  6676. The author(s) and publisher(s) of the Document do not by this
  6677. License give permission to use their names for publicity for or to
  6678. assert or imply endorsement of any Modified Version.
  6679. 5. COMBINING DOCUMENTS
  6680. You may combine the Document with other documents released under
  6681. this License, under the terms defined in section 4 above for
  6682. modified versions, provided that you include in the combination all
  6683. of the Invariant Sections of all of the original documents,
  6684. unmodified, and list them all as Invariant Sections of your
  6685. combined work in its license notice, and that you preserve all
  6686. their Warranty Disclaimers.
  6687. The combined work need only contain one copy of this License, and
  6688. multiple identical Invariant Sections may be replaced with a single
  6689. copy. If there are multiple Invariant Sections with the same name
  6690. but different contents, make the title of each such section unique
  6691. by adding at the end of it, in parentheses, the name of the
  6692. original author or publisher of that section if known, or else a
  6693. unique number. Make the same adjustment to the section titles in
  6694. the list of Invariant Sections in the license notice of the
  6695. combined work.
  6696. In the combination, you must combine any sections Entitled
  6697. "History" in the various original documents, forming one section
  6698. Entitled "History"; likewise combine any sections Entitled
  6699. "Acknowledgements", and any sections Entitled "Dedications". You
  6700. must delete all sections Entitled "Endorsements."
  6701. 6. COLLECTIONS OF DOCUMENTS
  6702. You may make a collection consisting of the Document and other
  6703. documents released under this License, and replace the individual
  6704. copies of this License in the various documents with a single copy
  6705. that is included in the collection, provided that you follow the
  6706. rules of this License for verbatim copying of each of the documents
  6707. in all other respects.
  6708. You may extract a single document from such a collection, and
  6709. distribute it individually under this License, provided you insert
  6710. a copy of this License into the extracted document, and follow this
  6711. License in all other respects regarding verbatim copying of that
  6712. document.
  6713. 7. AGGREGATION WITH INDEPENDENT WORKS
  6714. A compilation of the Document or its derivatives with other
  6715. separate and independent documents or works, in or on a volume of a
  6716. storage or distribution medium, is called an "aggregate" if the
  6717. copyright resulting from the compilation is not used to limit the
  6718. legal rights of the compilation's users beyond what the individual
  6719. works permit. When the Document is included in an aggregate, this
  6720. License does not apply to the other works in the aggregate which
  6721. are not themselves derivative works of the Document.
  6722. If the Cover Text requirement of section 3 is applicable to these
  6723. copies of the Document, then if the Document is less than one half
  6724. of the entire aggregate, the Document's Cover Texts may be placed
  6725. on covers that bracket the Document within the aggregate, or the
  6726. electronic equivalent of covers if the Document is in electronic
  6727. form. Otherwise they must appear on printed covers that bracket
  6728. the whole aggregate.
  6729. 8. TRANSLATION
  6730. Translation is considered a kind of modification, so you may
  6731. distribute translations of the Document under the terms of section
  6732. 4. Replacing Invariant Sections with translations requires special
  6733. permission from their copyright holders, but you may include
  6734. translations of some or all Invariant Sections in addition to the
  6735. original versions of these Invariant Sections. You may include a
  6736. translation of this License, and all the license notices in the
  6737. Document, and any Warranty Disclaimers, provided that you also
  6738. include the original English version of this License and the
  6739. original versions of those notices and disclaimers. In case of a
  6740. disagreement between the translation and the original version of
  6741. this License or a notice or disclaimer, the original version will
  6742. prevail.
  6743. If a section in the Document is Entitled "Acknowledgements",
  6744. "Dedications", or "History", the requirement (section 4) to
  6745. Preserve its Title (section 1) will typically require changing the
  6746. actual title.
  6747. 9. TERMINATION
  6748. You may not copy, modify, sublicense, or distribute the Document
  6749. except as expressly provided under this License. Any attempt
  6750. otherwise to copy, modify, sublicense, or distribute it is void,
  6751. and will automatically terminate your rights under this License.
  6752. However, if you cease all violation of this License, then your
  6753. license from a particular copyright holder is reinstated (a)
  6754. provisionally, unless and until the copyright holder explicitly and
  6755. finally terminates your license, and (b) permanently, if the
  6756. copyright holder fails to notify you of the violation by some
  6757. reasonable means prior to 60 days after the cessation.
  6758. Moreover, your license from a particular copyright holder is
  6759. reinstated permanently if the copyright holder notifies you of the
  6760. violation by some reasonable means, this is the first time you have
  6761. received notice of violation of this License (for any work) from
  6762. that copyright holder, and you cure the violation prior to 30 days
  6763. after your receipt of the notice.
  6764. Termination of your rights under this section does not terminate
  6765. the licenses of parties who have received copies or rights from you
  6766. under this License. If your rights have been terminated and not
  6767. permanently reinstated, receipt of a copy of some or all of the
  6768. same material does not give you any rights to use it.
  6769. 10. FUTURE REVISIONS OF THIS LICENSE
  6770. The Free Software Foundation may publish new, revised versions of
  6771. the GNU Free Documentation License from time to time. Such new
  6772. versions will be similar in spirit to the present version, but may
  6773. differ in detail to address new problems or concerns. See
  6774. <http://www.gnu.org/copyleft/>.
  6775. Each version of the License is given a distinguishing version
  6776. number. If the Document specifies that a particular numbered
  6777. version of this License "or any later version" applies to it, you
  6778. have the option of following the terms and conditions either of
  6779. that specified version or of any later version that has been
  6780. published (not as a draft) by the Free Software Foundation. If the
  6781. Document does not specify a version number of this License, you may
  6782. choose any version ever published (not as a draft) by the Free
  6783. Software Foundation. If the Document specifies that a proxy can
  6784. decide which future versions of this License can be used, that
  6785. proxy's public statement of acceptance of a version permanently
  6786. authorizes you to choose that version for the Document.
  6787. 11. RELICENSING
  6788. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  6789. World Wide Web server that publishes copyrightable works and also
  6790. provides prominent facilities for anybody to edit those works. A
  6791. public wiki that anybody can edit is an example of such a server.
  6792. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  6793. site means any set of copyrightable works thus published on the MMC
  6794. site.
  6795. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  6796. license published by Creative Commons Corporation, a not-for-profit
  6797. corporation with a principal place of business in San Francisco,
  6798. California, as well as future copyleft versions of that license
  6799. published by that same organization.
  6800. "Incorporate" means to publish or republish a Document, in whole or
  6801. in part, as part of another Document.
  6802. An MMC is "eligible for relicensing" if it is licensed under this
  6803. License, and if all works that were first published under this
  6804. License somewhere other than this MMC, and subsequently
  6805. incorporated in whole or in part into the MMC, (1) had no cover
  6806. texts or invariant sections, and (2) were thus incorporated prior
  6807. to November 1, 2008.
  6808. The operator of an MMC Site may republish an MMC contained in the
  6809. site under CC-BY-SA on the same site at any time before August 1,
  6810. 2009, provided the MMC is eligible for relicensing.
  6811. ADDENDUM: How to use this License for your documents
  6812. ====================================================
  6813. To use this License in a document you have written, include a copy of
  6814. the License in the document and put the following copyright and license
  6815. notices just after the title page:
  6816. Copyright (C) YEAR YOUR NAME.
  6817. Permission is granted to copy, distribute and/or modify this document
  6818. under the terms of the GNU Free Documentation License, Version 1.3
  6819. or any later version published by the Free Software Foundation;
  6820. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  6821. Texts. A copy of the license is included in the section entitled ``GNU
  6822. Free Documentation License''.
  6823. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  6824. Texts, replace the "with...Texts." line with this:
  6825. with the Invariant Sections being LIST THEIR TITLES, with
  6826. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  6827. being LIST.
  6828. If you have Invariant Sections without Cover Texts, or some other
  6829. combination of the three, merge those two alternatives to suit the
  6830. situation.
  6831. If your document contains nontrivial examples of program code, we
  6832. recommend releasing these examples in parallel under your choice of free
  6833. software license, such as the GNU General Public License, to permit
  6834. their use in free software.
  6835. 
  6836. File: ld.info, Node: LD Index, Prev: GNU Free Documentation License, Up: Top
  6837. LD Index
  6838. ********
  6839. �[index�]
  6840. * Menu:
  6841. * ": Symbols. (line 6)
  6842. * -(: Options. (line 1114)
  6843. * --accept-unknown-input-arch: Options. (line 1132)
  6844. * --add-needed: Options. (line 1163)
  6845. * --add-stdcall-alias: Options. (line 2258)
  6846. * --allow-multiple-definition: Options. (line 1535)
  6847. * --allow-shlib-undefined: Options. (line 1541)
  6848. * --as-needed: Options. (line 1142)
  6849. * --audit AUDITLIB: Options. (line 111)
  6850. * --auxiliary=NAME: Options. (line 294)
  6851. * --bank-window: Options. (line 2749)
  6852. * --base-file: Options. (line 2263)
  6853. * --be8: ARM. (line 28)
  6854. * --branch-stub on C-SKY: Options. (line 2721)
  6855. * --bss-plt: PowerPC ELF32. (line 16)
  6856. * --build-id: Options. (line 2220)
  6857. * --build-id=STYLE: Options. (line 2220)
  6858. * --check-sections: Options. (line 1245)
  6859. * --cmse-implib: ARM. (line 231)
  6860. * --code-region: MSP430. (line 34)
  6861. * --compact-branches: Options. (line 2794)
  6862. * --compress-debug-sections=none: Options. (line 2173)
  6863. * --compress-debug-sections=zlib: Options. (line 2173)
  6864. * --compress-debug-sections=zlib-gabi: Options. (line 2173)
  6865. * --compress-debug-sections=zlib-gnu: Options. (line 2173)
  6866. * --copy-dt-needed-entries: Options. (line 1257)
  6867. * --cref: Options. (line 1277)
  6868. * --ctf-share-types: Options. (line 1301)
  6869. * --ctf-variables: Options. (line 1290)
  6870. * --data-region: MSP430. (line 39)
  6871. * --default-imported-symver: Options. (line 1591)
  6872. * --default-script=SCRIPT: Options. (line 660)
  6873. * --default-symver: Options. (line 1587)
  6874. * --defsym=SYMBOL=EXP: Options. (line 1345)
  6875. * --demangle[=STYLE]: Options. (line 1365)
  6876. * --depaudit AUDITLIB: Options. (line 164)
  6877. * --dependency-file=DEPFILE: Options. (line 527)
  6878. * --disable-auto-image-base: Options. (line 2440)
  6879. * --disable-auto-import: Options. (line 2579)
  6880. * --disable-large-address-aware: Options. (line 2388)
  6881. * --disable-long-section-names: Options. (line 2273)
  6882. * --disable-multiple-abs-defs: Options. (line 1396)
  6883. * --disable-new-dtags: Options. (line 2147)
  6884. * --disable-runtime-pseudo-reloc: Options. (line 2592)
  6885. * --disable-sec-transformation: MSP430. (line 45)
  6886. * --disable-stdcall-fixup: Options. (line 2295)
  6887. * --discard-all: Options. (line 745)
  6888. * --discard-locals: Options. (line 749)
  6889. * --dll: Options. (line 2268)
  6890. * --dll-search-prefix: Options. (line 2446)
  6891. * --dotsyms: PowerPC64 ELF64. (line 33)
  6892. * --dsbt-index: Options. (line 2708)
  6893. * --dsbt-size: Options. (line 2703)
  6894. * --dynamic-linker=FILE: Options. (line 1378)
  6895. * --dynamic-list-cpp-new: Options. (line 1237)
  6896. * --dynamic-list-cpp-typeinfo: Options. (line 1241)
  6897. * --dynamic-list-data: Options. (line 1234)
  6898. * --dynamic-list=DYNAMIC-LIST-FILE: Options. (line 1221)
  6899. * --dynamicbase: Options. (line 2636)
  6900. * --eh-frame-hdr: Options. (line 2136)
  6901. * --embedded-relocs: Options. (line 1391)
  6902. * --emit-relocs: Options. (line 587)
  6903. * --emit-stack-syms: SPU ELF. (line 46)
  6904. * --emit-stub-syms: PowerPC ELF32. (line 47)
  6905. * --emit-stub-syms <1>: PowerPC64 ELF64. (line 29)
  6906. * --emit-stub-syms <2>: SPU ELF. (line 15)
  6907. * --enable-auto-image-base: Options. (line 2431)
  6908. * --enable-auto-import: Options. (line 2455)
  6909. * --enable-extra-pe-debug: Options. (line 2597)
  6910. * --enable-long-section-names: Options. (line 2273)
  6911. * --enable-new-dtags: Options. (line 2147)
  6912. * --enable-non-contiguous-regions: Options. (line 174)
  6913. * --enable-non-contiguous-regions-warnings: Options. (line 206)
  6914. * --enable-reloc-section: Options. (line 2690)
  6915. * --enable-runtime-pseudo-reloc: Options. (line 2584)
  6916. * --enable-stdcall-fixup: Options. (line 2295)
  6917. * --entry=ENTRY: Options. (line 212)
  6918. * --error-handling-script=SCRIPTNAME: Options. (line 1568)
  6919. * --error-unresolved-symbols: Options. (line 2072)
  6920. * --exclude-all-symbols: Options. (line 2348)
  6921. * --exclude-libs: Options. (line 222)
  6922. * --exclude-modules-for-implib: Options. (line 233)
  6923. * --exclude-symbols: Options. (line 2342)
  6924. * --export-all-symbols: Options. (line 2318)
  6925. * --export-dynamic: Options. (line 246)
  6926. * --export-dynamic-symbol-list=FILE: Options. (line 282)
  6927. * --export-dynamic-symbol=GLOB: Options. (line 273)
  6928. * --extra-overlay-stubs: SPU ELF. (line 19)
  6929. * --fatal-warnings: Options. (line 1400)
  6930. * --file-alignment: Options. (line 2352)
  6931. * --filter=NAME: Options. (line 315)
  6932. * --fix-arm1176: ARM. (line 108)
  6933. * --fix-cortex-a53-835769: ARM. (line 208)
  6934. * --fix-cortex-a8: ARM. (line 199)
  6935. * --fix-stm32l4xx-629360: ARM. (line 117)
  6936. * --fix-v4bx: ARM. (line 48)
  6937. * --fix-v4bx-interworking: ARM. (line 61)
  6938. * --force-dynamic: Options. (line 596)
  6939. * --force-exe-suffix: Options. (line 1405)
  6940. * --force-group-allocation: Options. (line 1337)
  6941. * --forceinteg: Options. (line 2644)
  6942. * --format=FORMAT: Options. (line 121)
  6943. * --format=VERSION: TI COFF. (line 6)
  6944. * --gc-keep-exported: Options. (line 1453)
  6945. * --gc-sections: Options. (line 1415)
  6946. * --got: Options. (line 2761)
  6947. * --got=TYPE: M68K. (line 6)
  6948. * --gpsize=VALUE: Options. (line 347)
  6949. * --hash-size=NUMBER: Options. (line 2157)
  6950. * --hash-style=STYLE: Options. (line 2165)
  6951. * --heap: Options. (line 2358)
  6952. * --help: Options. (line 1481)
  6953. * --high-entropy-va: Options. (line 2628)
  6954. * --ignore-branch-isa: Options. (line 2782)
  6955. * --ignore-branch-isa <1>: MIPS. (line 13)
  6956. * --image-base: Options. (line 2365)
  6957. * --imagic: Options. (line 2831)
  6958. * --in-implib=FILE: ARM. (line 236)
  6959. * --insert-timestamp: Options. (line 2679)
  6960. * --insn32: Options. (line 2773)
  6961. * --insn32 <1>: MIPS. (line 6)
  6962. * --just-symbols=FILE: Options. (line 618)
  6963. * --kill-at: Options. (line 2374)
  6964. * --large-address-aware: Options. (line 2379)
  6965. * --ld-generated-unwind-info: Options. (line 2142)
  6966. * --leading-underscore: Options. (line 2312)
  6967. * --library-path=DIR: Options. (line 405)
  6968. * --library=NAMESPEC: Options. (line 372)
  6969. * --local-store=lo:hi: SPU ELF. (line 24)
  6970. * --long-plt: ARM. (line 219)
  6971. * --major-image-version: Options. (line 2395)
  6972. * --major-os-version: Options. (line 2400)
  6973. * --major-subsystem-version: Options. (line 2404)
  6974. * --max-cache-size=SIZE: Options. (line 2215)
  6975. * --merge-exidx-entries: ARM. (line 216)
  6976. * --minor-image-version: Options. (line 2409)
  6977. * --minor-os-version: Options. (line 2414)
  6978. * --minor-subsystem-version: Options. (line 2418)
  6979. * --mri-script=MRI-CMDFILE: Options. (line 145)
  6980. * --multi-subspace: HPPA ELF32. (line 6)
  6981. * --nmagic: Options. (line 500)
  6982. * --nmagic <1>: Options. (line 2821)
  6983. * --no-accept-unknown-input-arch: Options. (line 1132)
  6984. * --no-add-needed: Options. (line 1163)
  6985. * --no-allow-shlib-undefined: Options. (line 1541)
  6986. * --no-apply-dynamic-relocs: ARM. (line 223)
  6987. * --no-as-needed: Options. (line 1142)
  6988. * --no-bind: Options. (line 2665)
  6989. * --no-check-sections: Options. (line 1245)
  6990. * --no-compact-branches: Options. (line 2795)
  6991. * --no-copy-dt-needed-entries: Options. (line 1257)
  6992. * --no-ctf-variables: Options. (line 1290)
  6993. * --no-define-common: Options. (line 1321)
  6994. * --no-demangle: Options. (line 1365)
  6995. * --no-dotsyms: PowerPC64 ELF64. (line 33)
  6996. * --no-dynamic-linker: Options. (line 1385)
  6997. * --no-eh-frame-hdr: Options. (line 2136)
  6998. * --no-enum-size-warning: ARM. (line 155)
  6999. * --no-export-dynamic: Options. (line 246)
  7000. * --no-fatal-warnings: Options. (line 1400)
  7001. * --no-fix-arm1176: ARM. (line 108)
  7002. * --no-fix-cortex-a53-835769: ARM. (line 208)
  7003. * --no-fix-cortex-a8: ARM. (line 199)
  7004. * --no-gc-sections: Options. (line 1415)
  7005. * --no-ignore-branch-isa: Options. (line 2783)
  7006. * --no-ignore-branch-isa <1>: MIPS. (line 13)
  7007. * --no-inline-optimize: PowerPC64 ELF64. (line 101)
  7008. * --no-insn32: Options. (line 2774)
  7009. * --no-insn32 <1>: MIPS. (line 6)
  7010. * --no-isolation: Options. (line 2655)
  7011. * --no-keep-memory: Options. (line 1518)
  7012. * --no-leading-underscore: Options. (line 2312)
  7013. * --no-merge-exidx-entries: Options. (line 2715)
  7014. * --no-merge-exidx-entries <1>: ARM. (line 216)
  7015. * --no-multi-toc: PowerPC64 ELF64. (line 109)
  7016. * --no-omagic: Options. (line 515)
  7017. * --no-omagic <1>: Options. (line 2845)
  7018. * --no-opd-optimize: PowerPC64 ELF64. (line 75)
  7019. * --no-overlays: SPU ELF. (line 9)
  7020. * --no-plt-align: PowerPC64 ELF64. (line 131)
  7021. * --no-plt-localentry: PowerPC64 ELF64. (line 160)
  7022. * --no-plt-static-chain: PowerPC64 ELF64. (line 142)
  7023. * --no-plt-thread-safe: PowerPC64 ELF64. (line 148)
  7024. * --no-power10-stubs: PowerPC64 ELF64. (line 176)
  7025. * --no-print-gc-sections: Options. (line 1444)
  7026. * --no-print-map-discarded: Options. (line 495)
  7027. * --no-save-restore-funcs: PowerPC64 ELF64. (line 44)
  7028. * --no-seh: Options. (line 2660)
  7029. * --no-strip-discarded: Options. (line 638)
  7030. * --no-tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  7031. * --no-tls-get-addr-regsave: PowerPC64 ELF64. (line 56)
  7032. * --no-tls-optimize: PowerPC ELF32. (line 51)
  7033. * --no-tls-optimize <1>: PowerPC64 ELF64. (line 51)
  7034. * --no-toc-optimize: PowerPC64 ELF64. (line 87)
  7035. * --no-toc-sort: PowerPC64 ELF64. (line 121)
  7036. * --no-trampoline: Options. (line 2743)
  7037. * --no-undefined: Options. (line 1525)
  7038. * --no-undefined-version: Options. (line 1582)
  7039. * --no-warn-mismatch: Options. (line 1595)
  7040. * --no-warn-search-mismatch: Options. (line 1604)
  7041. * --no-wchar-size-warning: ARM. (line 162)
  7042. * --no-whole-archive: Options. (line 1608)
  7043. * --noinhibit-exec: Options. (line 1612)
  7044. * --non-overlapping-opd: PowerPC64 ELF64. (line 81)
  7045. * --nxcompat: Options. (line 2649)
  7046. * --oformat=OUTPUT-FORMAT: Options. (line 1623)
  7047. * --omagic: Options. (line 506)
  7048. * --omagic <1>: Options. (line 2810)
  7049. * --orphan-handling=MODE: Options. (line 704)
  7050. * --out-implib: Options. (line 1636)
  7051. * --output-def: Options. (line 2423)
  7052. * --output=OUTPUT: Options. (line 521)
  7053. * --pic-executable: Options. (line 1645)
  7054. * --pic-veneer: ARM. (line 168)
  7055. * --plt-align: PowerPC64 ELF64. (line 131)
  7056. * --plt-localentry: PowerPC64 ELF64. (line 160)
  7057. * --plt-static-chain: PowerPC64 ELF64. (line 142)
  7058. * --plt-thread-safe: PowerPC64 ELF64. (line 148)
  7059. * --plugin: SPU ELF. (line 6)
  7060. * --pop-state: Options. (line 583)
  7061. * --power10-stubs: PowerPC64 ELF64. (line 176)
  7062. * --print-gc-sections: Options. (line 1444)
  7063. * --print-map: Options. (line 440)
  7064. * --print-map-discarded: Options. (line 495)
  7065. * --print-memory-usage: Options. (line 1469)
  7066. * --print-output-format: Options. (line 1463)
  7067. * --push-state: Options. (line 565)
  7068. * --reduce-memory-overheads: Options. (line 2201)
  7069. * --relax: Options. (line 1664)
  7070. * --relax on Nios II: Nios II. (line 6)
  7071. * --relax on PowerPC: PowerPC ELF32. (line 6)
  7072. * --relax on Xtensa: Xtensa. (line 27)
  7073. * --relocatable: Options. (line 600)
  7074. * --require-defined=SYMBOL: Options. (line 686)
  7075. * --retain-symbols-file=FILENAME: Options. (line 1690)
  7076. * --s390-pgste: S/390 ELF. (line 6)
  7077. * --save-restore-funcs: PowerPC64 ELF64. (line 44)
  7078. * --script=SCRIPT: Options. (line 651)
  7079. * --sdata-got: PowerPC ELF32. (line 33)
  7080. * --section-alignment: Options. (line 2602)
  7081. * --section-start=SECTIONNAME=ORG: Options. (line 1885)
  7082. * --secure-plt: PowerPC ELF32. (line 26)
  7083. * --sort-common: Options. (line 1817)
  7084. * --sort-section=alignment: Options. (line 1832)
  7085. * --sort-section=name: Options. (line 1828)
  7086. * --spare-dynamic-tags: Options. (line 1836)
  7087. * --split-by-file: Options. (line 1841)
  7088. * --split-by-reloc: Options. (line 1846)
  7089. * --stack: Options. (line 2608)
  7090. * --stack-analysis: SPU ELF. (line 29)
  7091. * --stats: Options. (line 1859)
  7092. * --strip-all: Options. (line 629)
  7093. * --strip-debug: Options. (line 633)
  7094. * --strip-discarded: Options. (line 638)
  7095. * --stub-group-size: PowerPC64 ELF64. (line 6)
  7096. * --stub-group-size on C-SKY: Options. (line 2728)
  7097. * --stub-group-size=N: ARM. (line 173)
  7098. * --stub-group-size=N <1>: HPPA ELF32. (line 12)
  7099. * --subsystem: Options. (line 2615)
  7100. * --support-old-code: ARM. (line 6)
  7101. * --sysroot=DIRECTORY: Options. (line 1863)
  7102. * --target-help: Options. (line 1485)
  7103. * --target1-abs: ARM. (line 33)
  7104. * --target1-rel: ARM. (line 33)
  7105. * --target2=TYPE: ARM. (line 38)
  7106. * --task-link: Options. (line 1868)
  7107. * --thumb-entry=ENTRY: ARM. (line 17)
  7108. * --tls-get-addr-optimize: PowerPC64 ELF64. (line 56)
  7109. * --tls-get-addr-regsave: PowerPC64 ELF64. (line 56)
  7110. * --trace: Options. (line 643)
  7111. * --trace-symbol=SYMBOL: Options. (line 755)
  7112. * --traditional-format: Options. (line 1873)
  7113. * --tsaware: Options. (line 2674)
  7114. * --undefined=SYMBOL: Options. (line 673)
  7115. * --unique[=SECTION]: Options. (line 730)
  7116. * --unresolved-symbols: Options. (line 1915)
  7117. * --use-blx: ARM. (line 73)
  7118. * --use-nul-prefixed-import-tables: ARM. (line 23)
  7119. * --verbose[=NUMBER]: Options. (line 1944)
  7120. * --version: Options. (line 739)
  7121. * --version-script=VERSION-SCRIPTFILE: Options. (line 1952)
  7122. * --vfp11-denorm-fix: ARM. (line 79)
  7123. * --warn-alternate-em: Options. (line 2064)
  7124. * --warn-common: Options. (line 1962)
  7125. * --warn-constructors: Options. (line 2030)
  7126. * --warn-multiple-gp: Options. (line 2035)
  7127. * --warn-once: Options. (line 2049)
  7128. * --warn-section-align: Options. (line 2053)
  7129. * --warn-textrel: Options. (line 2060)
  7130. * --warn-unresolved-symbols: Options. (line 2067)
  7131. * --wdmdriver: Options. (line 2669)
  7132. * --whole-archive: Options. (line 2076)
  7133. * --wrap=SYMBOL: Options. (line 2090)
  7134. * -a KEYWORD: Options. (line 104)
  7135. * -assert KEYWORD: Options. (line 1170)
  7136. * -b FORMAT: Options. (line 121)
  7137. * -Bdynamic: Options. (line 1173)
  7138. * -Bgroup: Options. (line 1183)
  7139. * -Bno-symbolic: Options. (line 1217)
  7140. * -Bshareable: Options. (line 1810)
  7141. * -Bstatic: Options. (line 1190)
  7142. * -Bsymbolic: Options. (line 1204)
  7143. * -Bsymbolic-functions: Options. (line 1211)
  7144. * -c MRI-CMDFILE: Options. (line 145)
  7145. * -call_shared: Options. (line 1173)
  7146. * -d: Options. (line 155)
  7147. * -dc: Options. (line 155)
  7148. * -dn: Options. (line 1190)
  7149. * -dp: Options. (line 155)
  7150. * -dT SCRIPT: Options. (line 660)
  7151. * -dy: Options. (line 1173)
  7152. * -E: Options. (line 246)
  7153. * -e ENTRY: Options. (line 212)
  7154. * -EB: Options. (line 287)
  7155. * -EL: Options. (line 290)
  7156. * -f NAME: Options. (line 294)
  7157. * -F NAME: Options. (line 315)
  7158. * -fini=NAME: Options. (line 338)
  7159. * -g: Options. (line 344)
  7160. * -G VALUE: Options. (line 347)
  7161. * -h NAME: Options. (line 354)
  7162. * -i: Options. (line 363)
  7163. * -IFILE: Options. (line 1378)
  7164. * -init=NAME: Options. (line 366)
  7165. * -L DIR: Options. (line 405)
  7166. * -l NAMESPEC: Options. (line 372)
  7167. * -M: Options. (line 440)
  7168. * -m EMULATION: Options. (line 430)
  7169. * -Map=MAPFILE: Options. (line 1489)
  7170. * -n: Options. (line 500)
  7171. * -N: Options. (line 506)
  7172. * -N <1>: Options. (line 2809)
  7173. * -n <1>: Options. (line 2820)
  7174. * -no-pie: Options. (line 1655)
  7175. * -no-relax: Options. (line 1664)
  7176. * -non_shared: Options. (line 1190)
  7177. * -nostdlib: Options. (line 1618)
  7178. * -O LEVEL: Options. (line 540)
  7179. * -o OUTPUT: Options. (line 521)
  7180. * -P AUDITLIB: Options. (line 164)
  7181. * -pie: Options. (line 1645)
  7182. * -plugin NAME: Options. (line 550)
  7183. * -q: Options. (line 587)
  7184. * -qmagic: Options. (line 1658)
  7185. * -Qy: Options. (line 1661)
  7186. * -r: Options. (line 600)
  7187. * -R FILE: Options. (line 618)
  7188. * -rpath-link=DIR: Options. (line 1731)
  7189. * -rpath=DIR: Options. (line 1704)
  7190. * -s: Options. (line 629)
  7191. * -S: Options. (line 633)
  7192. * -shared: Options. (line 1810)
  7193. * -soname=NAME: Options. (line 354)
  7194. * -static: Options. (line 1190)
  7195. * -t: Options. (line 643)
  7196. * -T SCRIPT: Options. (line 651)
  7197. * -Tbss=ORG: Options. (line 1894)
  7198. * -Tdata=ORG: Options. (line 1894)
  7199. * -Tldata-segment=ORG: Options. (line 1910)
  7200. * -Trodata-segment=ORG: Options. (line 1904)
  7201. * -Ttext-segment=ORG: Options. (line 1900)
  7202. * -Ttext=ORG: Options. (line 1894)
  7203. * -u SYMBOL: Options. (line 673)
  7204. * -Ur: Options. (line 694)
  7205. * -v: Options. (line 739)
  7206. * -V: Options. (line 739)
  7207. * -x: Options. (line 745)
  7208. * -X: Options. (line 749)
  7209. * -Y PATH: Options. (line 764)
  7210. * -y SYMBOL: Options. (line 755)
  7211. * -z: Options. (line 2830)
  7212. * -z defs: Options. (line 1525)
  7213. * -z KEYWORD: Options. (line 768)
  7214. * -z muldefs: Options. (line 1535)
  7215. * -z undefs: Options. (line 1525)
  7216. * .: Location Counter. (line 6)
  7217. * /DISCARD/: Output Section Discarding.
  7218. (line 26)
  7219. * 32-bit PLT entries: ARM. (line 219)
  7220. * :PHDR: Output Section Phdr.
  7221. (line 6)
  7222. * =FILLEXP: Output Section Fill.
  7223. (line 6)
  7224. * >REGION: Output Section Region.
  7225. (line 6)
  7226. * [COMMON]: Input Section Common.
  7227. (line 29)
  7228. * AArch64 rela addend: ARM. (line 223)
  7229. * ABSOLUTE (MRI): MRI. (line 32)
  7230. * absolute and relocatable symbols: Expression Section. (line 6)
  7231. * absolute expressions: Expression Section. (line 6)
  7232. * ABSOLUTE(EXP): Builtin Functions. (line 10)
  7233. * ADDR(SECTION): Builtin Functions. (line 17)
  7234. * address, section: Output Section Address.
  7235. (line 6)
  7236. * ALIAS (MRI): MRI. (line 43)
  7237. * ALIGN (MRI): MRI. (line 49)
  7238. * align expression: Builtin Functions. (line 38)
  7239. * align location counter: Builtin Functions. (line 38)
  7240. * ALIGN(ALIGN): Builtin Functions. (line 38)
  7241. * ALIGN(EXP,ALIGN): Builtin Functions. (line 38)
  7242. * ALIGN(SECTION_ALIGN): Forced Output Alignment.
  7243. (line 6)
  7244. * aligned common symbols: WIN32. (line 416)
  7245. * ALIGNOF(SECTION): Builtin Functions. (line 63)
  7246. * allocating memory: MEMORY. (line 6)
  7247. * architecture: Miscellaneous Commands.
  7248. (line 121)
  7249. * archive files, from cmd line: Options. (line 372)
  7250. * archive search path in linker script: File Commands. (line 80)
  7251. * arithmetic: Expressions. (line 6)
  7252. * arithmetic operators: Operators. (line 6)
  7253. * ARM interworking support: ARM. (line 6)
  7254. * ARM1176 erratum workaround: ARM. (line 108)
  7255. * ASSERT: Miscellaneous Commands.
  7256. (line 9)
  7257. * assertion in linker script: Miscellaneous Commands.
  7258. (line 9)
  7259. * assignment in scripts: Assignments. (line 6)
  7260. * AS_NEEDED(FILES): File Commands. (line 60)
  7261. * AT(LMA): Output Section LMA. (line 6)
  7262. * AT>LMA_REGION: Output Section LMA. (line 6)
  7263. * automatic data imports: WIN32. (line 185)
  7264. * back end: BFD. (line 6)
  7265. * BASE (MRI): MRI. (line 53)
  7266. * BE8: ARM. (line 28)
  7267. * BFD canonical format: Canonical format. (line 11)
  7268. * BFD requirements: BFD. (line 16)
  7269. * big-endian objects: Options. (line 287)
  7270. * binary input format: Options. (line 121)
  7271. * BLOCK(EXP): Builtin Functions. (line 76)
  7272. * bug criteria: Bug Criteria. (line 6)
  7273. * bug reports: Bug Reporting. (line 6)
  7274. * bugs in ld: Reporting Bugs. (line 6)
  7275. * BYTE(EXPRESSION): Output Section Data.
  7276. (line 6)
  7277. * C++ constructors, arranging in link: Output Section Keywords.
  7278. (line 19)
  7279. * CHIP (MRI): MRI. (line 57)
  7280. * COLLECT_NO_DEMANGLE: Environment. (line 29)
  7281. * combining symbols, warnings on: Options. (line 1962)
  7282. * COMDAT: Options. (line 1337)
  7283. * COMDAT <1>: Miscellaneous Commands.
  7284. (line 56)
  7285. * command files: Scripts. (line 6)
  7286. * command line: Options. (line 6)
  7287. * common allocation: Options. (line 155)
  7288. * common allocation <1>: Options. (line 1321)
  7289. * common allocation in linker script: Miscellaneous Commands.
  7290. (line 46)
  7291. * common allocation in linker script <1>: Miscellaneous Commands.
  7292. (line 51)
  7293. * common symbol placement: Input Section Common.
  7294. (line 6)
  7295. * COMMONPAGESIZE: Symbolic Constants. (line 13)
  7296. * compatibility, MRI: Options. (line 145)
  7297. * CONSTANT: Symbolic Constants. (line 6)
  7298. * constants in linker scripts: Constants. (line 6)
  7299. * constraints on output sections: Output Section Constraint.
  7300. (line 6)
  7301. * constructors: Options. (line 694)
  7302. * CONSTRUCTORS: Output Section Keywords.
  7303. (line 19)
  7304. * constructors, arranging in link: Output Section Keywords.
  7305. (line 19)
  7306. * Cortex-A53 erratum 835769 workaround: ARM. (line 208)
  7307. * Cortex-A8 erratum workaround: ARM. (line 199)
  7308. * crash of linker: Bug Criteria. (line 9)
  7309. * CREATE_OBJECT_SYMBOLS: Output Section Keywords.
  7310. (line 9)
  7311. * creating a DEF file: WIN32. (line 153)
  7312. * cross reference table: Options. (line 1277)
  7313. * cross references: Miscellaneous Commands.
  7314. (line 88)
  7315. * cross references <1>: Miscellaneous Commands.
  7316. (line 104)
  7317. * ctf type sharing: Options. (line 1301)
  7318. * ctf variables: Options. (line 1290)
  7319. * current output location: Location Counter. (line 6)
  7320. * data: Output Section Data.
  7321. (line 6)
  7322. * DATA_SEGMENT_ALIGN(MAXPAGESIZE, COMMONPAGESIZE): Builtin Functions.
  7323. (line 81)
  7324. * DATA_SEGMENT_END(EXP): Builtin Functions. (line 105)
  7325. * DATA_SEGMENT_RELRO_END(OFFSET, EXP): Builtin Functions. (line 111)
  7326. * dbx: Options. (line 1878)
  7327. * DEF files, creating: Options. (line 2423)
  7328. * default emulation: Environment. (line 21)
  7329. * default input format: Environment. (line 9)
  7330. * defined symbol: Options. (line 686)
  7331. * DEFINED(SYMBOL): Builtin Functions. (line 124)
  7332. * deleting local symbols: Options. (line 745)
  7333. * demangling, default: Environment. (line 29)
  7334. * demangling, from command line: Options. (line 1365)
  7335. * dependency file: Options. (line 527)
  7336. * direct linking to a dll: WIN32. (line 233)
  7337. * discarding sections: Output Section Discarding.
  7338. (line 6)
  7339. * discontinuous memory: MEMORY. (line 6)
  7340. * DLLs, creating: Options. (line 2318)
  7341. * DLLs, creating <1>: Options. (line 2423)
  7342. * DLLs, creating <2>: Options. (line 2431)
  7343. * DLLs, linking to: Options. (line 2446)
  7344. * dot: Location Counter. (line 6)
  7345. * dot inside sections: Location Counter. (line 36)
  7346. * dot outside sections: Location Counter. (line 66)
  7347. * dynamic linker, from command line: Options. (line 1378)
  7348. * dynamic symbol table: Options. (line 246)
  7349. * ELF program headers: PHDRS. (line 6)
  7350. * ELF symbol visibility: Options. (line 1070)
  7351. * emulation: Options. (line 430)
  7352. * emulation, default: Environment. (line 21)
  7353. * END (MRI): MRI. (line 61)
  7354. * endianness: Options. (line 287)
  7355. * entry point: Entry Point. (line 6)
  7356. * entry point, from command line: Options. (line 212)
  7357. * entry point, thumb: ARM. (line 17)
  7358. * ENTRY(SYMBOL): Entry Point. (line 6)
  7359. * error on valid input: Bug Criteria. (line 12)
  7360. * example of linker script: Simple Example. (line 6)
  7361. * EXCLUDE_FILE: Input Section Basics.
  7362. (line 17)
  7363. * export dynamic symbol: Options. (line 273)
  7364. * export dynamic symbol list: Options. (line 282)
  7365. * exporting DLL symbols: WIN32. (line 19)
  7366. * expression evaluation order: Evaluation. (line 6)
  7367. * expression sections: Expression Section. (line 6)
  7368. * expression, absolute: Builtin Functions. (line 10)
  7369. * expressions: Expressions. (line 6)
  7370. * EXTERN: Miscellaneous Commands.
  7371. (line 39)
  7372. * fatal signal: Bug Criteria. (line 9)
  7373. * file name wildcard patterns: Input Section Wildcards.
  7374. (line 6)
  7375. * FILEHDR: PHDRS. (line 62)
  7376. * filename symbols: Output Section Keywords.
  7377. (line 9)
  7378. * fill pattern, entire section: Output Section Fill.
  7379. (line 6)
  7380. * FILL(EXPRESSION): Output Section Data.
  7381. (line 39)
  7382. * finalization function: Options. (line 338)
  7383. * first input file: File Commands. (line 88)
  7384. * first instruction: Entry Point. (line 6)
  7385. * FIX_V4BX: ARM. (line 48)
  7386. * FIX_V4BX_INTERWORKING: ARM. (line 61)
  7387. * FORCE_COMMON_ALLOCATION: Miscellaneous Commands.
  7388. (line 46)
  7389. * FORCE_GROUP_ALLOCATION: Miscellaneous Commands.
  7390. (line 56)
  7391. * forcing input section alignment: Forced Input Alignment.
  7392. (line 6)
  7393. * forcing output section alignment: Forced Output Alignment.
  7394. (line 6)
  7395. * forcing the creation of dynamic sections: Options. (line 596)
  7396. * FORMAT (MRI): MRI. (line 65)
  7397. * functions in expressions: Builtin Functions. (line 6)
  7398. * garbage collection: Options. (line 1415)
  7399. * garbage collection <1>: Options. (line 1444)
  7400. * garbage collection <2>: Options. (line 1453)
  7401. * garbage collection <3>: Input Section Keep. (line 6)
  7402. * generating optimized output: Options. (line 540)
  7403. * GNU linker: Overview. (line 6)
  7404. * GNUTARGET: Environment. (line 9)
  7405. * group allocation in linker script: Options. (line 1337)
  7406. * group allocation in linker script <1>: Miscellaneous Commands.
  7407. (line 56)
  7408. * GROUP(FILES): File Commands. (line 53)
  7409. * grouping input files: File Commands. (line 53)
  7410. * groups of archives: Options. (line 1114)
  7411. * H8/300 support: H8/300. (line 6)
  7412. * header size: Builtin Functions. (line 190)
  7413. * heap size: Options. (line 2358)
  7414. * help: Options. (line 1481)
  7415. * HIDDEN: HIDDEN. (line 6)
  7416. * holes: Location Counter. (line 12)
  7417. * holes, filling: Output Section Data.
  7418. (line 39)
  7419. * HPPA multiple sub-space stubs: HPPA ELF32. (line 6)
  7420. * HPPA stub grouping: HPPA ELF32. (line 12)
  7421. * image base: Options. (line 2365)
  7422. * implicit linker scripts: Implicit Linker Scripts.
  7423. (line 6)
  7424. * import libraries: WIN32. (line 10)
  7425. * INCLUDE FILENAME: File Commands. (line 9)
  7426. * including a linker script: File Commands. (line 9)
  7427. * including an entire archive: Options. (line 2076)
  7428. * incremental link: Options. (line 363)
  7429. * INHIBIT_COMMON_ALLOCATION: Miscellaneous Commands.
  7430. (line 51)
  7431. * initialization function: Options. (line 366)
  7432. * initialized data in ROM: Output Section LMA. (line 39)
  7433. * input file format in linker script: Format Commands. (line 35)
  7434. * input filename symbols: Output Section Keywords.
  7435. (line 9)
  7436. * input files in linker scripts: File Commands. (line 19)
  7437. * input files, displaying: Options. (line 643)
  7438. * input format: Options. (line 121)
  7439. * input format <1>: Options. (line 121)
  7440. * Input import library: ARM. (line 236)
  7441. * input object files in linker scripts: File Commands. (line 19)
  7442. * input section alignment: Forced Input Alignment.
  7443. (line 6)
  7444. * input section basics: Input Section Basics.
  7445. (line 6)
  7446. * input section wildcards: Input Section Wildcards.
  7447. (line 6)
  7448. * input sections: Input Section. (line 6)
  7449. * INPUT(FILES): File Commands. (line 19)
  7450. * INSERT: Miscellaneous Commands.
  7451. (line 62)
  7452. * insert user script into default script: Miscellaneous Commands.
  7453. (line 62)
  7454. * integer notation: Constants. (line 6)
  7455. * integer suffixes: Constants. (line 15)
  7456. * internal object-file format: Canonical format. (line 11)
  7457. * invalid input: Bug Criteria. (line 14)
  7458. * K and M integer suffixes: Constants. (line 15)
  7459. * KEEP: Input Section Keep. (line 6)
  7460. * l =: MEMORY. (line 72)
  7461. * lazy evaluation: Evaluation. (line 6)
  7462. * ld bugs, reporting: Bug Reporting. (line 6)
  7463. * ldata segment origin, cmd line: Options. (line 1911)
  7464. * LDEMULATION: Environment. (line 21)
  7465. * LD_FEATURE(STRING): Miscellaneous Commands.
  7466. (line 127)
  7467. * len =: MEMORY. (line 72)
  7468. * LENGTH =: MEMORY. (line 72)
  7469. * LENGTH(MEMORY): Builtin Functions. (line 141)
  7470. * library search path in linker script: File Commands. (line 80)
  7471. * link map: Options. (line 440)
  7472. * link map discarded: Options. (line 495)
  7473. * link-time runtime library search path: Options. (line 1731)
  7474. * linker crash: Bug Criteria. (line 9)
  7475. * linker plugins: Plugins. (line 6)
  7476. * linker script concepts: Basic Script Concepts.
  7477. (line 6)
  7478. * linker script example: Simple Example. (line 6)
  7479. * linker script file commands: File Commands. (line 6)
  7480. * linker script format: Script Format. (line 6)
  7481. * linker script input object files: File Commands. (line 19)
  7482. * linker script simple commands: Simple Commands. (line 6)
  7483. * linker scripts: Scripts. (line 6)
  7484. * LIST (MRI): MRI. (line 69)
  7485. * little-endian objects: Options. (line 290)
  7486. * LOAD (MRI): MRI. (line 76)
  7487. * load address: Output Section LMA. (line 6)
  7488. * LOADADDR(SECTION): Builtin Functions. (line 144)
  7489. * loading, preventing: Output Section Type.
  7490. (line 23)
  7491. * local symbols, deleting: Options. (line 749)
  7492. * location counter: Location Counter. (line 6)
  7493. * LOG2CEIL(EXP): Builtin Functions. (line 148)
  7494. * LONG(EXPRESSION): Output Section Data.
  7495. (line 6)
  7496. * M and K integer suffixes: Constants. (line 15)
  7497. * M68HC11 and 68HC12 support: M68HC11/68HC12. (line 5)
  7498. * machine architecture: Miscellaneous Commands.
  7499. (line 121)
  7500. * machine dependencies: Machine Dependent. (line 6)
  7501. * mapping input sections to output sections: Input Section. (line 6)
  7502. * MAX: Builtin Functions. (line 151)
  7503. * MAXPAGESIZE: Symbolic Constants. (line 10)
  7504. * MEMORY: MEMORY. (line 6)
  7505. * memory region attributes: MEMORY. (line 34)
  7506. * memory regions: MEMORY. (line 6)
  7507. * memory regions and sections: Output Section Region.
  7508. (line 6)
  7509. * memory usage: Options. (line 1469)
  7510. * memory usage <1>: Options. (line 1518)
  7511. * Merging exidx entries: ARM. (line 216)
  7512. * MIN: Builtin Functions. (line 154)
  7513. * MIPS branch relocation check control: MIPS. (line 13)
  7514. * MIPS microMIPS instruction choice selection: MIPS. (line 6)
  7515. * Motorola 68K GOT generation: M68K. (line 6)
  7516. * MRI compatibility: MRI. (line 6)
  7517. * MSP430 extra sections: MSP430. (line 11)
  7518. * MSP430 Options: MSP430. (line 34)
  7519. * NAME (MRI): MRI. (line 82)
  7520. * name, section: Output Section Name.
  7521. (line 6)
  7522. * names: Symbols. (line 6)
  7523. * naming the output file: Options. (line 521)
  7524. * NEXT(EXP): Builtin Functions. (line 158)
  7525. * Nios II call relaxation: Nios II. (line 6)
  7526. * NMAGIC: Options. (line 500)
  7527. * NOCROSSREFS(SECTIONS): Miscellaneous Commands.
  7528. (line 88)
  7529. * NOCROSSREFS_TO(TOSECTION FROMSECTIONS): Miscellaneous Commands.
  7530. (line 104)
  7531. * NOLOAD: Output Section Type.
  7532. (line 23)
  7533. * not enough room for program headers: Builtin Functions. (line 195)
  7534. * NO_ENUM_SIZE_WARNING: ARM. (line 155)
  7535. * NO_WCHAR_SIZE_WARNING: ARM. (line 162)
  7536. * o =: MEMORY. (line 67)
  7537. * objdump -i: BFD. (line 6)
  7538. * object file management: BFD. (line 6)
  7539. * object files: Options. (line 29)
  7540. * object formats available: BFD. (line 6)
  7541. * object size: Options. (line 347)
  7542. * OMAGIC: Options. (line 506)
  7543. * OMAGIC <1>: Options. (line 515)
  7544. * ONLY_IF_RO: Output Section Constraint.
  7545. (line 6)
  7546. * ONLY_IF_RW: Output Section Constraint.
  7547. (line 6)
  7548. * opening object files: BFD outline. (line 6)
  7549. * operators for arithmetic: Operators. (line 6)
  7550. * options: Options. (line 6)
  7551. * ORDER (MRI): MRI. (line 87)
  7552. * org =: MEMORY. (line 67)
  7553. * ORIGIN =: MEMORY. (line 67)
  7554. * ORIGIN(MEMORY): Builtin Functions. (line 164)
  7555. * orphan: Orphan Sections. (line 6)
  7556. * orphan sections: Options. (line 704)
  7557. * output file after errors: Options. (line 1612)
  7558. * output file format in linker script: Format Commands. (line 10)
  7559. * output file name in linker script: File Commands. (line 70)
  7560. * output format: Options. (line 1463)
  7561. * output section alignment: Forced Output Alignment.
  7562. (line 6)
  7563. * output section attributes: Output Section Attributes.
  7564. (line 6)
  7565. * output section data: Output Section Data.
  7566. (line 6)
  7567. * OUTPUT(FILENAME): File Commands. (line 70)
  7568. * OUTPUT_ARCH(BFDARCH): Miscellaneous Commands.
  7569. (line 121)
  7570. * OUTPUT_FORMAT(BFDNAME): Format Commands. (line 10)
  7571. * OVERLAY: Overlay Description.
  7572. (line 6)
  7573. * overlays: Overlay Description.
  7574. (line 6)
  7575. * partial link: Options. (line 600)
  7576. * PE import table prefixing: ARM. (line 23)
  7577. * PHDRS: PHDRS. (line 6)
  7578. * PHDRS <1>: PHDRS. (line 62)
  7579. * PIC_VENEER: ARM. (line 168)
  7580. * Placement of SG veneers: ARM. (line 226)
  7581. * plugins: Plugins. (line 6)
  7582. * pop state governing input file handling: Options. (line 583)
  7583. * position dependent executables: Options. (line 1656)
  7584. * position independent executables: Options. (line 1647)
  7585. * PowerPC ELF32 options: PowerPC ELF32. (line 16)
  7586. * PowerPC GOT: PowerPC ELF32. (line 33)
  7587. * PowerPC long branches: PowerPC ELF32. (line 6)
  7588. * PowerPC PLT: PowerPC ELF32. (line 16)
  7589. * PowerPC stub symbols: PowerPC ELF32. (line 47)
  7590. * PowerPC TLS optimization: PowerPC ELF32. (line 51)
  7591. * PowerPC64 dot symbols: PowerPC64 ELF64. (line 33)
  7592. * PowerPC64 ELF64 options: PowerPC64 ELF64. (line 6)
  7593. * PowerPC64 ELFv2 PLT localentry optimization: PowerPC64 ELF64.
  7594. (line 160)
  7595. * PowerPC64 inline PLT call optimization: PowerPC64 ELF64. (line 101)
  7596. * PowerPC64 multi-TOC: PowerPC64 ELF64. (line 109)
  7597. * PowerPC64 OPD optimization: PowerPC64 ELF64. (line 75)
  7598. * PowerPC64 OPD spacing: PowerPC64 ELF64. (line 81)
  7599. * PowerPC64 PLT call stub static chain: PowerPC64 ELF64. (line 142)
  7600. * PowerPC64 PLT call stub thread safety: PowerPC64 ELF64. (line 148)
  7601. * PowerPC64 PLT stub alignment: PowerPC64 ELF64. (line 131)
  7602. * PowerPC64 Power10 stubs: PowerPC64 ELF64. (line 176)
  7603. * PowerPC64 register save/restore functions: PowerPC64 ELF64.
  7604. (line 44)
  7605. * PowerPC64 stub grouping: PowerPC64 ELF64. (line 6)
  7606. * PowerPC64 stub symbols: PowerPC64 ELF64. (line 29)
  7607. * PowerPC64 TLS optimization: PowerPC64 ELF64. (line 51)
  7608. * PowerPC64 TOC optimization: PowerPC64 ELF64. (line 87)
  7609. * PowerPC64 TOC sorting: PowerPC64 ELF64. (line 121)
  7610. * PowerPC64 __tls_get_addr optimization: PowerPC64 ELF64. (line 56)
  7611. * precedence in expressions: Operators. (line 6)
  7612. * prevent unnecessary loading: Output Section Type.
  7613. (line 23)
  7614. * program headers: PHDRS. (line 6)
  7615. * program headers and sections: Output Section Phdr.
  7616. (line 6)
  7617. * program headers, not enough room: Builtin Functions. (line 195)
  7618. * program segments: PHDRS. (line 6)
  7619. * PROVIDE: PROVIDE. (line 6)
  7620. * PROVIDE_HIDDEN: PROVIDE_HIDDEN. (line 6)
  7621. * PUBLIC (MRI): MRI. (line 95)
  7622. * push state governing input file handling: Options. (line 565)
  7623. * QUAD(EXPRESSION): Output Section Data.
  7624. (line 6)
  7625. * quoted symbol names: Symbols. (line 6)
  7626. * read-only text: Options. (line 500)
  7627. * read/write from cmd line: Options. (line 506)
  7628. * region alias: REGION_ALIAS. (line 6)
  7629. * region names: REGION_ALIAS. (line 6)
  7630. * regions of memory: MEMORY. (line 6)
  7631. * REGION_ALIAS(ALIAS, REGION): REGION_ALIAS. (line 6)
  7632. * relative expressions: Expression Section. (line 6)
  7633. * relaxing addressing modes: Options. (line 1664)
  7634. * relaxing on H8/300: H8/300. (line 9)
  7635. * relaxing on M68HC11: M68HC11/68HC12. (line 12)
  7636. * relaxing on NDS32: NDS32. (line 6)
  7637. * relaxing on Xtensa: Xtensa. (line 27)
  7638. * relocatable and absolute symbols: Expression Section. (line 6)
  7639. * relocatable output: Options. (line 600)
  7640. * removing sections: Output Section Discarding.
  7641. (line 6)
  7642. * reporting bugs in ld: Reporting Bugs. (line 6)
  7643. * requirements for BFD: BFD. (line 16)
  7644. * retain relocations in final executable: Options. (line 587)
  7645. * retaining specified symbols: Options. (line 1690)
  7646. * rodata segment origin, cmd line: Options. (line 1905)
  7647. * ROM initialized data: Output Section LMA. (line 39)
  7648. * round up expression: Builtin Functions. (line 38)
  7649. * round up location counter: Builtin Functions. (line 38)
  7650. * runtime library name: Options. (line 354)
  7651. * runtime library search path: Options. (line 1704)
  7652. * runtime pseudo-relocation: WIN32. (line 211)
  7653. * S/390: S/390 ELF. (line 6)
  7654. * S/390 ELF options: S/390 ELF. (line 6)
  7655. * scaled integers: Constants. (line 15)
  7656. * scommon section: Input Section Common.
  7657. (line 20)
  7658. * script files: Options. (line 651)
  7659. * script files <1>: Options. (line 660)
  7660. * scripts: Scripts. (line 6)
  7661. * search directory, from cmd line: Options. (line 405)
  7662. * search path in linker script: File Commands. (line 80)
  7663. * SEARCH_DIR(PATH): File Commands. (line 80)
  7664. * SECT (MRI): MRI. (line 101)
  7665. * section address: Output Section Address.
  7666. (line 6)
  7667. * section address in expression: Builtin Functions. (line 17)
  7668. * section alignment: Builtin Functions. (line 63)
  7669. * section alignment, warnings on: Options. (line 2053)
  7670. * section data: Output Section Data.
  7671. (line 6)
  7672. * section fill pattern: Output Section Fill.
  7673. (line 6)
  7674. * section groups: Options. (line 1337)
  7675. * section groups <1>: Miscellaneous Commands.
  7676. (line 56)
  7677. * section load address: Output Section LMA. (line 6)
  7678. * section load address in expression: Builtin Functions. (line 144)
  7679. * section name: Output Section Name.
  7680. (line 6)
  7681. * section name wildcard patterns: Input Section Wildcards.
  7682. (line 6)
  7683. * section size: Builtin Functions. (line 175)
  7684. * section, assigning to memory region: Output Section Region.
  7685. (line 6)
  7686. * section, assigning to program header: Output Section Phdr.
  7687. (line 6)
  7688. * SECTIONS: SECTIONS. (line 6)
  7689. * sections, discarding: Output Section Discarding.
  7690. (line 6)
  7691. * sections, orphan: Options. (line 704)
  7692. * Secure gateway import library: ARM. (line 231)
  7693. * segment origins, cmd line: Options. (line 1894)
  7694. * segments, ELF: PHDRS. (line 6)
  7695. * SEGMENT_START(SEGMENT, DEFAULT): Builtin Functions. (line 167)
  7696. * shared libraries: Options. (line 1812)
  7697. * SHORT(EXPRESSION): Output Section Data.
  7698. (line 6)
  7699. * SIZEOF(SECTION): Builtin Functions. (line 175)
  7700. * SIZEOF_HEADERS: Builtin Functions. (line 190)
  7701. * small common symbols: Input Section Common.
  7702. (line 20)
  7703. * SORT: Input Section Wildcards.
  7704. (line 58)
  7705. * SORT_BY_ALIGNMENT: Input Section Wildcards.
  7706. (line 45)
  7707. * SORT_BY_INIT_PRIORITY: Input Section Wildcards.
  7708. (line 51)
  7709. * SORT_BY_NAME: Input Section Wildcards.
  7710. (line 37)
  7711. * SORT_NONE: Input Section Wildcards.
  7712. (line 94)
  7713. * SPU: SPU ELF. (line 29)
  7714. * SPU <1>: SPU ELF. (line 46)
  7715. * SPU ELF options: SPU ELF. (line 6)
  7716. * SPU extra overlay stubs: SPU ELF. (line 19)
  7717. * SPU local store size: SPU ELF. (line 24)
  7718. * SPU overlay stub symbols: SPU ELF. (line 15)
  7719. * SPU overlays: SPU ELF. (line 9)
  7720. * SPU plugins: SPU ELF. (line 6)
  7721. * SQUAD(EXPRESSION): Output Section Data.
  7722. (line 6)
  7723. * stack size: Options. (line 2608)
  7724. * standard Unix system: Options. (line 7)
  7725. * start of execution: Entry Point. (line 6)
  7726. * start-stop-gc: Options. (line 1055)
  7727. * STARTUP(FILENAME): File Commands. (line 88)
  7728. * static library dependencies: libdep Plugin. (line 6)
  7729. * STM32L4xx erratum workaround: ARM. (line 117)
  7730. * strip all symbols: Options. (line 629)
  7731. * strip debugger symbols: Options. (line 633)
  7732. * stripping all but some symbols: Options. (line 1690)
  7733. * STUB_GROUP_SIZE: ARM. (line 173)
  7734. * SUBALIGN(SUBSECTION_ALIGN): Forced Input Alignment.
  7735. (line 6)
  7736. * suffixes for integers: Constants. (line 15)
  7737. * symbol defaults: Builtin Functions. (line 124)
  7738. * symbol definition, scripts: Assignments. (line 6)
  7739. * symbol names: Symbols. (line 6)
  7740. * symbol tracing: Options. (line 755)
  7741. * symbol versions: VERSION. (line 6)
  7742. * symbol-only input: Options. (line 618)
  7743. * symbolic constants: Symbolic Constants. (line 6)
  7744. * symbols, from command line: Options. (line 1345)
  7745. * symbols, relocatable and absolute: Expression Section. (line 6)
  7746. * symbols, require defined: Options. (line 686)
  7747. * symbols, retaining selectively: Options. (line 1690)
  7748. * synthesizing linker: Options. (line 1664)
  7749. * synthesizing on H8/300: H8/300. (line 14)
  7750. * TARGET(BFDNAME): Format Commands. (line 35)
  7751. * TARGET1: ARM. (line 33)
  7752. * TARGET2: ARM. (line 38)
  7753. * text segment origin, cmd line: Options. (line 1901)
  7754. * thumb entry point: ARM. (line 17)
  7755. * TI COFF versions: TI COFF. (line 6)
  7756. * traditional format: Options. (line 1873)
  7757. * trampoline generation on M68HC11: M68HC11/68HC12. (line 30)
  7758. * trampoline generation on M68HC12: M68HC11/68HC12. (line 30)
  7759. * unallocated address, next: Builtin Functions. (line 158)
  7760. * undefined symbol: Options. (line 673)
  7761. * undefined symbol in linker script: Miscellaneous Commands.
  7762. (line 39)
  7763. * undefined symbols, warnings on: Options. (line 2049)
  7764. * uninitialized data placement: Input Section Common.
  7765. (line 6)
  7766. * unspecified memory: Output Section Data.
  7767. (line 39)
  7768. * usage: Options. (line 1481)
  7769. * USE_BLX: ARM. (line 73)
  7770. * using a DEF file: WIN32. (line 52)
  7771. * using auto-export functionality: WIN32. (line 22)
  7772. * Using decorations: WIN32. (line 157)
  7773. * variables, defining: Assignments. (line 6)
  7774. * verbose[=NUMBER]: Options. (line 1944)
  7775. * version: Options. (line 739)
  7776. * version script: VERSION. (line 6)
  7777. * version script, symbol versions: Options. (line 1952)
  7778. * VERSION {script text}: VERSION. (line 6)
  7779. * versions of symbols: VERSION. (line 6)
  7780. * VFP11_DENORM_FIX: ARM. (line 79)
  7781. * visibility: Options. (line 1070)
  7782. * warnings, on combining symbols: Options. (line 1962)
  7783. * warnings, on section alignment: Options. (line 2053)
  7784. * warnings, on undefined symbols: Options. (line 2049)
  7785. * weak externals: WIN32. (line 401)
  7786. * what is this?: Overview. (line 6)
  7787. * wildcard file name patterns: Input Section Wildcards.
  7788. (line 6)
  7789. * Xtensa options: Xtensa. (line 55)
  7790. * Xtensa processors: Xtensa. (line 6)
  7791. 
  7792. Tag Table:
  7793. Node: Top703
  7794. Node: Overview1531
  7795. Node: Invocation2647
  7796. Node: Options3055
  7797. Node: Environment134035
  7798. Node: Scripts135796
  7799. Node: Basic Script Concepts137520
  7800. Node: Script Format140228
  7801. Node: Simple Example141091
  7802. Node: Simple Commands144185
  7803. Node: Entry Point144690
  7804. Node: File Commands145726
  7805. Node: Format Commands150035
  7806. Node: REGION_ALIAS151991
  7807. Node: Miscellaneous Commands156818
  7808. Node: Assignments162649
  7809. Node: Simple Assignments163160
  7810. Node: HIDDEN164891
  7811. Node: PROVIDE165518
  7812. Node: PROVIDE_HIDDEN167044
  7813. Node: Source Code Reference167288
  7814. Node: SECTIONS171205
  7815. Node: Output Section Description173093
  7816. Node: Output Section Name174334
  7817. Node: Output Section Address175211
  7818. Node: Input Section177444
  7819. Node: Input Section Basics178245
  7820. Node: Input Section Wildcards183263
  7821. Node: Input Section Common188204
  7822. Node: Input Section Keep189686
  7823. Node: Input Section Example190176
  7824. Node: Output Section Data191587
  7825. Node: Output Section Keywords194366
  7826. Node: Output Section Discarding197933
  7827. Node: Output Section Attributes199823
  7828. Node: Output Section Type200942
  7829. Node: Output Section LMA202071
  7830. Node: Forced Output Alignment205142
  7831. Node: Forced Input Alignment205571
  7832. Node: Output Section Constraint205959
  7833. Node: Output Section Region206387
  7834. Node: Output Section Phdr206820
  7835. Node: Output Section Fill207484
  7836. Node: Overlay Description208626
  7837. Node: MEMORY213071
  7838. Node: PHDRS217677
  7839. Node: VERSION223003
  7840. Node: Expressions231094
  7841. Node: Constants232107
  7842. Node: Symbolic Constants232981
  7843. Node: Symbols233532
  7844. Node: Orphan Sections234279
  7845. Node: Location Counter235864
  7846. Node: Operators240298
  7847. Node: Evaluation241220
  7848. Node: Expression Section242584
  7849. Node: Builtin Functions246554
  7850. Node: Implicit Linker Scripts254888
  7851. Node: Plugins255663
  7852. Node: libdep Plugin256123
  7853. Node: Machine Dependent257920
  7854. Node: H8/300259008
  7855. Node: M68HC11/68HC12261081
  7856. Node: ARM262528
  7857. Node: HPPA ELF32274638
  7858. Node: M68K276261
  7859. Node: MIPS277170
  7860. Node: MMIX278286
  7861. Node: MSP430279451
  7862. Node: NDS32281364
  7863. Node: Nios II282328
  7864. Node: PowerPC ELF32283644
  7865. Node: PowerPC64 ELF64286475
  7866. Node: S/390 ELF296233
  7867. Node: SPU ELF296580
  7868. Node: TI COFF299208
  7869. Node: WIN32299734
  7870. Node: Xtensa319881
  7871. Node: BFD323324
  7872. Node: BFD outline324782
  7873. Node: BFD information loss326070
  7874. Node: Canonical format328596
  7875. Node: Reporting Bugs332924
  7876. Node: Bug Criteria333618
  7877. Node: Bug Reporting334317
  7878. Node: MRI341352
  7879. Node: GNU Free Documentation License345823
  7880. Node: LD Index370960
  7881. 
  7882. End Tag Table
  7883. 
  7884. Local Variables:
  7885. coding: utf-8
  7886. End: