bfd.h 173 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273
  1. /* Main header file for the bfd library -- portable access to object files.
  2. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  3. 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
  4. Free Software Foundation, Inc.
  5. Contributed by Cygnus Support.
  6. Copyright 2007 Kevin Kofler
  7. This file is part of BFD, the Binary File Descriptor library.
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU General Public License for more details.
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
  19. #ifndef __BFD_H_SEEN__
  20. #define __BFD_H_SEEN__
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
  25. #ifndef SABER
  26. /* This hack is to avoid a problem with some strict ANSI C preprocessors.
  27. The problem is, "32_" is not a valid preprocessing token, and we don't
  28. want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
  29. cause the inner CONCAT2 macros to be evaluated first, producing
  30. still-valid pp-tokens. Then the final concatenation can be done. */
  31. #undef CONCAT4
  32. #define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
  33. #endif
  34. #endif
  35. /* This is a utility macro to handle the situation where the code
  36. wants to place a constant string into the code, followed by a
  37. comma and then the length of the string. Doing this by hand
  38. is error prone, so using this macro is safer. The macro will
  39. also safely handle the case where a NULL is passed as the arg. */
  40. #define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
  41. /* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
  42. to create the arguments to another macro, since the preprocessor
  43. will mis-count the number of arguments to the outer macro (by not
  44. evaluating STRING_COMMA_LEN and so missing the comma). This is a
  45. problem for example when trying to use STRING_COMMA_LEN to build
  46. the arguments to the strncmp() macro. Hence this alternative
  47. definition of strncmp is provided here.
  48. Note - these macros do NOT work if STR2 is not a constant string. */
  49. #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
  50. /* strcpy() can have a similar problem, but since we know we are
  51. copying a constant string, we can use memcpy which will be faster
  52. since there is no need to check for a NUL byte inside STR. We
  53. can also save time if we do not need to copy the terminating NUL. */
  54. #define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
  55. #define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
  56. /* The word size used by BFD on the host. This may be 64 with a 32
  57. bit target if the host is 64 bit, or if other 64 bit targets have
  58. been selected with --enable-targets, or if --enable-64-bit-bfd. */
  59. #define BFD_ARCH_SIZE 32
  60. /* The word size of the default bfd target. */
  61. #define BFD_DEFAULT_TARGET_SIZE 32
  62. #define BFD_HOST_64BIT_LONG 0
  63. #define BFD_HOST_LONG_LONG 1
  64. #if 1
  65. #define BFD_HOST_64_BIT long long
  66. #define BFD_HOST_U_64_BIT unsigned long long
  67. typedef BFD_HOST_64_BIT bfd_int64_t;
  68. typedef BFD_HOST_U_64_BIT bfd_uint64_t;
  69. #endif
  70. #if BFD_ARCH_SIZE >= 64
  71. #define BFD64
  72. #endif
  73. #ifndef INLINE
  74. #if __GNUC__ >= 2
  75. #define INLINE __inline__
  76. #else
  77. #define INLINE
  78. #endif
  79. #endif
  80. /* Forward declaration. */
  81. typedef struct bfd bfd;
  82. /* Boolean type used in bfd. Too many systems define their own
  83. versions of "boolean" for us to safely typedef a "boolean" of
  84. our own. Using an enum for "bfd_boolean" has its own set of
  85. problems, with strange looking casts required to avoid warnings
  86. on some older compilers. Thus we just use an int.
  87. General rule: Functions which are bfd_boolean return TRUE on
  88. success and FALSE on failure (unless they're a predicate). */
  89. typedef int bfd_boolean;
  90. #undef FALSE
  91. #undef TRUE
  92. #define FALSE 0
  93. #define TRUE 1
  94. #ifdef BFD64
  95. #ifndef BFD_HOST_64_BIT
  96. #error No 64 bit integer type available
  97. #endif /* ! defined (BFD_HOST_64_BIT) */
  98. typedef BFD_HOST_U_64_BIT bfd_vma;
  99. typedef BFD_HOST_64_BIT bfd_signed_vma;
  100. typedef BFD_HOST_U_64_BIT bfd_size_type;
  101. typedef BFD_HOST_U_64_BIT symvalue;
  102. #ifndef fprintf_vma
  103. #if BFD_HOST_64BIT_LONG
  104. #define sprintf_vma(s,x) sprintf (s, "%016lx", x)
  105. #define fprintf_vma(f,x) fprintf (f, "%016lx", x)
  106. #else
  107. #define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
  108. #define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
  109. #define fprintf_vma(s,x) \
  110. fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
  111. #define sprintf_vma(s,x) \
  112. sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
  113. #endif
  114. #endif
  115. #else /* not BFD64 */
  116. /* Represent a target address. Also used as a generic unsigned type
  117. which is guaranteed to be big enough to hold any arithmetic types
  118. we need to deal with. */
  119. typedef unsigned long bfd_vma;
  120. /* A generic signed type which is guaranteed to be big enough to hold any
  121. arithmetic types we need to deal with. Can be assumed to be compatible
  122. with bfd_vma in the same way that signed and unsigned ints are compatible
  123. (as parameters, in assignment, etc). */
  124. typedef long bfd_signed_vma;
  125. typedef unsigned long symvalue;
  126. typedef unsigned long bfd_size_type;
  127. /* Print a bfd_vma x on stream s. */
  128. #define fprintf_vma(s,x) fprintf (s, "%08lx", x)
  129. #define sprintf_vma(s,x) sprintf (s, "%08lx", x)
  130. #endif /* not BFD64 */
  131. #define HALF_BFD_SIZE_TYPE \
  132. (((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
  133. #ifndef BFD_HOST_64_BIT
  134. /* Fall back on a 32 bit type. The idea is to make these types always
  135. available for function return types, but in the case that
  136. BFD_HOST_64_BIT is undefined such a function should abort or
  137. otherwise signal an error. */
  138. typedef bfd_signed_vma bfd_int64_t;
  139. typedef bfd_vma bfd_uint64_t;
  140. #endif
  141. /* An offset into a file. BFD always uses the largest possible offset
  142. based on the build time availability of fseek, fseeko, or fseeko64. */
  143. typedef BFD_HOST_64_BIT file_ptr;
  144. typedef unsigned BFD_HOST_64_BIT ufile_ptr;
  145. extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
  146. extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
  147. #define printf_vma(x) fprintf_vma(stdout,x)
  148. #define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
  149. typedef unsigned int flagword; /* 32 bits of flags */
  150. typedef unsigned char bfd_byte;
  151. /* File formats. */
  152. typedef enum bfd_format
  153. {
  154. bfd_unknown = 0, /* File format is unknown. */
  155. bfd_object, /* Linker/assembler/compiler output. */
  156. bfd_archive, /* Object archive file. */
  157. bfd_core, /* Core dump. */
  158. bfd_type_end /* Marks the end; don't use it! */
  159. }
  160. bfd_format;
  161. /* Values that may appear in the flags field of a BFD. These also
  162. appear in the object_flags field of the bfd_target structure, where
  163. they indicate the set of flags used by that backend (not all flags
  164. are meaningful for all object file formats) (FIXME: at the moment,
  165. the object_flags values have mostly just been copied from backend
  166. to another, and are not necessarily correct). */
  167. /* No flags. */
  168. #define BFD_NO_FLAGS 0x00
  169. /* BFD contains relocation entries. */
  170. #define HAS_RELOC 0x01
  171. /* BFD is directly executable. */
  172. #define EXEC_P 0x02
  173. /* BFD has line number information (basically used for F_LNNO in a
  174. COFF header). */
  175. #define HAS_LINENO 0x04
  176. /* BFD has debugging information. */
  177. #define HAS_DEBUG 0x08
  178. /* BFD has symbols. */
  179. #define HAS_SYMS 0x10
  180. /* BFD has local symbols (basically used for F_LSYMS in a COFF
  181. header). */
  182. #define HAS_LOCALS 0x20
  183. /* BFD is a dynamic object. */
  184. #define DYNAMIC 0x40
  185. /* Text section is write protected (if D_PAGED is not set, this is
  186. like an a.out NMAGIC file) (the linker sets this by default, but
  187. clears it for -r or -N). */
  188. #define WP_TEXT 0x80
  189. /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
  190. linker sets this by default, but clears it for -r or -n or -N). */
  191. #define D_PAGED 0x100
  192. /* BFD is relaxable (this means that bfd_relax_section may be able to
  193. do something) (sometimes bfd_relax_section can do something even if
  194. this is not set). */
  195. #define BFD_IS_RELAXABLE 0x200
  196. /* This may be set before writing out a BFD to request using a
  197. traditional format. For example, this is used to request that when
  198. writing out an a.out object the symbols not be hashed to eliminate
  199. duplicates. */
  200. #define BFD_TRADITIONAL_FORMAT 0x400
  201. /* This flag indicates that the BFD contents are actually cached in
  202. memory. If this is set, iostream points to a bfd_in_memory struct. */
  203. #define BFD_IN_MEMORY 0x800
  204. /* The sections in this BFD specify a memory page. */
  205. #define HAS_LOAD_PAGE 0x1000
  206. /* This BFD has been created by the linker and doesn't correspond
  207. to any input file. */
  208. #define BFD_LINKER_CREATED 0x2000
  209. /* Symbols and relocation. */
  210. /* A count of carsyms (canonical archive symbols). */
  211. typedef unsigned long symindex;
  212. /* How to perform a relocation. */
  213. typedef const struct reloc_howto_struct reloc_howto_type;
  214. #define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
  215. /* General purpose part of a symbol X;
  216. target specific parts are in libcoff.h, libaout.h, etc. */
  217. #define bfd_get_section(x) ((x)->section)
  218. #define bfd_get_output_section(x) ((x)->section->output_section)
  219. #define bfd_set_section(x,y) ((x)->section) = (y)
  220. #define bfd_asymbol_base(x) ((x)->section->vma)
  221. #define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
  222. #define bfd_asymbol_name(x) ((x)->name)
  223. /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
  224. #define bfd_asymbol_bfd(x) ((x)->the_bfd)
  225. #define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
  226. /* A canonical archive symbol. */
  227. /* This is a type pun with struct ranlib on purpose! */
  228. typedef struct carsym
  229. {
  230. char *name;
  231. file_ptr file_offset; /* Look here to find the file. */
  232. }
  233. carsym; /* To make these you call a carsymogen. */
  234. /* Used in generating armaps (archive tables of contents).
  235. Perhaps just a forward definition would do? */
  236. struct orl /* Output ranlib. */
  237. {
  238. char **name; /* Symbol name. */
  239. union
  240. {
  241. file_ptr pos;
  242. bfd *abfd;
  243. } u; /* bfd* or file position. */
  244. int namidx; /* Index into string table. */
  245. };
  246. /* Linenumber stuff. */
  247. typedef struct lineno_cache_entry
  248. {
  249. unsigned int line_number; /* Linenumber from start of function. */
  250. union
  251. {
  252. struct bfd_symbol *sym; /* Function name. */
  253. bfd_vma offset; /* Offset into section. */
  254. } u;
  255. }
  256. alent;
  257. /* Object and core file sections. */
  258. #define align_power(addr, align) \
  259. (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
  260. typedef struct bfd_section *sec_ptr;
  261. #define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
  262. #define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
  263. #define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
  264. #define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
  265. #define bfd_section_name(bfd, ptr) ((ptr)->name)
  266. #define bfd_section_size(bfd, ptr) ((ptr)->size)
  267. #define bfd_get_section_size(ptr) ((ptr)->size)
  268. #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
  269. #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
  270. #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
  271. #define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
  272. #define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
  273. #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
  274. #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
  275. #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
  276. #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
  277. /* Find the address one past the end of SEC. */
  278. #define bfd_get_section_limit(bfd, sec) \
  279. (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
  280. / bfd_octets_per_byte (bfd))
  281. typedef struct stat stat_type;
  282. typedef enum bfd_print_symbol
  283. {
  284. bfd_print_symbol_name,
  285. bfd_print_symbol_more,
  286. bfd_print_symbol_all
  287. } bfd_print_symbol_type;
  288. /* Information about a symbol that nm needs. */
  289. typedef struct _symbol_info
  290. {
  291. symvalue value;
  292. char type;
  293. const char *name; /* Symbol name. */
  294. unsigned char stab_type; /* Stab type. */
  295. char stab_other; /* Stab other. */
  296. short stab_desc; /* Stab desc. */
  297. const char *stab_name; /* String for stab type. */
  298. } symbol_info;
  299. /* Get the name of a stabs type code. */
  300. extern const char *bfd_get_stab_name (int);
  301. /* Hash table routines. There is no way to free up a hash table. */
  302. /* An element in the hash table. Most uses will actually use a larger
  303. structure, and an instance of this will be the first field. */
  304. struct bfd_hash_entry
  305. {
  306. /* Next entry for this hash code. */
  307. struct bfd_hash_entry *next;
  308. /* String being hashed. */
  309. const char *string;
  310. /* Hash code. This is the full hash code, not the index into the
  311. table. */
  312. unsigned long hash;
  313. };
  314. /* A hash table. */
  315. struct bfd_hash_table
  316. {
  317. /* The hash array. */
  318. struct bfd_hash_entry **table;
  319. /* The number of slots in the hash table. */
  320. unsigned int size;
  321. /* The number of entries in the hash table. */
  322. unsigned int count;
  323. /* The size of elements. */
  324. unsigned int entsize;
  325. /* A function used to create new elements in the hash table. The
  326. first entry is itself a pointer to an element. When this
  327. function is first invoked, this pointer will be NULL. However,
  328. having the pointer permits a hierarchy of method functions to be
  329. built each of which calls the function in the superclass. Thus
  330. each function should be written to allocate a new block of memory
  331. only if the argument is NULL. */
  332. struct bfd_hash_entry *(*newfunc)
  333. (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
  334. /* An objalloc for this hash table. This is a struct objalloc *,
  335. but we use void * to avoid requiring the inclusion of objalloc.h. */
  336. void *memory;
  337. };
  338. /* Initialize a hash table. */
  339. extern bfd_boolean bfd_hash_table_init
  340. (struct bfd_hash_table *,
  341. struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
  342. struct bfd_hash_table *,
  343. const char *),
  344. unsigned int);
  345. /* Initialize a hash table specifying a size. */
  346. extern bfd_boolean bfd_hash_table_init_n
  347. (struct bfd_hash_table *,
  348. struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
  349. struct bfd_hash_table *,
  350. const char *),
  351. unsigned int, unsigned int);
  352. /* Free up a hash table. */
  353. extern void bfd_hash_table_free
  354. (struct bfd_hash_table *);
  355. /* Look up a string in a hash table. If CREATE is TRUE, a new entry
  356. will be created for this string if one does not already exist. The
  357. COPY argument must be TRUE if this routine should copy the string
  358. into newly allocated memory when adding an entry. */
  359. extern struct bfd_hash_entry *bfd_hash_lookup
  360. (struct bfd_hash_table *, const char *, bfd_boolean create,
  361. bfd_boolean copy);
  362. /* Replace an entry in a hash table. */
  363. extern void bfd_hash_replace
  364. (struct bfd_hash_table *, struct bfd_hash_entry *old,
  365. struct bfd_hash_entry *nw);
  366. /* Base method for creating a hash table entry. */
  367. extern struct bfd_hash_entry *bfd_hash_newfunc
  368. (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
  369. /* Grab some space for a hash table entry. */
  370. extern void *bfd_hash_allocate
  371. (struct bfd_hash_table *, unsigned int);
  372. /* Traverse a hash table in a random order, calling a function on each
  373. element. If the function returns FALSE, the traversal stops. The
  374. INFO argument is passed to the function. */
  375. extern void bfd_hash_traverse
  376. (struct bfd_hash_table *,
  377. bfd_boolean (*) (struct bfd_hash_entry *, void *),
  378. void *info);
  379. /* Allows the default size of a hash table to be configured. New hash
  380. tables allocated using bfd_hash_table_init will be created with
  381. this size. */
  382. extern void bfd_hash_set_default_size (bfd_size_type);
  383. /* This structure is used to keep track of stabs in sections
  384. information while linking. */
  385. struct stab_info
  386. {
  387. /* A hash table used to hold stabs strings. */
  388. struct bfd_strtab_hash *strings;
  389. /* The header file hash table. */
  390. struct bfd_hash_table includes;
  391. /* The first .stabstr section. */
  392. struct bfd_section *stabstr;
  393. };
  394. #define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
  395. /* User program access to BFD facilities. */
  396. /* Direct I/O routines, for programs which know more about the object
  397. file than BFD does. Use higher level routines if possible. */
  398. extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
  399. extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
  400. extern int bfd_seek (bfd *, file_ptr, int);
  401. extern file_ptr bfd_tell (bfd *);
  402. extern int bfd_flush (bfd *);
  403. extern int bfd_stat (bfd *, struct stat *);
  404. /* Deprecated old routines. */
  405. #if __GNUC__
  406. #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
  407. (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \
  408. bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
  409. #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
  410. (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
  411. bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
  412. #else
  413. #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
  414. (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
  415. bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
  416. #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
  417. (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
  418. bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
  419. #endif
  420. extern void warn_deprecated (const char *, const char *, int, const char *);
  421. /* Cast from const char * to char * so that caller can assign to
  422. a char * without a warning. */
  423. #define bfd_get_filename(abfd) ((char *) (abfd)->filename)
  424. #define bfd_get_cacheable(abfd) ((abfd)->cacheable)
  425. #define bfd_get_format(abfd) ((abfd)->format)
  426. #define bfd_get_target(abfd) ((abfd)->xvec->name)
  427. #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
  428. #define bfd_family_coff(abfd) \
  429. (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
  430. bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
  431. #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
  432. #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
  433. #define bfd_header_big_endian(abfd) \
  434. ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
  435. #define bfd_header_little_endian(abfd) \
  436. ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
  437. #define bfd_get_file_flags(abfd) ((abfd)->flags)
  438. #define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
  439. #define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
  440. #define bfd_my_archive(abfd) ((abfd)->my_archive)
  441. #define bfd_has_map(abfd) ((abfd)->has_armap)
  442. #define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
  443. #define bfd_usrdata(abfd) ((abfd)->usrdata)
  444. #define bfd_get_start_address(abfd) ((abfd)->start_address)
  445. #define bfd_get_symcount(abfd) ((abfd)->symcount)
  446. #define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
  447. #define bfd_count_sections(abfd) ((abfd)->section_count)
  448. #define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
  449. #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
  450. #define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
  451. extern bfd_boolean bfd_cache_close
  452. (bfd *abfd);
  453. /* NB: This declaration should match the autogenerated one in libbfd.h. */
  454. extern bfd_boolean bfd_cache_close_all (void);
  455. extern bfd_boolean bfd_record_phdr
  456. (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
  457. bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
  458. /* Byte swapping routines. */
  459. bfd_uint64_t bfd_getb64 (const void *);
  460. bfd_uint64_t bfd_getl64 (const void *);
  461. bfd_int64_t bfd_getb_signed_64 (const void *);
  462. bfd_int64_t bfd_getl_signed_64 (const void *);
  463. bfd_vma bfd_getb32 (const void *);
  464. bfd_vma bfd_getl32 (const void *);
  465. bfd_signed_vma bfd_getb_signed_32 (const void *);
  466. bfd_signed_vma bfd_getl_signed_32 (const void *);
  467. bfd_vma bfd_getb16 (const void *);
  468. bfd_vma bfd_getl16 (const void *);
  469. bfd_signed_vma bfd_getb_signed_16 (const void *);
  470. bfd_signed_vma bfd_getl_signed_16 (const void *);
  471. void bfd_putb64 (bfd_uint64_t, void *);
  472. void bfd_putl64 (bfd_uint64_t, void *);
  473. void bfd_putb32 (bfd_vma, void *);
  474. void bfd_putl32 (bfd_vma, void *);
  475. void bfd_putb16 (bfd_vma, void *);
  476. void bfd_putl16 (bfd_vma, void *);
  477. /* Byte swapping routines which take size and endiannes as arguments. */
  478. bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
  479. void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
  480. extern bfd_boolean bfd_section_already_linked_table_init (void);
  481. extern void bfd_section_already_linked_table_free (void);
  482. /* Externally visible ECOFF routines. */
  483. #if defined(__STDC__) || defined(ALMOST_STDC)
  484. struct ecoff_debug_info;
  485. struct ecoff_debug_swap;
  486. struct ecoff_extr;
  487. struct bfd_symbol;
  488. struct bfd_link_info;
  489. struct bfd_link_hash_entry;
  490. struct bfd_elf_version_tree;
  491. #endif
  492. extern bfd_vma bfd_ecoff_get_gp_value
  493. (bfd * abfd);
  494. extern bfd_boolean bfd_ecoff_set_gp_value
  495. (bfd *abfd, bfd_vma gp_value);
  496. extern bfd_boolean bfd_ecoff_set_regmasks
  497. (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
  498. unsigned long *cprmask);
  499. extern void *bfd_ecoff_debug_init
  500. (bfd *output_bfd, struct ecoff_debug_info *output_debug,
  501. const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
  502. extern void bfd_ecoff_debug_free
  503. (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
  504. const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
  505. extern bfd_boolean bfd_ecoff_debug_accumulate
  506. (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
  507. const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
  508. struct ecoff_debug_info *input_debug,
  509. const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
  510. extern bfd_boolean bfd_ecoff_debug_accumulate_other
  511. (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
  512. const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
  513. struct bfd_link_info *);
  514. extern bfd_boolean bfd_ecoff_debug_externals
  515. (bfd *abfd, struct ecoff_debug_info *debug,
  516. const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
  517. bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
  518. void (*set_index) (struct bfd_symbol *, bfd_size_type));
  519. extern bfd_boolean bfd_ecoff_debug_one_external
  520. (bfd *abfd, struct ecoff_debug_info *debug,
  521. const struct ecoff_debug_swap *swap, const char *name,
  522. struct ecoff_extr *esym);
  523. extern bfd_size_type bfd_ecoff_debug_size
  524. (bfd *abfd, struct ecoff_debug_info *debug,
  525. const struct ecoff_debug_swap *swap);
  526. extern bfd_boolean bfd_ecoff_write_debug
  527. (bfd *abfd, struct ecoff_debug_info *debug,
  528. const struct ecoff_debug_swap *swap, file_ptr where);
  529. extern bfd_boolean bfd_ecoff_write_accumulated_debug
  530. (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
  531. const struct ecoff_debug_swap *swap,
  532. struct bfd_link_info *info, file_ptr where);
  533. /* Externally visible ELF routines. */
  534. struct bfd_link_needed_list
  535. {
  536. struct bfd_link_needed_list *next;
  537. bfd *by;
  538. const char *name;
  539. };
  540. enum dynamic_lib_link_class {
  541. DYN_NORMAL = 0,
  542. DYN_AS_NEEDED = 1,
  543. DYN_DT_NEEDED = 2,
  544. DYN_NO_ADD_NEEDED = 4,
  545. DYN_NO_NEEDED = 8
  546. };
  547. enum notice_asneeded_action {
  548. notice_as_needed,
  549. notice_not_needed,
  550. notice_needed
  551. };
  552. extern bfd_boolean bfd_elf_record_link_assignment
  553. (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
  554. bfd_boolean);
  555. extern struct bfd_link_needed_list *bfd_elf_get_needed_list
  556. (bfd *, struct bfd_link_info *);
  557. extern bfd_boolean bfd_elf_get_bfd_needed_list
  558. (bfd *, struct bfd_link_needed_list **);
  559. extern bfd_boolean bfd_elf_size_dynamic_sections
  560. (bfd *, const char *, const char *, const char *, const char * const *,
  561. struct bfd_link_info *, struct bfd_section **,
  562. struct bfd_elf_version_tree *);
  563. extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
  564. (bfd *, struct bfd_link_info *);
  565. extern void bfd_elf_set_dt_needed_name
  566. (bfd *, const char *);
  567. extern const char *bfd_elf_get_dt_soname
  568. (bfd *);
  569. extern void bfd_elf_set_dyn_lib_class
  570. (bfd *, enum dynamic_lib_link_class);
  571. extern int bfd_elf_get_dyn_lib_class
  572. (bfd *);
  573. extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
  574. (bfd *, struct bfd_link_info *);
  575. extern bfd_boolean bfd_elf_discard_info
  576. (bfd *, struct bfd_link_info *);
  577. extern unsigned int _bfd_elf_default_action_discarded
  578. (struct bfd_section *);
  579. /* Return an upper bound on the number of bytes required to store a
  580. copy of ABFD's program header table entries. Return -1 if an error
  581. occurs; bfd_get_error will return an appropriate code. */
  582. extern long bfd_get_elf_phdr_upper_bound
  583. (bfd *abfd);
  584. /* Copy ABFD's program header table entries to *PHDRS. The entries
  585. will be stored as an array of Elf_Internal_Phdr structures, as
  586. defined in include/elf/internal.h. To find out how large the
  587. buffer needs to be, call bfd_get_elf_phdr_upper_bound.
  588. Return the number of program header table entries read, or -1 if an
  589. error occurs; bfd_get_error will return an appropriate code. */
  590. extern int bfd_get_elf_phdrs
  591. (bfd *abfd, void *phdrs);
  592. /* Create a new BFD as if by bfd_openr. Rather than opening a file,
  593. reconstruct an ELF file by reading the segments out of remote memory
  594. based on the ELF file header at EHDR_VMA and the ELF program headers it
  595. points to. If not null, *LOADBASEP is filled in with the difference
  596. between the VMAs from which the segments were read, and the VMAs the
  597. file headers (and hence BFD's idea of each section's VMA) put them at.
  598. The function TARGET_READ_MEMORY is called to copy LEN bytes from the
  599. remote memory at target address VMA into the local buffer at MYADDR; it
  600. should return zero on success or an `errno' code on failure. TEMPL must
  601. be a BFD for an ELF target with the word size and byte order found in
  602. the remote memory. */
  603. extern bfd *bfd_elf_bfd_from_remote_memory
  604. (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
  605. int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
  606. /* Return the arch_size field of an elf bfd, or -1 if not elf. */
  607. extern int bfd_get_arch_size
  608. (bfd *);
  609. /* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
  610. extern int bfd_get_sign_extend_vma
  611. (bfd *);
  612. extern struct bfd_section *_bfd_elf_tls_setup
  613. (bfd *, struct bfd_link_info *);
  614. extern void _bfd_fix_excluded_sec_syms
  615. (bfd *, struct bfd_link_info *);
  616. extern unsigned bfd_m68k_mach_to_features (int);
  617. extern int bfd_m68k_features_to_mach (unsigned);
  618. extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
  619. (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
  620. char **);
  621. extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
  622. (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
  623. char **);
  624. /* SunOS shared library support routines for the linker. */
  625. extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
  626. (bfd *, struct bfd_link_info *);
  627. extern bfd_boolean bfd_sunos_record_link_assignment
  628. (bfd *, struct bfd_link_info *, const char *);
  629. extern bfd_boolean bfd_sunos_size_dynamic_sections
  630. (bfd *, struct bfd_link_info *, struct bfd_section **,
  631. struct bfd_section **, struct bfd_section **);
  632. /* Linux shared library support routines for the linker. */
  633. extern bfd_boolean bfd_i386linux_size_dynamic_sections
  634. (bfd *, struct bfd_link_info *);
  635. extern bfd_boolean bfd_m68klinux_size_dynamic_sections
  636. (bfd *, struct bfd_link_info *);
  637. extern bfd_boolean bfd_sparclinux_size_dynamic_sections
  638. (bfd *, struct bfd_link_info *);
  639. /* mmap hacks */
  640. struct _bfd_window_internal;
  641. typedef struct _bfd_window_internal bfd_window_internal;
  642. typedef struct _bfd_window
  643. {
  644. /* What the user asked for. */
  645. void *data;
  646. bfd_size_type size;
  647. /* The actual window used by BFD. Small user-requested read-only
  648. regions sharing a page may share a single window into the object
  649. file. Read-write versions shouldn't until I've fixed things to
  650. keep track of which portions have been claimed by the
  651. application; don't want to give the same region back when the
  652. application wants two writable copies! */
  653. struct _bfd_window_internal *i;
  654. }
  655. bfd_window;
  656. extern void bfd_init_window
  657. (bfd_window *);
  658. extern void bfd_free_window
  659. (bfd_window *);
  660. extern bfd_boolean bfd_get_file_window
  661. (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
  662. /* XCOFF support routines for the linker. */
  663. extern bfd_boolean bfd_xcoff_link_record_set
  664. (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
  665. extern bfd_boolean bfd_xcoff_import_symbol
  666. (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
  667. const char *, const char *, const char *, unsigned int);
  668. extern bfd_boolean bfd_xcoff_export_symbol
  669. (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
  670. extern bfd_boolean bfd_xcoff_link_count_reloc
  671. (bfd *, struct bfd_link_info *, const char *);
  672. extern bfd_boolean bfd_xcoff_record_link_assignment
  673. (bfd *, struct bfd_link_info *, const char *);
  674. extern bfd_boolean bfd_xcoff_size_dynamic_sections
  675. (bfd *, struct bfd_link_info *, const char *, const char *,
  676. unsigned long, unsigned long, unsigned long, bfd_boolean,
  677. int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean);
  678. extern bfd_boolean bfd_xcoff_link_generate_rtinit
  679. (bfd *, const char *, const char *, bfd_boolean);
  680. /* XCOFF support routines for ar. */
  681. extern bfd_boolean bfd_xcoff_ar_archive_set_magic
  682. (bfd *, char *);
  683. /* Externally visible COFF routines. */
  684. #if defined(__STDC__) || defined(ALMOST_STDC)
  685. struct internal_syment;
  686. union internal_auxent;
  687. #endif
  688. extern bfd_boolean bfd_coff_get_syment
  689. (bfd *, struct bfd_symbol *, struct internal_syment *);
  690. extern bfd_boolean bfd_coff_get_auxent
  691. (bfd *, struct bfd_symbol *, int, union internal_auxent *);
  692. extern bfd_boolean bfd_coff_set_symbol_class
  693. (bfd *, struct bfd_symbol *, unsigned int);
  694. extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
  695. (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
  696. /* ARM Interworking support. Called from linker. */
  697. extern bfd_boolean bfd_arm_allocate_interworking_sections
  698. (struct bfd_link_info *);
  699. extern bfd_boolean bfd_arm_process_before_allocation
  700. (bfd *, struct bfd_link_info *, int);
  701. extern bfd_boolean bfd_arm_get_bfd_for_interworking
  702. (bfd *, struct bfd_link_info *);
  703. /* PE ARM Interworking support. Called from linker. */
  704. extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
  705. (struct bfd_link_info *);
  706. extern bfd_boolean bfd_arm_pe_process_before_allocation
  707. (bfd *, struct bfd_link_info *, int);
  708. extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
  709. (bfd *, struct bfd_link_info *);
  710. /* ELF ARM Interworking support. Called from linker. */
  711. extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
  712. (struct bfd_link_info *);
  713. extern bfd_boolean bfd_elf32_arm_process_before_allocation
  714. (bfd *, struct bfd_link_info *);
  715. void bfd_elf32_arm_set_target_relocs
  716. (struct bfd_link_info *, int, char *, int, int);
  717. extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
  718. (bfd *, struct bfd_link_info *);
  719. extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
  720. (bfd *, struct bfd_link_info *);
  721. /* ELF ARM mapping symbol support */
  722. #define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
  723. #define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
  724. #define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
  725. #define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
  726. extern bfd_boolean bfd_is_arm_special_symbol_name
  727. (const char * name, int type);
  728. extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int);
  729. /* ARM Note section processing. */
  730. extern bfd_boolean bfd_arm_merge_machines
  731. (bfd *, bfd *);
  732. extern bfd_boolean bfd_arm_update_notes
  733. (bfd *, const char *);
  734. extern unsigned int bfd_arm_get_mach_from_notes
  735. (bfd *, const char *);
  736. /* TI COFF load page support. */
  737. extern void bfd_ticoff_set_section_load_page
  738. (struct bfd_section *, int);
  739. extern int bfd_ticoff_get_section_load_page
  740. (struct bfd_section *);
  741. /* H8/300 functions. */
  742. extern bfd_vma bfd_h8300_pad_address
  743. (bfd *, bfd_vma);
  744. /* IA64 Itanium code generation. Called from linker. */
  745. extern void bfd_elf32_ia64_after_parse
  746. (int);
  747. extern void bfd_elf64_ia64_after_parse
  748. (int);
  749. /* This structure is used for a comdat section, as in PE. A comdat
  750. section is associated with a particular symbol. When the linker
  751. sees a comdat section, it keeps only one of the sections with a
  752. given name and associated with a given symbol. */
  753. struct coff_comdat_info
  754. {
  755. /* The name of the symbol associated with a comdat section. */
  756. const char *name;
  757. /* The local symbol table index of the symbol associated with a
  758. comdat section. This is only meaningful to the object file format
  759. specific code; it is not an index into the list returned by
  760. bfd_canonicalize_symtab. */
  761. long symbol;
  762. };
  763. extern struct coff_comdat_info *bfd_coff_get_comdat_section
  764. (bfd *, struct bfd_section *);
  765. /* Extracted from init.c. */
  766. void bfd_init (void);
  767. /* Extracted from opncls.c. */
  768. bfd *bfd_fopen (const char *filename, const char *target,
  769. const char *mode, int fd);
  770. bfd *bfd_openr (const char *filename, const char *target);
  771. bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
  772. bfd *bfd_openstreamr (const char *, const char *, void *);
  773. bfd *bfd_openr_iovec (const char *filename, const char *target,
  774. void *(*open) (struct bfd *nbfd,
  775. void *open_closure),
  776. void *open_closure,
  777. file_ptr (*pread) (struct bfd *nbfd,
  778. void *stream,
  779. void *buf,
  780. file_ptr nbytes,
  781. file_ptr offset),
  782. int (*close) (struct bfd *nbfd,
  783. void *stream));
  784. bfd *bfd_openw (const char *filename, const char *target);
  785. bfd_boolean bfd_close (bfd *abfd);
  786. bfd_boolean bfd_close_all_done (bfd *);
  787. bfd *bfd_create (const char *filename, bfd *templ);
  788. bfd_boolean bfd_make_writable (bfd *abfd);
  789. bfd_boolean bfd_make_readable (bfd *abfd);
  790. unsigned long bfd_calc_gnu_debuglink_crc32
  791. (unsigned long crc, const unsigned char *buf, bfd_size_type len);
  792. char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
  793. struct bfd_section *bfd_create_gnu_debuglink_section
  794. (bfd *abfd, const char *filename);
  795. bfd_boolean bfd_fill_in_gnu_debuglink_section
  796. (bfd *abfd, struct bfd_section *sect, const char *filename);
  797. /* Extracted from libbfd.c. */
  798. /* Byte swapping macros for user section data. */
  799. #define bfd_put_8(abfd, val, ptr) \
  800. ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
  801. #define bfd_put_signed_8 \
  802. bfd_put_8
  803. #define bfd_get_8(abfd, ptr) \
  804. (*(unsigned char *) (ptr) & 0xff)
  805. #define bfd_get_signed_8(abfd, ptr) \
  806. (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
  807. #define bfd_put_16(abfd, val, ptr) \
  808. BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
  809. #define bfd_put_signed_16 \
  810. bfd_put_16
  811. #define bfd_get_16(abfd, ptr) \
  812. BFD_SEND (abfd, bfd_getx16, (ptr))
  813. #define bfd_get_signed_16(abfd, ptr) \
  814. BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
  815. #define bfd_put_32(abfd, val, ptr) \
  816. BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
  817. #define bfd_put_signed_32 \
  818. bfd_put_32
  819. #define bfd_get_32(abfd, ptr) \
  820. BFD_SEND (abfd, bfd_getx32, (ptr))
  821. #define bfd_get_signed_32(abfd, ptr) \
  822. BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
  823. #define bfd_put_64(abfd, val, ptr) \
  824. BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
  825. #define bfd_put_signed_64 \
  826. bfd_put_64
  827. #define bfd_get_64(abfd, ptr) \
  828. BFD_SEND (abfd, bfd_getx64, (ptr))
  829. #define bfd_get_signed_64(abfd, ptr) \
  830. BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
  831. #define bfd_get(bits, abfd, ptr) \
  832. ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
  833. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
  834. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
  835. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
  836. : (abort (), (bfd_vma) - 1))
  837. #define bfd_put(bits, abfd, val, ptr) \
  838. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
  839. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
  840. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
  841. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
  842. : (abort (), (void) 0))
  843. /* Byte swapping macros for file header data. */
  844. #define bfd_h_put_8(abfd, val, ptr) \
  845. bfd_put_8 (abfd, val, ptr)
  846. #define bfd_h_put_signed_8(abfd, val, ptr) \
  847. bfd_put_8 (abfd, val, ptr)
  848. #define bfd_h_get_8(abfd, ptr) \
  849. bfd_get_8 (abfd, ptr)
  850. #define bfd_h_get_signed_8(abfd, ptr) \
  851. bfd_get_signed_8 (abfd, ptr)
  852. #define bfd_h_put_16(abfd, val, ptr) \
  853. BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
  854. #define bfd_h_put_signed_16 \
  855. bfd_h_put_16
  856. #define bfd_h_get_16(abfd, ptr) \
  857. BFD_SEND (abfd, bfd_h_getx16, (ptr))
  858. #define bfd_h_get_signed_16(abfd, ptr) \
  859. BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
  860. #define bfd_h_put_32(abfd, val, ptr) \
  861. BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
  862. #define bfd_h_put_signed_32 \
  863. bfd_h_put_32
  864. #define bfd_h_get_32(abfd, ptr) \
  865. BFD_SEND (abfd, bfd_h_getx32, (ptr))
  866. #define bfd_h_get_signed_32(abfd, ptr) \
  867. BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
  868. #define bfd_h_put_64(abfd, val, ptr) \
  869. BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
  870. #define bfd_h_put_signed_64 \
  871. bfd_h_put_64
  872. #define bfd_h_get_64(abfd, ptr) \
  873. BFD_SEND (abfd, bfd_h_getx64, (ptr))
  874. #define bfd_h_get_signed_64(abfd, ptr) \
  875. BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
  876. /* Aliases for the above, which should eventually go away. */
  877. #define H_PUT_64 bfd_h_put_64
  878. #define H_PUT_32 bfd_h_put_32
  879. #define H_PUT_16 bfd_h_put_16
  880. #define H_PUT_8 bfd_h_put_8
  881. #define H_PUT_S64 bfd_h_put_signed_64
  882. #define H_PUT_S32 bfd_h_put_signed_32
  883. #define H_PUT_S16 bfd_h_put_signed_16
  884. #define H_PUT_S8 bfd_h_put_signed_8
  885. #define H_GET_64 bfd_h_get_64
  886. #define H_GET_32 bfd_h_get_32
  887. #define H_GET_16 bfd_h_get_16
  888. #define H_GET_8 bfd_h_get_8
  889. #define H_GET_S64 bfd_h_get_signed_64
  890. #define H_GET_S32 bfd_h_get_signed_32
  891. #define H_GET_S16 bfd_h_get_signed_16
  892. #define H_GET_S8 bfd_h_get_signed_8
  893. /* Extracted from bfdio.c. */
  894. long bfd_get_mtime (bfd *abfd);
  895. long bfd_get_size (bfd *abfd);
  896. /* Extracted from bfdwin.c. */
  897. /* Extracted from section.c. */
  898. typedef struct bfd_section
  899. {
  900. /* The name of the section; the name isn't a copy, the pointer is
  901. the same as that passed to bfd_make_section. */
  902. const char *name;
  903. /* A unique sequence number. */
  904. int id;
  905. /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
  906. int index;
  907. /* The next section in the list belonging to the BFD, or NULL. */
  908. struct bfd_section *next;
  909. /* The previous section in the list belonging to the BFD, or NULL. */
  910. struct bfd_section *prev;
  911. /* The field flags contains attributes of the section. Some
  912. flags are read in from the object file, and some are
  913. synthesized from other information. */
  914. flagword flags;
  915. #define SEC_NO_FLAGS 0x000
  916. /* Tells the OS to allocate space for this section when loading.
  917. This is clear for a section containing debug information only. */
  918. #define SEC_ALLOC 0x001
  919. /* Tells the OS to load the section from the file when loading.
  920. This is clear for a .bss section. */
  921. #define SEC_LOAD 0x002
  922. /* The section contains data still to be relocated, so there is
  923. some relocation information too. */
  924. #define SEC_RELOC 0x004
  925. /* A signal to the OS that the section contains read only data. */
  926. #define SEC_READONLY 0x008
  927. /* The section contains code only. */
  928. #define SEC_CODE 0x010
  929. /* The section contains data only. */
  930. #define SEC_DATA 0x020
  931. /* The section will reside in ROM. */
  932. #define SEC_ROM 0x040
  933. /* The section contains constructor information. This section
  934. type is used by the linker to create lists of constructors and
  935. destructors used by <<g++>>. When a back end sees a symbol
  936. which should be used in a constructor list, it creates a new
  937. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
  938. the symbol to it, and builds a relocation. To build the lists
  939. of constructors, all the linker has to do is catenate all the
  940. sections called <<__CTOR_LIST__>> and relocate the data
  941. contained within - exactly the operations it would peform on
  942. standard data. */
  943. #define SEC_CONSTRUCTOR 0x080
  944. /* The section has contents - a data section could be
  945. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
  946. <<SEC_HAS_CONTENTS>> */
  947. #define SEC_HAS_CONTENTS 0x100
  948. /* An instruction to the linker to not output the section
  949. even if it has information which would normally be written. */
  950. #define SEC_NEVER_LOAD 0x200
  951. /* The section contains thread local data. */
  952. #define SEC_THREAD_LOCAL 0x400
  953. /* The section has GOT references. This flag is only for the
  954. linker, and is currently only used by the elf32-hppa back end.
  955. It will be set if global offset table references were detected
  956. in this section, which indicate to the linker that the section
  957. contains PIC code, and must be handled specially when doing a
  958. static link. */
  959. #define SEC_HAS_GOT_REF 0x800
  960. /* The section contains common symbols (symbols may be defined
  961. multiple times, the value of a symbol is the amount of
  962. space it requires, and the largest symbol value is the one
  963. used). Most targets have exactly one of these (which we
  964. translate to bfd_com_section_ptr), but ECOFF has two. */
  965. #define SEC_IS_COMMON 0x1000
  966. /* The section contains only debugging information. For
  967. example, this is set for ELF .debug and .stab sections.
  968. strip tests this flag to see if a section can be
  969. discarded. */
  970. #define SEC_DEBUGGING 0x2000
  971. /* The contents of this section are held in memory pointed to
  972. by the contents field. This is checked by bfd_get_section_contents,
  973. and the data is retrieved from memory if appropriate. */
  974. #define SEC_IN_MEMORY 0x4000
  975. /* The contents of this section are to be excluded by the
  976. linker for executable and shared objects unless those
  977. objects are to be further relocated. */
  978. #define SEC_EXCLUDE 0x8000
  979. /* The contents of this section are to be sorted based on the sum of
  980. the symbol and addend values specified by the associated relocation
  981. entries. Entries without associated relocation entries will be
  982. appended to the end of the section in an unspecified order. */
  983. #define SEC_SORT_ENTRIES 0x10000
  984. /* When linking, duplicate sections of the same name should be
  985. discarded, rather than being combined into a single section as
  986. is usually done. This is similar to how common symbols are
  987. handled. See SEC_LINK_DUPLICATES below. */
  988. #define SEC_LINK_ONCE 0x20000
  989. /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
  990. should handle duplicate sections. */
  991. #define SEC_LINK_DUPLICATES 0x40000
  992. /* This value for SEC_LINK_DUPLICATES means that duplicate
  993. sections with the same name should simply be discarded. */
  994. #define SEC_LINK_DUPLICATES_DISCARD 0x0
  995. /* This value for SEC_LINK_DUPLICATES means that the linker
  996. should warn if there are any duplicate sections, although
  997. it should still only link one copy. */
  998. #define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
  999. /* This value for SEC_LINK_DUPLICATES means that the linker
  1000. should warn if any duplicate sections are a different size. */
  1001. #define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
  1002. /* This value for SEC_LINK_DUPLICATES means that the linker
  1003. should warn if any duplicate sections contain different
  1004. contents. */
  1005. #define SEC_LINK_DUPLICATES_SAME_CONTENTS \
  1006. (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
  1007. /* This section was created by the linker as part of dynamic
  1008. relocation or other arcane processing. It is skipped when
  1009. going through the first-pass output, trusting that someone
  1010. else up the line will take care of it later. */
  1011. #define SEC_LINKER_CREATED 0x200000
  1012. /* This section should not be subject to garbage collection.
  1013. Also set to inform the linker that this section should not be
  1014. listed in the link map as discarded. */
  1015. #define SEC_KEEP 0x400000
  1016. /* This section contains "short" data, and should be placed
  1017. "near" the GP. */
  1018. #define SEC_SMALL_DATA 0x800000
  1019. /* Attempt to merge identical entities in the section.
  1020. Entity size is given in the entsize field. */
  1021. #define SEC_MERGE 0x1000000
  1022. /* If given with SEC_MERGE, entities to merge are zero terminated
  1023. strings where entsize specifies character size instead of fixed
  1024. size entries. */
  1025. #define SEC_STRINGS 0x2000000
  1026. /* This section contains data about section groups. */
  1027. #define SEC_GROUP 0x4000000
  1028. /* The section is a COFF shared library section. This flag is
  1029. only for the linker. If this type of section appears in
  1030. the input file, the linker must copy it to the output file
  1031. without changing the vma or size. FIXME: Although this
  1032. was originally intended to be general, it really is COFF
  1033. specific (and the flag was renamed to indicate this). It
  1034. might be cleaner to have some more general mechanism to
  1035. allow the back end to control what the linker does with
  1036. sections. */
  1037. #define SEC_COFF_SHARED_LIBRARY 0x10000000
  1038. /* This section contains data which may be shared with other
  1039. executables or shared objects. This is for COFF only. */
  1040. #define SEC_COFF_SHARED 0x20000000
  1041. /* When a section with this flag is being linked, then if the size of
  1042. the input section is less than a page, it should not cross a page
  1043. boundary. If the size of the input section is one page or more,
  1044. it should be aligned on a page boundary. This is for TI
  1045. TMS320C54X only. */
  1046. #define SEC_TIC54X_BLOCK 0x40000000
  1047. /* Conditionally link this section; do not link if there are no
  1048. references found to any symbol in the section. This is for TI
  1049. TMS320C54X only. */
  1050. #define SEC_TIC54X_CLINK 0x80000000
  1051. /* End of section flags. */
  1052. /* Some internal packed boolean fields. */
  1053. /* See the vma field. */
  1054. unsigned int user_set_vma : 1;
  1055. /* A mark flag used by some of the linker backends. */
  1056. unsigned int linker_mark : 1;
  1057. /* Another mark flag used by some of the linker backends. Set for
  1058. output sections that have an input section. */
  1059. unsigned int linker_has_input : 1;
  1060. /* Mark flags used by some linker backends for garbage collection. */
  1061. unsigned int gc_mark : 1;
  1062. unsigned int gc_mark_from_eh : 1;
  1063. /* The following flags are used by the ELF linker. */
  1064. /* Mark sections which have been allocated to segments. */
  1065. unsigned int segment_mark : 1;
  1066. /* Type of sec_info information. */
  1067. unsigned int sec_info_type:3;
  1068. #define ELF_INFO_TYPE_NONE 0
  1069. #define ELF_INFO_TYPE_STABS 1
  1070. #define ELF_INFO_TYPE_MERGE 2
  1071. #define ELF_INFO_TYPE_EH_FRAME 3
  1072. #define ELF_INFO_TYPE_JUST_SYMS 4
  1073. /* Nonzero if this section uses RELA relocations, rather than REL. */
  1074. unsigned int use_rela_p:1;
  1075. /* Bits used by various backends. The generic code doesn't touch
  1076. these fields. */
  1077. /* Nonzero if this section has TLS related relocations. */
  1078. unsigned int has_tls_reloc:1;
  1079. /* Nonzero if this section has a gp reloc. */
  1080. unsigned int has_gp_reloc:1;
  1081. /* Nonzero if this section needs the relax finalize pass. */
  1082. unsigned int need_finalize_relax:1;
  1083. /* Whether relocations have been processed. */
  1084. unsigned int reloc_done : 1;
  1085. /* End of internal packed boolean fields. */
  1086. /* The virtual memory address of the section - where it will be
  1087. at run time. The symbols are relocated against this. The
  1088. user_set_vma flag is maintained by bfd; if it's not set, the
  1089. backend can assign addresses (for example, in <<a.out>>, where
  1090. the default address for <<.data>> is dependent on the specific
  1091. target and various flags). */
  1092. bfd_vma vma;
  1093. /* The load address of the section - where it would be in a
  1094. rom image; really only used for writing section header
  1095. information. */
  1096. bfd_vma lma;
  1097. /* The size of the section in octets, as it will be output.
  1098. Contains a value even if the section has no contents (e.g., the
  1099. size of <<.bss>>). */
  1100. bfd_size_type size;
  1101. /* For input sections, the original size on disk of the section, in
  1102. octets. This field is used by the linker relaxation code. It is
  1103. currently only set for sections where the linker relaxation scheme
  1104. doesn't cache altered section and reloc contents (stabs, eh_frame,
  1105. SEC_MERGE, some coff relaxing targets), and thus the original size
  1106. needs to be kept to read the section multiple times.
  1107. For output sections, rawsize holds the section size calculated on
  1108. a previous linker relaxation pass. */
  1109. bfd_size_type rawsize;
  1110. /* If this section is going to be output, then this value is the
  1111. offset in *bytes* into the output section of the first byte in the
  1112. input section (byte ==> smallest addressable unit on the
  1113. target). In most cases, if this was going to start at the
  1114. 100th octet (8-bit quantity) in the output section, this value
  1115. would be 100. However, if the target byte size is 16 bits
  1116. (bfd_octets_per_byte is "2"), this value would be 50. */
  1117. bfd_vma output_offset;
  1118. /* The output section through which to map on output. */
  1119. struct bfd_section *output_section;
  1120. /* The alignment requirement of the section, as an exponent of 2 -
  1121. e.g., 3 aligns to 2^3 (or 8). */
  1122. unsigned int alignment_power;
  1123. /* If an input section, a pointer to a vector of relocation
  1124. records for the data in this section. */
  1125. struct reloc_cache_entry *relocation;
  1126. /* If an output section, a pointer to a vector of pointers to
  1127. relocation records for the data in this section. */
  1128. struct reloc_cache_entry **orelocation;
  1129. /* The number of relocation records in one of the above. */
  1130. unsigned reloc_count;
  1131. /* Information below is back end specific - and not always used
  1132. or updated. */
  1133. /* File position of section data. */
  1134. file_ptr filepos;
  1135. /* File position of relocation info. */
  1136. file_ptr rel_filepos;
  1137. /* File position of line data. */
  1138. file_ptr line_filepos;
  1139. /* Pointer to data for applications. */
  1140. void *userdata;
  1141. /* If the SEC_IN_MEMORY flag is set, this points to the actual
  1142. contents. */
  1143. unsigned char *contents;
  1144. /* Attached line number information. */
  1145. alent *lineno;
  1146. /* Number of line number records. */
  1147. unsigned int lineno_count;
  1148. /* Entity size for merging purposes. */
  1149. unsigned int entsize;
  1150. /* Points to the kept section if this section is a link-once section,
  1151. and is discarded. */
  1152. struct bfd_section *kept_section;
  1153. /* When a section is being output, this value changes as more
  1154. linenumbers are written out. */
  1155. file_ptr moving_line_filepos;
  1156. /* What the section number is in the target world. */
  1157. int target_index;
  1158. void *used_by_bfd;
  1159. /* If this is a constructor section then here is a list of the
  1160. relocations created to relocate items within it. */
  1161. struct relent_chain *constructor_chain;
  1162. /* The BFD which owns the section. */
  1163. bfd *owner;
  1164. /* A symbol which points at this section only. */
  1165. struct bfd_symbol *symbol;
  1166. struct bfd_symbol **symbol_ptr_ptr;
  1167. /* Early in the link process, map_head and map_tail are used to build
  1168. a list of input sections attached to an output section. Later,
  1169. output sections use these fields for a list of bfd_link_order
  1170. structs. */
  1171. union {
  1172. struct bfd_link_order *link_order;
  1173. struct bfd_section *s;
  1174. } map_head, map_tail;
  1175. } asection;
  1176. /* These sections are global, and are managed by BFD. The application
  1177. and target back end are not permitted to change the values in
  1178. these sections. New code should use the section_ptr macros rather
  1179. than referring directly to the const sections. The const sections
  1180. may eventually vanish. */
  1181. #define BFD_ABS_SECTION_NAME "*ABS*"
  1182. #define BFD_UND_SECTION_NAME "*UND*"
  1183. #define BFD_COM_SECTION_NAME "*COM*"
  1184. #define BFD_IND_SECTION_NAME "*IND*"
  1185. /* The absolute section. */
  1186. extern asection bfd_abs_section;
  1187. #define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
  1188. #define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
  1189. /* Pointer to the undefined section. */
  1190. extern asection bfd_und_section;
  1191. #define bfd_und_section_ptr ((asection *) &bfd_und_section)
  1192. #define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
  1193. /* Pointer to the common section. */
  1194. extern asection bfd_com_section;
  1195. #define bfd_com_section_ptr ((asection *) &bfd_com_section)
  1196. /* Pointer to the indirect section. */
  1197. extern asection bfd_ind_section;
  1198. #define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
  1199. #define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
  1200. #define bfd_is_const_section(SEC) \
  1201. ( ((SEC) == bfd_abs_section_ptr) \
  1202. || ((SEC) == bfd_und_section_ptr) \
  1203. || ((SEC) == bfd_com_section_ptr) \
  1204. || ((SEC) == bfd_ind_section_ptr))
  1205. /* Macros to handle insertion and deletion of a bfd's sections. These
  1206. only handle the list pointers, ie. do not adjust section_count,
  1207. target_index etc. */
  1208. #define bfd_section_list_remove(ABFD, S) \
  1209. do \
  1210. { \
  1211. asection *_s = S; \
  1212. asection *_next = _s->next; \
  1213. asection *_prev = _s->prev; \
  1214. if (_prev) \
  1215. _prev->next = _next; \
  1216. else \
  1217. (ABFD)->sections = _next; \
  1218. if (_next) \
  1219. _next->prev = _prev; \
  1220. else \
  1221. (ABFD)->section_last = _prev; \
  1222. } \
  1223. while (0)
  1224. #define bfd_section_list_append(ABFD, S) \
  1225. do \
  1226. { \
  1227. asection *_s = S; \
  1228. bfd *_abfd = ABFD; \
  1229. _s->next = NULL; \
  1230. if (_abfd->section_last) \
  1231. { \
  1232. _s->prev = _abfd->section_last; \
  1233. _abfd->section_last->next = _s; \
  1234. } \
  1235. else \
  1236. { \
  1237. _s->prev = NULL; \
  1238. _abfd->sections = _s; \
  1239. } \
  1240. _abfd->section_last = _s; \
  1241. } \
  1242. while (0)
  1243. #define bfd_section_list_prepend(ABFD, S) \
  1244. do \
  1245. { \
  1246. asection *_s = S; \
  1247. bfd *_abfd = ABFD; \
  1248. _s->prev = NULL; \
  1249. if (_abfd->sections) \
  1250. { \
  1251. _s->next = _abfd->sections; \
  1252. _abfd->sections->prev = _s; \
  1253. } \
  1254. else \
  1255. { \
  1256. _s->next = NULL; \
  1257. _abfd->section_last = _s; \
  1258. } \
  1259. _abfd->sections = _s; \
  1260. } \
  1261. while (0)
  1262. #define bfd_section_list_insert_after(ABFD, A, S) \
  1263. do \
  1264. { \
  1265. asection *_a = A; \
  1266. asection *_s = S; \
  1267. asection *_next = _a->next; \
  1268. _s->next = _next; \
  1269. _s->prev = _a; \
  1270. _a->next = _s; \
  1271. if (_next) \
  1272. _next->prev = _s; \
  1273. else \
  1274. (ABFD)->section_last = _s; \
  1275. } \
  1276. while (0)
  1277. #define bfd_section_list_insert_before(ABFD, B, S) \
  1278. do \
  1279. { \
  1280. asection *_b = B; \
  1281. asection *_s = S; \
  1282. asection *_prev = _b->prev; \
  1283. _s->prev = _prev; \
  1284. _s->next = _b; \
  1285. _b->prev = _s; \
  1286. if (_prev) \
  1287. _prev->next = _s; \
  1288. else \
  1289. (ABFD)->sections = _s; \
  1290. } \
  1291. while (0)
  1292. #define bfd_section_removed_from_list(ABFD, S) \
  1293. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
  1294. #define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
  1295. /* name, id, index, next, prev, flags, user_set_vma, */ \
  1296. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
  1297. \
  1298. /* linker_mark, linker_has_input, gc_mark, gc_mark_from_eh, */ \
  1299. 0, 0, 1, 0, \
  1300. \
  1301. /* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, */ \
  1302. 0, 0, 0, 0, \
  1303. \
  1304. /* has_gp_reloc, need_finalize_relax, reloc_done, */ \
  1305. 0, 0, 0, \
  1306. \
  1307. /* vma, lma, size, rawsize */ \
  1308. 0, 0, 0, 0, \
  1309. \
  1310. /* output_offset, output_section, alignment_power, */ \
  1311. 0, (struct bfd_section *) &SEC, 0, \
  1312. \
  1313. /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \
  1314. NULL, NULL, 0, 0, 0, \
  1315. \
  1316. /* line_filepos, userdata, contents, lineno, lineno_count, */ \
  1317. 0, NULL, NULL, NULL, 0, \
  1318. \
  1319. /* entsize, kept_section, moving_line_filepos, */ \
  1320. 0, NULL, 0, \
  1321. \
  1322. /* target_index, used_by_bfd, constructor_chain, owner, */ \
  1323. 0, NULL, NULL, NULL, \
  1324. \
  1325. /* symbol, symbol_ptr_ptr, */ \
  1326. (struct bfd_symbol *) SYM, &SEC.symbol, \
  1327. \
  1328. /* map_head, map_tail */ \
  1329. { NULL }, { NULL } \
  1330. }
  1331. void bfd_section_list_clear (bfd *);
  1332. asection *bfd_get_section_by_name (bfd *abfd, const char *name);
  1333. asection *bfd_get_section_by_name_if
  1334. (bfd *abfd,
  1335. const char *name,
  1336. bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
  1337. void *obj);
  1338. char *bfd_get_unique_section_name
  1339. (bfd *abfd, const char *templat, int *count);
  1340. asection *bfd_make_section_old_way (bfd *abfd, const char *name);
  1341. asection *bfd_make_section_anyway_with_flags
  1342. (bfd *abfd, const char *name, flagword flags);
  1343. asection *bfd_make_section_anyway (bfd *abfd, const char *name);
  1344. asection *bfd_make_section_with_flags
  1345. (bfd *, const char *name, flagword flags);
  1346. asection *bfd_make_section (bfd *, const char *name);
  1347. bfd_boolean bfd_set_section_flags
  1348. (bfd *abfd, asection *sec, flagword flags);
  1349. void bfd_map_over_sections
  1350. (bfd *abfd,
  1351. void (*func) (bfd *abfd, asection *sect, void *obj),
  1352. void *obj);
  1353. asection *bfd_sections_find_if
  1354. (bfd *abfd,
  1355. bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
  1356. void *obj);
  1357. bfd_boolean bfd_set_section_size
  1358. (bfd *abfd, asection *sec, bfd_size_type val);
  1359. bfd_boolean bfd_set_section_contents
  1360. (bfd *abfd, asection *section, const void *data,
  1361. file_ptr offset, bfd_size_type count);
  1362. bfd_boolean bfd_get_section_contents
  1363. (bfd *abfd, asection *section, void *location, file_ptr offset,
  1364. bfd_size_type count);
  1365. bfd_boolean bfd_malloc_and_get_section
  1366. (bfd *abfd, asection *section, bfd_byte **buf);
  1367. bfd_boolean bfd_copy_private_section_data
  1368. (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
  1369. #define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
  1370. BFD_SEND (obfd, _bfd_copy_private_section_data, \
  1371. (ibfd, isection, obfd, osection))
  1372. bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
  1373. bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
  1374. /* Extracted from archures.c. */
  1375. enum bfd_architecture
  1376. {
  1377. bfd_arch_unknown, /* File arch not known. */
  1378. bfd_arch_obscure, /* Arch known, not one of these. */
  1379. bfd_arch_m68k, /* Motorola 68xxx */
  1380. #define bfd_mach_m68000 1
  1381. #define bfd_mach_m68008 2
  1382. #define bfd_mach_m68010 3
  1383. #define bfd_mach_m68020 4
  1384. #define bfd_mach_m68030 5
  1385. #define bfd_mach_m68040 6
  1386. #define bfd_mach_m68060 7
  1387. #define bfd_mach_cpu32 8
  1388. #define bfd_mach_mcf_isa_a_nodiv 9
  1389. #define bfd_mach_mcf_isa_a 10
  1390. #define bfd_mach_mcf_isa_a_mac 11
  1391. #define bfd_mach_mcf_isa_a_emac 12
  1392. #define bfd_mach_mcf_isa_aplus 13
  1393. #define bfd_mach_mcf_isa_aplus_mac 14
  1394. #define bfd_mach_mcf_isa_aplus_emac 15
  1395. #define bfd_mach_mcf_isa_b_nousp 16
  1396. #define bfd_mach_mcf_isa_b_nousp_mac 17
  1397. #define bfd_mach_mcf_isa_b_nousp_emac 18
  1398. #define bfd_mach_mcf_isa_b 19
  1399. #define bfd_mach_mcf_isa_b_mac 20
  1400. #define bfd_mach_mcf_isa_b_emac 21
  1401. #define bfd_mach_mcf_isa_b_float 22
  1402. #define bfd_mach_mcf_isa_b_float_mac 23
  1403. #define bfd_mach_mcf_isa_b_float_emac 24
  1404. bfd_arch_vax, /* DEC Vax */
  1405. bfd_arch_i960, /* Intel 960 */
  1406. /* The order of the following is important.
  1407. lower number indicates a machine type that
  1408. only accepts a subset of the instructions
  1409. available to machines with higher numbers.
  1410. The exception is the "ca", which is
  1411. incompatible with all other machines except
  1412. "core". */
  1413. #define bfd_mach_i960_core 1
  1414. #define bfd_mach_i960_ka_sa 2
  1415. #define bfd_mach_i960_kb_sb 3
  1416. #define bfd_mach_i960_mc 4
  1417. #define bfd_mach_i960_xa 5
  1418. #define bfd_mach_i960_ca 6
  1419. #define bfd_mach_i960_jx 7
  1420. #define bfd_mach_i960_hx 8
  1421. bfd_arch_or32, /* OpenRISC 32 */
  1422. bfd_arch_sparc, /* SPARC */
  1423. #define bfd_mach_sparc 1
  1424. /* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
  1425. #define bfd_mach_sparc_sparclet 2
  1426. #define bfd_mach_sparc_sparclite 3
  1427. #define bfd_mach_sparc_v8plus 4
  1428. #define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
  1429. #define bfd_mach_sparc_sparclite_le 6
  1430. #define bfd_mach_sparc_v9 7
  1431. #define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
  1432. #define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
  1433. #define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
  1434. /* Nonzero if MACH has the v9 instruction set. */
  1435. #define bfd_mach_sparc_v9_p(mach) \
  1436. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
  1437. && (mach) != bfd_mach_sparc_sparclite_le)
  1438. /* Nonzero if MACH is a 64 bit sparc architecture. */
  1439. #define bfd_mach_sparc_64bit_p(mach) \
  1440. ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
  1441. bfd_arch_spu, /* PowerPC SPU */
  1442. #define bfd_mach_spu 256
  1443. bfd_arch_mips, /* MIPS Rxxxx */
  1444. #define bfd_mach_mips3000 3000
  1445. #define bfd_mach_mips3900 3900
  1446. #define bfd_mach_mips4000 4000
  1447. #define bfd_mach_mips4010 4010
  1448. #define bfd_mach_mips4100 4100
  1449. #define bfd_mach_mips4111 4111
  1450. #define bfd_mach_mips4120 4120
  1451. #define bfd_mach_mips4300 4300
  1452. #define bfd_mach_mips4400 4400
  1453. #define bfd_mach_mips4600 4600
  1454. #define bfd_mach_mips4650 4650
  1455. #define bfd_mach_mips5000 5000
  1456. #define bfd_mach_mips5400 5400
  1457. #define bfd_mach_mips5500 5500
  1458. #define bfd_mach_mips6000 6000
  1459. #define bfd_mach_mips7000 7000
  1460. #define bfd_mach_mips8000 8000
  1461. #define bfd_mach_mips9000 9000
  1462. #define bfd_mach_mips10000 10000
  1463. #define bfd_mach_mips12000 12000
  1464. #define bfd_mach_mips16 16
  1465. #define bfd_mach_mips5 5
  1466. #define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
  1467. #define bfd_mach_mipsisa32 32
  1468. #define bfd_mach_mipsisa32r2 33
  1469. #define bfd_mach_mipsisa64 64
  1470. #define bfd_mach_mipsisa64r2 65
  1471. bfd_arch_i386, /* Intel 386 */
  1472. #define bfd_mach_i386_i386 1
  1473. #define bfd_mach_i386_i8086 2
  1474. #define bfd_mach_i386_i386_intel_syntax 3
  1475. #define bfd_mach_x86_64 64
  1476. #define bfd_mach_x86_64_intel_syntax 65
  1477. bfd_arch_we32k, /* AT&T WE32xxx */
  1478. bfd_arch_tahoe, /* CCI/Harris Tahoe */
  1479. bfd_arch_i860, /* Intel 860 */
  1480. bfd_arch_i370, /* IBM 360/370 Mainframes */
  1481. bfd_arch_romp, /* IBM ROMP PC/RT */
  1482. bfd_arch_convex, /* Convex */
  1483. bfd_arch_m88k, /* Motorola 88xxx */
  1484. bfd_arch_m98k, /* Motorola 98xxx */
  1485. bfd_arch_pyramid, /* Pyramid Technology */
  1486. bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
  1487. #define bfd_mach_h8300 1
  1488. #define bfd_mach_h8300h 2
  1489. #define bfd_mach_h8300s 3
  1490. #define bfd_mach_h8300hn 4
  1491. #define bfd_mach_h8300sn 5
  1492. #define bfd_mach_h8300sx 6
  1493. #define bfd_mach_h8300sxn 7
  1494. bfd_arch_pdp11, /* DEC PDP-11 */
  1495. bfd_arch_powerpc, /* PowerPC */
  1496. #define bfd_mach_ppc 32
  1497. #define bfd_mach_ppc64 64
  1498. #define bfd_mach_ppc_403 403
  1499. #define bfd_mach_ppc_403gc 4030
  1500. #define bfd_mach_ppc_505 505
  1501. #define bfd_mach_ppc_601 601
  1502. #define bfd_mach_ppc_602 602
  1503. #define bfd_mach_ppc_603 603
  1504. #define bfd_mach_ppc_ec603e 6031
  1505. #define bfd_mach_ppc_604 604
  1506. #define bfd_mach_ppc_620 620
  1507. #define bfd_mach_ppc_630 630
  1508. #define bfd_mach_ppc_750 750
  1509. #define bfd_mach_ppc_860 860
  1510. #define bfd_mach_ppc_a35 35
  1511. #define bfd_mach_ppc_rs64ii 642
  1512. #define bfd_mach_ppc_rs64iii 643
  1513. #define bfd_mach_ppc_7400 7400
  1514. #define bfd_mach_ppc_e500 500
  1515. bfd_arch_rs6000, /* IBM RS/6000 */
  1516. #define bfd_mach_rs6k 6000
  1517. #define bfd_mach_rs6k_rs1 6001
  1518. #define bfd_mach_rs6k_rsc 6003
  1519. #define bfd_mach_rs6k_rs2 6002
  1520. bfd_arch_hppa, /* HP PA RISC */
  1521. #define bfd_mach_hppa10 10
  1522. #define bfd_mach_hppa11 11
  1523. #define bfd_mach_hppa20 20
  1524. #define bfd_mach_hppa20w 25
  1525. bfd_arch_d10v, /* Mitsubishi D10V */
  1526. #define bfd_mach_d10v 1
  1527. #define bfd_mach_d10v_ts2 2
  1528. #define bfd_mach_d10v_ts3 3
  1529. bfd_arch_d30v, /* Mitsubishi D30V */
  1530. bfd_arch_dlx, /* DLX */
  1531. bfd_arch_m68hc11, /* Motorola 68HC11 */
  1532. bfd_arch_m68hc12, /* Motorola 68HC12 */
  1533. #define bfd_mach_m6812_default 0
  1534. #define bfd_mach_m6812 1
  1535. #define bfd_mach_m6812s 2
  1536. bfd_arch_z8k, /* Zilog Z8000 */
  1537. #define bfd_mach_z8001 1
  1538. #define bfd_mach_z8002 2
  1539. bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
  1540. bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
  1541. #define bfd_mach_sh 1
  1542. #define bfd_mach_sh2 0x20
  1543. #define bfd_mach_sh_dsp 0x2d
  1544. #define bfd_mach_sh2a 0x2a
  1545. #define bfd_mach_sh2a_nofpu 0x2b
  1546. #define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
  1547. #define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
  1548. #define bfd_mach_sh2a_or_sh4 0x2a3
  1549. #define bfd_mach_sh2a_or_sh3e 0x2a4
  1550. #define bfd_mach_sh2e 0x2e
  1551. #define bfd_mach_sh3 0x30
  1552. #define bfd_mach_sh3_nommu 0x31
  1553. #define bfd_mach_sh3_dsp 0x3d
  1554. #define bfd_mach_sh3e 0x3e
  1555. #define bfd_mach_sh4 0x40
  1556. #define bfd_mach_sh4_nofpu 0x41
  1557. #define bfd_mach_sh4_nommu_nofpu 0x42
  1558. #define bfd_mach_sh4a 0x4a
  1559. #define bfd_mach_sh4a_nofpu 0x4b
  1560. #define bfd_mach_sh4al_dsp 0x4d
  1561. #define bfd_mach_sh5 0x50
  1562. bfd_arch_alpha, /* Dec Alpha */
  1563. #define bfd_mach_alpha_ev4 0x10
  1564. #define bfd_mach_alpha_ev5 0x20
  1565. #define bfd_mach_alpha_ev6 0x30
  1566. bfd_arch_arm, /* Advanced Risc Machines ARM. */
  1567. #define bfd_mach_arm_unknown 0
  1568. #define bfd_mach_arm_2 1
  1569. #define bfd_mach_arm_2a 2
  1570. #define bfd_mach_arm_3 3
  1571. #define bfd_mach_arm_3M 4
  1572. #define bfd_mach_arm_4 5
  1573. #define bfd_mach_arm_4T 6
  1574. #define bfd_mach_arm_5 7
  1575. #define bfd_mach_arm_5T 8
  1576. #define bfd_mach_arm_5TE 9
  1577. #define bfd_mach_arm_XScale 10
  1578. #define bfd_mach_arm_ep9312 11
  1579. #define bfd_mach_arm_iWMMXt 12
  1580. #define bfd_mach_arm_iWMMXt2 13
  1581. bfd_arch_ns32k, /* National Semiconductors ns32000 */
  1582. bfd_arch_w65, /* WDC 65816 */
  1583. bfd_arch_tic30, /* Texas Instruments TMS320C30 */
  1584. bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
  1585. #define bfd_mach_tic3x 30
  1586. #define bfd_mach_tic4x 40
  1587. bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
  1588. bfd_arch_tic80, /* TI TMS320c80 (MVP) */
  1589. bfd_arch_v850, /* NEC V850 */
  1590. #define bfd_mach_v850 1
  1591. #define bfd_mach_v850e 'E'
  1592. #define bfd_mach_v850e1 '1'
  1593. bfd_arch_arc, /* ARC Cores */
  1594. #define bfd_mach_arc_5 5
  1595. #define bfd_mach_arc_6 6
  1596. #define bfd_mach_arc_7 7
  1597. #define bfd_mach_arc_8 8
  1598. bfd_arch_m32c, /* Renesas M16C/M32C. */
  1599. #define bfd_mach_m16c 0x75
  1600. #define bfd_mach_m32c 0x78
  1601. bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
  1602. #define bfd_mach_m32r 1 /* For backwards compatibility. */
  1603. #define bfd_mach_m32rx 'x'
  1604. #define bfd_mach_m32r2 '2'
  1605. bfd_arch_mn10200, /* Matsushita MN10200 */
  1606. bfd_arch_mn10300, /* Matsushita MN10300 */
  1607. #define bfd_mach_mn10300 300
  1608. #define bfd_mach_am33 330
  1609. #define bfd_mach_am33_2 332
  1610. bfd_arch_fr30,
  1611. #define bfd_mach_fr30 0x46523330
  1612. bfd_arch_frv,
  1613. #define bfd_mach_frv 1
  1614. #define bfd_mach_frvsimple 2
  1615. #define bfd_mach_fr300 300
  1616. #define bfd_mach_fr400 400
  1617. #define bfd_mach_fr450 450
  1618. #define bfd_mach_frvtomcat 499 /* fr500 prototype */
  1619. #define bfd_mach_fr500 500
  1620. #define bfd_mach_fr550 550
  1621. bfd_arch_mcore,
  1622. bfd_arch_ia64, /* HP/Intel ia64 */
  1623. #define bfd_mach_ia64_elf64 64
  1624. #define bfd_mach_ia64_elf32 32
  1625. bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
  1626. #define bfd_mach_ip2022 1
  1627. #define bfd_mach_ip2022ext 2
  1628. bfd_arch_iq2000, /* Vitesse IQ2000. */
  1629. #define bfd_mach_iq2000 1
  1630. #define bfd_mach_iq10 2
  1631. bfd_arch_mt,
  1632. #define bfd_mach_ms1 1
  1633. #define bfd_mach_mrisc2 2
  1634. #define bfd_mach_ms2 3
  1635. bfd_arch_pj,
  1636. bfd_arch_avr, /* Atmel AVR microcontrollers. */
  1637. #define bfd_mach_avr1 1
  1638. #define bfd_mach_avr2 2
  1639. #define bfd_mach_avr3 3
  1640. #define bfd_mach_avr4 4
  1641. #define bfd_mach_avr5 5
  1642. #define bfd_mach_avr6 6
  1643. bfd_arch_bfin, /* ADI Blackfin */
  1644. #define bfd_mach_bfin 1
  1645. bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
  1646. #define bfd_mach_cr16c 1
  1647. bfd_arch_crx, /* National Semiconductor CRX. */
  1648. #define bfd_mach_crx 1
  1649. bfd_arch_cris, /* Axis CRIS */
  1650. #define bfd_mach_cris_v0_v10 255
  1651. #define bfd_mach_cris_v32 32
  1652. #define bfd_mach_cris_v10_v32 1032
  1653. bfd_arch_s390, /* IBM s390 */
  1654. #define bfd_mach_s390_31 31
  1655. #define bfd_mach_s390_64 64
  1656. bfd_arch_score, /* Sunplus score */
  1657. bfd_arch_openrisc, /* OpenRISC */
  1658. bfd_arch_mmix, /* Donald Knuth's educational processor. */
  1659. bfd_arch_xstormy16,
  1660. #define bfd_mach_xstormy16 1
  1661. bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
  1662. #define bfd_mach_msp11 11
  1663. #define bfd_mach_msp110 110
  1664. #define bfd_mach_msp12 12
  1665. #define bfd_mach_msp13 13
  1666. #define bfd_mach_msp14 14
  1667. #define bfd_mach_msp15 15
  1668. #define bfd_mach_msp16 16
  1669. #define bfd_mach_msp21 21
  1670. #define bfd_mach_msp31 31
  1671. #define bfd_mach_msp32 32
  1672. #define bfd_mach_msp33 33
  1673. #define bfd_mach_msp41 41
  1674. #define bfd_mach_msp42 42
  1675. #define bfd_mach_msp43 43
  1676. #define bfd_mach_msp44 44
  1677. bfd_arch_xc16x, /* Infineon's XC16X Series. */
  1678. #define bfd_mach_xc16x 1
  1679. #define bfd_mach_xc16xl 2
  1680. #define bfd_mach_xc16xs 3
  1681. bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
  1682. #define bfd_mach_xtensa 1
  1683. bfd_arch_maxq, /* Dallas MAXQ 10/20 */
  1684. #define bfd_mach_maxq10 10
  1685. #define bfd_mach_maxq20 20
  1686. bfd_arch_z80,
  1687. #define bfd_mach_z80strict 1 /* No undocumented opcodes. */
  1688. #define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */
  1689. #define bfd_mach_z80full 7 /* All undocumented instructions. */
  1690. #define bfd_mach_r800 11 /* R800: successor with multiplication. */
  1691. bfd_arch_last
  1692. };
  1693. typedef struct bfd_arch_info
  1694. {
  1695. int bits_per_word;
  1696. int bits_per_address;
  1697. int bits_per_byte;
  1698. enum bfd_architecture arch;
  1699. unsigned long mach;
  1700. const char *arch_name;
  1701. const char *printable_name;
  1702. unsigned int section_align_power;
  1703. /* TRUE if this is the default machine for the architecture.
  1704. The default arch should be the first entry for an arch so that
  1705. all the entries for that arch can be accessed via <<next>>. */
  1706. bfd_boolean the_default;
  1707. const struct bfd_arch_info * (*compatible)
  1708. (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
  1709. bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
  1710. const struct bfd_arch_info *next;
  1711. }
  1712. bfd_arch_info_type;
  1713. const char *bfd_printable_name (bfd *abfd);
  1714. const bfd_arch_info_type *bfd_scan_arch (const char *string);
  1715. const char **bfd_arch_list (void);
  1716. const bfd_arch_info_type *bfd_arch_get_compatible
  1717. (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
  1718. void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
  1719. enum bfd_architecture bfd_get_arch (bfd *abfd);
  1720. unsigned long bfd_get_mach (bfd *abfd);
  1721. unsigned int bfd_arch_bits_per_byte (bfd *abfd);
  1722. unsigned int bfd_arch_bits_per_address (bfd *abfd);
  1723. const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
  1724. const bfd_arch_info_type *bfd_lookup_arch
  1725. (enum bfd_architecture arch, unsigned long machine);
  1726. const char *bfd_printable_arch_mach
  1727. (enum bfd_architecture arch, unsigned long machine);
  1728. unsigned int bfd_octets_per_byte (bfd *abfd);
  1729. unsigned int bfd_arch_mach_octets_per_byte
  1730. (enum bfd_architecture arch, unsigned long machine);
  1731. /* Extracted from reloc.c. */
  1732. typedef enum bfd_reloc_status
  1733. {
  1734. /* No errors detected. */
  1735. bfd_reloc_ok,
  1736. /* The relocation was performed, but there was an overflow. */
  1737. bfd_reloc_overflow,
  1738. /* The address to relocate was not within the section supplied. */
  1739. bfd_reloc_outofrange,
  1740. /* Used by special functions. */
  1741. bfd_reloc_continue,
  1742. /* Unsupported relocation size requested. */
  1743. bfd_reloc_notsupported,
  1744. /* Unused. */
  1745. bfd_reloc_other,
  1746. /* The symbol to relocate against was undefined. */
  1747. bfd_reloc_undefined,
  1748. /* The relocation was performed, but may not be ok - presently
  1749. generated only when linking i960 coff files with i960 b.out
  1750. symbols. If this type is returned, the error_message argument
  1751. to bfd_perform_relocation will be set. */
  1752. bfd_reloc_dangerous
  1753. }
  1754. bfd_reloc_status_type;
  1755. typedef struct reloc_cache_entry
  1756. {
  1757. /* A pointer into the canonical table of pointers. */
  1758. struct bfd_symbol **sym_ptr_ptr;
  1759. /* offset in section. */
  1760. bfd_size_type address;
  1761. /* addend for relocation value. */
  1762. bfd_vma addend;
  1763. /* Pointer to how to perform the required relocation. */
  1764. reloc_howto_type *howto;
  1765. }
  1766. arelent;
  1767. enum complain_overflow
  1768. {
  1769. /* Do not complain on overflow. */
  1770. complain_overflow_dont,
  1771. /* Complain if the value overflows when considered as a signed
  1772. number one bit larger than the field. ie. A bitfield of N bits
  1773. is allowed to represent -2**n to 2**n-1. */
  1774. complain_overflow_bitfield,
  1775. /* Complain if the value overflows when considered as a signed
  1776. number. */
  1777. complain_overflow_signed,
  1778. /* Complain if the value overflows when considered as an
  1779. unsigned number. */
  1780. complain_overflow_unsigned
  1781. };
  1782. struct reloc_howto_struct
  1783. {
  1784. /* The type field has mainly a documentary use - the back end can
  1785. do what it wants with it, though normally the back end's
  1786. external idea of what a reloc number is stored
  1787. in this field. For example, a PC relative word relocation
  1788. in a coff environment has the type 023 - because that's
  1789. what the outside world calls a R_PCRWORD reloc. */
  1790. unsigned int type;
  1791. /* The value the final relocation is shifted right by. This drops
  1792. unwanted data from the relocation. */
  1793. unsigned int rightshift;
  1794. /* The size of the item to be relocated. This is *not* a
  1795. power-of-two measure. To get the number of bytes operated
  1796. on by a type of relocation, use bfd_get_reloc_size. */
  1797. int size;
  1798. /* The number of bits in the item to be relocated. This is used
  1799. when doing overflow checking. */
  1800. unsigned int bitsize;
  1801. /* Notes that the relocation is relative to the location in the
  1802. data section of the addend. The relocation function will
  1803. subtract from the relocation value the address of the location
  1804. being relocated. */
  1805. bfd_boolean pc_relative;
  1806. /* The bit position of the reloc value in the destination.
  1807. The relocated value is left shifted by this amount. */
  1808. unsigned int bitpos;
  1809. /* What type of overflow error should be checked for when
  1810. relocating. */
  1811. enum complain_overflow complain_on_overflow;
  1812. /* If this field is non null, then the supplied function is
  1813. called rather than the normal function. This allows really
  1814. strange relocation methods to be accommodated (e.g., i960 callj
  1815. instructions). */
  1816. bfd_reloc_status_type (*special_function)
  1817. (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
  1818. bfd *, char **);
  1819. /* The textual name of the relocation type. */
  1820. char *name;
  1821. /* Some formats record a relocation addend in the section contents
  1822. rather than with the relocation. For ELF formats this is the
  1823. distinction between USE_REL and USE_RELA (though the code checks
  1824. for USE_REL == 1/0). The value of this field is TRUE if the
  1825. addend is recorded with the section contents; when performing a
  1826. partial link (ld -r) the section contents (the data) will be
  1827. modified. The value of this field is FALSE if addends are
  1828. recorded with the relocation (in arelent.addend); when performing
  1829. a partial link the relocation will be modified.
  1830. All relocations for all ELF USE_RELA targets should set this field
  1831. to FALSE (values of TRUE should be looked on with suspicion).
  1832. However, the converse is not true: not all relocations of all ELF
  1833. USE_REL targets set this field to TRUE. Why this is so is peculiar
  1834. to each particular target. For relocs that aren't used in partial
  1835. links (e.g. GOT stuff) it doesn't matter what this is set to. */
  1836. bfd_boolean partial_inplace;
  1837. /* src_mask selects the part of the instruction (or data) to be used
  1838. in the relocation sum. If the target relocations don't have an
  1839. addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
  1840. dst_mask to extract the addend from the section contents. If
  1841. relocations do have an addend in the reloc, eg. ELF USE_RELA, this
  1842. field should be zero. Non-zero values for ELF USE_RELA targets are
  1843. bogus as in those cases the value in the dst_mask part of the
  1844. section contents should be treated as garbage. */
  1845. bfd_vma src_mask;
  1846. /* dst_mask selects which parts of the instruction (or data) are
  1847. replaced with a relocated value. */
  1848. bfd_vma dst_mask;
  1849. /* When some formats create PC relative instructions, they leave
  1850. the value of the pc of the place being relocated in the offset
  1851. slot of the instruction, so that a PC relative relocation can
  1852. be made just by adding in an ordinary offset (e.g., sun3 a.out).
  1853. Some formats leave the displacement part of an instruction
  1854. empty (e.g., m88k bcs); this flag signals the fact. */
  1855. bfd_boolean pcrel_offset;
  1856. };
  1857. #define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
  1858. { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
  1859. #define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
  1860. HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
  1861. NAME, FALSE, 0, 0, IN)
  1862. #define EMPTY_HOWTO(C) \
  1863. HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
  1864. NULL, FALSE, 0, 0, FALSE)
  1865. #define HOWTO_PREPARE(relocation, symbol) \
  1866. { \
  1867. if (symbol != NULL) \
  1868. { \
  1869. if (bfd_is_com_section (symbol->section)) \
  1870. { \
  1871. relocation = 0; \
  1872. } \
  1873. else \
  1874. { \
  1875. relocation = symbol->value; \
  1876. } \
  1877. } \
  1878. }
  1879. unsigned int bfd_get_reloc_size (reloc_howto_type *);
  1880. typedef struct relent_chain
  1881. {
  1882. arelent relent;
  1883. struct relent_chain *next;
  1884. }
  1885. arelent_chain;
  1886. bfd_reloc_status_type bfd_check_overflow
  1887. (enum complain_overflow how,
  1888. unsigned int bitsize,
  1889. unsigned int rightshift,
  1890. unsigned int addrsize,
  1891. bfd_vma relocation);
  1892. bfd_reloc_status_type bfd_perform_relocation
  1893. (bfd *abfd,
  1894. arelent *reloc_entry,
  1895. void *data,
  1896. asection *input_section,
  1897. bfd *output_bfd,
  1898. char **error_message);
  1899. bfd_reloc_status_type bfd_install_relocation
  1900. (bfd *abfd,
  1901. arelent *reloc_entry,
  1902. void *data, bfd_vma data_start,
  1903. asection *input_section,
  1904. char **error_message);
  1905. enum bfd_reloc_code_real {
  1906. _dummy_first_bfd_reloc_code_real,
  1907. /* Basic absolute relocations of N bits. */
  1908. BFD_RELOC_64,
  1909. BFD_RELOC_32,
  1910. BFD_RELOC_26,
  1911. BFD_RELOC_24,
  1912. BFD_RELOC_16,
  1913. BFD_RELOC_14,
  1914. BFD_RELOC_8,
  1915. /* PC-relative relocations. Sometimes these are relative to the address
  1916. of the relocation itself; sometimes they are relative to the start of
  1917. the section containing the relocation. It depends on the specific target.
  1918. The 24-bit relocation is used in some Intel 960 configurations. */
  1919. BFD_RELOC_64_PCREL,
  1920. BFD_RELOC_32_PCREL,
  1921. BFD_RELOC_24_PCREL,
  1922. BFD_RELOC_16_PCREL,
  1923. BFD_RELOC_12_PCREL,
  1924. BFD_RELOC_8_PCREL,
  1925. /* Section relative relocations. Some targets need this for DWARF2. */
  1926. BFD_RELOC_32_SECREL,
  1927. /* For ELF. */
  1928. BFD_RELOC_32_GOT_PCREL,
  1929. BFD_RELOC_16_GOT_PCREL,
  1930. BFD_RELOC_8_GOT_PCREL,
  1931. BFD_RELOC_32_GOTOFF,
  1932. BFD_RELOC_16_GOTOFF,
  1933. BFD_RELOC_LO16_GOTOFF,
  1934. BFD_RELOC_HI16_GOTOFF,
  1935. BFD_RELOC_HI16_S_GOTOFF,
  1936. BFD_RELOC_8_GOTOFF,
  1937. BFD_RELOC_64_PLT_PCREL,
  1938. BFD_RELOC_32_PLT_PCREL,
  1939. BFD_RELOC_24_PLT_PCREL,
  1940. BFD_RELOC_16_PLT_PCREL,
  1941. BFD_RELOC_8_PLT_PCREL,
  1942. BFD_RELOC_64_PLTOFF,
  1943. BFD_RELOC_32_PLTOFF,
  1944. BFD_RELOC_16_PLTOFF,
  1945. BFD_RELOC_LO16_PLTOFF,
  1946. BFD_RELOC_HI16_PLTOFF,
  1947. BFD_RELOC_HI16_S_PLTOFF,
  1948. BFD_RELOC_8_PLTOFF,
  1949. /* Relocations used by 68K ELF. */
  1950. BFD_RELOC_68K_GLOB_DAT,
  1951. BFD_RELOC_68K_JMP_SLOT,
  1952. BFD_RELOC_68K_RELATIVE,
  1953. /* Linkage-table relative. */
  1954. BFD_RELOC_32_BASEREL,
  1955. BFD_RELOC_16_BASEREL,
  1956. BFD_RELOC_LO16_BASEREL,
  1957. BFD_RELOC_HI16_BASEREL,
  1958. BFD_RELOC_HI16_S_BASEREL,
  1959. BFD_RELOC_8_BASEREL,
  1960. BFD_RELOC_RVA,
  1961. /* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
  1962. BFD_RELOC_8_FFnn,
  1963. /* These PC-relative relocations are stored as word displacements --
  1964. i.e., byte displacements shifted right two bits. The 30-bit word
  1965. displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
  1966. SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
  1967. signed 16-bit displacement is used on the MIPS, and the 23-bit
  1968. displacement is used on the Alpha. */
  1969. BFD_RELOC_32_PCREL_S2,
  1970. BFD_RELOC_16_PCREL_S2,
  1971. BFD_RELOC_23_PCREL_S2,
  1972. /* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
  1973. the target word. These are used on the SPARC. */
  1974. BFD_RELOC_HI22,
  1975. BFD_RELOC_LO10,
  1976. /* For systems that allocate a Global Pointer register, these are
  1977. displacements off that register. These relocation types are
  1978. handled specially, because the value the register will have is
  1979. decided relatively late. */
  1980. BFD_RELOC_GPREL16,
  1981. BFD_RELOC_GPREL32,
  1982. /* Reloc types used for i960/b.out. */
  1983. BFD_RELOC_I960_CALLJ,
  1984. /* SPARC ELF relocations. There is probably some overlap with other
  1985. relocation types already defined. */
  1986. BFD_RELOC_NONE,
  1987. BFD_RELOC_SPARC_WDISP22,
  1988. BFD_RELOC_SPARC22,
  1989. BFD_RELOC_SPARC13,
  1990. BFD_RELOC_SPARC_GOT10,
  1991. BFD_RELOC_SPARC_GOT13,
  1992. BFD_RELOC_SPARC_GOT22,
  1993. BFD_RELOC_SPARC_PC10,
  1994. BFD_RELOC_SPARC_PC22,
  1995. BFD_RELOC_SPARC_WPLT30,
  1996. BFD_RELOC_SPARC_COPY,
  1997. BFD_RELOC_SPARC_GLOB_DAT,
  1998. BFD_RELOC_SPARC_JMP_SLOT,
  1999. BFD_RELOC_SPARC_RELATIVE,
  2000. BFD_RELOC_SPARC_UA16,
  2001. BFD_RELOC_SPARC_UA32,
  2002. BFD_RELOC_SPARC_UA64,
  2003. /* I think these are specific to SPARC a.out (e.g., Sun 4). */
  2004. BFD_RELOC_SPARC_BASE13,
  2005. BFD_RELOC_SPARC_BASE22,
  2006. /* SPARC64 relocations */
  2007. #define BFD_RELOC_SPARC_64 BFD_RELOC_64
  2008. BFD_RELOC_SPARC_10,
  2009. BFD_RELOC_SPARC_11,
  2010. BFD_RELOC_SPARC_OLO10,
  2011. BFD_RELOC_SPARC_HH22,
  2012. BFD_RELOC_SPARC_HM10,
  2013. BFD_RELOC_SPARC_LM22,
  2014. BFD_RELOC_SPARC_PC_HH22,
  2015. BFD_RELOC_SPARC_PC_HM10,
  2016. BFD_RELOC_SPARC_PC_LM22,
  2017. BFD_RELOC_SPARC_WDISP16,
  2018. BFD_RELOC_SPARC_WDISP19,
  2019. BFD_RELOC_SPARC_7,
  2020. BFD_RELOC_SPARC_6,
  2021. BFD_RELOC_SPARC_5,
  2022. #define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
  2023. BFD_RELOC_SPARC_PLT32,
  2024. BFD_RELOC_SPARC_PLT64,
  2025. BFD_RELOC_SPARC_HIX22,
  2026. BFD_RELOC_SPARC_LOX10,
  2027. BFD_RELOC_SPARC_H44,
  2028. BFD_RELOC_SPARC_M44,
  2029. BFD_RELOC_SPARC_L44,
  2030. BFD_RELOC_SPARC_REGISTER,
  2031. /* SPARC little endian relocation */
  2032. BFD_RELOC_SPARC_REV32,
  2033. /* SPARC TLS relocations */
  2034. BFD_RELOC_SPARC_TLS_GD_HI22,
  2035. BFD_RELOC_SPARC_TLS_GD_LO10,
  2036. BFD_RELOC_SPARC_TLS_GD_ADD,
  2037. BFD_RELOC_SPARC_TLS_GD_CALL,
  2038. BFD_RELOC_SPARC_TLS_LDM_HI22,
  2039. BFD_RELOC_SPARC_TLS_LDM_LO10,
  2040. BFD_RELOC_SPARC_TLS_LDM_ADD,
  2041. BFD_RELOC_SPARC_TLS_LDM_CALL,
  2042. BFD_RELOC_SPARC_TLS_LDO_HIX22,
  2043. BFD_RELOC_SPARC_TLS_LDO_LOX10,
  2044. BFD_RELOC_SPARC_TLS_LDO_ADD,
  2045. BFD_RELOC_SPARC_TLS_IE_HI22,
  2046. BFD_RELOC_SPARC_TLS_IE_LO10,
  2047. BFD_RELOC_SPARC_TLS_IE_LD,
  2048. BFD_RELOC_SPARC_TLS_IE_LDX,
  2049. BFD_RELOC_SPARC_TLS_IE_ADD,
  2050. BFD_RELOC_SPARC_TLS_LE_HIX22,
  2051. BFD_RELOC_SPARC_TLS_LE_LOX10,
  2052. BFD_RELOC_SPARC_TLS_DTPMOD32,
  2053. BFD_RELOC_SPARC_TLS_DTPMOD64,
  2054. BFD_RELOC_SPARC_TLS_DTPOFF32,
  2055. BFD_RELOC_SPARC_TLS_DTPOFF64,
  2056. BFD_RELOC_SPARC_TLS_TPOFF32,
  2057. BFD_RELOC_SPARC_TLS_TPOFF64,
  2058. /* SPU Relocations. */
  2059. BFD_RELOC_SPU_IMM7,
  2060. BFD_RELOC_SPU_IMM8,
  2061. BFD_RELOC_SPU_IMM10,
  2062. BFD_RELOC_SPU_IMM10W,
  2063. BFD_RELOC_SPU_IMM16,
  2064. BFD_RELOC_SPU_IMM16W,
  2065. BFD_RELOC_SPU_IMM18,
  2066. BFD_RELOC_SPU_PCREL9a,
  2067. BFD_RELOC_SPU_PCREL9b,
  2068. BFD_RELOC_SPU_PCREL16,
  2069. BFD_RELOC_SPU_LO16,
  2070. BFD_RELOC_SPU_HI16,
  2071. /* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
  2072. "addend" in some special way.
  2073. For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
  2074. writing; when reading, it will be the absolute section symbol. The
  2075. addend is the displacement in bytes of the "lda" instruction from
  2076. the "ldah" instruction (which is at the address of this reloc). */
  2077. BFD_RELOC_ALPHA_GPDISP_HI16,
  2078. /* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
  2079. with GPDISP_HI16 relocs. The addend is ignored when writing the
  2080. relocations out, and is filled in with the file's GP value on
  2081. reading, for convenience. */
  2082. BFD_RELOC_ALPHA_GPDISP_LO16,
  2083. /* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
  2084. relocation except that there is no accompanying GPDISP_LO16
  2085. relocation. */
  2086. BFD_RELOC_ALPHA_GPDISP,
  2087. /* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
  2088. the assembler turns it into a LDQ instruction to load the address of
  2089. the symbol, and then fills in a register in the real instruction.
  2090. The LITERAL reloc, at the LDQ instruction, refers to the .lita
  2091. section symbol. The addend is ignored when writing, but is filled
  2092. in with the file's GP value on reading, for convenience, as with the
  2093. GPDISP_LO16 reloc.
  2094. The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
  2095. It should refer to the symbol to be referenced, as with 16_GOTOFF,
  2096. but it generates output not based on the position within the .got
  2097. section, but relative to the GP value chosen for the file during the
  2098. final link stage.
  2099. The LITUSE reloc, on the instruction using the loaded address, gives
  2100. information to the linker that it might be able to use to optimize
  2101. away some literal section references. The symbol is ignored (read
  2102. as the absolute section symbol), and the "addend" indicates the type
  2103. of instruction using the register:
  2104. 1 - "memory" fmt insn
  2105. 2 - byte-manipulation (byte offset reg)
  2106. 3 - jsr (target of branch) */
  2107. BFD_RELOC_ALPHA_LITERAL,
  2108. BFD_RELOC_ALPHA_ELF_LITERAL,
  2109. BFD_RELOC_ALPHA_LITUSE,
  2110. /* The HINT relocation indicates a value that should be filled into the
  2111. "hint" field of a jmp/jsr/ret instruction, for possible branch-
  2112. prediction logic which may be provided on some processors. */
  2113. BFD_RELOC_ALPHA_HINT,
  2114. /* The LINKAGE relocation outputs a linkage pair in the object file,
  2115. which is filled by the linker. */
  2116. BFD_RELOC_ALPHA_LINKAGE,
  2117. /* The CODEADDR relocation outputs a STO_CA in the object file,
  2118. which is filled by the linker. */
  2119. BFD_RELOC_ALPHA_CODEADDR,
  2120. /* The GPREL_HI/LO relocations together form a 32-bit offset from the
  2121. GP register. */
  2122. BFD_RELOC_ALPHA_GPREL_HI16,
  2123. BFD_RELOC_ALPHA_GPREL_LO16,
  2124. /* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
  2125. share a common GP, and the target address is adjusted for
  2126. STO_ALPHA_STD_GPLOAD. */
  2127. BFD_RELOC_ALPHA_BRSGP,
  2128. /* Alpha thread-local storage relocations. */
  2129. BFD_RELOC_ALPHA_TLSGD,
  2130. BFD_RELOC_ALPHA_TLSLDM,
  2131. BFD_RELOC_ALPHA_DTPMOD64,
  2132. BFD_RELOC_ALPHA_GOTDTPREL16,
  2133. BFD_RELOC_ALPHA_DTPREL64,
  2134. BFD_RELOC_ALPHA_DTPREL_HI16,
  2135. BFD_RELOC_ALPHA_DTPREL_LO16,
  2136. BFD_RELOC_ALPHA_DTPREL16,
  2137. BFD_RELOC_ALPHA_GOTTPREL16,
  2138. BFD_RELOC_ALPHA_TPREL64,
  2139. BFD_RELOC_ALPHA_TPREL_HI16,
  2140. BFD_RELOC_ALPHA_TPREL_LO16,
  2141. BFD_RELOC_ALPHA_TPREL16,
  2142. /* Bits 27..2 of the relocation address shifted right 2 bits;
  2143. simple reloc otherwise. */
  2144. BFD_RELOC_MIPS_JMP,
  2145. /* The MIPS16 jump instruction. */
  2146. BFD_RELOC_MIPS16_JMP,
  2147. /* MIPS16 GP relative reloc. */
  2148. BFD_RELOC_MIPS16_GPREL,
  2149. /* High 16 bits of 32-bit value; simple reloc. */
  2150. BFD_RELOC_HI16,
  2151. /* High 16 bits of 32-bit value but the low 16 bits will be sign
  2152. extended and added to form the final result. If the low 16
  2153. bits form a negative number, we need to add one to the high value
  2154. to compensate for the borrow when the low bits are added. */
  2155. BFD_RELOC_HI16_S,
  2156. /* Low 16 bits. */
  2157. BFD_RELOC_LO16,
  2158. /* High 16 bits of 32-bit pc-relative value */
  2159. BFD_RELOC_HI16_PCREL,
  2160. /* High 16 bits of 32-bit pc-relative value, adjusted */
  2161. BFD_RELOC_HI16_S_PCREL,
  2162. /* Low 16 bits of pc-relative value */
  2163. BFD_RELOC_LO16_PCREL,
  2164. /* MIPS16 high 16 bits of 32-bit value. */
  2165. BFD_RELOC_MIPS16_HI16,
  2166. /* MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign
  2167. extended and added to form the final result. If the low 16
  2168. bits form a negative number, we need to add one to the high value
  2169. to compensate for the borrow when the low bits are added. */
  2170. BFD_RELOC_MIPS16_HI16_S,
  2171. /* MIPS16 low 16 bits. */
  2172. BFD_RELOC_MIPS16_LO16,
  2173. /* Relocation against a MIPS literal section. */
  2174. BFD_RELOC_MIPS_LITERAL,
  2175. /* MIPS ELF relocations. */
  2176. BFD_RELOC_MIPS_GOT16,
  2177. BFD_RELOC_MIPS_CALL16,
  2178. BFD_RELOC_MIPS_GOT_HI16,
  2179. BFD_RELOC_MIPS_GOT_LO16,
  2180. BFD_RELOC_MIPS_CALL_HI16,
  2181. BFD_RELOC_MIPS_CALL_LO16,
  2182. BFD_RELOC_MIPS_SUB,
  2183. BFD_RELOC_MIPS_GOT_PAGE,
  2184. BFD_RELOC_MIPS_GOT_OFST,
  2185. BFD_RELOC_MIPS_GOT_DISP,
  2186. BFD_RELOC_MIPS_SHIFT5,
  2187. BFD_RELOC_MIPS_SHIFT6,
  2188. BFD_RELOC_MIPS_INSERT_A,
  2189. BFD_RELOC_MIPS_INSERT_B,
  2190. BFD_RELOC_MIPS_DELETE,
  2191. BFD_RELOC_MIPS_HIGHEST,
  2192. BFD_RELOC_MIPS_HIGHER,
  2193. BFD_RELOC_MIPS_SCN_DISP,
  2194. BFD_RELOC_MIPS_REL16,
  2195. BFD_RELOC_MIPS_RELGOT,
  2196. BFD_RELOC_MIPS_JALR,
  2197. BFD_RELOC_MIPS_TLS_DTPMOD32,
  2198. BFD_RELOC_MIPS_TLS_DTPREL32,
  2199. BFD_RELOC_MIPS_TLS_DTPMOD64,
  2200. BFD_RELOC_MIPS_TLS_DTPREL64,
  2201. BFD_RELOC_MIPS_TLS_GD,
  2202. BFD_RELOC_MIPS_TLS_LDM,
  2203. BFD_RELOC_MIPS_TLS_DTPREL_HI16,
  2204. BFD_RELOC_MIPS_TLS_DTPREL_LO16,
  2205. BFD_RELOC_MIPS_TLS_GOTTPREL,
  2206. BFD_RELOC_MIPS_TLS_TPREL32,
  2207. BFD_RELOC_MIPS_TLS_TPREL64,
  2208. BFD_RELOC_MIPS_TLS_TPREL_HI16,
  2209. BFD_RELOC_MIPS_TLS_TPREL_LO16,
  2210. /* MIPS ELF relocations (VxWorks extensions). */
  2211. BFD_RELOC_MIPS_COPY,
  2212. BFD_RELOC_MIPS_JUMP_SLOT,
  2213. /* Fujitsu Frv Relocations. */
  2214. BFD_RELOC_FRV_LABEL16,
  2215. BFD_RELOC_FRV_LABEL24,
  2216. BFD_RELOC_FRV_LO16,
  2217. BFD_RELOC_FRV_HI16,
  2218. BFD_RELOC_FRV_GPREL12,
  2219. BFD_RELOC_FRV_GPRELU12,
  2220. BFD_RELOC_FRV_GPREL32,
  2221. BFD_RELOC_FRV_GPRELHI,
  2222. BFD_RELOC_FRV_GPRELLO,
  2223. BFD_RELOC_FRV_GOT12,
  2224. BFD_RELOC_FRV_GOTHI,
  2225. BFD_RELOC_FRV_GOTLO,
  2226. BFD_RELOC_FRV_FUNCDESC,
  2227. BFD_RELOC_FRV_FUNCDESC_GOT12,
  2228. BFD_RELOC_FRV_FUNCDESC_GOTHI,
  2229. BFD_RELOC_FRV_FUNCDESC_GOTLO,
  2230. BFD_RELOC_FRV_FUNCDESC_VALUE,
  2231. BFD_RELOC_FRV_FUNCDESC_GOTOFF12,
  2232. BFD_RELOC_FRV_FUNCDESC_GOTOFFHI,
  2233. BFD_RELOC_FRV_FUNCDESC_GOTOFFLO,
  2234. BFD_RELOC_FRV_GOTOFF12,
  2235. BFD_RELOC_FRV_GOTOFFHI,
  2236. BFD_RELOC_FRV_GOTOFFLO,
  2237. BFD_RELOC_FRV_GETTLSOFF,
  2238. BFD_RELOC_FRV_TLSDESC_VALUE,
  2239. BFD_RELOC_FRV_GOTTLSDESC12,
  2240. BFD_RELOC_FRV_GOTTLSDESCHI,
  2241. BFD_RELOC_FRV_GOTTLSDESCLO,
  2242. BFD_RELOC_FRV_TLSMOFF12,
  2243. BFD_RELOC_FRV_TLSMOFFHI,
  2244. BFD_RELOC_FRV_TLSMOFFLO,
  2245. BFD_RELOC_FRV_GOTTLSOFF12,
  2246. BFD_RELOC_FRV_GOTTLSOFFHI,
  2247. BFD_RELOC_FRV_GOTTLSOFFLO,
  2248. BFD_RELOC_FRV_TLSOFF,
  2249. BFD_RELOC_FRV_TLSDESC_RELAX,
  2250. BFD_RELOC_FRV_GETTLSOFF_RELAX,
  2251. BFD_RELOC_FRV_TLSOFF_RELAX,
  2252. BFD_RELOC_FRV_TLSMOFF,
  2253. /* This is a 24bit GOT-relative reloc for the mn10300. */
  2254. BFD_RELOC_MN10300_GOTOFF24,
  2255. /* This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
  2256. in the instruction. */
  2257. BFD_RELOC_MN10300_GOT32,
  2258. /* This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
  2259. in the instruction. */
  2260. BFD_RELOC_MN10300_GOT24,
  2261. /* This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
  2262. in the instruction. */
  2263. BFD_RELOC_MN10300_GOT16,
  2264. /* Copy symbol at runtime. */
  2265. BFD_RELOC_MN10300_COPY,
  2266. /* Create GOT entry. */
  2267. BFD_RELOC_MN10300_GLOB_DAT,
  2268. /* Create PLT entry. */
  2269. BFD_RELOC_MN10300_JMP_SLOT,
  2270. /* Adjust by program base. */
  2271. BFD_RELOC_MN10300_RELATIVE,
  2272. /* i386/elf relocations */
  2273. BFD_RELOC_386_GOT32,
  2274. BFD_RELOC_386_PLT32,
  2275. BFD_RELOC_386_COPY,
  2276. BFD_RELOC_386_GLOB_DAT,
  2277. BFD_RELOC_386_JUMP_SLOT,
  2278. BFD_RELOC_386_RELATIVE,
  2279. BFD_RELOC_386_GOTOFF,
  2280. BFD_RELOC_386_GOTPC,
  2281. BFD_RELOC_386_TLS_TPOFF,
  2282. BFD_RELOC_386_TLS_IE,
  2283. BFD_RELOC_386_TLS_GOTIE,
  2284. BFD_RELOC_386_TLS_LE,
  2285. BFD_RELOC_386_TLS_GD,
  2286. BFD_RELOC_386_TLS_LDM,
  2287. BFD_RELOC_386_TLS_LDO_32,
  2288. BFD_RELOC_386_TLS_IE_32,
  2289. BFD_RELOC_386_TLS_LE_32,
  2290. BFD_RELOC_386_TLS_DTPMOD32,
  2291. BFD_RELOC_386_TLS_DTPOFF32,
  2292. BFD_RELOC_386_TLS_TPOFF32,
  2293. BFD_RELOC_386_TLS_GOTDESC,
  2294. BFD_RELOC_386_TLS_DESC_CALL,
  2295. BFD_RELOC_386_TLS_DESC,
  2296. /* x86-64/elf relocations */
  2297. BFD_RELOC_X86_64_GOT32,
  2298. BFD_RELOC_X86_64_PLT32,
  2299. BFD_RELOC_X86_64_COPY,
  2300. BFD_RELOC_X86_64_GLOB_DAT,
  2301. BFD_RELOC_X86_64_JUMP_SLOT,
  2302. BFD_RELOC_X86_64_RELATIVE,
  2303. BFD_RELOC_X86_64_GOTPCREL,
  2304. BFD_RELOC_X86_64_32S,
  2305. BFD_RELOC_X86_64_DTPMOD64,
  2306. BFD_RELOC_X86_64_DTPOFF64,
  2307. BFD_RELOC_X86_64_TPOFF64,
  2308. BFD_RELOC_X86_64_TLSGD,
  2309. BFD_RELOC_X86_64_TLSLD,
  2310. BFD_RELOC_X86_64_DTPOFF32,
  2311. BFD_RELOC_X86_64_GOTTPOFF,
  2312. BFD_RELOC_X86_64_TPOFF32,
  2313. BFD_RELOC_X86_64_GOTOFF64,
  2314. BFD_RELOC_X86_64_GOTPC32,
  2315. BFD_RELOC_X86_64_GOT64,
  2316. BFD_RELOC_X86_64_GOTPCREL64,
  2317. BFD_RELOC_X86_64_GOTPC64,
  2318. BFD_RELOC_X86_64_GOTPLT64,
  2319. BFD_RELOC_X86_64_PLTOFF64,
  2320. BFD_RELOC_X86_64_GOTPC32_TLSDESC,
  2321. BFD_RELOC_X86_64_TLSDESC_CALL,
  2322. BFD_RELOC_X86_64_TLSDESC,
  2323. /* ns32k relocations */
  2324. BFD_RELOC_NS32K_IMM_8,
  2325. BFD_RELOC_NS32K_IMM_16,
  2326. BFD_RELOC_NS32K_IMM_32,
  2327. BFD_RELOC_NS32K_IMM_8_PCREL,
  2328. BFD_RELOC_NS32K_IMM_16_PCREL,
  2329. BFD_RELOC_NS32K_IMM_32_PCREL,
  2330. BFD_RELOC_NS32K_DISP_8,
  2331. BFD_RELOC_NS32K_DISP_16,
  2332. BFD_RELOC_NS32K_DISP_32,
  2333. BFD_RELOC_NS32K_DISP_8_PCREL,
  2334. BFD_RELOC_NS32K_DISP_16_PCREL,
  2335. BFD_RELOC_NS32K_DISP_32_PCREL,
  2336. /* PDP11 relocations */
  2337. BFD_RELOC_PDP11_DISP_8_PCREL,
  2338. BFD_RELOC_PDP11_DISP_6_PCREL,
  2339. /* Picojava relocs. Not all of these appear in object files. */
  2340. BFD_RELOC_PJ_CODE_HI16,
  2341. BFD_RELOC_PJ_CODE_LO16,
  2342. BFD_RELOC_PJ_CODE_DIR16,
  2343. BFD_RELOC_PJ_CODE_DIR32,
  2344. BFD_RELOC_PJ_CODE_REL16,
  2345. BFD_RELOC_PJ_CODE_REL32,
  2346. /* Power(rs6000) and PowerPC relocations. */
  2347. BFD_RELOC_PPC_B26,
  2348. BFD_RELOC_PPC_BA26,
  2349. BFD_RELOC_PPC_TOC16,
  2350. BFD_RELOC_PPC_B16,
  2351. BFD_RELOC_PPC_B16_BRTAKEN,
  2352. BFD_RELOC_PPC_B16_BRNTAKEN,
  2353. BFD_RELOC_PPC_BA16,
  2354. BFD_RELOC_PPC_BA16_BRTAKEN,
  2355. BFD_RELOC_PPC_BA16_BRNTAKEN,
  2356. BFD_RELOC_PPC_COPY,
  2357. BFD_RELOC_PPC_GLOB_DAT,
  2358. BFD_RELOC_PPC_JMP_SLOT,
  2359. BFD_RELOC_PPC_RELATIVE,
  2360. BFD_RELOC_PPC_LOCAL24PC,
  2361. BFD_RELOC_PPC_EMB_NADDR32,
  2362. BFD_RELOC_PPC_EMB_NADDR16,
  2363. BFD_RELOC_PPC_EMB_NADDR16_LO,
  2364. BFD_RELOC_PPC_EMB_NADDR16_HI,
  2365. BFD_RELOC_PPC_EMB_NADDR16_HA,
  2366. BFD_RELOC_PPC_EMB_SDAI16,
  2367. BFD_RELOC_PPC_EMB_SDA2I16,
  2368. BFD_RELOC_PPC_EMB_SDA2REL,
  2369. BFD_RELOC_PPC_EMB_SDA21,
  2370. BFD_RELOC_PPC_EMB_MRKREF,
  2371. BFD_RELOC_PPC_EMB_RELSEC16,
  2372. BFD_RELOC_PPC_EMB_RELST_LO,
  2373. BFD_RELOC_PPC_EMB_RELST_HI,
  2374. BFD_RELOC_PPC_EMB_RELST_HA,
  2375. BFD_RELOC_PPC_EMB_BIT_FLD,
  2376. BFD_RELOC_PPC_EMB_RELSDA,
  2377. BFD_RELOC_PPC64_HIGHER,
  2378. BFD_RELOC_PPC64_HIGHER_S,
  2379. BFD_RELOC_PPC64_HIGHEST,
  2380. BFD_RELOC_PPC64_HIGHEST_S,
  2381. BFD_RELOC_PPC64_TOC16_LO,
  2382. BFD_RELOC_PPC64_TOC16_HI,
  2383. BFD_RELOC_PPC64_TOC16_HA,
  2384. BFD_RELOC_PPC64_TOC,
  2385. BFD_RELOC_PPC64_PLTGOT16,
  2386. BFD_RELOC_PPC64_PLTGOT16_LO,
  2387. BFD_RELOC_PPC64_PLTGOT16_HI,
  2388. BFD_RELOC_PPC64_PLTGOT16_HA,
  2389. BFD_RELOC_PPC64_ADDR16_DS,
  2390. BFD_RELOC_PPC64_ADDR16_LO_DS,
  2391. BFD_RELOC_PPC64_GOT16_DS,
  2392. BFD_RELOC_PPC64_GOT16_LO_DS,
  2393. BFD_RELOC_PPC64_PLT16_LO_DS,
  2394. BFD_RELOC_PPC64_SECTOFF_DS,
  2395. BFD_RELOC_PPC64_SECTOFF_LO_DS,
  2396. BFD_RELOC_PPC64_TOC16_DS,
  2397. BFD_RELOC_PPC64_TOC16_LO_DS,
  2398. BFD_RELOC_PPC64_PLTGOT16_DS,
  2399. BFD_RELOC_PPC64_PLTGOT16_LO_DS,
  2400. /* PowerPC and PowerPC64 thread-local storage relocations. */
  2401. BFD_RELOC_PPC_TLS,
  2402. BFD_RELOC_PPC_DTPMOD,
  2403. BFD_RELOC_PPC_TPREL16,
  2404. BFD_RELOC_PPC_TPREL16_LO,
  2405. BFD_RELOC_PPC_TPREL16_HI,
  2406. BFD_RELOC_PPC_TPREL16_HA,
  2407. BFD_RELOC_PPC_TPREL,
  2408. BFD_RELOC_PPC_DTPREL16,
  2409. BFD_RELOC_PPC_DTPREL16_LO,
  2410. BFD_RELOC_PPC_DTPREL16_HI,
  2411. BFD_RELOC_PPC_DTPREL16_HA,
  2412. BFD_RELOC_PPC_DTPREL,
  2413. BFD_RELOC_PPC_GOT_TLSGD16,
  2414. BFD_RELOC_PPC_GOT_TLSGD16_LO,
  2415. BFD_RELOC_PPC_GOT_TLSGD16_HI,
  2416. BFD_RELOC_PPC_GOT_TLSGD16_HA,
  2417. BFD_RELOC_PPC_GOT_TLSLD16,
  2418. BFD_RELOC_PPC_GOT_TLSLD16_LO,
  2419. BFD_RELOC_PPC_GOT_TLSLD16_HI,
  2420. BFD_RELOC_PPC_GOT_TLSLD16_HA,
  2421. BFD_RELOC_PPC_GOT_TPREL16,
  2422. BFD_RELOC_PPC_GOT_TPREL16_LO,
  2423. BFD_RELOC_PPC_GOT_TPREL16_HI,
  2424. BFD_RELOC_PPC_GOT_TPREL16_HA,
  2425. BFD_RELOC_PPC_GOT_DTPREL16,
  2426. BFD_RELOC_PPC_GOT_DTPREL16_LO,
  2427. BFD_RELOC_PPC_GOT_DTPREL16_HI,
  2428. BFD_RELOC_PPC_GOT_DTPREL16_HA,
  2429. BFD_RELOC_PPC64_TPREL16_DS,
  2430. BFD_RELOC_PPC64_TPREL16_LO_DS,
  2431. BFD_RELOC_PPC64_TPREL16_HIGHER,
  2432. BFD_RELOC_PPC64_TPREL16_HIGHERA,
  2433. BFD_RELOC_PPC64_TPREL16_HIGHEST,
  2434. BFD_RELOC_PPC64_TPREL16_HIGHESTA,
  2435. BFD_RELOC_PPC64_DTPREL16_DS,
  2436. BFD_RELOC_PPC64_DTPREL16_LO_DS,
  2437. BFD_RELOC_PPC64_DTPREL16_HIGHER,
  2438. BFD_RELOC_PPC64_DTPREL16_HIGHERA,
  2439. BFD_RELOC_PPC64_DTPREL16_HIGHEST,
  2440. BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
  2441. /* IBM 370/390 relocations */
  2442. BFD_RELOC_I370_D12,
  2443. /* The type of reloc used to build a constructor table - at the moment
  2444. probably a 32 bit wide absolute relocation, but the target can choose.
  2445. It generally does map to one of the other relocation types. */
  2446. BFD_RELOC_CTOR,
  2447. /* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
  2448. not stored in the instruction. */
  2449. BFD_RELOC_ARM_PCREL_BRANCH,
  2450. /* ARM 26 bit pc-relative branch. The lowest bit must be zero and is
  2451. not stored in the instruction. The 2nd lowest bit comes from a 1 bit
  2452. field in the instruction. */
  2453. BFD_RELOC_ARM_PCREL_BLX,
  2454. /* Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
  2455. not stored in the instruction. The 2nd lowest bit comes from a 1 bit
  2456. field in the instruction. */
  2457. BFD_RELOC_THUMB_PCREL_BLX,
  2458. /* ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. */
  2459. BFD_RELOC_ARM_PCREL_CALL,
  2460. /* ARM 26-bit pc-relative branch for B or conditional BL instruction. */
  2461. BFD_RELOC_ARM_PCREL_JUMP,
  2462. /* Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches.
  2463. The lowest bit must be zero and is not stored in the instruction.
  2464. Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an
  2465. "nn" one smaller in all cases. Note further that BRANCH23
  2466. corresponds to R_ARM_THM_CALL. */
  2467. BFD_RELOC_THUMB_PCREL_BRANCH7,
  2468. BFD_RELOC_THUMB_PCREL_BRANCH9,
  2469. BFD_RELOC_THUMB_PCREL_BRANCH12,
  2470. BFD_RELOC_THUMB_PCREL_BRANCH20,
  2471. BFD_RELOC_THUMB_PCREL_BRANCH23,
  2472. BFD_RELOC_THUMB_PCREL_BRANCH25,
  2473. /* 12-bit immediate offset, used in ARM-format ldr and str instructions. */
  2474. BFD_RELOC_ARM_OFFSET_IMM,
  2475. /* 5-bit immediate offset, used in Thumb-format ldr and str instructions. */
  2476. BFD_RELOC_ARM_THUMB_OFFSET,
  2477. /* Pc-relative or absolute relocation depending on target. Used for
  2478. entries in .init_array sections. */
  2479. BFD_RELOC_ARM_TARGET1,
  2480. /* Read-only segment base relative address. */
  2481. BFD_RELOC_ARM_ROSEGREL32,
  2482. /* Data segment base relative address. */
  2483. BFD_RELOC_ARM_SBREL32,
  2484. /* This reloc is used for references to RTTI data from exception handling
  2485. tables. The actual definition depends on the target. It may be a
  2486. pc-relative or some form of GOT-indirect relocation. */
  2487. BFD_RELOC_ARM_TARGET2,
  2488. /* 31-bit PC relative address. */
  2489. BFD_RELOC_ARM_PREL31,
  2490. /* Low and High halfword relocations for MOVW and MOVT instructions. */
  2491. BFD_RELOC_ARM_MOVW,
  2492. BFD_RELOC_ARM_MOVT,
  2493. BFD_RELOC_ARM_MOVW_PCREL,
  2494. BFD_RELOC_ARM_MOVT_PCREL,
  2495. BFD_RELOC_ARM_THUMB_MOVW,
  2496. BFD_RELOC_ARM_THUMB_MOVT,
  2497. BFD_RELOC_ARM_THUMB_MOVW_PCREL,
  2498. BFD_RELOC_ARM_THUMB_MOVT_PCREL,
  2499. /* Relocations for setting up GOTs and PLTs for shared libraries. */
  2500. BFD_RELOC_ARM_JUMP_SLOT,
  2501. BFD_RELOC_ARM_GLOB_DAT,
  2502. BFD_RELOC_ARM_GOT32,
  2503. BFD_RELOC_ARM_PLT32,
  2504. BFD_RELOC_ARM_RELATIVE,
  2505. BFD_RELOC_ARM_GOTOFF,
  2506. BFD_RELOC_ARM_GOTPC,
  2507. /* ARM thread-local storage relocations. */
  2508. BFD_RELOC_ARM_TLS_GD32,
  2509. BFD_RELOC_ARM_TLS_LDO32,
  2510. BFD_RELOC_ARM_TLS_LDM32,
  2511. BFD_RELOC_ARM_TLS_DTPOFF32,
  2512. BFD_RELOC_ARM_TLS_DTPMOD32,
  2513. BFD_RELOC_ARM_TLS_TPOFF32,
  2514. BFD_RELOC_ARM_TLS_IE32,
  2515. BFD_RELOC_ARM_TLS_LE32,
  2516. /* ARM group relocations. */
  2517. BFD_RELOC_ARM_ALU_PC_G0_NC,
  2518. BFD_RELOC_ARM_ALU_PC_G0,
  2519. BFD_RELOC_ARM_ALU_PC_G1_NC,
  2520. BFD_RELOC_ARM_ALU_PC_G1,
  2521. BFD_RELOC_ARM_ALU_PC_G2,
  2522. BFD_RELOC_ARM_LDR_PC_G0,
  2523. BFD_RELOC_ARM_LDR_PC_G1,
  2524. BFD_RELOC_ARM_LDR_PC_G2,
  2525. BFD_RELOC_ARM_LDRS_PC_G0,
  2526. BFD_RELOC_ARM_LDRS_PC_G1,
  2527. BFD_RELOC_ARM_LDRS_PC_G2,
  2528. BFD_RELOC_ARM_LDC_PC_G0,
  2529. BFD_RELOC_ARM_LDC_PC_G1,
  2530. BFD_RELOC_ARM_LDC_PC_G2,
  2531. BFD_RELOC_ARM_ALU_SB_G0_NC,
  2532. BFD_RELOC_ARM_ALU_SB_G0,
  2533. BFD_RELOC_ARM_ALU_SB_G1_NC,
  2534. BFD_RELOC_ARM_ALU_SB_G1,
  2535. BFD_RELOC_ARM_ALU_SB_G2,
  2536. BFD_RELOC_ARM_LDR_SB_G0,
  2537. BFD_RELOC_ARM_LDR_SB_G1,
  2538. BFD_RELOC_ARM_LDR_SB_G2,
  2539. BFD_RELOC_ARM_LDRS_SB_G0,
  2540. BFD_RELOC_ARM_LDRS_SB_G1,
  2541. BFD_RELOC_ARM_LDRS_SB_G2,
  2542. BFD_RELOC_ARM_LDC_SB_G0,
  2543. BFD_RELOC_ARM_LDC_SB_G1,
  2544. BFD_RELOC_ARM_LDC_SB_G2,
  2545. /* These relocs are only used within the ARM assembler. They are not
  2546. (at present) written to any object files. */
  2547. BFD_RELOC_ARM_IMMEDIATE,
  2548. BFD_RELOC_ARM_ADRL_IMMEDIATE,
  2549. BFD_RELOC_ARM_T32_IMMEDIATE,
  2550. BFD_RELOC_ARM_T32_ADD_IMM,
  2551. BFD_RELOC_ARM_T32_IMM12,
  2552. BFD_RELOC_ARM_T32_ADD_PC12,
  2553. BFD_RELOC_ARM_SHIFT_IMM,
  2554. BFD_RELOC_ARM_SMC,
  2555. BFD_RELOC_ARM_SWI,
  2556. BFD_RELOC_ARM_MULTI,
  2557. BFD_RELOC_ARM_CP_OFF_IMM,
  2558. BFD_RELOC_ARM_CP_OFF_IMM_S2,
  2559. BFD_RELOC_ARM_T32_CP_OFF_IMM,
  2560. BFD_RELOC_ARM_T32_CP_OFF_IMM_S2,
  2561. BFD_RELOC_ARM_ADR_IMM,
  2562. BFD_RELOC_ARM_LDR_IMM,
  2563. BFD_RELOC_ARM_LITERAL,
  2564. BFD_RELOC_ARM_IN_POOL,
  2565. BFD_RELOC_ARM_OFFSET_IMM8,
  2566. BFD_RELOC_ARM_T32_OFFSET_U8,
  2567. BFD_RELOC_ARM_T32_OFFSET_IMM,
  2568. BFD_RELOC_ARM_HWLITERAL,
  2569. BFD_RELOC_ARM_THUMB_ADD,
  2570. BFD_RELOC_ARM_THUMB_IMM,
  2571. BFD_RELOC_ARM_THUMB_SHIFT,
  2572. /* Renesas / SuperH SH relocs. Not all of these appear in object files. */
  2573. BFD_RELOC_SH_PCDISP8BY2,
  2574. BFD_RELOC_SH_PCDISP12BY2,
  2575. BFD_RELOC_SH_IMM3,
  2576. BFD_RELOC_SH_IMM3U,
  2577. BFD_RELOC_SH_DISP12,
  2578. BFD_RELOC_SH_DISP12BY2,
  2579. BFD_RELOC_SH_DISP12BY4,
  2580. BFD_RELOC_SH_DISP12BY8,
  2581. BFD_RELOC_SH_DISP20,
  2582. BFD_RELOC_SH_DISP20BY8,
  2583. BFD_RELOC_SH_IMM4,
  2584. BFD_RELOC_SH_IMM4BY2,
  2585. BFD_RELOC_SH_IMM4BY4,
  2586. BFD_RELOC_SH_IMM8,
  2587. BFD_RELOC_SH_IMM8BY2,
  2588. BFD_RELOC_SH_IMM8BY4,
  2589. BFD_RELOC_SH_PCRELIMM8BY2,
  2590. BFD_RELOC_SH_PCRELIMM8BY4,
  2591. BFD_RELOC_SH_SWITCH16,
  2592. BFD_RELOC_SH_SWITCH32,
  2593. BFD_RELOC_SH_USES,
  2594. BFD_RELOC_SH_COUNT,
  2595. BFD_RELOC_SH_ALIGN,
  2596. BFD_RELOC_SH_CODE,
  2597. BFD_RELOC_SH_DATA,
  2598. BFD_RELOC_SH_LABEL,
  2599. BFD_RELOC_SH_LOOP_START,
  2600. BFD_RELOC_SH_LOOP_END,
  2601. BFD_RELOC_SH_COPY,
  2602. BFD_RELOC_SH_GLOB_DAT,
  2603. BFD_RELOC_SH_JMP_SLOT,
  2604. BFD_RELOC_SH_RELATIVE,
  2605. BFD_RELOC_SH_GOTPC,
  2606. BFD_RELOC_SH_GOT_LOW16,
  2607. BFD_RELOC_SH_GOT_MEDLOW16,
  2608. BFD_RELOC_SH_GOT_MEDHI16,
  2609. BFD_RELOC_SH_GOT_HI16,
  2610. BFD_RELOC_SH_GOTPLT_LOW16,
  2611. BFD_RELOC_SH_GOTPLT_MEDLOW16,
  2612. BFD_RELOC_SH_GOTPLT_MEDHI16,
  2613. BFD_RELOC_SH_GOTPLT_HI16,
  2614. BFD_RELOC_SH_PLT_LOW16,
  2615. BFD_RELOC_SH_PLT_MEDLOW16,
  2616. BFD_RELOC_SH_PLT_MEDHI16,
  2617. BFD_RELOC_SH_PLT_HI16,
  2618. BFD_RELOC_SH_GOTOFF_LOW16,
  2619. BFD_RELOC_SH_GOTOFF_MEDLOW16,
  2620. BFD_RELOC_SH_GOTOFF_MEDHI16,
  2621. BFD_RELOC_SH_GOTOFF_HI16,
  2622. BFD_RELOC_SH_GOTPC_LOW16,
  2623. BFD_RELOC_SH_GOTPC_MEDLOW16,
  2624. BFD_RELOC_SH_GOTPC_MEDHI16,
  2625. BFD_RELOC_SH_GOTPC_HI16,
  2626. BFD_RELOC_SH_COPY64,
  2627. BFD_RELOC_SH_GLOB_DAT64,
  2628. BFD_RELOC_SH_JMP_SLOT64,
  2629. BFD_RELOC_SH_RELATIVE64,
  2630. BFD_RELOC_SH_GOT10BY4,
  2631. BFD_RELOC_SH_GOT10BY8,
  2632. BFD_RELOC_SH_GOTPLT10BY4,
  2633. BFD_RELOC_SH_GOTPLT10BY8,
  2634. BFD_RELOC_SH_GOTPLT32,
  2635. BFD_RELOC_SH_SHMEDIA_CODE,
  2636. BFD_RELOC_SH_IMMU5,
  2637. BFD_RELOC_SH_IMMS6,
  2638. BFD_RELOC_SH_IMMS6BY32,
  2639. BFD_RELOC_SH_IMMU6,
  2640. BFD_RELOC_SH_IMMS10,
  2641. BFD_RELOC_SH_IMMS10BY2,
  2642. BFD_RELOC_SH_IMMS10BY4,
  2643. BFD_RELOC_SH_IMMS10BY8,
  2644. BFD_RELOC_SH_IMMS16,
  2645. BFD_RELOC_SH_IMMU16,
  2646. BFD_RELOC_SH_IMM_LOW16,
  2647. BFD_RELOC_SH_IMM_LOW16_PCREL,
  2648. BFD_RELOC_SH_IMM_MEDLOW16,
  2649. BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
  2650. BFD_RELOC_SH_IMM_MEDHI16,
  2651. BFD_RELOC_SH_IMM_MEDHI16_PCREL,
  2652. BFD_RELOC_SH_IMM_HI16,
  2653. BFD_RELOC_SH_IMM_HI16_PCREL,
  2654. BFD_RELOC_SH_PT_16,
  2655. BFD_RELOC_SH_TLS_GD_32,
  2656. BFD_RELOC_SH_TLS_LD_32,
  2657. BFD_RELOC_SH_TLS_LDO_32,
  2658. BFD_RELOC_SH_TLS_IE_32,
  2659. BFD_RELOC_SH_TLS_LE_32,
  2660. BFD_RELOC_SH_TLS_DTPMOD32,
  2661. BFD_RELOC_SH_TLS_DTPOFF32,
  2662. BFD_RELOC_SH_TLS_TPOFF32,
  2663. /* ARC Cores relocs.
  2664. ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
  2665. not stored in the instruction. The high 20 bits are installed in bits 26
  2666. through 7 of the instruction. */
  2667. BFD_RELOC_ARC_B22_PCREL,
  2668. /* ARC 26 bit absolute branch. The lowest two bits must be zero and are not
  2669. stored in the instruction. The high 24 bits are installed in bits 23
  2670. through 0. */
  2671. BFD_RELOC_ARC_B26,
  2672. /* ADI Blackfin 16 bit immediate absolute reloc. */
  2673. BFD_RELOC_BFIN_16_IMM,
  2674. /* ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. */
  2675. BFD_RELOC_BFIN_16_HIGH,
  2676. /* ADI Blackfin 'a' part of LSETUP. */
  2677. BFD_RELOC_BFIN_4_PCREL,
  2678. /* ADI Blackfin. */
  2679. BFD_RELOC_BFIN_5_PCREL,
  2680. /* ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. */
  2681. BFD_RELOC_BFIN_16_LOW,
  2682. /* ADI Blackfin. */
  2683. BFD_RELOC_BFIN_10_PCREL,
  2684. /* ADI Blackfin 'b' part of LSETUP. */
  2685. BFD_RELOC_BFIN_11_PCREL,
  2686. /* ADI Blackfin. */
  2687. BFD_RELOC_BFIN_12_PCREL_JUMP,
  2688. /* ADI Blackfin Short jump, pcrel. */
  2689. BFD_RELOC_BFIN_12_PCREL_JUMP_S,
  2690. /* ADI Blackfin Call.x not implemented. */
  2691. BFD_RELOC_BFIN_24_PCREL_CALL_X,
  2692. /* ADI Blackfin Long Jump pcrel. */
  2693. BFD_RELOC_BFIN_24_PCREL_JUMP_L,
  2694. /* ADI Blackfin FD-PIC relocations. */
  2695. BFD_RELOC_BFIN_GOT17M4,
  2696. BFD_RELOC_BFIN_GOTHI,
  2697. BFD_RELOC_BFIN_GOTLO,
  2698. BFD_RELOC_BFIN_FUNCDESC,
  2699. BFD_RELOC_BFIN_FUNCDESC_GOT17M4,
  2700. BFD_RELOC_BFIN_FUNCDESC_GOTHI,
  2701. BFD_RELOC_BFIN_FUNCDESC_GOTLO,
  2702. BFD_RELOC_BFIN_FUNCDESC_VALUE,
  2703. BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4,
  2704. BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI,
  2705. BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO,
  2706. BFD_RELOC_BFIN_GOTOFF17M4,
  2707. BFD_RELOC_BFIN_GOTOFFHI,
  2708. BFD_RELOC_BFIN_GOTOFFLO,
  2709. /* ADI Blackfin GOT relocation. */
  2710. BFD_RELOC_BFIN_GOT,
  2711. /* ADI Blackfin PLTPC relocation. */
  2712. BFD_RELOC_BFIN_PLTPC,
  2713. /* ADI Blackfin arithmetic relocation. */
  2714. BFD_ARELOC_BFIN_PUSH,
  2715. /* ADI Blackfin arithmetic relocation. */
  2716. BFD_ARELOC_BFIN_CONST,
  2717. /* ADI Blackfin arithmetic relocation. */
  2718. BFD_ARELOC_BFIN_ADD,
  2719. /* ADI Blackfin arithmetic relocation. */
  2720. BFD_ARELOC_BFIN_SUB,
  2721. /* ADI Blackfin arithmetic relocation. */
  2722. BFD_ARELOC_BFIN_MULT,
  2723. /* ADI Blackfin arithmetic relocation. */
  2724. BFD_ARELOC_BFIN_DIV,
  2725. /* ADI Blackfin arithmetic relocation. */
  2726. BFD_ARELOC_BFIN_MOD,
  2727. /* ADI Blackfin arithmetic relocation. */
  2728. BFD_ARELOC_BFIN_LSHIFT,
  2729. /* ADI Blackfin arithmetic relocation. */
  2730. BFD_ARELOC_BFIN_RSHIFT,
  2731. /* ADI Blackfin arithmetic relocation. */
  2732. BFD_ARELOC_BFIN_AND,
  2733. /* ADI Blackfin arithmetic relocation. */
  2734. BFD_ARELOC_BFIN_OR,
  2735. /* ADI Blackfin arithmetic relocation. */
  2736. BFD_ARELOC_BFIN_XOR,
  2737. /* ADI Blackfin arithmetic relocation. */
  2738. BFD_ARELOC_BFIN_LAND,
  2739. /* ADI Blackfin arithmetic relocation. */
  2740. BFD_ARELOC_BFIN_LOR,
  2741. /* ADI Blackfin arithmetic relocation. */
  2742. BFD_ARELOC_BFIN_LEN,
  2743. /* ADI Blackfin arithmetic relocation. */
  2744. BFD_ARELOC_BFIN_NEG,
  2745. /* ADI Blackfin arithmetic relocation. */
  2746. BFD_ARELOC_BFIN_COMP,
  2747. /* ADI Blackfin arithmetic relocation. */
  2748. BFD_ARELOC_BFIN_PAGE,
  2749. /* ADI Blackfin arithmetic relocation. */
  2750. BFD_ARELOC_BFIN_HWPAGE,
  2751. /* ADI Blackfin arithmetic relocation. */
  2752. BFD_ARELOC_BFIN_ADDR,
  2753. /* Mitsubishi D10V relocs.
  2754. This is a 10-bit reloc with the right 2 bits
  2755. assumed to be 0. */
  2756. BFD_RELOC_D10V_10_PCREL_R,
  2757. /* Mitsubishi D10V relocs.
  2758. This is a 10-bit reloc with the right 2 bits
  2759. assumed to be 0. This is the same as the previous reloc
  2760. except it is in the left container, i.e.,
  2761. shifted left 15 bits. */
  2762. BFD_RELOC_D10V_10_PCREL_L,
  2763. /* This is an 18-bit reloc with the right 2 bits
  2764. assumed to be 0. */
  2765. BFD_RELOC_D10V_18,
  2766. /* This is an 18-bit reloc with the right 2 bits
  2767. assumed to be 0. */
  2768. BFD_RELOC_D10V_18_PCREL,
  2769. /* Mitsubishi D30V relocs.
  2770. This is a 6-bit absolute reloc. */
  2771. BFD_RELOC_D30V_6,
  2772. /* This is a 6-bit pc-relative reloc with
  2773. the right 3 bits assumed to be 0. */
  2774. BFD_RELOC_D30V_9_PCREL,
  2775. /* This is a 6-bit pc-relative reloc with
  2776. the right 3 bits assumed to be 0. Same
  2777. as the previous reloc but on the right side
  2778. of the container. */
  2779. BFD_RELOC_D30V_9_PCREL_R,
  2780. /* This is a 12-bit absolute reloc with the
  2781. right 3 bitsassumed to be 0. */
  2782. BFD_RELOC_D30V_15,
  2783. /* This is a 12-bit pc-relative reloc with
  2784. the right 3 bits assumed to be 0. */
  2785. BFD_RELOC_D30V_15_PCREL,
  2786. /* This is a 12-bit pc-relative reloc with
  2787. the right 3 bits assumed to be 0. Same
  2788. as the previous reloc but on the right side
  2789. of the container. */
  2790. BFD_RELOC_D30V_15_PCREL_R,
  2791. /* This is an 18-bit absolute reloc with
  2792. the right 3 bits assumed to be 0. */
  2793. BFD_RELOC_D30V_21,
  2794. /* This is an 18-bit pc-relative reloc with
  2795. the right 3 bits assumed to be 0. */
  2796. BFD_RELOC_D30V_21_PCREL,
  2797. /* This is an 18-bit pc-relative reloc with
  2798. the right 3 bits assumed to be 0. Same
  2799. as the previous reloc but on the right side
  2800. of the container. */
  2801. BFD_RELOC_D30V_21_PCREL_R,
  2802. /* This is a 32-bit absolute reloc. */
  2803. BFD_RELOC_D30V_32,
  2804. /* This is a 32-bit pc-relative reloc. */
  2805. BFD_RELOC_D30V_32_PCREL,
  2806. /* DLX relocs */
  2807. BFD_RELOC_DLX_HI16_S,
  2808. /* DLX relocs */
  2809. BFD_RELOC_DLX_LO16,
  2810. /* DLX relocs */
  2811. BFD_RELOC_DLX_JMP26,
  2812. /* Renesas M16C/M32C Relocations. */
  2813. BFD_RELOC_M32C_HI8,
  2814. BFD_RELOC_M32C_RL_JUMP,
  2815. BFD_RELOC_M32C_RL_1ADDR,
  2816. BFD_RELOC_M32C_RL_2ADDR,
  2817. /* Renesas M32R (formerly Mitsubishi M32R) relocs.
  2818. This is a 24 bit absolute address. */
  2819. BFD_RELOC_M32R_24,
  2820. /* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */
  2821. BFD_RELOC_M32R_10_PCREL,
  2822. /* This is an 18-bit reloc with the right 2 bits assumed to be 0. */
  2823. BFD_RELOC_M32R_18_PCREL,
  2824. /* This is a 26-bit reloc with the right 2 bits assumed to be 0. */
  2825. BFD_RELOC_M32R_26_PCREL,
  2826. /* This is a 16-bit reloc containing the high 16 bits of an address
  2827. used when the lower 16 bits are treated as unsigned. */
  2828. BFD_RELOC_M32R_HI16_ULO,
  2829. /* This is a 16-bit reloc containing the high 16 bits of an address
  2830. used when the lower 16 bits are treated as signed. */
  2831. BFD_RELOC_M32R_HI16_SLO,
  2832. /* This is a 16-bit reloc containing the lower 16 bits of an address. */
  2833. BFD_RELOC_M32R_LO16,
  2834. /* This is a 16-bit reloc containing the small data area offset for use in
  2835. add3, load, and store instructions. */
  2836. BFD_RELOC_M32R_SDA16,
  2837. /* For PIC. */
  2838. BFD_RELOC_M32R_GOT24,
  2839. BFD_RELOC_M32R_26_PLTREL,
  2840. BFD_RELOC_M32R_COPY,
  2841. BFD_RELOC_M32R_GLOB_DAT,
  2842. BFD_RELOC_M32R_JMP_SLOT,
  2843. BFD_RELOC_M32R_RELATIVE,
  2844. BFD_RELOC_M32R_GOTOFF,
  2845. BFD_RELOC_M32R_GOTOFF_HI_ULO,
  2846. BFD_RELOC_M32R_GOTOFF_HI_SLO,
  2847. BFD_RELOC_M32R_GOTOFF_LO,
  2848. BFD_RELOC_M32R_GOTPC24,
  2849. BFD_RELOC_M32R_GOT16_HI_ULO,
  2850. BFD_RELOC_M32R_GOT16_HI_SLO,
  2851. BFD_RELOC_M32R_GOT16_LO,
  2852. BFD_RELOC_M32R_GOTPC_HI_ULO,
  2853. BFD_RELOC_M32R_GOTPC_HI_SLO,
  2854. BFD_RELOC_M32R_GOTPC_LO,
  2855. /* This is a 9-bit reloc */
  2856. BFD_RELOC_V850_9_PCREL,
  2857. /* This is a 22-bit reloc */
  2858. BFD_RELOC_V850_22_PCREL,
  2859. /* This is a 16 bit offset from the short data area pointer. */
  2860. BFD_RELOC_V850_SDA_16_16_OFFSET,
  2861. /* This is a 16 bit offset (of which only 15 bits are used) from the
  2862. short data area pointer. */
  2863. BFD_RELOC_V850_SDA_15_16_OFFSET,
  2864. /* This is a 16 bit offset from the zero data area pointer. */
  2865. BFD_RELOC_V850_ZDA_16_16_OFFSET,
  2866. /* This is a 16 bit offset (of which only 15 bits are used) from the
  2867. zero data area pointer. */
  2868. BFD_RELOC_V850_ZDA_15_16_OFFSET,
  2869. /* This is an 8 bit offset (of which only 6 bits are used) from the
  2870. tiny data area pointer. */
  2871. BFD_RELOC_V850_TDA_6_8_OFFSET,
  2872. /* This is an 8bit offset (of which only 7 bits are used) from the tiny
  2873. data area pointer. */
  2874. BFD_RELOC_V850_TDA_7_8_OFFSET,
  2875. /* This is a 7 bit offset from the tiny data area pointer. */
  2876. BFD_RELOC_V850_TDA_7_7_OFFSET,
  2877. /* This is a 16 bit offset from the tiny data area pointer. */
  2878. BFD_RELOC_V850_TDA_16_16_OFFSET,
  2879. /* This is a 5 bit offset (of which only 4 bits are used) from the tiny
  2880. data area pointer. */
  2881. BFD_RELOC_V850_TDA_4_5_OFFSET,
  2882. /* This is a 4 bit offset from the tiny data area pointer. */
  2883. BFD_RELOC_V850_TDA_4_4_OFFSET,
  2884. /* This is a 16 bit offset from the short data area pointer, with the
  2885. bits placed non-contiguously in the instruction. */
  2886. BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
  2887. /* This is a 16 bit offset from the zero data area pointer, with the
  2888. bits placed non-contiguously in the instruction. */
  2889. BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
  2890. /* This is a 6 bit offset from the call table base pointer. */
  2891. BFD_RELOC_V850_CALLT_6_7_OFFSET,
  2892. /* This is a 16 bit offset from the call table base pointer. */
  2893. BFD_RELOC_V850_CALLT_16_16_OFFSET,
  2894. /* Used for relaxing indirect function calls. */
  2895. BFD_RELOC_V850_LONGCALL,
  2896. /* Used for relaxing indirect jumps. */
  2897. BFD_RELOC_V850_LONGJUMP,
  2898. /* Used to maintain alignment whilst relaxing. */
  2899. BFD_RELOC_V850_ALIGN,
  2900. /* This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
  2901. instructions. */
  2902. BFD_RELOC_V850_LO16_SPLIT_OFFSET,
  2903. /* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
  2904. instruction. */
  2905. BFD_RELOC_MN10300_32_PCREL,
  2906. /* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
  2907. instruction. */
  2908. BFD_RELOC_MN10300_16_PCREL,
  2909. /* This is a 8bit DP reloc for the tms320c30, where the most
  2910. significant 8 bits of a 24 bit word are placed into the least
  2911. significant 8 bits of the opcode. */
  2912. BFD_RELOC_TIC30_LDP,
  2913. /* This is a 7bit reloc for the tms320c54x, where the least
  2914. significant 7 bits of a 16 bit word are placed into the least
  2915. significant 7 bits of the opcode. */
  2916. BFD_RELOC_TIC54X_PARTLS7,
  2917. /* This is a 9bit DP reloc for the tms320c54x, where the most
  2918. significant 9 bits of a 16 bit word are placed into the least
  2919. significant 9 bits of the opcode. */
  2920. BFD_RELOC_TIC54X_PARTMS9,
  2921. /* This is an extended address 23-bit reloc for the tms320c54x. */
  2922. BFD_RELOC_TIC54X_23,
  2923. /* This is a 16-bit reloc for the tms320c54x, where the least
  2924. significant 16 bits of a 23-bit extended address are placed into
  2925. the opcode. */
  2926. BFD_RELOC_TIC54X_16_OF_23,
  2927. /* This is a reloc for the tms320c54x, where the most
  2928. significant 7 bits of a 23-bit extended address are placed into
  2929. the opcode. */
  2930. BFD_RELOC_TIC54X_MS7_OF_23,
  2931. /* This is a 48 bit reloc for the FR30 that stores 32 bits. */
  2932. BFD_RELOC_FR30_48,
  2933. /* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
  2934. two sections. */
  2935. BFD_RELOC_FR30_20,
  2936. /* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
  2937. 4 bits. */
  2938. BFD_RELOC_FR30_6_IN_4,
  2939. /* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
  2940. into 8 bits. */
  2941. BFD_RELOC_FR30_8_IN_8,
  2942. /* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
  2943. into 8 bits. */
  2944. BFD_RELOC_FR30_9_IN_8,
  2945. /* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
  2946. into 8 bits. */
  2947. BFD_RELOC_FR30_10_IN_8,
  2948. /* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
  2949. short offset into 8 bits. */
  2950. BFD_RELOC_FR30_9_PCREL,
  2951. /* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
  2952. short offset into 11 bits. */
  2953. BFD_RELOC_FR30_12_PCREL,
  2954. /* Motorola Mcore relocations. */
  2955. BFD_RELOC_MCORE_PCREL_IMM8BY4,
  2956. BFD_RELOC_MCORE_PCREL_IMM11BY2,
  2957. BFD_RELOC_MCORE_PCREL_IMM4BY2,
  2958. BFD_RELOC_MCORE_PCREL_32,
  2959. BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
  2960. BFD_RELOC_MCORE_RVA,
  2961. /* These are relocations for the GETA instruction. */
  2962. BFD_RELOC_MMIX_GETA,
  2963. BFD_RELOC_MMIX_GETA_1,
  2964. BFD_RELOC_MMIX_GETA_2,
  2965. BFD_RELOC_MMIX_GETA_3,
  2966. /* These are relocations for a conditional branch instruction. */
  2967. BFD_RELOC_MMIX_CBRANCH,
  2968. BFD_RELOC_MMIX_CBRANCH_J,
  2969. BFD_RELOC_MMIX_CBRANCH_1,
  2970. BFD_RELOC_MMIX_CBRANCH_2,
  2971. BFD_RELOC_MMIX_CBRANCH_3,
  2972. /* These are relocations for the PUSHJ instruction. */
  2973. BFD_RELOC_MMIX_PUSHJ,
  2974. BFD_RELOC_MMIX_PUSHJ_1,
  2975. BFD_RELOC_MMIX_PUSHJ_2,
  2976. BFD_RELOC_MMIX_PUSHJ_3,
  2977. BFD_RELOC_MMIX_PUSHJ_STUBBABLE,
  2978. /* These are relocations for the JMP instruction. */
  2979. BFD_RELOC_MMIX_JMP,
  2980. BFD_RELOC_MMIX_JMP_1,
  2981. BFD_RELOC_MMIX_JMP_2,
  2982. BFD_RELOC_MMIX_JMP_3,
  2983. /* This is a relocation for a relative address as in a GETA instruction or
  2984. a branch. */
  2985. BFD_RELOC_MMIX_ADDR19,
  2986. /* This is a relocation for a relative address as in a JMP instruction. */
  2987. BFD_RELOC_MMIX_ADDR27,
  2988. /* This is a relocation for an instruction field that may be a general
  2989. register or a value 0..255. */
  2990. BFD_RELOC_MMIX_REG_OR_BYTE,
  2991. /* This is a relocation for an instruction field that may be a general
  2992. register. */
  2993. BFD_RELOC_MMIX_REG,
  2994. /* This is a relocation for two instruction fields holding a register and
  2995. an offset, the equivalent of the relocation. */
  2996. BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
  2997. /* This relocation is an assertion that the expression is not allocated as
  2998. a global register. It does not modify contents. */
  2999. BFD_RELOC_MMIX_LOCAL,
  3000. /* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
  3001. short offset into 7 bits. */
  3002. BFD_RELOC_AVR_7_PCREL,
  3003. /* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
  3004. short offset into 12 bits. */
  3005. BFD_RELOC_AVR_13_PCREL,
  3006. /* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
  3007. program memory address) into 16 bits. */
  3008. BFD_RELOC_AVR_16_PM,
  3009. /* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
  3010. data memory address) into 8 bit immediate value of LDI insn. */
  3011. BFD_RELOC_AVR_LO8_LDI,
  3012. /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
  3013. of data memory address) into 8 bit immediate value of LDI insn. */
  3014. BFD_RELOC_AVR_HI8_LDI,
  3015. /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
  3016. of program memory address) into 8 bit immediate value of LDI insn. */
  3017. BFD_RELOC_AVR_HH8_LDI,
  3018. /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
  3019. of 32 bit value) into 8 bit immediate value of LDI insn. */
  3020. BFD_RELOC_AVR_MS8_LDI,
  3021. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value
  3022. (usually data memory address) into 8 bit immediate value of SUBI insn. */
  3023. BFD_RELOC_AVR_LO8_LDI_NEG,
  3024. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value
  3025. (high 8 bit of data memory address) into 8 bit immediate value of
  3026. SUBI insn. */
  3027. BFD_RELOC_AVR_HI8_LDI_NEG,
  3028. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value
  3029. (most high 8 bit of program memory address) into 8 bit immediate value
  3030. of LDI or SUBI insn. */
  3031. BFD_RELOC_AVR_HH8_LDI_NEG,
  3032. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb
  3033. of 32 bit value) into 8 bit immediate value of LDI insn. */
  3034. BFD_RELOC_AVR_MS8_LDI_NEG,
  3035. /* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
  3036. command address) into 8 bit immediate value of LDI insn. */
  3037. BFD_RELOC_AVR_LO8_LDI_PM,
  3038. /* This is a 16 bit reloc for the AVR that stores 8 bit value
  3039. (command address) into 8 bit immediate value of LDI insn. If the address
  3040. is beyond the 128k boundary, the linker inserts a jump stub for this reloc
  3041. in the lower 128k. */
  3042. BFD_RELOC_AVR_LO8_LDI_GS,
  3043. /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
  3044. of command address) into 8 bit immediate value of LDI insn. */
  3045. BFD_RELOC_AVR_HI8_LDI_PM,
  3046. /* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
  3047. of command address) into 8 bit immediate value of LDI insn. If the address
  3048. is beyond the 128k boundary, the linker inserts a jump stub for this reloc
  3049. below 128k. */
  3050. BFD_RELOC_AVR_HI8_LDI_GS,
  3051. /* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
  3052. of command address) into 8 bit immediate value of LDI insn. */
  3053. BFD_RELOC_AVR_HH8_LDI_PM,
  3054. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value
  3055. (usually command address) into 8 bit immediate value of SUBI insn. */
  3056. BFD_RELOC_AVR_LO8_LDI_PM_NEG,
  3057. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value
  3058. (high 8 bit of 16 bit command address) into 8 bit immediate value
  3059. of SUBI insn. */
  3060. BFD_RELOC_AVR_HI8_LDI_PM_NEG,
  3061. /* This is a 16 bit reloc for the AVR that stores negated 8 bit value
  3062. (high 6 bit of 22 bit command address) into 8 bit immediate
  3063. value of SUBI insn. */
  3064. BFD_RELOC_AVR_HH8_LDI_PM_NEG,
  3065. /* This is a 32 bit reloc for the AVR that stores 23 bit value
  3066. into 22 bits. */
  3067. BFD_RELOC_AVR_CALL,
  3068. /* This is a 16 bit reloc for the AVR that stores all needed bits
  3069. for absolute addressing with ldi with overflow check to linktime */
  3070. BFD_RELOC_AVR_LDI,
  3071. /* This is a 6 bit reloc for the AVR that stores offset for ldd/std
  3072. instructions */
  3073. BFD_RELOC_AVR_6,
  3074. /* This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
  3075. instructions */
  3076. BFD_RELOC_AVR_6_ADIW,
  3077. /* Direct 12 bit. */
  3078. BFD_RELOC_390_12,
  3079. /* 12 bit GOT offset. */
  3080. BFD_RELOC_390_GOT12,
  3081. /* 32 bit PC relative PLT address. */
  3082. BFD_RELOC_390_PLT32,
  3083. /* Copy symbol at runtime. */
  3084. BFD_RELOC_390_COPY,
  3085. /* Create GOT entry. */
  3086. BFD_RELOC_390_GLOB_DAT,
  3087. /* Create PLT entry. */
  3088. BFD_RELOC_390_JMP_SLOT,
  3089. /* Adjust by program base. */
  3090. BFD_RELOC_390_RELATIVE,
  3091. /* 32 bit PC relative offset to GOT. */
  3092. BFD_RELOC_390_GOTPC,
  3093. /* 16 bit GOT offset. */
  3094. BFD_RELOC_390_GOT16,
  3095. /* PC relative 16 bit shifted by 1. */
  3096. BFD_RELOC_390_PC16DBL,
  3097. /* 16 bit PC rel. PLT shifted by 1. */
  3098. BFD_RELOC_390_PLT16DBL,
  3099. /* PC relative 32 bit shifted by 1. */
  3100. BFD_RELOC_390_PC32DBL,
  3101. /* 32 bit PC rel. PLT shifted by 1. */
  3102. BFD_RELOC_390_PLT32DBL,
  3103. /* 32 bit PC rel. GOT shifted by 1. */
  3104. BFD_RELOC_390_GOTPCDBL,
  3105. /* 64 bit GOT offset. */
  3106. BFD_RELOC_390_GOT64,
  3107. /* 64 bit PC relative PLT address. */
  3108. BFD_RELOC_390_PLT64,
  3109. /* 32 bit rel. offset to GOT entry. */
  3110. BFD_RELOC_390_GOTENT,
  3111. /* 64 bit offset to GOT. */
  3112. BFD_RELOC_390_GOTOFF64,
  3113. /* 12-bit offset to symbol-entry within GOT, with PLT handling. */
  3114. BFD_RELOC_390_GOTPLT12,
  3115. /* 16-bit offset to symbol-entry within GOT, with PLT handling. */
  3116. BFD_RELOC_390_GOTPLT16,
  3117. /* 32-bit offset to symbol-entry within GOT, with PLT handling. */
  3118. BFD_RELOC_390_GOTPLT32,
  3119. /* 64-bit offset to symbol-entry within GOT, with PLT handling. */
  3120. BFD_RELOC_390_GOTPLT64,
  3121. /* 32-bit rel. offset to symbol-entry within GOT, with PLT handling. */
  3122. BFD_RELOC_390_GOTPLTENT,
  3123. /* 16-bit rel. offset from the GOT to a PLT entry. */
  3124. BFD_RELOC_390_PLTOFF16,
  3125. /* 32-bit rel. offset from the GOT to a PLT entry. */
  3126. BFD_RELOC_390_PLTOFF32,
  3127. /* 64-bit rel. offset from the GOT to a PLT entry. */
  3128. BFD_RELOC_390_PLTOFF64,
  3129. /* s390 tls relocations. */
  3130. BFD_RELOC_390_TLS_LOAD,
  3131. BFD_RELOC_390_TLS_GDCALL,
  3132. BFD_RELOC_390_TLS_LDCALL,
  3133. BFD_RELOC_390_TLS_GD32,
  3134. BFD_RELOC_390_TLS_GD64,
  3135. BFD_RELOC_390_TLS_GOTIE12,
  3136. BFD_RELOC_390_TLS_GOTIE32,
  3137. BFD_RELOC_390_TLS_GOTIE64,
  3138. BFD_RELOC_390_TLS_LDM32,
  3139. BFD_RELOC_390_TLS_LDM64,
  3140. BFD_RELOC_390_TLS_IE32,
  3141. BFD_RELOC_390_TLS_IE64,
  3142. BFD_RELOC_390_TLS_IEENT,
  3143. BFD_RELOC_390_TLS_LE32,
  3144. BFD_RELOC_390_TLS_LE64,
  3145. BFD_RELOC_390_TLS_LDO32,
  3146. BFD_RELOC_390_TLS_LDO64,
  3147. BFD_RELOC_390_TLS_DTPMOD,
  3148. BFD_RELOC_390_TLS_DTPOFF,
  3149. BFD_RELOC_390_TLS_TPOFF,
  3150. /* Long displacement extension. */
  3151. BFD_RELOC_390_20,
  3152. BFD_RELOC_390_GOT20,
  3153. BFD_RELOC_390_GOTPLT20,
  3154. BFD_RELOC_390_TLS_GOTIE20,
  3155. /* Score relocations */
  3156. BFD_RELOC_SCORE_DUMMY1,
  3157. /* Low 16 bit for load/store */
  3158. BFD_RELOC_SCORE_GPREL15,
  3159. /* This is a 24-bit reloc with the right 1 bit assumed to be 0 */
  3160. BFD_RELOC_SCORE_DUMMY2,
  3161. BFD_RELOC_SCORE_JMP,
  3162. /* This is a 19-bit reloc with the right 1 bit assumed to be 0 */
  3163. BFD_RELOC_SCORE_BRANCH,
  3164. /* This is a 11-bit reloc with the right 1 bit assumed to be 0 */
  3165. BFD_RELOC_SCORE16_JMP,
  3166. /* This is a 8-bit reloc with the right 1 bit assumed to be 0 */
  3167. BFD_RELOC_SCORE16_BRANCH,
  3168. /* Undocumented Score relocs */
  3169. BFD_RELOC_SCORE_GOT15,
  3170. BFD_RELOC_SCORE_GOT_LO16,
  3171. BFD_RELOC_SCORE_CALL15,
  3172. BFD_RELOC_SCORE_DUMMY_HI16,
  3173. /* Scenix IP2K - 9-bit register number / data address */
  3174. BFD_RELOC_IP2K_FR9,
  3175. /* Scenix IP2K - 4-bit register/data bank number */
  3176. BFD_RELOC_IP2K_BANK,
  3177. /* Scenix IP2K - low 13 bits of instruction word address */
  3178. BFD_RELOC_IP2K_ADDR16CJP,
  3179. /* Scenix IP2K - high 3 bits of instruction word address */
  3180. BFD_RELOC_IP2K_PAGE3,
  3181. /* Scenix IP2K - ext/low/high 8 bits of data address */
  3182. BFD_RELOC_IP2K_LO8DATA,
  3183. BFD_RELOC_IP2K_HI8DATA,
  3184. BFD_RELOC_IP2K_EX8DATA,
  3185. /* Scenix IP2K - low/high 8 bits of instruction word address */
  3186. BFD_RELOC_IP2K_LO8INSN,
  3187. BFD_RELOC_IP2K_HI8INSN,
  3188. /* Scenix IP2K - even/odd PC modifier to modify snb pcl.0 */
  3189. BFD_RELOC_IP2K_PC_SKIP,
  3190. /* Scenix IP2K - 16 bit word address in text section. */
  3191. BFD_RELOC_IP2K_TEXT,
  3192. /* Scenix IP2K - 7-bit sp or dp offset */
  3193. BFD_RELOC_IP2K_FR_OFFSET,
  3194. /* Scenix VPE4K coprocessor - data/insn-space addressing */
  3195. BFD_RELOC_VPE4KMATH_DATA,
  3196. BFD_RELOC_VPE4KMATH_INSN,
  3197. /* These two relocations are used by the linker to determine which of
  3198. the entries in a C++ virtual function table are actually used. When
  3199. the --gc-sections option is given, the linker will zero out the entries
  3200. that are not used, so that the code for those functions need not be
  3201. included in the output.
  3202. VTABLE_INHERIT is a zero-space relocation used to describe to the
  3203. linker the inheritance tree of a C++ virtual function table. The
  3204. relocation's symbol should be the parent class' vtable, and the
  3205. relocation should be located at the child vtable.
  3206. VTABLE_ENTRY is a zero-space relocation that describes the use of a
  3207. virtual function table entry. The reloc's symbol should refer to the
  3208. table of the class mentioned in the code. Off of that base, an offset
  3209. describes the entry that is being used. For Rela hosts, this offset
  3210. is stored in the reloc's addend. For Rel hosts, we are forced to put
  3211. this offset in the reloc's section offset. */
  3212. BFD_RELOC_VTABLE_INHERIT,
  3213. BFD_RELOC_VTABLE_ENTRY,
  3214. /* Intel IA64 Relocations. */
  3215. BFD_RELOC_IA64_IMM14,
  3216. BFD_RELOC_IA64_IMM22,
  3217. BFD_RELOC_IA64_IMM64,
  3218. BFD_RELOC_IA64_DIR32MSB,
  3219. BFD_RELOC_IA64_DIR32LSB,
  3220. BFD_RELOC_IA64_DIR64MSB,
  3221. BFD_RELOC_IA64_DIR64LSB,
  3222. BFD_RELOC_IA64_GPREL22,
  3223. BFD_RELOC_IA64_GPREL64I,
  3224. BFD_RELOC_IA64_GPREL32MSB,
  3225. BFD_RELOC_IA64_GPREL32LSB,
  3226. BFD_RELOC_IA64_GPREL64MSB,
  3227. BFD_RELOC_IA64_GPREL64LSB,
  3228. BFD_RELOC_IA64_LTOFF22,
  3229. BFD_RELOC_IA64_LTOFF64I,
  3230. BFD_RELOC_IA64_PLTOFF22,
  3231. BFD_RELOC_IA64_PLTOFF64I,
  3232. BFD_RELOC_IA64_PLTOFF64MSB,
  3233. BFD_RELOC_IA64_PLTOFF64LSB,
  3234. BFD_RELOC_IA64_FPTR64I,
  3235. BFD_RELOC_IA64_FPTR32MSB,
  3236. BFD_RELOC_IA64_FPTR32LSB,
  3237. BFD_RELOC_IA64_FPTR64MSB,
  3238. BFD_RELOC_IA64_FPTR64LSB,
  3239. BFD_RELOC_IA64_PCREL21B,
  3240. BFD_RELOC_IA64_PCREL21BI,
  3241. BFD_RELOC_IA64_PCREL21M,
  3242. BFD_RELOC_IA64_PCREL21F,
  3243. BFD_RELOC_IA64_PCREL22,
  3244. BFD_RELOC_IA64_PCREL60B,
  3245. BFD_RELOC_IA64_PCREL64I,
  3246. BFD_RELOC_IA64_PCREL32MSB,
  3247. BFD_RELOC_IA64_PCREL32LSB,
  3248. BFD_RELOC_IA64_PCREL64MSB,
  3249. BFD_RELOC_IA64_PCREL64LSB,
  3250. BFD_RELOC_IA64_LTOFF_FPTR22,
  3251. BFD_RELOC_IA64_LTOFF_FPTR64I,
  3252. BFD_RELOC_IA64_LTOFF_FPTR32MSB,
  3253. BFD_RELOC_IA64_LTOFF_FPTR32LSB,
  3254. BFD_RELOC_IA64_LTOFF_FPTR64MSB,
  3255. BFD_RELOC_IA64_LTOFF_FPTR64LSB,
  3256. BFD_RELOC_IA64_SEGREL32MSB,
  3257. BFD_RELOC_IA64_SEGREL32LSB,
  3258. BFD_RELOC_IA64_SEGREL64MSB,
  3259. BFD_RELOC_IA64_SEGREL64LSB,
  3260. BFD_RELOC_IA64_SECREL32MSB,
  3261. BFD_RELOC_IA64_SECREL32LSB,
  3262. BFD_RELOC_IA64_SECREL64MSB,
  3263. BFD_RELOC_IA64_SECREL64LSB,
  3264. BFD_RELOC_IA64_REL32MSB,
  3265. BFD_RELOC_IA64_REL32LSB,
  3266. BFD_RELOC_IA64_REL64MSB,
  3267. BFD_RELOC_IA64_REL64LSB,
  3268. BFD_RELOC_IA64_LTV32MSB,
  3269. BFD_RELOC_IA64_LTV32LSB,
  3270. BFD_RELOC_IA64_LTV64MSB,
  3271. BFD_RELOC_IA64_LTV64LSB,
  3272. BFD_RELOC_IA64_IPLTMSB,
  3273. BFD_RELOC_IA64_IPLTLSB,
  3274. BFD_RELOC_IA64_COPY,
  3275. BFD_RELOC_IA64_LTOFF22X,
  3276. BFD_RELOC_IA64_LDXMOV,
  3277. BFD_RELOC_IA64_TPREL14,
  3278. BFD_RELOC_IA64_TPREL22,
  3279. BFD_RELOC_IA64_TPREL64I,
  3280. BFD_RELOC_IA64_TPREL64MSB,
  3281. BFD_RELOC_IA64_TPREL64LSB,
  3282. BFD_RELOC_IA64_LTOFF_TPREL22,
  3283. BFD_RELOC_IA64_DTPMOD64MSB,
  3284. BFD_RELOC_IA64_DTPMOD64LSB,
  3285. BFD_RELOC_IA64_LTOFF_DTPMOD22,
  3286. BFD_RELOC_IA64_DTPREL14,
  3287. BFD_RELOC_IA64_DTPREL22,
  3288. BFD_RELOC_IA64_DTPREL64I,
  3289. BFD_RELOC_IA64_DTPREL32MSB,
  3290. BFD_RELOC_IA64_DTPREL32LSB,
  3291. BFD_RELOC_IA64_DTPREL64MSB,
  3292. BFD_RELOC_IA64_DTPREL64LSB,
  3293. BFD_RELOC_IA64_LTOFF_DTPREL22,
  3294. /* Motorola 68HC11 reloc.
  3295. This is the 8 bit high part of an absolute address. */
  3296. BFD_RELOC_M68HC11_HI8,
  3297. /* Motorola 68HC11 reloc.
  3298. This is the 8 bit low part of an absolute address. */
  3299. BFD_RELOC_M68HC11_LO8,
  3300. /* Motorola 68HC11 reloc.
  3301. This is the 3 bit of a value. */
  3302. BFD_RELOC_M68HC11_3B,
  3303. /* Motorola 68HC11 reloc.
  3304. This reloc marks the beginning of a jump/call instruction.
  3305. It is used for linker relaxation to correctly identify beginning
  3306. of instruction and change some branches to use PC-relative
  3307. addressing mode. */
  3308. BFD_RELOC_M68HC11_RL_JUMP,
  3309. /* Motorola 68HC11 reloc.
  3310. This reloc marks a group of several instructions that gcc generates
  3311. and for which the linker relaxation pass can modify and/or remove
  3312. some of them. */
  3313. BFD_RELOC_M68HC11_RL_GROUP,
  3314. /* Motorola 68HC11 reloc.
  3315. This is the 16-bit lower part of an address. It is used for 'call'
  3316. instruction to specify the symbol address without any special
  3317. transformation (due to memory bank window). */
  3318. BFD_RELOC_M68HC11_LO16,
  3319. /* Motorola 68HC11 reloc.
  3320. This is a 8-bit reloc that specifies the page number of an address.
  3321. It is used by 'call' instruction to specify the page number of
  3322. the symbol. */
  3323. BFD_RELOC_M68HC11_PAGE,
  3324. /* Motorola 68HC11 reloc.
  3325. This is a 24-bit reloc that represents the address with a 16-bit
  3326. value and a 8-bit page number. The symbol address is transformed
  3327. to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */
  3328. BFD_RELOC_M68HC11_24,
  3329. /* Motorola 68HC12 reloc.
  3330. This is the 5 bits of a value. */
  3331. BFD_RELOC_M68HC12_5B,
  3332. /* NS CR16C Relocations. */
  3333. BFD_RELOC_16C_NUM08,
  3334. BFD_RELOC_16C_NUM08_C,
  3335. BFD_RELOC_16C_NUM16,
  3336. BFD_RELOC_16C_NUM16_C,
  3337. BFD_RELOC_16C_NUM32,
  3338. BFD_RELOC_16C_NUM32_C,
  3339. BFD_RELOC_16C_DISP04,
  3340. BFD_RELOC_16C_DISP04_C,
  3341. BFD_RELOC_16C_DISP08,
  3342. BFD_RELOC_16C_DISP08_C,
  3343. BFD_RELOC_16C_DISP16,
  3344. BFD_RELOC_16C_DISP16_C,
  3345. BFD_RELOC_16C_DISP24,
  3346. BFD_RELOC_16C_DISP24_C,
  3347. BFD_RELOC_16C_DISP24a,
  3348. BFD_RELOC_16C_DISP24a_C,
  3349. BFD_RELOC_16C_REG04,
  3350. BFD_RELOC_16C_REG04_C,
  3351. BFD_RELOC_16C_REG04a,
  3352. BFD_RELOC_16C_REG04a_C,
  3353. BFD_RELOC_16C_REG14,
  3354. BFD_RELOC_16C_REG14_C,
  3355. BFD_RELOC_16C_REG16,
  3356. BFD_RELOC_16C_REG16_C,
  3357. BFD_RELOC_16C_REG20,
  3358. BFD_RELOC_16C_REG20_C,
  3359. BFD_RELOC_16C_ABS20,
  3360. BFD_RELOC_16C_ABS20_C,
  3361. BFD_RELOC_16C_ABS24,
  3362. BFD_RELOC_16C_ABS24_C,
  3363. BFD_RELOC_16C_IMM04,
  3364. BFD_RELOC_16C_IMM04_C,
  3365. BFD_RELOC_16C_IMM16,
  3366. BFD_RELOC_16C_IMM16_C,
  3367. BFD_RELOC_16C_IMM20,
  3368. BFD_RELOC_16C_IMM20_C,
  3369. BFD_RELOC_16C_IMM24,
  3370. BFD_RELOC_16C_IMM24_C,
  3371. BFD_RELOC_16C_IMM32,
  3372. BFD_RELOC_16C_IMM32_C,
  3373. /* NS CRX Relocations. */
  3374. BFD_RELOC_CRX_REL4,
  3375. BFD_RELOC_CRX_REL8,
  3376. BFD_RELOC_CRX_REL8_CMP,
  3377. BFD_RELOC_CRX_REL16,
  3378. BFD_RELOC_CRX_REL24,
  3379. BFD_RELOC_CRX_REL32,
  3380. BFD_RELOC_CRX_REGREL12,
  3381. BFD_RELOC_CRX_REGREL22,
  3382. BFD_RELOC_CRX_REGREL28,
  3383. BFD_RELOC_CRX_REGREL32,
  3384. BFD_RELOC_CRX_ABS16,
  3385. BFD_RELOC_CRX_ABS32,
  3386. BFD_RELOC_CRX_NUM8,
  3387. BFD_RELOC_CRX_NUM16,
  3388. BFD_RELOC_CRX_NUM32,
  3389. BFD_RELOC_CRX_IMM16,
  3390. BFD_RELOC_CRX_IMM32,
  3391. BFD_RELOC_CRX_SWITCH8,
  3392. BFD_RELOC_CRX_SWITCH16,
  3393. BFD_RELOC_CRX_SWITCH32,
  3394. /* These relocs are only used within the CRIS assembler. They are not
  3395. (at present) written to any object files. */
  3396. BFD_RELOC_CRIS_BDISP8,
  3397. BFD_RELOC_CRIS_UNSIGNED_5,
  3398. BFD_RELOC_CRIS_SIGNED_6,
  3399. BFD_RELOC_CRIS_UNSIGNED_6,
  3400. BFD_RELOC_CRIS_SIGNED_8,
  3401. BFD_RELOC_CRIS_UNSIGNED_8,
  3402. BFD_RELOC_CRIS_SIGNED_16,
  3403. BFD_RELOC_CRIS_UNSIGNED_16,
  3404. BFD_RELOC_CRIS_LAPCQ_OFFSET,
  3405. BFD_RELOC_CRIS_UNSIGNED_4,
  3406. /* Relocs used in ELF shared libraries for CRIS. */
  3407. BFD_RELOC_CRIS_COPY,
  3408. BFD_RELOC_CRIS_GLOB_DAT,
  3409. BFD_RELOC_CRIS_JUMP_SLOT,
  3410. BFD_RELOC_CRIS_RELATIVE,
  3411. /* 32-bit offset to symbol-entry within GOT. */
  3412. BFD_RELOC_CRIS_32_GOT,
  3413. /* 16-bit offset to symbol-entry within GOT. */
  3414. BFD_RELOC_CRIS_16_GOT,
  3415. /* 32-bit offset to symbol-entry within GOT, with PLT handling. */
  3416. BFD_RELOC_CRIS_32_GOTPLT,
  3417. /* 16-bit offset to symbol-entry within GOT, with PLT handling. */
  3418. BFD_RELOC_CRIS_16_GOTPLT,
  3419. /* 32-bit offset to symbol, relative to GOT. */
  3420. BFD_RELOC_CRIS_32_GOTREL,
  3421. /* 32-bit offset to symbol with PLT entry, relative to GOT. */
  3422. BFD_RELOC_CRIS_32_PLT_GOTREL,
  3423. /* 32-bit offset to symbol with PLT entry, relative to this relocation. */
  3424. BFD_RELOC_CRIS_32_PLT_PCREL,
  3425. /* Intel i860 Relocations. */
  3426. BFD_RELOC_860_COPY,
  3427. BFD_RELOC_860_GLOB_DAT,
  3428. BFD_RELOC_860_JUMP_SLOT,
  3429. BFD_RELOC_860_RELATIVE,
  3430. BFD_RELOC_860_PC26,
  3431. BFD_RELOC_860_PLT26,
  3432. BFD_RELOC_860_PC16,
  3433. BFD_RELOC_860_LOW0,
  3434. BFD_RELOC_860_SPLIT0,
  3435. BFD_RELOC_860_LOW1,
  3436. BFD_RELOC_860_SPLIT1,
  3437. BFD_RELOC_860_LOW2,
  3438. BFD_RELOC_860_SPLIT2,
  3439. BFD_RELOC_860_LOW3,
  3440. BFD_RELOC_860_LOGOT0,
  3441. BFD_RELOC_860_SPGOT0,
  3442. BFD_RELOC_860_LOGOT1,
  3443. BFD_RELOC_860_SPGOT1,
  3444. BFD_RELOC_860_LOGOTOFF0,
  3445. BFD_RELOC_860_SPGOTOFF0,
  3446. BFD_RELOC_860_LOGOTOFF1,
  3447. BFD_RELOC_860_SPGOTOFF1,
  3448. BFD_RELOC_860_LOGOTOFF2,
  3449. BFD_RELOC_860_LOGOTOFF3,
  3450. BFD_RELOC_860_LOPC,
  3451. BFD_RELOC_860_HIGHADJ,
  3452. BFD_RELOC_860_HAGOT,
  3453. BFD_RELOC_860_HAGOTOFF,
  3454. BFD_RELOC_860_HAPC,
  3455. BFD_RELOC_860_HIGH,
  3456. BFD_RELOC_860_HIGOT,
  3457. BFD_RELOC_860_HIGOTOFF,
  3458. /* OpenRISC Relocations. */
  3459. BFD_RELOC_OPENRISC_ABS_26,
  3460. BFD_RELOC_OPENRISC_REL_26,
  3461. /* H8 elf Relocations. */
  3462. BFD_RELOC_H8_DIR16A8,
  3463. BFD_RELOC_H8_DIR16R8,
  3464. BFD_RELOC_H8_DIR24A8,
  3465. BFD_RELOC_H8_DIR24R8,
  3466. BFD_RELOC_H8_DIR32A16,
  3467. /* Sony Xstormy16 Relocations. */
  3468. BFD_RELOC_XSTORMY16_REL_12,
  3469. BFD_RELOC_XSTORMY16_12,
  3470. BFD_RELOC_XSTORMY16_24,
  3471. BFD_RELOC_XSTORMY16_FPTR16,
  3472. /* Infineon Relocations. */
  3473. BFD_RELOC_XC16X_PAG,
  3474. BFD_RELOC_XC16X_POF,
  3475. BFD_RELOC_XC16X_SEG,
  3476. BFD_RELOC_XC16X_SOF,
  3477. /* Relocations used by VAX ELF. */
  3478. BFD_RELOC_VAX_GLOB_DAT,
  3479. BFD_RELOC_VAX_JMP_SLOT,
  3480. BFD_RELOC_VAX_RELATIVE,
  3481. /* Morpho MT - 16 bit immediate relocation. */
  3482. BFD_RELOC_MT_PC16,
  3483. /* Morpho MT - Hi 16 bits of an address. */
  3484. BFD_RELOC_MT_HI16,
  3485. /* Morpho MT - Low 16 bits of an address. */
  3486. BFD_RELOC_MT_LO16,
  3487. /* Morpho MT - Used to tell the linker which vtable entries are used. */
  3488. BFD_RELOC_MT_GNU_VTINHERIT,
  3489. /* Morpho MT - Used to tell the linker which vtable entries are used. */
  3490. BFD_RELOC_MT_GNU_VTENTRY,
  3491. /* Morpho MT - 8 bit immediate relocation. */
  3492. BFD_RELOC_MT_PCINSN8,
  3493. /* msp430 specific relocation codes */
  3494. BFD_RELOC_MSP430_10_PCREL,
  3495. BFD_RELOC_MSP430_16_PCREL,
  3496. BFD_RELOC_MSP430_16,
  3497. BFD_RELOC_MSP430_16_PCREL_BYTE,
  3498. BFD_RELOC_MSP430_16_BYTE,
  3499. BFD_RELOC_MSP430_2X_PCREL,
  3500. BFD_RELOC_MSP430_RL_PCREL,
  3501. /* IQ2000 Relocations. */
  3502. BFD_RELOC_IQ2000_OFFSET_16,
  3503. BFD_RELOC_IQ2000_OFFSET_21,
  3504. BFD_RELOC_IQ2000_UHI16,
  3505. /* Special Xtensa relocation used only by PLT entries in ELF shared
  3506. objects to indicate that the runtime linker should set the value
  3507. to one of its own internal functions or data structures. */
  3508. BFD_RELOC_XTENSA_RTLD,
  3509. /* Xtensa relocations for ELF shared objects. */
  3510. BFD_RELOC_XTENSA_GLOB_DAT,
  3511. BFD_RELOC_XTENSA_JMP_SLOT,
  3512. BFD_RELOC_XTENSA_RELATIVE,
  3513. /* Xtensa relocation used in ELF object files for symbols that may require
  3514. PLT entries. Otherwise, this is just a generic 32-bit relocation. */
  3515. BFD_RELOC_XTENSA_PLT,
  3516. /* Xtensa relocations to mark the difference of two local symbols.
  3517. These are only needed to support linker relaxation and can be ignored
  3518. when not relaxing. The field is set to the value of the difference
  3519. assuming no relaxation. The relocation encodes the position of the
  3520. first symbol so the linker can determine whether to adjust the field
  3521. value. */
  3522. BFD_RELOC_XTENSA_DIFF8,
  3523. BFD_RELOC_XTENSA_DIFF16,
  3524. BFD_RELOC_XTENSA_DIFF32,
  3525. /* Generic Xtensa relocations for instruction operands. Only the slot
  3526. number is encoded in the relocation. The relocation applies to the
  3527. last PC-relative immediate operand, or if there are no PC-relative
  3528. immediates, to the last immediate operand. */
  3529. BFD_RELOC_XTENSA_SLOT0_OP,
  3530. BFD_RELOC_XTENSA_SLOT1_OP,
  3531. BFD_RELOC_XTENSA_SLOT2_OP,
  3532. BFD_RELOC_XTENSA_SLOT3_OP,
  3533. BFD_RELOC_XTENSA_SLOT4_OP,
  3534. BFD_RELOC_XTENSA_SLOT5_OP,
  3535. BFD_RELOC_XTENSA_SLOT6_OP,
  3536. BFD_RELOC_XTENSA_SLOT7_OP,
  3537. BFD_RELOC_XTENSA_SLOT8_OP,
  3538. BFD_RELOC_XTENSA_SLOT9_OP,
  3539. BFD_RELOC_XTENSA_SLOT10_OP,
  3540. BFD_RELOC_XTENSA_SLOT11_OP,
  3541. BFD_RELOC_XTENSA_SLOT12_OP,
  3542. BFD_RELOC_XTENSA_SLOT13_OP,
  3543. BFD_RELOC_XTENSA_SLOT14_OP,
  3544. /* Alternate Xtensa relocations. Only the slot is encoded in the
  3545. relocation. The meaning of these relocations is opcode-specific. */
  3546. BFD_RELOC_XTENSA_SLOT0_ALT,
  3547. BFD_RELOC_XTENSA_SLOT1_ALT,
  3548. BFD_RELOC_XTENSA_SLOT2_ALT,
  3549. BFD_RELOC_XTENSA_SLOT3_ALT,
  3550. BFD_RELOC_XTENSA_SLOT4_ALT,
  3551. BFD_RELOC_XTENSA_SLOT5_ALT,
  3552. BFD_RELOC_XTENSA_SLOT6_ALT,
  3553. BFD_RELOC_XTENSA_SLOT7_ALT,
  3554. BFD_RELOC_XTENSA_SLOT8_ALT,
  3555. BFD_RELOC_XTENSA_SLOT9_ALT,
  3556. BFD_RELOC_XTENSA_SLOT10_ALT,
  3557. BFD_RELOC_XTENSA_SLOT11_ALT,
  3558. BFD_RELOC_XTENSA_SLOT12_ALT,
  3559. BFD_RELOC_XTENSA_SLOT13_ALT,
  3560. BFD_RELOC_XTENSA_SLOT14_ALT,
  3561. /* Xtensa relocations for backward compatibility. These have all been
  3562. replaced by BFD_RELOC_XTENSA_SLOT0_OP. */
  3563. BFD_RELOC_XTENSA_OP0,
  3564. BFD_RELOC_XTENSA_OP1,
  3565. BFD_RELOC_XTENSA_OP2,
  3566. /* Xtensa relocation to mark that the assembler expanded the
  3567. instructions from an original target. The expansion size is
  3568. encoded in the reloc size. */
  3569. BFD_RELOC_XTENSA_ASM_EXPAND,
  3570. /* Xtensa relocation to mark that the linker should simplify
  3571. assembler-expanded instructions. This is commonly used
  3572. internally by the linker after analysis of a
  3573. BFD_RELOC_XTENSA_ASM_EXPAND. */
  3574. BFD_RELOC_XTENSA_ASM_SIMPLIFY,
  3575. /* 8 bit signed offset in (ix+d) or (iy+d). */
  3576. BFD_RELOC_Z80_DISP8,
  3577. /* DJNZ offset. */
  3578. BFD_RELOC_Z8K_DISP7,
  3579. /* CALR offset. */
  3580. BFD_RELOC_Z8K_CALLR,
  3581. /* 4 bit value. */
  3582. BFD_RELOC_Z8K_IMM4L,
  3583. BFD_RELOC_UNUSED };
  3584. typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
  3585. reloc_howto_type *bfd_reloc_type_lookup
  3586. (bfd *abfd, bfd_reloc_code_real_type code);
  3587. const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
  3588. /* Extracted from syms.c. */
  3589. typedef struct bfd_symbol
  3590. {
  3591. /* A pointer to the BFD which owns the symbol. This information
  3592. is necessary so that a back end can work out what additional
  3593. information (invisible to the application writer) is carried
  3594. with the symbol.
  3595. This field is *almost* redundant, since you can use section->owner
  3596. instead, except that some symbols point to the global sections
  3597. bfd_{abs,com,und}_section. This could be fixed by making
  3598. these globals be per-bfd (or per-target-flavor). FIXME. */
  3599. struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
  3600. /* The text of the symbol. The name is left alone, and not copied; the
  3601. application may not alter it. */
  3602. const char *name;
  3603. /* The value of the symbol. This really should be a union of a
  3604. numeric value with a pointer, since some flags indicate that
  3605. a pointer to another symbol is stored here. */
  3606. symvalue value;
  3607. /* Attributes of a symbol. */
  3608. #define BSF_NO_FLAGS 0x00
  3609. /* The symbol has local scope; <<static>> in <<C>>. The value
  3610. is the offset into the section of the data. */
  3611. #define BSF_LOCAL 0x01
  3612. /* The symbol has global scope; initialized data in <<C>>. The
  3613. value is the offset into the section of the data. */
  3614. #define BSF_GLOBAL 0x02
  3615. /* The symbol has global scope and is exported. The value is
  3616. the offset into the section of the data. */
  3617. #define BSF_EXPORT BSF_GLOBAL /* No real difference. */
  3618. /* A normal C symbol would be one of:
  3619. <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
  3620. <<BSF_GLOBAL>>. */
  3621. /* The symbol is a debugging record. The value has an arbitrary
  3622. meaning, unless BSF_DEBUGGING_RELOC is also set. */
  3623. #define BSF_DEBUGGING 0x08
  3624. /* The symbol denotes a function entry point. Used in ELF,
  3625. perhaps others someday. */
  3626. #define BSF_FUNCTION 0x10
  3627. /* Used by the linker. */
  3628. #define BSF_KEEP 0x20
  3629. #define BSF_KEEP_G 0x40
  3630. /* A weak global symbol, overridable without warnings by
  3631. a regular global symbol of the same name. */
  3632. #define BSF_WEAK 0x80
  3633. /* This symbol was created to point to a section, e.g. ELF's
  3634. STT_SECTION symbols. */
  3635. #define BSF_SECTION_SYM 0x100
  3636. /* The symbol used to be a common symbol, but now it is
  3637. allocated. */
  3638. #define BSF_OLD_COMMON 0x200
  3639. /* The default value for common data. */
  3640. #define BFD_FORT_COMM_DEFAULT_VALUE 0
  3641. /* In some files the type of a symbol sometimes alters its
  3642. location in an output file - ie in coff a <<ISFCN>> symbol
  3643. which is also <<C_EXT>> symbol appears where it was
  3644. declared and not at the end of a section. This bit is set
  3645. by the target BFD part to convey this information. */
  3646. #define BSF_NOT_AT_END 0x400
  3647. /* Signal that the symbol is the label of constructor section. */
  3648. #define BSF_CONSTRUCTOR 0x800
  3649. /* Signal that the symbol is a warning symbol. The name is a
  3650. warning. The name of the next symbol is the one to warn about;
  3651. if a reference is made to a symbol with the same name as the next
  3652. symbol, a warning is issued by the linker. */
  3653. #define BSF_WARNING 0x1000
  3654. /* Signal that the symbol is indirect. This symbol is an indirect
  3655. pointer to the symbol with the same name as the next symbol. */
  3656. #define BSF_INDIRECT 0x2000
  3657. /* BSF_FILE marks symbols that contain a file name. This is used
  3658. for ELF STT_FILE symbols. */
  3659. #define BSF_FILE 0x4000
  3660. /* Symbol is from dynamic linking information. */
  3661. #define BSF_DYNAMIC 0x8000
  3662. /* The symbol denotes a data object. Used in ELF, and perhaps
  3663. others someday. */
  3664. #define BSF_OBJECT 0x10000
  3665. /* This symbol is a debugging symbol. The value is the offset
  3666. into the section of the data. BSF_DEBUGGING should be set
  3667. as well. */
  3668. #define BSF_DEBUGGING_RELOC 0x20000
  3669. /* This symbol is thread local. Used in ELF. */
  3670. #define BSF_THREAD_LOCAL 0x40000
  3671. flagword flags;
  3672. /* A pointer to the section to which this symbol is
  3673. relative. This will always be non NULL, there are special
  3674. sections for undefined and absolute symbols. */
  3675. struct bfd_section *section;
  3676. /* Back end special data. */
  3677. union
  3678. {
  3679. void *p;
  3680. bfd_vma i;
  3681. }
  3682. udata;
  3683. }
  3684. asymbol;
  3685. #define bfd_get_symtab_upper_bound(abfd) \
  3686. BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
  3687. bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
  3688. bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
  3689. #define bfd_is_local_label_name(abfd, name) \
  3690. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
  3691. bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
  3692. #define bfd_is_target_special_symbol(abfd, sym) \
  3693. BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
  3694. #define bfd_canonicalize_symtab(abfd, location) \
  3695. BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
  3696. bfd_boolean bfd_set_symtab
  3697. (bfd *abfd, asymbol **location, unsigned int count);
  3698. void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
  3699. #define bfd_make_empty_symbol(abfd) \
  3700. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
  3701. asymbol *_bfd_generic_make_empty_symbol (bfd *);
  3702. #define bfd_make_debug_symbol(abfd,ptr,size) \
  3703. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
  3704. int bfd_decode_symclass (asymbol *symbol);
  3705. bfd_boolean bfd_is_undefined_symclass (int symclass);
  3706. void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
  3707. bfd_boolean bfd_copy_private_symbol_data
  3708. (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
  3709. #define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
  3710. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
  3711. (ibfd, isymbol, obfd, osymbol))
  3712. /* Extracted from bfd.c. */
  3713. struct bfd
  3714. {
  3715. /* A unique identifier of the BFD */
  3716. unsigned int id;
  3717. /* The filename the application opened the BFD with. */
  3718. const char *filename;
  3719. /* A pointer to the target jump table. */
  3720. const struct bfd_target *xvec;
  3721. /* The IOSTREAM, and corresponding IO vector that provide access
  3722. to the file backing the BFD. */
  3723. void *iostream;
  3724. const struct bfd_iovec *iovec;
  3725. /* Is the file descriptor being cached? That is, can it be closed as
  3726. needed, and re-opened when accessed later? */
  3727. bfd_boolean cacheable;
  3728. /* Marks whether there was a default target specified when the
  3729. BFD was opened. This is used to select which matching algorithm
  3730. to use to choose the back end. */
  3731. bfd_boolean target_defaulted;
  3732. /* The caching routines use these to maintain a
  3733. least-recently-used list of BFDs. */
  3734. struct bfd *lru_prev, *lru_next;
  3735. /* When a file is closed by the caching routines, BFD retains
  3736. state information on the file here... */
  3737. ufile_ptr where;
  3738. /* ... and here: (``once'' means at least once). */
  3739. bfd_boolean opened_once;
  3740. /* Set if we have a locally maintained mtime value, rather than
  3741. getting it from the file each time. */
  3742. bfd_boolean mtime_set;
  3743. /* File modified time, if mtime_set is TRUE. */
  3744. long mtime;
  3745. /* Reserved for an unimplemented file locking extension. */
  3746. int ifd;
  3747. /* The format which belongs to the BFD. (object, core, etc.) */
  3748. bfd_format format;
  3749. /* The direction with which the BFD was opened. */
  3750. enum bfd_direction
  3751. {
  3752. no_direction = 0,
  3753. read_direction = 1,
  3754. write_direction = 2,
  3755. both_direction = 3
  3756. }
  3757. direction;
  3758. /* Format_specific flags. */
  3759. flagword flags;
  3760. /* Currently my_archive is tested before adding origin to
  3761. anything. I believe that this can become always an add of
  3762. origin, with origin set to 0 for non archive files. */
  3763. ufile_ptr origin;
  3764. /* Remember when output has begun, to stop strange things
  3765. from happening. */
  3766. bfd_boolean output_has_begun;
  3767. /* A hash table for section names. */
  3768. struct bfd_hash_table section_htab;
  3769. /* Pointer to linked list of sections. */
  3770. struct bfd_section *sections;
  3771. /* The last section on the section list. */
  3772. struct bfd_section *section_last;
  3773. /* The number of sections. */
  3774. unsigned int section_count;
  3775. /* Stuff only useful for object files:
  3776. The start address. */
  3777. bfd_vma start_address;
  3778. /* Used for input and output. */
  3779. unsigned int symcount;
  3780. /* Symbol table for output BFD (with symcount entries). */
  3781. struct bfd_symbol **outsymbols;
  3782. /* Used for slurped dynamic symbol tables. */
  3783. unsigned int dynsymcount;
  3784. /* Pointer to structure which contains architecture information. */
  3785. const struct bfd_arch_info *arch_info;
  3786. /* Flag set if symbols from this BFD should not be exported. */
  3787. bfd_boolean no_export;
  3788. /* Stuff only useful for archives. */
  3789. void *arelt_data;
  3790. struct bfd *my_archive; /* The containing archive BFD. */
  3791. struct bfd *next; /* The next BFD in the archive. */
  3792. struct bfd *archive_head; /* The first BFD in the archive. */
  3793. bfd_boolean has_armap;
  3794. /* A chain of BFD structures involved in a link. */
  3795. struct bfd *link_next;
  3796. /* A field used by _bfd_generic_link_add_archive_symbols. This will
  3797. be used only for archive elements. */
  3798. int archive_pass;
  3799. /* Used by the back end to hold private data. */
  3800. union
  3801. {
  3802. struct aout_data_struct *aout_data;
  3803. struct artdata *aout_ar_data;
  3804. struct _oasys_data *oasys_obj_data;
  3805. struct _oasys_ar_data *oasys_ar_data;
  3806. struct coff_tdata *coff_obj_data;
  3807. struct pe_tdata *pe_obj_data;
  3808. struct xcoff_tdata *xcoff_obj_data;
  3809. struct ecoff_tdata *ecoff_obj_data;
  3810. struct ieee_data_struct *ieee_data;
  3811. struct ieee_ar_data_struct *ieee_ar_data;
  3812. struct srec_data_struct *srec_data;
  3813. struct ihex_data_struct *ihex_data;
  3814. struct tekhex_data_struct *tekhex_data;
  3815. struct elf_obj_tdata *elf_obj_data;
  3816. struct nlm_obj_tdata *nlm_obj_data;
  3817. struct bout_data_struct *bout_data;
  3818. struct mmo_data_struct *mmo_data;
  3819. struct sun_core_struct *sun_core_data;
  3820. struct sco5_core_struct *sco5_core_data;
  3821. struct trad_core_struct *trad_core_data;
  3822. struct som_data_struct *som_data;
  3823. struct hpux_core_struct *hpux_core_data;
  3824. struct hppabsd_core_struct *hppabsd_core_data;
  3825. struct sgi_core_struct *sgi_core_data;
  3826. struct lynx_core_struct *lynx_core_data;
  3827. struct osf_core_struct *osf_core_data;
  3828. struct cisco_core_struct *cisco_core_data;
  3829. struct versados_data_struct *versados_data;
  3830. struct netbsd_core_struct *netbsd_core_data;
  3831. struct mach_o_data_struct *mach_o_data;
  3832. struct mach_o_fat_data_struct *mach_o_fat_data;
  3833. struct bfd_pef_data_struct *pef_data;
  3834. struct bfd_pef_xlib_data_struct *pef_xlib_data;
  3835. struct bfd_sym_data_struct *sym_data;
  3836. void *any;
  3837. }
  3838. tdata;
  3839. /* Used by the application to hold private data. */
  3840. void *usrdata;
  3841. /* Where all the allocated stuff under this BFD goes. This is a
  3842. struct objalloc *, but we use void * to avoid requiring the inclusion
  3843. of objalloc.h. */
  3844. void *memory;
  3845. };
  3846. typedef enum bfd_error
  3847. {
  3848. bfd_error_no_error = 0,
  3849. bfd_error_system_call,
  3850. bfd_error_invalid_target,
  3851. bfd_error_wrong_format,
  3852. bfd_error_wrong_object_format,
  3853. bfd_error_invalid_operation,
  3854. bfd_error_no_memory,
  3855. bfd_error_no_symbols,
  3856. bfd_error_no_armap,
  3857. bfd_error_no_more_archived_files,
  3858. bfd_error_malformed_archive,
  3859. bfd_error_file_not_recognized,
  3860. bfd_error_file_ambiguously_recognized,
  3861. bfd_error_no_contents,
  3862. bfd_error_nonrepresentable_section,
  3863. bfd_error_no_debug_section,
  3864. bfd_error_bad_value,
  3865. bfd_error_file_truncated,
  3866. bfd_error_file_too_big,
  3867. bfd_error_on_input,
  3868. bfd_error_invalid_error_code
  3869. }
  3870. bfd_error_type;
  3871. bfd_error_type bfd_get_error (void);
  3872. void bfd_set_error (bfd_error_type error_tag, ...);
  3873. const char *bfd_errmsg (bfd_error_type error_tag);
  3874. void bfd_perror (const char *message);
  3875. typedef void (*bfd_error_handler_type) (const char *, ...);
  3876. bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
  3877. void bfd_set_error_program_name (const char *);
  3878. bfd_error_handler_type bfd_get_error_handler (void);
  3879. long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
  3880. long bfd_canonicalize_reloc
  3881. (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
  3882. void bfd_set_reloc
  3883. (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
  3884. bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
  3885. int bfd_get_arch_size (bfd *abfd);
  3886. int bfd_get_sign_extend_vma (bfd *abfd);
  3887. bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
  3888. unsigned int bfd_get_gp_size (bfd *abfd);
  3889. void bfd_set_gp_size (bfd *abfd, unsigned int i);
  3890. bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
  3891. bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
  3892. #define bfd_copy_private_header_data(ibfd, obfd) \
  3893. BFD_SEND (obfd, _bfd_copy_private_header_data, \
  3894. (ibfd, obfd))
  3895. bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
  3896. #define bfd_copy_private_bfd_data(ibfd, obfd) \
  3897. BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
  3898. (ibfd, obfd))
  3899. bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
  3900. #define bfd_merge_private_bfd_data(ibfd, obfd) \
  3901. BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
  3902. (ibfd, obfd))
  3903. bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
  3904. #define bfd_set_private_flags(abfd, flags) \
  3905. BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
  3906. #define bfd_sizeof_headers(abfd, info) \
  3907. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
  3908. #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
  3909. BFD_SEND (abfd, _bfd_find_nearest_line, \
  3910. (abfd, sec, syms, off, file, func, line))
  3911. #define bfd_find_line(abfd, syms, sym, file, line) \
  3912. BFD_SEND (abfd, _bfd_find_line, \
  3913. (abfd, syms, sym, file, line))
  3914. #define bfd_find_inliner_info(abfd, file, func, line) \
  3915. BFD_SEND (abfd, _bfd_find_inliner_info, \
  3916. (abfd, file, func, line))
  3917. #define bfd_debug_info_start(abfd) \
  3918. BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
  3919. #define bfd_debug_info_end(abfd) \
  3920. BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
  3921. #define bfd_debug_info_accumulate(abfd, section) \
  3922. BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
  3923. #define bfd_stat_arch_elt(abfd, stat) \
  3924. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
  3925. #define bfd_update_armap_timestamp(abfd) \
  3926. BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
  3927. #define bfd_set_arch_mach(abfd, arch, mach)\
  3928. BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
  3929. #define bfd_relax_section(abfd, section, link_info, again) \
  3930. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
  3931. #define bfd_gc_sections(abfd, link_info) \
  3932. BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
  3933. #define bfd_merge_sections(abfd, link_info) \
  3934. BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
  3935. #define bfd_is_group_section(abfd, sec) \
  3936. BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
  3937. #define bfd_discard_group(abfd, sec) \
  3938. BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
  3939. #define bfd_link_hash_table_create(abfd) \
  3940. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
  3941. #define bfd_link_hash_table_free(abfd, hash) \
  3942. BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
  3943. #define bfd_link_add_symbols(abfd, info) \
  3944. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
  3945. #define bfd_link_just_syms(abfd, sec, info) \
  3946. BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
  3947. #define bfd_final_link(abfd, info) \
  3948. BFD_SEND (abfd, _bfd_final_link, (abfd, info))
  3949. #define bfd_free_cached_info(abfd) \
  3950. BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
  3951. #define bfd_get_dynamic_symtab_upper_bound(abfd) \
  3952. BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
  3953. #define bfd_print_private_bfd_data(abfd, file)\
  3954. BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
  3955. #define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
  3956. BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
  3957. #define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
  3958. BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
  3959. dyncount, dynsyms, ret))
  3960. #define bfd_get_dynamic_reloc_upper_bound(abfd) \
  3961. BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
  3962. #define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
  3963. BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
  3964. extern bfd_byte *bfd_get_relocated_section_contents
  3965. (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
  3966. bfd_boolean, asymbol **);
  3967. bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
  3968. struct bfd_preserve
  3969. {
  3970. void *marker;
  3971. void *tdata;
  3972. flagword flags;
  3973. const struct bfd_arch_info *arch_info;
  3974. struct bfd_section *sections;
  3975. struct bfd_section *section_last;
  3976. unsigned int section_count;
  3977. struct bfd_hash_table section_htab;
  3978. };
  3979. bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
  3980. void bfd_preserve_restore (bfd *, struct bfd_preserve *);
  3981. void bfd_preserve_finish (bfd *, struct bfd_preserve *);
  3982. bfd_vma bfd_emul_get_maxpagesize (const char *);
  3983. void bfd_emul_set_maxpagesize (const char *, bfd_vma);
  3984. bfd_vma bfd_emul_get_commonpagesize (const char *);
  3985. void bfd_emul_set_commonpagesize (const char *, bfd_vma);
  3986. /* Extracted from archive.c. */
  3987. symindex bfd_get_next_mapent
  3988. (bfd *abfd, symindex previous, carsym **sym);
  3989. bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
  3990. bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
  3991. /* Extracted from corefile.c. */
  3992. const char *bfd_core_file_failing_command (bfd *abfd);
  3993. int bfd_core_file_failing_signal (bfd *abfd);
  3994. bfd_boolean core_file_matches_executable_p
  3995. (bfd *core_bfd, bfd *exec_bfd);
  3996. bfd_boolean generic_core_file_matches_executable_p
  3997. (bfd *core_bfd, bfd *exec_bfd);
  3998. /* Extracted from targets.c. */
  3999. #define BFD_SEND(bfd, message, arglist) \
  4000. ((*((bfd)->xvec->message)) arglist)
  4001. #ifdef DEBUG_BFD_SEND
  4002. #undef BFD_SEND
  4003. #define BFD_SEND(bfd, message, arglist) \
  4004. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
  4005. ((*((bfd)->xvec->message)) arglist) : \
  4006. (bfd_assert (__FILE__,__LINE__), NULL))
  4007. #endif
  4008. #define BFD_SEND_FMT(bfd, message, arglist) \
  4009. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
  4010. #ifdef DEBUG_BFD_SEND
  4011. #undef BFD_SEND_FMT
  4012. #define BFD_SEND_FMT(bfd, message, arglist) \
  4013. (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
  4014. (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
  4015. (bfd_assert (__FILE__,__LINE__), NULL))
  4016. #endif
  4017. enum bfd_flavour
  4018. {
  4019. bfd_target_unknown_flavour,
  4020. bfd_target_aout_flavour,
  4021. bfd_target_coff_flavour,
  4022. bfd_target_ecoff_flavour,
  4023. bfd_target_xcoff_flavour,
  4024. bfd_target_elf_flavour,
  4025. bfd_target_ieee_flavour,
  4026. bfd_target_nlm_flavour,
  4027. bfd_target_oasys_flavour,
  4028. bfd_target_tekhex_flavour,
  4029. bfd_target_srec_flavour,
  4030. bfd_target_ihex_flavour,
  4031. bfd_target_som_flavour,
  4032. bfd_target_os9k_flavour,
  4033. bfd_target_versados_flavour,
  4034. bfd_target_msdos_flavour,
  4035. bfd_target_ovax_flavour,
  4036. bfd_target_evax_flavour,
  4037. bfd_target_mmo_flavour,
  4038. bfd_target_mach_o_flavour,
  4039. bfd_target_pef_flavour,
  4040. bfd_target_pef_xlib_flavour,
  4041. bfd_target_sym_flavour
  4042. };
  4043. enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
  4044. /* Forward declaration. */
  4045. typedef struct bfd_link_info _bfd_link_info;
  4046. typedef struct bfd_target
  4047. {
  4048. /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
  4049. char *name;
  4050. /* The "flavour" of a back end is a general indication about
  4051. the contents of a file. */
  4052. enum bfd_flavour flavour;
  4053. /* The order of bytes within the data area of a file. */
  4054. enum bfd_endian byteorder;
  4055. /* The order of bytes within the header parts of a file. */
  4056. enum bfd_endian header_byteorder;
  4057. /* A mask of all the flags which an executable may have set -
  4058. from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>. */
  4059. flagword object_flags;
  4060. /* A mask of all the flags which a section may have set - from
  4061. the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>. */
  4062. flagword section_flags;
  4063. /* The character normally found at the front of a symbol.
  4064. (if any), perhaps `_'. */
  4065. char symbol_leading_char;
  4066. /* The pad character for file names within an archive header. */
  4067. char ar_pad_char;
  4068. /* The maximum number of characters in an archive header. */
  4069. unsigned short ar_max_namelen;
  4070. /* Entries for byte swapping for data. These are different from the
  4071. other entry points, since they don't take a BFD as the first argument.
  4072. Certain other handlers could do the same. */
  4073. bfd_uint64_t (*bfd_getx64) (const void *);
  4074. bfd_int64_t (*bfd_getx_signed_64) (const void *);
  4075. void (*bfd_putx64) (bfd_uint64_t, void *);
  4076. bfd_vma (*bfd_getx32) (const void *);
  4077. bfd_signed_vma (*bfd_getx_signed_32) (const void *);
  4078. void (*bfd_putx32) (bfd_vma, void *);
  4079. bfd_vma (*bfd_getx16) (const void *);
  4080. bfd_signed_vma (*bfd_getx_signed_16) (const void *);
  4081. void (*bfd_putx16) (bfd_vma, void *);
  4082. /* Byte swapping for the headers. */
  4083. bfd_uint64_t (*bfd_h_getx64) (const void *);
  4084. bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
  4085. void (*bfd_h_putx64) (bfd_uint64_t, void *);
  4086. bfd_vma (*bfd_h_getx32) (const void *);
  4087. bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
  4088. void (*bfd_h_putx32) (bfd_vma, void *);
  4089. bfd_vma (*bfd_h_getx16) (const void *);
  4090. bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
  4091. void (*bfd_h_putx16) (bfd_vma, void *);
  4092. /* Format dependent routines: these are vectors of entry points
  4093. within the target vector structure, one for each format to check. */
  4094. /* Check the format of a file being read. Return a <<bfd_target *>> or zero. */
  4095. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
  4096. /* Set the format of a file being written. */
  4097. bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
  4098. /* Write cached information into a file being written, at <<bfd_close>>. */
  4099. bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
  4100. /* Generic entry points. */
  4101. #define BFD_JUMP_TABLE_GENERIC(NAME) \
  4102. NAME##_close_and_cleanup, \
  4103. NAME##_bfd_free_cached_info, \
  4104. NAME##_new_section_hook, \
  4105. NAME##_get_section_contents, \
  4106. NAME##_get_section_contents_in_window
  4107. /* Called when the BFD is being closed to do any necessary cleanup. */
  4108. bfd_boolean (*_close_and_cleanup) (bfd *);
  4109. /* Ask the BFD to free all cached information. */
  4110. bfd_boolean (*_bfd_free_cached_info) (bfd *);
  4111. /* Called when a new section is created. */
  4112. bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
  4113. /* Read the contents of a section. */
  4114. bfd_boolean (*_bfd_get_section_contents)
  4115. (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
  4116. bfd_boolean (*_bfd_get_section_contents_in_window)
  4117. (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
  4118. /* Entry points to copy private data. */
  4119. #define BFD_JUMP_TABLE_COPY(NAME) \
  4120. NAME##_bfd_copy_private_bfd_data, \
  4121. NAME##_bfd_merge_private_bfd_data, \
  4122. _bfd_generic_init_private_section_data, \
  4123. NAME##_bfd_copy_private_section_data, \
  4124. NAME##_bfd_copy_private_symbol_data, \
  4125. NAME##_bfd_copy_private_header_data, \
  4126. NAME##_bfd_set_private_flags, \
  4127. NAME##_bfd_print_private_bfd_data
  4128. /* Called to copy BFD general private data from one object file
  4129. to another. */
  4130. bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
  4131. /* Called to merge BFD general private data from one object file
  4132. to a common output file when linking. */
  4133. bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
  4134. /* Called to initialize BFD private section data from one object file
  4135. to another. */
  4136. #define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
  4137. BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info))
  4138. bfd_boolean (*_bfd_init_private_section_data)
  4139. (bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *);
  4140. /* Called to copy BFD private section data from one object file
  4141. to another. */
  4142. bfd_boolean (*_bfd_copy_private_section_data)
  4143. (bfd *, sec_ptr, bfd *, sec_ptr);
  4144. /* Called to copy BFD private symbol data from one symbol
  4145. to another. */
  4146. bfd_boolean (*_bfd_copy_private_symbol_data)
  4147. (bfd *, asymbol *, bfd *, asymbol *);
  4148. /* Called to copy BFD private header data from one object file
  4149. to another. */
  4150. bfd_boolean (*_bfd_copy_private_header_data)
  4151. (bfd *, bfd *);
  4152. /* Called to set private backend flags. */
  4153. bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
  4154. /* Called to print private BFD data. */
  4155. bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
  4156. /* Core file entry points. */
  4157. #define BFD_JUMP_TABLE_CORE(NAME) \
  4158. NAME##_core_file_failing_command, \
  4159. NAME##_core_file_failing_signal, \
  4160. NAME##_core_file_matches_executable_p
  4161. char * (*_core_file_failing_command) (bfd *);
  4162. int (*_core_file_failing_signal) (bfd *);
  4163. bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
  4164. /* Archive entry points. */
  4165. #define BFD_JUMP_TABLE_ARCHIVE(NAME) \
  4166. NAME##_slurp_armap, \
  4167. NAME##_slurp_extended_name_table, \
  4168. NAME##_construct_extended_name_table, \
  4169. NAME##_truncate_arname, \
  4170. NAME##_write_armap, \
  4171. NAME##_read_ar_hdr, \
  4172. NAME##_openr_next_archived_file, \
  4173. NAME##_get_elt_at_index, \
  4174. NAME##_generic_stat_arch_elt, \
  4175. NAME##_update_armap_timestamp
  4176. bfd_boolean (*_bfd_slurp_armap) (bfd *);
  4177. bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
  4178. bfd_boolean (*_bfd_construct_extended_name_table)
  4179. (bfd *, char **, bfd_size_type *, const char **);
  4180. void (*_bfd_truncate_arname) (bfd *, const char *, char *);
  4181. bfd_boolean (*write_armap)
  4182. (bfd *, unsigned int, struct orl *, unsigned int, int);
  4183. void * (*_bfd_read_ar_hdr_fn) (bfd *);
  4184. bfd * (*openr_next_archived_file) (bfd *, bfd *);
  4185. #define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
  4186. bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
  4187. int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
  4188. bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
  4189. /* Entry points used for symbols. */
  4190. #define BFD_JUMP_TABLE_SYMBOLS(NAME) \
  4191. NAME##_get_symtab_upper_bound, \
  4192. NAME##_canonicalize_symtab, \
  4193. NAME##_make_empty_symbol, \
  4194. NAME##_print_symbol, \
  4195. NAME##_get_symbol_info, \
  4196. NAME##_bfd_is_local_label_name, \
  4197. NAME##_bfd_is_target_special_symbol, \
  4198. NAME##_get_lineno, \
  4199. NAME##_find_nearest_line, \
  4200. _bfd_generic_find_line, \
  4201. NAME##_find_inliner_info, \
  4202. NAME##_bfd_make_debug_symbol, \
  4203. NAME##_read_minisymbols, \
  4204. NAME##_minisymbol_to_symbol
  4205. long (*_bfd_get_symtab_upper_bound) (bfd *);
  4206. long (*_bfd_canonicalize_symtab)
  4207. (bfd *, struct bfd_symbol **);
  4208. struct bfd_symbol *
  4209. (*_bfd_make_empty_symbol) (bfd *);
  4210. void (*_bfd_print_symbol)
  4211. (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
  4212. #define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
  4213. void (*_bfd_get_symbol_info)
  4214. (bfd *, struct bfd_symbol *, symbol_info *);
  4215. #define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
  4216. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
  4217. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
  4218. alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
  4219. bfd_boolean (*_bfd_find_nearest_line)
  4220. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
  4221. const char **, const char **, unsigned int *);
  4222. bfd_boolean (*_bfd_find_line)
  4223. (bfd *, struct bfd_symbol **, struct bfd_symbol *,
  4224. const char **, unsigned int *);
  4225. bfd_boolean (*_bfd_find_inliner_info)
  4226. (bfd *, const char **, const char **, unsigned int *);
  4227. /* Back-door to allow format-aware applications to create debug symbols
  4228. while using BFD for everything else. Currently used by the assembler
  4229. when creating COFF files. */
  4230. asymbol * (*_bfd_make_debug_symbol)
  4231. (bfd *, void *, unsigned long size);
  4232. #define bfd_read_minisymbols(b, d, m, s) \
  4233. BFD_SEND (b, _read_minisymbols, (b, d, m, s))
  4234. long (*_read_minisymbols)
  4235. (bfd *, bfd_boolean, void **, unsigned int *);
  4236. #define bfd_minisymbol_to_symbol(b, d, m, f) \
  4237. BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
  4238. asymbol * (*_minisymbol_to_symbol)
  4239. (bfd *, bfd_boolean, const void *, asymbol *);
  4240. /* Routines for relocs. */
  4241. #define BFD_JUMP_TABLE_RELOCS(NAME) \
  4242. NAME##_get_reloc_upper_bound, \
  4243. NAME##_canonicalize_reloc, \
  4244. NAME##_bfd_reloc_type_lookup
  4245. long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
  4246. long (*_bfd_canonicalize_reloc)
  4247. (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
  4248. /* See documentation on reloc types. */
  4249. reloc_howto_type *
  4250. (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
  4251. /* Routines used when writing an object file. */
  4252. #define BFD_JUMP_TABLE_WRITE(NAME) \
  4253. NAME##_set_arch_mach, \
  4254. NAME##_set_section_contents
  4255. bfd_boolean (*_bfd_set_arch_mach)
  4256. (bfd *, enum bfd_architecture, unsigned long);
  4257. bfd_boolean (*_bfd_set_section_contents)
  4258. (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
  4259. /* Routines used by the linker. */
  4260. #define BFD_JUMP_TABLE_LINK(NAME) \
  4261. NAME##_sizeof_headers, \
  4262. NAME##_bfd_get_relocated_section_contents, \
  4263. NAME##_bfd_relax_section, \
  4264. NAME##_bfd_link_hash_table_create, \
  4265. NAME##_bfd_link_hash_table_free, \
  4266. NAME##_bfd_link_add_symbols, \
  4267. NAME##_bfd_link_just_syms, \
  4268. NAME##_bfd_final_link, \
  4269. NAME##_bfd_link_split_section, \
  4270. NAME##_bfd_gc_sections, \
  4271. NAME##_bfd_merge_sections, \
  4272. NAME##_bfd_is_group_section, \
  4273. NAME##_bfd_discard_group, \
  4274. NAME##_section_already_linked \
  4275. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
  4276. bfd_byte * (*_bfd_get_relocated_section_contents)
  4277. (bfd *, struct bfd_link_info *, struct bfd_link_order *,
  4278. bfd_byte *, bfd_boolean, struct bfd_symbol **);
  4279. bfd_boolean (*_bfd_relax_section)
  4280. (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
  4281. /* Create a hash table for the linker. Different backends store
  4282. different information in this table. */
  4283. struct bfd_link_hash_table *
  4284. (*_bfd_link_hash_table_create) (bfd *);
  4285. /* Release the memory associated with the linker hash table. */
  4286. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
  4287. /* Add symbols from this object file into the hash table. */
  4288. bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
  4289. /* Indicate that we are only retrieving symbol values from this section. */
  4290. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
  4291. /* Do a link based on the link_order structures attached to each
  4292. section of the BFD. */
  4293. bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
  4294. /* Should this section be split up into smaller pieces during linking. */
  4295. bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
  4296. /* Remove sections that are not referenced from the output. */
  4297. bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
  4298. /* Attempt to merge SEC_MERGE sections. */
  4299. bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
  4300. /* Is this section a member of a group? */
  4301. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
  4302. /* Discard members of a group. */
  4303. bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
  4304. /* Check if SEC has been already linked during a reloceatable or
  4305. final link. */
  4306. void (*_section_already_linked) (bfd *, struct bfd_section *,
  4307. struct bfd_link_info *);
  4308. /* Routines to handle dynamic symbols and relocs. */
  4309. #define BFD_JUMP_TABLE_DYNAMIC(NAME) \
  4310. NAME##_get_dynamic_symtab_upper_bound, \
  4311. NAME##_canonicalize_dynamic_symtab, \
  4312. NAME##_get_synthetic_symtab, \
  4313. NAME##_get_dynamic_reloc_upper_bound, \
  4314. NAME##_canonicalize_dynamic_reloc
  4315. /* Get the amount of memory required to hold the dynamic symbols. */
  4316. long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
  4317. /* Read in the dynamic symbols. */
  4318. long (*_bfd_canonicalize_dynamic_symtab)
  4319. (bfd *, struct bfd_symbol **);
  4320. /* Create synthetized symbols. */
  4321. long (*_bfd_get_synthetic_symtab)
  4322. (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
  4323. struct bfd_symbol **);
  4324. /* Get the amount of memory required to hold the dynamic relocs. */
  4325. long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
  4326. /* Read in the dynamic relocs. */
  4327. long (*_bfd_canonicalize_dynamic_reloc)
  4328. (bfd *, arelent **, struct bfd_symbol **);
  4329. /* Opposite endian version of this target. */
  4330. const struct bfd_target * alternative_target;
  4331. /* Data for use by back-end routines, which isn't
  4332. generic enough to belong in this structure. */
  4333. const void *backend_data;
  4334. } bfd_target;
  4335. bfd_boolean bfd_set_default_target (const char *name);
  4336. const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
  4337. const char ** bfd_target_list (void);
  4338. const bfd_target *bfd_search_for_target
  4339. (int (*search_func) (const bfd_target *, void *),
  4340. void *);
  4341. /* Extracted from format.c. */
  4342. bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
  4343. bfd_boolean bfd_check_format_matches
  4344. (bfd *abfd, bfd_format format, char ***matching);
  4345. bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
  4346. const char *bfd_format_string (bfd_format format);
  4347. /* Extracted from linker.c. */
  4348. bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
  4349. #define bfd_link_split_section(abfd, sec) \
  4350. BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
  4351. void bfd_section_already_linked (bfd *abfd, asection *sec,
  4352. struct bfd_link_info *info);
  4353. #define bfd_section_already_linked(abfd, sec, info) \
  4354. BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
  4355. /* Extracted from simple.c. */
  4356. bfd_byte *bfd_simple_get_relocated_section_contents
  4357. (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
  4358. #ifdef __cplusplus
  4359. }
  4360. #endif
  4361. #endif