binutils.texi 215 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759
  1. \input texinfo @c -*- Texinfo -*-
  2. @setfilename binutils.info
  3. @settitle @sc{gnu} Binary Utilities
  4. @finalout
  5. @synindex ky cp
  6. @c man begin INCLUDE
  7. @include bfdver.texi
  8. @c man end
  9. @copying
  10. @c man begin COPYRIGHT
  11. Copyright @copyright{} 1991-2022 Free Software Foundation, Inc.
  12. Permission is granted to copy, distribute and/or modify this document
  13. under the terms of the GNU Free Documentation License, Version 1.3
  14. or any later version published by the Free Software Foundation;
  15. with no Invariant Sections, with no Front-Cover Texts, and with no
  16. Back-Cover Texts. A copy of the license is included in the
  17. section entitled ``GNU Free Documentation License''.
  18. @c man end
  19. @end copying
  20. @dircategory Software development
  21. @direntry
  22. * Binutils: (binutils). The GNU binary utilities.
  23. @end direntry
  24. @dircategory Individual utilities
  25. @direntry
  26. * addr2line: (binutils)addr2line. Convert addresses to file and line.
  27. * ar: (binutils)ar. Create, modify, and extract from archives.
  28. * c++filt: (binutils)c++filt. Filter to demangle encoded C++ symbols.
  29. * cxxfilt: (binutils)c++filt. MS-DOS name for c++filt.
  30. * dlltool: (binutils)dlltool. Create files needed to build and use DLLs.
  31. * nm: (binutils)nm. List symbols from object files.
  32. * objcopy: (binutils)objcopy. Copy and translate object files.
  33. * objdump: (binutils)objdump. Display information from object files.
  34. * ranlib: (binutils)ranlib. Generate index to archive contents.
  35. * readelf: (binutils)readelf. Display the contents of ELF format files.
  36. * size: (binutils)size. List section sizes and total size.
  37. * strings: (binutils)strings. List printable strings from files.
  38. * strip: (binutils)strip. Discard symbols.
  39. * elfedit: (binutils)elfedit. Update ELF header and property of ELF files.
  40. * windmc: (binutils)windmc. Generator for Windows message resources.
  41. * windres: (binutils)windres. Manipulate Windows resources.
  42. @end direntry
  43. @titlepage
  44. @title The @sc{gnu} Binary Utilities
  45. @ifset VERSION_PACKAGE
  46. @subtitle @value{VERSION_PACKAGE}
  47. @end ifset
  48. @subtitle Version @value{VERSION}
  49. @sp 1
  50. @subtitle @value{UPDATED}
  51. @author Roland H. Pesch
  52. @author Jeffrey M. Osier
  53. @author Cygnus Support
  54. @page
  55. @tex
  56. {\parskip=0pt \hfill Cygnus Support\par \hfill
  57. Texinfo \texinfoversion\par }
  58. @end tex
  59. @vskip 0pt plus 1filll
  60. @insertcopying
  61. @end titlepage
  62. @contents
  63. @node Top
  64. @top Introduction
  65. @cindex version
  66. This brief manual contains documentation for the @sc{gnu} binary
  67. utilities
  68. @ifset VERSION_PACKAGE
  69. @value{VERSION_PACKAGE}
  70. @end ifset
  71. version @value{VERSION}:
  72. @iftex
  73. @table @code
  74. @item ar
  75. Create, modify, and extract from archives
  76. @item nm
  77. List symbols from object files
  78. @item objcopy
  79. Copy and translate object files
  80. @item objdump
  81. Display information from object files
  82. @item ranlib
  83. Generate index to archive contents
  84. @item readelf
  85. Display the contents of ELF format files.
  86. @item size
  87. List file section sizes and total size
  88. @item strings
  89. List printable strings from files
  90. @item strip
  91. Discard symbols
  92. @item elfedit
  93. Update the ELF header and program property of ELF files.
  94. @item c++filt
  95. Demangle encoded C++ symbols (on MS-DOS, this program is named
  96. @code{cxxfilt})
  97. @item addr2line
  98. Convert addresses or symbol+offset into file names and line numbers
  99. @item windres
  100. Manipulate Windows resources
  101. @item windmc
  102. Generator for Windows message resources
  103. @item dlltool
  104. Create the files needed to build and use Dynamic Link Libraries
  105. @end table
  106. @end iftex
  107. This document is distributed under the terms of the GNU Free
  108. Documentation License version 1.3. A copy of the license is included
  109. in the section entitled ``GNU Free Documentation License''.
  110. @menu
  111. * ar:: Create, modify, and extract from archives
  112. * nm:: List symbols from object files
  113. * objcopy:: Copy and translate object files
  114. * objdump:: Display information from object files
  115. * ranlib:: Generate index to archive contents
  116. * size:: List section sizes and total size
  117. * strings:: List printable strings from files
  118. * strip:: Discard symbols
  119. * c++filt:: Filter to demangle encoded C++ symbols
  120. * cxxfilt: c++filt. MS-DOS name for c++filt
  121. * addr2line:: Convert addresses or symbol+offset to file and line
  122. * windmc:: Generator for Windows message resources
  123. * windres:: Manipulate Windows resources
  124. * dlltool:: Create files needed to build and use DLLs
  125. * readelf:: Display the contents of ELF format files
  126. * elfedit:: Update ELF header and property of ELF files
  127. * Common Options:: Command-line options for all utilities
  128. * Selecting the Target System:: How these utilities determine the target
  129. * debuginfod:: Using binutils with debuginfod
  130. * Reporting Bugs:: Reporting Bugs
  131. * GNU Free Documentation License:: GNU Free Documentation License
  132. * Binutils Index:: Binutils Index
  133. @end menu
  134. @node ar
  135. @chapter ar
  136. @kindex ar
  137. @cindex archives
  138. @cindex collections of files
  139. @c man title ar create, modify, and extract from archives
  140. @smallexample
  141. ar [-]@var{p}[@var{mod}] [@option{--plugin} @var{name}] [@option{--target} @var{bfdname}] [@option{--output} @var{dirname}] [@option{--record-libdeps} @var{libdeps}] [@var{relpos}] [@var{count}] @var{archive} [@var{member}@dots{}]
  142. ar -M [ <mri-script ]
  143. @end smallexample
  144. @c man begin DESCRIPTION ar
  145. The @sc{gnu} @command{ar} program creates, modifies, and extracts from
  146. archives. An @dfn{archive} is a single file holding a collection of
  147. other files in a structure that makes it possible to retrieve
  148. the original individual files (called @dfn{members} of the archive).
  149. The original files' contents, mode (permissions), timestamp, owner, and
  150. group are preserved in the archive, and can be restored on
  151. extraction.
  152. @cindex name length
  153. @sc{gnu} @command{ar} can maintain archives whose members have names of any
  154. length; however, depending on how @command{ar} is configured on your
  155. system, a limit on member-name length may be imposed for compatibility
  156. with archive formats maintained with other tools. If it exists, the
  157. limit is often 15 characters (typical of formats related to a.out) or 16
  158. characters (typical of formats related to coff).
  159. @cindex libraries
  160. @command{ar} is considered a binary utility because archives of this sort
  161. are most often used as @dfn{libraries} holding commonly needed
  162. subroutines. Since libraries often will depend on other libraries,
  163. @command{ar} can also record the dependencies of a library when the
  164. @option{--record-libdeps} option is specified.
  165. @cindex symbol index
  166. @command{ar} creates an index to the symbols defined in relocatable
  167. object modules in the archive when you specify the modifier @samp{s}.
  168. Once created, this index is updated in the archive whenever @command{ar}
  169. makes a change to its contents (save for the @samp{q} update operation).
  170. An archive with such an index speeds up linking to the library, and
  171. allows routines in the library to call each other without regard to
  172. their placement in the archive.
  173. You may use @samp{nm -s} or @samp{nm --print-armap} to list this index
  174. table. If an archive lacks the table, another form of @command{ar} called
  175. @command{ranlib} can be used to add just the table.
  176. @cindex thin archives
  177. @sc{gnu} @command{ar} can optionally create a @emph{thin} archive,
  178. which contains a symbol index and references to the original copies
  179. of the member files of the archive. This is useful for building
  180. libraries for use within a local build tree, where the relocatable
  181. objects are expected to remain available, and copying the contents of
  182. each object would only waste time and space.
  183. An archive can either be @emph{thin} or it can be normal. It cannot
  184. be both at the same time. Once an archive is created its format
  185. cannot be changed without first deleting it and then creating a new
  186. archive in its place.
  187. Thin archives are also @emph{flattened}, so that adding one thin
  188. archive to another thin archive does not nest it, as would happen with
  189. a normal archive. Instead the elements of the first archive are added
  190. individually to the second archive.
  191. The paths to the elements of the archive are stored relative to the
  192. archive itself.
  193. @cindex compatibility, @command{ar}
  194. @cindex @command{ar} compatibility
  195. @sc{gnu} @command{ar} is designed to be compatible with two different
  196. facilities. You can control its activity using command-line options,
  197. like the different varieties of @command{ar} on Unix systems; or, if you
  198. specify the single command-line option @option{-M}, you can control it
  199. with a script supplied via standard input, like the MRI ``librarian''
  200. program.
  201. @c man end
  202. @menu
  203. * ar cmdline:: Controlling @command{ar} on the command line
  204. * ar scripts:: Controlling @command{ar} with a script
  205. @end menu
  206. @page
  207. @node ar cmdline
  208. @section Controlling @command{ar} on the Command Line
  209. @smallexample
  210. @c man begin SYNOPSIS ar
  211. ar [@option{-X32_64}] [@option{-}]@var{p}[@var{mod}] [@option{--plugin} @var{name}] [@option{--target} @var{bfdname}] [@option{--output} @var{dirname}] [@option{--record-libdeps} @var{libdeps}] [@option{--thin}] [@var{relpos}] [@var{count}] @var{archive} [@var{member}@dots{}]
  212. @c man end
  213. @end smallexample
  214. @cindex Unix compatibility, @command{ar}
  215. When you use @command{ar} in the Unix style, @command{ar} insists on at least two
  216. arguments to execute: one keyletter specifying the @emph{operation}
  217. (optionally accompanied by other keyletters specifying
  218. @emph{modifiers}), and the archive name to act on.
  219. Most operations can also accept further @var{member} arguments,
  220. specifying particular files to operate on.
  221. @c man begin OPTIONS ar
  222. @sc{gnu} @command{ar} allows you to mix the operation code @var{p} and modifier
  223. flags @var{mod} in any order, within the first command-line argument.
  224. If you wish, you may begin the first command-line argument with a
  225. dash.
  226. @cindex operations on archive
  227. The @var{p} keyletter specifies what operation to execute; it may be
  228. any of the following, but you must specify only one of them:
  229. @table @samp
  230. @item d
  231. @cindex deleting from archive
  232. @emph{Delete} modules from the archive. Specify the names of modules to
  233. be deleted as @var{member}@dots{}; the archive is untouched if you
  234. specify no files to delete.
  235. If you specify the @samp{v} modifier, @command{ar} lists each module
  236. as it is deleted.
  237. @item m
  238. @cindex moving in archive
  239. Use this operation to @emph{move} members in an archive.
  240. The ordering of members in an archive can make a difference in how
  241. programs are linked using the library, if a symbol is defined in more
  242. than one member.
  243. If no modifiers are used with @code{m}, any members you name in the
  244. @var{member} arguments are moved to the @emph{end} of the archive;
  245. you can use the @samp{a}, @samp{b}, or @samp{i} modifiers to move them to a
  246. specified place instead.
  247. @item p
  248. @cindex printing from archive
  249. @emph{Print} the specified members of the archive, to the standard
  250. output file. If the @samp{v} modifier is specified, show the member
  251. name before copying its contents to standard output.
  252. If you specify no @var{member} arguments, all the files in the archive are
  253. printed.
  254. @item q
  255. @cindex quick append to archive
  256. @emph{Quick append}; Historically, add the files @var{member}@dots{} to the end of
  257. @var{archive}, without checking for replacement.
  258. The modifiers @samp{a}, @samp{b}, and @samp{i} do @emph{not} affect this
  259. operation; new members are always placed at the end of the archive.
  260. The modifier @samp{v} makes @command{ar} list each file as it is appended.
  261. Since the point of this operation is speed, implementations of
  262. @command{ar} have the option of not updating the archive's symbol
  263. table if one exists. Too many different systems however assume that
  264. symbol tables are always up-to-date, so @sc{gnu} @command{ar} will
  265. rebuild the table even with a quick append.
  266. Note - @sc{gnu} @command{ar} treats the command @samp{qs} as a
  267. synonym for @samp{r} - replacing already existing files in the
  268. archive and appending new ones at the end.
  269. @item r
  270. @cindex replacement in archive
  271. Insert the files @var{member}@dots{} into @var{archive} (with
  272. @emph{replacement}). This operation differs from @samp{q} in that any
  273. previously existing members are deleted if their names match those being
  274. added.
  275. If one of the files named in @var{member}@dots{} does not exist, @command{ar}
  276. displays an error message, and leaves undisturbed any existing members
  277. of the archive matching that name.
  278. By default, new members are added at the end of the file; but you may
  279. use one of the modifiers @samp{a}, @samp{b}, or @samp{i} to request
  280. placement relative to some existing member.
  281. The modifier @samp{v} used with this operation elicits a line of
  282. output for each file inserted, along with one of the letters @samp{a} or
  283. @samp{r} to indicate whether the file was appended (no old member
  284. deleted) or replaced.
  285. @item s
  286. @cindex ranlib
  287. Add an index to the archive, or update it if it already exists. Note
  288. this command is an exception to the rule that there can only be one
  289. command letter, as it is possible to use it as either a command or a
  290. modifier. In either case it does the same thing.
  291. @item t
  292. @cindex contents of archive
  293. Display a @emph{table} listing the contents of @var{archive}, or those
  294. of the files listed in @var{member}@dots{} that are present in the
  295. archive. Normally only the member name is shown, but if the modifier
  296. @samp{O} is specified, then the corresponding offset of the member is also
  297. displayed. Finally, in order to see the modes (permissions), timestamp,
  298. owner, group, and size the @samp{v} modifier should be included.
  299. If you do not specify a @var{member}, all files in the archive
  300. are listed.
  301. @cindex repeated names in archive
  302. @cindex name duplication in archive
  303. If there is more than one file with the same name (say, @samp{fie}) in
  304. an archive (say @samp{b.a}), @samp{ar t b.a fie} lists only the
  305. first instance; to see them all, you must ask for a complete
  306. listing---in our example, @samp{ar t b.a}.
  307. @c WRS only; per Gumby, this is implementation-dependent, and in a more
  308. @c recent case in fact works the other way.
  309. @item x
  310. @cindex extract from archive
  311. @emph{Extract} members (named @var{member}) from the archive. You can
  312. use the @samp{v} modifier with this operation, to request that
  313. @command{ar} list each name as it extracts it.
  314. If you do not specify a @var{member}, all files in the archive
  315. are extracted.
  316. Files cannot be extracted from a thin archive, and there are
  317. restrictions on extracting from archives created with @option{P}: The
  318. paths must not be absolute, may not contain @code{..}, and any
  319. subdirectories in the paths must exist. If it is desired to avoid
  320. these restrictions then used the @option{--output} option to specify
  321. an output directory.
  322. @end table
  323. A number of modifiers (@var{mod}) may immediately follow the @var{p}
  324. keyletter, to specify variations on an operation's behavior:
  325. @table @samp
  326. @item a
  327. @cindex relative placement in archive
  328. Add new files @emph{after} an existing member of the
  329. archive. If you use the modifier @samp{a}, the name of an existing archive
  330. member must be present as the @var{relpos} argument, before the
  331. @var{archive} specification.
  332. @item b
  333. Add new files @emph{before} an existing member of the
  334. archive. If you use the modifier @samp{b}, the name of an existing archive
  335. member must be present as the @var{relpos} argument, before the
  336. @var{archive} specification. (same as @samp{i}).
  337. @item c
  338. @cindex creating archives
  339. @emph{Create} the archive. The specified @var{archive} is always
  340. created if it did not exist, when you request an update. But a warning is
  341. issued unless you specify in advance that you expect to create it, by
  342. using this modifier.
  343. @item D
  344. @cindex deterministic archives
  345. @kindex --enable-deterministic-archives
  346. Operate in @emph{deterministic} mode. When adding files and the archive
  347. index use zero for UIDs, GIDs, timestamps, and use consistent file modes
  348. for all files. When this option is used, if @command{ar} is used with
  349. identical options and identical input files, multiple runs will create
  350. identical output files regardless of the input files' owners, groups,
  351. file modes, or modification times.
  352. If @file{binutils} was configured with
  353. @option{--enable-deterministic-archives}, then this mode is on by default.
  354. It can be disabled with the @samp{U} modifier, below.
  355. @item f
  356. Truncate names in the archive. @sc{gnu} @command{ar} will normally permit file
  357. names of any length. This will cause it to create archives which are
  358. not compatible with the native @command{ar} program on some systems. If
  359. this is a concern, the @samp{f} modifier may be used to truncate file
  360. names when putting them in the archive.
  361. @item i
  362. Insert new files @emph{before} an existing member of the
  363. archive. If you use the modifier @samp{i}, the name of an existing archive
  364. member must be present as the @var{relpos} argument, before the
  365. @var{archive} specification. (same as @samp{b}).
  366. @item l
  367. @c This modifier was accepted but not used.
  368. @c whaffor ar l modifier??? presumably compat; with
  369. @c what???---doc@@cygnus.com, 25jan91
  370. Specify dependencies of this library. The dependencies must immediately
  371. follow this option character, must use the same syntax as the linker
  372. command line, and must be specified within a single argument. I.e., if
  373. multiple items are needed, they must be quoted to form a single command
  374. line argument. For example @samp{L "-L/usr/local/lib -lmydep1 -lmydep2"}
  375. @item N
  376. Uses the @var{count} parameter. This is used if there are multiple
  377. entries in the archive with the same name. Extract or delete instance
  378. @var{count} of the given name from the archive.
  379. @item o
  380. @cindex dates in archive
  381. Preserve the @emph{original} dates of members when extracting them. If
  382. you do not specify this modifier, files extracted from the archive
  383. are stamped with the time of extraction.
  384. @item O
  385. @cindex offsets of files
  386. Display member offsets inside the archive. Use together with the @samp{t}
  387. option.
  388. @item P
  389. Use the full path name when matching or storing names in the archive.
  390. Archives created with full path names are not POSIX compliant, and
  391. thus may not work with tools other than up to date @sc{gnu} tools.
  392. Modifying such archives with @sc{gnu} @command{ar} without using
  393. @option{P} will remove the full path names unless the archive is a
  394. thin archive. Note that @option{P} may be useful when adding files to
  395. a thin archive since @option{r} without @option{P} ignores the path
  396. when choosing which element to replace. Thus
  397. @smallexample
  398. ar rcST archive.a subdir/file1 subdir/file2 file1
  399. @end smallexample
  400. will result in the first @code{subdir/file1} being replaced with
  401. @code{file1} from the current directory. Adding @option{P} will
  402. prevent this replacement.
  403. @item s
  404. @cindex writing archive index
  405. Write an object-file index into the archive, or update an existing one,
  406. even if no other change is made to the archive. You may use this modifier
  407. flag either with any operation, or alone. Running @samp{ar s} on an
  408. archive is equivalent to running @samp{ranlib} on it.
  409. @item S
  410. @cindex not writing archive index
  411. Do not generate an archive symbol table. This can speed up building a
  412. large library in several steps. The resulting archive can not be used
  413. with the linker. In order to build a symbol table, you must omit the
  414. @samp{S} modifier on the last execution of @samp{ar}, or you must run
  415. @samp{ranlib} on the archive.
  416. @item T
  417. Deprecated alias for @option{--thin}. @option{T} is not recommended because in
  418. many ar implementations @option{T} has a different meaning, as specified by
  419. X/Open System Interface.
  420. @item u
  421. @cindex updating an archive
  422. Normally, @samp{ar r}@dots{} inserts all files
  423. listed into the archive. If you would like to insert @emph{only} those
  424. of the files you list that are newer than existing members of the same
  425. names, use this modifier. The @samp{u} modifier is allowed only for the
  426. operation @samp{r} (replace). In particular, the combination @samp{qu} is
  427. not allowed, since checking the timestamps would lose any speed
  428. advantage from the operation @samp{q}.
  429. @item U
  430. @cindex deterministic archives
  431. @kindex --enable-deterministic-archives
  432. Do @emph{not} operate in @emph{deterministic} mode. This is the inverse
  433. of the @samp{D} modifier, above: added files and the archive index will
  434. get their actual UID, GID, timestamp, and file mode values.
  435. This is the default unless @file{binutils} was configured with
  436. @option{--enable-deterministic-archives}.
  437. @item v
  438. This modifier requests the @emph{verbose} version of an operation. Many
  439. operations display additional information, such as filenames processed,
  440. when the modifier @samp{v} is appended.
  441. @item V
  442. This modifier shows the version number of @command{ar}.
  443. @end table
  444. The @command{ar} program also supports some command-line options which
  445. are neither modifiers nor actions, but which do change its behaviour
  446. in specific ways:
  447. @table @samp
  448. @item --help
  449. Displays the list of command-line options supported by @command{ar}
  450. and then exits.
  451. @item --version
  452. Displays the version information of @command{ar} and then exits.
  453. @item -X32_64
  454. @command{ar} ignores an initial option spelled @samp{-X32_64}, for
  455. compatibility with AIX. The behaviour produced by this option is the
  456. default for @sc{gnu} @command{ar}. @command{ar} does not support any
  457. of the other @samp{-X} options; in particular, it does not support
  458. @option{-X32} which is the default for AIX @command{ar}.
  459. @item --plugin @var{name}
  460. @cindex plugins
  461. The optional command-line switch @option{--plugin @var{name}} causes
  462. @command{ar} to load the plugin called @var{name} which adds support
  463. for more file formats, including object files with link-time
  464. optimization information.
  465. This option is only available if the toolchain has been built with
  466. plugin support enabled.
  467. If @option{--plugin} is not provided, but plugin support has been
  468. enabled then @command{ar} iterates over the files in
  469. @file{$@{libdir@}/bfd-plugins} in alphabetic order and the first
  470. plugin that claims the object in question is used.
  471. Please note that this plugin search directory is @emph{not} the one
  472. used by @command{ld}'s @option{-plugin} option. In order to make
  473. @command{ar} use the linker plugin it must be copied into the
  474. @file{$@{libdir@}/bfd-plugins} directory. For GCC based compilations
  475. the linker plugin is called @file{liblto_plugin.so.0.0.0}. For Clang
  476. based compilations it is called @file{LLVMgold.so}. The GCC plugin
  477. is always backwards compatible with earlier versions, so it is
  478. sufficient to just copy the newest one.
  479. @item --target @var{target}
  480. The optional command-line switch @option{--target @var{bfdname}}
  481. specifies that the archive members are in an object code format
  482. different from your system's default format. See
  483. @xref{Target Selection}, for more information.
  484. @item --output @var{dirname}
  485. The @option{--output} option can be used to specify a path to a
  486. directory into which archive members should be extracted. If this
  487. option is not specified then the current directory will be used.
  488. Note - although the presence of this option does imply a @option{x}
  489. extraction operation that option must still be included on the command
  490. line.
  491. @item --record-libdeps @var{libdeps}
  492. The @option{--record-libdeps} option is identical to the @option{l} modifier,
  493. just handled in long form.
  494. @item --thin
  495. @cindex creating thin archive
  496. Make the specified @var{archive} a @emph{thin} archive. If it already
  497. exists and is a regular archive, the existing members must be present
  498. in the same directory as @var{archive}.
  499. @end table
  500. @c man end
  501. @ignore
  502. @c man begin SEEALSO ar
  503. nm(1), ranlib(1), and the Info entries for @file{binutils}.
  504. @c man end
  505. @end ignore
  506. @node ar scripts
  507. @section Controlling @command{ar} with a Script
  508. @smallexample
  509. ar -M [ <@var{script} ]
  510. @end smallexample
  511. @cindex MRI compatibility, @command{ar}
  512. @cindex scripts, @command{ar}
  513. If you use the single command-line option @samp{-M} with @command{ar}, you
  514. can control its operation with a rudimentary command language. This
  515. form of @command{ar} operates interactively if standard input is coming
  516. directly from a terminal. During interactive use, @command{ar} prompts for
  517. input (the prompt is @samp{AR >}), and continues executing even after
  518. errors. If you redirect standard input to a script file, no prompts are
  519. issued, and @command{ar} abandons execution (with a nonzero exit code)
  520. on any error.
  521. The @command{ar} command language is @emph{not} designed to be equivalent
  522. to the command-line options; in fact, it provides somewhat less control
  523. over archives. The only purpose of the command language is to ease the
  524. transition to @sc{gnu} @command{ar} for developers who already have scripts
  525. written for the MRI ``librarian'' program.
  526. The syntax for the @command{ar} command language is straightforward:
  527. @itemize @bullet
  528. @item
  529. commands are recognized in upper or lower case; for example, @code{LIST}
  530. is the same as @code{list}. In the following descriptions, commands are
  531. shown in upper case for clarity.
  532. @item
  533. a single command may appear on each line; it is the first word on the
  534. line.
  535. @item
  536. empty lines are allowed, and have no effect.
  537. @item
  538. comments are allowed; text after either of the characters @samp{*}
  539. or @samp{;} is ignored.
  540. @item
  541. Whenever you use a list of names as part of the argument to an @command{ar}
  542. command, you can separate the individual names with either commas or
  543. blanks. Commas are shown in the explanations below, for clarity.
  544. @item
  545. @samp{+} is used as a line continuation character; if @samp{+} appears
  546. at the end of a line, the text on the following line is considered part
  547. of the current command.
  548. @end itemize
  549. Here are the commands you can use in @command{ar} scripts, or when using
  550. @command{ar} interactively. Three of them have special significance:
  551. @code{OPEN} or @code{CREATE} specify a @dfn{current archive}, which is
  552. a temporary file required for most of the other commands.
  553. @code{SAVE} commits the changes so far specified by the script. Prior
  554. to @code{SAVE}, commands affect only the temporary copy of the current
  555. archive.
  556. @table @code
  557. @item ADDLIB @var{archive}
  558. @itemx ADDLIB @var{archive} (@var{module}, @var{module}, @dots{} @var{module})
  559. Add all the contents of @var{archive} (or, if specified, each named
  560. @var{module} from @var{archive}) to the current archive.
  561. Requires prior use of @code{OPEN} or @code{CREATE}.
  562. @item ADDMOD @var{member}, @var{member}, @dots{} @var{member}
  563. @c FIXME! w/Replacement?? If so, like "ar r @var{archive} @var{names}"
  564. @c else like "ar q..."
  565. Add each named @var{member} as a module in the current archive.
  566. Requires prior use of @code{OPEN} or @code{CREATE}.
  567. @item CLEAR
  568. Discard the contents of the current archive, canceling the effect of
  569. any operations since the last @code{SAVE}. May be executed (with no
  570. effect) even if no current archive is specified.
  571. @item CREATE @var{archive}
  572. Creates an archive, and makes it the current archive (required for many
  573. other commands). The new archive is created with a temporary name; it
  574. is not actually saved as @var{archive} until you use @code{SAVE}.
  575. You can overwrite existing archives; similarly, the contents of any
  576. existing file named @var{archive} will not be destroyed until @code{SAVE}.
  577. @item DELETE @var{module}, @var{module}, @dots{} @var{module}
  578. Delete each listed @var{module} from the current archive; equivalent to
  579. @samp{ar -d @var{archive} @var{module} @dots{} @var{module}}.
  580. Requires prior use of @code{OPEN} or @code{CREATE}.
  581. @item DIRECTORY @var{archive} (@var{module}, @dots{} @var{module})
  582. @itemx DIRECTORY @var{archive} (@var{module}, @dots{} @var{module}) @var{outputfile}
  583. List each named @var{module} present in @var{archive}. The separate
  584. command @code{VERBOSE} specifies the form of the output: when verbose
  585. output is off, output is like that of @samp{ar -t @var{archive}
  586. @var{module}@dots{}}. When verbose output is on, the listing is like
  587. @samp{ar -tv @var{archive} @var{module}@dots{}}.
  588. Output normally goes to the standard output stream; however, if you
  589. specify @var{outputfile} as a final argument, @command{ar} directs the
  590. output to that file.
  591. @item END
  592. Exit from @command{ar}, with a @code{0} exit code to indicate successful
  593. completion. This command does not save the output file; if you have
  594. changed the current archive since the last @code{SAVE} command, those
  595. changes are lost.
  596. @item EXTRACT @var{module}, @var{module}, @dots{} @var{module}
  597. Extract each named @var{module} from the current archive, writing them
  598. into the current directory as separate files. Equivalent to @samp{ar -x
  599. @var{archive} @var{module}@dots{}}.
  600. Requires prior use of @code{OPEN} or @code{CREATE}.
  601. @ignore
  602. @c FIXME Tokens but no commands???
  603. @item FULLDIR
  604. @item HELP
  605. @end ignore
  606. @item LIST
  607. Display full contents of the current archive, in ``verbose'' style
  608. regardless of the state of @code{VERBOSE}. The effect is like @samp{ar
  609. tv @var{archive}}. (This single command is a @sc{gnu} @command{ar}
  610. enhancement, rather than present for MRI compatibility.)
  611. Requires prior use of @code{OPEN} or @code{CREATE}.
  612. @item OPEN @var{archive}
  613. Opens an existing archive for use as the current archive (required for
  614. many other commands). Any changes as the result of subsequent commands
  615. will not actually affect @var{archive} until you next use @code{SAVE}.
  616. @item REPLACE @var{module}, @var{module}, @dots{} @var{module}
  617. In the current archive, replace each existing @var{module} (named in
  618. the @code{REPLACE} arguments) from files in the current working directory.
  619. To execute this command without errors, both the file, and the module in
  620. the current archive, must exist.
  621. Requires prior use of @code{OPEN} or @code{CREATE}.
  622. @item VERBOSE
  623. Toggle an internal flag governing the output from @code{DIRECTORY}.
  624. When the flag is on, @code{DIRECTORY} output matches output from
  625. @samp{ar -tv }@dots{}.
  626. @item SAVE
  627. Commit your changes to the current archive, and actually save it as a
  628. file with the name specified in the last @code{CREATE} or @code{OPEN}
  629. command.
  630. Requires prior use of @code{OPEN} or @code{CREATE}.
  631. @end table
  632. @iftex
  633. @node ld
  634. @chapter ld
  635. @cindex linker
  636. @kindex ld
  637. The @sc{gnu} linker @command{ld} is now described in a separate manual.
  638. @xref{Top,, Overview,, Using LD: the @sc{gnu} linker}.
  639. @end iftex
  640. @node nm
  641. @chapter nm
  642. @cindex symbols
  643. @kindex nm
  644. @c man title nm list symbols from object files
  645. @smallexample
  646. @c man begin SYNOPSIS nm
  647. nm [@option{-A}|@option{-o}|@option{--print-file-name}]
  648. [@option{-a}|@option{--debug-syms}]
  649. [@option{-B}|@option{--format=bsd}]
  650. [@option{-C}|@option{--demangle}[=@var{style}]]
  651. [@option{-D}|@option{--dynamic}]
  652. [@option{-f}@var{format}|@option{--format=}@var{format}]
  653. [@option{-g}|@option{--extern-only}]
  654. [@option{-h}|@option{--help}]
  655. [@option{--ifunc-chars=@var{CHARS}}]
  656. [@option{-j}|@option{--format=just-symbols}]
  657. [@option{-l}|@option{--line-numbers}] [@option{--inlines}]
  658. [@option{-n}|@option{-v}|@option{--numeric-sort}]
  659. [@option{-P}|@option{--portability}]
  660. [@option{-p}|@option{--no-sort}]
  661. [@option{-r}|@option{--reverse-sort}]
  662. [@option{-S}|@option{--print-size}]
  663. [@option{-s}|@option{--print-armap}]
  664. [@option{-t} @var{radix}|@option{--radix=}@var{radix}]
  665. [@option{-u}|@option{--undefined-only}]
  666. [@option{-U} @var{method}] [@option{--unicode=}@var{method}]
  667. [@option{-V}|@option{--version}]
  668. [@option{-X 32_64}]
  669. [@option{--defined-only}]
  670. [@option{--no-demangle}]
  671. [@option{--no-recurse-limit}|@option{--recurse-limit}]]
  672. [@option{--plugin} @var{name}]
  673. [@option{--size-sort}]
  674. [@option{--special-syms}]
  675. [@option{--synthetic}]
  676. [@option{--target=}@var{bfdname}]
  677. [@option{--with-symbol-versions}]
  678. [@option{--without-symbol-versions}]
  679. [@var{objfile}@dots{}]
  680. @c man end
  681. @end smallexample
  682. @c man begin DESCRIPTION nm
  683. @sc{gnu} @command{nm} lists the symbols from object files @var{objfile}@dots{}.
  684. If no object files are listed as arguments, @command{nm} assumes the file
  685. @file{a.out}.
  686. For each symbol, @command{nm} shows:
  687. @itemize @bullet
  688. @item
  689. The symbol value, in the radix selected by options (see below), or
  690. hexadecimal by default.
  691. @item
  692. The symbol type. At least the following types are used; others are, as
  693. well, depending on the object file format. If lowercase, the symbol is
  694. usually local; if uppercase, the symbol is global (external). There
  695. are however a few lowercase symbols that are shown for special global
  696. symbols (@code{u}, @code{v} and @code{w}).
  697. @c Some more detail on exactly what these symbol types are used for
  698. @c would be nice.
  699. @table @code
  700. @item A
  701. The symbol's value is absolute, and will not be changed by further
  702. linking.
  703. @item B
  704. @itemx b
  705. The symbol is in the BSS data section. This section typically
  706. contains zero-initialized or uninitialized data, although the exact
  707. behavior is system dependent.
  708. @item C
  709. @itemx c
  710. The symbol is common. Common symbols are uninitialized data. When
  711. linking, multiple common symbols may appear with the same name. If the
  712. symbol is defined anywhere, the common symbols are treated as undefined
  713. references.
  714. @ifclear man
  715. For more details on common symbols, see the discussion of
  716. --warn-common in @ref{Options,,Linker options,ld.info,The GNU linker}.
  717. @end ifclear
  718. The lower case @var{c} character is used when the symbol is in a
  719. special section for small commons.
  720. @item D
  721. @itemx d
  722. The symbol is in the initialized data section.
  723. @item G
  724. @itemx g
  725. The symbol is in an initialized data section for small objects. Some
  726. object file formats permit more efficient access to small data objects,
  727. such as a global int variable as opposed to a large global array.
  728. @item i
  729. For PE format files this indicates that the symbol is in a section
  730. specific to the implementation of DLLs.
  731. For ELF format files this indicates that the symbol is an indirect
  732. function. This is a GNU extension to the standard set of ELF symbol
  733. types. It indicates a symbol which if referenced by a relocation does
  734. not evaluate to its address, but instead must be invoked at runtime.
  735. The runtime execution will then return the value to be used in the
  736. relocation.
  737. Note - the actual symbols display for GNU indirect symbols is
  738. controlled by the @option{--ifunc-chars} command line option. If this
  739. option has been provided then the first character in the string will
  740. be used for global indirect function symbols. If the string contains
  741. a second character then that will be used for local indirect function
  742. symbols.
  743. @item I
  744. The symbol is an indirect reference to another symbol.
  745. @item N
  746. The symbol is a debugging symbol.
  747. @item n
  748. The symbol is in the read-only data section.
  749. @item p
  750. The symbol is in a stack unwind section.
  751. @item R
  752. @itemx r
  753. The symbol is in a read only data section.
  754. @item S
  755. @itemx s
  756. The symbol is in an uninitialized or zero-initialized data section
  757. for small objects.
  758. @item T
  759. @itemx t
  760. The symbol is in the text (code) section.
  761. @item U
  762. The symbol is undefined.
  763. @item u
  764. The symbol is a unique global symbol. This is a GNU extension to the
  765. standard set of ELF symbol bindings. For such a symbol the dynamic linker
  766. will make sure that in the entire process there is just one symbol with
  767. this name and type in use.
  768. @item V
  769. @itemx v
  770. The symbol is a weak object. When a weak defined symbol is linked with
  771. a normal defined symbol, the normal defined symbol is used with no error.
  772. When a weak undefined symbol is linked and the symbol is not defined,
  773. the value of the weak symbol becomes zero with no error. On some
  774. systems, uppercase indicates that a default value has been specified.
  775. @item W
  776. @itemx w
  777. The symbol is a weak symbol that has not been specifically tagged as a
  778. weak object symbol. When a weak defined symbol is linked with a normal
  779. defined symbol, the normal defined symbol is used with no error.
  780. When a weak undefined symbol is linked and the symbol is not defined,
  781. the value of the symbol is determined in a system-specific manner without
  782. error. On some systems, uppercase indicates that a default value has been
  783. specified.
  784. @item -
  785. The symbol is a stabs symbol in an a.out object file. In this case, the
  786. next values printed are the stabs other field, the stabs desc field, and
  787. the stab type. Stabs symbols are used to hold debugging information.
  788. @item ?
  789. The symbol type is unknown, or object file format specific.
  790. @end table
  791. @item
  792. The symbol name. If a symbol has version information associated with it,
  793. then the version information is displayed as well. If the versioned
  794. symbol is undefined or hidden from linker, the version string is displayed
  795. as a suffix to the symbol name, preceded by an @@ character. For example
  796. @samp{foo@@VER_1}. If the version is the default version to be used when
  797. resolving unversioned references to the symbol, then it is displayed as a
  798. suffix preceded by two @@ characters. For example @samp{foo@@@@VER_2}.
  799. @end itemize
  800. @c man end
  801. @c man begin OPTIONS nm
  802. The long and short forms of options, shown here as alternatives, are
  803. equivalent.
  804. @table @env
  805. @item -A
  806. @itemx -o
  807. @itemx --print-file-name
  808. @cindex input file name
  809. @cindex file name
  810. @cindex source file name
  811. Precede each symbol by the name of the input file (or archive member)
  812. in which it was found, rather than identifying the input file once only,
  813. before all of its symbols.
  814. @item -a
  815. @itemx --debug-syms
  816. @cindex debugging symbols
  817. Display all symbols, even debugger-only symbols; normally these are not
  818. listed.
  819. @item -B
  820. @cindex @command{nm} format
  821. @cindex @command{nm} compatibility
  822. The same as @option{--format=bsd} (for compatibility with the MIPS @command{nm}).
  823. @item -C
  824. @itemx --demangle[=@var{style}]
  825. @cindex demangling in nm
  826. Decode (@dfn{demangle}) low-level symbol names into user-level names.
  827. Besides removing any initial underscore prepended by the system, this
  828. makes C++ function names readable. Different compilers have different
  829. mangling styles. The optional demangling style argument can be used to
  830. choose an appropriate demangling style for your compiler. @xref{c++filt},
  831. for more information on demangling.
  832. @item --no-demangle
  833. Do not demangle low-level symbol names. This is the default.
  834. @item --recurse-limit
  835. @itemx --no-recurse-limit
  836. @itemx --recursion-limit
  837. @itemx --no-recursion-limit
  838. Enables or disables a limit on the amount of recursion performed
  839. whilst demangling strings. Since the name mangling formats allow for
  840. an infinite level of recursion it is possible to create strings whose
  841. decoding will exhaust the amount of stack space available on the host
  842. machine, triggering a memory fault. The limit tries to prevent this
  843. from happening by restricting recursion to 2048 levels of nesting.
  844. The default is for this limit to be enabled, but disabling it may be
  845. necessary in order to demangle truly complicated names. Note however
  846. that if the recursion limit is disabled then stack exhaustion is
  847. possible and any bug reports about such an event will be rejected.
  848. @item -D
  849. @itemx --dynamic
  850. @cindex dynamic symbols
  851. Display the dynamic symbols rather than the normal symbols. This is
  852. only meaningful for dynamic objects, such as certain types of shared
  853. libraries.
  854. @item -f @var{format}
  855. @itemx --format=@var{format}
  856. @cindex @command{nm} format
  857. @cindex @command{nm} compatibility
  858. Use the output format @var{format}, which can be @code{bsd},
  859. @code{sysv}, @code{posix} or @code{just-symbols}. The default is @code{bsd}.
  860. Only the first character of @var{format} is significant; it can be
  861. either upper or lower case.
  862. @item -g
  863. @itemx --extern-only
  864. @cindex external symbols
  865. Display only external symbols.
  866. @item -h
  867. @itemx --help
  868. Show a summary of the options to @command{nm} and exit.
  869. @item --ifunc-chars=@var{CHARS}
  870. When display GNU indirect function symbols @command{nm} will default
  871. to using the @code{i} character for both local indirect functions and
  872. global indirect functions. The @option{--ifunc-chars} option allows
  873. the user to specify a string containing one or two characters. The
  874. first character will be used for global indirect function symbols and
  875. the second character, if present, will be used for local indirect
  876. function symbols.
  877. @item j
  878. The same as @option{--format=just-symbols}.
  879. @item -l
  880. @itemx --line-numbers
  881. @cindex symbol line numbers
  882. For each symbol, use debugging information to try to find a filename and
  883. line number. For a defined symbol, look for the line number of the
  884. address of the symbol. For an undefined symbol, look for the line
  885. number of a relocation entry which refers to the symbol. If line number
  886. information can be found, print it after the other symbol information.
  887. @item --inlines
  888. @cindex objdump inlines
  889. When option @option{-l} is active, if the address belongs to a
  890. function that was inlined, then this option causes the source
  891. information for all enclosing scopes back to the first non-inlined
  892. function to be printed as well. For example, if @code{main} inlines
  893. @code{callee1} which inlines @code{callee2}, and address is from
  894. @code{callee2}, the source information for @code{callee1} and @code{main}
  895. will also be printed.
  896. @item -n
  897. @itemx -v
  898. @itemx --numeric-sort
  899. Sort symbols numerically by their addresses, rather than alphabetically
  900. by their names.
  901. @item -p
  902. @itemx --no-sort
  903. @cindex sorting symbols
  904. Do not bother to sort the symbols in any order; print them in the order
  905. encountered.
  906. @item -P
  907. @itemx --portability
  908. Use the POSIX.2 standard output format instead of the default format.
  909. Equivalent to @samp{-f posix}.
  910. @item -r
  911. @itemx --reverse-sort
  912. Reverse the order of the sort (whether numeric or alphabetic); let the
  913. last come first.
  914. @item -S
  915. @itemx --print-size
  916. Print both value and size of defined symbols for the @code{bsd} output style.
  917. This option has no effect for object formats that do not record symbol
  918. sizes, unless @samp{--size-sort} is also used in which case a
  919. calculated size is displayed.
  920. @item -s
  921. @itemx --print-armap
  922. @cindex symbol index, listing
  923. When listing symbols from archive members, include the index: a mapping
  924. (stored in the archive by @command{ar} or @command{ranlib}) of which modules
  925. contain definitions for which names.
  926. @item -t @var{radix}
  927. @itemx --radix=@var{radix}
  928. Use @var{radix} as the radix for printing the symbol values. It must be
  929. @samp{d} for decimal, @samp{o} for octal, or @samp{x} for hexadecimal.
  930. @item -u
  931. @itemx --undefined-only
  932. @cindex external symbols
  933. @cindex undefined symbols
  934. Display only undefined symbols (those external to each object file).
  935. @item -U @var{[d|i|l|e|x|h]}
  936. @itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]}
  937. Controls the display of UTF-8 encoded multibyte characters in strings.
  938. The default (@option{--unicode=default}) is to give them no special
  939. treatment. The @option{--unicode=locale} option displays the sequence
  940. in the current locale, which may or may not support them. The options
  941. @option{--unicode=hex} and @option{--unicode=invalid} display them as
  942. hex byte sequences enclosed by either angle brackets or curly braces.
  943. The @option{--unicode=escape} option displays them as escape sequences
  944. (@var{\uxxxx}) and the @option{--unicode=highlight} option displays
  945. them as escape sequences highlighted in red (if supported by the
  946. output device). The colouring is intended to draw attention to the
  947. presence of unicode sequences where they might not be expected.
  948. @item -V
  949. @itemx --version
  950. Show the version number of @command{nm} and exit.
  951. @item -X
  952. This option is ignored for compatibility with the AIX version of
  953. @command{nm}. It takes one parameter which must be the string
  954. @option{32_64}. The default mode of AIX @command{nm} corresponds
  955. to @option{-X 32}, which is not supported by @sc{gnu} @command{nm}.
  956. @item --defined-only
  957. @cindex external symbols
  958. @cindex undefined symbols
  959. Display only defined symbols for each object file.
  960. @item --plugin @var{name}
  961. @cindex plugins
  962. Load the plugin called @var{name} to add support for extra target
  963. types. This option is only available if the toolchain has been built
  964. with plugin support enabled.
  965. If @option{--plugin} is not provided, but plugin support has been
  966. enabled then @command{nm} iterates over the files in
  967. @file{$@{libdir@}/bfd-plugins} in alphabetic order and the first
  968. plugin that claims the object in question is used.
  969. Please note that this plugin search directory is @emph{not} the one
  970. used by @command{ld}'s @option{-plugin} option. In order to make
  971. @command{nm} use the linker plugin it must be copied into the
  972. @file{$@{libdir@}/bfd-plugins} directory. For GCC based compilations
  973. the linker plugin is called @file{liblto_plugin.so.0.0.0}. For Clang
  974. based compilations it is called @file{LLVMgold.so}. The GCC plugin
  975. is always backwards compatible with earlier versions, so it is
  976. sufficient to just copy the newest one.
  977. @item --size-sort
  978. Sort symbols by size. For ELF objects symbol sizes are read from the
  979. ELF, for other object types the symbol sizes are computed as the
  980. difference between the value of the symbol and the value of the symbol
  981. with the next higher value. If the @code{bsd} output format is used
  982. the size of the symbol is printed, rather than the value, and
  983. @samp{-S} must be used in order both size and value to be printed.
  984. @item --special-syms
  985. Display symbols which have a target-specific special meaning. These
  986. symbols are usually used by the target for some special processing and
  987. are not normally helpful when included in the normal symbol lists.
  988. For example for ARM targets this option would skip the mapping symbols
  989. used to mark transitions between ARM code, THUMB code and data.
  990. @item --synthetic
  991. Include synthetic symbols in the output. These are special symbols
  992. created by the linker for various purposes. They are not shown by
  993. default since they are not part of the binary's original source code.
  994. @item --with-symbol-versions
  995. @item --without-symbol-versions
  996. Enables or disables the display of symbol version information. The
  997. version string is displayed as a suffix to the symbol name, preceded
  998. by an @@ character. For example @samp{foo@@VER_1}. If the version is
  999. the default version to be used when resolving unversioned references
  1000. to the symbol then it is displayed as a suffix preceded by two @@
  1001. characters. For example @samp{foo@@@@VER_2}. By default, symbol
  1002. version information is displayed.
  1003. @item --target=@var{bfdname}
  1004. @cindex object code format
  1005. Specify an object code format other than your system's default format.
  1006. @xref{Target Selection}, for more information.
  1007. @end table
  1008. @c man end
  1009. @ignore
  1010. @c man begin SEEALSO nm
  1011. ar(1), objdump(1), ranlib(1), and the Info entries for @file{binutils}.
  1012. @c man end
  1013. @end ignore
  1014. @node objcopy
  1015. @chapter objcopy
  1016. @c man title objcopy copy and translate object files
  1017. @smallexample
  1018. @c man begin SYNOPSIS objcopy
  1019. objcopy [@option{-F} @var{bfdname}|@option{--target=}@var{bfdname}]
  1020. [@option{-I} @var{bfdname}|@option{--input-target=}@var{bfdname}]
  1021. [@option{-O} @var{bfdname}|@option{--output-target=}@var{bfdname}]
  1022. [@option{-B} @var{bfdarch}|@option{--binary-architecture=}@var{bfdarch}]
  1023. [@option{-S}|@option{--strip-all}]
  1024. [@option{-g}|@option{--strip-debug}]
  1025. [@option{--strip-unneeded}]
  1026. [@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}]
  1027. [@option{--keep-file-symbols}]
  1028. [@option{--keep-section-symbols}]
  1029. [@option{-N} @var{symbolname}|@option{--strip-symbol=}@var{symbolname}]
  1030. [@option{--strip-unneeded-symbol=}@var{symbolname}]
  1031. [@option{-G} @var{symbolname}|@option{--keep-global-symbol=}@var{symbolname}]
  1032. [@option{--localize-hidden}]
  1033. [@option{-L} @var{symbolname}|@option{--localize-symbol=}@var{symbolname}]
  1034. [@option{--globalize-symbol=}@var{symbolname}]
  1035. [@option{--globalize-symbols=}@var{filename}]
  1036. [@option{-W} @var{symbolname}|@option{--weaken-symbol=}@var{symbolname}]
  1037. [@option{-w}|@option{--wildcard}]
  1038. [@option{-x}|@option{--discard-all}]
  1039. [@option{-X}|@option{--discard-locals}]
  1040. [@option{-b} @var{byte}|@option{--byte=}@var{byte}]
  1041. [@option{-i} [@var{breadth}]|@option{--interleave}[=@var{breadth}]]
  1042. [@option{--interleave-width=}@var{width}]
  1043. [@option{-j} @var{sectionpattern}|@option{--only-section=}@var{sectionpattern}]
  1044. [@option{-R} @var{sectionpattern}|@option{--remove-section=}@var{sectionpattern}]
  1045. [@option{--keep-section=}@var{sectionpattern}]
  1046. [@option{--remove-relocations=}@var{sectionpattern}]
  1047. [@option{-p}|@option{--preserve-dates}]
  1048. [@option{-D}|@option{--enable-deterministic-archives}]
  1049. [@option{-U}|@option{--disable-deterministic-archives}]
  1050. [@option{--debugging}]
  1051. [@option{--gap-fill=}@var{val}]
  1052. [@option{--pad-to=}@var{address}]
  1053. [@option{--set-start=}@var{val}]
  1054. [@option{--adjust-start=}@var{incr}]
  1055. [@option{--change-addresses=}@var{incr}]
  1056. [@option{--change-section-address} @var{sectionpattern}@{=,+,-@}@var{val}]
  1057. [@option{--change-section-lma} @var{sectionpattern}@{=,+,-@}@var{val}]
  1058. [@option{--change-section-vma} @var{sectionpattern}@{=,+,-@}@var{val}]
  1059. [@option{--change-warnings}] [@option{--no-change-warnings}]
  1060. [@option{--set-section-flags} @var{sectionpattern}=@var{flags}]
  1061. [@option{--set-section-alignment} @var{sectionpattern}=@var{align}]
  1062. [@option{--add-section} @var{sectionname}=@var{filename}]
  1063. [@option{--dump-section} @var{sectionname}=@var{filename}]
  1064. [@option{--update-section} @var{sectionname}=@var{filename}]
  1065. [@option{--rename-section} @var{oldname}=@var{newname}[,@var{flags}]]
  1066. [@option{--long-section-names} @{enable,disable,keep@}]
  1067. [@option{--change-leading-char}] [@option{--remove-leading-char}]
  1068. [@option{--reverse-bytes=}@var{num}]
  1069. [@option{--srec-len=}@var{ival}] [@option{--srec-forceS3}]
  1070. [@option{--redefine-sym} @var{old}=@var{new}]
  1071. [@option{--redefine-syms=}@var{filename}]
  1072. [@option{--weaken}]
  1073. [@option{--keep-symbols=}@var{filename}]
  1074. [@option{--strip-symbols=}@var{filename}]
  1075. [@option{--strip-unneeded-symbols=}@var{filename}]
  1076. [@option{--keep-global-symbols=}@var{filename}]
  1077. [@option{--localize-symbols=}@var{filename}]
  1078. [@option{--weaken-symbols=}@var{filename}]
  1079. [@option{--add-symbol} @var{name}=[@var{section}:]@var{value}[,@var{flags}]]
  1080. [@option{--alt-machine-code=}@var{index}]
  1081. [@option{--prefix-symbols=}@var{string}]
  1082. [@option{--prefix-sections=}@var{string}]
  1083. [@option{--prefix-alloc-sections=}@var{string}]
  1084. [@option{--add-gnu-debuglink=}@var{path-to-file}]
  1085. [@option{--only-keep-debug}]
  1086. [@option{--strip-dwo}]
  1087. [@option{--extract-dwo}]
  1088. [@option{--extract-symbol}]
  1089. [@option{--writable-text}]
  1090. [@option{--readonly-text}]
  1091. [@option{--pure}]
  1092. [@option{--impure}]
  1093. [@option{--file-alignment=}@var{num}]
  1094. [@option{--heap=}@var{size}]
  1095. [@option{--image-base=}@var{address}]
  1096. [@option{--section-alignment=}@var{num}]
  1097. [@option{--stack=}@var{size}]
  1098. [@option{--subsystem=}@var{which}:@var{major}.@var{minor}]
  1099. [@option{--compress-debug-sections}]
  1100. [@option{--decompress-debug-sections}]
  1101. [@option{--elf-stt-common=@var{val}}]
  1102. [@option{--merge-notes}]
  1103. [@option{--no-merge-notes}]
  1104. [@option{--verilog-data-width=@var{val}}]
  1105. [@option{-v}|@option{--verbose}]
  1106. [@option{-V}|@option{--version}]
  1107. [@option{--help}] [@option{--info}]
  1108. @var{infile} [@var{outfile}]
  1109. @c man end
  1110. @end smallexample
  1111. @c man begin DESCRIPTION objcopy
  1112. The @sc{gnu} @command{objcopy} utility copies the contents of an object
  1113. file to another. @command{objcopy} uses the @sc{gnu} @sc{bfd} Library to
  1114. read and write the object files. It can write the destination object
  1115. file in a format different from that of the source object file. The
  1116. exact behavior of @command{objcopy} is controlled by command-line options.
  1117. Note that @command{objcopy} should be able to copy a fully linked file
  1118. between any two formats. However, copying a relocatable object file
  1119. between any two formats may not work as expected.
  1120. @command{objcopy} creates temporary files to do its translations and
  1121. deletes them afterward. @command{objcopy} uses @sc{bfd} to do all its
  1122. translation work; it has access to all the formats described in @sc{bfd}
  1123. and thus is able to recognize most formats without being told
  1124. explicitly. @xref{BFD,,BFD,ld.info,Using LD}.
  1125. @command{objcopy} can be used to generate S-records by using an output
  1126. target of @samp{srec} (e.g., use @samp{-O srec}).
  1127. @command{objcopy} can be used to generate a raw binary file by using an
  1128. output target of @samp{binary} (e.g., use @option{-O binary}). When
  1129. @command{objcopy} generates a raw binary file, it will essentially produce
  1130. a memory dump of the contents of the input object file. All symbols and
  1131. relocation information will be discarded. The memory dump will start at
  1132. the load address of the lowest section copied into the output file.
  1133. When generating an S-record or a raw binary file, it may be helpful to
  1134. use @option{-S} to remove sections containing debugging information. In
  1135. some cases @option{-R} will be useful to remove sections which contain
  1136. information that is not needed by the binary file.
  1137. Note---@command{objcopy} is not able to change the endianness of its input
  1138. files. If the input format has an endianness (some formats do not),
  1139. @command{objcopy} can only copy the inputs into file formats that have the
  1140. same endianness or which have no endianness (e.g., @samp{srec}).
  1141. (However, see the @option{--reverse-bytes} option.)
  1142. @c man end
  1143. @c man begin OPTIONS objcopy
  1144. @table @env
  1145. @item @var{infile}
  1146. @itemx @var{outfile}
  1147. The input and output files, respectively.
  1148. If you do not specify @var{outfile}, @command{objcopy} creates a
  1149. temporary file and destructively renames the result with
  1150. the name of @var{infile}.
  1151. @item -I @var{bfdname}
  1152. @itemx --input-target=@var{bfdname}
  1153. Consider the source file's object format to be @var{bfdname}, rather than
  1154. attempting to deduce it. @xref{Target Selection}, for more information.
  1155. @item -O @var{bfdname}
  1156. @itemx --output-target=@var{bfdname}
  1157. Write the output file using the object format @var{bfdname}.
  1158. @xref{Target Selection}, for more information.
  1159. @item -F @var{bfdname}
  1160. @itemx --target=@var{bfdname}
  1161. Use @var{bfdname} as the object format for both the input and the output
  1162. file; i.e., simply transfer data from source to destination with no
  1163. translation. @xref{Target Selection}, for more information.
  1164. @item -B @var{bfdarch}
  1165. @itemx --binary-architecture=@var{bfdarch}
  1166. Useful when transforming a architecture-less input file into an object file.
  1167. In this case the output architecture can be set to @var{bfdarch}. This
  1168. option will be ignored if the input file has a known @var{bfdarch}. You
  1169. can access this binary data inside a program by referencing the special
  1170. symbols that are created by the conversion process. These symbols are
  1171. called _binary_@var{objfile}_start, _binary_@var{objfile}_end and
  1172. _binary_@var{objfile}_size. e.g. you can transform a picture file into
  1173. an object file and then access it in your code using these symbols.
  1174. @item -j @var{sectionpattern}
  1175. @itemx --only-section=@var{sectionpattern}
  1176. Copy only the indicated sections from the input file to the output file.
  1177. This option may be given more than once. Note that using this option
  1178. inappropriately may make the output file unusable. Wildcard
  1179. characters are accepted in @var{sectionpattern}.
  1180. If the first character of @var{sectionpattern} is the exclamation
  1181. point (!) then matching sections will not be copied, even if earlier
  1182. use of @option{--only-section} on the same command line would
  1183. otherwise copy it. For example:
  1184. @smallexample
  1185. --only-section=.text.* --only-section=!.text.foo
  1186. @end smallexample
  1187. will copy all sectinos matching '.text.*' but not the section
  1188. '.text.foo'.
  1189. @item -R @var{sectionpattern}
  1190. @itemx --remove-section=@var{sectionpattern}
  1191. Remove any section matching @var{sectionpattern} from the output file.
  1192. This option may be given more than once. Note that using this option
  1193. inappropriately may make the output file unusable. Wildcard
  1194. characters are accepted in @var{sectionpattern}. Using both the
  1195. @option{-j} and @option{-R} options together results in undefined
  1196. behaviour.
  1197. If the first character of @var{sectionpattern} is the exclamation
  1198. point (!) then matching sections will not be removed even if an
  1199. earlier use of @option{--remove-section} on the same command line
  1200. would otherwise remove it. For example:
  1201. @smallexample
  1202. --remove-section=.text.* --remove-section=!.text.foo
  1203. @end smallexample
  1204. will remove all sections matching the pattern '.text.*', but will not
  1205. remove the section '.text.foo'.
  1206. @item --keep-section=@var{sectionpattern}
  1207. When removing sections from the output file, keep sections that match
  1208. @var{sectionpattern}.
  1209. @item --remove-relocations=@var{sectionpattern}
  1210. Remove non-dynamic relocations from the output file for any section
  1211. matching @var{sectionpattern}. This option may be given more than
  1212. once. Note that using this option inappropriately may make the output
  1213. file unusable, and attempting to remove a dynamic relocation section
  1214. such as @samp{.rela.plt} from an executable or shared library with
  1215. @option{--remove-relocations=.plt} will not work. Wildcard characters
  1216. are accepted in @var{sectionpattern}.
  1217. For example:
  1218. @smallexample
  1219. --remove-relocations=.text.*
  1220. @end smallexample
  1221. will remove the relocations for all sections matching the pattern
  1222. '.text.*'.
  1223. If the first character of @var{sectionpattern} is the exclamation
  1224. point (!) then matching sections will not have their relocation
  1225. removed even if an earlier use of @option{--remove-relocations} on the
  1226. same command line would otherwise cause the relocations to be removed.
  1227. For example:
  1228. @smallexample
  1229. --remove-relocations=.text.* --remove-relocations=!.text.foo
  1230. @end smallexample
  1231. will remove all relocations for sections matching the pattern
  1232. '.text.*', but will not remove relocations for the section
  1233. '.text.foo'.
  1234. @item -S
  1235. @itemx --strip-all
  1236. Do not copy relocation and symbol information from the source file.
  1237. Also deletes debug sections.
  1238. @item -g
  1239. @itemx --strip-debug
  1240. Do not copy debugging symbols or sections from the source file.
  1241. @item --strip-unneeded
  1242. Remove all symbols that are not needed for relocation processing in
  1243. addition to debugging symbols and sections stripped by
  1244. @option{--strip-debug}.
  1245. @item -K @var{symbolname}
  1246. @itemx --keep-symbol=@var{symbolname}
  1247. When stripping symbols, keep symbol @var{symbolname} even if it would
  1248. normally be stripped. This option may be given more than once.
  1249. @item -N @var{symbolname}
  1250. @itemx --strip-symbol=@var{symbolname}
  1251. Do not copy symbol @var{symbolname} from the source file. This option
  1252. may be given more than once.
  1253. @item --strip-unneeded-symbol=@var{symbolname}
  1254. Do not copy symbol @var{symbolname} from the source file unless it is needed
  1255. by a relocation. This option may be given more than once.
  1256. @item -G @var{symbolname}
  1257. @itemx --keep-global-symbol=@var{symbolname}
  1258. Keep only symbol @var{symbolname} global. Make all other symbols local
  1259. to the file, so that they are not visible externally. This option may
  1260. be given more than once. Note: this option cannot be used in
  1261. conjunction with the @option{--globalize-symbol} or
  1262. @option{--globalize-symbols} options.
  1263. @item --localize-hidden
  1264. In an ELF object, mark all symbols that have hidden or internal visibility
  1265. as local. This option applies on top of symbol-specific localization options
  1266. such as @option{-L}.
  1267. @item -L @var{symbolname}
  1268. @itemx --localize-symbol=@var{symbolname}
  1269. Convert a global or weak symbol called @var{symbolname} into a local
  1270. symbol, so that it is not visible externally. This option may be
  1271. given more than once. Note - unique symbols are not converted.
  1272. @item -W @var{symbolname}
  1273. @itemx --weaken-symbol=@var{symbolname}
  1274. Make symbol @var{symbolname} weak. This option may be given more than once.
  1275. @item --globalize-symbol=@var{symbolname}
  1276. Give symbol @var{symbolname} global scoping so that it is visible
  1277. outside of the file in which it is defined. This option may be given
  1278. more than once. Note: this option cannot be used in conjunction with
  1279. the @option{-G} or @option{--keep-global-symbol} options.
  1280. @item -w
  1281. @itemx --wildcard
  1282. Permit regular expressions in @var{symbolname}s used in other command
  1283. line options. The question mark (?), asterisk (*), backslash (\) and
  1284. square brackets ([]) operators can be used anywhere in the symbol
  1285. name. If the first character of the symbol name is the exclamation
  1286. point (!) then the sense of the switch is reversed for that symbol.
  1287. For example:
  1288. @smallexample
  1289. -w -W !foo -W fo*
  1290. @end smallexample
  1291. would cause objcopy to weaken all symbols that start with ``fo''
  1292. except for the symbol ``foo''.
  1293. @item -x
  1294. @itemx --discard-all
  1295. Do not copy non-global symbols from the source file.
  1296. @c FIXME any reason to prefer "non-global" to "local" here?
  1297. @item -X
  1298. @itemx --discard-locals
  1299. Do not copy compiler-generated local symbols.
  1300. (These usually start with @samp{L} or @samp{.}.)
  1301. @item -b @var{byte}
  1302. @itemx --byte=@var{byte}
  1303. If interleaving has been enabled via the @option{--interleave} option
  1304. then start the range of bytes to keep at the @var{byte}th byte.
  1305. @var{byte} can be in the range from 0 to @var{breadth}-1, where
  1306. @var{breadth} is the value given by the @option{--interleave} option.
  1307. @item -i [@var{breadth}]
  1308. @itemx --interleave[=@var{breadth}]
  1309. Only copy a range out of every @var{breadth} bytes. (Header data is
  1310. not affected). Select which byte in the range begins the copy with
  1311. the @option{--byte} option. Select the width of the range with the
  1312. @option{--interleave-width} option.
  1313. This option is useful for creating files to program @sc{rom}. It is
  1314. typically used with an @code{srec} output target. Note that
  1315. @command{objcopy} will complain if you do not specify the
  1316. @option{--byte} option as well.
  1317. The default interleave breadth is 4, so with @option{--byte} set to 0,
  1318. @command{objcopy} would copy the first byte out of every four bytes
  1319. from the input to the output.
  1320. @item --interleave-width=@var{width}
  1321. When used with the @option{--interleave} option, copy @var{width}
  1322. bytes at a time. The start of the range of bytes to be copied is set
  1323. by the @option{--byte} option, and the extent of the range is set with
  1324. the @option{--interleave} option.
  1325. The default value for this option is 1. The value of @var{width} plus
  1326. the @var{byte} value set by the @option{--byte} option must not exceed
  1327. the interleave breadth set by the @option{--interleave} option.
  1328. This option can be used to create images for two 16-bit flashes interleaved
  1329. in a 32-bit bus by passing @option{-b 0 -i 4 --interleave-width=2}
  1330. and @option{-b 2 -i 4 --interleave-width=2} to two @command{objcopy}
  1331. commands. If the input was '12345678' then the outputs would be
  1332. '1256' and '3478' respectively.
  1333. @item -p
  1334. @itemx --preserve-dates
  1335. Set the access and modification dates of the output file to be the same
  1336. as those of the input file.
  1337. @item -D
  1338. @itemx --enable-deterministic-archives
  1339. @cindex deterministic archives
  1340. @kindex --enable-deterministic-archives
  1341. Operate in @emph{deterministic} mode. When copying archive members
  1342. and writing the archive index, use zero for UIDs, GIDs, timestamps,
  1343. and use consistent file modes for all files.
  1344. If @file{binutils} was configured with
  1345. @option{--enable-deterministic-archives}, then this mode is on by default.
  1346. It can be disabled with the @samp{-U} option, below.
  1347. @item -U
  1348. @itemx --disable-deterministic-archives
  1349. @cindex deterministic archives
  1350. @kindex --enable-deterministic-archives
  1351. Do @emph{not} operate in @emph{deterministic} mode. This is the
  1352. inverse of the @option{-D} option, above: when copying archive members
  1353. and writing the archive index, use their actual UID, GID, timestamp,
  1354. and file mode values.
  1355. This is the default unless @file{binutils} was configured with
  1356. @option{--enable-deterministic-archives}.
  1357. @item --debugging
  1358. Convert debugging information, if possible. This is not the default
  1359. because only certain debugging formats are supported, and the
  1360. conversion process can be time consuming.
  1361. @item --gap-fill @var{val}
  1362. Fill gaps between sections with @var{val}. This operation applies to
  1363. the @emph{load address} (LMA) of the sections. It is done by increasing
  1364. the size of the section with the lower address, and filling in the extra
  1365. space created with @var{val}.
  1366. @item --pad-to @var{address}
  1367. Pad the output file up to the load address @var{address}. This is
  1368. done by increasing the size of the last section. The extra space is
  1369. filled in with the value specified by @option{--gap-fill} (default zero).
  1370. @item --set-start @var{val}
  1371. Set the start address (also known as the entry address) of the new
  1372. file to @var{val}. Not all object file formats support setting the
  1373. start address.
  1374. @item --change-start @var{incr}
  1375. @itemx --adjust-start @var{incr}
  1376. @cindex changing start address
  1377. Change the start address (also known as the entry address) by adding
  1378. @var{incr}. Not all object file formats support setting the start
  1379. address.
  1380. @item --change-addresses @var{incr}
  1381. @itemx --adjust-vma @var{incr}
  1382. @cindex changing object addresses
  1383. Change the VMA and LMA addresses of all sections, as well as the start
  1384. address, by adding @var{incr}. Some object file formats do not permit
  1385. section addresses to be changed arbitrarily. Note that this does not
  1386. relocate the sections; if the program expects sections to be loaded at a
  1387. certain address, and this option is used to change the sections such
  1388. that they are loaded at a different address, the program may fail.
  1389. @item --change-section-address @var{sectionpattern}@{=,+,-@}@var{val}
  1390. @itemx --adjust-section-vma @var{sectionpattern}@{=,+,-@}@var{val}
  1391. @cindex changing section address
  1392. Set or change both the VMA address and the LMA address of any section
  1393. matching @var{sectionpattern}. If @samp{=} is used, the section
  1394. address is set to @var{val}. Otherwise, @var{val} is added to or
  1395. subtracted from the section address. See the comments under
  1396. @option{--change-addresses}, above. If @var{sectionpattern} does not
  1397. match any sections in the input file, a warning will be issued, unless
  1398. @option{--no-change-warnings} is used.
  1399. @item --change-section-lma @var{sectionpattern}@{=,+,-@}@var{val}
  1400. @cindex changing section LMA
  1401. Set or change the LMA address of any sections matching
  1402. @var{sectionpattern}. The LMA address is the address where the
  1403. section will be loaded into memory at program load time. Normally
  1404. this is the same as the VMA address, which is the address of the
  1405. section at program run time, but on some systems, especially those
  1406. where a program is held in ROM, the two can be different. If @samp{=}
  1407. is used, the section address is set to @var{val}. Otherwise,
  1408. @var{val} is added to or subtracted from the section address. See the
  1409. comments under @option{--change-addresses}, above. If
  1410. @var{sectionpattern} does not match any sections in the input file, a
  1411. warning will be issued, unless @option{--no-change-warnings} is used.
  1412. @item --change-section-vma @var{sectionpattern}@{=,+,-@}@var{val}
  1413. @cindex changing section VMA
  1414. Set or change the VMA address of any section matching
  1415. @var{sectionpattern}. The VMA address is the address where the
  1416. section will be located once the program has started executing.
  1417. Normally this is the same as the LMA address, which is the address
  1418. where the section will be loaded into memory, but on some systems,
  1419. especially those where a program is held in ROM, the two can be
  1420. different. If @samp{=} is used, the section address is set to
  1421. @var{val}. Otherwise, @var{val} is added to or subtracted from the
  1422. section address. See the comments under @option{--change-addresses},
  1423. above. If @var{sectionpattern} does not match any sections in the
  1424. input file, a warning will be issued, unless
  1425. @option{--no-change-warnings} is used.
  1426. @item --change-warnings
  1427. @itemx --adjust-warnings
  1428. If @option{--change-section-address} or @option{--change-section-lma} or
  1429. @option{--change-section-vma} is used, and the section pattern does not
  1430. match any sections, issue a warning. This is the default.
  1431. @item --no-change-warnings
  1432. @itemx --no-adjust-warnings
  1433. Do not issue a warning if @option{--change-section-address} or
  1434. @option{--adjust-section-lma} or @option{--adjust-section-vma} is used, even
  1435. if the section pattern does not match any sections.
  1436. @item --set-section-flags @var{sectionpattern}=@var{flags}
  1437. Set the flags for any sections matching @var{sectionpattern}. The
  1438. @var{flags} argument is a comma separated string of flag names. The
  1439. recognized names are @samp{alloc}, @samp{contents}, @samp{load},
  1440. @samp{noload}, @samp{readonly}, @samp{code}, @samp{data}, @samp{rom},
  1441. @samp{exclude}, @samp{share}, and @samp{debug}. You can set the
  1442. @samp{contents} flag for a section which does not have contents, but it
  1443. is not meaningful to clear the @samp{contents} flag of a section which
  1444. does have contents--just remove the section instead. Not all flags are
  1445. meaningful for all object file formats. In particular the
  1446. @samp{share} flag is only meaningful for COFF format files and not for
  1447. ELF format files.
  1448. @item --set-section-alignment @var{sectionpattern}=@var{align}
  1449. Set the alignment for any sections matching @var{sectionpattern}.
  1450. @var{align} specifies the alignment in bytes and must be a power of
  1451. two, i.e. 1, 2, 4, 8@dots{}.
  1452. @item --add-section @var{sectionname}=@var{filename}
  1453. Add a new section named @var{sectionname} while copying the file. The
  1454. contents of the new section are taken from the file @var{filename}. The
  1455. size of the section will be the size of the file. This option only
  1456. works on file formats which can support sections with arbitrary names.
  1457. Note - it may be necessary to use the @option{--set-section-flags}
  1458. option to set the attributes of the newly created section.
  1459. @item --dump-section @var{sectionname}=@var{filename}
  1460. Place the contents of section named @var{sectionname} into the file
  1461. @var{filename}, overwriting any contents that may have been there
  1462. previously. This option is the inverse of @option{--add-section}.
  1463. This option is similar to the @option{--only-section} option except
  1464. that it does not create a formatted file, it just dumps the contents
  1465. as raw binary data, without applying any relocations. The option can
  1466. be specified more than once.
  1467. @item --update-section @var{sectionname}=@var{filename}
  1468. Replace the existing contents of a section named @var{sectionname}
  1469. with the contents of file @var{filename}. The size of the section
  1470. will be adjusted to the size of the file. The section flags for
  1471. @var{sectionname} will be unchanged. For ELF format files the section
  1472. to segment mapping will also remain unchanged, something which is not
  1473. possible using @option{--remove-section} followed by
  1474. @option{--add-section}. The option can be specified more than once.
  1475. Note - it is possible to use @option{--rename-section} and
  1476. @option{--update-section} to both update and rename a section from one
  1477. command line. In this case, pass the original section name to
  1478. @option{--update-section}, and the original and new section names to
  1479. @option{--rename-section}.
  1480. @item --add-symbol @var{name}=[@var{section}:]@var{value}[,@var{flags}]
  1481. Add a new symbol named @var{name} while copying the file. This option may be
  1482. specified multiple times. If the @var{section} is given, the symbol will be
  1483. associated with and relative to that section, otherwise it will be an ABS
  1484. symbol. Specifying an undefined section will result in a fatal error. There
  1485. is no check for the value, it will be taken as specified. Symbol flags can
  1486. be specified and not all flags will be meaningful for all object file
  1487. formats. By default, the symbol will be global. The special flag
  1488. 'before=@var{othersym}' will insert the new symbol in front of the specified
  1489. @var{othersym}, otherwise the symbol(s) will be added at the end of the
  1490. symbol table in the order they appear.
  1491. @item --rename-section @var{oldname}=@var{newname}[,@var{flags}]
  1492. Rename a section from @var{oldname} to @var{newname}, optionally
  1493. changing the section's flags to @var{flags} in the process. This has
  1494. the advantage over using a linker script to perform the rename in that
  1495. the output stays as an object file and does not become a linked
  1496. executable. This option accepts the same set of flags as the
  1497. @option{--sect-section-flags} option.
  1498. This option is particularly helpful when the input format is binary,
  1499. since this will always create a section called .data. If for example,
  1500. you wanted instead to create a section called .rodata containing binary
  1501. data you could use the following command line to achieve it:
  1502. @smallexample
  1503. objcopy -I binary -O <output_format> -B <architecture> \
  1504. --rename-section .data=.rodata,alloc,load,readonly,data,contents \
  1505. <input_binary_file> <output_object_file>
  1506. @end smallexample
  1507. @item --long-section-names @{enable,disable,keep@}
  1508. Controls the handling of long section names when processing @code{COFF}
  1509. and @code{PE-COFF} object formats. The default behaviour, @samp{keep},
  1510. is to preserve long section names if any are present in the input file.
  1511. The @samp{enable} and @samp{disable} options forcibly enable or disable
  1512. the use of long section names in the output object; when @samp{disable}
  1513. is in effect, any long section names in the input object will be truncated.
  1514. The @samp{enable} option will only emit long section names if any are
  1515. present in the inputs; this is mostly the same as @samp{keep}, but it
  1516. is left undefined whether the @samp{enable} option might force the
  1517. creation of an empty string table in the output file.
  1518. @item --change-leading-char
  1519. Some object file formats use special characters at the start of
  1520. symbols. The most common such character is underscore, which compilers
  1521. often add before every symbol. This option tells @command{objcopy} to
  1522. change the leading character of every symbol when it converts between
  1523. object file formats. If the object file formats use the same leading
  1524. character, this option has no effect. Otherwise, it will add a
  1525. character, or remove a character, or change a character, as
  1526. appropriate.
  1527. @item --remove-leading-char
  1528. If the first character of a global symbol is a special symbol leading
  1529. character used by the object file format, remove the character. The
  1530. most common symbol leading character is underscore. This option will
  1531. remove a leading underscore from all global symbols. This can be useful
  1532. if you want to link together objects of different file formats with
  1533. different conventions for symbol names. This is different from
  1534. @option{--change-leading-char} because it always changes the symbol name
  1535. when appropriate, regardless of the object file format of the output
  1536. file.
  1537. @item --reverse-bytes=@var{num}
  1538. Reverse the bytes in a section with output contents. A section length must
  1539. be evenly divisible by the value given in order for the swap to be able to
  1540. take place. Reversing takes place before the interleaving is performed.
  1541. This option is used typically in generating ROM images for problematic
  1542. target systems. For example, on some target boards, the 32-bit words
  1543. fetched from 8-bit ROMs are re-assembled in little-endian byte order
  1544. regardless of the CPU byte order. Depending on the programming model, the
  1545. endianness of the ROM may need to be modified.
  1546. Consider a simple file with a section containing the following eight
  1547. bytes: @code{12345678}.
  1548. Using @samp{--reverse-bytes=2} for the above example, the bytes in the
  1549. output file would be ordered @code{21436587}.
  1550. Using @samp{--reverse-bytes=4} for the above example, the bytes in the
  1551. output file would be ordered @code{43218765}.
  1552. By using @samp{--reverse-bytes=2} for the above example, followed by
  1553. @samp{--reverse-bytes=4} on the output file, the bytes in the second
  1554. output file would be ordered @code{34127856}.
  1555. @item --srec-len=@var{ival}
  1556. Meaningful only for srec output. Set the maximum length of the Srecords
  1557. being produced to @var{ival}. This length covers both address, data and
  1558. crc fields.
  1559. @item --srec-forceS3
  1560. Meaningful only for srec output. Avoid generation of S1/S2 records,
  1561. creating S3-only record format.
  1562. @item --redefine-sym @var{old}=@var{new}
  1563. Change the name of a symbol @var{old}, to @var{new}. This can be useful
  1564. when one is trying link two things together for which you have no
  1565. source, and there are name collisions.
  1566. @item --redefine-syms=@var{filename}
  1567. Apply @option{--redefine-sym} to each symbol pair "@var{old} @var{new}"
  1568. listed in the file @var{filename}. @var{filename} is simply a flat file,
  1569. with one symbol pair per line. Line comments may be introduced by the hash
  1570. character. This option may be given more than once.
  1571. @item --weaken
  1572. Change all global symbols in the file to be weak. This can be useful
  1573. when building an object which will be linked against other objects using
  1574. the @option{-R} option to the linker. This option is only effective when
  1575. using an object file format which supports weak symbols.
  1576. @item --keep-symbols=@var{filename}
  1577. Apply @option{--keep-symbol} option to each symbol listed in the file
  1578. @var{filename}. @var{filename} is simply a flat file, with one symbol
  1579. name per line. Line comments may be introduced by the hash character.
  1580. This option may be given more than once.
  1581. @item --strip-symbols=@var{filename}
  1582. Apply @option{--strip-symbol} option to each symbol listed in the file
  1583. @var{filename}. @var{filename} is simply a flat file, with one symbol
  1584. name per line. Line comments may be introduced by the hash character.
  1585. This option may be given more than once.
  1586. @item --strip-unneeded-symbols=@var{filename}
  1587. Apply @option{--strip-unneeded-symbol} option to each symbol listed in
  1588. the file @var{filename}. @var{filename} is simply a flat file, with one
  1589. symbol name per line. Line comments may be introduced by the hash
  1590. character. This option may be given more than once.
  1591. @item --keep-global-symbols=@var{filename}
  1592. Apply @option{--keep-global-symbol} option to each symbol listed in the
  1593. file @var{filename}. @var{filename} is simply a flat file, with one
  1594. symbol name per line. Line comments may be introduced by the hash
  1595. character. This option may be given more than once.
  1596. @item --localize-symbols=@var{filename}
  1597. Apply @option{--localize-symbol} option to each symbol listed in the file
  1598. @var{filename}. @var{filename} is simply a flat file, with one symbol
  1599. name per line. Line comments may be introduced by the hash character.
  1600. This option may be given more than once.
  1601. @item --globalize-symbols=@var{filename}
  1602. Apply @option{--globalize-symbol} option to each symbol listed in the file
  1603. @var{filename}. @var{filename} is simply a flat file, with one symbol
  1604. name per line. Line comments may be introduced by the hash character.
  1605. This option may be given more than once. Note: this option cannot be
  1606. used in conjunction with the @option{-G} or @option{--keep-global-symbol}
  1607. options.
  1608. @item --weaken-symbols=@var{filename}
  1609. Apply @option{--weaken-symbol} option to each symbol listed in the file
  1610. @var{filename}. @var{filename} is simply a flat file, with one symbol
  1611. name per line. Line comments may be introduced by the hash character.
  1612. This option may be given more than once.
  1613. @item --alt-machine-code=@var{index}
  1614. If the output architecture has alternate machine codes, use the
  1615. @var{index}th code instead of the default one. This is useful in case
  1616. a machine is assigned an official code and the tool-chain adopts the
  1617. new code, but other applications still depend on the original code
  1618. being used. For ELF based architectures if the @var{index}
  1619. alternative does not exist then the value is treated as an absolute
  1620. number to be stored in the e_machine field of the ELF header.
  1621. @item --writable-text
  1622. Mark the output text as writable. This option isn't meaningful for all
  1623. object file formats.
  1624. @item --readonly-text
  1625. Make the output text write protected. This option isn't meaningful for all
  1626. object file formats.
  1627. @item --pure
  1628. Mark the output file as demand paged. This option isn't meaningful for all
  1629. object file formats.
  1630. @item --impure
  1631. Mark the output file as impure. This option isn't meaningful for all
  1632. object file formats.
  1633. @item --prefix-symbols=@var{string}
  1634. Prefix all symbols in the output file with @var{string}.
  1635. @item --prefix-sections=@var{string}
  1636. Prefix all section names in the output file with @var{string}.
  1637. @item --prefix-alloc-sections=@var{string}
  1638. Prefix all the names of all allocated sections in the output file with
  1639. @var{string}.
  1640. @item --add-gnu-debuglink=@var{path-to-file}
  1641. Creates a .gnu_debuglink section which contains a reference to
  1642. @var{path-to-file} and adds it to the output file. Note: the file at
  1643. @var{path-to-file} must exist. Part of the process of adding the
  1644. .gnu_debuglink section involves embedding a checksum of the contents
  1645. of the debug info file into the section.
  1646. If the debug info file is built in one location but it is going to be
  1647. installed at a later time into a different location then do not use
  1648. the path to the installed location. The @option{--add-gnu-debuglink}
  1649. option will fail because the installed file does not exist yet.
  1650. Instead put the debug info file in the current directory and use the
  1651. @option{--add-gnu-debuglink} option without any directory components,
  1652. like this:
  1653. @smallexample
  1654. objcopy --add-gnu-debuglink=foo.debug
  1655. @end smallexample
  1656. At debug time the debugger will attempt to look for the separate debug
  1657. info file in a set of known locations. The exact set of these
  1658. locations varies depending upon the distribution being used, but it
  1659. typically includes:
  1660. @table @code
  1661. @item * The same directory as the executable.
  1662. @item * A sub-directory of the directory containing the executable
  1663. called .debug
  1664. @item * A global debug directory such as /usr/lib/debug.
  1665. @end table
  1666. As long as the debug info file has been installed into one of these
  1667. locations before the debugger is run everything should work
  1668. correctly.
  1669. @item --keep-section-symbils
  1670. When stripping a file, perhaps with @option{--strip-debug} or
  1671. @option{--strip-unneeded}, retain any symbols specifying section names,
  1672. which would otherwise get stripped.
  1673. @item --keep-file-symbols
  1674. When stripping a file, perhaps with @option{--strip-debug} or
  1675. @option{--strip-unneeded}, retain any symbols specifying source file names,
  1676. which would otherwise get stripped.
  1677. @item --only-keep-debug
  1678. Strip a file, removing contents of any sections that would not be
  1679. stripped by @option{--strip-debug} and leaving the debugging sections
  1680. intact. In ELF files, this preserves all note sections in the output.
  1681. Note - the section headers of the stripped sections are preserved,
  1682. including their sizes, but the contents of the section are discarded.
  1683. The section headers are preserved so that other tools can match up the
  1684. debuginfo file with the real executable, even if that executable has
  1685. been relocated to a different address space.
  1686. The intention is that this option will be used in conjunction with
  1687. @option{--add-gnu-debuglink} to create a two part executable. One a
  1688. stripped binary which will occupy less space in RAM and in a
  1689. distribution and the second a debugging information file which is only
  1690. needed if debugging abilities are required. The suggested procedure
  1691. to create these files is as follows:
  1692. @enumerate
  1693. @item Link the executable as normal. Assuming that it is called
  1694. @code{foo} then...
  1695. @item Run @code{objcopy --only-keep-debug foo foo.dbg} to
  1696. create a file containing the debugging info.
  1697. @item Run @code{objcopy --strip-debug foo} to create a
  1698. stripped executable.
  1699. @item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
  1700. to add a link to the debugging info into the stripped executable.
  1701. @end enumerate
  1702. Note---the choice of @code{.dbg} as an extension for the debug info
  1703. file is arbitrary. Also the @code{--only-keep-debug} step is
  1704. optional. You could instead do this:
  1705. @enumerate
  1706. @item Link the executable as normal.
  1707. @item Copy @code{foo} to @code{foo.full}
  1708. @item Run @code{objcopy --strip-debug foo}
  1709. @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
  1710. @end enumerate
  1711. i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
  1712. full executable. It does not have to be a file created by the
  1713. @option{--only-keep-debug} switch.
  1714. Note---this switch is only intended for use on fully linked files. It
  1715. does not make sense to use it on object files where the debugging
  1716. information may be incomplete. Besides the gnu_debuglink feature
  1717. currently only supports the presence of one filename containing
  1718. debugging information, not multiple filenames on a one-per-object-file
  1719. basis.
  1720. @item --strip-dwo
  1721. Remove the contents of all DWARF .dwo sections, leaving the
  1722. remaining debugging sections and all symbols intact.
  1723. This option is intended for use by the compiler as part of
  1724. the @option{-gsplit-dwarf} option, which splits debug information
  1725. between the .o file and a separate .dwo file. The compiler
  1726. generates all debug information in the same file, then uses
  1727. the @option{--extract-dwo} option to copy the .dwo sections to
  1728. the .dwo file, then the @option{--strip-dwo} option to remove
  1729. those sections from the original .o file.
  1730. @item --extract-dwo
  1731. Extract the contents of all DWARF .dwo sections. See the
  1732. @option{--strip-dwo} option for more information.
  1733. @item --file-alignment @var{num}
  1734. Specify the file alignment. Sections in the file will always begin at
  1735. file offsets which are multiples of this number. This defaults to
  1736. 512.
  1737. [This option is specific to PE targets.]
  1738. @item --heap @var{reserve}
  1739. @itemx --heap @var{reserve},@var{commit}
  1740. Specify the number of bytes of memory to reserve (and optionally commit)
  1741. to be used as heap for this program.
  1742. [This option is specific to PE targets.]
  1743. @item --image-base @var{value}
  1744. Use @var{value} as the base address of your program or dll. This is
  1745. the lowest memory location that will be used when your program or dll
  1746. is loaded. To reduce the need to relocate and improve performance of
  1747. your dlls, each should have a unique base address and not overlap any
  1748. other dlls. The default is 0x400000 for executables, and 0x10000000
  1749. for dlls.
  1750. [This option is specific to PE targets.]
  1751. @item --section-alignment @var{num}
  1752. Sets the section alignment field in the PE header. Sections in memory
  1753. will always begin at addresses which are a multiple of this number.
  1754. Defaults to 0x1000.
  1755. [This option is specific to PE targets.]
  1756. @item --stack @var{reserve}
  1757. @itemx --stack @var{reserve},@var{commit}
  1758. Specify the number of bytes of memory to reserve (and optionally commit)
  1759. to be used as stack for this program.
  1760. [This option is specific to PE targets.]
  1761. @item --subsystem @var{which}
  1762. @itemx --subsystem @var{which}:@var{major}
  1763. @itemx --subsystem @var{which}:@var{major}.@var{minor}
  1764. Specifies the subsystem under which your program will execute. The
  1765. legal values for @var{which} are @code{native}, @code{windows},
  1766. @code{console}, @code{posix}, @code{efi-app}, @code{efi-bsd},
  1767. @code{efi-rtd}, @code{sal-rtd}, and @code{xbox}. You may optionally set
  1768. the subsystem version also. Numeric values are also accepted for
  1769. @var{which}.
  1770. [This option is specific to PE targets.]
  1771. @item --extract-symbol
  1772. Keep the file's section flags and symbols but remove all section data.
  1773. Specifically, the option:
  1774. @itemize
  1775. @item removes the contents of all sections;
  1776. @item sets the size of every section to zero; and
  1777. @item sets the file's start address to zero.
  1778. @end itemize
  1779. This option is used to build a @file{.sym} file for a VxWorks kernel.
  1780. It can also be a useful way of reducing the size of a @option{--just-symbols}
  1781. linker input file.
  1782. @item --compress-debug-sections
  1783. Compress DWARF debug sections using zlib with SHF_COMPRESSED from the
  1784. ELF ABI. Note - if compression would actually make a section
  1785. @emph{larger}, then it is not compressed.
  1786. @item --compress-debug-sections=none
  1787. @itemx --compress-debug-sections=zlib
  1788. @itemx --compress-debug-sections=zlib-gnu
  1789. @itemx --compress-debug-sections=zlib-gabi
  1790. For ELF files, these options control how DWARF debug sections are
  1791. compressed. @option{--compress-debug-sections=none} is equivalent
  1792. to @option{--decompress-debug-sections}.
  1793. @option{--compress-debug-sections=zlib} and
  1794. @option{--compress-debug-sections=zlib-gabi} are equivalent to
  1795. @option{--compress-debug-sections}.
  1796. @option{--compress-debug-sections=zlib-gnu} compresses DWARF debug
  1797. sections using zlib. The debug sections are renamed to begin with
  1798. @samp{.zdebug} instead of @samp{.debug}. Note - if compression would
  1799. actually make a section @emph{larger}, then it is not compressed nor
  1800. renamed.
  1801. @item --decompress-debug-sections
  1802. Decompress DWARF debug sections using zlib. The original section
  1803. names of the compressed sections are restored.
  1804. @item --elf-stt-common=yes
  1805. @itemx --elf-stt-common=no
  1806. For ELF files, these options control whether common symbols should be
  1807. converted to the @code{STT_COMMON} or @code{STT_OBJECT} type.
  1808. @option{--elf-stt-common=yes} converts common symbol type to
  1809. @code{STT_COMMON}. @option{--elf-stt-common=no} converts common symbol
  1810. type to @code{STT_OBJECT}.
  1811. @item --merge-notes
  1812. @itemx --no-merge-notes
  1813. For ELF files, attempt (or do not attempt) to reduce the size of any
  1814. SHT_NOTE type sections by removing duplicate notes.
  1815. @item -V
  1816. @itemx --version
  1817. Show the version number of @command{objcopy}.
  1818. @item --verilog-data-width=@var{bytes}
  1819. For Verilog output, this options controls the number of bytes
  1820. converted for each output data element. The input target controls the
  1821. endianness of the conversion.
  1822. @item -v
  1823. @itemx --verbose
  1824. Verbose output: list all object files modified. In the case of
  1825. archives, @samp{objcopy -V} lists all members of the archive.
  1826. @item --help
  1827. Show a summary of the options to @command{objcopy}.
  1828. @item --info
  1829. Display a list showing all architectures and object formats available.
  1830. @end table
  1831. @c man end
  1832. @ignore
  1833. @c man begin SEEALSO objcopy
  1834. ld(1), objdump(1), and the Info entries for @file{binutils}.
  1835. @c man end
  1836. @end ignore
  1837. @node objdump
  1838. @chapter objdump
  1839. @cindex object file information
  1840. @kindex objdump
  1841. @c man title objdump display information from object files
  1842. @smallexample
  1843. @c man begin SYNOPSIS objdump
  1844. objdump [@option{-a}|@option{--archive-headers}]
  1845. [@option{-b} @var{bfdname}|@option{--target=@var{bfdname}}]
  1846. [@option{-C}|@option{--demangle}[=@var{style}] ]
  1847. [@option{-d}|@option{--disassemble}[=@var{symbol}]]
  1848. [@option{-D}|@option{--disassemble-all}]
  1849. [@option{-z}|@option{--disassemble-zeroes}]
  1850. [@option{-EB}|@option{-EL}|@option{--endian=}@{big | little @}]
  1851. [@option{-f}|@option{--file-headers}]
  1852. [@option{-F}|@option{--file-offsets}]
  1853. [@option{--file-start-context}]
  1854. [@option{-g}|@option{--debugging}]
  1855. [@option{-e}|@option{--debugging-tags}]
  1856. [@option{-h}|@option{--section-headers}|@option{--headers}]
  1857. [@option{-i}|@option{--info}]
  1858. [@option{-j} @var{section}|@option{--section=}@var{section}]
  1859. [@option{-l}|@option{--line-numbers}]
  1860. [@option{-S}|@option{--source}]
  1861. [@option{--source-comment}[=@var{text}]]
  1862. [@option{-m} @var{machine}|@option{--architecture=}@var{machine}]
  1863. [@option{-M} @var{options}|@option{--disassembler-options=}@var{options}]
  1864. [@option{-p}|@option{--private-headers}]
  1865. [@option{-P} @var{options}|@option{--private=}@var{options}]
  1866. [@option{-r}|@option{--reloc}]
  1867. [@option{-R}|@option{--dynamic-reloc}]
  1868. [@option{-s}|@option{--full-contents}]
  1869. [@option{-W[lLiaprmfFsoORtUuTgAck]}|
  1870. @option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
  1871. [@option{-WK}|@option{--dwarf=follow-links}]
  1872. [@option{-WN}|@option{--dwarf=no-follow-links}]
  1873. [@option{-wD}|@option{--dwarf=use-debuginfod}]
  1874. [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}]
  1875. [@option{-L}|@option{--process-links}]
  1876. [@option{--ctf=}@var{section}]
  1877. [@option{-G}|@option{--stabs}]
  1878. [@option{-t}|@option{--syms}]
  1879. [@option{-T}|@option{--dynamic-syms}]
  1880. [@option{-x}|@option{--all-headers}]
  1881. [@option{-w}|@option{--wide}]
  1882. [@option{--start-address=}@var{address}]
  1883. [@option{--stop-address=}@var{address}]
  1884. [@option{--no-addresses}]
  1885. [@option{--prefix-addresses}]
  1886. [@option{--[no-]show-raw-insn}]
  1887. [@option{--adjust-vma=}@var{offset}]
  1888. [@option{--dwarf-depth=@var{n}}]
  1889. [@option{--dwarf-start=@var{n}}]
  1890. [@option{--ctf-parent=}@var{section}]
  1891. [@option{--no-recurse-limit}|@option{--recurse-limit}]
  1892. [@option{--special-syms}]
  1893. [@option{--prefix=}@var{prefix}]
  1894. [@option{--prefix-strip=}@var{level}]
  1895. [@option{--insn-width=}@var{width}]
  1896. [@option{--visualize-jumps[=color|=extended-color|=off]}
  1897. [@option{--disassembler-color=[color|extended-color|off]}
  1898. [@option{-U} @var{method}] [@option{--unicode=}@var{method}]
  1899. [@option{-V}|@option{--version}]
  1900. [@option{-H}|@option{--help}]
  1901. @var{objfile}@dots{}
  1902. @c man end
  1903. @end smallexample
  1904. @c man begin DESCRIPTION objdump
  1905. @command{objdump} displays information about one or more object files.
  1906. The options control what particular information to display. This
  1907. information is mostly useful to programmers who are working on the
  1908. compilation tools, as opposed to programmers who just want their
  1909. program to compile and work.
  1910. @var{objfile}@dots{} are the object files to be examined. When you
  1911. specify archives, @command{objdump} shows information on each of the member
  1912. object files.
  1913. @c man end
  1914. @c man begin OPTIONS objdump
  1915. The long and short forms of options, shown here as alternatives, are
  1916. equivalent. At least one option from the list
  1917. @option{-a,-d,-D,-e,-f,-g,-G,-h,-H,-p,-P,-r,-R,-s,-S,-t,-T,-V,-x} must be given.
  1918. @table @env
  1919. @item -a
  1920. @itemx --archive-header
  1921. @cindex archive headers
  1922. If any of the @var{objfile} files are archives, display the archive
  1923. header information (in a format similar to @samp{ls -l}). Besides the
  1924. information you could list with @samp{ar tv}, @samp{objdump -a} shows
  1925. the object file format of each archive member.
  1926. @item --adjust-vma=@var{offset}
  1927. @cindex section addresses in objdump
  1928. @cindex VMA in objdump
  1929. When dumping information, first add @var{offset} to all the section
  1930. addresses. This is useful if the section addresses do not correspond to
  1931. the symbol table, which can happen when putting sections at particular
  1932. addresses when using a format which can not represent section addresses,
  1933. such as a.out.
  1934. @item -b @var{bfdname}
  1935. @itemx --target=@var{bfdname}
  1936. @cindex object code format
  1937. Specify that the object-code format for the object files is
  1938. @var{bfdname}. This option may not be necessary; @var{objdump} can
  1939. automatically recognize many formats.
  1940. For example,
  1941. @example
  1942. objdump -b oasys -m vax -h fu.o
  1943. @end example
  1944. @noindent
  1945. displays summary information from the section headers (@option{-h}) of
  1946. @file{fu.o}, which is explicitly identified (@option{-m}) as a VAX object
  1947. file in the format produced by Oasys compilers. You can list the
  1948. formats available with the @option{-i} option.
  1949. @xref{Target Selection}, for more information.
  1950. @item -C
  1951. @itemx --demangle[=@var{style}]
  1952. @cindex demangling in objdump
  1953. Decode (@dfn{demangle}) low-level symbol names into user-level names.
  1954. Besides removing any initial underscore prepended by the system, this
  1955. makes C++ function names readable. Different compilers have different
  1956. mangling styles. The optional demangling style argument can be used to
  1957. choose an appropriate demangling style for your compiler. @xref{c++filt},
  1958. for more information on demangling.
  1959. @item --recurse-limit
  1960. @itemx --no-recurse-limit
  1961. @itemx --recursion-limit
  1962. @itemx --no-recursion-limit
  1963. Enables or disables a limit on the amount of recursion performed
  1964. whilst demangling strings. Since the name mangling formats allow for
  1965. an infinite level of recursion it is possible to create strings whose
  1966. decoding will exhaust the amount of stack space available on the host
  1967. machine, triggering a memory fault. The limit tries to prevent this
  1968. from happening by restricting recursion to 2048 levels of nesting.
  1969. The default is for this limit to be enabled, but disabling it may be
  1970. necessary in order to demangle truly complicated names. Note however
  1971. that if the recursion limit is disabled then stack exhaustion is
  1972. possible and any bug reports about such an event will be rejected.
  1973. @item -g
  1974. @itemx --debugging
  1975. Display debugging information. This attempts to parse STABS
  1976. debugging format information stored in the file and print it out using
  1977. a C like syntax. If no STABS debugging was found this option
  1978. falls back on the @option{-W} option to print any DWARF information in
  1979. the file.
  1980. @item -e
  1981. @itemx --debugging-tags
  1982. Like @option{-g}, but the information is generated in a format compatible
  1983. with ctags tool.
  1984. @item -d
  1985. @itemx --disassemble
  1986. @itemx --disassemble=@var{symbol}
  1987. @cindex disassembling object code
  1988. @cindex machine instructions
  1989. Display the assembler mnemonics for the machine instructions from the
  1990. input file. This option only disassembles those sections which are
  1991. expected to contain instructions. If the optional @var{symbol}
  1992. argument is given, then display the assembler mnemonics starting at
  1993. @var{symbol}. If @var{symbol} is a function name then disassembly
  1994. will stop at the end of the function, otherwise it will stop when the
  1995. next symbol is encountered. If there are no matches for @var{symbol}
  1996. then nothing will be displayed.
  1997. Note if the @option{--dwarf=follow-links} option is enabled
  1998. then any symbol tables in linked debug info files will be read in and
  1999. used when disassembling.
  2000. @item -D
  2001. @itemx --disassemble-all
  2002. Like @option{-d}, but disassemble the contents of all sections, not just
  2003. those expected to contain instructions.
  2004. This option also has a subtle effect on the disassembly of
  2005. instructions in code sections. When option @option{-d} is in effect
  2006. objdump will assume that any symbols present in a code section occur
  2007. on the boundary between instructions and it will refuse to disassemble
  2008. across such a boundary. When option @option{-D} is in effect however
  2009. this assumption is supressed. This means that it is possible for the
  2010. output of @option{-d} and @option{-D} to differ if, for example, data
  2011. is stored in code sections.
  2012. If the target is an ARM architecture this switch also has the effect
  2013. of forcing the disassembler to decode pieces of data found in code
  2014. sections as if they were instructions.
  2015. Note if the @option{--dwarf=follow-links} option is enabled
  2016. then any symbol tables in linked debug info files will be read in and
  2017. used when disassembling.
  2018. @item --no-addresses
  2019. When disassembling, don't print addresses on each line or for symbols
  2020. and relocation offsets. In combination with @option{--no-show-raw-insn}
  2021. this may be useful for comparing compiler output.
  2022. @item --prefix-addresses
  2023. When disassembling, print the complete address on each line. This is
  2024. the older disassembly format.
  2025. @item -EB
  2026. @itemx -EL
  2027. @itemx --endian=@{big|little@}
  2028. @cindex endianness
  2029. @cindex disassembly endianness
  2030. Specify the endianness of the object files. This only affects
  2031. disassembly. This can be useful when disassembling a file format which
  2032. does not describe endianness information, such as S-records.
  2033. @item -f
  2034. @itemx --file-headers
  2035. @cindex object file header
  2036. Display summary information from the overall header of
  2037. each of the @var{objfile} files.
  2038. @item -F
  2039. @itemx --file-offsets
  2040. @cindex object file offsets
  2041. When disassembling sections, whenever a symbol is displayed, also
  2042. display the file offset of the region of data that is about to be
  2043. dumped. If zeroes are being skipped, then when disassembly resumes,
  2044. tell the user how many zeroes were skipped and the file offset of the
  2045. location from where the disassembly resumes. When dumping sections,
  2046. display the file offset of the location from where the dump starts.
  2047. @item --file-start-context
  2048. @cindex source code context
  2049. Specify that when displaying interlisted source code/disassembly
  2050. (assumes @option{-S}) from a file that has not yet been displayed, extend the
  2051. context to the start of the file.
  2052. @item -h
  2053. @itemx --section-headers
  2054. @itemx --headers
  2055. @cindex section headers
  2056. Display summary information from the section headers of the
  2057. object file.
  2058. File segments may be relocated to nonstandard addresses, for example by
  2059. using the @option{-Ttext}, @option{-Tdata}, or @option{-Tbss} options to
  2060. @command{ld}. However, some object file formats, such as a.out, do not
  2061. store the starting address of the file segments. In those situations,
  2062. although @command{ld} relocates the sections correctly, using @samp{objdump
  2063. -h} to list the file section headers cannot show the correct addresses.
  2064. Instead, it shows the usual addresses, which are implicit for the
  2065. target.
  2066. Note, in some cases it is possible for a section to have both the
  2067. READONLY and the NOREAD attributes set. In such cases the NOREAD
  2068. attribute takes precedence, but @command{objdump} will report both
  2069. since the exact setting of the flag bits might be important.
  2070. @item -H
  2071. @itemx --help
  2072. Print a summary of the options to @command{objdump} and exit.
  2073. @item -i
  2074. @itemx --info
  2075. @cindex architectures available
  2076. @cindex object formats available
  2077. Display a list showing all architectures and object formats available
  2078. for specification with @option{-b} or @option{-m}.
  2079. @item -j @var{name}
  2080. @itemx --section=@var{name}
  2081. @cindex section information
  2082. Display information only for section @var{name}.
  2083. @item -L
  2084. @itemx --process-links
  2085. Display the contents of non-debug sections found in separate debuginfo
  2086. files that are linked to the main file. This option automatically
  2087. implies the @option{-WK} option, and only sections requested by other
  2088. command line options will be displayed.
  2089. @item -l
  2090. @itemx --line-numbers
  2091. @cindex source filenames for object files
  2092. Label the display (using debugging information) with the filename and
  2093. source line numbers corresponding to the object code or relocs shown.
  2094. Only useful with @option{-d}, @option{-D}, or @option{-r}.
  2095. @item -m @var{machine}
  2096. @itemx --architecture=@var{machine}
  2097. @cindex architecture
  2098. @cindex disassembly architecture
  2099. Specify the architecture to use when disassembling object files. This
  2100. can be useful when disassembling object files which do not describe
  2101. architecture information, such as S-records. You can list the available
  2102. architectures with the @option{-i} option.
  2103. If the target is an ARM architecture then this switch has an
  2104. additional effect. It restricts the disassembly to only those
  2105. instructions supported by the architecture specified by @var{machine}.
  2106. If it is necessary to use this switch because the input file does not
  2107. contain any architecture information, but it is also desired to
  2108. disassemble all the instructions use @option{-marm}.
  2109. @item -M @var{options}
  2110. @itemx --disassembler-options=@var{options}
  2111. Pass target specific information to the disassembler. Only supported on
  2112. some targets. If it is necessary to specify more than one
  2113. disassembler option then multiple @option{-M} options can be used or
  2114. can be placed together into a comma separated list.
  2115. For ARC, @option{dsp} controls the printing of DSP instructions,
  2116. @option{spfp} selects the printing of FPX single precision FP
  2117. instructions, @option{dpfp} selects the printing of FPX double
  2118. precision FP instructions, @option{quarkse_em} selects the printing of
  2119. special QuarkSE-EM instructions, @option{fpuda} selects the printing
  2120. of double precision assist instructions, @option{fpus} selects the
  2121. printing of FPU single precision FP instructions, while @option{fpud}
  2122. selects the printing of FPU double precision FP instructions.
  2123. Additionally, one can choose to have all the immediates printed in
  2124. hexadecimal using @option{hex}. By default, the short immediates are
  2125. printed using the decimal representation, while the long immediate
  2126. values are printed as hexadecimal.
  2127. @option{cpu=...} allows one to enforce a particular ISA when disassembling
  2128. instructions, overriding the @option{-m} value or whatever is in the ELF file.
  2129. This might be useful to select ARC EM or HS ISA, because architecture is same
  2130. for those and disassembler relies on private ELF header data to decide if code
  2131. is for EM or HS. This option might be specified multiple times - only the
  2132. latest value will be used. Valid values are same as for the assembler
  2133. @option{-mcpu=...} option.
  2134. If the target is an ARM architecture then this switch can be used to
  2135. select which register name set is used during disassembler. Specifying
  2136. @option{-M reg-names-std} (the default) will select the register names as
  2137. used in ARM's instruction set documentation, but with register 13 called
  2138. 'sp', register 14 called 'lr' and register 15 called 'pc'. Specifying
  2139. @option{-M reg-names-apcs} will select the name set used by the ARM
  2140. Procedure Call Standard, whilst specifying @option{-M reg-names-raw} will
  2141. just use @samp{r} followed by the register number.
  2142. There are also two variants on the APCS register naming scheme enabled
  2143. by @option{-M reg-names-atpcs} and @option{-M reg-names-special-atpcs} which
  2144. use the ARM/Thumb Procedure Call Standard naming conventions. (Either
  2145. with the normal register names or the special register names).
  2146. This option can also be used for ARM architectures to force the
  2147. disassembler to interpret all instructions as Thumb instructions by
  2148. using the switch @option{--disassembler-options=force-thumb}. This can be
  2149. useful when attempting to disassemble thumb code produced by other
  2150. compilers.
  2151. For AArch64 targets this switch can be used to set whether instructions are
  2152. disassembled as the most general instruction using the @option{-M no-aliases}
  2153. option or whether instruction notes should be generated as comments in the
  2154. disasssembly using @option{-M notes}.
  2155. For the x86, some of the options duplicate functions of the @option{-m}
  2156. switch, but allow finer grained control.
  2157. @table @code
  2158. @item x86-64
  2159. @itemx i386
  2160. @itemx i8086
  2161. Select disassembly for the given architecture.
  2162. @item intel
  2163. @itemx att
  2164. Select between intel syntax mode and AT&T syntax mode.
  2165. @item amd64
  2166. @itemx intel64
  2167. Select between AMD64 ISA and Intel64 ISA.
  2168. @item intel-mnemonic
  2169. @itemx att-mnemonic
  2170. Select between intel mnemonic mode and AT&T mnemonic mode.
  2171. Note: @code{intel-mnemonic} implies @code{intel} and
  2172. @code{att-mnemonic} implies @code{att}.
  2173. @item addr64
  2174. @itemx addr32
  2175. @itemx addr16
  2176. @itemx data32
  2177. @itemx data16
  2178. Specify the default address size and operand size. These five options
  2179. will be overridden if @code{x86-64}, @code{i386} or @code{i8086}
  2180. appear later in the option string.
  2181. @item suffix
  2182. When in AT&T mode and also for a limited set of instructions when in Intel
  2183. mode, instructs the disassembler to print a mnemonic suffix even when the
  2184. suffix could be inferred by the operands or, for certain instructions, the
  2185. execution mode's defaults.
  2186. @end table
  2187. For PowerPC, the @option{-M} argument @option{raw} selects
  2188. disasssembly of hardware insns rather than aliases. For example, you
  2189. will see @code{rlwinm} rather than @code{clrlwi}, and @code{addi}
  2190. rather than @code{li}. All of the @option{-m} arguments for
  2191. @command{gas} that select a CPU are supported. These are:
  2192. @option{403}, @option{405}, @option{440}, @option{464}, @option{476},
  2193. @option{601}, @option{603}, @option{604}, @option{620}, @option{7400},
  2194. @option{7410}, @option{7450}, @option{7455}, @option{750cl},
  2195. @option{821}, @option{850}, @option{860}, @option{a2}, @option{booke},
  2196. @option{booke32}, @option{cell}, @option{com}, @option{e200z4},
  2197. @option{e300}, @option{e500}, @option{e500mc}, @option{e500mc64},
  2198. @option{e500x2}, @option{e5500}, @option{e6500}, @option{efs},
  2199. @option{power4}, @option{power5}, @option{power6}, @option{power7},
  2200. @option{power8}, @option{power9}, @option{power10}, @option{ppc},
  2201. @option{ppc32}, @option{ppc64}, @option{ppc64bridge}, @option{ppcps},
  2202. @option{pwr}, @option{pwr2}, @option{pwr4}, @option{pwr5}, @option{pwr5x},
  2203. @option{pwr6}, @option{pwr7}, @option{pwr8}, @option{pwr9}, @option{pwr10},
  2204. @option{pwrx}, @option{titan}, and @option{vle}.
  2205. @option{32} and @option{64} modify the default or a prior CPU
  2206. selection, disabling and enabling 64-bit insns respectively. In
  2207. addition, @option{altivec}, @option{any}, @option{htm}, @option{vsx},
  2208. and @option{spe} add capabilities to a previous @emph{or later} CPU
  2209. selection. @option{any} will disassemble any opcode known to
  2210. binutils, but in cases where an opcode has two different meanings or
  2211. different arguments, you may not see the disassembly you expect.
  2212. If you disassemble without giving a CPU selection, a default will be
  2213. chosen from information gleaned by BFD from the object files headers,
  2214. but the result again may not be as you expect.
  2215. For MIPS, this option controls the printing of instruction mnemonic
  2216. names and register names in disassembled instructions. Multiple
  2217. selections from the following may be specified as a comma separated
  2218. string, and invalid options are ignored:
  2219. @table @code
  2220. @item no-aliases
  2221. Print the 'raw' instruction mnemonic instead of some pseudo
  2222. instruction mnemonic. I.e., print 'daddu' or 'or' instead of 'move',
  2223. 'sll' instead of 'nop', etc.
  2224. @item msa
  2225. Disassemble MSA instructions.
  2226. @item virt
  2227. Disassemble the virtualization ASE instructions.
  2228. @item xpa
  2229. Disassemble the eXtended Physical Address (XPA) ASE instructions.
  2230. @item gpr-names=@var{ABI}
  2231. Print GPR (general-purpose register) names as appropriate
  2232. for the specified ABI. By default, GPR names are selected according to
  2233. the ABI of the binary being disassembled.
  2234. @item fpr-names=@var{ABI}
  2235. Print FPR (floating-point register) names as
  2236. appropriate for the specified ABI. By default, FPR numbers are printed
  2237. rather than names.
  2238. @item cp0-names=@var{ARCH}
  2239. Print CP0 (system control coprocessor; coprocessor 0) register names
  2240. as appropriate for the CPU or architecture specified by
  2241. @var{ARCH}. By default, CP0 register names are selected according to
  2242. the architecture and CPU of the binary being disassembled.
  2243. @item hwr-names=@var{ARCH}
  2244. Print HWR (hardware register, used by the @code{rdhwr} instruction) names
  2245. as appropriate for the CPU or architecture specified by
  2246. @var{ARCH}. By default, HWR names are selected according to
  2247. the architecture and CPU of the binary being disassembled.
  2248. @item reg-names=@var{ABI}
  2249. Print GPR and FPR names as appropriate for the selected ABI.
  2250. @item reg-names=@var{ARCH}
  2251. Print CPU-specific register names (CP0 register and HWR names)
  2252. as appropriate for the selected CPU or architecture.
  2253. @end table
  2254. For any of the options listed above, @var{ABI} or
  2255. @var{ARCH} may be specified as @samp{numeric} to have numbers printed
  2256. rather than names, for the selected types of registers.
  2257. You can list the available values of @var{ABI} and @var{ARCH} using
  2258. the @option{--help} option.
  2259. For VAX, you can specify function entry addresses with @option{-M
  2260. entry:0xf00ba}. You can use this multiple times to properly
  2261. disassemble VAX binary files that don't contain symbol tables (like
  2262. ROM dumps). In these cases, the function entry mask would otherwise
  2263. be decoded as VAX instructions, which would probably lead the rest
  2264. of the function being wrongly disassembled.
  2265. @item -p
  2266. @itemx --private-headers
  2267. Print information that is specific to the object file format. The exact
  2268. information printed depends upon the object file format. For some
  2269. object file formats, no additional information is printed.
  2270. @item -P @var{options}
  2271. @itemx --private=@var{options}
  2272. Print information that is specific to the object file format. The
  2273. argument @var{options} is a comma separated list that depends on the
  2274. format (the lists of options is displayed with the help).
  2275. For XCOFF, the available options are:
  2276. @table @code
  2277. @item header
  2278. @item aout
  2279. @item sections
  2280. @item syms
  2281. @item relocs
  2282. @item lineno,
  2283. @item loader
  2284. @item except
  2285. @item typchk
  2286. @item traceback
  2287. @item toc
  2288. @item ldinfo
  2289. @end table
  2290. Not all object formats support this option. In particular the ELF
  2291. format does not use it.
  2292. @item -r
  2293. @itemx --reloc
  2294. @cindex relocation entries, in object file
  2295. Print the relocation entries of the file. If used with @option{-d} or
  2296. @option{-D}, the relocations are printed interspersed with the
  2297. disassembly.
  2298. @item -R
  2299. @itemx --dynamic-reloc
  2300. @cindex dynamic relocation entries, in object file
  2301. Print the dynamic relocation entries of the file. This is only
  2302. meaningful for dynamic objects, such as certain types of shared
  2303. libraries. As for @option{-r}, if used with @option{-d} or
  2304. @option{-D}, the relocations are printed interspersed with the
  2305. disassembly.
  2306. @item -s
  2307. @itemx --full-contents
  2308. @cindex sections, full contents
  2309. @cindex object file sections
  2310. Display the full contents of any sections requested. By default all
  2311. non-empty sections are displayed.
  2312. @item -S
  2313. @itemx --source
  2314. @cindex source disassembly
  2315. @cindex disassembly, with source
  2316. Display source code intermixed with disassembly, if possible. Implies
  2317. @option{-d}.
  2318. @item --source-comment[=@var{txt}]
  2319. @cindex source disassembly
  2320. @cindex disassembly, with source
  2321. Like the @option{-S} option, but all source code lines are displayed
  2322. with a prefix of @var{txt}. Typically @var{txt} will be a comment
  2323. string which can be used to distinguish the assembler code from the
  2324. source code. If @var{txt} is not provided then a default string of
  2325. @var{``# ``} (hash followed by a space), will be used.
  2326. @item --prefix=@var{prefix}
  2327. @cindex Add prefix to absolute paths
  2328. Specify @var{prefix} to add to the absolute paths when used with
  2329. @option{-S}.
  2330. @item --prefix-strip=@var{level}
  2331. @cindex Strip absolute paths
  2332. Indicate how many initial directory names to strip off the hardwired
  2333. absolute paths. It has no effect without @option{--prefix=}@var{prefix}.
  2334. @item --show-raw-insn
  2335. When disassembling instructions, print the instruction in hex as well as
  2336. in symbolic form. This is the default except when
  2337. @option{--prefix-addresses} is used.
  2338. @item --no-show-raw-insn
  2339. When disassembling instructions, do not print the instruction bytes.
  2340. This is the default when @option{--prefix-addresses} is used.
  2341. @item --insn-width=@var{width}
  2342. @cindex Instruction width
  2343. Display @var{width} bytes on a single line when disassembling
  2344. instructions.
  2345. @item --visualize-jumps[=color|=extended-color|=off]
  2346. Visualize jumps that stay inside a function by drawing ASCII art between
  2347. the start and target addresses. The optional @option{=color} argument
  2348. adds color to the output using simple terminal colors. Alternatively
  2349. the @option{=extended-color} argument will add color using 8bit
  2350. colors, but these might not work on all terminals.
  2351. If it is necessary to disable the @option{visualize-jumps} option
  2352. after it has previously been enabled then use
  2353. @option{visualize-jumps=off}.
  2354. @item --disassembler-color=[color|extended-color|off]
  2355. Apply syntax highlighting to the disassembler output. The
  2356. @option{color} argument adds color using simple terminal colors.
  2357. Alternatively the @option{extended-color} argument will use 8bit
  2358. colors, but these might not work on all terminals.
  2359. If it is necessary to disable the @option{--disassembler-color} option
  2360. after it has previously been enabled then use
  2361. @option{--disassembler-color=off}.
  2362. @item -W[lLiaprmfFsoORtUuTgAckK]
  2363. @itemx --dwarf[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]
  2364. @include debug.options.texi
  2365. @item --dwarf-check
  2366. Enable additional checks for consistency of Dwarf information.
  2367. @include ctf.options.texi
  2368. @item -G
  2369. @itemx --stabs
  2370. @cindex stab
  2371. @cindex .stab
  2372. @cindex debug symbols
  2373. @cindex ELF object file format
  2374. Display the full contents of any sections requested. Display the
  2375. contents of the .stab and .stab.index and .stab.excl sections from an
  2376. ELF file. This is only useful on systems (such as Solaris 2.0) in which
  2377. @code{.stab} debugging symbol-table entries are carried in an ELF
  2378. section. In most other file formats, debugging symbol-table entries are
  2379. interleaved with linkage symbols, and are visible in the @option{--syms}
  2380. output.
  2381. @item --start-address=@var{address}
  2382. @cindex start-address
  2383. Start displaying data at the specified address. This affects the output
  2384. of the @option{-d}, @option{-r} and @option{-s} options.
  2385. @item --stop-address=@var{address}
  2386. @cindex stop-address
  2387. Stop displaying data at the specified address. This affects the output
  2388. of the @option{-d}, @option{-r} and @option{-s} options.
  2389. @item -t
  2390. @itemx --syms
  2391. @cindex symbol table entries, printing
  2392. Print the symbol table entries of the file.
  2393. This is similar to the information provided by the @samp{nm} program,
  2394. although the display format is different. The format of the output
  2395. depends upon the format of the file being dumped, but there are two main
  2396. types. One looks like this:
  2397. @smallexample
  2398. [ 4](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
  2399. [ 6](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 fred
  2400. @end smallexample
  2401. where the number inside the square brackets is the number of the entry
  2402. in the symbol table, the @var{sec} number is the section number, the
  2403. @var{fl} value are the symbol's flag bits, the @var{ty} number is the
  2404. symbol's type, the @var{scl} number is the symbol's storage class and
  2405. the @var{nx} value is the number of auxiliary entries associated with
  2406. the symbol. The last two fields are the symbol's value and its name.
  2407. The other common output format, usually seen with ELF based files,
  2408. looks like this:
  2409. @smallexample
  2410. 00000000 l d .bss 00000000 .bss
  2411. 00000000 g .text 00000000 fred
  2412. @end smallexample
  2413. Here the first number is the symbol's value (sometimes referred to as
  2414. its address). The next field is actually a set of characters and
  2415. spaces indicating the flag bits that are set on the symbol. These
  2416. characters are described below. Next is the section with which the
  2417. symbol is associated or @emph{*ABS*} if the section is absolute (ie
  2418. not connected with any section), or @emph{*UND*} if the section is
  2419. referenced in the file being dumped, but not defined there.
  2420. After the section name comes another field, a number, which for common
  2421. symbols is the alignment and for other symbol is the size. Finally
  2422. the symbol's name is displayed.
  2423. The flag characters are divided into 7 groups as follows:
  2424. @table @code
  2425. @item l
  2426. @itemx g
  2427. @itemx u
  2428. @itemx !
  2429. The symbol is a local (l), global (g), unique global (u), neither
  2430. global nor local (a space) or both global and local (!). A
  2431. symbol can be neither local or global for a variety of reasons, e.g.,
  2432. because it is used for debugging, but it is probably an indication of
  2433. a bug if it is ever both local and global. Unique global symbols are
  2434. a GNU extension to the standard set of ELF symbol bindings. For such
  2435. a symbol the dynamic linker will make sure that in the entire process
  2436. there is just one symbol with this name and type in use.
  2437. @item w
  2438. The symbol is weak (w) or strong (a space).
  2439. @item C
  2440. The symbol denotes a constructor (C) or an ordinary symbol (a space).
  2441. @item W
  2442. The symbol is a warning (W) or a normal symbol (a space). A warning
  2443. symbol's name is a message to be displayed if the symbol following the
  2444. warning symbol is ever referenced.
  2445. @item I
  2446. @item i
  2447. The symbol is an indirect reference to another symbol (I), a function
  2448. to be evaluated during reloc processing (i) or a normal symbol (a
  2449. space).
  2450. @item d
  2451. @itemx D
  2452. The symbol is a debugging symbol (d) or a dynamic symbol (D) or a
  2453. normal symbol (a space).
  2454. @item F
  2455. @item f
  2456. @item O
  2457. The symbol is the name of a function (F) or a file (f) or an object
  2458. (O) or just a normal symbol (a space).
  2459. @end table
  2460. @item -T
  2461. @itemx --dynamic-syms
  2462. @cindex dynamic symbol table entries, printing
  2463. Print the dynamic symbol table entries of the file. This is only
  2464. meaningful for dynamic objects, such as certain types of shared
  2465. libraries. This is similar to the information provided by the @samp{nm}
  2466. program when given the @option{-D} (@option{--dynamic}) option.
  2467. The output format is similar to that produced by the @option{--syms}
  2468. option, except that an extra field is inserted before the symbol's
  2469. name, giving the version information associated with the symbol.
  2470. If the version is the default version to be used when resolving
  2471. unversioned references to the symbol then it's displayed as is,
  2472. otherwise it's put into parentheses.
  2473. @item --special-syms
  2474. When displaying symbols include those which the target considers to be
  2475. special in some way and which would not normally be of interest to the
  2476. user.
  2477. @item -U @var{[d|i|l|e|x|h]}
  2478. @itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]}
  2479. Controls the display of UTF-8 encoded multibyte characters in strings.
  2480. The default (@option{--unicode=default}) is to give them no special
  2481. treatment. The @option{--unicode=locale} option displays the sequence
  2482. in the current locale, which may or may not support them. The options
  2483. @option{--unicode=hex} and @option{--unicode=invalid} display them as
  2484. hex byte sequences enclosed by either angle brackets or curly braces.
  2485. The @option{--unicode=escape} option displays them as escape sequences
  2486. (@var{\uxxxx}) and the @option{--unicode=highlight} option displays
  2487. them as escape sequences highlighted in red (if supported by the
  2488. output device). The colouring is intended to draw attention to the
  2489. presence of unicode sequences where they might not be expected.
  2490. @item -V
  2491. @itemx --version
  2492. Print the version number of @command{objdump} and exit.
  2493. @item -x
  2494. @itemx --all-headers
  2495. @cindex all header information, object file
  2496. @cindex header information, all
  2497. Display all available header information, including the symbol table and
  2498. relocation entries. Using @option{-x} is equivalent to specifying all of
  2499. @option{-a -f -h -p -r -t}.
  2500. @item -w
  2501. @itemx --wide
  2502. @cindex wide output, printing
  2503. Format some lines for output devices that have more than 80 columns.
  2504. Also do not truncate symbol names when they are displayed.
  2505. @item -z
  2506. @itemx --disassemble-zeroes
  2507. Normally the disassembly output will skip blocks of zeroes. This
  2508. option directs the disassembler to disassemble those blocks, just like
  2509. any other data.
  2510. @end table
  2511. @c man end
  2512. @ignore
  2513. @c man begin SEEALSO objdump
  2514. nm(1), readelf(1), and the Info entries for @file{binutils}.
  2515. @c man end
  2516. @end ignore
  2517. @node ranlib
  2518. @chapter ranlib
  2519. @kindex ranlib
  2520. @cindex archive contents
  2521. @cindex symbol index
  2522. @c man title ranlib generate an index to an archive
  2523. @smallexample
  2524. @c man begin SYNOPSIS ranlib
  2525. ranlib [@option{--plugin} @var{name}] [@option{-DhHvVt}] @var{archive}
  2526. @c man end
  2527. @end smallexample
  2528. @c man begin DESCRIPTION ranlib
  2529. @command{ranlib} generates an index to the contents of an archive and
  2530. stores it in the archive. The index lists each symbol defined by a
  2531. member of an archive that is a relocatable object file.
  2532. You may use @samp{nm -s} or @samp{nm --print-armap} to list this index.
  2533. An archive with such an index speeds up linking to the library and
  2534. allows routines in the library to call each other without regard to
  2535. their placement in the archive.
  2536. The @sc{gnu} @command{ranlib} program is another form of @sc{gnu} @command{ar}; running
  2537. @command{ranlib} is completely equivalent to executing @samp{ar -s}.
  2538. @xref{ar}.
  2539. @c man end
  2540. @c man begin OPTIONS ranlib
  2541. @table @env
  2542. @item -h
  2543. @itemx -H
  2544. @itemx --help
  2545. Show usage information for @command{ranlib}.
  2546. @item -v
  2547. @itemx -V
  2548. @itemx --version
  2549. Show the version number of @command{ranlib}.
  2550. @item -D
  2551. @cindex deterministic archives
  2552. @kindex --enable-deterministic-archives
  2553. Operate in @emph{deterministic} mode. The symbol map archive member's
  2554. header will show zero for the UID, GID, and timestamp. When this
  2555. option is used, multiple runs will produce identical output files.
  2556. If @file{binutils} was configured with
  2557. @option{--enable-deterministic-archives}, then this mode is on by
  2558. default. It can be disabled with the @samp{-U} option, described
  2559. below.
  2560. @item -t
  2561. Update the timestamp of the symbol map of an archive.
  2562. @item -U
  2563. @cindex deterministic archives
  2564. @kindex --enable-deterministic-archives
  2565. Do @emph{not} operate in @emph{deterministic} mode. This is the
  2566. inverse of the @samp{-D} option, above: the archive index will get
  2567. actual UID, GID, timestamp, and file mode values.
  2568. If @file{binutils} was configured @emph{without}
  2569. @option{--enable-deterministic-archives}, then this mode is on by
  2570. default.
  2571. @end table
  2572. @c man end
  2573. @ignore
  2574. @c man begin SEEALSO ranlib
  2575. ar(1), nm(1), and the Info entries for @file{binutils}.
  2576. @c man end
  2577. @end ignore
  2578. @node size
  2579. @chapter size
  2580. @kindex size
  2581. @cindex section sizes
  2582. @c man title size list section sizes and total size of binary files
  2583. @smallexample
  2584. @c man begin SYNOPSIS size
  2585. size [@option{-A}|@option{-B}|@option{-G}|@option{--format=}@var{compatibility}]
  2586. [@option{--help}]
  2587. [@option{-d}|@option{-o}|@option{-x}|@option{--radix=}@var{number}]
  2588. [@option{--common}]
  2589. [@option{-t}|@option{--totals}]
  2590. [@option{--target=}@var{bfdname}] [@option{-V}|@option{--version}]
  2591. [@var{objfile}@dots{}]
  2592. @c man end
  2593. @end smallexample
  2594. @c man begin DESCRIPTION size
  2595. The @sc{gnu} @command{size} utility lists the section sizes and the total
  2596. size for each of the binary files @var{objfile} on its argument list.
  2597. By default, one line of output is generated for each file or each
  2598. module if the file is an archive.
  2599. @var{objfile}@dots{} are the files to be examined. If none are
  2600. specified, the file @code{a.out} will be used instead.
  2601. @c man end
  2602. @c man begin OPTIONS size
  2603. The command-line options have the following meanings:
  2604. @table @env
  2605. @item -A
  2606. @itemx -B
  2607. @itemx -G
  2608. @itemx --format=@var{compatibility}
  2609. @cindex @command{size} display format
  2610. Using one of these options, you can choose whether the output from @sc{gnu}
  2611. @command{size} resembles output from System V @command{size} (using @option{-A},
  2612. or @option{--format=sysv}), or Berkeley @command{size} (using @option{-B}, or
  2613. @option{--format=berkeley}). The default is the one-line format similar to
  2614. Berkeley's. Alternatively, you can choose the GNU format output
  2615. (using @option{-G}, or @option{--format=gnu}), this is similar to
  2616. Berkeley's output format, but sizes are counted differently.
  2617. @c Bonus for doc-source readers: you can also say --format=strange (or
  2618. @c anything else that starts with 's') for sysv, and --format=boring (or
  2619. @c anything else that starts with 'b') for Berkeley.
  2620. Here is an example of the Berkeley (default) format of output from
  2621. @command{size}:
  2622. @smallexample
  2623. $ size --format=Berkeley ranlib size
  2624. text data bss dec hex filename
  2625. 294880 81920 11592 388392 5ed28 ranlib
  2626. 294880 81920 11888 388688 5ee50 size
  2627. @end smallexample
  2628. The Berkeley style output counts read only data in the @code{text}
  2629. column, not in the @code{data} column, the @code{dec} and @code{hex}
  2630. columns both display the sum of the @code{text}, @code{data}, and
  2631. @code{bss} columns in decimal and hexadecimal respectively.
  2632. The GNU format counts read only data in the @code{data} column, not
  2633. the @code{text} column, and only displays the sum of the @code{text},
  2634. @code{data}, and @code{bss} columns once, in the @code{total} column.
  2635. The @option{--radix} option can be used to change the number base for
  2636. all columns. Here is the same data displayed with GNU conventions:
  2637. @smallexample
  2638. $ size --format=GNU ranlib size
  2639. text data bss total filename
  2640. 279880 96920 11592 388392 ranlib
  2641. 279880 96920 11888 388688 size
  2642. @end smallexample
  2643. @noindent
  2644. This is the same data, but displayed closer to System V conventions:
  2645. @smallexample
  2646. $ size --format=SysV ranlib size
  2647. ranlib :
  2648. section size addr
  2649. .text 294880 8192
  2650. .data 81920 303104
  2651. .bss 11592 385024
  2652. Total 388392
  2653. size :
  2654. section size addr
  2655. .text 294880 8192
  2656. .data 81920 303104
  2657. .bss 11888 385024
  2658. Total 388688
  2659. @end smallexample
  2660. @item --help
  2661. Show a summary of acceptable arguments and options.
  2662. @item -d
  2663. @itemx -o
  2664. @itemx -x
  2665. @itemx --radix=@var{number}
  2666. @cindex @command{size} number format
  2667. @cindex radix for section sizes
  2668. Using one of these options, you can control whether the size of each
  2669. section is given in decimal (@option{-d}, or @option{--radix=10}); octal
  2670. (@option{-o}, or @option{--radix=8}); or hexadecimal (@option{-x}, or
  2671. @option{--radix=16}). In @option{--radix=@var{number}}, only the three
  2672. values (8, 10, 16) are supported. The total size is always given in two
  2673. radices; decimal and hexadecimal for @option{-d} or @option{-x} output, or
  2674. octal and hexadecimal if you're using @option{-o}.
  2675. @item --common
  2676. Print total size of common symbols in each file. When using Berkeley
  2677. or GNU format these are included in the bss size.
  2678. @item -t
  2679. @itemx --totals
  2680. Show totals of all objects listed (Berkeley or GNU format mode only).
  2681. @item --target=@var{bfdname}
  2682. @cindex object code format
  2683. Specify that the object-code format for @var{objfile} is
  2684. @var{bfdname}. This option may not be necessary; @command{size} can
  2685. automatically recognize many formats.
  2686. @xref{Target Selection}, for more information.
  2687. @item -V
  2688. @itemx --version
  2689. Display the version number of @command{size}.
  2690. @end table
  2691. @c man end
  2692. @ignore
  2693. @c man begin SEEALSO size
  2694. ar(1), objdump(1), readelf(1), and the Info entries for @file{binutils}.
  2695. @c man end
  2696. @end ignore
  2697. @node strings
  2698. @chapter strings
  2699. @kindex strings
  2700. @cindex listings strings
  2701. @cindex printing strings
  2702. @cindex strings, printing
  2703. @c man title strings print the sequences of printable characters in files
  2704. @smallexample
  2705. @c man begin SYNOPSIS strings
  2706. strings [@option{-afovV}] [@option{-}@var{min-len}]
  2707. [@option{-n} @var{min-len}] [@option{--bytes=}@var{min-len}]
  2708. [@option{-t} @var{radix}] [@option{--radix=}@var{radix}]
  2709. [@option{-e} @var{encoding}] [@option{--encoding=}@var{encoding}]
  2710. [@option{-U} @var{method}] [@option{--unicode=}@var{method}]
  2711. [@option{-}] [@option{--all}] [@option{--print-file-name}]
  2712. [@option{-T} @var{bfdname}] [@option{--target=}@var{bfdname}]
  2713. [@option{-w}] [@option{--include-all-whitespace}]
  2714. [@option{-s}] [@option{--output-separator} @var{sep_string}]
  2715. [@option{--help}] [@option{--version}] @var{file}@dots{}
  2716. @c man end
  2717. @end smallexample
  2718. @c man begin DESCRIPTION strings
  2719. For each @var{file} given, @sc{gnu} @command{strings} prints the
  2720. printable character sequences that are at least 4 characters long (or
  2721. the number given with the options below) and are followed by an
  2722. unprintable character.
  2723. Depending upon how the strings program was configured it will default
  2724. to either displaying all the printable sequences that it can find in
  2725. each file, or only those sequences that are in loadable, initialized
  2726. data sections. If the file type is unrecognizable, or if strings is
  2727. reading from stdin then it will always display all of the printable
  2728. sequences that it can find.
  2729. For backwards compatibility any file that occurs after a command-line
  2730. option of just @option{-} will also be scanned in full, regardless of
  2731. the presence of any @option{-d} option.
  2732. @command{strings} is mainly useful for determining the contents of
  2733. non-text files.
  2734. @c man end
  2735. @c man begin OPTIONS strings
  2736. @table @env
  2737. @item -a
  2738. @itemx --all
  2739. @itemx -
  2740. Scan the whole file, regardless of what sections it contains or
  2741. whether those sections are loaded or initialized. Normally this is
  2742. the default behaviour, but strings can be configured so that the
  2743. @option{-d} is the default instead.
  2744. The @option{-} option is position dependent and forces strings to
  2745. perform full scans of any file that is mentioned after the @option{-}
  2746. on the command line, even if the @option{-d} option has been
  2747. specified.
  2748. @item -d
  2749. @itemx --data
  2750. Only print strings from initialized, loaded data sections in the
  2751. file. This may reduce the amount of garbage in the output, but it
  2752. also exposes the strings program to any security flaws that may be
  2753. present in the BFD library used to scan and load sections. Strings
  2754. can be configured so that this option is the default behaviour. In
  2755. such cases the @option{-a} option can be used to avoid using the BFD
  2756. library and instead just print all of the strings found in the file.
  2757. @item -f
  2758. @itemx --print-file-name
  2759. Print the name of the file before each string.
  2760. @item --help
  2761. Print a summary of the program usage on the standard output and exit.
  2762. @item -@var{min-len}
  2763. @itemx -n @var{min-len}
  2764. @itemx --bytes=@var{min-len}
  2765. Print sequences of displayable characters that are at least
  2766. @var{min-len} characters long. If not specified a default minimum
  2767. length of 4 is used. The distinction between displayable and
  2768. non-displayable characters depends upon the setting of the
  2769. @option{-e} and @option{-U} options. Sequences are always terminated
  2770. at control characters such as new-line and carriage-return, but not
  2771. the tab character.
  2772. @item -o
  2773. Like @samp{-t o}. Some other versions of @command{strings} have @option{-o}
  2774. act like @samp{-t d} instead. Since we can not be compatible with both
  2775. ways, we simply chose one.
  2776. @item -t @var{radix}
  2777. @itemx --radix=@var{radix}
  2778. Print the offset within the file before each string. The single
  2779. character argument specifies the radix of the offset---@samp{o} for
  2780. octal, @samp{x} for hexadecimal, or @samp{d} for decimal.
  2781. @item -e @var{encoding}
  2782. @itemx --encoding=@var{encoding}
  2783. Select the character encoding of the strings that are to be found.
  2784. Possible values for @var{encoding} are: @samp{s} = single-7-bit-byte
  2785. characters (ASCII, ISO 8859, etc., default), @samp{S} =
  2786. single-8-bit-byte characters, @samp{b} = 16-bit bigendian, @samp{l} =
  2787. 16-bit littleendian, @samp{B} = 32-bit bigendian, @samp{L} = 32-bit
  2788. littleendian. Useful for finding wide character strings. (@samp{l}
  2789. and @samp{b} apply to, for example, Unicode UTF-16/UCS-2 encodings).
  2790. @item -U @var{[d|i|l|e|x|h]}
  2791. @itemx --unicode=@var{[default|invalid|locale|escape|hex|highlight]}
  2792. Controls the display of UTF-8 encoded multibyte characters in strings.
  2793. The default (@option{--unicode=default}) is to give them no special
  2794. treatment, and instead rely upon the setting of the
  2795. @option{--encoding} option. The other values for this option
  2796. automatically enable @option{--encoding=S}.
  2797. The @option{--unicode=invalid} option treats them as non-graphic
  2798. characters and hence not part of a valid string. All the remaining
  2799. options treat them as valid string characters.
  2800. The @option{--unicode=locale} option displays them in the current
  2801. locale, which may or may not support UTF-8 encoding. The
  2802. @option{--unicode=hex} option displays them as hex byte sequences
  2803. enclosed between @var{<>} characters. The @option{--unicode=escape}
  2804. option displays them as escape sequences (@var{\uxxxx}) and the
  2805. @option{--unicode=highlight} option displays them as escape sequences
  2806. highlighted in red (if supported by the output device). The colouring
  2807. is intended to draw attention to the presence of unicode sequences
  2808. where they might not be expected.
  2809. @item -T @var{bfdname}
  2810. @itemx --target=@var{bfdname}
  2811. @cindex object code format
  2812. Specify an object code format other than your system's default format.
  2813. @xref{Target Selection}, for more information.
  2814. @item -v
  2815. @itemx -V
  2816. @itemx --version
  2817. Print the program version number on the standard output and exit.
  2818. @item -w
  2819. @itemx --include-all-whitespace
  2820. By default tab and space characters are included in the strings that
  2821. are displayed, but other whitespace characters, such a newlines and
  2822. carriage returns, are not. The @option{-w} option changes this so
  2823. that all whitespace characters are considered to be part of a string.
  2824. @item -s
  2825. @itemx --output-separator
  2826. By default, output strings are delimited by a new-line. This option
  2827. allows you to supply any string to be used as the output record
  2828. separator. Useful with --include-all-whitespace where strings
  2829. may contain new-lines internally.
  2830. @end table
  2831. @c man end
  2832. @ignore
  2833. @c man begin SEEALSO strings
  2834. ar(1), nm(1), objdump(1), ranlib(1), readelf(1)
  2835. and the Info entries for @file{binutils}.
  2836. @c man end
  2837. @end ignore
  2838. @node strip
  2839. @chapter strip
  2840. @kindex strip
  2841. @cindex removing symbols
  2842. @cindex discarding symbols
  2843. @cindex symbols, discarding
  2844. @c man title strip discard symbols and other data from object files
  2845. @smallexample
  2846. @c man begin SYNOPSIS strip
  2847. strip [@option{-F} @var{bfdname} |@option{--target=}@var{bfdname}]
  2848. [@option{-I} @var{bfdname} |@option{--input-target=}@var{bfdname}]
  2849. [@option{-O} @var{bfdname} |@option{--output-target=}@var{bfdname}]
  2850. [@option{-s}|@option{--strip-all}]
  2851. [@option{-S}|@option{-g}|@option{-d}|@option{--strip-debug}]
  2852. [@option{--strip-dwo}]
  2853. [@option{-K} @var{symbolname}|@option{--keep-symbol=}@var{symbolname}]
  2854. [@option{-M}|@option{--merge-notes}][@option{--no-merge-notes}]
  2855. [@option{-N} @var{symbolname} |@option{--strip-symbol=}@var{symbolname}]
  2856. [@option{-w}|@option{--wildcard}]
  2857. [@option{-x}|@option{--discard-all}] [@option{-X} |@option{--discard-locals}]
  2858. [@option{-R} @var{sectionname} |@option{--remove-section=}@var{sectionname}]
  2859. [@option{--keep-section=}@var{sectionpattern}]
  2860. [@option{--remove-relocations=}@var{sectionpattern}]
  2861. [@option{-o} @var{file}] [@option{-p}|@option{--preserve-dates}]
  2862. [@option{-D}|@option{--enable-deterministic-archives}]
  2863. [@option{-U}|@option{--disable-deterministic-archives}]
  2864. [@option{--keep-section-symbols}]
  2865. [@option{--keep-file-symbols}]
  2866. [@option{--only-keep-debug}]
  2867. [@option{-v} |@option{--verbose}] [@option{-V}|@option{--version}]
  2868. [@option{--help}] [@option{--info}]
  2869. @var{objfile}@dots{}
  2870. @c man end
  2871. @end smallexample
  2872. @c man begin DESCRIPTION strip
  2873. @sc{gnu} @command{strip} discards all symbols from object files
  2874. @var{objfile}. The list of object files may include archives.
  2875. At least one object file must be given.
  2876. @command{strip} modifies the files named in its argument,
  2877. rather than writing modified copies under different names.
  2878. @c man end
  2879. @c man begin OPTIONS strip
  2880. @table @env
  2881. @item -F @var{bfdname}
  2882. @itemx --target=@var{bfdname}
  2883. Treat the original @var{objfile} as a file with the object
  2884. code format @var{bfdname}, and rewrite it in the same format.
  2885. @xref{Target Selection}, for more information.
  2886. @item --help
  2887. Show a summary of the options to @command{strip} and exit.
  2888. @item --info
  2889. Display a list showing all architectures and object formats available.
  2890. @item -I @var{bfdname}
  2891. @itemx --input-target=@var{bfdname}
  2892. Treat the original @var{objfile} as a file with the object
  2893. code format @var{bfdname}.
  2894. @xref{Target Selection}, for more information.
  2895. @item -O @var{bfdname}
  2896. @itemx --output-target=@var{bfdname}
  2897. Replace @var{objfile} with a file in the output format @var{bfdname}.
  2898. @xref{Target Selection}, for more information.
  2899. @item -R @var{sectionname}
  2900. @itemx --remove-section=@var{sectionname}
  2901. Remove any section named @var{sectionname} from the output file, in
  2902. addition to whatever sections would otherwise be removed. This
  2903. option may be given more than once. Note that using this option
  2904. inappropriately may make the output file unusable. The wildcard
  2905. character @samp{*} may be given at the end of @var{sectionname}. If
  2906. so, then any section starting with @var{sectionname} will be removed.
  2907. If the first character of @var{sectionpattern} is the exclamation
  2908. point (!) then matching sections will not be removed even if an
  2909. earlier use of @option{--remove-section} on the same command line
  2910. would otherwise remove it. For example:
  2911. @smallexample
  2912. --remove-section=.text.* --remove-section=!.text.foo
  2913. @end smallexample
  2914. will remove all sections matching the pattern '.text.*', but will not
  2915. remove the section '.text.foo'.
  2916. @item --keep-section=@var{sectionpattern}
  2917. When removing sections from the output file, keep sections that match
  2918. @var{sectionpattern}.
  2919. @item --remove-relocations=@var{sectionpattern}
  2920. Remove relocations from the output file for any section matching
  2921. @var{sectionpattern}. This option may be given more than once. Note
  2922. that using this option inappropriately may make the output file
  2923. unusable. Wildcard characters are accepted in @var{sectionpattern}.
  2924. For example:
  2925. @smallexample
  2926. --remove-relocations=.text.*
  2927. @end smallexample
  2928. will remove the relocations for all sections matching the patter
  2929. '.text.*'.
  2930. If the first character of @var{sectionpattern} is the exclamation
  2931. point (!) then matching sections will not have their relocation
  2932. removed even if an earlier use of @option{--remove-relocations} on the
  2933. same command line would otherwise cause the relocations to be removed.
  2934. For example:
  2935. @smallexample
  2936. --remove-relocations=.text.* --remove-relocations=!.text.foo
  2937. @end smallexample
  2938. will remove all relocations for sections matching the pattern
  2939. '.text.*', but will not remove relocations for the section
  2940. '.text.foo'.
  2941. @item -s
  2942. @itemx --strip-all
  2943. Remove all symbols.
  2944. @item -g
  2945. @itemx -S
  2946. @itemx -d
  2947. @itemx --strip-debug
  2948. Remove debugging symbols only.
  2949. @item --strip-dwo
  2950. Remove the contents of all DWARF .dwo sections, leaving the
  2951. remaining debugging sections and all symbols intact.
  2952. See the description of this option in the @command{objcopy} section
  2953. for more information.
  2954. @item --strip-unneeded
  2955. Remove all symbols that are not needed for relocation processing in
  2956. addition to debugging symbols and sections stripped by
  2957. @option{--strip-debug}.
  2958. @item -K @var{symbolname}
  2959. @itemx --keep-symbol=@var{symbolname}
  2960. When stripping symbols, keep symbol @var{symbolname} even if it would
  2961. normally be stripped. This option may be given more than once.
  2962. @item -M
  2963. @itemx --merge-notes
  2964. @itemx --no-merge-notes
  2965. For ELF files, attempt (or do not attempt) to reduce the size of any
  2966. SHT_NOTE type sections by removing duplicate notes. The default is to
  2967. attempt this reduction unless stripping debug or DWO information.
  2968. @item -N @var{symbolname}
  2969. @itemx --strip-symbol=@var{symbolname}
  2970. Remove symbol @var{symbolname} from the source file. This option may be
  2971. given more than once, and may be combined with strip options other than
  2972. @option{-K}.
  2973. @item -o @var{file}
  2974. Put the stripped output in @var{file}, rather than replacing the
  2975. existing file. When this argument is used, only one @var{objfile}
  2976. argument may be specified.
  2977. @item -p
  2978. @itemx --preserve-dates
  2979. Preserve the access and modification dates of the file.
  2980. @item -D
  2981. @itemx --enable-deterministic-archives
  2982. @cindex deterministic archives
  2983. @kindex --enable-deterministic-archives
  2984. Operate in @emph{deterministic} mode. When copying archive members
  2985. and writing the archive index, use zero for UIDs, GIDs, timestamps,
  2986. and use consistent file modes for all files.
  2987. If @file{binutils} was configured with
  2988. @option{--enable-deterministic-archives}, then this mode is on by default.
  2989. It can be disabled with the @samp{-U} option, below.
  2990. @item -U
  2991. @itemx --disable-deterministic-archives
  2992. @cindex deterministic archives
  2993. @kindex --enable-deterministic-archives
  2994. Do @emph{not} operate in @emph{deterministic} mode. This is the
  2995. inverse of the @option{-D} option, above: when copying archive members
  2996. and writing the archive index, use their actual UID, GID, timestamp,
  2997. and file mode values.
  2998. This is the default unless @file{binutils} was configured with
  2999. @option{--enable-deterministic-archives}.
  3000. @item -w
  3001. @itemx --wildcard
  3002. Permit regular expressions in @var{symbolname}s used in other command
  3003. line options. The question mark (?), asterisk (*), backslash (\) and
  3004. square brackets ([]) operators can be used anywhere in the symbol
  3005. name. If the first character of the symbol name is the exclamation
  3006. point (!) then the sense of the switch is reversed for that symbol.
  3007. For example:
  3008. @smallexample
  3009. -w -K !foo -K fo*
  3010. @end smallexample
  3011. would cause strip to only keep symbols that start with the letters
  3012. ``fo'', but to discard the symbol ``foo''.
  3013. @item -x
  3014. @itemx --discard-all
  3015. Remove non-global symbols.
  3016. @item -X
  3017. @itemx --discard-locals
  3018. Remove compiler-generated local symbols.
  3019. (These usually start with @samp{L} or @samp{.}.)
  3020. @item --keep-section-symbols
  3021. When stripping a file, perhaps with @option{--strip-debug} or
  3022. @option{--strip-unneeded}, retain any symbols specifying section names,
  3023. which would otherwise get stripped.
  3024. @item --keep-file-symbols
  3025. When stripping a file, perhaps with @option{--strip-debug} or
  3026. @option{--strip-unneeded}, retain any symbols specifying source file names,
  3027. which would otherwise get stripped.
  3028. @item --only-keep-debug
  3029. Strip a file, emptying the contents of any sections that would not be
  3030. stripped by @option{--strip-debug} and leaving the debugging sections
  3031. intact. In ELF files, this preserves all the note sections in the
  3032. output as well.
  3033. Note - the section headers of the stripped sections are preserved,
  3034. including their sizes, but the contents of the section are discarded.
  3035. The section headers are preserved so that other tools can match up the
  3036. debuginfo file with the real executable, even if that executable has
  3037. been relocated to a different address space.
  3038. The intention is that this option will be used in conjunction with
  3039. @option{--add-gnu-debuglink} to create a two part executable. One a
  3040. stripped binary which will occupy less space in RAM and in a
  3041. distribution and the second a debugging information file which is only
  3042. needed if debugging abilities are required. The suggested procedure
  3043. to create these files is as follows:
  3044. @enumerate
  3045. @item Link the executable as normal. Assuming that it is called
  3046. @code{foo} then...
  3047. @item Run @code{objcopy --only-keep-debug foo foo.dbg} to
  3048. create a file containing the debugging info.
  3049. @item Run @code{objcopy --strip-debug foo} to create a
  3050. stripped executable.
  3051. @item Run @code{objcopy --add-gnu-debuglink=foo.dbg foo}
  3052. to add a link to the debugging info into the stripped executable.
  3053. @end enumerate
  3054. Note---the choice of @code{.dbg} as an extension for the debug info
  3055. file is arbitrary. Also the @code{--only-keep-debug} step is
  3056. optional. You could instead do this:
  3057. @enumerate
  3058. @item Link the executable as normal.
  3059. @item Copy @code{foo} to @code{foo.full}
  3060. @item Run @code{strip --strip-debug foo}
  3061. @item Run @code{objcopy --add-gnu-debuglink=foo.full foo}
  3062. @end enumerate
  3063. i.e., the file pointed to by the @option{--add-gnu-debuglink} can be the
  3064. full executable. It does not have to be a file created by the
  3065. @option{--only-keep-debug} switch.
  3066. Note---this switch is only intended for use on fully linked files. It
  3067. does not make sense to use it on object files where the debugging
  3068. information may be incomplete. Besides the gnu_debuglink feature
  3069. currently only supports the presence of one filename containing
  3070. debugging information, not multiple filenames on a one-per-object-file
  3071. basis.
  3072. @item -V
  3073. @itemx --version
  3074. Show the version number for @command{strip}.
  3075. @item -v
  3076. @itemx --verbose
  3077. Verbose output: list all object files modified. In the case of
  3078. archives, @samp{strip -v} lists all members of the archive.
  3079. @end table
  3080. @c man end
  3081. @ignore
  3082. @c man begin SEEALSO strip
  3083. the Info entries for @file{binutils}.
  3084. @c man end
  3085. @end ignore
  3086. @node c++filt, addr2line, strip, Top
  3087. @chapter c++filt
  3088. @kindex c++filt
  3089. @cindex demangling C++ symbols
  3090. @c man title cxxfilt demangle C++ and Java symbols
  3091. @smallexample
  3092. @c man begin SYNOPSIS cxxfilt
  3093. c++filt [@option{-_}|@option{--strip-underscore}]
  3094. [@option{-n}|@option{--no-strip-underscore}]
  3095. [@option{-p}|@option{--no-params}]
  3096. [@option{-t}|@option{--types}]
  3097. [@option{-i}|@option{--no-verbose}]
  3098. [@option{-r}|@option{--no-recurse-limit}]
  3099. [@option{-R}|@option{--recurse-limit}]
  3100. [@option{-s} @var{format}|@option{--format=}@var{format}]
  3101. [@option{--help}] [@option{--version}] [@var{symbol}@dots{}]
  3102. @c man end
  3103. @end smallexample
  3104. @c man begin DESCRIPTION cxxfilt
  3105. @kindex cxxfilt
  3106. The C++ and Java languages provide function overloading, which means
  3107. that you can write many functions with the same name, providing that
  3108. each function takes parameters of different types. In order to be
  3109. able to distinguish these similarly named functions C++ and Java
  3110. encode them into a low-level assembler name which uniquely identifies
  3111. each different version. This process is known as @dfn{mangling}. The
  3112. @command{c++filt}
  3113. @footnote{MS-DOS does not allow @kbd{+} characters in file names, so on
  3114. MS-DOS this program is named @command{CXXFILT}.}
  3115. program does the inverse mapping: it decodes (@dfn{demangles}) low-level
  3116. names into user-level names so that they can be read.
  3117. Every alphanumeric word (consisting of letters, digits, underscores,
  3118. dollars, or periods) seen in the input is a potential mangled name.
  3119. If the name decodes into a C++ name, the C++ name replaces the
  3120. low-level name in the output, otherwise the original word is output.
  3121. In this way you can pass an entire assembler source file, containing
  3122. mangled names, through @command{c++filt} and see the same source file
  3123. containing demangled names.
  3124. You can also use @command{c++filt} to decipher individual symbols by
  3125. passing them on the command line:
  3126. @example
  3127. c++filt @var{symbol}
  3128. @end example
  3129. If no @var{symbol} arguments are given, @command{c++filt} reads symbol
  3130. names from the standard input instead. All the results are printed on
  3131. the standard output. The difference between reading names from the
  3132. command line versus reading names from the standard input is that
  3133. command-line arguments are expected to be just mangled names and no
  3134. checking is performed to separate them from surrounding text. Thus
  3135. for example:
  3136. @smallexample
  3137. c++filt -n _Z1fv
  3138. @end smallexample
  3139. will work and demangle the name to ``f()'' whereas:
  3140. @smallexample
  3141. c++filt -n _Z1fv,
  3142. @end smallexample
  3143. will not work. (Note the extra comma at the end of the mangled
  3144. name which makes it invalid). This command however will work:
  3145. @smallexample
  3146. echo _Z1fv, | c++filt -n
  3147. @end smallexample
  3148. and will display ``f(),'', i.e., the demangled name followed by a
  3149. trailing comma. This behaviour is because when the names are read
  3150. from the standard input it is expected that they might be part of an
  3151. assembler source file where there might be extra, extraneous
  3152. characters trailing after a mangled name. For example:
  3153. @smallexample
  3154. .type _Z1fv, @@function
  3155. @end smallexample
  3156. @c man end
  3157. @c man begin OPTIONS cxxfilt
  3158. @table @env
  3159. @item -_
  3160. @itemx --strip-underscore
  3161. On some systems, both the C and C++ compilers put an underscore in front
  3162. of every name. For example, the C name @code{foo} gets the low-level
  3163. name @code{_foo}. This option removes the initial underscore. Whether
  3164. @command{c++filt} removes the underscore by default is target dependent.
  3165. @item -n
  3166. @itemx --no-strip-underscore
  3167. Do not remove the initial underscore.
  3168. @item -p
  3169. @itemx --no-params
  3170. When demangling the name of a function, do not display the types of
  3171. the function's parameters.
  3172. @item -t
  3173. @itemx --types
  3174. Attempt to demangle types as well as function names. This is disabled
  3175. by default since mangled types are normally only used internally in
  3176. the compiler, and they can be confused with non-mangled names. For example,
  3177. a function called ``a'' treated as a mangled type name would be
  3178. demangled to ``signed char''.
  3179. @item -i
  3180. @itemx --no-verbose
  3181. Do not include implementation details (if any) in the demangled
  3182. output.
  3183. @item -r
  3184. @itemx -R
  3185. @itemx --recurse-limit
  3186. @itemx --no-recurse-limit
  3187. @itemx --recursion-limit
  3188. @itemx --no-recursion-limit
  3189. Enables or disables a limit on the amount of recursion performed
  3190. whilst demangling strings. Since the name mangling formats allow for
  3191. an infinite level of recursion it is possible to create strings whose
  3192. decoding will exhaust the amount of stack space available on the host
  3193. machine, triggering a memory fault. The limit tries to prevent this
  3194. from happening by restricting recursion to 2048 levels of nesting.
  3195. The default is for this limit to be enabled, but disabling it may be
  3196. necessary in order to demangle truly complicated names. Note however
  3197. that if the recursion limit is disabled then stack exhaustion is
  3198. possible and any bug reports about such an event will be rejected.
  3199. The @option{-r} option is a synonym for the
  3200. @option{--no-recurse-limit} option. The @option{-R} option is a
  3201. synonym for the @option{--recurse-limit} option.
  3202. @item -s @var{format}
  3203. @itemx --format=@var{format}
  3204. @command{c++filt} can decode various methods of mangling, used by
  3205. different compilers. The argument to this option selects which
  3206. method it uses:
  3207. @table @code
  3208. @item auto
  3209. Automatic selection based on executable (the default method)
  3210. @item gnu
  3211. the one used by the @sc{gnu} C++ compiler (g++)
  3212. @item lucid
  3213. the one used by the Lucid compiler (lcc)
  3214. @item arm
  3215. the one specified by the C++ Annotated Reference Manual
  3216. @item hp
  3217. the one used by the HP compiler (aCC)
  3218. @item edg
  3219. the one used by the EDG compiler
  3220. @item gnu-v3
  3221. the one used by the @sc{gnu} C++ compiler (g++) with the V3 ABI.
  3222. @item java
  3223. the one used by the @sc{gnu} Java compiler (gcj)
  3224. @item gnat
  3225. the one used by the @sc{gnu} Ada compiler (GNAT).
  3226. @end table
  3227. @item --help
  3228. Print a summary of the options to @command{c++filt} and exit.
  3229. @item --version
  3230. Print the version number of @command{c++filt} and exit.
  3231. @end table
  3232. @c man end
  3233. @ignore
  3234. @c man begin SEEALSO cxxfilt
  3235. the Info entries for @file{binutils}.
  3236. @c man end
  3237. @end ignore
  3238. @quotation
  3239. @emph{Warning:} @command{c++filt} is a new utility, and the details of its
  3240. user interface are subject to change in future releases. In particular,
  3241. a command-line option may be required in the future to decode a name
  3242. passed as an argument on the command line; in other words,
  3243. @example
  3244. c++filt @var{symbol}
  3245. @end example
  3246. @noindent
  3247. may in a future release become
  3248. @example
  3249. c++filt @var{option} @var{symbol}
  3250. @end example
  3251. @end quotation
  3252. @node addr2line
  3253. @chapter addr2line
  3254. @kindex addr2line
  3255. @cindex address to file name and line number
  3256. @c man title addr2line convert addresses or symbol+offset into file names and line numbers
  3257. @smallexample
  3258. @c man begin SYNOPSIS addr2line
  3259. addr2line [@option{-a}|@option{--addresses}]
  3260. [@option{-b} @var{bfdname}|@option{--target=}@var{bfdname}]
  3261. [@option{-C}|@option{--demangle}[=@var{style}]]
  3262. [@option{-r}|@option{--no-recurse-limit}]
  3263. [@option{-R}|@option{--recurse-limit}]
  3264. [@option{-e} @var{filename}|@option{--exe=}@var{filename}]
  3265. [@option{-f}|@option{--functions}] [@option{-s}|@option{--basename}]
  3266. [@option{-i}|@option{--inlines}]
  3267. [@option{-p}|@option{--pretty-print}]
  3268. [@option{-j}|@option{--section=}@var{name}]
  3269. [@option{-H}|@option{--help}] [@option{-V}|@option{--version}]
  3270. [addr addr @dots{}]
  3271. @c man end
  3272. @end smallexample
  3273. @c man begin DESCRIPTION addr2line
  3274. @command{addr2line} translates addresses or symbol+offset into file names and line numbers.
  3275. Given an address or symbol+offset in an executable or an offset in a section of a relocatable
  3276. object, it uses the debugging information to figure out which file name and
  3277. line number are associated with it.
  3278. The executable or relocatable object to use is specified with the @option{-e}
  3279. option. The default is the file @file{a.out}. The section in the relocatable
  3280. object to use is specified with the @option{-j} option.
  3281. @command{addr2line} has two modes of operation.
  3282. In the first, hexadecimal addresses or symbol+offset are specified on the command line,
  3283. and @command{addr2line} displays the file name and line number for each
  3284. address.
  3285. In the second, @command{addr2line} reads hexadecimal addresses or symbol+offset from
  3286. standard input, and prints the file name and line number for each
  3287. address on standard output. In this mode, @command{addr2line} may be used
  3288. in a pipe to convert dynamically chosen addresses.
  3289. The format of the output is @samp{FILENAME:LINENO}. By default
  3290. each input address generates one line of output.
  3291. Two options can generate additional lines before each
  3292. @samp{FILENAME:LINENO} line (in that order).
  3293. If the @option{-a} option is used then a line with the input address
  3294. is displayed.
  3295. If the @option{-f} option is used, then a line with the
  3296. @samp{FUNCTIONNAME} is displayed. This is the name of the function
  3297. containing the address.
  3298. One option can generate additional lines after the
  3299. @samp{FILENAME:LINENO} line.
  3300. If the @option{-i} option is used and the code at the given address is
  3301. present there because of inlining by the compiler then additional
  3302. lines are displayed afterwards. One or two extra lines (if the
  3303. @option{-f} option is used) are displayed for each inlined function.
  3304. Alternatively if the @option{-p} option is used then each input
  3305. address generates a single, long, output line containing the address,
  3306. the function name, the file name and the line number. If the
  3307. @option{-i} option has also been used then any inlined functions will
  3308. be displayed in the same manner, but on separate lines, and prefixed
  3309. by the text @samp{(inlined by)}.
  3310. If the file name or function name can not be determined,
  3311. @command{addr2line} will print two question marks in their place. If the
  3312. line number can not be determined, @command{addr2line} will print 0.
  3313. When symbol+offset is used, +offset is optional, except when the symbol
  3314. is ambigious with a hex number. The resolved symbols can be mangled
  3315. or unmangled, except unmangled symbols with + are not allowed.
  3316. @c man end
  3317. @c man begin OPTIONS addr2line
  3318. The long and short forms of options, shown here as alternatives, are
  3319. equivalent.
  3320. @table @env
  3321. @item -a
  3322. @itemx --addresses
  3323. Display the address before the function name, file and line number
  3324. information. The address is printed with a @samp{0x} prefix to easily
  3325. identify it.
  3326. @item -b @var{bfdname}
  3327. @itemx --target=@var{bfdname}
  3328. @cindex object code format
  3329. Specify that the object-code format for the object files is
  3330. @var{bfdname}.
  3331. @item -C
  3332. @itemx --demangle[=@var{style}]
  3333. @cindex demangling in objdump
  3334. Decode (@dfn{demangle}) low-level symbol names into user-level names.
  3335. Besides removing any initial underscore prepended by the system, this
  3336. makes C++ function names readable. Different compilers have different
  3337. mangling styles. The optional demangling style argument can be used to
  3338. choose an appropriate demangling style for your compiler. @xref{c++filt},
  3339. for more information on demangling.
  3340. @item -e @var{filename}
  3341. @itemx --exe=@var{filename}
  3342. Specify the name of the executable for which addresses should be
  3343. translated. The default file is @file{a.out}.
  3344. @item -f
  3345. @itemx --functions
  3346. Display function names as well as file and line number information.
  3347. @item -s
  3348. @itemx --basenames
  3349. Display only the base of each file name.
  3350. @item -i
  3351. @itemx --inlines
  3352. If the address belongs to a function that was inlined, the source
  3353. information for all enclosing scopes back to the first non-inlined
  3354. function will also be printed. For example, if @code{main} inlines
  3355. @code{callee1} which inlines @code{callee2}, and address is from
  3356. @code{callee2}, the source information for @code{callee1} and @code{main}
  3357. will also be printed.
  3358. @item -j
  3359. @itemx --section
  3360. Read offsets relative to the specified section instead of absolute addresses.
  3361. @item -p
  3362. @itemx --pretty-print
  3363. Make the output more human friendly: each location are printed on one line.
  3364. If option @option{-i} is specified, lines for all enclosing scopes are
  3365. prefixed with @samp{(inlined by)}.
  3366. @item -r
  3367. @itemx -R
  3368. @itemx --recurse-limit
  3369. @itemx --no-recurse-limit
  3370. @itemx --recursion-limit
  3371. @itemx --no-recursion-limit
  3372. Enables or disables a limit on the amount of recursion performed
  3373. whilst demangling strings. Since the name mangling formats allow for
  3374. an infinite level of recursion it is possible to create strings whose
  3375. decoding will exhaust the amount of stack space available on the host
  3376. machine, triggering a memory fault. The limit tries to prevent this
  3377. from happening by restricting recursion to 2048 levels of nesting.
  3378. The default is for this limit to be enabled, but disabling it may be
  3379. necessary in order to demangle truly complicated names. Note however
  3380. that if the recursion limit is disabled then stack exhaustion is
  3381. possible and any bug reports about such an event will be rejected.
  3382. The @option{-r} option is a synonym for the
  3383. @option{--no-recurse-limit} option. The @option{-R} option is a
  3384. synonym for the @option{--recurse-limit} option.
  3385. Note this option is only effective if the @option{-C} or
  3386. @option{--demangle} option has been enabled.
  3387. @end table
  3388. @c man end
  3389. @ignore
  3390. @c man begin SEEALSO addr2line
  3391. Info entries for @file{binutils}.
  3392. @c man end
  3393. @end ignore
  3394. @node windmc
  3395. @chapter windmc
  3396. @command{windmc} may be used to generator Windows message resources.
  3397. @quotation
  3398. @emph{Warning:} @command{windmc} is not always built as part of the binary
  3399. utilities, since it is only useful for Windows targets.
  3400. @end quotation
  3401. @c man title windmc generates Windows message resources
  3402. @smallexample
  3403. @c man begin SYNOPSIS windmc
  3404. windmc [options] input-file
  3405. @c man end
  3406. @end smallexample
  3407. @c man begin DESCRIPTION windmc
  3408. @command{windmc} reads message definitions from an input file (.mc) and
  3409. translate them into a set of output files. The output files may be of
  3410. four kinds:
  3411. @table @code
  3412. @item h
  3413. A C header file containing the message definitions.
  3414. @item rc
  3415. A resource file compilable by the @command{windres} tool.
  3416. @item bin
  3417. One or more binary files containing the resource data for a specific
  3418. message language.
  3419. @item dbg
  3420. A C include file that maps message id's to their symbolic name.
  3421. @end table
  3422. The exact description of these different formats is available in
  3423. documentation from Microsoft.
  3424. When @command{windmc} converts from the @code{mc} format to the @code{bin}
  3425. format, @code{rc}, @code{h}, and optional @code{dbg} it is acting like the
  3426. Windows Message Compiler.
  3427. @c man end
  3428. @c man begin OPTIONS windmc
  3429. @table @env
  3430. @item -a
  3431. @itemx --ascii_in
  3432. Specifies that the input file specified is ASCII. This is the default
  3433. behaviour.
  3434. @item -A
  3435. @itemx --ascii_out
  3436. Specifies that messages in the output @code{bin} files should be in ASCII
  3437. format.
  3438. @item -b
  3439. @itemx --binprefix
  3440. Specifies that @code{bin} filenames should have to be prefixed by the
  3441. basename of the source file.
  3442. @item -c
  3443. @itemx --customflag
  3444. Sets the customer bit in all message id's.
  3445. @item -C @var{codepage}
  3446. @itemx --codepage_in @var{codepage}
  3447. Sets the default codepage to be used to convert input file to UTF16. The
  3448. default is ocdepage 1252.
  3449. @item -d
  3450. @itemx --decimal_values
  3451. Outputs the constants in the header file in decimal. Default is using
  3452. hexadecimal output.
  3453. @item -e @var{ext}
  3454. @itemx --extension @var{ext}
  3455. The extension for the header file. The default is .h extension.
  3456. @item -F @var{target}
  3457. @itemx --target @var{target}
  3458. Specify the BFD format to use for a bin file as output. This
  3459. is a BFD target name; you can use the @option{--help} option to see a list
  3460. of supported targets. Normally @command{windmc} will use the default
  3461. format, which is the first one listed by the @option{--help} option.
  3462. @ifclear man
  3463. @ref{Target Selection}.
  3464. @end ifclear
  3465. @item -h @var{path}
  3466. @itemx --headerdir @var{path}
  3467. The target directory of the generated header file. The default is the
  3468. current directory.
  3469. @item -H
  3470. @itemx --help
  3471. Displays a list of command-line options and then exits.
  3472. @item -m @var{characters}
  3473. @itemx --maxlength @var{characters}
  3474. Instructs @command{windmc} to generate a warning if the length
  3475. of any message exceeds the number specified.
  3476. @item -n
  3477. @itemx --nullterminate
  3478. Terminate message text in @code{bin} files by zero. By default they are
  3479. terminated by CR/LF.
  3480. @item -o
  3481. @itemx --hresult_use
  3482. Not yet implemented. Instructs @code{windmc} to generate an OLE2 header
  3483. file, using HRESULT definitions. Status codes are used if the flag is not
  3484. specified.
  3485. @item -O @var{codepage}
  3486. @itemx --codepage_out @var{codepage}
  3487. Sets the default codepage to be used to output text files. The default
  3488. is ocdepage 1252.
  3489. @item -r @var{path}
  3490. @itemx --rcdir @var{path}
  3491. The target directory for the generated @code{rc} script and the generated
  3492. @code{bin} files that the resource compiler script includes. The default
  3493. is the current directory.
  3494. @item -u
  3495. @itemx --unicode_in
  3496. Specifies that the input file is UTF16.
  3497. @item -U
  3498. @itemx --unicode_out
  3499. Specifies that messages in the output @code{bin} file should be in UTF16
  3500. format. This is the default behaviour.
  3501. @item -v
  3502. @item --verbose
  3503. Enable verbose mode.
  3504. @item -V
  3505. @item --version
  3506. Prints the version number for @command{windmc}.
  3507. @item -x @var{path}
  3508. @itemx --xdgb @var{path}
  3509. The path of the @code{dbg} C include file that maps message id's to the
  3510. symbolic name. No such file is generated without specifying the switch.
  3511. @end table
  3512. @c man end
  3513. @ignore
  3514. @c man begin SEEALSO windmc
  3515. the Info entries for @file{binutils}.
  3516. @c man end
  3517. @end ignore
  3518. @node windres
  3519. @chapter windres
  3520. @command{windres} may be used to manipulate Windows resources.
  3521. @quotation
  3522. @emph{Warning:} @command{windres} is not always built as part of the binary
  3523. utilities, since it is only useful for Windows targets.
  3524. @end quotation
  3525. @c man title windres manipulate Windows resources
  3526. @smallexample
  3527. @c man begin SYNOPSIS windres
  3528. windres [options] [input-file] [output-file]
  3529. @c man end
  3530. @end smallexample
  3531. @c man begin DESCRIPTION windres
  3532. @command{windres} reads resources from an input file and copies them into
  3533. an output file. Either file may be in one of three formats:
  3534. @table @code
  3535. @item rc
  3536. A text format read by the Resource Compiler.
  3537. @item res
  3538. A binary format generated by the Resource Compiler.
  3539. @item coff
  3540. A COFF object or executable.
  3541. @end table
  3542. The exact description of these different formats is available in
  3543. documentation from Microsoft.
  3544. When @command{windres} converts from the @code{rc} format to the @code{res}
  3545. format, it is acting like the Windows Resource Compiler. When
  3546. @command{windres} converts from the @code{res} format to the @code{coff}
  3547. format, it is acting like the Windows @code{CVTRES} program.
  3548. When @command{windres} generates an @code{rc} file, the output is similar
  3549. but not identical to the format expected for the input. When an input
  3550. @code{rc} file refers to an external filename, an output @code{rc} file
  3551. will instead include the file contents.
  3552. If the input or output format is not specified, @command{windres} will
  3553. guess based on the file name, or, for the input file, the file contents.
  3554. A file with an extension of @file{.rc} will be treated as an @code{rc}
  3555. file, a file with an extension of @file{.res} will be treated as a
  3556. @code{res} file, and a file with an extension of @file{.o} or
  3557. @file{.exe} will be treated as a @code{coff} file.
  3558. If no output file is specified, @command{windres} will print the resources
  3559. in @code{rc} format to standard output.
  3560. The normal use is for you to write an @code{rc} file, use @command{windres}
  3561. to convert it to a COFF object file, and then link the COFF file into
  3562. your application. This will make the resources described in the
  3563. @code{rc} file available to Windows.
  3564. @c man end
  3565. @c man begin OPTIONS windres
  3566. @table @env
  3567. @item -i @var{filename}
  3568. @itemx --input @var{filename}
  3569. The name of the input file. If this option is not used, then
  3570. @command{windres} will use the first non-option argument as the input file
  3571. name. If there are no non-option arguments, then @command{windres} will
  3572. read from standard input. @command{windres} can not read a COFF file from
  3573. standard input.
  3574. @item -o @var{filename}
  3575. @itemx --output @var{filename}
  3576. The name of the output file. If this option is not used, then
  3577. @command{windres} will use the first non-option argument, after any used
  3578. for the input file name, as the output file name. If there is no
  3579. non-option argument, then @command{windres} will write to standard output.
  3580. @command{windres} can not write a COFF file to standard output. Note,
  3581. for compatibility with @command{rc} the option @option{-fo} is also
  3582. accepted, but its use is not recommended.
  3583. @item -J @var{format}
  3584. @itemx --input-format @var{format}
  3585. The input format to read. @var{format} may be @samp{res}, @samp{rc}, or
  3586. @samp{coff}. If no input format is specified, @command{windres} will
  3587. guess, as described above.
  3588. @item -O @var{format}
  3589. @itemx --output-format @var{format}
  3590. The output format to generate. @var{format} may be @samp{res},
  3591. @samp{rc}, or @samp{coff}. If no output format is specified,
  3592. @command{windres} will guess, as described above.
  3593. @item -F @var{target}
  3594. @itemx --target @var{target}
  3595. Specify the BFD format to use for a COFF file as input or output. This
  3596. is a BFD target name; you can use the @option{--help} option to see a list
  3597. of supported targets. Normally @command{windres} will use the default
  3598. format, which is the first one listed by the @option{--help} option.
  3599. @ifclear man
  3600. @ref{Target Selection}.
  3601. @end ifclear
  3602. @item --preprocessor @var{program}
  3603. When @command{windres} reads an @code{rc} file, it runs it through the C
  3604. preprocessor first. This option may be used to specify the preprocessor
  3605. to use. The default preprocessor is @code{gcc}.
  3606. @item --preprocessor-arg @var{option}
  3607. When @command{windres} reads an @code{rc} file, it runs it through
  3608. the C preprocessor first. This option may be used to specify additional
  3609. text to be passed to preprocessor on its command line.
  3610. This option can be used multiple times to add multiple options to the
  3611. preprocessor command line.
  3612. If the @option{--preprocessor} option has not been specified then a
  3613. default set of preprocessor arguments will be used, with any
  3614. @option{--preprocessor-arg} options being placed after them on the
  3615. command line. These default arguments are @code{-E},
  3616. @code{-xc-header} and @code{-DRC_INVOKED}.
  3617. @item -I @var{directory}
  3618. @itemx --include-dir @var{directory}
  3619. Specify an include directory to use when reading an @code{rc} file.
  3620. @command{windres} will pass this to the preprocessor as an @option{-I}
  3621. option. @command{windres} will also search this directory when looking for
  3622. files named in the @code{rc} file. If the argument passed to this command
  3623. matches any of the supported @var{formats} (as described in the @option{-J}
  3624. option), it will issue a deprecation warning, and behave just like the
  3625. @option{-J} option. New programs should not use this behaviour. If a
  3626. directory happens to match a @var{format}, simple prefix it with @samp{./}
  3627. to disable the backward compatibility.
  3628. @item -D @var{target}
  3629. @itemx --define @var{sym}[=@var{val}]
  3630. Specify a @option{-D} option to pass to the preprocessor when reading an
  3631. @code{rc} file.
  3632. @item -U @var{target}
  3633. @itemx --undefine @var{sym}
  3634. Specify a @option{-U} option to pass to the preprocessor when reading an
  3635. @code{rc} file.
  3636. @item -r
  3637. Ignored for compatibility with rc.
  3638. @item -v
  3639. Enable verbose mode. This tells you what the preprocessor is if you
  3640. didn't specify one.
  3641. @item -c @var{val}
  3642. @item --codepage @var{val}
  3643. Specify the default codepage to use when reading an @code{rc} file.
  3644. @var{val} should be a hexadecimal prefixed by @samp{0x} or decimal
  3645. codepage code. The valid range is from zero up to 0xffff, but the
  3646. validity of the codepage is host and configuration dependent.
  3647. @item -l @var{val}
  3648. @item --language @var{val}
  3649. Specify the default language to use when reading an @code{rc} file.
  3650. @var{val} should be a hexadecimal language code. The low eight bits are
  3651. the language, and the high eight bits are the sublanguage.
  3652. @item --use-temp-file
  3653. Use a temporary file to instead of using popen to read the output of
  3654. the preprocessor. Use this option if the popen implementation is buggy
  3655. on the host (eg., certain non-English language versions of Windows 95 and
  3656. Windows 98 are known to have buggy popen where the output will instead
  3657. go the console).
  3658. @item --no-use-temp-file
  3659. Use popen, not a temporary file, to read the output of the preprocessor.
  3660. This is the default behaviour.
  3661. @item -h
  3662. @item --help
  3663. Prints a usage summary.
  3664. @item -V
  3665. @item --version
  3666. Prints the version number for @command{windres}.
  3667. @item --yydebug
  3668. If @command{windres} is compiled with @code{YYDEBUG} defined as @code{1},
  3669. this will turn on parser debugging.
  3670. @end table
  3671. @c man end
  3672. @ignore
  3673. @c man begin SEEALSO windres
  3674. the Info entries for @file{binutils}.
  3675. @c man end
  3676. @end ignore
  3677. @node dlltool
  3678. @chapter dlltool
  3679. @cindex DLL
  3680. @kindex dlltool
  3681. @command{dlltool} is used to create the files needed to create dynamic
  3682. link libraries (DLLs) on systems which understand PE format image
  3683. files such as Windows. A DLL contains an export table which contains
  3684. information that the runtime loader needs to resolve references from a
  3685. referencing program.
  3686. The export table is generated by this program by reading in a
  3687. @file{.def} file or scanning the @file{.a} and @file{.o} files which
  3688. will be in the DLL. A @file{.o} file can contain information in
  3689. special @samp{.drectve} sections with export information.
  3690. @quotation
  3691. @emph{Note:} @command{dlltool} is not always built as part of the
  3692. binary utilities, since it is only useful for those targets which
  3693. support DLLs.
  3694. @end quotation
  3695. @c man title dlltool create files needed to build and use DLLs
  3696. @smallexample
  3697. @c man begin SYNOPSIS dlltool
  3698. dlltool [@option{-d}|@option{--input-def} @var{def-file-name}]
  3699. [@option{-b}|@option{--base-file} @var{base-file-name}]
  3700. [@option{-e}|@option{--output-exp} @var{exports-file-name}]
  3701. [@option{-z}|@option{--output-def} @var{def-file-name}]
  3702. [@option{-l}|@option{--output-lib} @var{library-file-name}]
  3703. [@option{-y}|@option{--output-delaylib} @var{library-file-name}]
  3704. [@option{--export-all-symbols}] [@option{--no-export-all-symbols}]
  3705. [@option{--exclude-symbols} @var{list}]
  3706. [@option{--no-default-excludes}]
  3707. [@option{-S}|@option{--as} @var{path-to-assembler}] [@option{-f}|@option{--as-flags} @var{options}]
  3708. [@option{-D}|@option{--dllname} @var{name}] [@option{-m}|@option{--machine} @var{machine}]
  3709. [@option{-a}|@option{--add-indirect}]
  3710. [@option{-U}|@option{--add-underscore}] [@option{--add-stdcall-underscore}]
  3711. [@option{-k}|@option{--kill-at}] [@option{-A}|@option{--add-stdcall-alias}]
  3712. [@option{-p}|@option{--ext-prefix-alias} @var{prefix}]
  3713. [@option{-x}|@option{--no-idata4}] [@option{-c}|@option{--no-idata5}]
  3714. [@option{--use-nul-prefixed-import-tables}]
  3715. [@option{-I}|@option{--identify} @var{library-file-name}] [@option{--identify-strict}]
  3716. [@option{-i}|@option{--interwork}]
  3717. [@option{-n}|@option{--nodelete}] [@option{-t}|@option{--temp-prefix} @var{prefix}]
  3718. [@option{-v}|@option{--verbose}]
  3719. [@option{-h}|@option{--help}] [@option{-V}|@option{--version}]
  3720. [@option{--no-leading-underscore}] [@option{--leading-underscore}]
  3721. [object-file @dots{}]
  3722. @c man end
  3723. @end smallexample
  3724. @c man begin DESCRIPTION dlltool
  3725. @command{dlltool} reads its inputs, which can come from the @option{-d} and
  3726. @option{-b} options as well as object files specified on the command
  3727. line. It then processes these inputs and if the @option{-e} option has
  3728. been specified it creates a exports file. If the @option{-l} option
  3729. has been specified it creates a library file and if the @option{-z} option
  3730. has been specified it creates a def file. Any or all of the @option{-e},
  3731. @option{-l} and @option{-z} options can be present in one invocation of
  3732. dlltool.
  3733. When creating a DLL, along with the source for the DLL, it is necessary
  3734. to have three other files. @command{dlltool} can help with the creation of
  3735. these files.
  3736. The first file is a @file{.def} file which specifies which functions are
  3737. exported from the DLL, which functions the DLL imports, and so on. This
  3738. is a text file and can be created by hand, or @command{dlltool} can be used
  3739. to create it using the @option{-z} option. In this case @command{dlltool}
  3740. will scan the object files specified on its command line looking for
  3741. those functions which have been specially marked as being exported and
  3742. put entries for them in the @file{.def} file it creates.
  3743. In order to mark a function as being exported from a DLL, it needs to
  3744. have an @option{-export:<name_of_function>} entry in the @samp{.drectve}
  3745. section of the object file. This can be done in C by using the
  3746. asm() operator:
  3747. @smallexample
  3748. asm (".section .drectve");
  3749. asm (".ascii \"-export:my_func\"");
  3750. int my_func (void) @{ @dots{} @}
  3751. @end smallexample
  3752. The second file needed for DLL creation is an exports file. This file
  3753. is linked with the object files that make up the body of the DLL and it
  3754. handles the interface between the DLL and the outside world. This is a
  3755. binary file and it can be created by giving the @option{-e} option to
  3756. @command{dlltool} when it is creating or reading in a @file{.def} file.
  3757. The third file needed for DLL creation is the library file that programs
  3758. will link with in order to access the functions in the DLL (an `import
  3759. library'). This file can be created by giving the @option{-l} option to
  3760. dlltool when it is creating or reading in a @file{.def} file.
  3761. If the @option{-y} option is specified, dlltool generates a delay-import
  3762. library that can be used instead of the normal import library to allow
  3763. a program to link to the dll only as soon as an imported function is
  3764. called for the first time. The resulting executable will need to be
  3765. linked to the static delayimp library containing __delayLoadHelper2(),
  3766. which in turn will import LoadLibraryA and GetProcAddress from kernel32.
  3767. @command{dlltool} builds the library file by hand, but it builds the
  3768. exports file by creating temporary files containing assembler statements
  3769. and then assembling these. The @option{-S} command-line option can be
  3770. used to specify the path to the assembler that dlltool will use,
  3771. and the @option{-f} option can be used to pass specific flags to that
  3772. assembler. The @option{-n} can be used to prevent dlltool from deleting
  3773. these temporary assembler files when it is done, and if @option{-n} is
  3774. specified twice then this will prevent dlltool from deleting the
  3775. temporary object files it used to build the library.
  3776. Here is an example of creating a DLL from a source file @samp{dll.c} and
  3777. also creating a program (from an object file called @samp{program.o})
  3778. that uses that DLL:
  3779. @smallexample
  3780. gcc -c dll.c
  3781. dlltool -e exports.o -l dll.lib dll.o
  3782. gcc dll.o exports.o -o dll.dll
  3783. gcc program.o dll.lib -o program
  3784. @end smallexample
  3785. @command{dlltool} may also be used to query an existing import library
  3786. to determine the name of the DLL to which it is associated. See the
  3787. description of the @option{-I} or @option{--identify} option.
  3788. @c man end
  3789. @c man begin OPTIONS dlltool
  3790. The command-line options have the following meanings:
  3791. @table @env
  3792. @item -d @var{filename}
  3793. @itemx --input-def @var{filename}
  3794. @cindex input .def file
  3795. Specifies the name of a @file{.def} file to be read in and processed.
  3796. @item -b @var{filename}
  3797. @itemx --base-file @var{filename}
  3798. @cindex base files
  3799. Specifies the name of a base file to be read in and processed. The
  3800. contents of this file will be added to the relocation section in the
  3801. exports file generated by dlltool.
  3802. @item -e @var{filename}
  3803. @itemx --output-exp @var{filename}
  3804. Specifies the name of the export file to be created by dlltool.
  3805. @item -z @var{filename}
  3806. @itemx --output-def @var{filename}
  3807. Specifies the name of the @file{.def} file to be created by dlltool.
  3808. @item -l @var{filename}
  3809. @itemx --output-lib @var{filename}
  3810. Specifies the name of the library file to be created by dlltool.
  3811. @item -y @var{filename}
  3812. @itemx --output-delaylib @var{filename}
  3813. Specifies the name of the delay-import library file to be created by dlltool.
  3814. @item --export-all-symbols
  3815. Treat all global and weak defined symbols found in the input object
  3816. files as symbols to be exported. There is a small list of symbols which
  3817. are not exported by default; see the @option{--no-default-excludes}
  3818. option. You may add to the list of symbols to not export by using the
  3819. @option{--exclude-symbols} option.
  3820. @item --no-export-all-symbols
  3821. Only export symbols explicitly listed in an input @file{.def} file or in
  3822. @samp{.drectve} sections in the input object files. This is the default
  3823. behaviour. The @samp{.drectve} sections are created by @samp{dllexport}
  3824. attributes in the source code.
  3825. @item --exclude-symbols @var{list}
  3826. Do not export the symbols in @var{list}. This is a list of symbol names
  3827. separated by comma or colon characters. The symbol names should not
  3828. contain a leading underscore. This is only meaningful when
  3829. @option{--export-all-symbols} is used.
  3830. @item --no-default-excludes
  3831. When @option{--export-all-symbols} is used, it will by default avoid
  3832. exporting certain special symbols. The current list of symbols to avoid
  3833. exporting is @samp{DllMain@@12}, @samp{DllEntryPoint@@0},
  3834. @samp{impure_ptr}. You may use the @option{--no-default-excludes} option
  3835. to go ahead and export these special symbols. This is only meaningful
  3836. when @option{--export-all-symbols} is used.
  3837. @item -S @var{path}
  3838. @itemx --as @var{path}
  3839. Specifies the path, including the filename, of the assembler to be used
  3840. to create the exports file.
  3841. @item -f @var{options}
  3842. @itemx --as-flags @var{options}
  3843. Specifies any specific command-line options to be passed to the
  3844. assembler when building the exports file. This option will work even if
  3845. the @option{-S} option is not used. This option only takes one argument,
  3846. and if it occurs more than once on the command line, then later
  3847. occurrences will override earlier occurrences. So if it is necessary to
  3848. pass multiple options to the assembler they should be enclosed in
  3849. double quotes.
  3850. @item -D @var{name}
  3851. @itemx --dll-name @var{name}
  3852. Specifies the name to be stored in the @file{.def} file as the name of
  3853. the DLL when the @option{-e} option is used. If this option is not
  3854. present, then the filename given to the @option{-e} option will be
  3855. used as the name of the DLL.
  3856. @item -m @var{machine}
  3857. @itemx -machine @var{machine}
  3858. Specifies the type of machine for which the library file should be
  3859. built. @command{dlltool} has a built in default type, depending upon how
  3860. it was created, but this option can be used to override that. This is
  3861. normally only useful when creating DLLs for an ARM processor, when the
  3862. contents of the DLL are actually encode using Thumb instructions.
  3863. @item -a
  3864. @itemx --add-indirect
  3865. Specifies that when @command{dlltool} is creating the exports file it
  3866. should add a section which allows the exported functions to be
  3867. referenced without using the import library. Whatever the hell that
  3868. means!
  3869. @item -U
  3870. @itemx --add-underscore
  3871. Specifies that when @command{dlltool} is creating the exports file it
  3872. should prepend an underscore to the names of @emph{all} exported symbols.
  3873. @item --no-leading-underscore
  3874. @item --leading-underscore
  3875. Specifies whether standard symbol should be forced to be prefixed, or
  3876. not.
  3877. @item --add-stdcall-underscore
  3878. Specifies that when @command{dlltool} is creating the exports file it
  3879. should prepend an underscore to the names of exported @emph{stdcall}
  3880. functions. Variable names and non-stdcall function names are not modified.
  3881. This option is useful when creating GNU-compatible import libs for third
  3882. party DLLs that were built with MS-Windows tools.
  3883. @item -k
  3884. @itemx --kill-at
  3885. Specifies that @samp{@@<number>} suffixes should be omitted from the names
  3886. of stdcall functions that will be imported from the DLL. This is
  3887. useful when creating an import library for a DLL which exports stdcall
  3888. functions but without the usual @samp{@@<number>} symbol name suffix.
  3889. This does not change the naming of symbols provided by the import library
  3890. to programs linked against it, but only the entries in the import table
  3891. (ie the .idata section).
  3892. @item -A
  3893. @itemx --add-stdcall-alias
  3894. Specifies that when @command{dlltool} is creating the exports file it
  3895. should add aliases for stdcall symbols without @samp{@@ <number>}
  3896. in addition to the symbols with @samp{@@ <number>}.
  3897. @item -p
  3898. @itemx --ext-prefix-alias @var{prefix}
  3899. Causes @command{dlltool} to create external aliases for all DLL
  3900. imports with the specified prefix. The aliases are created for both
  3901. external and import symbols with no leading underscore.
  3902. @item -x
  3903. @itemx --no-idata4
  3904. Specifies that when @command{dlltool} is creating the exports and library
  3905. files it should omit the @code{.idata4} section. This is for compatibility
  3906. with certain operating systems.
  3907. @item --use-nul-prefixed-import-tables
  3908. Specifies that when @command{dlltool} is creating the exports and library
  3909. files it should prefix the @code{.idata4} and @code{.idata5} by zero an
  3910. element. This emulates old gnu import library generation of
  3911. @code{dlltool}. By default this option is turned off.
  3912. @item -c
  3913. @itemx --no-idata5
  3914. Specifies that when @command{dlltool} is creating the exports and library
  3915. files it should omit the @code{.idata5} section. This is for compatibility
  3916. with certain operating systems.
  3917. @item -I @var{filename}
  3918. @itemx --identify @var{filename}
  3919. Specifies that @command{dlltool} should inspect the import library
  3920. indicated by @var{filename} and report, on @code{stdout}, the name(s)
  3921. of the associated DLL(s). This can be performed in addition to any
  3922. other operations indicated by the other options and arguments.
  3923. @command{dlltool} fails if the import library does not exist or is not
  3924. actually an import library. See also @option{--identify-strict}.
  3925. @item --identify-strict
  3926. Modifies the behavior of the @option{--identify} option, such
  3927. that an error is reported if @var{filename} is associated with
  3928. more than one DLL.
  3929. @item -i
  3930. @itemx --interwork
  3931. Specifies that @command{dlltool} should mark the objects in the library
  3932. file and exports file that it produces as supporting interworking
  3933. between ARM and Thumb code.
  3934. @item -n
  3935. @itemx --nodelete
  3936. Makes @command{dlltool} preserve the temporary assembler files it used to
  3937. create the exports file. If this option is repeated then dlltool will
  3938. also preserve the temporary object files it uses to create the library
  3939. file.
  3940. @item -t @var{prefix}
  3941. @itemx --temp-prefix @var{prefix}
  3942. Makes @command{dlltool} use @var{prefix} when constructing the names of
  3943. temporary assembler and object files. By default, the temp file prefix
  3944. is generated from the pid.
  3945. @item -v
  3946. @itemx --verbose
  3947. Make dlltool describe what it is doing.
  3948. @item -h
  3949. @itemx --help
  3950. Displays a list of command-line options and then exits.
  3951. @item -V
  3952. @itemx --version
  3953. Displays dlltool's version number and then exits.
  3954. @end table
  3955. @c man end
  3956. @menu
  3957. * def file format:: The format of the dlltool @file{.def} file
  3958. @end menu
  3959. @node def file format
  3960. @section The format of the @command{dlltool} @file{.def} file
  3961. A @file{.def} file contains any number of the following commands:
  3962. @table @asis
  3963. @item @code{NAME} @var{name} @code{[ ,} @var{base} @code{]}
  3964. The result is going to be named @var{name}@code{.exe}.
  3965. @item @code{LIBRARY} @var{name} @code{[ ,} @var{base} @code{]}
  3966. The result is going to be named @var{name}@code{.dll}.
  3967. Note: If you want to use LIBRARY as name then you need to quote. Otherwise
  3968. this will fail due a necessary hack for libtool (see PR binutils/13710 for more
  3969. details).
  3970. @item @code{EXPORTS ( ( (} @var{name1} @code{[ = } @var{name2} @code{] ) | ( } @var{name1} @code{=} @var{module-name} @code{.} @var{external-name} @code{) ) [ == } @var{its_name} @code{]}
  3971. @item @code{[} @var{integer} @code{] [ NONAME ] [ CONSTANT ] [ DATA ] [ PRIVATE ] ) *}
  3972. Declares @var{name1} as an exported symbol from the DLL, with optional
  3973. ordinal number @var{integer}, or declares @var{name1} as an alias
  3974. (forward) of the function @var{external-name} in the DLL.
  3975. If @var{its_name} is specified, this name is used as string in export table.
  3976. @var{module-name}.
  3977. Note: The @code{EXPORTS} has to be the last command in .def file, as keywords
  3978. are treated - beside @code{LIBRARY} - as simple name-identifiers.
  3979. If you want to use LIBRARY as name then you need to quote it.
  3980. @item @code{IMPORTS ( (} @var{internal-name} @code{=} @var{module-name} @code{.} @var{integer} @code{) | [} @var{internal-name} @code{= ]} @var{module-name} @code{.} @var{external-name} @code{) [ == ) @var{its_name} @code{]} *}
  3981. Declares that @var{external-name} or the exported function whose
  3982. ordinal number is @var{integer} is to be imported from the file
  3983. @var{module-name}. If @var{internal-name} is specified then this is
  3984. the name that the imported function will be referred to in the body of
  3985. the DLL.
  3986. If @var{its_name} is specified, this name is used as string in import table.
  3987. Note: The @code{IMPORTS} has to be the last command in .def file, as keywords
  3988. are treated - beside @code{LIBRARY} - as simple name-identifiers.
  3989. If you want to use LIBRARY as name then you need to quote it.
  3990. @item @code{DESCRIPTION} @var{string}
  3991. Puts @var{string} into the output @file{.exp} file in the
  3992. @code{.rdata} section.
  3993. @item @code{STACKSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
  3994. @item @code{HEAPSIZE} @var{number-reserve} @code{[, } @var{number-commit} @code{]}
  3995. Generates @code{--stack} or @code{--heap}
  3996. @var{number-reserve},@var{number-commit} in the output @code{.drectve}
  3997. section. The linker will see this and act upon it.
  3998. @item @code{CODE} @var{attr} @code{+}
  3999. @item @code{DATA} @var{attr} @code{+}
  4000. @item @code{SECTIONS (} @var{section-name} @var{attr}@code{ + ) *}
  4001. Generates @code{--attr} @var{section-name} @var{attr} in the output
  4002. @code{.drectve} section, where @var{attr} is one of @code{READ},
  4003. @code{WRITE}, @code{EXECUTE} or @code{SHARED}. The linker will see
  4004. this and act upon it.
  4005. @end table
  4006. @ignore
  4007. @c man begin SEEALSO dlltool
  4008. The Info pages for @file{binutils}.
  4009. @c man end
  4010. @end ignore
  4011. @node readelf
  4012. @chapter readelf
  4013. @cindex ELF file information
  4014. @kindex readelf
  4015. @c man title readelf display information about ELF files
  4016. @smallexample
  4017. @c man begin SYNOPSIS readelf
  4018. readelf [@option{-a}|@option{--all}]
  4019. [@option{-h}|@option{--file-header}]
  4020. [@option{-l}|@option{--program-headers}|@option{--segments}]
  4021. [@option{-S}|@option{--section-headers}|@option{--sections}]
  4022. [@option{-g}|@option{--section-groups}]
  4023. [@option{-t}|@option{--section-details}]
  4024. [@option{-e}|@option{--headers}]
  4025. [@option{-s}|@option{--syms}|@option{--symbols}]
  4026. [@option{--dyn-syms}|@option{--lto-syms}]
  4027. [@option{--sym-base=[0|8|10|16]}]
  4028. [@option{--demangle@var{=style}}|@option{--no-demangle}]
  4029. [@option{--quiet}]
  4030. [@option{--recurse-limit}|@option{--no-recurse-limit}]
  4031. [@option{-U} @var{method}|@option{--unicode=}@var{method}]
  4032. [@option{-n}|@option{--notes}]
  4033. [@option{-r}|@option{--relocs}]
  4034. [@option{-u}|@option{--unwind}]
  4035. [@option{-d}|@option{--dynamic}]
  4036. [@option{-V}|@option{--version-info}]
  4037. [@option{-A}|@option{--arch-specific}]
  4038. [@option{-D}|@option{--use-dynamic}]
  4039. [@option{-L}|@option{--lint}|@option{--enable-checks}]
  4040. [@option{-x} <number or name>|@option{--hex-dump=}<number or name>]
  4041. [@option{-p} <number or name>|@option{--string-dump=}<number or name>]
  4042. [@option{-R} <number or name>|@option{--relocated-dump=}<number or name>]
  4043. [@option{-z}|@option{--decompress}]
  4044. [@option{-c}|@option{--archive-index}]
  4045. [@option{-w[lLiaprmfFsoORtUuTgAck]}|
  4046. @option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
  4047. [@option{-wK}|@option{--debug-dump=follow-links}]
  4048. [@option{-wN}|@option{--debug-dump=no-follow-links}]
  4049. [@option{-wD}|@option{--debug-dump=use-debuginfod}]
  4050. [@option{-wE}|@option{--debug-dump=do-not-use-debuginfod}]
  4051. [@option{-P}|@option{--process-links}]
  4052. [@option{--dwarf-depth=@var{n}}]
  4053. [@option{--dwarf-start=@var{n}}]
  4054. [@option{--ctf=}@var{section}]
  4055. [@option{--ctf-parent=}@var{section}]
  4056. [@option{--ctf-symbols=}@var{section}]
  4057. [@option{--ctf-strings=}@var{section}]
  4058. [@option{-I}|@option{--histogram}]
  4059. [@option{-v}|@option{--version}]
  4060. [@option{-W}|@option{--wide}]
  4061. [@option{-T}|@option{--silent-truncation}]
  4062. [@option{-H}|@option{--help}]
  4063. @var{elffile}@dots{}
  4064. @c man end
  4065. @end smallexample
  4066. @c man begin DESCRIPTION readelf
  4067. @command{readelf} displays information about one or more ELF format object
  4068. files. The options control what particular information to display.
  4069. @var{elffile}@dots{} are the object files to be examined. 32-bit and
  4070. 64-bit ELF files are supported, as are archives containing ELF files.
  4071. This program performs a similar function to @command{objdump} but it
  4072. goes into more detail and it exists independently of the @sc{bfd}
  4073. library, so if there is a bug in @sc{bfd} then readelf will not be
  4074. affected.
  4075. @c man end
  4076. @c man begin OPTIONS readelf
  4077. The long and short forms of options, shown here as alternatives, are
  4078. equivalent. At least one option besides @samp{-v} or @samp{-H} must be
  4079. given.
  4080. @table @env
  4081. @item -a
  4082. @itemx --all
  4083. Equivalent to specifying @option{--file-header},
  4084. @option{--program-headers}, @option{--sections}, @option{--symbols},
  4085. @option{--relocs}, @option{--dynamic}, @option{--notes},
  4086. @option{--version-info}, @option{--arch-specific}, @option{--unwind},
  4087. @option{--section-groups} and @option{--histogram}.
  4088. Note - this option does not enable @option{--use-dynamic} itself, so
  4089. if that option is not present on the command line then dynamic symbols
  4090. and dynamic relocs will not be displayed.
  4091. @item -h
  4092. @itemx --file-header
  4093. @cindex ELF file header information
  4094. Displays the information contained in the ELF header at the start of the
  4095. file.
  4096. @item -l
  4097. @itemx --program-headers
  4098. @itemx --segments
  4099. @cindex ELF program header information
  4100. @cindex ELF segment information
  4101. Displays the information contained in the file's segment headers, if it
  4102. has any.
  4103. @item --quiet
  4104. @cindex quiet
  4105. Suppress "no symbols" diagnostic.
  4106. @item -S
  4107. @itemx --sections
  4108. @itemx --section-headers
  4109. @cindex ELF section information
  4110. Displays the information contained in the file's section headers, if it
  4111. has any.
  4112. @item -g
  4113. @itemx --section-groups
  4114. @cindex ELF section group information
  4115. Displays the information contained in the file's section groups, if it
  4116. has any.
  4117. @item -t
  4118. @itemx --section-details
  4119. @cindex ELF section information
  4120. Displays the detailed section information. Implies @option{-S}.
  4121. @item -s
  4122. @itemx --symbols
  4123. @itemx --syms
  4124. @cindex ELF symbol table information
  4125. Displays the entries in symbol table section of the file, if it has one.
  4126. If a symbol has version information associated with it then this is
  4127. displayed as well. The version string is displayed as a suffix to the
  4128. symbol name, preceded by an @@ character. For example
  4129. @samp{foo@@VER_1}. If the version is the default version to be used
  4130. when resolving unversioned references to the symbol then it is
  4131. displayed as a suffix preceded by two @@ characters. For example
  4132. @samp{foo@@@@VER_2}.
  4133. @item --dyn-syms
  4134. @cindex ELF dynamic symbol table information
  4135. Displays the entries in dynamic symbol table section of the file, if it
  4136. has one. The output format is the same as the format used by the
  4137. @option{--syms} option.
  4138. @item --lto-syms
  4139. @cindex LTO symbol table
  4140. Displays the contents of any LTO symbol tables in the file.
  4141. @item --sym-base=[0|8|10|16]
  4142. @cindex symbol table size base
  4143. Forces the size field of the symbol table to use the given base. Any
  4144. unrecognized options will be treated as @samp{0}. @option{--sym-base=0}
  4145. represents the default and legacy behaviour. This will output sizes as decimal
  4146. for numbers less than 100000. For sizes 100000 and greater hexadecimal notation
  4147. will be used with a 0x prefix.
  4148. @option{--sym-base=8} will give the symbol sizes in octal.
  4149. @option{--sym-base=10} will always give the symbol sizes in decimal.
  4150. @option{--sym-base=16} will always give the symbol sizes in hexadecimal with a
  4151. 0x prefix.
  4152. @item -C
  4153. @itemx --demangle[=@var{style}]
  4154. @cindex demangling in nm
  4155. Decode (@dfn{demangle}) low-level symbol names into user-level names.
  4156. This makes C++ function names readable. Different compilers have
  4157. different mangling styles. The optional demangling style argument can
  4158. be used to choose an appropriate demangling style for your
  4159. compiler. @xref{c++filt}, for more information on demangling.
  4160. @item --no-demangle
  4161. Do not demangle low-level symbol names. This is the default.
  4162. @item --recurse-limit
  4163. @itemx --no-recurse-limit
  4164. @itemx --recursion-limit
  4165. @itemx --no-recursion-limit
  4166. Enables or disables a limit on the amount of recursion performed
  4167. whilst demangling strings. Since the name mangling formats allow for
  4168. an infinite level of recursion it is possible to create strings whose
  4169. decoding will exhaust the amount of stack space available on the host
  4170. machine, triggering a memory fault. The limit tries to prevent this
  4171. from happening by restricting recursion to 2048 levels of nesting.
  4172. The default is for this limit to be enabled, but disabling it may be
  4173. necessary in order to demangle truly complicated names. Note however
  4174. that if the recursion limit is disabled then stack exhaustion is
  4175. possible and any bug reports about such an event will be rejected.
  4176. @item -U @var{[d|i|l|e|x|h]}
  4177. @itemx --unicode=[default|invalid|locale|escape|hex|highlight]
  4178. Controls the display of non-ASCII characters in identifier names.
  4179. The default (@option{--unicode=locale} or @option{--unicode=default}) is
  4180. to treat them as multibyte characters and display them in the current
  4181. locale. All other versions of this option treat the bytes as UTF-8
  4182. encoded values and attempt to interpret them. If they cannot be
  4183. interpreted or if the @option{--unicode=invalid} option is used then
  4184. they are displayed as a sequence of hex bytes, encloses in curly
  4185. parethesis characters.
  4186. Using the @option{--unicode=escape} option will display the characters
  4187. as as unicode escape sequences (@var{\uxxxx}). Using the
  4188. @option{--unicode=hex} will display the characters as hex byte
  4189. sequences enclosed between angle brackets.
  4190. Using the @option{--unicode=highlight} will display the characters as
  4191. unicode escape sequences but it will also highlighted them in red,
  4192. assuming that colouring is supported by the output device. The
  4193. colouring is intended to draw attention to the presence of unicode
  4194. sequences when they might not be expected.
  4195. @item -e
  4196. @itemx --headers
  4197. Display all the headers in the file. Equivalent to @option{-h -l -S}.
  4198. @item -n
  4199. @itemx --notes
  4200. @cindex ELF notes
  4201. Displays the contents of the NOTE segments and/or sections, if any.
  4202. @item -r
  4203. @itemx --relocs
  4204. @cindex ELF reloc information
  4205. Displays the contents of the file's relocation section, if it has one.
  4206. @item -u
  4207. @itemx --unwind
  4208. @cindex unwind information
  4209. Displays the contents of the file's unwind section, if it has one. Only
  4210. the unwind sections for IA64 ELF files, as well as ARM unwind tables
  4211. (@code{.ARM.exidx} / @code{.ARM.extab}) are currently supported. If
  4212. support is not yet implemented for your architecture you could try
  4213. dumping the contents of the @var{.eh_frames} section using the
  4214. @option{--debug-dump=frames} or @option{--debug-dump=frames-interp}
  4215. options.
  4216. @item -d
  4217. @itemx --dynamic
  4218. @cindex ELF dynamic section information
  4219. Displays the contents of the file's dynamic section, if it has one.
  4220. @item -V
  4221. @itemx --version-info
  4222. @cindex ELF version sections information
  4223. Displays the contents of the version sections in the file, it they
  4224. exist.
  4225. @item -A
  4226. @itemx --arch-specific
  4227. Displays architecture-specific information in the file, if there
  4228. is any.
  4229. @item -D
  4230. @itemx --use-dynamic
  4231. When displaying symbols, this option makes @command{readelf} use the
  4232. symbol hash tables in the file's dynamic section, rather than the
  4233. symbol table sections.
  4234. When displaying relocations, this option makes @command{readelf}
  4235. display the dynamic relocations rather than the static relocations.
  4236. @item -L
  4237. @itemx --lint
  4238. @itemx --enable-checks
  4239. Displays warning messages about possible problems with the file(s)
  4240. being examined. If used on its own then all of the contents of the
  4241. file(s) will be examined. If used with one of the dumping options
  4242. then the warning messages will only be produced for the things being
  4243. displayed.
  4244. @item -x <number or name>
  4245. @itemx --hex-dump=<number or name>
  4246. Displays the contents of the indicated section as a hexadecimal bytes.
  4247. A number identifies a particular section by index in the section table;
  4248. any other string identifies all sections with that name in the object file.
  4249. @item -R <number or name>
  4250. @itemx --relocated-dump=<number or name>
  4251. Displays the contents of the indicated section as a hexadecimal
  4252. bytes. A number identifies a particular section by index in the
  4253. section table; any other string identifies all sections with that name
  4254. in the object file. The contents of the section will be relocated
  4255. before they are displayed.
  4256. @item -p <number or name>
  4257. @itemx --string-dump=<number or name>
  4258. Displays the contents of the indicated section as printable strings.
  4259. A number identifies a particular section by index in the section table;
  4260. any other string identifies all sections with that name in the object file.
  4261. @item -z
  4262. @itemx --decompress
  4263. Requests that the section(s) being dumped by @option{x}, @option{R} or
  4264. @option{p} options are decompressed before being displayed. If the
  4265. section(s) are not compressed then they are displayed as is.
  4266. @item -c
  4267. @itemx --archive-index
  4268. @cindex Archive file symbol index information
  4269. Displays the file symbol index information contained in the header part
  4270. of binary archives. Performs the same function as the @option{t}
  4271. command to @command{ar}, but without using the BFD library. @xref{ar}.
  4272. @item -w[lLiaprmfFsOoRtUuTgAckK]
  4273. @itemx --debug-dump[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links,=follow-links]
  4274. @include debug.options.texi
  4275. @item -P
  4276. @itemx --process-links
  4277. Display the contents of non-debug sections found in separate debuginfo
  4278. files that are linked to the main file. This option automatically
  4279. implies the @option{-wK} option, and only sections requested by other
  4280. command line options will be displayed.
  4281. @include ctf.options.texi
  4282. @item --ctf-symbols=@var{section}
  4283. @item --ctf-strings=@var{section}
  4284. Specify the name of another section from which the CTF file can inherit
  4285. strings and symbols. By default, the @code{.symtab} and its linked
  4286. string table are used.
  4287. If either of @option{--ctf-symbols} or @option{--ctf-strings} is specified, the
  4288. other must be specified as well.
  4289. @item -I
  4290. @itemx --histogram
  4291. Display a histogram of bucket list lengths when displaying the contents
  4292. of the symbol tables.
  4293. @item -v
  4294. @itemx --version
  4295. Display the version number of readelf.
  4296. @item -W
  4297. @itemx --wide
  4298. Don't break output lines to fit into 80 columns. By default
  4299. @command{readelf} breaks section header and segment listing lines for
  4300. 64-bit ELF files, so that they fit into 80 columns. This option causes
  4301. @command{readelf} to print each section header resp. each segment one a
  4302. single line, which is far more readable on terminals wider than 80 columns.
  4303. @item -T
  4304. @itemx --silent-truncation
  4305. Normally when readelf is displaying a symbol name, and it has to
  4306. truncate the name to fit into an 80 column display, it will add a
  4307. suffix of @code{[...]} to the name. This command line option
  4308. disables this behaviour, allowing 5 more characters of the name to be
  4309. displayed and restoring the old behaviour of readelf (prior to release
  4310. 2.35).
  4311. @item -H
  4312. @itemx --help
  4313. Display the command-line options understood by @command{readelf}.
  4314. @end table
  4315. @c man end
  4316. @ignore
  4317. @c man begin SEEALSO readelf
  4318. objdump(1), and the Info entries for @file{binutils}.
  4319. @c man end
  4320. @end ignore
  4321. @node elfedit
  4322. @chapter elfedit
  4323. @cindex Update ELF header
  4324. @kindex elfedit
  4325. @c man title elfedit update ELF header and program property of ELF files
  4326. @smallexample
  4327. @c man begin SYNOPSIS elfedit
  4328. elfedit [@option{--input-mach=}@var{machine}]
  4329. [@option{--input-type=}@var{type}]
  4330. [@option{--input-osabi=}@var{osabi}]
  4331. [@option{--input-abiversion=}@var{version}]
  4332. @option{--output-mach=}@var{machine}
  4333. @option{--output-type=}@var{type}
  4334. @option{--output-osabi=}@var{osabi}
  4335. @option{--output-abiversion=}@var{version}
  4336. @option{--enable-x86-feature=}@var{feature}
  4337. @option{--disable-x86-feature=}@var{feature}
  4338. [@option{-v}|@option{--version}]
  4339. [@option{-h}|@option{--help}]
  4340. @var{elffile}@dots{}
  4341. @c man end
  4342. @end smallexample
  4343. @c man begin DESCRIPTION elfedit
  4344. @command{elfedit} updates the ELF header and program property of ELF
  4345. files which have the matching ELF machine and file types. The options
  4346. control how and which fields in the ELF header and program property
  4347. should be updated.
  4348. @var{elffile}@dots{} are the ELF files to be updated. 32-bit and
  4349. 64-bit ELF files are supported, as are archives containing ELF files.
  4350. @c man end
  4351. @c man begin OPTIONS elfedit
  4352. The long and short forms of options, shown here as alternatives, are
  4353. equivalent. At least one of the @option{--output-mach},
  4354. @option{--output-type}, @option{--output-osabi},
  4355. @option{--output-abiversion},
  4356. @option{--enable-x86-feature} and @option{--disable-x86-feature}
  4357. options must be given.
  4358. @table @env
  4359. @item --input-mach=@var{machine}
  4360. Set the matching input ELF machine type to @var{machine}. If
  4361. @option{--input-mach} isn't specified, it will match any ELF
  4362. machine types.
  4363. The supported ELF machine types are, @var{i386}, @var{IAMCU}, @var{L1OM},
  4364. @var{K1OM} and @var{x86-64}.
  4365. @item --output-mach=@var{machine}
  4366. Change the ELF machine type in the ELF header to @var{machine}. The
  4367. supported ELF machine types are the same as @option{--input-mach}.
  4368. @item --input-type=@var{type}
  4369. Set the matching input ELF file type to @var{type}. If
  4370. @option{--input-type} isn't specified, it will match any ELF file types.
  4371. The supported ELF file types are, @var{rel}, @var{exec} and @var{dyn}.
  4372. @item --output-type=@var{type}
  4373. Change the ELF file type in the ELF header to @var{type}. The
  4374. supported ELF types are the same as @option{--input-type}.
  4375. @item --input-osabi=@var{osabi}
  4376. Set the matching input ELF file OSABI to @var{osabi}. If
  4377. @option{--input-osabi} isn't specified, it will match any ELF OSABIs.
  4378. The supported ELF OSABIs are, @var{none}, @var{HPUX}, @var{NetBSD},
  4379. @var{GNU}, @var{Linux} (alias for @var{GNU}),
  4380. @var{Solaris}, @var{AIX}, @var{Irix},
  4381. @var{FreeBSD}, @var{TRU64}, @var{Modesto}, @var{OpenBSD}, @var{OpenVMS},
  4382. @var{NSK}, @var{AROS} and @var{FenixOS}.
  4383. @item --output-osabi=@var{osabi}
  4384. Change the ELF OSABI in the ELF header to @var{osabi}. The
  4385. supported ELF OSABI are the same as @option{--input-osabi}.
  4386. @item --input-abiversion=@var{version}
  4387. Set the matching input ELF file ABIVERSION to @var{version}.
  4388. @var{version} must be between 0 and 255. If @option{--input-abiversion}
  4389. isn't specified, it will match any ELF ABIVERSIONs.
  4390. @item --output-abiversion=@var{version}
  4391. Change the ELF ABIVERSION in the ELF header to @var{version}.
  4392. @var{version} must be between 0 and 255.
  4393. @item --enable-x86-feature=@var{feature}
  4394. Set the @var{feature} bit in program property in @var{exec} or @var{dyn}
  4395. ELF files with machine types of @var{i386} or @var{x86-64}. The
  4396. supported features are, @var{ibt}, @var{shstk}, @var{lam_u48} and
  4397. @var{lam_u57}.
  4398. @item --disable-x86-feature=@var{feature}
  4399. Clear the @var{feature} bit in program property in @var{exec} or
  4400. @var{dyn} ELF files with machine types of @var{i386} or @var{x86-64}.
  4401. The supported features are the same as @option{--enable-x86-feature}.
  4402. Note: @option{--enable-x86-feature} and @option{--disable-x86-feature}
  4403. are available only on hosts with @samp{mmap} support.
  4404. @item -v
  4405. @itemx --version
  4406. Display the version number of @command{elfedit}.
  4407. @item -h
  4408. @itemx --help
  4409. Display the command-line options understood by @command{elfedit}.
  4410. @end table
  4411. @c man end
  4412. @ignore
  4413. @c man begin SEEALSO elfedit
  4414. readelf(1), and the Info entries for @file{binutils}.
  4415. @c man end
  4416. @end ignore
  4417. @node Common Options
  4418. @chapter Common Options
  4419. The following command-line options are supported by all of the
  4420. programs described in this manual.
  4421. @c man begin OPTIONS
  4422. @table @env
  4423. @include at-file.texi
  4424. @c man end
  4425. @item --help
  4426. Display the command-line options supported by the program.
  4427. @item --version
  4428. Display the version number of the program.
  4429. @c man begin OPTIONS
  4430. @end table
  4431. @c man end
  4432. @node Selecting the Target System
  4433. @chapter Selecting the Target System
  4434. You can specify two aspects of the target system to the @sc{gnu}
  4435. binary file utilities, each in several ways:
  4436. @itemize @bullet
  4437. @item
  4438. the target
  4439. @item
  4440. the architecture
  4441. @end itemize
  4442. In the following summaries, the lists of ways to specify values are in
  4443. order of decreasing precedence. The ways listed first override those
  4444. listed later.
  4445. The commands to list valid values only list the values for which the
  4446. programs you are running were configured. If they were configured with
  4447. @option{--enable-targets=all}, the commands list most of the available
  4448. values, but a few are left out; not all targets can be configured in at
  4449. once because some of them can only be configured @dfn{native} (on hosts
  4450. with the same type as the target system).
  4451. @menu
  4452. * Target Selection::
  4453. * Architecture Selection::
  4454. @end menu
  4455. @node Target Selection
  4456. @section Target Selection
  4457. A @dfn{target} is an object file format. A given target may be
  4458. supported for multiple architectures (@pxref{Architecture Selection}).
  4459. A target selection may also have variations for different operating
  4460. systems or architectures.
  4461. The command to list valid target values is @samp{objdump -i}
  4462. (the first column of output contains the relevant information).
  4463. Some sample values are: @samp{a.out-hp300bsd}, @samp{ecoff-littlemips},
  4464. @samp{a.out-sunos-big}.
  4465. You can also specify a target using a configuration triplet. This is
  4466. the same sort of name that is passed to @file{configure} to specify a
  4467. target. When you use a configuration triplet as an argument, it must be
  4468. fully canonicalized. You can see the canonical version of a triplet by
  4469. running the shell script @file{config.sub} which is included with the
  4470. sources.
  4471. Some sample configuration triplets are: @samp{m68k-hp-bsd},
  4472. @samp{mips-dec-ultrix}, @samp{sparc-sun-sunos}.
  4473. @subheading @command{objdump} Target
  4474. Ways to specify:
  4475. @enumerate
  4476. @item
  4477. command-line option: @option{-b} or @option{--target}
  4478. @item
  4479. environment variable @code{GNUTARGET}
  4480. @item
  4481. deduced from the input file
  4482. @end enumerate
  4483. @subheading @command{objcopy} and @command{strip} Input Target
  4484. Ways to specify:
  4485. @enumerate
  4486. @item
  4487. command-line options: @option{-I} or @option{--input-target}, or @option{-F} or @option{--target}
  4488. @item
  4489. environment variable @code{GNUTARGET}
  4490. @item
  4491. deduced from the input file
  4492. @end enumerate
  4493. @subheading @command{objcopy} and @command{strip} Output Target
  4494. Ways to specify:
  4495. @enumerate
  4496. @item
  4497. command-line options: @option{-O} or @option{--output-target}, or @option{-F} or @option{--target}
  4498. @item
  4499. the input target (see ``@command{objcopy} and @command{strip} Input Target'' above)
  4500. @item
  4501. environment variable @code{GNUTARGET}
  4502. @item
  4503. deduced from the input file
  4504. @end enumerate
  4505. @subheading @command{nm}, @command{size}, and @command{strings} Target
  4506. Ways to specify:
  4507. @enumerate
  4508. @item
  4509. command-line option: @option{--target}
  4510. @item
  4511. environment variable @code{GNUTARGET}
  4512. @item
  4513. deduced from the input file
  4514. @end enumerate
  4515. @node Architecture Selection
  4516. @section Architecture Selection
  4517. An @dfn{architecture} is a type of @sc{cpu} on which an object file is
  4518. to run. Its name may contain a colon, separating the name of the
  4519. processor family from the name of the particular @sc{cpu}.
  4520. The command to list valid architecture values is @samp{objdump -i} (the
  4521. second column contains the relevant information).
  4522. Sample values: @samp{m68k:68020}, @samp{mips:3000}, @samp{sparc}.
  4523. @subheading @command{objdump} Architecture
  4524. Ways to specify:
  4525. @enumerate
  4526. @item
  4527. command-line option: @option{-m} or @option{--architecture}
  4528. @item
  4529. deduced from the input file
  4530. @end enumerate
  4531. @subheading @command{objcopy}, @command{nm}, @command{size}, @command{strings} Architecture
  4532. Ways to specify:
  4533. @enumerate
  4534. @item
  4535. deduced from the input file
  4536. @end enumerate
  4537. @node debuginfod
  4538. @chapter debuginfod
  4539. @cindex separate debug files
  4540. debuginfod is a web service that indexes ELF/DWARF debugging resources
  4541. by build-id and serves them over HTTP. For more information see:
  4542. @emph{https://sourceware.org/elfutils/Debuginfod.html}
  4543. Binutils can be built with the debuginfod client library
  4544. @code{libdebuginfod} using the @option{--with-debuginfod} configure option.
  4545. This option is enabled by default if @code{libdebuginfod} is installed
  4546. and found at configure time. This allows @command{objdump} and
  4547. @command{readelf} to automatically query debuginfod servers for
  4548. separate debug files when the files are otherwise not found.
  4549. debuginfod is packaged with elfutils, starting with version 0.178.
  4550. You can get the latest version from `https://sourceware.org/elfutils/'.
  4551. The DWARF info dumping tools (@command{readelf} and @command{objdump})
  4552. have options to control when they should access the debuginfod
  4553. servers. By default this access is enabled.
  4554. @node Reporting Bugs
  4555. @chapter Reporting Bugs
  4556. @cindex bugs
  4557. @cindex reporting bugs
  4558. Your bug reports play an essential role in making the binary utilities
  4559. reliable.
  4560. Reporting a bug may help you by bringing a solution to your problem, or
  4561. it may not. But in any case the principal function of a bug report is
  4562. to help the entire community by making the next version of the binary
  4563. utilities work better. Bug reports are your contribution to their
  4564. maintenance.
  4565. In order for a bug report to serve its purpose, you must include the
  4566. information that enables us to fix the bug.
  4567. @menu
  4568. * Bug Criteria:: Have you found a bug?
  4569. * Bug Reporting:: How to report bugs
  4570. @end menu
  4571. @node Bug Criteria
  4572. @section Have You Found a Bug?
  4573. @cindex bug criteria
  4574. If you are not sure whether you have found a bug, here are some guidelines:
  4575. @itemize @bullet
  4576. @cindex fatal signal
  4577. @cindex crash
  4578. @item
  4579. If a binary utility gets a fatal signal, for any input whatever, that is
  4580. a bug. Reliable utilities never crash.
  4581. @cindex error on valid input
  4582. @item
  4583. If a binary utility produces an error message for valid input, that is a
  4584. bug.
  4585. @item
  4586. If you are an experienced user of binary utilities, your suggestions for
  4587. improvement are welcome in any case.
  4588. @end itemize
  4589. @node Bug Reporting
  4590. @section How to Report Bugs
  4591. @cindex bug reports
  4592. @cindex bugs, reporting
  4593. A number of companies and individuals offer support for @sc{gnu}
  4594. products. If you obtained the binary utilities from a support
  4595. organization, we recommend you contact that organization first.
  4596. You can find contact information for many support companies and
  4597. individuals in the file @file{etc/SERVICE} in the @sc{gnu} Emacs
  4598. distribution.
  4599. @ifset BUGURL
  4600. In any event, we also recommend that you send bug reports for the binary
  4601. utilities to @value{BUGURL}.
  4602. @end ifset
  4603. The fundamental principle of reporting bugs usefully is this:
  4604. @strong{report all the facts}. If you are not sure whether to state a
  4605. fact or leave it out, state it!
  4606. Often people omit facts because they think they know what causes the
  4607. problem and assume that some details do not matter. Thus, you might
  4608. assume that the name of a file you use in an example does not matter.
  4609. Well, probably it does not, but one cannot be sure. Perhaps the bug is
  4610. a stray memory reference which happens to fetch from the location where
  4611. that pathname is stored in memory; perhaps, if the pathname were
  4612. different, the contents of that location would fool the utility into
  4613. doing the right thing despite the bug. Play it safe and give a
  4614. specific, complete example. That is the easiest thing for you to do,
  4615. and the most helpful.
  4616. Keep in mind that the purpose of a bug report is to enable us to fix the bug if
  4617. it is new to us. Therefore, always write your bug reports on the assumption
  4618. that the bug has not been reported previously.
  4619. Sometimes people give a few sketchy facts and ask, ``Does this ring a
  4620. bell?'' This cannot help us fix a bug, so it is basically useless. We
  4621. respond by asking for enough details to enable us to investigate.
  4622. You might as well expedite matters by sending them to begin with.
  4623. To enable us to fix the bug, you should include all these things:
  4624. @itemize @bullet
  4625. @item
  4626. The version of the utility. Each utility announces it if you start it
  4627. with the @option{--version} argument.
  4628. Without this, we will not know whether there is any point in looking for
  4629. the bug in the current version of the binary utilities.
  4630. @item
  4631. Any patches you may have applied to the source, including any patches
  4632. made to the @code{BFD} library.
  4633. @item
  4634. The type of machine you are using, and the operating system name and
  4635. version number.
  4636. @item
  4637. What compiler (and its version) was used to compile the utilities---e.g.
  4638. ``@code{gcc-2.7}''.
  4639. @item
  4640. The command arguments you gave the utility to observe the bug. To
  4641. guarantee you will not omit something important, list them all. A copy
  4642. of the Makefile (or the output from make) is sufficient.
  4643. If we were to try to guess the arguments, we would probably guess wrong
  4644. and then we might not encounter the bug.
  4645. @item
  4646. A complete input file, or set of input files, that will reproduce the
  4647. bug. If the utility is reading an object file or files, then it is
  4648. generally most helpful to send the actual object files.
  4649. If the source files were produced exclusively using @sc{gnu} programs
  4650. (e.g., @command{gcc}, @command{gas}, and/or the @sc{gnu} @command{ld}), then it
  4651. may be OK to send the source files rather than the object files. In
  4652. this case, be sure to say exactly what version of @command{gcc}, or
  4653. whatever, was used to produce the object files. Also say how
  4654. @command{gcc}, or whatever, was configured.
  4655. @item
  4656. A description of what behavior you observe that you believe is
  4657. incorrect. For example, ``It gets a fatal signal.''
  4658. Of course, if the bug is that the utility gets a fatal signal, then we
  4659. will certainly notice it. But if the bug is incorrect output, we might
  4660. not notice unless it is glaringly wrong. You might as well not give us
  4661. a chance to make a mistake.
  4662. Even if the problem you experience is a fatal signal, you should still
  4663. say so explicitly. Suppose something strange is going on, such as your
  4664. copy of the utility is out of sync, or you have encountered a bug in
  4665. the C library on your system. (This has happened!) Your copy might
  4666. crash and ours would not. If you told us to expect a crash, then when
  4667. ours fails to crash, we would know that the bug was not happening for
  4668. us. If you had not told us to expect a crash, then we would not be able
  4669. to draw any conclusion from our observations.
  4670. @item
  4671. If you wish to suggest changes to the source, send us context diffs, as
  4672. generated by @command{diff} with the @option{-u}, @option{-c}, or @option{-p}
  4673. option. Always send diffs from the old file to the new file. If you
  4674. wish to discuss something in the @command{ld} source, refer to it by
  4675. context, not by line number.
  4676. The line numbers in our development sources will not match those in your
  4677. sources. Your line numbers would convey no useful information to us.
  4678. @end itemize
  4679. Here are some things that are not necessary:
  4680. @itemize @bullet
  4681. @item
  4682. A description of the envelope of the bug.
  4683. Often people who encounter a bug spend a lot of time investigating
  4684. which changes to the input file will make the bug go away and which
  4685. changes will not affect it.
  4686. This is often time consuming and not very useful, because the way we
  4687. will find the bug is by running a single example under the debugger
  4688. with breakpoints, not by pure deduction from a series of examples.
  4689. We recommend that you save your time for something else.
  4690. Of course, if you can find a simpler example to report @emph{instead}
  4691. of the original one, that is a convenience for us. Errors in the
  4692. output will be easier to spot, running under the debugger will take
  4693. less time, and so on.
  4694. However, simplification is not vital; if you do not want to do this,
  4695. report the bug anyway and send us the entire test case you used.
  4696. @item
  4697. A patch for the bug.
  4698. A patch for the bug does help us if it is a good one. But do not omit
  4699. the necessary information, such as the test case, on the assumption that
  4700. a patch is all we need. We might see problems with your patch and decide
  4701. to fix the problem another way, or we might not understand it at all.
  4702. Sometimes with programs as complicated as the binary utilities it is
  4703. very hard to construct an example that will make the program follow a
  4704. certain path through the code. If you do not send us the example, we
  4705. will not be able to construct one, so we will not be able to verify that
  4706. the bug is fixed.
  4707. And if we cannot understand what bug you are trying to fix, or why your
  4708. patch should be an improvement, we will not install it. A test case will
  4709. help us to understand.
  4710. @item
  4711. A guess about what the bug is or what it depends on.
  4712. Such guesses are usually wrong. Even we cannot guess right about such
  4713. things without first using the debugger to find the facts.
  4714. @end itemize
  4715. @node GNU Free Documentation License
  4716. @appendix GNU Free Documentation License
  4717. @include fdl.texi
  4718. @node Binutils Index
  4719. @unnumbered Binutils Index
  4720. @printindex cp
  4721. @bye