binutils.texi 194 KB

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